Ejemplo n.º 1
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)])
     self.text_label = tools.ToStr(label) if type(label) != str else label
     value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
     value = tools.ToBytes(value) if value is not None else value
     self.value = value
Ejemplo n.º 2
0
    def __init__(self, section, etype, node):
        Entry.__init__(self, section, etype, node)
        self.return_invalid_entry = fdt_util.GetBool(self._node,
                                                     'return-invalid-entry')
        self.return_unknown_contents = fdt_util.GetBool(self._node,
                                                     'return-unknown-contents')
        self.bad_update_contents = fdt_util.GetBool(self._node,
                                                    'bad-update-contents')
        self.return_contents_once = fdt_util.GetBool(self._node,
                                                     'return-contents-once')

        # Set to True when the entry is ready to process the FDT.
        self.process_fdt_ready = False
        self.never_complete_process_fdt = fdt_util.GetBool(self._node,
                                                'never-complete-process-fdt')
        self.require_args = fdt_util.GetBool(self._node, 'require-args')

        # This should be picked up by GetEntryArgsOrProps()
        self.test_existing_prop = 'existing'
        self.force_bad_datatype = fdt_util.GetBool(self._node,
                                                   'force-bad-datatype')
        (self.test_str_fdt, self.test_str_arg, self.test_int_fdt,
         self.test_int_arg, existing) = self.GetEntryArgsOrProps([
            EntryArg('test-str-fdt', str),
            EntryArg('test-str-arg', str),
            EntryArg('test-int-fdt', int),
            EntryArg('test-int-arg', int),
            EntryArg('test-existing-prop', str)], self.require_args)
        if self.force_bad_datatype:
            self.GetEntryArgsOrProps([EntryArg('test-bad-datatype-arg', bool)])
        self.return_contents = True
Ejemplo n.º 3
0
    def __init__(self, lines=None, mode=None, state=FileState.NEW):
        Entry.__init__(self, mode=mode)
        self.__lines = lines
        self.__state = state

        if self.__state == FileState.NEW:
            if self.__lines is None:
                self.__lines = []
                pass
            pass
        elif self.__state == FileState.SYNC_INMEM:
            assert self.__lines is not None, 'SYNC_INMEM implies lines not None'
            pass
        elif self.__state == FileState.SYNC_CLEAR:
            assert self.__lines is None, 'SYNC_CLEAR implies line not None'
            pass
        elif self.__state == FileState.DIRTY:
            assert self.__lines is not None, 'DIRTY implies lines not None'
            pass
        elif self.__state == FileState.VIRTUAL:
            assert self.__lines is not None, 'VIRTUAL implies lines not None'
        else:
            assert 0
            pass
        pass
Ejemplo n.º 4
0
    def __init__(self, section, etype, node):
        Entry.__init__(self, section, etype, node)
        self.return_invalid_entry = fdt_util.GetBool(self._node,
                                                     'return-invalid-entry')
        self.return_unknown_contents = fdt_util.GetBool(
            self._node, 'return-unknown-contents')
        self.bad_update_contents = fdt_util.GetBool(self._node,
                                                    'bad-update-contents')
        self.return_contents_once = fdt_util.GetBool(self._node,
                                                     'return-contents-once')

        # Set to True when the entry is ready to process the FDT.
        self.process_fdt_ready = False
        self.never_complete_process_fdt = fdt_util.GetBool(
            self._node, 'never-complete-process-fdt')
        self.require_args = fdt_util.GetBool(self._node, 'require-args')

        # This should be picked up by GetEntryArgsOrProps()
        self.test_existing_prop = 'existing'
        self.force_bad_datatype = fdt_util.GetBool(self._node,
                                                   'force-bad-datatype')
        (self.test_str_fdt, self.test_str_arg, self.test_int_fdt,
         self.test_int_arg, existing) = self.GetEntryArgsOrProps([
             EntryArg('test-str-fdt', str),
             EntryArg('test-str-arg', str),
             EntryArg('test-int-fdt', int),
             EntryArg('test-int-arg', int),
             EntryArg('test-existing-prop', str)
         ], self.require_args)
        if self.force_bad_datatype:
            self.GetEntryArgsOrProps([EntryArg('test-bad-datatype-arg', bool)])
        self.return_contents = True
Ejemplo n.º 5
0
 def __init__(self, section, etype, node, test=False):
     if not test:
         Entry.__init__(self, section, etype, node)
     self._entries = OrderedDict()
     self._pad_byte = 0
     self._sort = False
     self._skip_at_start = None
     self._end_4gb = False
Ejemplo n.º 6
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.text_label, = self.GetEntryArgsOrProps(
         [EntryArg('text-label', str)])
     self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
     if not self.value:
         self.Raise("No value provided for text label '%s'" %
                    self.text_label)
Ejemplo n.º 7
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.text_label, = self.GetEntryArgsOrProps(
         [EntryArg('text-label', str)])
     self.value, = self.GetEntryArgsOrProps(
         [EntryArg(self.text_label, str)])
     if not self.value:
         self.Raise("No value provided for text label '%s'" %
                    self.text_label)
Ejemplo n.º 8
0
    def __init__(self, section, etype, node):
        # Put this here to allow entry-docs and help to work without libfdt
        global state
        import state

        Entry.__init__(self, section, etype, node)
        self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')
        self._cbfs_entries = OrderedDict()
        self._ReadSubnodes()
        self.reader = None
Ejemplo n.º 9
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.return_invalid_entry = fdt_util.GetBool(self._node,
                                                  'return-invalid-entry')
     self.return_unknown_contents = fdt_util.GetBool(self._node,
                                                  'return-unknown-contents')
     self.bad_update_contents = fdt_util.GetBool(self._node,
                                                 'bad-update-contents')
     self.process_fdt_ready = False
     self.never_complete_process_fdt = fdt_util.GetBool(self._node,
                                             'never-complete-process-fdt')
Ejemplo n.º 10
0
    def __init__(self, section, etype, node):
        # Put these here to allow entry-docs and help to work without libfdt
        global libfdt
        global state
        global Fdt

        import libfdt
        import state
        from fdt import Fdt

        Entry.__init__(self, section, etype, node)
Ejemplo n.º 11
0
 def __init__(self, section, etype, node, test=False):
     if not test:
         Entry.__init__(self, section, etype, node)
     if section:
         self.image = section.image
     self._entries = OrderedDict()
     self._pad_byte = 0
     self._sort = False
     self._skip_at_start = None
     self._end_4gb = False
     if not test:
         self._ReadNode()
         self._ReadEntries()
Ejemplo n.º 12
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     value = fdt_util.GetString(self._node, 'text')
     if value:
         value = tools.ToBytes(value)
     else:
         label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)])
         self.text_label = label
         if self.text_label:
             value, = self.GetEntryArgsOrProps([EntryArg(self.text_label,
                                                         str)])
             value = tools.ToBytes(value) if value is not None else value
     self.value = value
Ejemplo n.º 13
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.content = fdt_util.GetPhandleList(self._node, 'content')
     if not self.content:
         self.Raise("Vblock must have a 'content' property")
     (self.keydir, self.keyblock, self.signprivate, self.version,
      self.kernelkey, self.preamble_flags) = self.GetEntryArgsOrProps([
         EntryArg('keydir', str),
         EntryArg('keyblock', str),
         EntryArg('signprivate', str),
         EntryArg('version', int),
         EntryArg('kernelkey', str),
         EntryArg('preamble-flags', int)])
Ejemplo n.º 14
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.content = fdt_util.GetPhandleList(self._node, 'content')
     if not self.content:
         self.Raise("Vblock must have a 'content' property")
     (self.keydir, self.keyblock, self.signprivate, self.version,
      self.kernelkey, self.preamble_flags) = self.GetEntryArgsOrProps([
         EntryArg('keydir', str),
         EntryArg('keyblock', str),
         EntryArg('signprivate', str),
         EntryArg('version', int),
         EntryArg('kernelkey', str),
         EntryArg('preamble-flags', int)])
Ejemplo n.º 15
0
    def __init__(self, index, parent, initials=None, name=None,
                 index_as=None, sort_as=None, meta=None, alias=None,
                 **rest):
        
        for attribute in self._generated_fields:
            setattr(self, attribute, dict.fromkeys([Entry.INFLECTION_NONE,]))
            
        Entry.__init__(self, index, parent, meta)

        # If this entry is an alias for another entry, indicate that
        # here.
        self.alias = alias

        names = escape_aware_split(name, ',')
        
        if len(names) > 1:
            last_name, first_name = names
        else:
            last_name, first_name = names[0], ''

        # Remove any preceding commas (',') and surrounding
        # whitespace.
        first_name = first_name.lstrip(',').strip()
        
        field_variable_map = [
            ('reference', 'reference'),
            ('typeset_in_text_first', 'first_name'),
            ('typeset_in_text_last', 'last_name'),
            ('typeset_in_index', 'typeset_formal'),]

        # Prepare the different local variables.
        reference = initials

        if first_name:
            typeset_formal = '%s, %s' % (last_name, first_name)
        else:
            typeset_formal = last_name

        for particle in ['the', 'von', 'van', 'van der']:
            if first_name.endswith(particle):
                last_name = ' '.join([first_name[-len(particle):], last_name])
                first_name = first_name[:-len(particle)]
                break          # Will avoid the following else-clause.
            
        variables = locals()
        
        for field, variable in field_variable_map:
            getattr(self, field)[Entry.INFLECTION_NONE] = variables[variable]

        self.index_inflection = Entry.INFLECTION_NONE
Ejemplo n.º 16
0
    def __init__(self, section, etype, node):
        Entry.__init__(self, section, etype, node)
        self.hardware_id, self.keydir, self.bmpblk = self.GetEntryArgsOrProps(
            [EntryArg('hardware-id', str),
             EntryArg('keydir', str),
             EntryArg('bmpblk', str)])

        # Read in the GBB flags from the config
        self.gbb_flags = 0
        flags_node = node.FindNode('flags')
        if flags_node:
            for flag, value in gbb_flag_properties.iteritems():
                if fdt_util.GetBool(flags_node, flag):
                    self.gbb_flags |= value
Ejemplo n.º 17
0
    def __init__(self, section, etype, node):
        Entry.__init__(self, section, etype, node)
        self.hardware_id, self.keydir, self.bmpblk = self.GetEntryArgsOrProps([
            EntryArg('hardware-id', str),
            EntryArg('keydir', str),
            EntryArg('bmpblk', str)
        ])

        # Read in the GBB flags from the config
        self.gbb_flags = 0
        flags_node = node.FindNode('flags')
        if flags_node:
            for flag, value in gbb_flag_properties.iteritems():
                if fdt_util.GetBool(flags_node, flag):
                    self.gbb_flags |= value
Ejemplo n.º 18
0
    def __init__(self, index, parent, acronym=None, indent_level=None,
                 full_form=None, meta=None, alias=None, **rest):
        # Set a couple of defining attributes before calling our base
        # constructor.
        for attribute in self._generated_fields:
            setattr(self, attribute, dict.fromkeys([Entry.INFLECTION_SINGULAR,
                                                    Entry.INFLECTION_PLURAL]))
            
        # Register this entry in the INDEX, set our PARENT and if we
        # do have a parent, add ourselves to that PARENT's set of
        # children.
        Entry.__init__(self, index, parent, meta)

        # If this entry is an alias for another entry, indicate that
        # here.
        self.alias = alias

        self._setup(acronym, full_form, self._meta, indent_level)

        # To enable a ConceptEntry to refer to an AcronymEntry:
        self.typeset_in_index = self.typeset_in_index_long
Ejemplo n.º 19
0
    def __init__(self, text='text', getter=None, setter=None, on_change=None):
        ''' Create a text entry.

        :Parameters:
        `text` : str
            Initial text
        `getter` : function()
            Function to be used to get actual value
        `setter` : function(value)
            Function to be used to set actual value
        `on_change` : function(entry)
            Function to be called when entry has changed
        '''

        self._text = text
        self._setter = setter
        self._getter = getter
        self._on_change = on_change
        Entry.__init__(self, text=text, on_change=self._on_commit)
        self._expand[0] = True
        if self._getter:
            pyglet.clock.schedule_interval(self._update_text, 0.1)
        self.text = text
Ejemplo n.º 20
0
 def __init__(self, index, parent, concept=None, indent_level=None,
              plural=None, index_as=None, sort_as=None, meta=None,
              alias=None, **rest):
     # Set a couple of defining attributes before calling our base
     # constructor.
     for attribute in self._generated_fields:
         setattr(self, attribute,
                 dict.fromkeys([Entry.INFLECTION_SINGULAR,
                                Entry.INFLECTION_PLURAL,
                                ]))
     
     # Call the base constructor.
     Entry.__init__(self, index, parent, meta)
     
     # If this entry is an alias for another entry, indicate that
     # here.
     self.alias = alias
     
     if concept:
         concept = self.unescape(concept.strip())
     else:
         concept = ''
         
     self._setup(concept, self._meta, indent_level)
Ejemplo n.º 21
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.text_label, = self.GetEntryArgsOrProps(
         [EntryArg('text-label', str)])
     self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
Ejemplo n.º 22
0
 def __init__(self, image, etype, node):
     Entry.__init__(self, image, etype, node)
Ejemplo n.º 23
0
 def __init__(self, image, etype, node):
     Entry.__init__(self, image, etype, node)
     self._section = bsection.Section(node.name, node)
Ejemplo n.º 24
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self._filename = fdt_util.GetString(self._node, "filename", self.etype)
Ejemplo n.º 25
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.location = fdt_util.GetString(self._node, 'location')
Ejemplo n.º 26
0
 def __init__(self, image, etype, node):
     Entry.__init__(self, image, etype, node)
Ejemplo n.º 27
0
 def __init__(self, name, mongo_uri, *args, **kwargs):
     collection = name.lower()
     self.store = MongoStore(mongo_uri, collection=collection)
     registers[collection] = self
     Entry.__init__(self, name=name, *args, **kwargs)
Ejemplo n.º 28
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')
     self._cbfs_entries = OrderedDict()
     self._ReadSubnodes()
     self.reader = None
Ejemplo n.º 29
0
 def __init__(self, router=None, core=None, rdonly=True):
     Entry.__init__(self, router, core)
     self._temp = Temp(self, rdonly)
Ejemplo n.º 30
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     if self.size is None:
         self.Raise("'fill' entry must have a size property")
     self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
Ejemplo n.º 31
0
 def __init__(self, vrtx, edge, attr, router=None, core=None, rdonly=True):
     Entry.__init__(self, router, core)
     self._temp = Temp(self, rdonly)
     self._vrtx = vrtx
     self._edge = edge
     self._attr = attr
Ejemplo n.º 32
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
Ejemplo n.º 33
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
Ejemplo n.º 34
0
 def __init__(self, mode=None, state=DirectoryState.INMEMORY):
     VFSDirectory.__init__(self)
     Entry.__init__(self, mode=mode)
     self.__state = state
     pass
Ejemplo n.º 35
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self._filename = fdt_util.GetString(self._node, 'filename', self.etype)
     self.compress = fdt_util.GetString(self._node, 'compress', 'none')
Ejemplo n.º 36
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     if self.size is None:
         self.Raise("'fill' entry must have a size property")
     self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
Ejemplo n.º 37
0
 def __init__(self, image, etype, node):
     Entry.__init__(self, image, etype, node)
     self._section = bsection.Section(node.name, node)
Ejemplo n.º 38
0
 def __init__(self, section, etype, node):
     Entry.__init__(self, section, etype, node)
     self.text_label, = self.GetEntryArgsOrProps(
         [EntryArg('text-label', str)])
     self.value, = self.GetEntryArgsOrProps(
         [EntryArg(self.text_label, str)])