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,001
find_or_add
def find_or_add(xml, element, attr=None, always_add=False): if always_add: e = None else: q = element if attr: q += "[@{}='{}']".format(*attr) e = xml.find(q, APPXMANIFEST_NS) if e is None: prefix, _, name = element.partition(":") name = ET.QName(A...
python
PC/layout/support/appxmanifest.py
247
261
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,002
_get_app
def _get_app(xml, appid): if appid: app = xml.find( "m:Applications/m:Application[@Id='{}']".format(appid), APPXMANIFEST_NS ) if app is None: raise LookupError(appid) else: app = xml return app
python
PC/layout/support/appxmanifest.py
264
273
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,003
add_visual
def add_visual(xml, appid, data): app = _get_app(xml, appid) e = find_or_add(app, "uap:VisualElements") for i in data.items(): e.set(*i) return e
python
PC/layout/support/appxmanifest.py
276
281
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,004
add_alias
def add_alias(xml, appid, alias, subsystem="windows"): app = _get_app(xml, appid) e = find_or_add(app, "m:Extensions") e = find_or_add(e, "uap5:Extension", ("Category", "windows.appExecutionAlias")) e = find_or_add(e, "uap5:AppExecutionAlias") e.set(ET.QName(APPXMANIFEST_NS["desktop4"], "Subsystem")...
python
PC/layout/support/appxmanifest.py
284
290
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,005
add_file_type
def add_file_type(xml, appid, name, suffix, parameters='"%1"', info=None, logo=None): app = _get_app(xml, appid) e = find_or_add(app, "m:Extensions") e = find_or_add(e, "uap3:Extension", ("Category", "windows.fileTypeAssociation")) e = find_or_add(e, "uap3:FileTypeAssociation", ("Name", name)) e.set...
python
PC/layout/support/appxmanifest.py
293
307
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,006
add_application
def add_application( ns, xml, appid, executable, aliases, visual_element, subsystem, file_types ): node = xml.find("m:Applications", APPXMANIFEST_NS) suffix = "_d.exe" if ns.debug else ".exe" app = ET.SubElement( node, ET.QName(APPXMANIFEST_NS[""], "Application"), { "...
python
PC/layout/support/appxmanifest.py
310
331
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,007
_get_registry_entries
def _get_registry_entries(ns, root="", d=None): r = root if root else PureWindowsPath("") if d is None: d = REGISTRY for key, value in d.items(): if key == "_condition": continue if value is SPECIAL_LOOKUP: if key == "SysArchitecture": value = ...
python
PC/layout/support/appxmanifest.py
334
362
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,008
add_registry_entries
def add_registry_entries(ns, xml): e = find_or_add(xml, "m:Extensions") e = find_or_add(e, "rescap4:Extension") e.set("Category", "windows.classicAppCompatKeys") e.set("EntryPoint", "Windows.FullTrustApplication") e = ET.SubElement(e, ET.QName(APPXMANIFEST_NS["rescap4"], "ClassicAppCompatKeys")) ...
python
PC/layout/support/appxmanifest.py
365
379
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,009
disable_registry_virtualization
def disable_registry_virtualization(xml): e = find_or_add(xml, "m:Properties") e = find_or_add(e, "desktop6:RegistryWriteVirtualization") e.text = "disabled" e = find_or_add(xml, "m:Capabilities") e = find_or_add(e, "rescap:Capability", ("Name", "unvirtualizedResources"))
python
PC/layout/support/appxmanifest.py
382
387
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,010
get_appxmanifest
def get_appxmanifest(ns): for k, v in APPXMANIFEST_NS.items(): ET.register_namespace(k, v) ET.register_namespace("", APPXMANIFEST_NS["m"]) xml = ET.parse(io.StringIO(APPXMANIFEST_TEMPLATE)) NS = APPXMANIFEST_NS QN = ET.QName data = dict(APPX_DATA) for k, v in zip(APPX_PLATFORM_DATA...
python
PC/layout/support/appxmanifest.py
390
486
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,011
get_resources_xml
def get_resources_xml(ns): return RESOURCES_XML_TEMPLATE.encode("utf-8")
python
PC/layout/support/appxmanifest.py
489
490
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,012
get_appx_layout
def get_appx_layout(ns): if not ns.include_appxmanifest: return yield "AppxManifest.xml", ("AppxManifest.xml", get_appxmanifest(ns)) yield "_resources.xml", ("_resources.xml", get_resources_xml(ns)) icons = ns.source / "PC" / "icons" for px in [44, 50, 150]: src = icons / "pythonx{}...
python
PC/layout/support/appxmanifest.py
493
518
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,013
get_props_layout
def get_props_layout(ns): if ns.include_all or ns.include_props: # TODO: Filter contents of props file according to included/excluded items d = dict(PROPS_DATA) if not d.get("PYTHON_PLATFORM"): d["PYTHON_PLATFORM"] = { "win32": "Win32", "amd64": "X...
python
PC/layout/support/props.py
83
95
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,014
get_pip_dir
def get_pip_dir(ns): if ns.copy: if ns.zip_lib: return ns.copy / "packages" return ns.copy / "Lib" / "site-packages" else: return ns.temp / "packages"
python
PC/layout/support/pip.py
19
25
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,015
get_pip_layout
def get_pip_layout(ns): pip_dir = get_pip_dir(ns) if not pip_dir.is_dir(): log_warning("Failed to find {} - pip will not be included", pip_dir) else: pkg_root = "packages/{}" if ns.zip_lib else "Lib/site-packages/{}" for dest, src in rglob(pip_dir, "**/*"): yield pkg_root...
python
PC/layout/support/pip.py
28
41
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,016
extract_pip_files
def extract_pip_files(ns): dest = get_pip_dir(ns) try: dest.mkdir(parents=True, exist_ok=False) except IOError: return src = ns.source / "Lib" / "ensurepip" / "_bundled" ns.temp.mkdir(parents=True, exist_ok=True) wheels = [shutil.copy(whl, ns.temp) for whl in src.glob("*.whl")]...
python
PC/layout/support/pip.py
44
93
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,017
_get_nuspec_data_overrides
def _get_nuspec_data_overrides(ns): arch = ns.arch if ns.include_freethreaded: arch += "t" for k, v in zip(NUSPEC_PLATFORM_DATA["_keys"], NUSPEC_PLATFORM_DATA[arch]): ev = os.getenv("PYTHON_NUSPEC_" + k) if ev: yield k, ev yield k, v
python
PC/layout/support/nuspec.py
64
72
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,018
get_nuspec_layout
def get_nuspec_layout(ns): if ns.include_all or ns.include_nuspec: data = dict(NUSPEC_DATA) for k, v in _get_nuspec_data_overrides(ns): if not data.get(k): data[k] = v if ns.include_all or ns.include_props: data["FILELIST"] = FILELIST_WITH_PROPS ...
python
PC/layout/support/nuspec.py
75
85
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,019
__init__
def __init__(self, *patterns): self._names = set() self._prefixes = [] self._suffixes = [] for p in map(os.path.normcase, patterns): if p.endswith("*"): self._prefixes.append(p[:-1]) elif p.startswith("*"): self._suffixes.append(p[1...
python
PC/layout/support/filesets.py
12
22
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,020
_make_name
def _make_name(self, f): return os.path.normcase(f.stem)
python
PC/layout/support/filesets.py
24
25
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,021
__contains__
def __contains__(self, f): bn = self._make_name(f) return ( bn in self._names or any(map(bn.startswith, self._prefixes)) or any(map(bn.endswith, self._suffixes)) )
python
PC/layout/support/filesets.py
27
33
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,022
_make_name
def _make_name(self, f): return os.path.normcase(f.name)
python
PC/layout/support/filesets.py
37
38
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,023
__init__
def __init__(self, *patterns): self._names = set() self._prefixes = [] self._suffixes = [] for p in map(os.path.normcase, patterns): if p.startswith("*."): self._names.add(p[1:]) elif p.startswith("*"): self._suffixes.append(p[1:]) ...
python
PC/layout/support/filesets.py
42
56
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,024
_make_name
def _make_name(self, f): return os.path.normcase(f.suffix)
python
PC/layout/support/filesets.py
58
59
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,025
__contains__
def __contains__(self, f): bn = self._make_name(f) return ( bn in self._names or any(map(bn.startswith, self._prefixes)) or any(map(bn.endswith, self._suffixes)) )
python
PC/layout/support/filesets.py
61
67
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,026
_rglob
def _rglob(root, pattern, condition): dirs = [root] recurse = pattern[:3] in {"**/", "**\\"} if recurse: pattern = pattern[3:] while dirs: d = dirs.pop(0) if recurse: dirs.extend( filter( condition, (type(root)(f2) for f2 in os.sca...
python
PC/layout/support/filesets.py
70
88
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,027
_return_true
def _return_true(f): return True
python
PC/layout/support/filesets.py
91
92
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,028
rglob
def rglob(root, patterns, condition=None): if not os.path.isdir(root): return if isinstance(patterns, tuple): for p in patterns: yield from _rglob(root, p, condition or _return_true) else: yield from _rglob(root, patterns, condition or _return_true)
python
PC/layout/support/filesets.py
95
102
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,029
_file_search
def _file_search(fname, pat): with open(fname, encoding="utf-8") as f: for line in f: match = pat.search(line) if match is not None: yield match
python
Tools/ssl/make_ssl_data.py
30
35
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,030
parse_err_h
def parse_err_h(args): """Parse err codes, e.g. ERR_LIB_X509: 11""" pat = re.compile(r"#\s*define\W+ERR_LIB_(\w+)\s+(\d+)") lib2errnum = {} for match in _file_search(args.err_h, pat): libname, num = match.groups() lib2errnum[libname] = int(num) return lib2errnum
python
Tools/ssl/make_ssl_data.py
38
46
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,031
parse_openssl_error_text
def parse_openssl_error_text(args): """Parse error reasons, X509_R_AKID_MISMATCH""" # ignore backslash line continuation for now pat = re.compile(r"^((\w+?)_R_(\w+)):(\d+):") for match in _file_search(args.errtxt, pat): reason, libname, errname, num = match.groups() if "_F_" in reason: ...
python
Tools/ssl/make_ssl_data.py
49
59
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,032
parse_extra_reasons
def parse_extra_reasons(args): """Parse extra reasons from openssl.ec""" pat = re.compile(r"^R\s+((\w+)_R_(\w+))\s+(\d+)") for match in _file_search(args.errcodes, pat): reason, libname, errname, num = match.groups() num = int(num) yield reason, libname, errname, num
python
Tools/ssl/make_ssl_data.py
62
68
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,033
gen_library_codes
def gen_library_codes(args): """Generate table short libname to numeric code""" yield "static struct py_ssl_library_code library_codes[] = {" for libname in sorted(args.lib2errnum): yield f"#ifdef ERR_LIB_{libname}" yield f' {{"{libname}", ERR_LIB_{libname}}},' yield "#endif" ...
python
Tools/ssl/make_ssl_data.py
71
80
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,034
gen_error_codes
def gen_error_codes(args): """Generate error code table for error reasons""" yield "static struct py_ssl_error_code error_codes[] = {" for reason, libname, errname, num in args.reasons: yield f" #ifdef {reason}" yield f' {{"{errname}", ERR_LIB_{libname}, {reason}}},' yield " #el...
python
Tools/ssl/make_ssl_data.py
83
95
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,035
main
def main(): args = parser.parse_args() args.err_h = os.path.join(args.srcdir, "include", "openssl", "err.h") if not os.path.isfile(args.err_h): # Fall back to infile for OpenSSL 3.0.0 args.err_h += ".in" args.errcodes = os.path.join(args.srcdir, "crypto", "err", "openssl.ec") args.e...
python
Tools/ssl/make_ssl_data.py
98
135
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,036
__init__
def __init__(self, version, args): self.version = version self.args = args # installation directory self.install_dir = os.path.join( os.path.join(args.base_directory, self.library.lower()), version ) # source file self.src_dir = os.path.join(args.base_...
python
Tools/ssl/multissltests.py
166
180
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,037
__str__
def __str__(self): return "<{0.__class__.__name__} for {0.version}>".format(self)
python
Tools/ssl/multissltests.py
182
183
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,038
__eq__
def __eq__(self, other): if not isinstance(other, AbstractBuilder): return NotImplemented return ( self.library == other.library and self.version == other.version )
python
Tools/ssl/multissltests.py
185
191
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,039
__hash__
def __hash__(self): return hash((self.library, self.version))
python
Tools/ssl/multissltests.py
193
194
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,040
short_version
def short_version(self): """Short version for OpenSSL download URL""" return None
python
Tools/ssl/multissltests.py
197
199
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,041
openssl_cli
def openssl_cli(self): """openssl CLI binary""" return os.path.join(self.install_dir, "bin", "openssl")
python
Tools/ssl/multissltests.py
202
204
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,042
openssl_version
def openssl_version(self): """output of 'bin/openssl version'""" cmd = [self.openssl_cli, "version"] return self._subprocess_output(cmd)
python
Tools/ssl/multissltests.py
207
210
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,043
pyssl_version
def pyssl_version(self): """Value of ssl.OPENSSL_VERSION""" cmd = [ sys.executable, '-c', 'import ssl; print(ssl.OPENSSL_VERSION)' ] return self._subprocess_output(cmd)
python
Tools/ssl/multissltests.py
213
219
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,044
include_dir
def include_dir(self): return os.path.join(self.install_dir, "include")
python
Tools/ssl/multissltests.py
222
223
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,045
lib_dir
def lib_dir(self): return os.path.join(self.install_dir, "lib")
python
Tools/ssl/multissltests.py
226
227
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,046
has_openssl
def has_openssl(self): return os.path.isfile(self.openssl_cli)
python
Tools/ssl/multissltests.py
230
231
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,047
has_src
def has_src(self): return os.path.isfile(self.src_file)
python
Tools/ssl/multissltests.py
234
235
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,048
_subprocess_call
def _subprocess_call(self, cmd, env=None, **kwargs): log.debug("Call '{}'".format(" ".join(cmd))) return subprocess.check_call(cmd, env=env, **kwargs)
python
Tools/ssl/multissltests.py
237
239
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,049
_subprocess_output
def _subprocess_output(self, cmd, env=None, **kwargs): log.debug("Call '{}'".format(" ".join(cmd))) if env is None: env = os.environ.copy() env["LD_LIBRARY_PATH"] = self.lib_dir out = subprocess.check_output(cmd, env=env, **kwargs) return out.strip().decode("utf-8...
python
Tools/ssl/multissltests.py
241
247
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,050
_download_src
def _download_src(self): """Download sources""" src_dir = os.path.dirname(self.src_file) if not os.path.isdir(src_dir): os.makedirs(src_dir) data = None for url_template in self.url_templates: url = url_template.format(v=self.version, s=self.short_version)...
python
Tools/ssl/multissltests.py
249
273
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,051
_unpack_src
def _unpack_src(self): """Unpack tar.gz bundle""" # cleanup if os.path.isdir(self.build_dir): shutil.rmtree(self.build_dir) os.makedirs(self.build_dir) tf = tarfile.open(self.src_file) name = self.build_template.format(self.version) base = name + '/' ...
python
Tools/ssl/multissltests.py
275
294
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,052
_build_src
def _build_src(self, config_args=()): """Now build openssl""" log.info("Running build in {}".format(self.build_dir)) cwd = self.build_dir cmd = [ "./config", *config_args, "shared", "--debug", "--prefix={}".format(self.install_dir) ] # ...
python
Tools/ssl/multissltests.py
296
316
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,053
_make_install
def _make_install(self): self._subprocess_call( ["make", "-j1", self.install_target], cwd=self.build_dir ) self._post_install() if not self.args.keep_sources: shutil.rmtree(self.build_dir)
python
Tools/ssl/multissltests.py
318
325
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,054
_post_install
def _post_install(self): pass
python
Tools/ssl/multissltests.py
327
328
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,055
install
def install(self): log.info(self.openssl_cli) if not self.has_openssl or self.args.force: if not self.has_src: self._download_src() else: log.debug("Already has src {}".format(self.src_file)) self._unpack_src() self._build_s...
python
Tools/ssl/multissltests.py
330
345
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,056
recompile_pymods
def recompile_pymods(self): log.warning("Using build from {}".format(self.build_dir)) # force a rebuild of all modules that use OpenSSL APIs for fname in self.module_files: os.utime(fname, None) # remove all build artefacts for root, dirs, files in os.walk('build'): ...
python
Tools/ssl/multissltests.py
347
368
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,057
check_imports
def check_imports(self): cmd = [sys.executable, "-c", "import _ssl; import _hashlib"] self._subprocess_call(cmd)
python
Tools/ssl/multissltests.py
370
372
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,058
check_pyssl
def check_pyssl(self): version = self.pyssl_version if self.version not in version: raise ValueError(version)
python
Tools/ssl/multissltests.py
374
377
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,059
run_python_tests
def run_python_tests(self, tests, network=True): if not tests: cmd = [ sys.executable, os.path.join(PYTHONROOT, 'Lib/test/ssltests.py'), '-j0' ] elif sys.version_info < (3, 3): cmd = [sys.executable, '-m', 'test.regrtest...
python
Tools/ssl/multissltests.py
379
394
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,060
_post_install
def _post_install(self): if self.version.startswith("3."): self._post_install_3xx()
python
Tools/ssl/multissltests.py
409
411
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,061
_build_src
def _build_src(self, config_args=()): if self.version.startswith("3."): config_args += ("enable-fips",) super()._build_src(config_args)
python
Tools/ssl/multissltests.py
413
416
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,062
_post_install_3xx
def _post_install_3xx(self): # create ssl/ subdir with example configs # Install FIPS module self._subprocess_call( ["make", "-j1", "install_ssldirs", "install_fips"], cwd=self.build_dir ) if not os.path.isdir(self.lib_dir): # 3.0.0-beta2 uses ...
python
Tools/ssl/multissltests.py
418
428
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,063
short_version
def short_version(self): """Short version for OpenSSL download URL""" mo = re.search(r"^(\d+)\.(\d+)\.(\d+)", self.version) parsed = tuple(int(m) for m in mo.groups()) if parsed < (1, 0, 0): return "0.9.x" if parsed >= (3, 0, 0): # OpenSSL 3.0.0 -> /old/3....
python
Tools/ssl/multissltests.py
431
440
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,064
configure_make
def configure_make(): if not os.path.isfile('Makefile'): log.info('Running ./configure') subprocess.check_call([ './configure', '--config-cache', '--quiet', '--with-pydebug' ]) log.info('Running make') subprocess.check_call(['make', '--quiet'])
python
Tools/ssl/multissltests.py
451
460
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,065
main
def main(): args = parser.parse_args() if not args.openssl and not args.libressl: args.openssl = list(OPENSSL_RECENT_VERSIONS) args.libressl = list(LIBRESSL_RECENT_VERSIONS) if not args.disable_ancient: args.openssl.extend(OPENSSL_OLD_VERSIONS) args.libressl.exten...
python
Tools/ssl/multissltests.py
463
539
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,066
_type_char_ptr
def _type_char_ptr(): return gdb.lookup_type('char').pointer() # char*
python
Tools/gdb/libpython.py
54
55
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,067
_type_unsigned_char_ptr
def _type_unsigned_char_ptr(): return gdb.lookup_type('unsigned char').pointer() # unsigned char*
python
Tools/gdb/libpython.py
58
59
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,068
_type_unsigned_short_ptr
def _type_unsigned_short_ptr(): return gdb.lookup_type('unsigned short').pointer()
python
Tools/gdb/libpython.py
62
63
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,069
_type_unsigned_int_ptr
def _type_unsigned_int_ptr(): return gdb.lookup_type('unsigned int').pointer()
python
Tools/gdb/libpython.py
66
67
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,070
_sizeof_void_p
def _sizeof_void_p(): return gdb.lookup_type('void').pointer().sizeof
python
Tools/gdb/libpython.py
69
70
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,071
_sizeof_pyobject
def _sizeof_pyobject(): return gdb.lookup_type('PyObject').sizeof
python
Tools/gdb/libpython.py
72
73
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,072
_managed_dict_offset
def _managed_dict_offset(): # See pycore_object.h pyobj = gdb.lookup_type("PyObject") if any(field.name == "ob_ref_local" for field in pyobj.fields()): return -1 * _sizeof_void_p() else: return -3 * _sizeof_void_p()
python
Tools/gdb/libpython.py
75
81
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,073
safety_limit
def safety_limit(val): # Given an integer value from the process being debugged, limit it to some # safety threshold so that arbitrary breakage within said process doesn't # break the gdb process too much (e.g. sizes of iterations, sizes of lists) return min(val, 1000)
python
Tools/gdb/libpython.py
113
117
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,074
safe_range
def safe_range(val): # As per range, but don't trust the value too much: cap it to a safety # threshold in case the data was corrupted return range(safety_limit(int(val)))
python
Tools/gdb/libpython.py
120
123
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,075
__init__
def __init__(self, maxlen=None): self._val = '' self.maxlen = maxlen
python
Tools/gdb/libpython.py
131
133
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,076
write
def write(self, data): if self.maxlen: if len(data) + len(self._val) > self.maxlen: # Truncation: self._val += data[0:self.maxlen - len(self._val)] raise StringTruncated() self._val += data
python
Tools/gdb/libpython.py
135
142
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,077
getvalue
def getvalue(self): return self._val
python
Tools/gdb/libpython.py
144
145
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,078
__init__
def __init__(self, gdbval, cast_to=None): if cast_to: self._gdbval = gdbval.cast(cast_to) else: self._gdbval = gdbval
python
Tools/gdb/libpython.py
160
164
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,079
field
def field(self, name): ''' Get the gdb.Value for the given field within the PyObject. Various libpython types are defined using the "PyObject_HEAD" and "PyObject_VAR_HEAD" macros. In Python, this is defined as an embedded PyVarObject type thus: PyVarObject ob_base; ...
python
Tools/gdb/libpython.py
166
190
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,080
pyop_field
def pyop_field(self, name): ''' Get a PyObjectPtr for the given PyObject* field within this PyObject. ''' return PyObjectPtr.from_pyobject_ptr(self.field(name))
python
Tools/gdb/libpython.py
192
196
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,081
write_field_repr
def write_field_repr(self, name, out, visited): ''' Extract the PyObject* field named "name", and write its representation to file-like object "out" ''' field_obj = self.pyop_field(name) field_obj.write_repr(out, visited)
python
Tools/gdb/libpython.py
198
204
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,082
get_truncated_repr
def get_truncated_repr(self, maxlen): ''' Get a repr-like string for the data, but truncate it at "maxlen" bytes (ending the object graph traversal as soon as you do) ''' out = TruncatedStringIO(maxlen) try: self.write_repr(out, set()) except StringTru...
python
Tools/gdb/libpython.py
206
219
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,083
type
def type(self): return PyTypeObjectPtr(self.field('ob_type'))
python
Tools/gdb/libpython.py
221
222
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,084
is_null
def is_null(self): return 0 == int(self._gdbval)
python
Tools/gdb/libpython.py
224
225
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,085
is_optimized_out
def is_optimized_out(self): ''' Is the value of the underlying PyObject* visible to the debugger? This can vary with the precise version of the compiler used to build Python, and the precise version of gdb. See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=556975 with ...
python
Tools/gdb/libpython.py
227
237
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,086
safe_tp_name
def safe_tp_name(self): try: ob_type = self.type() tp_name = ob_type.field('tp_name') return tp_name.string() # NullPyObjectPtr: NULL tp_name? # RuntimeError: Can't even read the object at all? # UnicodeDecodeError: Failed to decode tp_name bytestring ...
python
Tools/gdb/libpython.py
239
248
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,087
proxyval
def proxyval(self, visited): ''' Scrape a value from the inferior process, and try to represent it within the gdb process, whilst (hopefully) avoiding crashes when the remote data is corrupt. Derived classes will override this. For example, a PyLongObjectPtr* with long_...
python
Tools/gdb/libpython.py
250
287
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,088
__init__
def __init__(self, tp_name, address): self.tp_name = tp_name self.address = address
python
Tools/gdb/libpython.py
274
276
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,089
__repr__
def __repr__(self): # For the NULL pointer, we have no way of knowing a type, so # special-case it as per # http://bugs.python.org/issue8032#msg100882 if self.address == 0: return '0x0' return '<%s at remote 0x%x>' % (se...
python
Tools/gdb/libpython.py
278
284
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,090
write_repr
def write_repr(self, out, visited): ''' Write a string representation of the value scraped from the inferior process to "out", a file-like object. ''' # Default implementation: generate a proxy value and write its repr # However, this could involve a lot of work for compl...
python
Tools/gdb/libpython.py
289
297
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,091
subclass_from_type
def subclass_from_type(cls, t): ''' Given a PyTypeObjectPtr instance wrapping a gdb.Value that's a (PyTypeObject*), determine the corresponding subclass of PyObjectPtr to use Ideally, we would look up the symbols for the global types, but that isn't working yet: ...
python
Tools/gdb/libpython.py
300
364
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,092
from_pyobject_ptr
def from_pyobject_ptr(cls, gdbval): ''' Try to locate the appropriate derived class dynamically, and cast the pointer accordingly. ''' try: p = PyObjectPtr(gdbval) cls = cls.subclass_from_type(p.type()) return cls(gdbval, cast_to=cls.get_gdb_ty...
python
Tools/gdb/libpython.py
367
380
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,093
get_gdb_type
def get_gdb_type(cls): return gdb.lookup_type(cls._typename).pointer()
python
Tools/gdb/libpython.py
383
384
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,094
as_address
def as_address(self): return int(self._gdbval)
python
Tools/gdb/libpython.py
386
387
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,095
__init__
def __init__(self, rep): self._rep = rep
python
Tools/gdb/libpython.py
399
400
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,096
__repr__
def __repr__(self): return self._rep
python
Tools/gdb/libpython.py
402
403
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,097
_write_instance_repr
def _write_instance_repr(out, visited, name, pyop_attrdict, address): '''Shared code for use by all classes: write a representation to file-like object "out"''' out.write('<') out.write(name) # Write dictionary of instance attributes: if isinstance(pyop_attrdict, (PyKeysValuesPair, PyDictObject...
python
Tools/gdb/libpython.py
406
425
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,098
__init__
def __init__(self, cl_name, attrdict, address): self.cl_name = cl_name self.attrdict = attrdict self.address = address
python
Tools/gdb/libpython.py
430
433
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,099
__repr__
def __repr__(self): if isinstance(self.attrdict, dict): kwargs = ', '.join(["%s=%r" % (arg, val) for arg, val in self.attrdict.items()]) return '<%s(%s) at remote 0x%x>' % (self.cl_name, kwargs, self.address)...
python
Tools/gdb/libpython.py
435
443
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,100
_PyObject_VAR_SIZE
def _PyObject_VAR_SIZE(typeobj, nitems): if _PyObject_VAR_SIZE._type_size_t is None: _PyObject_VAR_SIZE._type_size_t = gdb.lookup_type('size_t') return ( ( typeobj.field('tp_basicsize') + nitems * typeobj.field('tp_itemsize') + (_sizeof_void_p() - 1) ) & ~(_si...
python
Tools/gdb/libpython.py
445
453
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }