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,101 | getenv | def getenv(self) -> Dict[str, Any]:
"""Generate environ dict for platform"""
env = os.environ.copy()
if hasattr(os, 'process_cpu_count'):
cpu_count = os.process_cpu_count()
else:
cpu_count = os.cpu_count()
env.setdefault("MAKEFLAGS", f"-j{cpu_count}")
... | python | Tools/wasm/wasm_build.py | 518 | 544 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,102 | _run_cmd | def _run_cmd(
self,
cmd: Iterable[str],
args: Iterable[str] = (),
cwd: Optional[pathlib.Path] = None,
) -> int:
cmd = list(cmd)
cmd.extend(args)
if cwd is None:
cwd = self.builddir
logger.info('Running "%s" in "%s"', shlex.join(cmd), cwd)
... | python | Tools/wasm/wasm_build.py | 546 | 561 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,103 | _check_execute | def _check_execute(self) -> None:
if self.is_browser:
raise ValueError(f"Cannot execute on {self.target}") | python | Tools/wasm/wasm_build.py | 563 | 565 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,104 | run_build | def run_build(self, *args: str) -> None:
"""Run configure (if necessary) and make"""
if not self.makefile.exists():
logger.info("Makefile not found, running configure")
self.run_configure(*args)
self.run_make("all", *args) | python | Tools/wasm/wasm_build.py | 567 | 572 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,105 | run_configure | def run_configure(self, *args: str) -> int:
"""Run configure script to generate Makefile"""
os.makedirs(self.builddir, exist_ok=True)
return self._run_cmd(self.configure_cmd, args) | python | Tools/wasm/wasm_build.py | 574 | 577 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,106 | run_make | def run_make(self, *args: str) -> int:
"""Run make (defaults to build all)"""
return self._run_cmd(self.make_cmd, args) | python | Tools/wasm/wasm_build.py | 579 | 581 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,107 | run_pythoninfo | def run_pythoninfo(self, *args: str) -> int:
"""Run 'make pythoninfo'"""
self._check_execute()
return self.run_make("pythoninfo", *args) | python | Tools/wasm/wasm_build.py | 583 | 586 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,108 | run_test | def run_test(self, target: str, testopts: Optional[str] = None) -> int:
"""Run buildbottests"""
self._check_execute()
if testopts is None:
testopts = self.default_testopts
return self.run_make(target, f"TESTOPTS={testopts}") | python | Tools/wasm/wasm_build.py | 588 | 593 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,109 | run_py | def run_py(self, *args: str) -> int:
"""Run Python with hostrunner"""
self._check_execute()
return self.run_make(
"--eval", f"run: all; $(HOSTRUNNER) ./$(PYTHON) {shlex.join(args)}", "run"
) | python | Tools/wasm/wasm_build.py | 595 | 600 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,110 | run_browser | def run_browser(self, bind: str = "127.0.0.1", port: int = 8000) -> None:
"""Run WASM webserver and open build in browser"""
relbuilddir = self.builddir.relative_to(SRCDIR)
url = f"http://{bind}:{port}/{relbuilddir}/python.html"
args = [
sys.executable,
os.fspath(... | python | Tools/wasm/wasm_build.py | 602 | 631 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,111 | clean | def clean(self, all: bool = False) -> None:
"""Clean build directory"""
if all:
if self.builddir.exists():
shutil.rmtree(self.builddir)
elif self.makefile.exists():
self.run_make("clean") | python | Tools/wasm/wasm_build.py | 633 | 639 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,112 | build_emports | def build_emports(self, force: bool = False) -> None:
"""Pre-build emscripten ports."""
platform = self.host.platform
if platform.ports is None or platform.cc is None:
raise ValueError("Need ports and CC command")
embuilder_cmd = [os.fspath(platform.ports)]
embuilder... | python | Tools/wasm/wasm_build.py | 641 | 686 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,113 | main | def main() -> None:
args = parser.parse_args()
logging.basicConfig(
level=logging.INFO if args.verbose else logging.ERROR,
format="%(message)s",
)
if args.platform == "cleanall":
for builder in PROFILES.values():
builder.clean(all=True)
parser.exit(0)
# ... | python | Tools/wasm/wasm_build.py | 851 | 928 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,114 | get_builddir | def get_builddir(args: argparse.Namespace) -> pathlib.Path:
"""Get builddir path from pybuilddir.txt"""
with open("pybuilddir.txt", encoding="utf-8") as f:
builddir = f.read()
return pathlib.Path(builddir) | python | Tools/wasm/wasm_assets.py | 105 | 109 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,115 | get_sysconfigdata | def get_sysconfigdata(args: argparse.Namespace) -> pathlib.Path:
"""Get path to sysconfigdata relative to build root"""
assert isinstance(args.builddir, pathlib.Path)
data_name: str = sysconfig._get_sysconfigdata_name() # type: ignore[attr-defined]
if not data_name.startswith(SYSCONFIG_NAMES):
... | python | Tools/wasm/wasm_assets.py | 112 | 121 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,116 | create_stdlib_zip | def create_stdlib_zip(
args: argparse.Namespace,
*,
optimize: int = 0,
) -> None:
def filterfunc(filename: str) -> bool:
pathname = pathlib.Path(filename).resolve()
return pathname not in args.omit_files_absolute
with zipfile.PyZipFile(
args.wasm_stdlib_zip,
mode="w"... | python | Tools/wasm/wasm_assets.py | 124 | 148 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,117 | filterfunc | def filterfunc(filename: str) -> bool:
pathname = pathlib.Path(filename).resolve()
return pathname not in args.omit_files_absolute | python | Tools/wasm/wasm_assets.py | 129 | 131 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,118 | detect_extension_modules | def detect_extension_modules(args: argparse.Namespace) -> Dict[str, bool]:
modules = {}
# disabled by Modules/Setup.local ?
with open(args.buildroot / "Makefile") as f:
for line in f:
if line.startswith("MODDISABLED_NAMES="):
disabled = line.split("=", 1)[1].strip().spli... | python | Tools/wasm/wasm_assets.py | 151 | 178 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,119 | path | def path(val: str) -> pathlib.Path:
return pathlib.Path(val).absolute() | python | Tools/wasm/wasm_assets.py | 181 | 182 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,120 | main | def main() -> None:
args = parser.parse_args()
relative_prefix = args.prefix.relative_to(pathlib.Path("/"))
args.srcdir = SRCDIR
args.srcdir_lib = SRCDIR_LIB
args.wasm_root = args.buildroot / relative_prefix
args.wasm_stdlib_zip = args.wasm_root / WASM_STDLIB_ZIP
args.wasm_stdlib = args.was... | python | Tools/wasm/wasm_assets.py | 200 | 242 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,121 | end_headers | def end_headers(self) -> None:
self.send_my_headers()
super().end_headers() | python | Tools/wasm/wasm_webserver.py | 24 | 26 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,122 | send_my_headers | def send_my_headers(self) -> None:
self.send_header("Cross-Origin-Opener-Policy", "same-origin")
self.send_header("Cross-Origin-Embedder-Policy", "require-corp") | python | Tools/wasm/wasm_webserver.py | 28 | 30 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,123 | main | def main() -> None:
args = parser.parse_args()
if not args.bind:
args.bind = None
server.test( # type: ignore[attr-defined]
HandlerClass=MyHTTPRequestHandler,
protocol="HTTP/1.1",
port=args.port,
bind=args.bind,
) | python | Tools/wasm/wasm_webserver.py | 33 | 43 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,124 | updated_env | def updated_env(updates={}):
"""Create a new dict representing the environment to use.
The changes made to the execution environment are printed out.
"""
env_defaults = {}
# https://reproducible-builds.org/docs/source-date-epoch/
git_epoch_cmd = ["git", "log", "-1", "--pretty=%ct"]
try:
... | python | Tools/wasm/wasi.py | 30 | 55 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,125 | subdir | def subdir(working_dir, *, clean_ok=False):
"""Decorator to change to a working directory."""
def decorator(func):
@functools.wraps(func)
def wrapper(context):
try:
tput_output = subprocess.check_output(["tput", "cols"],
... | python | Tools/wasm/wasi.py | 58 | 83 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,126 | decorator | def decorator(func):
@functools.wraps(func)
def wrapper(context):
try:
tput_output = subprocess.check_output(["tput", "cols"],
encoding="utf-8")
terminal_width = int(tput_output.strip())
except ... | python | Tools/wasm/wasi.py | 60 | 81 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,127 | wrapper | def wrapper(context):
try:
tput_output = subprocess.check_output(["tput", "cols"],
encoding="utf-8")
terminal_width = int(tput_output.strip())
except subprocess.CalledProcessError:
terminal_widt... | python | Tools/wasm/wasi.py | 62 | 79 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,128 | call | def call(command, *, quiet, **kwargs):
"""Execute a command.
If 'quiet' is true, then redirect stdout and stderr to a temporary file.
"""
print("❯", " ".join(map(str, command)))
if not quiet:
stdout = None
stderr = None
else:
stdout = tempfile.NamedTemporaryFile("w", enc... | python | Tools/wasm/wasi.py | 86 | 103 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,129 | build_platform | def build_platform():
"""The name of the build/host platform."""
# Can also be found via `config.guess`.`
return sysconfig.get_config_var("BUILD_GNU_TYPE") | python | Tools/wasm/wasi.py | 106 | 109 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,130 | build_python_path | def build_python_path():
"""The path to the build Python binary."""
binary = BUILD_DIR / "python"
if not binary.is_file():
binary = binary.with_suffix(".exe")
if not binary.is_file():
raise FileNotFoundError("Unable to find `python(.exe)` in "
... | python | Tools/wasm/wasi.py | 112 | 121 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,131 | configure_build_python | def configure_build_python(context, working_dir):
"""Configure the build/host Python."""
if LOCAL_SETUP.exists():
print(f"👍 {LOCAL_SETUP} exists ...")
else:
print(f"📝 Touching {LOCAL_SETUP} ...")
LOCAL_SETUP.write_bytes(LOCAL_SETUP_MARKER)
configure = [os.path.relpath(CHECKOUT... | python | Tools/wasm/wasi.py | 125 | 137 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,132 | make_build_python | def make_build_python(context, working_dir):
"""Make/build the build Python."""
call(["make", "--jobs", str(cpu_count()), "all"],
quiet=context.quiet)
binary = build_python_path()
cmd = [binary, "-c",
"import sys; "
"print(f'{sys.version_info.major}.{sys.version_info... | python | Tools/wasm/wasi.py | 141 | 152 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,133 | find_wasi_sdk | def find_wasi_sdk():
"""Find the path to wasi-sdk."""
if wasi_sdk_path := os.environ.get("WASI_SDK_PATH"):
return pathlib.Path(wasi_sdk_path)
elif (default_path := pathlib.Path("/opt/wasi-sdk")).exists():
return default_path | python | Tools/wasm/wasi.py | 155 | 160 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,134 | wasi_sdk_env | def wasi_sdk_env(context):
"""Calculate environment variables for building with wasi-sdk."""
wasi_sdk_path = context.wasi_sdk_path
sysroot = wasi_sdk_path / "share" / "wasi-sysroot"
env = {"CC": "clang", "CPP": "clang-cpp", "CXX": "clang++",
"AR": "llvm-ar", "RANLIB": "ranlib"}
for env_v... | python | Tools/wasm/wasi.py | 163 | 190 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,135 | configure_wasi_python | def configure_wasi_python(context, working_dir):
"""Configure the WASI/host build."""
if not context.wasi_sdk_path or not context.wasi_sdk_path.exists():
raise ValueError("WASI-SDK not found; "
"download from "
"https://github.com/WebAssembly/wasi-sdk and/... | python | Tools/wasm/wasi.py | 194 | 246 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,136 | make_wasi_python | def make_wasi_python(context, working_dir):
"""Run `make` for the WASI/host build."""
call(["make", "--jobs", str(cpu_count()), "all"],
env=updated_env(),
quiet=context.quiet)
exec_script = working_dir / "python.sh"
subprocess.check_call([exec_script, "--version"]) | python | Tools/wasm/wasi.py | 250 | 257 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,137 | build_all | def build_all(context):
"""Build everything."""
steps = [configure_build_python, make_build_python, configure_wasi_python,
make_wasi_python]
for step in steps:
step(context) | python | Tools/wasm/wasi.py | 260 | 265 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,138 | clean_contents | def clean_contents(context):
"""Delete all files created by this script."""
if CROSS_BUILD_DIR.exists():
print(f"🧹 Deleting {CROSS_BUILD_DIR} ...")
shutil.rmtree(CROSS_BUILD_DIR)
if LOCAL_SETUP.exists():
with LOCAL_SETUP.open("rb") as file:
if file.read(len(LOCAL_SETUP_... | python | Tools/wasm/wasi.py | 267 | 276 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,139 | main | def main():
default_host_runner = (f"{shutil.which('wasmtime')} run "
# Make sure the stack size will work for a pydebug
# build.
# The 8388608 value comes from `ulimit -s` under Linux
# which equates to 8291 KiB.
... | python | Tools/wasm/wasi.py | 279 | 343 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,140 | generate_flag_macros | def generate_flag_macros(out: CWriter) -> None:
for i, flag in enumerate(FLAGS):
out.emit(f"#define HAS_{flag}_FLAG ({1<<i})\n")
for i, flag in enumerate(FLAGS):
out.emit(
f"#define OPCODE_HAS_{flag}(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_{flag}_FLAG))\n"
)
out.e... | python | Tools/cases_generator/opcode_metadata_generator.py | 61 | 68 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,141 | generate_oparg_macros | def generate_oparg_macros(out: CWriter) -> None:
for name, value in OPARG_KINDS.items():
out.emit(f"#define {name} {value}\n")
out.emit("\n") | python | Tools/cases_generator/opcode_metadata_generator.py | 71 | 74 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,142 | emit_stack_effect_function | def emit_stack_effect_function(
out: CWriter, direction: str, data: list[tuple[str, str]]
) -> None:
out.emit(f"extern int _PyOpcode_num_{direction}(int opcode, int oparg);\n")
out.emit("#ifdef NEED_OPCODE_METADATA\n")
out.emit(f"int _PyOpcode_num_{direction}(int opcode, int oparg) {{\n")
out.emit(... | python | Tools/cases_generator/opcode_metadata_generator.py | 77 | 91 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,143 | generate_stack_effect_functions | def generate_stack_effect_functions(analysis: Analysis, out: CWriter) -> None:
popped_data: list[tuple[str, str]] = []
pushed_data: list[tuple[str, str]] = []
for inst in analysis.instructions.values():
stack = get_stack_effect(inst)
popped = (-stack.base_offset).to_c()
pushed = (sta... | python | Tools/cases_generator/opcode_metadata_generator.py | 94 | 104 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,144 | generate_is_pseudo | def generate_is_pseudo(analysis: Analysis, out: CWriter) -> None:
"""Write the IS_PSEUDO_INSTR macro"""
out.emit("\n\n#define IS_PSEUDO_INSTR(OP) ( \\\n")
for op in analysis.pseudos:
out.emit(f"((OP) == {op}) || \\\n")
out.emit("0")
out.emit(")\n\n") | python | Tools/cases_generator/opcode_metadata_generator.py | 107 | 113 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,145 | get_format | def get_format(inst: Instruction) -> str:
if inst.properties.oparg:
format = "INSTR_FMT_IB"
else:
format = "INSTR_FMT_IX"
if inst.size > 1:
format += "C"
format += "0" * (inst.size - 2)
return format | python | Tools/cases_generator/opcode_metadata_generator.py | 116 | 124 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,146 | generate_instruction_formats | def generate_instruction_formats(analysis: Analysis, out: CWriter) -> None:
# Compute the set of all instruction formats.
formats: set[str] = set()
for inst in analysis.instructions.values():
formats.add(get_format(inst))
# Generate an enum for it
out.emit("enum InstructionFormat {\n")
n... | python | Tools/cases_generator/opcode_metadata_generator.py | 127 | 138 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,147 | generate_deopt_table | def generate_deopt_table(analysis: Analysis, out: CWriter) -> None:
out.emit("extern const uint8_t _PyOpcode_Deopt[256];\n")
out.emit("#ifdef NEED_OPCODE_METADATA\n")
out.emit("const uint8_t _PyOpcode_Deopt[256] = {\n")
deopts: list[tuple[str, str]] = []
for inst in analysis.instructions.values():
... | python | Tools/cases_generator/opcode_metadata_generator.py | 141 | 155 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,148 | generate_cache_table | def generate_cache_table(analysis: Analysis, out: CWriter) -> None:
out.emit("extern const uint8_t _PyOpcode_Caches[256];\n")
out.emit("#ifdef NEED_OPCODE_METADATA\n")
out.emit("const uint8_t _PyOpcode_Caches[256] = {\n")
for inst in analysis.instructions.values():
if inst.family and inst.family... | python | Tools/cases_generator/opcode_metadata_generator.py | 158 | 170 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,149 | generate_name_table | def generate_name_table(analysis: Analysis, out: CWriter) -> None:
table_size = 256 + len(analysis.pseudos)
out.emit(f"extern const char *_PyOpcode_OpName[{table_size}];\n")
out.emit("#ifdef NEED_OPCODE_METADATA\n")
out.emit(f"const char *_PyOpcode_OpName[{table_size}] = {{\n")
names = list(analysis... | python | Tools/cases_generator/opcode_metadata_generator.py | 173 | 183 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,150 | generate_metadata_table | def generate_metadata_table(analysis: Analysis, out: CWriter) -> None:
table_size = 256 + len(analysis.pseudos)
out.emit("struct opcode_metadata {\n")
out.emit("uint8_t valid_entry;\n")
out.emit("int8_t instr_format;\n")
out.emit("int16_t flags;\n")
out.emit("};\n\n")
out.emit(
f"ext... | python | Tools/cases_generator/opcode_metadata_generator.py | 186 | 213 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,151 | generate_expansion_table | def generate_expansion_table(analysis: Analysis, out: CWriter) -> None:
expansions_table: dict[str, list[tuple[str, int, int]]] = {}
for inst in sorted(analysis.instructions.values(), key=lambda t: t.name):
offset: int = 0 # Cache effect offset
expansions: list[tuple[str, int, int]] = [] # [(n... | python | Tools/cases_generator/opcode_metadata_generator.py | 216 | 276 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,152 | is_viable_expansion | def is_viable_expansion(inst: Instruction) -> bool:
"An instruction can be expanded if all its parts are viable for tier 2"
for part in inst.parts:
if isinstance(part, Uop):
# Skip specializing and replaced uops
if "specializing" in part.annotations:
continue
... | python | Tools/cases_generator/opcode_metadata_generator.py | 279 | 290 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,153 | generate_extra_cases | def generate_extra_cases(analysis: Analysis, out: CWriter) -> None:
out.emit("#define EXTRA_CASES \\\n")
valid_opcodes = set(analysis.opmap.values())
for op in range(256):
if op not in valid_opcodes:
out.emit(f" case {op}: \\\n")
out.emit(" ;\n") | python | Tools/cases_generator/opcode_metadata_generator.py | 293 | 299 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,154 | generate_pseudo_targets | def generate_pseudo_targets(analysis: Analysis, out: CWriter) -> None:
table_size = len(analysis.pseudos)
max_targets = max(len(pseudo.targets) for pseudo in analysis.pseudos.values())
out.emit("struct pseudo_targets {\n")
out.emit(f"uint8_t targets[{max_targets + 1}];\n")
out.emit("};\n")
out.e... | python | Tools/cases_generator/opcode_metadata_generator.py | 302 | 335 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,155 | generate_opcode_metadata | def generate_opcode_metadata(
filenames: list[str], analysis: Analysis, outfile: TextIO
) -> None:
write_header(__file__, filenames, outfile)
out = CWriter(outfile, 0, False)
with out.header_guard("Py_CORE_OPCODE_METADATA_H"):
out.emit("#ifndef Py_BUILD_CORE\n")
out.emit('# error "this ... | python | Tools/cases_generator/opcode_metadata_generator.py | 338 | 365 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,156 | declare_variables | def declare_variables(inst: Instruction, out: CWriter) -> None:
variables = {"unused"}
for uop in inst.parts:
if isinstance(uop, Uop):
for var in reversed(uop.stack.inputs):
if var.name not in variables:
type = var.type if var.type else "PyObject *"
... | python | Tools/cases_generator/tier1_generator.py | 38 | 57 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,157 | write_uop | def write_uop(
uop: Part, out: CWriter, offset: int, stack: Stack, inst: Instruction, braces: bool
) -> int:
# out.emit(stack.as_comment() + "\n")
if isinstance(uop, Skip):
entries = "entries" if uop.size > 1 else "entry"
out.emit(f"/* Skip {uop.size} cache {entries} */\n")
return of... | python | Tools/cases_generator/tier1_generator.py | 60 | 103 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,158 | uses_this | def uses_this(inst: Instruction) -> bool:
if inst.properties.needs_this:
return True
for uop in inst.parts:
if isinstance(uop, Skip):
continue
for cache in uop.caches:
if cache.name != "unused":
return True
return False | python | Tools/cases_generator/tier1_generator.py | 106 | 115 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,159 | generate_tier1 | def generate_tier1(
filenames: list[str], analysis: Analysis, outfile: TextIO, lines: bool
) -> None:
write_header(__file__, filenames, outfile)
outfile.write(
"""
#ifdef TIER_TWO
#error "This file is for Tier 1 only"
#endif
#define TIER_ONE 1
"""
)
out = CWriter(outfile, 2, lines)
o... | python | Tools/cases_generator/tier1_generator.py | 118 | 170 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,160 | generate_tier1_from_files | def generate_tier1_from_files(
filenames: list[str], outfilename: str, lines: bool
) -> None:
data = analyze_files(filenames)
with open(outfilename, "w") as outfile:
generate_tier1(filenames, data, outfile, lines) | python | Tools/cases_generator/tier1_generator.py | 191 | 196 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,161 | contextual | def contextual(func: Callable[[P], N | None]) -> Callable[[P], N | None]:
# Decorator to wrap grammar methods.
# Resets position if `func` returns None.
def contextual_wrapper(self: P) -> N | None:
begin = self.getpos()
res = func(self)
if res is None:
self.setpos(begin)
... | python | Tools/cases_generator/parsing.py | 14 | 27 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,162 | contextual_wrapper | def contextual_wrapper(self: P) -> N | None:
begin = self.getpos()
res = func(self)
if res is None:
self.setpos(begin)
return None
end = self.getpos()
res.context = Context(begin, end, self)
return res | python | Tools/cases_generator/parsing.py | 17 | 25 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,163 | __repr__ | def __repr__(self) -> str:
return f"<{self.owner.filename}: {self.begin}-{self.end}>" | python | Tools/cases_generator/parsing.py | 35 | 36 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,164 | text | def text(self) -> str:
return self.to_text() | python | Tools/cases_generator/parsing.py | 44 | 45 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,165 | to_text | def to_text(self, dedent: int = 0) -> str:
context = self.context
if not context:
return ""
return lx.to_text(self.tokens, dedent) | python | Tools/cases_generator/parsing.py | 47 | 51 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,166 | tokens | def tokens(self) -> list[lx.Token]:
context = self.context
if not context:
return []
tokens = context.owner.tokens
begin = context.begin
end = context.end
return tokens[begin:end] | python | Tools/cases_generator/parsing.py | 54 | 61 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,167 | __repr__ | def __repr__(self) -> str:
items = [self.name, self.type, self.cond, self.size]
while items and items[-1] == "":
del items[-1]
return f"StackEffect({', '.join(repr(item) for item in items)})" | python | Tools/cases_generator/parsing.py | 78 | 82 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,168 | definition | def definition(self) -> AstNode | None:
if macro := self.macro_def():
return macro
if family := self.family_def():
return family
if pseudo := self.pseudo_def():
return pseudo
if inst := self.inst_def():
return inst
return None | python | Tools/cases_generator/parsing.py | 150 | 159 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,169 | inst_def | def inst_def(self) -> InstDef | None:
if hdr := self.inst_header():
if block := self.block():
return InstDef(
hdr.annotations,
hdr.kind,
hdr.name,
hdr.inputs,
hdr.outputs,
... | python | Tools/cases_generator/parsing.py | 162 | 174 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,170 | inst_header | def inst_header(self) -> InstHeader | None:
# annotation* inst(NAME, (inputs -- outputs))
# | annotation* op(NAME, (inputs -- outputs))
annotations = []
while anno := self.expect(lx.ANNOTATION):
if anno.text == "replicate":
self.require(lx.LPAREN)
... | python | Tools/cases_generator/parsing.py | 177 | 201 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,171 | io_effect | def io_effect(self) -> tuple[list[InputEffect], list[OutputEffect]]:
# '(' [inputs] '--' [outputs] ')'
if self.expect(lx.LPAREN):
inputs = self.inputs() or []
if self.expect(lx.MINUSMINUS):
outputs = self.outputs() or []
if self.expect(lx.RPAREN):
... | python | Tools/cases_generator/parsing.py | 203 | 211 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,172 | inputs | def inputs(self) -> list[InputEffect] | None:
# input (',' input)*
here = self.getpos()
if inp := self.input():
inp = cast(InputEffect, inp)
near = self.getpos()
if self.expect(lx.COMMA):
if rest := self.inputs():
return [in... | python | Tools/cases_generator/parsing.py | 213 | 225 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,173 | input | def input(self) -> InputEffect | None:
return self.cache_effect() or self.stack_effect() | python | Tools/cases_generator/parsing.py | 228 | 229 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,174 | outputs | def outputs(self) -> list[OutputEffect] | None:
# output (, output)*
here = self.getpos()
if outp := self.output():
near = self.getpos()
if self.expect(lx.COMMA):
if rest := self.outputs():
return [outp] + rest
self.setpos(n... | python | Tools/cases_generator/parsing.py | 231 | 242 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,175 | output | def output(self) -> OutputEffect | None:
return self.stack_effect() | python | Tools/cases_generator/parsing.py | 245 | 246 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,176 | cache_effect | def cache_effect(self) -> CacheEffect | None:
# IDENTIFIER '/' NUMBER
if tkn := self.expect(lx.IDENTIFIER):
if self.expect(lx.DIVIDE):
num = self.require(lx.NUMBER).text
try:
size = int(num)
except ValueError:
... | python | Tools/cases_generator/parsing.py | 249 | 260 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,177 | stack_effect | def stack_effect(self) -> StackEffect | None:
# IDENTIFIER [':' IDENTIFIER [TIMES]] ['if' '(' expression ')']
# | IDENTIFIER '[' expression ']'
if tkn := self.expect(lx.IDENTIFIER):
type_text = ""
if self.expect(lx.COLON):
type_text = self.require(lx.IDENT... | python | Tools/cases_generator/parsing.py | 263 | 289 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,178 | expression | def expression(self) -> Expression | None:
tokens: list[lx.Token] = []
level = 1
while tkn := self.peek():
if tkn.kind in (lx.LBRACKET, lx.LPAREN):
level += 1
elif tkn.kind in (lx.RBRACKET, lx.RPAREN):
level -= 1
if level ==... | python | Tools/cases_generator/parsing.py | 292 | 306 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,179 | op | def op(self) -> OpName | None:
if tkn := self.expect(lx.IDENTIFIER):
return OpName(tkn.text)
return None | python | Tools/cases_generator/parsing.py | 317 | 320 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,180 | macro_def | def macro_def(self) -> Macro | None:
if tkn := self.expect(lx.MACRO):
if self.expect(lx.LPAREN):
if tkn := self.expect(lx.IDENTIFIER):
if self.expect(lx.RPAREN):
if self.expect(lx.EQUALS):
if uops := self.uops():... | python | Tools/cases_generator/parsing.py | 323 | 333 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,181 | uops | def uops(self) -> list[UOp] | None:
if uop := self.uop():
uop = cast(UOp, uop)
uops = [uop]
while self.expect(lx.PLUS):
if uop := self.uop():
uop = cast(UOp, uop)
uops.append(uop)
else:
... | python | Tools/cases_generator/parsing.py | 335 | 346 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,182 | uop | def uop(self) -> UOp | None:
if tkn := self.expect(lx.IDENTIFIER):
if self.expect(lx.DIVIDE):
if num := self.expect(lx.NUMBER):
try:
size = int(num.text)
except ValueError:
raise self.make_syntax_... | python | Tools/cases_generator/parsing.py | 349 | 364 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,183 | family_def | def family_def(self) -> Family | None:
if (tkn := self.expect(lx.IDENTIFIER)) and tkn.text == "family":
size = None
if self.expect(lx.LPAREN):
if tkn := self.expect(lx.IDENTIFIER):
if self.expect(lx.COMMA):
if not (size := self.... | python | Tools/cases_generator/parsing.py | 367 | 387 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,184 | flags | def flags(self) -> list[str]:
here = self.getpos()
if self.expect(lx.LPAREN):
if tkn := self.expect(lx.IDENTIFIER):
flags = [tkn.text]
while self.expect(lx.COMMA):
if tkn := self.expect(lx.IDENTIFIER):
flags.append(t... | python | Tools/cases_generator/parsing.py | 389 | 403 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,185 | pseudo_def | def pseudo_def(self) -> Pseudo | None:
if (tkn := self.expect(lx.IDENTIFIER)) and tkn.text == "pseudo":
size = None
if self.expect(lx.LPAREN):
if tkn := self.expect(lx.IDENTIFIER):
if self.expect(lx.COMMA):
flags = self.flags()
... | python | Tools/cases_generator/parsing.py | 406 | 422 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,186 | members | def members(self) -> list[str] | None:
here = self.getpos()
if tkn := self.expect(lx.IDENTIFIER):
members = [tkn.text]
while self.expect(lx.COMMA):
if tkn := self.expect(lx.IDENTIFIER):
members.append(tkn.text)
else:
... | python | Tools/cases_generator/parsing.py | 424 | 438 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,187 | block | def block(self) -> Block | None:
if self.c_blob():
return Block()
return None | python | Tools/cases_generator/parsing.py | 441 | 444 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,188 | c_blob | def c_blob(self) -> list[lx.Token]:
tokens: list[lx.Token] = []
level = 0
while tkn := self.next(raw=True):
tokens.append(tkn)
if tkn.kind in (lx.LBRACE, lx.LPAREN, lx.LBRACKET):
level += 1
elif tkn.kind in (lx.RBRACE, lx.RPAREN, lx.RBRACKET):
... | python | Tools/cases_generator/parsing.py | 446 | 457 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,189 | dump | def dump(self, indent: str) -> None:
print(indent, end="")
text = ", ".join([f"{key}: {value}" for (key, value) in self.__dict__.items()])
print(indent, text, sep="") | python | Tools/cases_generator/analyzer.py | 31 | 34 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,190 | from_list | def from_list(properties: list["Properties"]) -> "Properties":
return Properties(
escapes=any(p.escapes for p in properties),
error_with_pop=any(p.error_with_pop for p in properties),
error_without_pop=any(p.error_without_pop for p in properties),
deopts=any(p.deo... | python | Tools/cases_generator/analyzer.py | 37 | 56 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,191 | infallible | def infallible(self) -> bool:
return not self.error_with_pop and not self.error_without_pop | python | Tools/cases_generator/analyzer.py | 59 | 60 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,192 | name | def name(self) -> str:
return f"unused/{self.size}" | python | Tools/cases_generator/analyzer.py | 91 | 92 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,193 | properties | def properties(self) -> Properties:
return SKIP_PROPERTIES | python | Tools/cases_generator/analyzer.py | 95 | 96 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,194 | __str__ | def __str__(self) -> str:
cond = f" if ({self.condition})" if self.condition else ""
size = f"[{self.size}]" if self.size != "1" else ""
type = "" if self.type is None else f"{self.type} "
return f"{type}{self.name}{size}{cond} {self.peek}" | python | Tools/cases_generator/analyzer.py | 107 | 111 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,195 | is_array | def is_array(self) -> bool:
return self.type == "PyObject **" | python | Tools/cases_generator/analyzer.py | 113 | 114 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,196 | __str__ | def __str__(self) -> str:
return f"({', '.join([str(i) for i in self.inputs])} -- {', '.join([str(i) for i in self.outputs])})" | python | Tools/cases_generator/analyzer.py | 122 | 123 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,197 | __str__ | def __str__(self) -> str:
return f"{self.name}/{self.size}" | python | Tools/cases_generator/analyzer.py | 131 | 132 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,198 | dump | def dump(self, indent: str) -> None:
print(
indent, self.name, ", ".join(self.annotations) if self.annotations else ""
)
print(indent, self.stack, ", ".join([str(c) for c in self.caches]))
self.properties.dump(" " + indent) | python | Tools/cases_generator/analyzer.py | 149 | 154 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,199 | size | def size(self) -> int:
if self._size < 0:
self._size = sum(c.size for c in self.caches)
return self._size | python | Tools/cases_generator/analyzer.py | 157 | 160 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
9,200 | why_not_viable | def why_not_viable(self) -> str | None:
if self.name == "_SAVE_RETURN_OFFSET":
return None # Adjusts next_instr, but only in tier 1 code
if "INSTRUMENTED" in self.name:
return "is instrumented"
if "replaced" in self.annotations:
return "is replaced"
i... | python | Tools/cases_generator/analyzer.py | 162 | 184 | {
"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.