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
9,701
r_byte
def r_byte(self) -> int: buf = self.r_string(1) return buf[0]
python
Tools/build/umarshal.py
102
104
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,702
r_short
def r_short(self) -> int: buf = self.r_string(2) x = buf[0] x |= buf[1] << 8 x |= -(x & (1<<15)) # Sign-extend return x
python
Tools/build/umarshal.py
106
111
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,703
r_long
def r_long(self) -> int: buf = self.r_string(4) x = buf[0] x |= buf[1] << 8 x |= buf[2] << 16 x |= buf[3] << 24 x |= -(x & (1<<31)) # Sign-extend return x
python
Tools/build/umarshal.py
113
120
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,704
r_long64
def r_long64(self) -> int: buf = self.r_string(8) x = buf[0] x |= buf[1] << 8 x |= buf[2] << 16 x |= buf[3] << 24 x |= buf[4] << 32 x |= buf[5] << 40 x |= buf[6] << 48 x |= buf[7] << 56 x |= -(x & (1<<63)) # Sign-extend return x
python
Tools/build/umarshal.py
122
133
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,705
r_PyLong
def r_PyLong(self) -> int: n = self.r_long() size = abs(n) x = 0 # Pray this is right for i in range(size): x |= self.r_short() << i*15 if n < 0: x = -x return x
python
Tools/build/umarshal.py
135
144
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,706
r_float_bin
def r_float_bin(self) -> float: buf = self.r_string(8) import struct # Lazy import to avoid breaking UNIX build return struct.unpack("d", buf)[0]
python
Tools/build/umarshal.py
146
149
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,707
r_float_str
def r_float_str(self) -> float: n = self.r_byte() buf = self.r_string(n) return ast.literal_eval(buf.decode("ascii"))
python
Tools/build/umarshal.py
151
154
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,708
r_ref_reserve
def r_ref_reserve(self, flag: int) -> int: if flag: idx = len(self.refs) self.refs.append(None) return idx else: return 0
python
Tools/build/umarshal.py
156
162
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,709
r_ref_insert
def r_ref_insert(self, obj: Any, idx: int, flag: int) -> Any: if flag: self.refs[idx] = obj return obj
python
Tools/build/umarshal.py
164
167
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,710
r_ref
def r_ref(self, obj: Any, flag: int) -> Any: assert flag & FLAG_REF self.refs.append(obj) return obj
python
Tools/build/umarshal.py
169
172
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,711
r_object
def r_object(self) -> Any: old_level = self.level try: return self._r_object() finally: self.level = old_level
python
Tools/build/umarshal.py
174
179
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,712
_r_object
def _r_object(self) -> Any: code = self.r_byte() flag = code & FLAG_REF type = code & ~FLAG_REF # print(" "*self.level + f"{code} {flag} {type} {chr(type)!r}") self.level += 1 def R_REF(obj: Any) -> Any: if flag: obj = self.r_ref(obj, flag) ...
python
Tools/build/umarshal.py
181
301
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,713
R_REF
def R_REF(obj: Any) -> Any: if flag: obj = self.r_ref(obj, flag) return obj
python
Tools/build/umarshal.py
188
191
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,714
loads
def loads(data: bytes) -> Any: assert isinstance(data, bytes) r = Reader(data) return r.r_object()
python
Tools/build/umarshal.py
304
307
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,715
main
def main(): # Test import marshal, pprint sample = {'foo': {(42, "bar", 3.14)}} data = marshal.dumps(sample) retval = loads(data) assert retval == sample, retval sample = main.__code__ data = marshal.dumps(sample) retval = loads(data) assert isinstance(retval, Code), retval p...
python
Tools/build/umarshal.py
310
321
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,716
is_local_symbol_type
def is_local_symbol_type(symtype): # Ignore local symbols. # If lowercase, the symbol is usually local; if uppercase, the symbol # is global (external). There are however a few lowercase symbols that # are shown for special global symbols ("u", "v" and "w"). if symtype.islower() and symtype not in...
python
Tools/build/smelly.py
29
44
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,717
get_exported_symbols
def get_exported_symbols(library, dynamic=False): print(f"Check that {library} only exports symbols starting with Py or _Py") # Only look at dynamic symbols args = ['nm', '--no-sort'] if dynamic: args.append('--dynamic') args.append(library) print("+ %s" % ' '.join(args)) proc = sub...
python
Tools/build/smelly.py
47
64
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,718
get_smelly_symbols
def get_smelly_symbols(stdout, dynamic=False): smelly_symbols = [] python_symbols = [] local_symbols = [] for line in stdout.splitlines(): # Split line '0000000000001b80 D PyTextIOWrapper_Type' if not line: continue parts = line.split(maxsplit=2) if len(part...
python
Tools/build/smelly.py
67
100
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,719
check_library
def check_library(library, dynamic=False): nm_output = get_exported_symbols(library, dynamic) smelly_symbols, python_symbols = get_smelly_symbols(nm_output, dynamic) if not smelly_symbols: print(f"OK: no smelly symbol found ({len(python_symbols)} Python symbols)") return 0 print() ...
python
Tools/build/smelly.py
103
118
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,720
check_extensions
def check_extensions(): print(__file__) # This assumes pybuilddir.txt is in same directory as pyconfig.h. # In the case of out-of-tree builds, we can't assume pybuilddir.txt is # in the source folder. config_dir = os.path.dirname(sysconfig.get_config_h_filename()) filename = os.path.join(config_...
python
Tools/build/smelly.py
121
150
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,721
main
def main(): nsymbol = 0 # static library LIBRARY = sysconfig.get_config_var('LIBRARY') if not LIBRARY: raise Exception("failed to get LIBRARY variable from sysconfig") if os.path.exists(LIBRARY): nsymbol += check_library(LIBRARY) # dynamic library LDLIBRARY = sysconfig.get_...
python
Tools/build/smelly.py
153
181
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,722
spdx_id
def spdx_id(value: str) -> str: """Encode a value into characters that are valid in an SPDX ID""" return re.sub(r"[^a-zA-Z0-9.\-]+", "-", value)
python
Tools/build/generate_sbom.py
86
88
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,723
error_if
def error_if(value: bool, error_message: str) -> None: """Prints an error if a comparison fails along with a link to the devguide""" if value: print(error_message) print("See 'https://devguide.python.org/developer-workflow/sbom' for more information.") sys.exit(1)
python
Tools/build/generate_sbom.py
91
96
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,724
filter_gitignored_paths
def filter_gitignored_paths(paths: list[str]) -> list[str]: """ Filter out paths excluded by the gitignore file. The output of 'git check-ignore --non-matching --verbose' looks like this for non-matching (included) files: '::<whitespace><path>' And looks like this for matching (excluded) f...
python
Tools/build/generate_sbom.py
99
131
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,725
get_externals
def get_externals() -> list[str]: """ Parses 'PCbuild/get_externals.bat' for external libraries. Returns a list of (git tag, name, version) tuples. """ get_externals_bat_path = CPYTHON_ROOT_DIR / "PCbuild/get_externals.bat" externals = re.findall( r"set\s+libraries\s*=\s*%libraries%\s+([...
python
Tools/build/generate_sbom.py
134
144
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,726
check_sbom_packages
def check_sbom_packages(sbom_data: dict[str, typing.Any]) -> None: """Make a bunch of assertions about the SBOM package data to ensure it's consistent.""" for package in sbom_data["packages"]: # Properties and ID must be properly formed. error_if( "name" not in package, ...
python
Tools/build/generate_sbom.py
147
212
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,727
create_source_sbom
def create_source_sbom() -> None: sbom_path = CPYTHON_ROOT_DIR / "Misc/sbom.spdx.json" sbom_data = json.loads(sbom_path.read_bytes()) # We regenerate all of this information. Package information # should be preserved though since that is edited by humans. sbom_data["files"] = [] sbom_data["rela...
python
Tools/build/generate_sbom.py
215
283
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,728
create_externals_sbom
def create_externals_sbom() -> None: sbom_path = CPYTHON_ROOT_DIR / "Misc/externals.spdx.json" sbom_data = json.loads(sbom_path.read_bytes()) externals = get_externals() externals_name_to_version = {} externals_name_to_git_tag = {} for git_tag in externals: name, _, version = git_tag.rp...
python
Tools/build/generate_sbom.py
286
322
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,729
main
def main() -> None: create_source_sbom() create_externals_sbom()
python
Tools/build/generate_sbom.py
325
327
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,730
list_builtin_modules
def list_builtin_modules(names): names |= set(sys.builtin_module_names)
python
Tools/build/generate_stdlib_module_names.py
53
54
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,731
list_python_modules
def list_python_modules(names): for filename in os.listdir(STDLIB_PATH): if not filename.endswith(".py"): continue name = filename.removesuffix(".py") names.add(name)
python
Tools/build/generate_stdlib_module_names.py
58
63
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,732
list_packages
def list_packages(names): for name in os.listdir(STDLIB_PATH): if name in IGNORE: continue package_path = os.path.join(STDLIB_PATH, name) if not os.path.isdir(package_path): continue if any(package_file.endswith(".py") for package_file in os.lis...
python
Tools/build/generate_stdlib_module_names.py
67
76
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,733
list_modules_setup_extensions
def list_modules_setup_extensions(names): checker = ModuleChecker() names.update(checker.list_module_names(all=True))
python
Tools/build/generate_stdlib_module_names.py
81
83
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,734
list_frozen
def list_frozen(names): submodules = set() for name in _imp._frozen_module_names(): # To skip __hello__, __hello_alias__ and etc. if name.startswith('__'): continue if '.' in name: submodules.add(name) else: names.add(name) # Make sure all ...
python
Tools/build/generate_stdlib_module_names.py
88
103
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,735
list_modules
def list_modules(): names = set() list_builtin_modules(names) list_modules_setup_extensions(names) list_packages(names) list_python_modules(names) list_frozen(names) # Remove ignored packages and modules for name in list(names): package_name = name.split('.')[0] # packa...
python
Tools/build/generate_stdlib_module_names.py
106
129
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,736
write_modules
def write_modules(fp, names): print(f"// Auto-generated by {SCRIPT_NAME}.", file=fp) print("// List used to create sys.stdlib_module_names.", file=fp) print(file=fp) print("static const char* _Py_stdlib_module_names[] = {", file=fp) for name in sorted(names): print(f'"{name}",', fi...
python
Tools/build/generate_stdlib_module_names.py
132
140
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,737
main
def main(): if not sysconfig.is_python_build(): print(f"ERROR: {sys.executable} is not a Python build", file=sys.stderr) sys.exit(1) fp = sys.stdout names = list_modules() write_modules(fp, names)
python
Tools/build/generate_stdlib_module_names.py
143
151
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,738
get_json
def get_json(url): """Download the json file from the url and returns a decoded object.""" with urlopen(url) as f: data = f.read().decode('utf-8') return json.loads(data)
python
Tools/build/parse_html5_entities.py
26
30
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,739
create_dict
def create_dict(entities): """Create the html5 dict from the decoded json object.""" new_html5 = {} for name, value in entities.items(): new_html5[name.lstrip('&')] = value['characters'] return new_html5
python
Tools/build/parse_html5_entities.py
32
37
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,740
compare_dicts
def compare_dicts(old, new): """Compare the old and new dicts and print the differences.""" added = new.keys() - old.keys() if added: print('{} entitie(s) have been added:'.format(len(added))) for name in sorted(added): print(' {!r}: {!r}'.format(name, new[name])) removed = ...
python
Tools/build/parse_html5_entities.py
39
58
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,741
write_items
def write_items(entities, file=sys.stdout): """Write the items of the dictionary in the specified file.""" # The keys in the generated dictionary should be sorted # in a case-insensitive way, however, when two keys are equal, # the uppercase version should come first so that the result # looks like:...
python
Tools/build/parse_html5_entities.py
60
81
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,742
__bool__
def __bool__(self): return self.value in {"builtin", "shared"}
python
Tools/build/check_extension_modules.py
121
122
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,743
__init__
def __init__(self, cross_compiling: bool = False, strict: bool = False): self.cross_compiling = cross_compiling self.strict_extensions_build = strict self.ext_suffix = sysconfig.get_config_var("EXT_SUFFIX") self.platform = sysconfig.get_platform() self.builddir = self.get_builddi...
python
Tools/build/check_extension_modules.py
139
153
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,744
check
def check(self): for modinfo in self.modules: logger.debug("Checking '%s' (%s)", modinfo.name, self.get_location(modinfo)) if modinfo.state == ModuleState.DISABLED: self.disabled_configure.append(modinfo) elif modinfo.state == ModuleState.DISABLED_SETUP: ...
python
Tools/build/check_extension_modules.py
155
180
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,745
summary
def summary(self, *, verbose: bool = False): longest = max([len(e.name) for e in self.modules], default=0) def print_three_column(modinfos: list[ModuleInfo]): names = [modinfo.name for modinfo in modinfos] names.sort(key=str.lower) # guarantee zip() doesn't drop anyt...
python
Tools/build/check_extension_modules.py
182
253
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,746
print_three_column
def print_three_column(modinfos: list[ModuleInfo]): names = [modinfo.name for modinfo in modinfos] names.sort(key=str.lower) # guarantee zip() doesn't drop anything while len(names) % 3: names.append("") for l, m, r in zip(names[::3], names[1::...
python
Tools/build/check_extension_modules.py
185
192
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,747
check_strict_build
def check_strict_build(self): """Fail if modules are missing and it's a strict build""" if self.strict_extensions_build and (self.failed_on_import or self.missing): raise RuntimeError("Failed to build some stdlib modules")
python
Tools/build/check_extension_modules.py
255
258
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,748
list_module_names
def list_module_names(self, *, all: bool = False) -> set: names = {modinfo.name for modinfo in self.modules} if all: names.update(WINDOWS_MODULES) return names
python
Tools/build/check_extension_modules.py
260
264
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,749
get_builddir
def get_builddir(self) -> pathlib.Path: try: with open(self.pybuilddir_txt, encoding="utf-8") as f: builddir = f.read() except FileNotFoundError: logger.error("%s must be run from the top build directory", __file__) raise builddir = pathlib.Pat...
python
Tools/build/check_extension_modules.py
266
275
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,750
get_modules
def get_modules(self) -> list[ModuleInfo]: """Get module info from sysconfig and Modules/Setup* files""" seen = set() modules = [] # parsing order is important, first entry wins for modinfo in self.get_core_modules(): modules.append(modinfo) seen.add(modin...
python
Tools/build/check_extension_modules.py
277
296
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,751
get_core_modules
def get_core_modules(self) -> Iterable[ModuleInfo]: """Get hard-coded core modules""" for name in CORE_MODULES: modinfo = ModuleInfo(name, ModuleState.BUILTIN) logger.debug("Found core module %s", modinfo) yield modinfo
python
Tools/build/check_extension_modules.py
298
303
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,752
get_sysconfig_modules
def get_sysconfig_modules(self) -> Iterable[ModuleInfo]: """Get modules defined in Makefile through sysconfig MODBUILT_NAMES: modules in *static* block MODSHARED_NAMES: modules in *shared* block MODDISABLED_NAMES: modules in *disabled* block """ moddisabled = set(sysconf...
python
Tools/build/check_extension_modules.py
305
339
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,753
parse_setup_file
def parse_setup_file(self, setup_file: pathlib.Path) -> Iterable[ModuleInfo]: """Parse a Modules/Setup file""" assign_var = re.compile(r"^\w+=") # EGG_SPAM=foo # default to static module state = ModuleState.BUILTIN logger.debug("Parsing Setup file %s", setup_file) with o...
python
Tools/build/check_extension_modules.py
341
372
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,754
get_spec
def get_spec(self, modinfo: ModuleInfo) -> ModuleSpec: """Get ModuleSpec for builtin or extension module""" if modinfo.state == ModuleState.SHARED: location = os.fspath(self.get_location(modinfo)) loader = ExtensionFileLoader(modinfo.name, location) return spec_from_f...
python
Tools/build/check_extension_modules.py
374
383
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,755
get_location
def get_location(self, modinfo: ModuleInfo) -> pathlib.Path: """Get shared library location in build directory""" if modinfo.state == ModuleState.SHARED: return self.builddir / f"{modinfo.name}{self.ext_suffix}" else: return None
python
Tools/build/check_extension_modules.py
385
390
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,756
_check_file
def _check_file(self, modinfo: ModuleInfo, spec: ModuleSpec): """Check that the module file is present and not empty""" if spec.loader is BuiltinImporter: return try: st = os.stat(spec.origin) except FileNotFoundError: logger.error("%s (%s) is missing"...
python
Tools/build/check_extension_modules.py
392
402
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,757
check_module_import
def check_module_import(self, modinfo: ModuleInfo): """Attempt to import module and report errors""" spec = self.get_spec(modinfo) self._check_file(modinfo, spec) try: with warnings.catch_warnings(): # ignore deprecation warning from deprecated modules ...
python
Tools/build/check_extension_modules.py
404
418
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,758
check_module_cross
def check_module_cross(self, modinfo: ModuleInfo): """Sanity check for cross compiling""" spec = self.get_spec(modinfo) self._check_file(modinfo, spec)
python
Tools/build/check_extension_modules.py
420
423
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,759
rename_module
def rename_module(self, modinfo: ModuleInfo) -> None: """Rename module file""" if modinfo.state == ModuleState.BUILTIN: logger.error("Cannot mark builtin module '%s' as failed!", modinfo.name) return failed_name = f"{modinfo.name}_failed{self.ext_suffix}" builddi...
python
Tools/build/check_extension_modules.py
425
453
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,760
main
def main(): args = parser.parse_args() if args.debug: args.verbose = True logging.basicConfig( level=logging.DEBUG if args.debug else logging.INFO, format="[%(levelname)s] %(message)s", ) checker = ModuleChecker( cross_compiling=args.cross_compiling, strict=a...
python
Tools/build/check_extension_modules.py
456
479
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,761
__init__
def __init__(self, *args, **kwargs): self.currentResult = None self.running = 0 self.__rollbackImporter = RollbackImporter() self.test_suite = None #test discovery variables self.directory_to_read = '' self.top_level_dir = '' self.test_file_glob_pattern =...
python
Tools/unittestgui/unittestgui.py
54
65
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,762
errorDialog
def errorDialog(self, title, message): "Override to display an error arising from GUI usage" pass
python
Tools/unittestgui/unittestgui.py
67
69
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,763
getDirectoryToDiscover
def getDirectoryToDiscover(self): "Override to prompt user for directory to perform test discovery" pass
python
Tools/unittestgui/unittestgui.py
71
73
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,764
runClicked
def runClicked(self): "To be called in response to user choosing to run a test" if self.running: return if not self.test_suite: self.errorDialog("Test Discovery", "You discover some tests first!") return self.currentResult = GUITestResult(self) self.totalT...
python
Tools/unittestgui/unittestgui.py
75
87
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,765
stopClicked
def stopClicked(self): "To be called in response to user stopping the running of a test" if self.currentResult: self.currentResult.stop()
python
Tools/unittestgui/unittestgui.py
89
92
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,766
discoverClicked
def discoverClicked(self): self.__rollbackImporter.rollbackImports() directory = self.getDirectoryToDiscover() if not directory: return self.directory_to_read = directory try: # Explicitly use 'None' value if no top level directory is # specifi...
python
Tools/unittestgui/unittestgui.py
94
113
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,767
notifyTestsDiscovered
def notifyTestsDiscovered(self, test_suite): "Override to display information about the suite of discovered tests" pass
python
Tools/unittestgui/unittestgui.py
117
119
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,768
notifyRunning
def notifyRunning(self): "Override to set GUI in 'running' mode, enabling 'stop' button etc." pass
python
Tools/unittestgui/unittestgui.py
121
123
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,769
notifyStopped
def notifyStopped(self): "Override to set GUI in 'stopped' mode, enabling 'run' button etc." pass
python
Tools/unittestgui/unittestgui.py
125
127
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,770
notifyTestFailed
def notifyTestFailed(self, test, err): "Override to indicate that a test has just failed" pass
python
Tools/unittestgui/unittestgui.py
129
131
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,771
notifyTestErrored
def notifyTestErrored(self, test, err): "Override to indicate that a test has just errored" pass
python
Tools/unittestgui/unittestgui.py
133
135
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,772
notifyTestSkipped
def notifyTestSkipped(self, test, reason): "Override to indicate that test was skipped" pass
python
Tools/unittestgui/unittestgui.py
137
139
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,773
notifyTestFailedExpectedly
def notifyTestFailedExpectedly(self, test, err): "Override to indicate that test has just failed expectedly" pass
python
Tools/unittestgui/unittestgui.py
141
143
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,774
notifyTestStarted
def notifyTestStarted(self, test): "Override to indicate that a test is about to run" pass
python
Tools/unittestgui/unittestgui.py
145
147
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,775
notifyTestFinished
def notifyTestFinished(self, test): """Override to indicate that a test has finished (it may already have failed or errored)""" pass
python
Tools/unittestgui/unittestgui.py
149
152
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,776
__init__
def __init__(self, callback): unittest.TestResult.__init__(self) self.callback = callback
python
Tools/unittestgui/unittestgui.py
159
161
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,777
addError
def addError(self, test, err): unittest.TestResult.addError(self, test, err) self.callback.notifyTestErrored(test, err)
python
Tools/unittestgui/unittestgui.py
163
165
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,778
addFailure
def addFailure(self, test, err): unittest.TestResult.addFailure(self, test, err) self.callback.notifyTestFailed(test, err)
python
Tools/unittestgui/unittestgui.py
167
169
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,779
addSkip
def addSkip(self, test, reason): super(GUITestResult,self).addSkip(test, reason) self.callback.notifyTestSkipped(test, reason)
python
Tools/unittestgui/unittestgui.py
171
173
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,780
addExpectedFailure
def addExpectedFailure(self, test, err): super(GUITestResult,self).addExpectedFailure(test, err) self.callback.notifyTestFailedExpectedly(test, err)
python
Tools/unittestgui/unittestgui.py
175
177
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,781
stopTest
def stopTest(self, test): unittest.TestResult.stopTest(self, test) self.callback.notifyTestFinished(test)
python
Tools/unittestgui/unittestgui.py
179
181
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,782
startTest
def startTest(self, test): unittest.TestResult.startTest(self, test) self.callback.notifyTestStarted(test)
python
Tools/unittestgui/unittestgui.py
183
185
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,783
__init__
def __init__(self): self.previousModules = sys.modules.copy()
python
Tools/unittestgui/unittestgui.py
192
193
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,784
rollbackImports
def rollbackImports(self): for modname in sys.modules.copy().keys(): if not modname in self.previousModules: # Force reload when modname next imported del(sys.modules[modname])
python
Tools/unittestgui/unittestgui.py
195
199
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,785
__init__
def __init__(self, master, top_level_dir, test_file_glob_pattern, *args, **kwargs): self.top_level_dir = top_level_dir self.dirVar = tk.StringVar() self.dirVar.set(top_level_dir) self.test_file_glob_pattern = test_file_glob_pattern self.testPatternVar = tk.StringVar() se...
python
Tools/unittestgui/unittestgui.py
211
221
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,786
body
def body(self, master): tk.Label(master, text="Top Level Directory").grid(row=0) self.e1 = tk.Entry(master, textvariable=self.dirVar) self.e1.grid(row = 0, column=1) tk.Button(master, text="...", command=lambda: self.selectDirClicked(master)).grid(row=0,column=3) ...
python
Tools/unittestgui/unittestgui.py
223
233
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,787
selectDirClicked
def selectDirClicked(self, master): dir_path = filedialog.askdirectory(parent=master) if dir_path: self.dirVar.set(dir_path)
python
Tools/unittestgui/unittestgui.py
235
238
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,788
apply
def apply(self): self.top_level_dir = self.dirVar.get() self.test_file_glob_pattern = self.testPatternVar.get()
python
Tools/unittestgui/unittestgui.py
240
242
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,789
initGUI
def initGUI(self, root, initialTestName): """Set up the GUI inside the given root window. The test name entry field will be pre-filled with the given initialTestName. """ self.root = root self.statusVar = tk.StringVar() self.statusVar.set("Idle") #tk vars for tr...
python
Tools/unittestgui/unittestgui.py
247
266
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,790
getDirectoryToDiscover
def getDirectoryToDiscover(self): return filedialog.askdirectory()
python
Tools/unittestgui/unittestgui.py
268
269
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,791
settingsClicked
def settingsClicked(self): d = DiscoverSettingsDialog(self.top, self.top_level_dir, self.test_file_glob_pattern) self.top_level_dir = d.top_level_dir self.test_file_glob_pattern = d.test_file_glob_pattern
python
Tools/unittestgui/unittestgui.py
271
274
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,792
notifyTestsDiscovered
def notifyTestsDiscovered(self, test_suite): discovered = test_suite.countTestCases() self.runCountVar.set(0) self.failCountVar.set(0) self.errorCountVar.set(0) self.remainingCountVar.set(discovered) self.progressBar.setProgressFraction(0.0) self.errorListbox.dele...
python
Tools/unittestgui/unittestgui.py
276
286
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,793
createWidgets
def createWidgets(self): """Creates and packs the various widgets. Why is it that GUI code always ends up looking a mess, despite all the best intentions to keep it tidy? Answers on a postcard, please. """ # Status bar statusFrame = tk.Frame(self.top, relief=tk.SUNKEN, b...
python
Tools/unittestgui/unittestgui.py
288
357
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,794
errorDialog
def errorDialog(self, title, message): messagebox.showerror(parent=self.root, title=title, message=message)
python
Tools/unittestgui/unittestgui.py
359
361
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,795
notifyRunning
def notifyRunning(self): self.runCountVar.set(0) self.failCountVar.set(0) self.errorCountVar.set(0) self.remainingCountVar.set(self.totalTests) self.errorInfo = [] while self.errorListbox.size(): self.errorListbox.delete(0) #Stopping seems not to work,...
python
Tools/unittestgui/unittestgui.py
363
375
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,796
notifyStopped
def notifyStopped(self): self.stopGoButton.config(state=tk.DISABLED) #self.stopGoButton.config(command=self.runClicked, text="Start") self.statusVar.set("Idle")
python
Tools/unittestgui/unittestgui.py
377
380
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,797
notifyTestStarted
def notifyTestStarted(self, test): self.statusVar.set(str(test)) self.top.update_idletasks()
python
Tools/unittestgui/unittestgui.py
382
384
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,798
notifyTestFailed
def notifyTestFailed(self, test, err): self.failCountVar.set(1 + self.failCountVar.get()) self.errorListbox.insert(tk.END, "Failure: %s" % test) self.errorInfo.append((test,err))
python
Tools/unittestgui/unittestgui.py
386
389
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,799
notifyTestErrored
def notifyTestErrored(self, test, err): self.errorCountVar.set(1 + self.errorCountVar.get()) self.errorListbox.insert(tk.END, "Error: %s" % test) self.errorInfo.append((test,err))
python
Tools/unittestgui/unittestgui.py
391
394
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
9,800
notifyTestSkipped
def notifyTestSkipped(self, test, reason): super(TkTestRunner, self).notifyTestSkipped(test, reason) self.skipCountVar.set(1 + self.skipCountVar.get())
python
Tools/unittestgui/unittestgui.py
396
398
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }