Lines Matching refs:self

52   def __init__(self):  argument
53 self._parent = None
54 self._name = None
57 def parent(self): argument
58 return self._parent
61 def name(self): argument
62 return self._name
64 def find_all(self, pred): argument
75 if pred(self):
76 yield self
78 if self._get_children() is None:
81 for i in self._get_children():
85 def find_first(self, pred): argument
95 for i in self.find_all(pred):
100 def find_parent_first(self, pred): argument
110 for i in self.find_parents(pred):
115 def find_parents(self, pred): argument
126 parent = self.parent
133 def sort_children(self): argument
137 self._sort_by_name(self._children)
139 def _sort_by_name(self, what): argument
142 def _get_name(self): argument
146 def _get_children(self): argument
147 return (i for i in self._children)
149 def _children_name_map_matching(self, match=lambda x: True): argument
151 for i in self._get_children():
164 def validate_tree(self): argument
173 children = self._get_children()
177 for child in self._get_children():
178 if child.parent != self:
181 %(child, self, child.parent)
188 def __str__(self): argument
189 return "<%s name='%s'>" %(self.__class__, self.name)
202 def __init__(self): argument
208 self._entries = []
210 self._entry_map = { 'static': {}, 'dynamic': {}, 'controls': {} }
211 self._entries_ordered = [] # list of ordered Entry/Clone instances
212 self._clones = []
215 self._name = None
216 self._parent = None
217 self._outer_namespaces = None
218 self._tags = []
219 self._types = []
222 def outer_namespaces(self): argument
223 if self._outer_namespaces is None:
226 return (i for i in self._outer_namespaces)
229 def tags(self): argument
230 return (i for i in self._tags)
233 def types(self): argument
234 return (i for i in self._types)
236 def _get_properties(self): argument
238 for i in self._entries:
241 for i in self._clones:
244 def insert_tag(self, tag, description=""): argument
259 tag_ids = [tg.name for tg in self.tags if tg.name == tag]
261 self._tags.append(Tag(tag, self, description))
263 def insert_type(self, type_name, type_selector="typedef", **kwargs): argument
286 type_names = [tp.name for tp in self.types if tp.name == tp]
288 self._types.append(Typedef(type_name, self, kwargs.get('languages')))
290 def insert_entry(self, entry): argument
303 self._entries.append(e)
304 self._entry_map[e.kind][e.name] = e
305 self._entries_ordered.append(e)
307 def insert_clone(self, clone): argument
323 self._entry_map[c.kind][c.name] = c
324 self._clones.append(c)
325 self._entries_ordered.append(c)
327 def prune_clones(self): argument
336 for p in self._clones:
350 self._clones.remove(p)
351 self._entry_map[p.kind].pop(p.name)
352 self._entries_ordered.remove(p)
354 def is_entry_this_kind(self, entry, kind): argument
368 return entry.name in self._entry_map[kind]
372 def construct_graph(self): argument
381 self.validate_tree()
382 self._construct_tags()
383 self.validate_tree()
384 self._construct_types()
385 self.validate_tree()
386 self._construct_clones()
387 self.validate_tree()
388 self._construct_outer_namespaces()
389 self.validate_tree()
391 def _construct_tags(self): argument
392 tag_dict = self._dictionary_by_name(self.tags)
393 for p in self._get_properties():
404 def _construct_types(self): argument
405 type_dict = self._dictionary_by_name(self.types)
406 for p in self._get_properties():
414 def _construct_clones(self): argument
415 for p in self._clones:
417 target_entry = self._entry_map[target_kind].get(p.name)
429 def _construct_outer_namespaces(self): argument
431 if self._outer_namespaces is None: #the first time this runs
432 self._outer_namespaces = []
434 root = self._dictionary_by_name(self._outer_namespaces)
438 for p in self._entries_ordered:
440 ons = root.get(ons_name, OuterNamespace(ons_name, self))
450 self._construct_sections(ons)
452 if ons not in self._outer_namespaces:
453 self._outer_namespaces.append(ons)
457 def _construct_sections(self, outer_namespace): argument
459 sections_dict = self._dictionary_by_name(outer_namespace.sections)
483 self._construct_kinds(sec)
494 def _construct_kinds(self, section): argument
519 self._construct_inner_namespaces(kind)
521 self._construct_entries(kind)
532 def _construct_inner_namespaces(self, parent, depth=0): argument
534 ins_dict = self._dictionary_by_name(parent.namespaces)
552 self._construct_inner_namespaces(ins, depth + 1)
555 self._construct_entries(ins, depth + 1)
566 def _construct_entries(self, parent, depth=0): argument
568 entry_dict = self._dictionary_by_name(parent.entries)
589 def _get_children(self): argument
590 if self.outer_namespaces is not None:
591 for i in self.outer_namespaces:
594 if self.tags is not None:
595 for i in self.tags:
609 def __init__(self, name, parent, description=""): argument
610 self._name = name # 'id' attribute in XML
611 self._id = name
612 self._description = description
613 self._parent = parent
616 self._entries = [] # filled in by Metadata#construct_tags
619 def id(self): argument
620 return self._id
623 def description(self): argument
624 return self._description
627 def entries(self): argument
628 return (i for i in self._entries)
630 def _get_children(self): argument
643 def __init__(self, name, parent, languages=None): argument
644 self._name = name
645 self._parent = parent
648 self._entries = [] # filled in by Metadata#construct_types
650 self._languages = languages or {}
653 def languages(self): argument
654 return self._languages
657 def entries(self): argument
658 return (i for i in self._entries)
660 def _get_children(self): argument
672 def __init__(self, name, parent, sections=[]): argument
673 self._name = name
674 self._parent = parent # MetadataSet
675 self._sections = sections[:]
676 self._leafs = []
678 self._children = self._sections
681 def sections(self): argument
682 return (i for i in self._sections)
697 def __init__(self, name, parent, description=None, kinds=[]): argument
698 self._name = name
699 self._parent = parent
700 self._description = description
701 self._kinds = kinds[:]
703 self._leafs = []
706 def description(self): argument
707 return self._description
710 def kinds(self): argument
711 return (i for i in self._kinds)
714 def hal_versions(self): argument
716 for i in self._kinds:
723 def sort_children(self): argument
724 self.validate_tree()
726 find_child = lambda x: [i for i in self._get_children() if i.name == x]
730 self._kinds = new_lst
731 self.validate_tree()
733 def _get_children(self): argument
734 return (i for i in self.kinds)
737 def merged_kinds(self): argument
752 new_kinds_lst = reduce(aggregate_by_name, self.kinds, [])
757 def combine_kinds_into_single_node(self): argument
780 combined = Kind(name="combined", parent=self)
782 for k in self._get_children():
800 def __init__(self, name, parent): argument
801 self._name = name
802 self._parent = parent
803 self._namespaces = []
804 self._entries = []
806 self._leafs = []
809 def namespaces(self): argument
810 return self._namespaces
813 def entries(self): argument
814 return self._entries
817 def merged_entries(self): argument
818 for i in self.entries:
821 def sort_children(self): argument
822 self._namespaces.sort(key=self._get_name())
823 self._entries.sort(key=self._get_name())
825 def _get_children(self): argument
826 for i in self.namespaces:
828 for i in self.entries:
831 def combine_children_by_name(self): argument
864 return Kind._combine_children_by_name(self, new_type=type(self))
868 def _combine_children_by_name(self, new_type): argument
872 for ins in self.namespaces:
874 InnerNamespace(ins.name, parent=self))
878 for ent in self.entries:
882 kind = new_type(self.name, self.parent)
901 def __init__(self, name, parent): argument
902 self._name = name
903 self._parent = parent
904 self._namespaces = []
905 self._entries = []
906 self._leafs = []
909 def namespaces(self): argument
910 return self._namespaces
913 def entries(self): argument
914 return self._entries
917 def hal_versions(self): argument
919 for entry in self.entries:
921 for namespace in self.namespaces:
926 def merged_entries(self): argument
927 for i in self.entries:
930 def sort_children(self): argument
931 self._namespaces.sort(key=self._get_name())
932 self._entries.sort(key=self._get_name())
934 def _get_children(self): argument
935 for i in self.namespaces:
937 for i in self.entries:
940 def combine_children_by_name(self): argument
974 return Kind._combine_children_by_name(self, new_type=type(self))
994 def __init__(self, name, parent, argument
996 self._name = name # str, e.g. 'ON' or 'OFF'
997 self._id = id # int, e.g. '0'
998 self._deprecated = deprecated # bool
999 self._optional = optional # bool
1000 self._hidden = hidden # bool
1001 self._ndk_hidden = ndk_hidden # bool
1002 self._notes = notes # None or str
1003 self._sdk_notes = sdk_notes # None or str
1004 self._ndk_notes = ndk_notes # None or str
1005 self._parent = parent
1008 self._hal_major_version = parent.parent.hal_major_version
1009 self._hal_minor_version = parent.parent.hal_minor_version
1011 self._hal_major_version = 3
1012 self._hal_minor_version = 2
1014 self._hal_major_version = int(hal_version.partition('.')[0])
1015 self._hal_minor_version = int(hal_version.partition('.')[2])
1018 def id(self): argument
1019 return self._id
1022 def deprecated(self): argument
1023 return self._deprecated
1026 def optional(self): argument
1027 return self._optional
1030 def hidden(self): argument
1031 return self._hidden
1034 def ndk_hidden(self): argument
1035 return self._ndk_hidden
1038 def notes(self): argument
1039 return self._notes
1042 def sdk_notes(self): argument
1043 return self._sdk_notes
1046 def ndk_notes(self): argument
1047 return self._ndk_notes
1050 def hal_major_version(self): argument
1051 return self._hal_major_version
1054 def hal_minor_version(self): argument
1055 return self._hal_minor_version
1057 def _get_children(self): argument
1070 def __init__(self, parent, values, ids={}, deprecateds=[], argument
1072 self._parent = parent
1073 self._name = None
1074 self._values = \
1075 [ EnumValue(val, self, ids.get(val), val in deprecateds, val in optionals, val in hiddens, \
1080 def values(self): argument
1081 return (i for i in self._values)
1084 def has_values_with_id(self): argument
1085 return bool(any(i for i in self.values if i.id))
1087 def has_new_values_added_in_hal_version(self, hal_major_version, hal_minor_version): argument
1088 …return bool(any(i for i in self.values if i.hal_major_version == hal_major_version and i.hal_minor…
1090 def _get_children(self): argument
1091 return (i for i in self._values)
1153 def __init__(self, **kwargs): argument
1210 self._name = kwargs['name']
1211 self._type = kwargs['type']
1212 self._kind = kwargs['kind'] # static, dynamic, or controls
1214 self._init_common(**kwargs)
1217 def type(self): argument
1218 return self._type
1221 def kind(self): argument
1222 return self._kind
1225 def hal_major_version(self): argument
1226 return self._hal_major_version
1229 def hal_minor_version(self): argument
1230 return self._hal_minor_version
1233 def visibility(self): argument
1234 return self._visibility
1237 def applied_visibility(self): argument
1238 return self._visibility or 'system'
1241 def applied_ndk_visible(self): argument
1242 if self._visibility in ("public", "ndk_public"):
1247 def synthetic(self): argument
1248 return self._synthetic
1251 def hwlevel(self): argument
1252 return self._hwlevel
1255 def deprecated(self): argument
1256 return self._deprecated
1259 def deprecation_description(self): argument
1260 return self._deprecation_description
1263 def permission_needed(self): argument
1264 return self._permission_needed or "false"
1268 def optional(self): argument
1269 return self._optional
1272 def applied_optional(self): argument
1273 return self._optional or False
1276 def name_short(self): argument
1277 return self.get_name_minimal()
1280 def container(self): argument
1281 return self._container
1284 def container_sizes(self): argument
1285 if self._container_sizes is None:
1288 return (i for i in self._container_sizes)
1291 def tuple_values(self): argument
1292 if self._tuple_values is None:
1295 return (i for i in self._tuple_values)
1298 def description(self): argument
1299 return self._description
1302 def range(self): argument
1303 return self._range
1306 def units(self): argument
1307 return self._units
1310 def details(self): argument
1311 return self._details
1314 def hal_details(self): argument
1315 return self._hal_details
1318 def ndk_details(self): argument
1319 return self._ndk_details
1322 def applied_ndk_details(self): argument
1323 return (self._details or "") + (self._ndk_details or "")
1326 def tags(self): argument
1327 if self._tags is None:
1330 return (i for i in self._tags)
1333 def type_notes(self): argument
1334 return self._type_notes
1337 def typedef(self): argument
1338 return self._typedef
1341 def enum(self): argument
1342 return self._enum
1344 def has_new_values_added_in_hal_version(self, hal_major_version, hal_minor_version): argument
1345 if self._enum is not None:
1346 return self._enum.has_new_values_added_in_hal_version(hal_major_version,hal_minor_version)
1350 def _get_children(self): argument
1351 if self.enum:
1352 yield self.enum
1354 def sort_children(self): argument
1357 def is_clone(self): argument
1366 def _init_common(self, **kwargs): argument
1368 self._parent = None # filled in by Metadata::_construct_entries
1370 self._container = kwargs.get('container')
1371 self._container_sizes = kwargs.get('container_sizes')
1375 if self.is_clone():
1376 self._hal_major_version = 0
1377 self._hal_minor_version = 0
1379 self._hal_major_version = 3
1380 self._hal_minor_version = 2
1382 self._hal_major_version = int(hal_version.partition('.')[0])
1383 self._hal_minor_version = int(hal_version.partition('.')[2])
1397 self._tuple_values = kwargs.get('tuple_values')
1399 self._description = kwargs.get('description')
1400 self._range = kwargs.get('range')
1401 self._units = kwargs.get('units')
1402 self._details = kwargs.get('details')
1403 self._hal_details = kwargs.get('hal_details')
1404 self._ndk_details = kwargs.get('ndk_details')
1406 self._tag_ids = kwargs.get('tag_ids', [])
1407 self._tags = None # Filled in by Metadata::_construct_tags
1409 self._type_notes = kwargs.get('type_notes')
1410 self._type_name = kwargs.get('type_name')
1411 self._typedef = None # Filled in by Metadata::_construct_types
1414 self._enum = Enum(self, enum_values, enum_ids, enum_deprecateds, enum_optionals,
1417 self._enum = None
1419 self._visibility = kwargs.get('visibility')
1420 self._synthetic = kwargs.get('synthetic', False)
1421 self._hwlevel = kwargs.get('hwlevel')
1422 self._deprecated = kwargs.get('deprecated', False)
1423 self._deprecation_description = kwargs.get('deprecation_description')
1425 self._permission_needed = kwargs.get('permission_needed')
1426 self._optional = kwargs.get('optional')
1427 self._ndk_visible = kwargs.get('ndk_visible')
1429 self._property_keys = kwargs
1431 def merge(self): argument
1436 return MergedEntry(self)
1440 def get_name_as_list(self): argument
1448 return self.name.split(".")
1450 def get_inner_namespace_list(self): argument
1458 return self.get_name_as_list()[2:-1]
1460 def get_outer_namespace(self): argument
1472 return self.get_name_as_list()[0]
1474 def get_section(self): argument
1486 return self.get_name_as_list()[1]
1488 def get_name_minimal(self): argument
1499 return self.get_name_as_list()[-1]
1501 def get_path_without_name(self): argument
1509 return ".".join(self.get_name_as_list()[0:-1])
1525 def __init__(self, entry=None, **kwargs): argument
1566 self._entry = entry # Entry object
1567 self._target_kind = kwargs['target_kind']
1568 self._name = kwargs['name'] # same as entry.name
1569 self._kind = kwargs['kind']
1572 self._type = None
1575 self._init_common(**kwargs)
1578 def entry(self): argument
1579 return self._entry
1582 def target_kind(self): argument
1583 return self._target_kind
1585 def is_clone(self): argument
1604 def __init__(self, entry): argument
1618 setattr(self, p, getattr(entry, p) or getattr(entry.entry, p))
1620 setattr(self, p, getattr(entry, p))
1642 setattr(self, p, getattr(entry.entry, p))
1644 setattr(self, p, getattr(entry, p))