Ejemplo n.º 1
0
 def __init__(self, name, tables):
     """init Chains object"""
     UserDict.__init__(self)
     self.name = name
     self.tables = tables
     self.predef = tables
     self.reset()  # name, tables)
Ejemplo n.º 2
0
    def __init__(self):
        UserDict.__init__(self)
        self.__format__ = '<4f3f'
        self.__size__ = struct.calcsize(self.__format__)

        self['quat'] = [None, None, None, None]
        self['position'] = [None, None, None]
Ejemplo n.º 3
0
    def __init__(self,
                 taskmanager_id,
                 state="NEW",
                 generation_id=None,
                 generation_time=None,
                 missed_update_count=0):
        """
        Initialize Metadata object

        :type taskmanager_id: :obj:`string`
        :type state: :obj:`string`
        :type generation_id: :obj:`int`
        :type generation_time: :obj:`float`
        :type missed_update_count: :obj:`int`
        """
        UserDict.__init__(self)
        if state not in Metadata.valid_states:
            structlog.getLogger(LOGGERNAME).exception(
                f"Invalid Metadata state: {state}")
            raise InvalidMetadataError()
        if not generation_time:
            generation_time = time.time()

        self.data = {
            "taskmanager_id": taskmanager_id,
            "state": state,
            "generation_id": generation_id,
            "generation_time": int(generation_time),
            "missed_update_count": missed_update_count,
        }
Ejemplo n.º 4
0
    def __init__(self, cellbase_dict):
        """Initialise a ClinVar record object from JSON data. See /clinvar-variant-types/README.md for the in-depth
        explanation of ClinVar data model. See also issue https://github.com/EBIvariation/eva-opentargets/issues/127
        for the most recent discussions on changing support of different ClinVar record types.
        """
        UserDict.__init__(self, cellbase_dict)
        if 'measureSet' in self.data['referenceClinVarAssertion']:
            # MeasureSet provides information on a variant or a set of variants located on the same chromosomal copy.
            if self.data['referenceClinVarAssertion']['measureSet'][
                    'type'] == 'Variant':
                # The measure "list" actually only contains a single variant. This is the only case we are currently
                # supporting. As of July 2020, it accounts for >99.7% of all ClinVar records.
                measure_list = self.data['referenceClinVarAssertion'][
                    'measureSet']['measure']
            else:
                # Uncommon record types, such as "Haplotype", "Phase unknown", or "Distinct chromosomes".
                # Not currently supported.
                measure_list = []
        elif 'measureSet' in self.data['referenceClinVarAssertion'][
                'genotypeSet']:
            # The record contains a GenotypeSet, a rare subtype which contains an assertion about a group of variants
            # from several chromosome copies. This could be either a CompoundHeterozygote or a Diplotype, and those
            # types are currently not processed.
            measure_list = []
        else:
            raise KeyError(
                'ClinVar record contains neither a MeasureSet, nor a GenotypeSet'
            )

        self.measures = [
            ClinvarRecordMeasure(measure_dict, self)
            for measure_dict in measure_list
        ]
Ejemplo n.º 5
0
    def __init__(self, model, query_parameters, *args, **kwargs):
        self._model = model

        # Core options, not modifiable by client updates
        if 'columns' not in kwargs:
            model_fields = model._meta.local_fields
            kwargs['columns'] = list(map(lambda f: (six.text_type(f.verbose_name), f.name), model_fields))

        if 'hidden_columns' not in kwargs or kwargs['hidden_columns'] is None:
            kwargs['hidden_columns'] = []

        if 'search_fields' not in kwargs or kwargs['search_fields'] is None:
            kwargs['search_fields'] = []

        if 'unsortable_columns' not in kwargs or kwargs['unsortable_columns'] is None:
            kwargs['unsortable_columns'] = []

        # Absorb query GET params
        kwargs = self._normalize_options(query_parameters, kwargs)

        UserDict.__init__(self, DEFAULT_OPTIONS, *args, **kwargs)

        self._flat_column_names = []
        for column in self['columns']:
            column = get_field_definition(column)
            flat_name = column.pretty_name
            if column.fields:
                flat_name = column.fields[0]
            self._flat_column_names.append(flat_name)
Ejemplo n.º 6
0
    def __init__(self, model, query_parameters, *args, **kwargs):
        self._model = model

        # Core options, not modifiable by client updates
        if 'columns' not in kwargs:
            model_fields = model._meta.local_fields
            kwargs['columns'] = list(
                map(lambda f: (six.text_type(f.verbose_name), f.name),
                    model_fields))

        if 'hidden_columns' not in kwargs or kwargs['hidden_columns'] is None:
            kwargs['hidden_columns'] = []

        if 'search_fields' not in kwargs or kwargs['search_fields'] is None:
            kwargs['search_fields'] = []

        if 'unsortable_columns' not in kwargs or kwargs[
                'unsortable_columns'] is None:
            kwargs['unsortable_columns'] = []

        # Absorb query GET params
        kwargs = self._normalize_options(query_parameters, kwargs)

        UserDict.__init__(self, DEFAULT_OPTIONS, *args, **kwargs)

        self._flat_column_names = []
        for column in self['columns']:
            column = get_field_definition(column)
            flat_name = column.pretty_name
            if column.fields:
                flat_name = column.fields[0]
            self._flat_column_names.append(flat_name)
 def __init__(self):
     UserDict.__init__(self)
     self.update({
         "order": 8,
         "sigma": 2,
         "adaptLengthInRegime": True,
         "meanThresholdMethod": thresholdOtsu,
         "meanThreshold": None,
         "mask": None,
         "nlmsMask": None,
         "nlmsThreshold": None,
         "useParallelPool": True,
         "maskDilationDiskRadius": 3,
         "maskFillHoles": False,
         "diagnosticMode": False,
         "K_sampling_delta": 0.1,
         "responseOrder": 3,
         "bridgingLevels": 2,
         "suppressionValue": 0,
         "filter": False,  #OrientationSpaceFilter(),
         "response": False,  #OrientationSpaceResponse(),
         "maxima_highest": np.empty(0),
         "K_highest": np.empty(0),
         "bridging": np.empty(0),
         "nlms_highest": np.empty(0),
         "nlms_single": np.empty(0),
     })
Ejemplo n.º 8
0
 def __init__(self, turn, data):
     UserDict.__init__(self, data)
     self._turn = turn
     self._fmt_str = None
     if 'ownerid' in self.data:
         self.data['owner'] = self._turn.find_component(
             'players', self.data['ownerid'])
Ejemplo n.º 9
0
    def __init__(self):
        UserDict.__init__(self)
        self.__format__ = '<32si'
        self.__size__ = struct.calcsize(self.__format__)

        self['boneName'] = None
        self['boneType'] = None
Ejemplo n.º 10
0
 def __init__(self,schema,dn,entry):
   self._keytuple2attrtype = {}
   self._attrtype2keytuple = {}
   self._s = schema
   self.dn = dn
   UserDict.__init__(self,{})
   self.update(entry)
Ejemplo n.º 11
0
    def __init__(self):
        UserDict.__init__(self)
        self.__format__ = '<4f3f'
        self.__size__ = struct.calcsize(self.__format__)

        self['quat'] = [None, None, None, None]
        self['position'] = [None, None, None]
Ejemplo n.º 12
0
    def __init__(self,
                 taskmanager_id,
                 create_time=None,
                 expiration_time=None,
                 scheduled_create_time=None,
                 creator='module',
                 schema_id=None):
        """
        Initialize Header object

        :type taskmanager_id: :obj:`string`
        :type create_time: :obj:`float`
        :type expiration_time: :obj:`float`
        :type scheduled_create_time: :obj:`float`
        :type creator: :obj:`string`
        :type schema_id: :obj:`int`
        """

        UserDict.__init__(self)
        if not create_time:
            create_time = time.time()
        if not expiration_time:
            expiration_time = create_time + Header.default_data_lifetime
        if not scheduled_create_time:
            scheduled_create_time = time.time()

        self.data = {
            'taskmanager_id': taskmanager_id,
            'create_time': int(create_time),
            'expiration_time': int(expiration_time),
            'scheduled_create_time': int(scheduled_create_time),
            'creator': creator,
            'schema_id': schema_id
        }
Ejemplo n.º 13
0
 def __init__(self, filepath):
     
     try:
         if os.path.exists(filepath):
             UserDict.__init__(self)
             st = os.stat(filepath)
             self['id'] = id(self)
             self['full_name'] = filepath
             self['size'] = st.st_size
             self['sizeh'] = approximate_size(st.st_size,a_kilobyte_is_1024_bytes=False)
             self['user_id'] = st.st_uid
             self['group_id'] = st.st_gid
             self['is_directory'] = False
             self['is_file'] = False
             self['is_link'] = False
             self['extension'] = ''
             if (os.path.isdir((self['full_name']))):
                 self['is_directory'] = True
             if (os.path.isfile((self['full_name']))):
                 self['is_file'] = True
             if (os.path.isdir((self['full_name']))):
                 self['is_link'] = True
             if self['is_file']:
                 self['extension'] = filepath.split(os.extsep)[len(filepath.split(os.extsep))-1]
         else:
             raise IOError
     except IOError:
         log.error("File {0} doesn't exist.".format(filepath))
         sys.exit(1)
Ejemplo n.º 14
0
 def __init__(self):
     UserDict.__init__(self)
     self.__format__ = '<i2h'
     self.__size__ = struct.calcsize(self.__format__)
     self['magic'] = None
     self['numMaterials'] = None
     self['numObjects'] = None
Ejemplo n.º 15
0
 def __init__(self, name, tables):
     """init Chains object"""
     UserDict.__init__(self)
     self.name = name
     self.tables = tables
     self.predef = tables
     self.reset()  # name, tables)
Ejemplo n.º 16
0
 def __init__(self, isisdict):
     UserDict.__init__(self)
     if isisdict is not None:
         UserDict.__init__(self, isisdict)
     self["LatitudeType"] = "Planetographic"
     self["LongitudeDirection"] = "PositiveEast"
     self["LongitudeDomain"] = "180"
Ejemplo n.º 17
0
 def __init__(self, schema, dn, entry):
     self._keytuple2attrtype = {}
     self._attrtype2keytuple = {}
     self._s = schema
     self.dn = dn
     UserDict.__init__(self, {})
     self.update(entry)
Ejemplo n.º 18
0
    def __init__(self,
                 taskmanager_id,
                 state='NEW',
                 generation_id=None,
                 generation_time=None,
                 missed_update_count=0):
        """
        Initialize Metadata object

        :type taskmanager_id: :obj:`string`
        :type state: :obj:`string`
        :type generation_id: :obj:`int`
        :type generation_time: :obj:`float`
        :type missed_update_count: :obj:`int`
        """
        UserDict.__init__(self)
        if state not in Metadata.valid_states:
            logging.getLogger().exception(f'Invalid Metadata state: {state}')
            raise InvalidMetadataError()
        if not generation_time:
            generation_time = time.time()

        self.data = {
            'taskmanager_id': taskmanager_id,
            'state': state,
            'generation_id': generation_id,
            'generation_time': int(generation_time),
            'missed_update_count': missed_update_count
        }
Ejemplo n.º 19
0
    def __init__(self):
        UserDict.__init__(self)
        self.__format__ = '<32si'
        self.__size__ = struct.calcsize(self.__format__)

        self['boneName'] = None
        self['boneType'] = None
Ejemplo n.º 20
0
    def __init__(
        self,
        keyfile=None,
        certfile=None,
        ssl_version="PROTOCOL_SSLv23",
        ca_certs=None,
        do_handshake_on_connect=True,
        cert_reqs=CERT_NONE,
        suppress_ragged_eofs=True,
        ciphers=None,
        **kwargs,
    ):
        """settings of SSL

        :param keyfile: SSL key file path usally end with ".key"
        :param certfile: SSL cert file path usally end with ".crt"
        """
        UserDict.__init__(self)
        self.data.update(
            dict(
                keyfile=keyfile,
                certfile=certfile,
                server_side=True,
                ssl_version=getattr(ssl, ssl_version, ssl.PROTOCOL_SSLv23),
                ca_certs=ca_certs,
                do_handshake_on_connect=do_handshake_on_connect,
                cert_reqs=cert_reqs,
                suppress_ragged_eofs=suppress_ragged_eofs,
                ciphers=ciphers,
            ))
Ejemplo n.º 21
0
    def __init__(self, model, query_parameters, *args, **kwargs):
        self._model = model

        # Core options, not modifiable by client updates
        if 'columns' not in kwargs:
            model_fields = model._meta.local_fields
            kwargs['columns'] = map(lambda f: f.verbose_name.capitalize(),
                                    model_fields)

        if 'hidden_columns' not in kwargs or kwargs['hidden_columns'] is None:
            kwargs['hidden_columns'] = []

        if 'search_fields' not in kwargs or kwargs['search_fields'] is None:
            kwargs['search_fields'] = []

        # Absorb query GET params
        kwargs = self._normalize_options(query_parameters, kwargs)

        UserDict.__init__(self, DEFAULT_OPTIONS, *args, **kwargs)

        self._flat_column_names = []
        for field_name in self.columns:
            if isinstance(field_name, (tuple, list)):
                pretty_name, field_name = field_name[:2]

            if not field_name or isinstance(field_name, (tuple, list)):
                field_name = pretty_name

            self._flat_column_names.append(field_name)
Ejemplo n.º 22
0
 def __init__(self, sid=None, expire=3600):
     UserDict.__init__(self)
     self.sid = sid
     if sid:
         self._load()
     else:
         self._create_sid()
Ejemplo n.º 23
0
    def __init__(self, d=None, path=None):
        if not path:
            path = os.path.join(os.getcwd(), 'project.pbxproj')

        self.pbxproj_path = os.path.abspath(path)
        self.source_root = os.path.abspath(os.path.join(os.path.split(path)[0], '..'))

        UserDict.__init__(self, d)

        self.data = PBXDict(self.data)
        self.objects = self.get('objects')
        self.modified = False

        root_id = self.get('rootObject')

        if root_id:
            self.root_object = self.objects[root_id]
            root_group_id = self.root_object.get('mainGroup')
            self.root_group = self.objects[root_group_id]
        else:
            print("error: project has no root object")
            self.root_object = None
            self.root_group = None

        for k, v in self.objects.items():
            v.id = k
Ejemplo n.º 24
0
    def __init__(self):
        """

        :param data_filename:
        """
        self.data_filename = os.path.dirname(__file__) + '/unicode.dat'
        self.str = [None, ] * 65536

        lines = open(self.data_filename).readlines()
        UserDict.__init__(self)
        for line in lines:
            fields = line.split()
            for i, field in enumerate(fields):
                if field.startswith('"') and field.endswith('"'):
                    fields[i] = field[1:-1]
            if len(fields) > 3:
                try:
                    code = int(fields[0].split(':')[0].split(';')[0])
                    entity = fields[1]
                    self[entity] = UnicodeChar(fields)  # keep entity table

                    if len(fields) > 4:  # keep code table
                        if not self.str[code]:
                            self.str[code] = self[entity]
                        else:
                            pass
                except ValueError:
                    pass
Ejemplo n.º 25
0
 def __init__(self):
     UserDict.__init__(self)
     self.__format__ = '<8s3i'
     self.__size__ = struct.calcsize(self.__format__)
     self['fileType'] = None
     self['numObjects'] = None
     self['skeletonHash'] = None
     self['numElements'] = None
Ejemplo n.º 26
0
 def __init__(self):
     UserDict.__init__(self)
     self.__format__ = '<32sif12f'
     self.__size__ = struct.calcsize(self.__format__)
     self['name'] = None
     self['parent'] = None
     self['scale'] = None
     self['matrix'] = [[],[],[]]
Ejemplo n.º 27
0
 def __init__(self):
     UserDict.__init__(self)
     self.__format__ = '<8s3i'
     self.__size__ = struct.calcsize(self.__format__)
     self['fileType'] = None
     self['numObjects'] = None
     self['skeletonHash'] = None
     self['numElements'] = None
Ejemplo n.º 28
0
    def __init__(self, keys=None):
        """Initialize from a ParameterSet to create an empty mapping of
        parameters.

        :param keys: iterable of parameter names
        """
        UserDict.__init__(self)
        self._keys = keys if keys is not None else ParameterSet()
Ejemplo n.º 29
0
 def __init__(self, file_path = None):
     UserDict.__init__(self)
     if not os.path.exists(file_path):
         os.makedirs(file_path)
     self["path"] = file_path
     self["file"] = []
     self["directory"] = []
     self.__parse(self["path"])
Ejemplo n.º 30
0
 def __init__(self, owner_player, data):
     UserDict.__init__(self, data)
     self.owner = owner_player
     self.obj_map = {'planets':   baseobjects.Planet,
                     'starbases': baseobjects.Starbase,
                     'ships':     baseobjects.Ship,
                     'engines':   baseobjects.Engine,
                     'torpedos':  baseobjects.Launcher}
Ejemplo n.º 31
0
 def __init__(self):
     UserDict.__init__(self)
     self.__format__ = '<32sif12f'
     self.__size__ = struct.calcsize(self.__format__)
     self['name'] = None
     self['parent'] = None
     self['scale'] = None
     self['matrix'] = [[], [], []]
Ejemplo n.º 32
0
 def __init__(self, data={}, **kwds):
     """Create a new profile based on the class defaults, which are
     overlaid with items from the `data` dict and keyword arguments."""
     UserDict.__init__(self)
     initdata = self.defaults.copy()
     initdata.update(data)
     initdata.update(**kwds)
     self.data.update(initdata)
Ejemplo n.º 33
0
 def __init__(self, save_target):
     UserDict.__init__(self)
     self.path = None if isinstance(save_target, FileIdMap) else Path(save_target)
     self.parent = save_target if isinstance(save_target, FileIdMap) else None
     if self.path is None and self.parent is None:
         raise ValueError("Bad stuff in " + repr(save_target))
     self._initialized = False
     self._initialize_dict()
     self.save()
Ejemplo n.º 34
0
 def __init__(self, *args, **kwargs):
     """ Create a Message object
     @type: string denoting the message type. Standardization efforts are in progress.
     @id: identifier for message. Usually a nonce or a DID. This combined with the type
         tell us how to interpret the message.
     other things: ambiguous data. Interpretation defined by type and id.
     """
     UserDict.__init__(self,*args, **kwargs)
     self.context = {}
Ejemplo n.º 35
0
    def __init__(self, bot):
        UserDict.__init__(self)
        self.bot = bot
        self.streamer = bot.streamer
        self.db_session = DBManager.create_session()
        self.custom_data = []
        self.bttv_emote_manager = BTTVEmoteManager(self)

        self.bot.execute_every(60 * 60 * 2, self.bot.action_queue.add, (self.bttv_emote_manager.update_emotes, ))
Ejemplo n.º 36
0
    def __init__(self, initial=None):
        handlers = initial or {
            'application/json': JSONHandler(),
            'application/json; charset=UTF-8': JSONHandler(),
        }

        # NOTE(jmvrbanac): Directly calling UserDict as it's not inheritable.
        # Also, this results in self.update(...) being called.
        UserDict.__init__(self, handlers)
Ejemplo n.º 37
0
 def __init__(self, sid=None, expire=3600, refresh_time=300):
     UserDict.__init__(self)
     self.sid = sid
     self._changed = False
     self._refresh_time = refresh_time
     if sid:
         self._load()
     else:
         self._create_sid()
Ejemplo n.º 38
0
    def __init__(self, url, local_file, download_time=None):
        UserDict.__init__(self)
        if download_time is None:
            download_time = datetime.datetime.fromtimestamp(time.time())
        timestr = download_time.isoformat()

        self["url"] = url
        self["local_file"] = local_file
        self["time"] = timestr
Ejemplo n.º 39
0
    def __init__(self):

        UserDict.__init__(self)
        self.data = dict()  # self.data[elementid] = list of vendors with prices
        self._vendormap = VendorMap()
        self.bricklink_initialized = False
        self.vendor_initialized = False
        self.averageprices = dict()
        self.webreader = None
Ejemplo n.º 40
0
    def __init__(self, url, local_file, download_time=None):
        UserDict.__init__(self)
        if download_time is None:
            download_time = datetime.datetime.fromtimestamp(time.time())
        timestr = download_time.isoformat()

        self['url'] = url
        self['local_file'] = local_file
        self['time'] = timestr
Ejemplo n.º 41
0
 def __init__(self, **kw):
     """usage: Object(id="human", objtype="class", parents=["living"])
        acts like normal python class and dictionary at the same time
        in addition looks for atributes from parent objects
     """
     if "from_" in kw:
         kw["from"] = kw["from_"]
         del kw["from_"]
     UserDict.__init__(self, kw)
Ejemplo n.º 42
0
 def __init__(self, bundleID, bundlePath=None, defaultsPlistName='Defaults'):
     """
     bundleId: the application bundle identifier
     bundlePath: the full bundle path (useful to test a Debug build)
     defaultsPlistName: the name of the plist that contains default values
     """
     self.__bundleID = bundleID
     self.__bundlePath = bundlePath
     UserDict.__init__(self)
     self.__setup(defaultsPlistName)
Ejemplo n.º 43
0
 def __init__(self,prefix=""):
     UserDict.__init__(self)
     self.reset()
     self.nextlabel = 0
     self.nextTemp = 0
     self.nextEnum = 0
     self.nextParamSlot = 0
     self.var_params = []
     self.prefix = prefix
     self.temp_prefix = "t__%s" % prefix
Ejemplo n.º 44
0
    def __init__(self):
        UserDict.__init__(self)
        self.__format__ = '<8s5i'
        self.__size__ = struct.calcsize(self.__format__)

        self['filetype'] = None
        self['three'] = None
        self['magic'] = None
        self['numBones'] = None
        self['numFrames'] = None
        self['fps'] = None
Ejemplo n.º 45
0
    def __init__(self):
        UserDict.__init__(self)
        self.__format__ = '<i64s4i'
        self.__size__ = struct.calcsize(self.__format__)

        self['matIndex'] = None
        self['name'] = None
        self['startVertex'] = None
        self['numVertices'] = None
        self['startIndex'] = None
        self['numIndices'] = None
Ejemplo n.º 46
0
 def __init__(self, initial={}, namespace=None):
     self._init = False
     UserDict.__init__(self, initial)
     if namespace and isclass(namespace):
         self.names = {x:getattr(namespace, x)for x in dir(namespace) if not x.startswith("_")}
         self.variables = {x:self.names[x] for x in self.names if x.startswith("var")}
         self.flags = {x:self.names[x] for x in self.names if x.startswith("flag")}
         if("levelName" in self.names):
             self.levelName = self.names["levelName"]
         else: 
             self.levelName = None
         self._init = True
    def __init__(self, initial=None, ignore=(), caseless=True, spaceless=True):
        """Initializes with possible initial value and normalizing spec.

        Initial values can be either a dictionary or an iterable of name/value
        pairs. In the latter case items are added in the given order.

        Normalizing spec has exact same semantics as with `normalize` method.
        """
        UserDict.__init__(self)
        self._keys = {}
        self._normalize = lambda s: normalize(s, ignore, caseless, spaceless)
        if initial:
            self._add_initial(initial)
Ejemplo n.º 48
0
    def __init__(self, cellbase_dict):
        UserDict.__init__(self, cellbase_dict)
        if "measureSet" in self.data['referenceClinVarAssertion']:
            measure_list = self.data['referenceClinVarAssertion']["measureSet"]["measure"]
        elif "measureSet" in self.data['referenceClinVarAssertion']["genotypeSet"]:
            measure_list = []
            for measure_set in self.data['referenceClinVarAssertion']["genotypeSet"]["measureSet"]:
                for measure in measure_set["measure"]:
                    measure_list.append(measure)
        else:
            raise KeyError()

        self.measures = [ClinvarRecordMeasure(measure_dict, self) for measure_dict in measure_list]
Ejemplo n.º 49
0
    def __init__(self, initdict=None, hook_when_init=True):
        """

        :param initdict: initialized from
        :param hook_when_init: run hook points when it is True
        """
        UserDict.__init__(self)

        if initdict:
            if hook_when_init:
                self.update(initdict)
            else:
                self.data.update(initdict)
Ejemplo n.º 50
0
    def __init__(self, bot):
        UserDict.__init__(self)
        self.bot = bot
        self.streamer = bot.streamer
        self.db_session = DBManager.create_session()
        self.custom_data = []
        self.bttv_emote_manager = BTTVEmoteManager(self)

        self.bot.execute_delayed(5, self.bot.action_queue.add, (self.bttv_emote_manager.update_emotes, ))
        self.bot.execute_every(60 * 60 * 2, self.bot.action_queue.add, (self.bttv_emote_manager.update_emotes, ))

        # Used as caching to store emotes
        self.global_emotes = []
Ejemplo n.º 51
0
    def __init__(self, url, local_file, description,
                  download_time=None, raw=None, is_accompany=False, market=''):
        UserDict.__init__(self)
        if download_time is None:
            download_time = datetime.datetime.utcnow()
        timestr = download_time.isoformat()

        self['url'] = url
        self['local_file'] = local_file
        self['description'] = description
        self['time'] = timestr
        self['raw'] = raw
        self['is_accompany'] = is_accompany
        self['market'] = market
Ejemplo n.º 52
0
 def __init__(self, overrides={}):
     UserDict.__init__(self)
     self.db_session = DBManager.create_session()
     self.default_settings = {
             'broadcaster': 'test_broadcaster',
             'ban_ascii': True,
             'ban_msg_length': True,
             'motd_interval_offline': 60,
             'motd_interval_online': 5,
             'max_msg_length': 350,
             'lines_offline': True,
             'parse_pyramids': False,
             'check_links': True,
             }
     self.default_settings.update(overrides)
Ejemplo n.º 53
0
 def __init__(self,
              destfile,
              sourcefile="reference-one",
              sloppy=False,
              ipversion=4
              ):
     """init Tables Object is easy going"""
     UserDict.__init__(self)
     self.destfile = destfile
     self.sourcefile = sourcefile
     self.sloppy = sloppy
     self.linecounter = 0
     self.tblctr = 0
     self.patterns = ""
     self.reset(sourcefile, ipversion)
Ejemplo n.º 54
0
    def __init__(self, socket_manager=None, module_manager=None, bot=None):
        UserDict.__init__(self)
        self.db_session = DBManager.create_session()

        self.internal_commands = {}
        self.db_commands = {}
        self.module_commands = {}

        self.bot = bot
        self.module_manager = module_manager

        if socket_manager:
            socket_manager.add_handler('module.update', self.on_module_reload)
            socket_manager.add_handler('command.update', self.on_command_update)
            socket_manager.add_handler('command.remove', self.on_command_remove)
Ejemplo n.º 55
0
 def __init__(self, overrides={}):
     UserDict.__init__(self)
     self.db_session = DBManager.create_session()
     self.default_settings = {
         "broadcaster": "test_broadcaster",
         "ban_ascii": True,
         "ban_msg_length": True,
         "motd_interval_offline": 60,
         "motd_interval_online": 5,
         "max_msg_length": 350,
         "lines_offline": True,
         "parse_pyramids": False,
         "parse_emote_combo": False,
         "check_links": True,
     }
     self.default_settings.update(overrides)