Lines Matching refs:cls

35     def _from_raw(cls, raw):
38 elif isinstance(raw, cls):
41 # We could use cls[raw] for the upper-case form,
43 return cls(raw.lower())
48 def by_priority(cls, group=None):
50 return cls._ALL_BY_PRIORITY.copy()
52 return cls._TYPE_DECLS_BY_PRIORITY.copy()
54 return cls._ALL_DECLS_BY_PRIORITY.copy()
62 def is_type_decl(cls, kind):
63 if kind in cls.TYPES:
65 if not isinstance(kind, cls):
70 def is_decl(cls, kind):
71 if kind in cls.DECLS:
73 if not isinstance(kind, cls):
78 def get_group(cls, kind, *, groups=None):
79 if not isinstance(kind, cls):
87 if group not in cls._GROUPS:
91 unsupported = [g for g in groups if g not in cls._GROUPS]
95 if kind in cls._GROUPS[group]:
101 def resolve_group(cls, group):
102 if isinstance(group, cls):
106 return cls._GROUPS[group].copy()
112 resolve.update(cls.resolve_group(gr))
114 #return {*cls.resolve_group(g) for g in group}
164 def from_raw(cls, raw):
165 if isinstance(raw, cls):
168 return cls(*raw)
172 return cls(raw, -1)
206 def from_row(cls, row, **markers):
208 return cls(*row)
213 def _make(cls, iterable):
215 return cls(*iterable)
220 def __new__(cls, filename, funcname, name):
222 cls,
257 def from_raw(cls, raw):
258 if isinstance(raw, cls):
261 return cls(*raw)
266 def from_row(cls, row, columns=None):
284 elif column in cls._fields:
288 return cls(**kwargs)
430 def from_parsed(cls, parsed):
431 if parsed.kind is not cls.kind:
432 raise TypeError(f'kind mismatch ({parsed.kind.value} != {cls.kind.value})')
433 data, extra = cls._resolve_data(parsed.data)
434 self = cls(
435 cls._resolve_file(parsed),
438 cls._resolve_parent(parsed) if parsed.parent else None,
445 def _resolve_file(cls, parsed):
452 def _resolve_data(cls, data):
456 def _raw_data(cls, data, extra):
463 def _data_as_row(cls, data, extra, colnames):
468 rendered = cls._render_data_row_item(colname, data, extra)
475 def _render_data_row_item(cls, colname, data, extra):
482 def _render_data_row(cls, fmt, data, extra, colnames):
485 datarow = cls._data_as_row(data, extra, colnames)
498 def _render_data(cls, fmt, data, extra):
499 row = cls._render_data_row(fmt, data, extra, ['data'])
503 def _resolve_parent(cls, parsed, *, _kind=None):
521 def _parse_columns(cls, columns):
523 columns = list(columns or cls.FIELDS)
537 elif colname in cls.FIELDS or colname == 'kind':
774 def from_row(cls, row, **markers):
776 if cls is Declaration:
782 sub = cls
786 def _from_row(cls, row):
789 if kind is not cls.kind:
790 raise TypeError(f'expected kind {cls.kind.value!r}, got {row!r}')
793 data, extra = cls._parse_data(data, fmt='row')
795 return cls(fileinfo, name, data, funcname, _extra=extra)
797 return cls(fileinfo, name, data, funcname)
800 def _resolve_parent(cls, parsed, *, _kind=None):
802 raise TypeError(f'{cls.kind.value} declarations do not have parents ({parsed})')
806 def _render_data(cls, fmt, data, extra):
811 yield from cls._format_data(fmt, data, extra)
814 def _render_data_row_item(cls, colname, data, extra):
816 return cls._format_data('row', data, extra)
821 def _format_data(cls, fmt, data, extra):
825 def _parse_data(cls, datastr, fmt=None):
833 return cls._unformat_data(datastr, fmt)
836 def _unformat_data(cls, datastr, fmt=None):
843 def from_str(cls, text):
852 return cls._from_str(text), storage
855 def _from_str(cls, text):
868 return cls(typequal, typespec, abstract or None)
890 def _resolve_parent(cls, parsed):
894 def _resolve_data(cls, data):
909 def _format_data(cls, fmt, data, extra):
921 def _unformat_data(cls, datastr, fmt=None):
956 def from_str(cls, text):
965 return cls._from_str(text), storage
968 def _from_str(cls, text):
995 return cls(params, returntype, inline, isforward)
1020 def _resolve_data(cls, data):
1036 def _format_data(cls, fmt, data, extra):
1048 def _unformat_data(cls, datastr, fmt=None):
1106 def _resolve_data(cls, data):
1119 def _format_data(cls, fmt, data, extra):
1131 def _unformat_data(cls, datastr, fmt=None):
1153 def from_data(cls, raw, index):
1168 return cls(name, vartype, size)
1171 def from_str(cls, text):
1181 return cls(name, vartype, size)
1191 def _resolve_data(cls, data):
1203 def _format_data(cls, fmt, data, extra):
1217 def _unformat_data(cls, datastr, fmt=None):
1250 def _resolve_data(cls, data):
1264 def _format_data(cls, fmt, data, extra):
1277 def _unformat_data(cls, datastr, fmt=None):
1300 def _resolve_data(cls, data):
1310 def _render_data(cls, fmt, data, extra):
1336 KIND_CLASSES = {cls.kind: cls for cls in [
1351 cls = KIND_CLASSES[parsed.kind]
1354 return cls.from_parsed(parsed)
1370 def from_decls(cls, decls):
1371 return cls(decls)
1374 def from_parsed(cls, items):
1378 return cls.from_decls(decls)
1381 def _resolve_key(cls, raw):
1386 raw.filename if cls._is_public(raw) else None,
1430 def _is_public(cls, decl):