id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
8,401
filename
def filename(self): if not self.file: return None return self.file.filename
python
Tools/c-analyzer/c_parser/info.py
609
612
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,402
parsed
def parsed(self): try: return self._parsed except AttributeError: parent = self.parent if parent is not None and not isinstance(parent, str): parent = parent.name self._parsed = ParsedItem( self.file, self.ki...
python
Tools/c-analyzer/c_parser/info.py
615
629
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,403
fix_filename
def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): if self.file: self.file = self.file.fix_filename(relroot, **kwargs) return self
python
Tools/c-analyzer/c_parser/info.py
631
634
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,404
as_rowdata
def as_rowdata(self, columns=None): columns, datacolumns, colnames = self._parse_columns(columns) return self._as_row(colnames, datacolumns, self._data_as_row)
python
Tools/c-analyzer/c_parser/info.py
636
638
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,405
render_rowdata
def render_rowdata(self, columns=None): columns, datacolumns, colnames = self._parse_columns(columns) def data_as_row(data, ext, cols): return self._render_data_row('row', data, ext, cols) rowdata = self._as_row(colnames, datacolumns, data_as_row) for column, value in rowdata...
python
Tools/c-analyzer/c_parser/info.py
640
662
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,406
data_as_row
def data_as_row(data, ext, cols): return self._render_data_row('row', data, ext, cols)
python
Tools/c-analyzer/c_parser/info.py
642
643
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,407
_as_row
def _as_row(self, colnames, datacolumns, data_as_row): try: data = data_as_row(self.data, self._extra, datacolumns) except NotImplementedError: data = None row = data or {} for column, colname in colnames.items(): if colname == 'filename': ...
python
Tools/c-analyzer/c_parser/info.py
664
680
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,408
render
def render(self, fmt='line'): fmt = fmt or 'line' try: render = _FORMATS[fmt] except KeyError: raise TypeError(f'unsupported fmt {fmt!r}') try: data = self._render_data(fmt, self.data, self._extra) except NotImplementedError: data =...
python
Tools/c-analyzer/c_parser/info.py
682
692
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,409
_fmt_line
def _fmt_line(parsed, data=None): parts = [ f'<{parsed.kind.value}>', ] parent = '' if parsed.parent: parent = parsed.parent if not isinstance(parent, str): if parent.kind is KIND.FUNCTION: parent = f'{parent.name}()' else: ...
python
Tools/c-analyzer/c_parser/info.py
697
721
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,410
_fmt_full
def _fmt_full(parsed, data=None): if parsed.kind is KIND.VARIABLE and parsed.parent: prefix = 'local ' suffix = f' ({parsed.parent.name})' else: # XXX Show other prefixes (e.g. global, public) prefix = suffix = '' yield f'{prefix}{parsed.kind.value} {parsed.name!r}{suffix}' ...
python
Tools/c-analyzer/c_parser/info.py
724
760
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,411
from_row
def from_row(cls, row, **markers): fixed = tuple(_tables.fix_row(row, **markers)) if cls is Declaration: _, _, _, kind, _ = fixed sub = KIND_CLASSES.get(KIND(kind)) if not sub or not issubclass(sub, Declaration): raise TypeError(f'unsupported kind, got...
python
Tools/c-analyzer/c_parser/info.py
776
785
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,412
_from_row
def _from_row(cls, row): filename, funcname, name, kind, data = row kind = KIND._from_raw(kind) if kind is not cls.kind: raise TypeError(f'expected kind {cls.kind.value!r}, got {row!r}') fileinfo = FileInfo.from_raw(filename) extra = None if isinstance(data, s...
python
Tools/c-analyzer/c_parser/info.py
788
800
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,413
_resolve_parent
def _resolve_parent(cls, parsed, *, _kind=None): if _kind is None: raise TypeError(f'{cls.kind.value} declarations do not have parents ({parsed})') return super()._resolve_parent(parsed, _kind=_kind)
python
Tools/c-analyzer/c_parser/info.py
803
806
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,414
_render_data
def _render_data(cls, fmt, data, extra): if not data: # XXX There should be some! Forward? yield '???' else: yield from cls._format_data(fmt, data, extra)
python
Tools/c-analyzer/c_parser/info.py
809
814
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,415
_render_data_row_item
def _render_data_row_item(cls, colname, data, extra): if colname == 'data': return cls._format_data('row', data, extra) else: return None
python
Tools/c-analyzer/c_parser/info.py
817
821
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,416
_format_data
def _format_data(cls, fmt, data, extra): raise NotImplementedError(fmt)
python
Tools/c-analyzer/c_parser/info.py
824
825
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,417
_parse_data
def _parse_data(cls, datastr, fmt=None): """This is the reverse of _render_data.""" if not datastr or datastr is _tables.UNKNOWN or datastr == '???': return None, None elif datastr is _tables.EMPTY or datastr == '-': # All the kinds have *something* even it is unknown. ...
python
Tools/c-analyzer/c_parser/info.py
828
836
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,418
_unformat_data
def _unformat_data(cls, datastr, fmt=None): raise NotImplementedError(fmt)
python
Tools/c-analyzer/c_parser/info.py
839
840
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,419
from_str
def from_str(cls, text): orig = text storage, sep, text = text.strip().partition(' ') if not sep: text = storage storage = None elif storage not in ('auto', 'register', 'static', 'extern'): text = orig storage = None return cls._fro...
python
Tools/c-analyzer/c_parser/info.py
846
855
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,420
_from_str
def _from_str(cls, text): orig = text if text.startswith(('const ', 'volatile ')): typequal, _, text = text.partition(' ') else: typequal = None # Extract a series of identifiers/keywords. m = re.match(r"^ *'?([a-zA-Z_]\w*(?:\s+[a-zA-Z_]\w*)*)\s*(.*?)'?\s...
python
Tools/c-analyzer/c_parser/info.py
858
871
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,421
__str__
def __str__(self): parts = [] if self.qualifier: parts.append(self.qualifier) parts.append(self.spec + (self.abstract or '')) return ' '.join(parts)
python
Tools/c-analyzer/c_parser/info.py
873
878
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,422
qualifier
def qualifier(self): return self.typequal
python
Tools/c-analyzer/c_parser/info.py
881
882
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,423
spec
def spec(self): return self.typespec
python
Tools/c-analyzer/c_parser/info.py
885
886
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,424
_resolve_parent
def _resolve_parent(cls, parsed): return super()._resolve_parent(parsed, _kind=KIND.FUNCTION)
python
Tools/c-analyzer/c_parser/info.py
893
894
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,425
_resolve_data
def _resolve_data(cls, data): if not data: return None, None storage, vartype = _get_vartype(data) return VarType(**vartype), {'storage': storage}
python
Tools/c-analyzer/c_parser/info.py
897
901
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,426
_raw_data
def _raw_data(self, data, extra): vartype = data._asdict() return { 'storage': extra['storage'], 'vartype': vartype, }
python
Tools/c-analyzer/c_parser/info.py
904
909
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,427
_format_data
def _format_data(cls, fmt, data, extra): storage = extra.get('storage') text = f'{storage} {data}' if storage else str(data) if fmt in ('line', 'brief'): yield text #elif fmt == 'full': elif fmt == 'row': yield text else: raise NotImple...
python
Tools/c-analyzer/c_parser/info.py
912
921
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,428
_unformat_data
def _unformat_data(cls, datastr, fmt=None): if fmt in ('line', 'brief'): vartype, storage = VarType.from_str(datastr) return vartype, {'storage': storage} #elif fmt == 'full': elif fmt == 'row': vartype, storage = VarType.from_str(datastr) return v...
python
Tools/c-analyzer/c_parser/info.py
924
933
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,429
__init__
def __init__(self, file, name, data, parent=None, storage=None): super().__init__(file, name, data, parent, _extra={'storage': storage or None}, _shortkey=f'({parent.name}).{name}' if parent else name, _key=(str(file), ...
python
Tools/c-analyzer/c_parser/info.py
935
949
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,430
vartype
def vartype(self): return self.data
python
Tools/c-analyzer/c_parser/info.py
952
953
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,431
from_str
def from_str(cls, text): orig = text storage, sep, text = text.strip().partition(' ') if not sep: text = storage storage = None elif storage not in ('auto', 'register', 'static', 'extern'): text = orig storage = None return cls._fro...
python
Tools/c-analyzer/c_parser/info.py
959
968
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,432
_from_str
def _from_str(cls, text): orig = text inline, sep, text = text.partition('|') if not sep: text = inline inline = None isforward = False if text.endswith(';'): text = text[:-1] isforward = True elif text.endswith('{}'): ...
python
Tools/c-analyzer/c_parser/info.py
971
998
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,433
__str__
def __str__(self): parts = [] if self.inline: parts.extend([ self.inline, '|', ]) parts.extend([ str(self.returntype), self.params, ';' if self.isforward else '{}', ]) return ' '.join(part...
python
Tools/c-analyzer/c_parser/info.py
1,000
1,012
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,434
returns
def returns(self): return self.returntype
python
Tools/c-analyzer/c_parser/info.py
1,015
1,016
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,435
typequal
def typequal(self): return self.returntype.typequal
python
Tools/c-analyzer/c_parser/info.py
1,019
1,020
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,436
typespec
def typespec(self): return self.returntype.typespec
python
Tools/c-analyzer/c_parser/info.py
1,023
1,024
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,437
abstract
def abstract(self): return self.returntype.abstract
python
Tools/c-analyzer/c_parser/info.py
1,027
1,028
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,438
_resolve_data
def _resolve_data(cls, data): if not data: return None, None kwargs = dict(data) returntype = dict(data['returntype']) del returntype['storage'] kwargs['returntype'] = VarType(**returntype) storage = kwargs.pop('storage') return Signature(**kwargs), {'...
python
Tools/c-analyzer/c_parser/info.py
1,035
1,043
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,439
_raw_data
def _raw_data(self, data): # XXX finish! return data
python
Tools/c-analyzer/c_parser/info.py
1,046
1,048
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,440
_format_data
def _format_data(cls, fmt, data, extra): storage = extra.get('storage') text = f'{storage} {data}' if storage else str(data) if fmt in ('line', 'brief'): yield text #elif fmt == 'full': elif fmt == 'row': yield text else: raise NotImple...
python
Tools/c-analyzer/c_parser/info.py
1,051
1,060
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,441
_unformat_data
def _unformat_data(cls, datastr, fmt=None): if fmt in ('line', 'brief'): sig, storage = Signature.from_str(sig) return sig, {'storage': storage} #elif fmt == 'full': elif fmt == 'row': sig, storage = Signature.from_str(sig) return sig, {'storage': ...
python
Tools/c-analyzer/c_parser/info.py
1,063
1,072
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,442
__init__
def __init__(self, file, name, data, parent=None, storage=None): super().__init__(file, name, data, parent, _extra={'storage': storage}) self._shortkey = f'~{name}~ {self.data}' self._key = ( str(file), self._shortkey, )
python
Tools/c-analyzer/c_parser/info.py
1,074
1,080
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,443
signature
def signature(self): return self.data
python
Tools/c-analyzer/c_parser/info.py
1,083
1,084
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,444
__init__
def __init__(self, file, name, data, parent=None, *, _shortkey=None): if not _shortkey: _shortkey = f'{self.kind.value} {name}' super().__init__(file, name, data, parent, _shortkey=_shortkey, _key=( str(file), ...
python
Tools/c-analyzer/c_parser/info.py
1,089
1,098
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,445
__init__
def __init__(self, name): _file = _data = _parent = None super().__init__(_file, name, _data, _parent, _shortkey=name)
python
Tools/c-analyzer/c_parser/info.py
1,103
1,105
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,446
__init__
def __init__(self, vartype): _file = _name = _parent = None data = vartype self.vartype = vartype super().__init__(_file, _name, data, _parent, _shortkey=f'<{vartype}>')
python
Tools/c-analyzer/c_parser/info.py
1,110
1,114
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,447
_resolve_data
def _resolve_data(cls, data): if not data: raise NotImplementedError(data) kwargs = dict(data) del kwargs['storage'] if 'returntype' in kwargs: vartype = kwargs['returntype'] del vartype['storage'] kwargs['returntype'] = VarType(**vartype) ...
python
Tools/c-analyzer/c_parser/info.py
1,121
1,133
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,448
_raw_data
def _raw_data(self, data): # XXX finish! return data
python
Tools/c-analyzer/c_parser/info.py
1,136
1,138
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,449
_format_data
def _format_data(cls, fmt, data, extra): text = str(data) if fmt in ('line', 'brief'): yield text elif fmt == 'full': yield text elif fmt == 'row': yield text else: raise NotImplementedError(fmt)
python
Tools/c-analyzer/c_parser/info.py
1,141
1,150
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,450
_unformat_data
def _unformat_data(cls, datastr, fmt=None): if fmt in ('line', 'brief'): vartype, _ = VarType.from_str(datastr) return vartype, None #elif fmt == 'full': elif fmt == 'row': vartype, _ = VarType.from_str(datastr) return vartype, None else: ...
python
Tools/c-analyzer/c_parser/info.py
1,153
1,162
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,451
__init__
def __init__(self, file, name, data, parent=None): super().__init__(file, name, data, parent, _shortkey=name)
python
Tools/c-analyzer/c_parser/info.py
1,164
1,165
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,452
vartype
def vartype(self): return self.data
python
Tools/c-analyzer/c_parser/info.py
1,168
1,169
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,453
from_data
def from_data(cls, raw, index): name = raw.name if raw.name else index vartype = size = None if type(raw.data) is int: size = raw.data elif isinstance(raw.data, str): size = int(raw.data) elif raw.data: vartype = dict(raw.data) del ...
python
Tools/c-analyzer/c_parser/info.py
1,175
1,190
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,454
from_str
def from_str(cls, text): name, _, vartype = text.partition(': ') if name.startswith('#'): name = int(name[1:]) if vartype.isdigit(): size = int(vartype) vartype = None else: vartype, _ = VarType.from_str(vartype) size = None ...
python
Tools/c-analyzer/c_parser/info.py
1,193
1,203
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,455
__str__
def __str__(self): name = self.name if isinstance(self.name, str) else f'#{self.name}' return f'{name}: {self.vartype or self.size}'
python
Tools/c-analyzer/c_parser/info.py
1,205
1,207
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,456
_resolve_data
def _resolve_data(cls, data): if not data: # XXX There should be some! Forward? return None, None return [Member.from_data(v, i) for i, v in enumerate(data)], None
python
Tools/c-analyzer/c_parser/info.py
1,213
1,217
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,457
_raw_data
def _raw_data(self, data): # XXX finish! return data
python
Tools/c-analyzer/c_parser/info.py
1,220
1,222
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,458
_format_data
def _format_data(cls, fmt, data, extra): if fmt in ('line', 'brief'): members = ', '.join(f'<{m}>' for m in data) yield f'[{members}]' elif fmt == 'full': for member in data: yield f'{member}' elif fmt == 'row': members = ', '.join(...
python
Tools/c-analyzer/c_parser/info.py
1,225
1,236
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,459
_unformat_data
def _unformat_data(cls, datastr, fmt=None): if fmt in ('line', 'brief'): members = [Member.from_str(m[1:-1]) for m in datastr[1:-1].split(', ')] return members, None #elif fmt == 'full': elif fmt == 'row': members = [Member.from_str(m.rs...
python
Tools/c-analyzer/c_parser/info.py
1,239
1,250
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,460
__init__
def __init__(self, file, name, data, parent=None): super().__init__(file, name, data, parent)
python
Tools/c-analyzer/c_parser/info.py
1,252
1,253
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,461
members
def members(self): return self.data
python
Tools/c-analyzer/c_parser/info.py
1,256
1,257
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,462
_resolve_data
def _resolve_data(cls, data): if not data: # XXX There should be some! Forward? return None, None enumerators = [e if isinstance(e, str) else e.name for e in data] return enumerators, None
python
Tools/c-analyzer/c_parser/info.py
1,272
1,278
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,463
_raw_data
def _raw_data(self, data): # XXX finish! return data
python
Tools/c-analyzer/c_parser/info.py
1,281
1,283
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,464
_format_data
def _format_data(cls, fmt, data, extra): if fmt in ('line', 'brief'): yield repr(data) elif fmt == 'full': for enumerator in data: yield f'{enumerator}' elif fmt == 'row': # XXX This won't work with CSV... yield ','.join(data) ...
python
Tools/c-analyzer/c_parser/info.py
1,286
1,296
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,465
_unformat_data
def _unformat_data(cls, datastr, fmt=None): if fmt in ('line', 'brief'): return _strutil.unrepr(datastr), None #elif fmt == 'full': elif fmt == 'row': return datastr.split(','), None else: raise NotImplementedError(fmt)
python
Tools/c-analyzer/c_parser/info.py
1,299
1,306
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,466
__init__
def __init__(self, file, name, data, parent=None): super().__init__(file, name, data, parent)
python
Tools/c-analyzer/c_parser/info.py
1,308
1,309
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,467
enumerators
def enumerators(self): return self.data
python
Tools/c-analyzer/c_parser/info.py
1,312
1,313
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,468
_resolve_data
def _resolve_data(cls, data): # XXX finish! return data, None
python
Tools/c-analyzer/c_parser/info.py
1,322
1,324
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,469
_raw_data
def _raw_data(self, data): # XXX finish! return data
python
Tools/c-analyzer/c_parser/info.py
1,327
1,329
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,470
_render_data
def _render_data(cls, fmt, data, extra): # XXX Handle other formats? return repr(data)
python
Tools/c-analyzer/c_parser/info.py
1,332
1,334
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,471
_parse_data
def _parse_data(self, datastr, fmt=None): # XXX Handle other formats? return _strutil.unrepr(datastr), None
python
Tools/c-analyzer/c_parser/info.py
1,337
1,339
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,472
__init__
def __init__(self, file, name, data, parent=None): super().__init__(file, name, data, parent, _shortkey=data or '', _key=( str(file), file.lno, # XXX Only one stmt per line? ...
python
Tools/c-analyzer/c_parser/info.py
1,341
1,349
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,473
text
def text(self): return self.data
python
Tools/c-analyzer/c_parser/info.py
1,352
1,353
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,474
resolve_parsed
def resolve_parsed(parsed): if isinstance(parsed, HighlevelParsedItem): return parsed try: cls = KIND_CLASSES[parsed.kind] except KeyError: raise ValueError(f'unsupported kind in {parsed!r}') return cls.from_parsed(parsed)
python
Tools/c-analyzer/c_parser/info.py
1,369
1,376
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,475
set_flag
def set_flag(item, name, value): try: setattr(item, name, value) except AttributeError: object.__setattr__(item, name, value)
python
Tools/c-analyzer/c_parser/info.py
1,379
1,383
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,476
from_decls
def from_decls(cls, decls): return cls(decls)
python
Tools/c-analyzer/c_parser/info.py
1,392
1,393
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,477
from_parsed
def from_parsed(cls, items): decls = (resolve_parsed(item) for item in items if item.kind is not KIND.STATEMENT) return cls.from_decls(decls)
python
Tools/c-analyzer/c_parser/info.py
1,396
1,400
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,478
_resolve_key
def _resolve_key(cls, raw): if isinstance(raw, str): raw = [raw] elif isinstance(raw, Declaration): raw = ( raw.filename if cls._is_public(raw) else None, # `raw.parent` is always None for types and functions. raw.parent if raw.kind...
python
Tools/c-analyzer/c_parser/info.py
1,403
1,449
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,479
_is_public
def _is_public(cls, decl): # For .c files don't we need info from .h files to make this decision? # XXX Check for "extern". # For now we treat all decls a "private" (have filename set). return False
python
Tools/c-analyzer/c_parser/info.py
1,452
1,456
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,480
__init__
def __init__(self, decls): # (file, func, name) -> decl # "public": # * (None, None, name) # "private", "global": # * (file, None, name) # "private", "local": # * (file, func, name) if hasattr(decls, 'items'): self._decls = decls ...
python
Tools/c-analyzer/c_parser/info.py
1,458
1,472
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,481
validate
def validate(self): for key, decl in self._decls.items(): if type(key) is not tuple or len(key) != 3: raise ValueError(f'expected 3-tuple key, got {key!r} (for decl {decl!r})') filename, funcname, name = key if not name: raise ValueError(f'expe...
python
Tools/c-analyzer/c_parser/info.py
1,474
1,487
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,482
__repr__
def __repr__(self): return f'{type(self).__name__}({list(self)})'
python
Tools/c-analyzer/c_parser/info.py
1,489
1,490
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,483
__len__
def __len__(self): return len(self._decls)
python
Tools/c-analyzer/c_parser/info.py
1,492
1,493
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,484
__iter__
def __iter__(self): yield from self._decls
python
Tools/c-analyzer/c_parser/info.py
1,495
1,496
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,485
__getitem__
def __getitem__(self, key): # XXX Be more exact for the 3-tuple case? if type(key) not in (str, tuple): raise KeyError(f'unsupported key {key!r}') resolved, extra = self._resolve_key(key) if extra: raise KeyError(f'key must have at most 3 parts, got {key!r}') ...
python
Tools/c-analyzer/c_parser/info.py
1,498
1,521
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,486
types
def types(self): return self._find(kind=KIND.TYPES)
python
Tools/c-analyzer/c_parser/info.py
1,524
1,525
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,487
functions
def functions(self): return self._find(None, None, None, KIND.FUNCTION)
python
Tools/c-analyzer/c_parser/info.py
1,528
1,529
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,488
variables
def variables(self): return self._find(None, None, None, KIND.VARIABLE)
python
Tools/c-analyzer/c_parser/info.py
1,532
1,533
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,489
iter_all
def iter_all(self): yield from self._decls.values()
python
Tools/c-analyzer/c_parser/info.py
1,535
1,536
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,490
get
def get(self, key, default=None): try: return self[key] except KeyError: return default
python
Tools/c-analyzer/c_parser/info.py
1,538
1,542
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,491
find
def find(self, *key, **explicit): if not key: if not explicit: return iter(self) return self._find(**explicit) resolved, extra = self._resolve_key(key) filename, funcname, name = resolved if not extra: kind = None elif len(extr...
python
Tools/c-analyzer/c_parser/info.py
1,548
1,572
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,492
_find
def _find(self, filename=None, funcname=None, name=None, kind=None): for decl in self._decls.values(): if filename and decl.filename != filename: continue if funcname: if decl.kind is not KIND.VARIABLE: continue if decl....
python
Tools/c-analyzer/c_parser/info.py
1,574
1,589
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,493
_add_decl
def _add_decl(self, decl, key=None): if key: if type(key) not in (str, tuple): raise NotImplementedError((key, decl)) # Any partial key will be turned into a full key, but that # same partial key will still match a key lookup. resolved, _ = self._r...
python
Tools/c-analyzer/c_parser/info.py
1,591
1,604
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,494
_extend
def _extend(self, decls): decls = iter(decls) # Check only the first item. for decl in decls: if isinstance(decl, Declaration): self._add_decl(decl) # Add the rest without checking. for decl in decls: self._add_decl(...
python
Tools/c-analyzer/c_parser/info.py
1,606
1,628
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,495
resolve
def resolve(source, filename): if _looks_like_filename(source): return _resolve_filename(source, filename) if isinstance(source, str): source = source.splitlines() # At this point "source" is not a str. if not filename: filename = None elif not isinstance(filename, str): ...
python
Tools/c-analyzer/c_parser/source.py
5
19
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,496
good_file
def good_file(filename, alt=None): if not _looks_like_filename(filename): raise ValueError(f'expected a filename, got {filename}') filename, _ = _resolve_filename(filename, alt) try: yield filename except Exception: if not os.path.exists(filename): raise FileNotFoundE...
python
Tools/c-analyzer/c_parser/source.py
23
32
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,497
_looks_like_filename
def _looks_like_filename(value): if not isinstance(value, str): return False return value.endswith(('.c', '.h'))
python
Tools/c-analyzer/c_parser/source.py
35
38
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,498
_resolve_filename
def _resolve_filename(filename, alt=None): if os.path.isabs(filename): ... # raise NotImplementedError else: filename = os.path.join('.', filename) if not alt: alt = filename elif os.path.abspath(filename) == os.path.abspath(alt): alt = filename else: ...
python
Tools/c-analyzer/c_parser/source.py
41
54
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,499
opened
def opened(source, filename=None): source, filename = resolve(source, filename) if isinstance(source, str): with open(source) as srcfile: yield srcfile, filename else: yield source, filename
python
Tools/c-analyzer/c_parser/source.py
58
64
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,500
_format_vartype
def _format_vartype(vartype): if isinstance(vartype, str): return vartype data = vartype try: vartype = data['vartype'] except KeyError: storage, typequal, typespec, abstract = vartype.values() else: storage = data.get('storage') if storage: _, ty...
python
Tools/c-analyzer/c_parser/__main__.py
25
46
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }