Exemple #1
0
    def __init__(self, configuration_file=None):
        _Mapping.__init__(self)

        # Initialize values Dictionaries
        self._sections = dict()
        self._cache = dict()

        # Find configuration file to use
        configuration_file = self._find_config_file(configuration_file)

        # Read configuration file if exists
        # If not, return empty Configuration file, this will force
        # host and accelerator classes to uses defaults values
        if configuration_file:
            self._sections = self._read_config_file(configuration_file)

            # AcceleratorAPI backward compatibility
            self._legacy_backward_compatibility()
Exemple #2
0
    def __init__(self,
                 db_path: str,
                 writeback: bool = False,
                 new: bool = False):
        Mapping.__init__(self)
        Sized.__init__(self)
        self.__closed__ = False  # tag whether db is closed
        self.__path__ = db_path

        if os.path.exists(self.__path__):
            if new is True:
                os.remove(self.__path__)
            self.__db__ = shelve.open(self.__path__,
                                      writeback=writeback,
                                      protocol=None)
        else:
            if new is False:
                raise FileNotFoundError(self.__path__)
            self.__db__ = shelve.open(self.__path__,
                                      writeback=writeback,
                                      protocol=None)
Exemple #3
0
 def __init__(self):
     Mapping.__init__(self)
     self._items = {}
     self.added = Subject()
     self.removed = Subject()
     self.cleared = Subject()
 def __init__(self, game_id):
     Mapping.__init__(self)
     self._game_id = game_id  # Just for logging
     self._back = {}
 def __init__(self):
     Mapping.__init__(self)
     self._items = {}