# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/.
def __init__(self, _class): if isinstance(_class, six.string_types): assert _classin self.mapping, "Class should be one of %s; you gave %s" % (
self.mapping,
_class,
)
_class = self.mapping[_class] assert _classin self.structures, "Class should be one of %s; you gave %s" % (
self.structures,
_class,
)
self.code = _class
self.info = self.structures[_class]()
class SubscriptableReadOnlyStruct(object): def __init__(self, struct):
self._struct = struct
def _delegate(self, name):
result = getattr(self._struct, name) if isinstance(result, Structure): return SubscriptableReadOnlyStruct(result) return result
def __getitem__(self, name):
match = [fname for fname, ftype in self._struct._fields_ if fname == name] if match: return self._delegate(name) raise KeyError(name)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.