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,901 | build_item | def build_item(cls, info, resolved=None, **extra):
if resolved is None:
return cls._item_class.from_raw(info, **extra)
else:
return cls._item_class.from_resolved(info, resolved, **extra) | python | Tools/c-analyzer/c_analyzer/info.py | 272 | 276 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,902 | from_results | def from_results(cls, results):
self = cls()
for info, resolved in results:
self._add_result(info, resolved)
return self | python | Tools/c-analyzer/c_analyzer/info.py | 279 | 283 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,903 | __init__ | def __init__(self, items=None):
self._analyzed = {type(self).build_item(item): None
for item in items or ()} | python | Tools/c-analyzer/c_analyzer/info.py | 285 | 287 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,904 | __repr__ | def __repr__(self):
return f'{type(self).__name__}({list(self._analyzed.keys())})' | python | Tools/c-analyzer/c_analyzer/info.py | 289 | 290 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,905 | __iter__ | def __iter__(self):
#yield from self.types
#yield from self.functions
#yield from self.variables
yield from self._analyzed | python | Tools/c-analyzer/c_analyzer/info.py | 292 | 296 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,906 | __len__ | def __len__(self):
return len(self._analyzed) | python | Tools/c-analyzer/c_analyzer/info.py | 298 | 299 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,907 | __getitem__ | def __getitem__(self, key):
if type(key) is int:
for i, val in enumerate(self._analyzed):
if i == key:
return val
else:
raise IndexError(key)
else:
return self._analyzed[key] | python | Tools/c-analyzer/c_analyzer/info.py | 301 | 309 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,908 | fix_filenames | def fix_filenames(self, relroot=fsutil.USE_CWD, **kwargs):
if relroot and relroot is not fsutil.USE_CWD:
relroot = os.path.abspath(relroot)
for item in self._analyzed:
item.fix_filename(relroot, fixroot=False, **kwargs) | python | Tools/c-analyzer/c_analyzer/info.py | 311 | 315 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,909 | _add_result | def _add_result(self, info, resolved):
analyzed = type(self).build_item(info, resolved)
self._analyzed[analyzed] = None
return analyzed | python | Tools/c-analyzer/c_analyzer/info.py | 317 | 320 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,910 | _render_table | def _render_table(items, columns, relroot=None):
# XXX improve this
header = '\t'.join(columns)
div = '--------------------'
yield header
yield div
total = 0
for item in items:
rowdata = item.render_rowdata(columns)
row = [rowdata[c] for c in columns]
if relroot and '... | python | Tools/c-analyzer/c_analyzer/__main__.py | 82 | 98 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,911 | build_section | def build_section(name, groupitems, *, relroot=None):
info = TABLE_SECTIONS[name]
while type(info) is not tuple:
if name in KINDS:
name = info
info = TABLE_SECTIONS[info]
columns, match_kind, sortkey = info
items = (v for v in groupitems if match_kind(v.kind))
items = so... | python | Tools/c-analyzer/c_analyzer/__main__.py | 101 | 117 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,912 | render | def render():
yield ''
yield f'{name}:'
yield ''
for line in _render_table(items, columns, relroot):
yield line | python | Tools/c-analyzer/c_analyzer/__main__.py | 111 | 116 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,913 | add_checks_cli | def add_checks_cli(parser, checks=None, *, add_flags=None):
default = False
if not checks:
checks = list(CHECKS)
default = True
elif isinstance(checks, str):
checks = [checks]
if (add_flags is None and len(checks) > 1) or default:
add_flags = True
process_checks = ad... | python | Tools/c-analyzer/c_analyzer/__main__.py | 128 | 145 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,914 | _get_check_handlers | def _get_check_handlers(fmt, printer, verbosity=VERBOSITY):
div = None
def handle_after():
pass
if not fmt:
div = ''
def handle_failure(failure, data):
data = repr(data)
if verbosity >= 3:
logger.info(f'failure: {failure}')
logg... | python | Tools/c-analyzer/c_analyzer/__main__.py | 148 | 191 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,915 | handle_after | def handle_after():
pass | python | Tools/c-analyzer/c_analyzer/__main__.py | 150 | 151 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,916 | handle_failure | def handle_failure(failure, data):
data = repr(data)
if verbosity >= 3:
logger.info(f'failure: {failure}')
logger.info(f'data: {data}')
else:
logger.warn(f'failure: {failure} (data: {data})') | python | Tools/c-analyzer/c_analyzer/__main__.py | 154 | 160 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,917 | handle_failure | def handle_failure(failure, data):
print(f'{failure!r} {data!r}') | python | Tools/c-analyzer/c_analyzer/__main__.py | 162 | 163 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,918 | handle_failure | def handle_failure(failure, data):
parent = data.parent or ''
funcname = parent if isinstance(parent, str) else parent.name
name = f'({funcname}).{data.name}' if funcname else data.name
failure = failure.split('\t')[0]
print(f'{data.filename}:{name} - {failure... | python | Tools/c-analyzer/c_analyzer/__main__.py | 165 | 170 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,919 | handle_failure | def handle_failure(failure, data):
print(_fmt_one_summary(data, failure)) | python | Tools/c-analyzer/c_analyzer/__main__.py | 172 | 173 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,920 | handle_failure | def handle_failure(failure, data):
name = data.shortkey if data.kind is KIND.VARIABLE else data.name
parent = data.parent or ''
funcname = parent if isinstance(parent, str) else parent.name
known = 'yes' if data.is_known else '*** NO ***'
print(f'{data.kind.va... | python | Tools/c-analyzer/c_analyzer/__main__.py | 176 | 186 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,921 | fmt_raw | def fmt_raw(analysis):
for item in analysis:
yield from item.render('raw') | python | Tools/c-analyzer/c_analyzer/__main__.py | 197 | 199 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,922 | fmt_brief | def fmt_brief(analysis):
# XXX Support sorting.
items = sorted(analysis)
for kind in KINDS:
if kind is KIND.STATEMENT:
continue
for item in items:
if item.kind is not kind:
continue
yield from item.render('brief')
yield f' total: {len(... | python | Tools/c-analyzer/c_analyzer/__main__.py | 202 | 212 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,923 | fmt_summary | def fmt_summary(analysis):
# XXX Support sorting and grouping.
items = list(analysis)
total = len(items)
def section(name):
_, render = build_section(name, items)
yield from render()
yield from section('types')
yield from section('functions')
yield from section('variables')... | python | Tools/c-analyzer/c_analyzer/__main__.py | 215 | 231 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,924 | section | def section(name):
_, render = build_section(name, items)
yield from render() | python | Tools/c-analyzer/c_analyzer/__main__.py | 220 | 222 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,925 | _fmt_one_summary | def _fmt_one_summary(item, extra=None):
parent = item.parent or ''
funcname = parent if isinstance(parent, str) else parent.name
if extra:
return f'{item.filename:35}\t{funcname or "-":35}\t{item.name:40}\t{extra}'
else:
return f'{item.filename:35}\t{funcname or "-":35}\t{item.name}' | python | Tools/c-analyzer/c_analyzer/__main__.py | 234 | 240 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,926 | fmt_full | def fmt_full(analysis):
# XXX Support sorting.
items = sorted(analysis, key=lambda v: v.key)
yield ''
for item in items:
yield from item.render('full')
yield ''
yield f'total: {len(items)}' | python | Tools/c-analyzer/c_analyzer/__main__.py | 243 | 250 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,927 | add_output_cli | def add_output_cli(parser, *, default='summary'):
parser.add_argument('--format', dest='fmt', default=default, choices=tuple(FORMATS))
def process_args(args, *, argv=None):
pass
return process_args | python | Tools/c-analyzer/c_analyzer/__main__.py | 261 | 266 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,928 | process_args | def process_args(args, *, argv=None):
pass | python | Tools/c-analyzer/c_analyzer/__main__.py | 264 | 265 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,929 | _cli_check | def _cli_check(parser, checks=None, **kwargs):
if isinstance(checks, str):
checks = [checks]
if checks is False:
process_checks = None
elif checks is None:
process_checks = add_checks_cli(parser)
elif len(checks) == 1 and type(checks) is not dict and re.match(r'^<.*>$', checks[0]... | python | Tools/c-analyzer/c_analyzer/__main__.py | 272 | 293 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,930 | process_checks | def process_checks(args, *, argv=None):
args.checks = [check] | python | Tools/c-analyzer/c_analyzer/__main__.py | 281 | 282 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,931 | cmd_check | def cmd_check(filenames, *,
checks=None,
ignored=None,
fmt=None,
failfast=False,
iter_filenames=None,
relroot=fsutil.USE_CWD,
track_progress=None,
verbosity=VERBOSITY,
_analyze=_analyze,
... | python | Tools/c-analyzer/c_analyzer/__main__.py | 296 | 358 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,932 | _cli_analyze | def _cli_analyze(parser, **kwargs):
process_progress = add_progress_cli(parser)
process_output = add_output_cli(parser)
process_files = add_files_cli(parser, **kwargs)
return [
process_progress,
process_output,
process_files,
] | python | Tools/c-analyzer/c_analyzer/__main__.py | 361 | 369 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,933 | cmd_analyze | def cmd_analyze(filenames, *,
fmt=None,
iter_filenames=None,
relroot=fsutil.USE_CWD,
track_progress=None,
verbosity=None,
_analyze=_analyze,
formats=FORMATS,
**kwargs
):
ve... | python | Tools/c-analyzer/c_analyzer/__main__.py | 373 | 401 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,934 | _cli_data | def _cli_data(parser, filenames=None, known=None):
ArgumentParser = type(parser)
common = ArgumentParser(add_help=False)
# These flags will get processed by the top-level parse_args().
add_verbosity_cli(common)
add_traceback_cli(common)
subs = parser.add_subparsers(dest='datacmd')
sub = su... | python | Tools/c-analyzer/c_analyzer/__main__.py | 404 | 432 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,935 | process_args | def process_args(args, *, argv):
if args.datacmd == 'dump':
process_progress(args, argv) | python | Tools/c-analyzer/c_analyzer/__main__.py | 429 | 431 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,936 | cmd_data | def cmd_data(datacmd, filenames, known=None, *,
_analyze=_analyze,
formats=FORMATS,
extracolumns=None,
relroot=fsutil.USE_CWD,
track_progress=None,
**kwargs
):
kwargs.pop('verbosity', None)
usestdout = kwargs.pop('show', ... | python | Tools/c-analyzer/c_analyzer/__main__.py | 435 | 468 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,937 | parse_args | def parse_args(argv=sys.argv[1:], prog=sys.argv[0], *, subset=None):
import argparse
parser = argparse.ArgumentParser(
prog=prog or get_prog(),
)
processors = add_commands_cli(
parser,
commands={k: v[1] for k, v in COMMANDS.items()},
commonspecs=[
add_verbosi... | python | Tools/c-analyzer/c_analyzer/__main__.py | 493 | 523 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,938 | main | def main(cmd, cmd_kwargs):
try:
run_cmd = COMMANDS[cmd][0]
except KeyError:
raise ValueError(f'unsupported cmd {cmd!r}')
run_cmd(**cmd_kwargs) | python | Tools/c-analyzer/c_analyzer/__main__.py | 526 | 531 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,939 | get_known | def get_known(known, extracolumns=None, *,
analyze_resolved=None,
handle_unresolved=True,
relroot=fsutil.USE_CWD,
):
if isinstance(known, str):
known = read_known(known, extracolumns, relroot)
return analyze_known(
known,
handle_unr... | python | Tools/c-analyzer/c_analyzer/datafiles.py | 19 | 30 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,940 | read_known | def read_known(infile, extracolumns=None, relroot=fsutil.USE_CWD):
extracolumns = EXTRA_COLUMNS + (
list(extracolumns) if extracolumns else []
)
known = {}
for decl, extra in _parser.iter_decls_tsv(infile, extracolumns, relroot):
known[decl] = extra
return known | python | Tools/c-analyzer/c_analyzer/datafiles.py | 33 | 40 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,941 | analyze_known | def analyze_known(known, *,
analyze_resolved=None,
handle_unresolved=True,
):
knowntypes = knowntypespecs = {}
collated = _match.group_by_kinds(known)
types = {decl: None for decl in collated['type']}
typespecs = _analyze.get_typespecs(types)
def... | python | Tools/c-analyzer/c_analyzer/datafiles.py | 43 | 61 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,942 | analyze_decl | def analyze_decl(decl):
return _analyze.analyze_decl(
decl,
typespecs,
knowntypespecs,
types,
knowntypes,
analyze_resolved=analyze_resolved,
) | python | Tools/c-analyzer/c_analyzer/datafiles.py | 51 | 59 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,943 | write_known | def write_known(rows, outfile, extracolumns=None, *,
relroot=fsutil.USE_CWD,
backup=True,
):
extracolumns = EXTRA_COLUMNS + (
list(extracolumns) if extracolumns else []
)
_parser.write_decls_tsv(
rows,
outfile,
extracolumns,
... | python | Tools/c-analyzer/c_analyzer/datafiles.py | 64 | 77 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,944 | read_ignored | def read_ignored(infile, relroot=fsutil.USE_CWD):
return dict(_iter_ignored(infile, relroot)) | python | Tools/c-analyzer/c_analyzer/datafiles.py | 92 | 93 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,945 | _iter_ignored | def _iter_ignored(infile, relroot):
if relroot and relroot is not fsutil.USE_CWD:
relroot = os.path.abspath(relroot)
bogus = {_tables.EMPTY, _tables.UNKNOWN}
for row in _tables.read_table(infile, IGNORED_HEADER, sep='\t'):
*varidinfo, reason = row
if _tables.EMPTY in varidinfo or _ta... | python | Tools/c-analyzer/c_analyzer/datafiles.py | 96 | 109 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,946 | write_ignored | def write_ignored(variables, outfile, relroot=fsutil.USE_CWD):
raise NotImplementedError
if relroot and relroot is not fsutil.USE_CWD:
relroot = os.path.abspath(relroot)
reason = '???'
#if not isinstance(varid, DeclID):
# varid = getattr(varid, 'parsed', varid).id
decls = (d.fix_filen... | python | Tools/c-analyzer/c_analyzer/datafiles.py | 112 | 125 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,947 | get_typespecs | def get_typespecs(typedecls):
typespecs = {}
for decl in typedecls:
if decl.shortkey not in typespecs:
typespecs[decl.shortkey] = [decl]
else:
typespecs[decl.shortkey].append(decl)
return typespecs | python | Tools/c-analyzer/c_analyzer/analyze.py | 21 | 28 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,948 | analyze_decl | def analyze_decl(decl, typespecs, knowntypespecs, types, knowntypes, *,
analyze_resolved=None):
resolved = resolve_decl(decl, typespecs, knowntypespecs, types)
if resolved is None:
# The decl is supposed to be skipped or ignored.
return None
if analyze_resolved is None:
... | python | Tools/c-analyzer/c_analyzer/analyze.py | 31 | 39 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,949 | analyze_type_decls | def analyze_type_decls(types, analyze_decl, handle_unresolved=True):
unresolved = set(types)
while unresolved:
updated = []
for decl in unresolved:
resolved = analyze_decl(decl)
if resolved is None:
# The decl should be skipped or ignored.
... | python | Tools/c-analyzer/c_analyzer/analyze.py | 45 | 97 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,950 | resolve_decl | def resolve_decl(decl, typespecs, knowntypespecs, types):
if decl.kind is KIND.ENUM:
typedeps = []
else:
if decl.kind is KIND.VARIABLE:
vartypes = [decl.vartype]
elif decl.kind is KIND.FUNCTION:
vartypes = [decl.signature.returntype]
elif decl.kind is KIND... | python | Tools/c-analyzer/c_analyzer/analyze.py | 100 | 146 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,951 | find_typedecl | def find_typedecl(decl, typespec, typespecs):
specdecls = typespecs.get(typespec)
if not specdecls:
return None
filename = decl.filename
if len(specdecls) == 1:
typedecl, = specdecls
if '-' in typespec and typedecl.filename != filename:
# Inlined types are always in... | python | Tools/c-analyzer/c_analyzer/analyze.py | 149 | 193 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,952 | __init__ | def __init__(self):
_file = _name = _data = _parent = None
super().__init__(_file, _name, _data, _parent, _shortkey='<skipped>') | python | Tools/c-analyzer/c_analyzer/analyze.py | 200 | 202 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,953 | _handle_unresolved | def _handle_unresolved(unresolved, types, analyze_decl):
#raise NotImplementedError(unresolved)
dump = True
dump = False
if dump:
print()
for decl in types: # Preserve the original order.
if decl not in unresolved:
assert types[decl] is not None, decl
if typ... | python | Tools/c-analyzer/c_analyzer/analyze.py | 207 | 236 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,954 | _dump_unresolved | def _dump_unresolved(decl, types, analyze_decl):
if isinstance(decl, str):
typespec = decl
decl, = (d for d in types if d.shortkey == typespec)
elif type(decl) is tuple:
filename, typespec = decl
if '-' in typespec:
found = [d for d in types
if d.... | python | Tools/c-analyzer/c_analyzer/analyze.py | 239 | 311 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,955 | is_system_type | def is_system_type(typespec):
return typespec in SYSTEM_TYPES | python | Tools/c-analyzer/c_analyzer/match.py | 46 | 47 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,956 | is_public | def is_public(decl):
if not decl.filename.endswith('.h'):
return False
if 'Include' not in decl.filename.split(os.path.sep):
return False
return True | python | Tools/c-analyzer/c_analyzer/match.py | 53 | 58 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,957 | is_process_global | def is_process_global(vardecl):
kind, storage, _, _, _ = _info.get_parsed_vartype(vardecl)
if kind is not _KIND.VARIABLE:
raise NotImplementedError(vardecl)
if 'static' in (storage or ''):
return True
if hasattr(vardecl, 'parent'):
parent = vardecl.parent
else:
paren... | python | Tools/c-analyzer/c_analyzer/match.py | 61 | 72 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,958 | is_fixed_type | def is_fixed_type(vardecl):
if not vardecl:
return None
_, _, _, typespec, abstract = _info.get_parsed_vartype(vardecl)
if 'typeof' in typespec:
raise NotImplementedError(vardecl)
elif not abstract:
return True
if '*' not in abstract:
# XXX What about []?
ret... | python | Tools/c-analyzer/c_analyzer/match.py | 75 | 94 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,959 | is_immutable | def is_immutable(vardecl):
if not vardecl:
return None
if not is_fixed_type(vardecl):
return False
_, _, typequal, _, _ = _info.get_parsed_vartype(vardecl)
# If there, it can only be "const" or "volatile".
return typequal == 'const' | python | Tools/c-analyzer/c_analyzer/match.py | 97 | 104 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,960 | is_public_api | def is_public_api(decl):
if not is_public(decl):
return False
if decl.kind is _KIND.TYPEDEF:
return True
elif _match.is_type_decl(decl):
return not _match.is_forward_decl(decl)
else:
return _match.is_external_reference(decl) | python | Tools/c-analyzer/c_analyzer/match.py | 107 | 115 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,961 | is_public_declaration | def is_public_declaration(decl):
if not is_public(decl):
return False
if decl.kind is _KIND.TYPEDEF:
return True
elif _match.is_type_decl(decl):
return _match.is_forward_decl(decl)
else:
return _match.is_external_reference(decl) | python | Tools/c-analyzer/c_analyzer/match.py | 118 | 126 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,962 | is_public_definition | def is_public_definition(decl):
if not is_public(decl):
return False
if decl.kind is _KIND.TYPEDEF:
return True
elif _match.is_type_decl(decl):
return not _match.is_forward_decl(decl)
else:
return not _match.is_external_reference(decl) | python | Tools/c-analyzer/c_analyzer/match.py | 129 | 137 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,963 | is_public_impl | def is_public_impl(decl):
if not _KIND.is_decl(decl.kind):
return False
# See filter_forward() about "is_public".
return getattr(decl, 'is_public', False) | python | Tools/c-analyzer/c_analyzer/match.py | 140 | 144 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,964 | is_module_global_decl | def is_module_global_decl(decl):
if is_public_impl(decl):
return False
if _match.is_forward_decl(decl):
return False
return not _match.is_local_var(decl) | python | Tools/c-analyzer/c_analyzer/match.py | 147 | 152 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,965 | filter_forward | def filter_forward(items, *, markpublic=False):
if markpublic:
public = set()
actual = []
for item in items:
if is_public_api(item):
public.add(item.id)
elif not _match.is_forward_decl(item):
actual.append(item)
else:
... | python | Tools/c-analyzer/c_analyzer/match.py | 158 | 178 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,966 | group_by_storage | def group_by_storage(decls, **kwargs):
def is_module_global(decl):
if not is_module_global_decl(decl):
return False
if decl.kind == _KIND.VARIABLE:
if _info.get_effective_storage(decl) == 'static':
# This is covered by is_static_module_global().
... | python | Tools/c-analyzer/c_analyzer/match.py | 184 | 212 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,967 | is_module_global | def is_module_global(decl):
if not is_module_global_decl(decl):
return False
if decl.kind == _KIND.VARIABLE:
if _info.get_effective_storage(decl) == 'static':
# This is covered by is_static_module_global().
return False
return True | python | Tools/c-analyzer/c_analyzer/match.py | 185 | 192 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,968 | is_static_module_global | def is_static_module_global(decl):
if not _match.is_global_var(decl):
return False
return _info.get_effective_storage(decl) == 'static' | python | Tools/c-analyzer/c_analyzer/match.py | 193 | 196 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,969 | is_static_local | def is_static_local(decl):
if not _match.is_local_var(decl):
return False
return _info.get_effective_storage(decl) == 'static' | python | Tools/c-analyzer/c_analyzer/match.py | 197 | 200 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,970 | parsecodes | def parsecodes(codes, len=len, range=range):
""" Converts code combinations to either a single code integer
or a tuple of integers.
meta-codes (in angular brackets, e.g. <LR> and <RL>) are
ignored.
Empty codes or illegal ones are returned as None.
"""
if not codes:
... | python | Tools/unicode/gencodec.py | 46 | 71 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,971 | readmap | def readmap(filename):
with open(filename) as f:
lines = f.readlines()
enc2uni = {}
identity = []
unmapped = list(range(256))
# UTC mapping tables per convention don't include the identity
# mappings for code points 0x00 - 0x1F and 0x7F, unless these are
# explicitly mapped to diff... | python | Tools/unicode/gencodec.py | 73 | 121 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,972 | hexrepr | def hexrepr(t, precision=4):
if t is None:
return 'None'
try:
len(t)
except TypeError:
return '0x%0*X' % (precision, t)
try:
return '(' + ', '.join(['0x%0*X' % (precision, item)
for item in t]) + ')'
except TypeError as why:
pr... | python | Tools/unicode/gencodec.py | 123 | 136 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,973 | python_mapdef_code | def python_mapdef_code(varname, map, comments=1, precisions=(2, 4)):
l = []
append = l.append
if "IDENTITY" in map:
append("%s = codecs.make_identity_dict(range(%d))" %
(varname, map["IDENTITY"]))
append("%s.update({" % varname)
splits = 1
del map["IDENTITY"]
... | python | Tools/unicode/gencodec.py | 138 | 193 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,974 | python_tabledef_code | def python_tabledef_code(varname, map, comments=1, key_precision=2):
l = []
append = l.append
append('%s = (' % varname)
# Analyze map and create table dict
mappings = sorted(map.items())
table = {}
maxkey = 255
if 'IDENTITY' in map:
for key in range(256):
table[key... | python | Tools/unicode/gencodec.py | 195 | 251 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,975 | codegen | def codegen(name, map, encodingname, comments=1):
""" Returns Python source for the given map.
Comments are included in the source, if comments is true (default).
"""
# Generate code
decoding_map_code = python_mapdef_code(
'decoding_map',
map,
comments=comments)
de... | python | Tools/unicode/gencodec.py | 253 | 356 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,976 | pymap | def pymap(name,map,pyfile,encodingname,comments=1):
code = codegen(name,map,encodingname,comments)
with open(pyfile,'w') as f:
f.write(code) | python | Tools/unicode/gencodec.py | 358 | 362 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,977 | marshalmap | def marshalmap(name,map,marshalfile):
d = {}
for e,(u,c) in map.items():
d[e] = (u,c)
with open(marshalfile,'wb') as f:
marshal.dump(d,f) | python | Tools/unicode/gencodec.py | 364 | 370 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,978 | convertdir | def convertdir(dir, dirprefix='', nameprefix='', comments=1):
mapnames = os.listdir(dir)
for mapname in mapnames:
mappathname = os.path.join(dir, mapname)
if not os.path.isfile(mappathname):
continue
name = os.path.split(mapname)[1]
name = name.replace('-','_')
... | python | Tools/unicode/gencodec.py | 372 | 398 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,979 | rewritepythondir | def rewritepythondir(dir, dirprefix='', comments=1):
mapnames = os.listdir(dir)
for mapname in mapnames:
if not mapname.endswith('.mapping'):
continue
name = mapname[:-len('.mapping')]
codefile = name + '.py'
print('converting %s to %s' % (mapname,
... | python | Tools/unicode/gencodec.py | 400 | 418 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,980 | main | def main():
mapfile = open_mapping_file('python-mappings/CP949.TXT', MAPPINGS_CP949)
print("Loading Mapping File...")
decmap = loadmap(mapfile)
uhcdecmap, ksx1001decmap, cp949encmap = {}, {}, {}
for c1, c2map in decmap.items():
for c2, code in c2map.items():
if c1 >= 0xa1 and c2 ... | python | Tools/unicode/genmap_korean.py | 21 | 58 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,981 | __init__ | def __init__(self, dawg):
self.id = dawg.next_id
dawg.next_id += 1
self.final = False
self.edges = {}
self.linear_edges = None # later: list of (string, next_state) | python | Tools/unicode/dawg.py | 27 | 33 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,982 | __str__ | def __str__(self):
if self.final:
arr = ["1"]
else:
arr = ["0"]
for (label, node) in sorted(self.edges.items()):
arr.append(label)
arr.append(str(node.id))
return "_".join(arr) | python | Tools/unicode/dawg.py | 35 | 45 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,983 | _as_tuple | def _as_tuple(self):
edges = sorted(self.edges.items())
edge_tuple = tuple((label, node.id) for label, node in edges)
return (self.final, edge_tuple) | python | Tools/unicode/dawg.py | 48 | 51 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,984 | __hash__ | def __hash__(self):
return hash(self._as_tuple()) | python | Tools/unicode/dawg.py | 53 | 54 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,985 | __eq__ | def __eq__(self, other):
return self._as_tuple() == other._as_tuple() | python | Tools/unicode/dawg.py | 56 | 57 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,986 | num_reachable_linear | def num_reachable_linear(self):
# returns the number of different paths to final nodes reachable from
# this one
count = 0
# staying at self counts as a path if self is final
if self.final:
count += 1
for label, node in self.linear_edges:
count +=... | python | Tools/unicode/dawg.py | 60 | 71 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,987 | __init__ | def __init__(self):
self.previous_word = ""
self.next_id = 0
self.root = DawgNode(self)
# Here is a list of nodes that have not been checked for duplication.
self.unchecked_nodes = []
# To deduplicate, maintain a dictionary with
# minimized_nodes[canonical_node]... | python | Tools/unicode/dawg.py | 75 | 94 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,988 | insert | def insert(self, word, value):
if not all(0 <= ord(c) < 128 for c in word):
raise ValueError("Use 7-bit ASCII characters only")
if word <= self.previous_word:
raise ValueError("Error: Words must be inserted in alphabetical order.")
if value in self.inverse:
ra... | python | Tools/unicode/dawg.py | 96 | 133 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,989 | finish | def finish(self):
if not self.data:
raise ValueError("need at least one word in the dawg")
# minimize all unchecked_nodes
self._minimize(0)
self._linearize_edges()
topoorder, linear_data, inverse = self._topological_order()
return self.compute_packed(topoord... | python | Tools/unicode/dawg.py | 135 | 144 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,990 | _minimize | def _minimize(self, down_to):
# proceed from the leaf up to a certain point
for i in range(len(self.unchecked_nodes) - 1, down_to - 1, -1):
(parent, letter, child) = self.unchecked_nodes[i]
if child in self.minimized_nodes:
# replace the child with the previously ... | python | Tools/unicode/dawg.py | 146 | 156 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,991 | _lookup | def _lookup(self, word):
""" Return an integer 0 <= k < number of strings in dawg
where word is the kth successful traversal of the dawg. """
node = self.root
skipped = 0 # keep track of number of final nodes that we skipped
index = 0
while index < len(word):
... | python | Tools/unicode/dawg.py | 158 | 178 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,992 | enum_all_nodes | def enum_all_nodes(self):
stack = [self.root]
done = set()
while stack:
node = stack.pop()
if node.id in done:
continue
yield node
done.add(node.id)
for label, child in sorted(node.edges.items()):
stack.a... | python | Tools/unicode/dawg.py | 180 | 190 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,993 | prettyprint | def prettyprint(self):
for node in sorted(self.enum_all_nodes(), key=lambda e: e.id):
s_final = " final" if node.final else ""
print(f"{node.id}: ({node}) {s_final}")
for label, child in sorted(node.edges.items()):
print(f" {label} goto {child.id}") | python | Tools/unicode/dawg.py | 192 | 197 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,994 | _inverse_lookup | def _inverse_lookup(self, number):
assert 0, "not working in the current form, but keep it as the pure python version of compact lookup"
result = []
node = self.root
while 1:
if node.final:
if pos == 0:
return "".join(result)
... | python | Tools/unicode/dawg.py | 199 | 217 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,995 | _linearize_edges | def _linearize_edges(self):
# compute "linear" edges. the idea is that long chains of edges without
# any of the intermediate states being final or any extra incoming or
# outgoing edges can be represented by having removing them, and
# instead using longer strings as edge labels (instea... | python | Tools/unicode/dawg.py | 219 | 237 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,996 | _topological_order | def _topological_order(self):
# compute reachable linear nodes, and the set of incoming edges for each node
order = []
stack = [self.root]
seen = set()
while stack:
# depth first traversal
node = stack.pop()
if node.id in seen:
... | python | Tools/unicode/dawg.py | 239 | 295 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,997 | compute_packed | def compute_packed(self, order):
def compute_chunk(node, offsets):
""" compute the packed node/edge data for a node. result is a
list of bytes as long as order. the jump distance calculations use
the offsets dictionary to know where in the final big output
bytestr... | python | Tools/unicode/dawg.py | 297 | 376 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,998 | compute_chunk | def compute_chunk(node, offsets):
""" compute the packed node/edge data for a node. result is a
list of bytes as long as order. the jump distance calculations use
the offsets dictionary to know where in the final big output
bytestring the individual nodes will end up. """... | python | Tools/unicode/dawg.py | 298 | 323 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
8,999 | compute_new_offsets | def compute_new_offsets(chunks, offsets):
""" Given a list of chunks, compute the new offsets (by adding the
chunk lengths together). Also check if we cannot shrink the output
further because none of the node offsets are smaller now. if that's
the case return None. """
... | python | Tools/unicode/dawg.py | 325 | 342 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,000 | number_add_bits | def number_add_bits(x, *bits):
for bit in bits:
assert bit == 0 or bit == 1
x = (x << 1) | bit
return x | python | Tools/unicode/dawg.py | 382 | 386 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.