id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
185,652 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_ATOM = 15
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
def _format_attribute(node: ast.Attribute, level: int) -> str:
value = to_expr(node.value, PR_ATOM)
const = node.value
if (isinstance(const, ast.Constant) and isi... | null |
185,653 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_TUPLE = 0
def parens(level: int, target_lvl: int, value: str) -> str:
if level > target_lvl:
return f"({value})"
return value
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
... | null |
185,654 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMATTERS.get(type(node))
if formatter is not None:
return formatter(node, level)
return "<unsupported node: " + ty... | null |
185,655 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_TEST = 1
def _format_kw(node: ast.keyword):
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
def _format_call(node: ast.Call, level: int) -> str:
args = [to_expr(arg) for arg in node.args] + [
_format_kw(arg... | null |
185,656 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_NOT = 4
PR_FACTOR = 12
def get_unop(node: ast.unaryop) -> str:
if isinstance(node, ast.UAdd):
return "+"
elif isinstance(node, ast.USub):
return "-"
elif isinstance(node, ast.Not):
return "not "
... | null |
185,657 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_FACTOR = 12
BIN_OPS = {
ast.Add: (" + ", PR_ARITH),
ast.Sub: (" - ", PR_ARITH),
ast.Mult: (" * ", PR_TERM),
ast.MatMult: (" @ ", PR_TERM),
ast.Div: (" / ", PR_TERM),
ast.Mod: (" % ", PR_TERM),
ast.LShift: (" << ", ... | null |
185,658 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_TUPLE = 0
PR_ATOM = 15
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMATTERS.get(type(node))
if formatter is not None:
return formatter(node, leve... | null |
185,659 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def _format_yield(node: ast.Yield, level: int) -> str:
raise SyntaxError("'yield expression' can not be used within an annotation") | null |
185,660 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def _format_yield_from(node: ast.YieldFrom, level: int) -> str:
raise SyntaxError("'yield expression' can not be used within an annotation") | null |
185,661 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
Dict = _alias(dict, 2, inst=False, name='Dict')
def _format_dict(node: ast.Dict, level: int) -> str:
return (
"{"
+ ", ".join(
to_expr(k) + ": " + to_expr... | null |
185,662 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_AWAIT = 14
PR_ATOM = 15
def parens(level: int, target_lvl: int, value: str) -> str:
if level > target_lvl:
return f"({value})"
return value
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
... | null |
185,663 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_EXPR = 6
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMATTERS.get(type(node))
if formatter is not None:
return formatter(node, level)
return "<uns... | null |
185,664 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_OR = 2
PR_AND = 3
def parens(level: int, target_lvl: int, value: str) -> str:
if level > target_lvl:
return f"({value})"
return value
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
... | null |
185,665 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_TEST = 1
def parens(level: int, target_lvl: int, value: str) -> str:
if level > target_lvl:
return f"({value})"
return value
def _format_arguments(node: ast.arguments) -> str:
res = []
for i, arg in enumerat... | null |
185,666 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_TEST = 1
def parens(level: int, target_lvl: int, value: str) -> str:
if level > target_lvl:
return f"({value})"
return value
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
r... | null |
185,667 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
PR_TEST = 1
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMATTERS.get(type(node))
if formatter is not None:
return formatter(node, level)
return ... | null |
185,668 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def _format_comprehensions(nodes: List[ast.comprehension]) -> str:
return "".join(_format_comprehension(n) for n in nodes)
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMA... | null |
185,669 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def _format_comprehensions(nodes: List[ast.comprehension]) -> str:
return "".join(_format_comprehension(n) for n in nodes)
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMA... | null |
185,670 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def _format_comprehensions(nodes: List[ast.comprehension]) -> str:
return "".join(_format_comprehension(n) for n in nodes)
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMA... | null |
185,671 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def _format_comprehensions(nodes: List[ast.comprehension]) -> str:
return "".join(_format_comprehension(n) for n in nodes)
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMA... | null |
185,672 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def to_expr(node: Optional[ast.AST], level=PR_TEST) -> str:
if node is None:
return ""
formatter = _FORMATTERS.get(type(node))
if formatter is not None:
return formatter(node, level)
return "<unsupported node: " + ty... | null |
185,673 | import ast
from typing import Any, Callable, Dict, List, Optional, Type
def _format_constant(node: ast.Constant, level: int):
if node.value is Ellipsis:
return "..."
return repr(node.value) | null |
185,674 | from .opcode_cinder import opcode as opcode_cinder
from .opcodebase import Opcode
def _load_mapping_arg_effect(oparg: int, _jmp: int = 0) -> int:
if oparg == 2:
return -1
elif oparg == 3:
return -2
return 1 | null |
185,675 | from __future__ import annotations
import ast
import importlib.util
import itertools
import marshal
import os
import sys
from ast import AST, ClassDef
from builtins import compile as builtin_compile
from contextlib import contextmanager
from typing import Dict, Union
from . import consts, future, misc, pyassem, symbols... | null |
185,676 | from __future__ import annotations
import ast
import importlib.util
import itertools
import marshal
import os
import sys
from ast import AST, ClassDef
from builtins import compile as builtin_compile
from contextlib import contextmanager
from typing import Dict, Union
from . import consts, future, misc, pyassem, symbols... | null |
185,677 | from __future__ import annotations
import ast
import importlib.util
import itertools
import marshal
import os
import sys
from ast import AST, ClassDef
from builtins import compile as builtin_compile
from contextlib import contextmanager
from typing import Dict, Union
from . import consts, future, misc, pyassem, symbols... | null |
185,678 | from __future__ import annotations
import ast
import importlib.util
import itertools
import marshal
import os
import sys
from ast import AST, ClassDef
from builtins import compile as builtin_compile
from contextlib import contextmanager
from typing import Dict, Union
from . import consts, future, misc, pyassem, symbols... | null |
185,679 | from __future__ import annotations
import ast
import importlib.util
import itertools
import marshal
import os
import sys
from ast import AST, ClassDef
from builtins import compile as builtin_compile
from contextlib import contextmanager
from typing import Dict, Union
from . import consts, future, misc, pyassem, symbols... | Find the op (DELETE, LOAD, STORE) in an AssTuple tree |
185,680 | from __future__ import annotations
import linecache
from contextlib import contextmanager
from typing import TYPE_CHECKING
def Optional(self, parameters):
"""Optional type.
Optional[X] is equivalent to Union[X, None].
"""
arg = _type_check(parameters, f"{self} requires a single type.")
return Unio... | null |
185,681 | import argparse
import builtins
import importlib.util
import marshal
import os
import re
import sys
from dis import dis
from . import pycodegen, static
coding_re = re.compile(rb"^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)")
group = argparser.add_mutually_exclusive_group()
group.add_argument(
"--static", action="... | null |
185,682 | from __future__ import print_function
import dis as _dis
import opcode
import re
import sys
from pprint import pformat
from types import CodeType
from typing import Dict, Generator, Iterable, List, Optional, Pattern, TextIO, Tuple
def _disassemble_bytes(
code: bytes,
lasti: int = -1,
varnames: Optional[Tupl... | null |
185,683 | from __future__ import print_function
import dis as _dis
import opcode
import re
import sys
from pprint import pformat
from types import CodeType
from typing import Dict, Generator, Iterable, List, Optional, Pattern, TextIO, Tuple
coding_re: Pattern[bytes] = re.compile(
rb"^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-... | null |
185,684 | MANGLE_LEN = 256
def mangle(name, klass):
if klass is None:
return name
if not name.startswith("__"):
return name
if len(name) + 2 >= MANGLE_LEN:
return name
# TODO: Probably need to split and mangle recursively?
if "." in name:
return name
if name.endswith("__")... | null |
185,685 | from __future__ import annotations
import ast
import operator
import sys
from ast import Bytes, cmpop, Constant, copy_location, Ellipsis, NameConstant, Num, Str
from typing import (
Any,
Callable,
cast,
Dict,
Iterable,
Mapping,
Optional,
Tuple,
Type,
Union,
)
from .visitor import... | null |
185,686 | from __future__ import annotations
import ast
import operator
import sys
from ast import Bytes, cmpop, Constant, copy_location, Ellipsis, NameConstant, Num, Str
from typing import (
Any,
Callable,
cast,
Dict,
Iterable,
Mapping,
Optional,
Tuple,
Type,
Union,
)
from .visitor import... | null |
185,687 | from __future__ import annotations
import ast
import operator
import sys
from ast import Bytes, cmpop, Constant, copy_location, Ellipsis, NameConstant, Num, Str
from typing import (
Any,
Callable,
cast,
Dict,
Iterable,
Mapping,
Optional,
Tuple,
Type,
Union,
)
from .visitor import... | null |
185,688 | from __future__ import annotations
import ast
import operator
import sys
from ast import Bytes, cmpop, Constant, copy_location, Ellipsis, NameConstant, Num, Str
from typing import (
Any,
Callable,
cast,
Dict,
Iterable,
Mapping,
Optional,
Tuple,
Type,
Union,
)
from .visitor import... | null |
185,689 | from __future__ import annotations
import sys
from contextlib import contextmanager
from types import CodeType
from typing import ClassVar, Generator, List, Optional
from . import opcode_cinder, opcodes
from .consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NEWLOCALS,
CO_OPTIMIZED,... | null |
185,690 | from __future__ import annotations
import sys
from contextlib import contextmanager
from types import CodeType
from typing import ClassVar, Generator, List, Optional
from . import opcode_cinder, opcodes
from .consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NEWLOCALS,
CO_OPTIMIZED,... | null |
185,691 | from __future__ import annotations
import sys
from contextlib import contextmanager
from types import CodeType
from typing import ClassVar, Generator, List, Optional
from . import opcode_cinder, opcodes
from .consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NEWLOCALS,
CO_OPTIMIZED,... | null |
185,692 | import ast
from ast import AST, copy_location
from typing import Any, Sequence, TypeVar, Union
def dumpNode(node):
print(node.__class__)
for attr in dir(node):
if attr[0] != "_":
print("\t", "%-10.10s" % attr, getattr(node, attr)) | null |
185,693 | from __future__ import print_function
import ast
from .visitor import ASTVisitor, walk
The provided code snippet includes necessary dependencies for implementing the `is_future` function. Write a Python function `def is_future(stmt)` to solve the following problem:
Return true if statement is a well-formed future stat... | Return true if statement is a well-formed future statement |
185,694 | from __future__ import print_function
import ast
from .visitor import ASTVisitor, walk
class FutureParser(ASTVisitor):
def __init__(self):
def visitModule(self, node):
def check_stmt(self, stmt):
def get_features(self):
class BadFutureParser(ASTVisitor):
def visitImportFrom(self, node):
def wa... | null |
185,695 | from __future__ import annotations
import ast
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
ClassDef,
Delete,
ExceptHandler,
FunctionDef,
Global,
Import,
ImportFrom,
Module,
Name,
)
from symtable import SymbolTable
from typing import final... | null |
185,696 | from __future__ import annotations
import ast
import builtins
import logging
import os
import symtable
import sys
from contextlib import nullcontext
from symtable import SymbolTable as PythonSymbolTable, SymbolTableFactory
from types import CodeType
from typing import (
Callable,
ContextManager,
Dict,
f... | Construct a symtable object from analysis result |
185,697 | from __future__ import annotations
def _set_patch(module: StrictModule, name: str, value: object) -> None:
type(module).patch(module, name, value) | null |
185,698 | from __future__ import annotations
def _del_patch(module: StrictModule, name: str) -> None:
type(module).patch_delete(module, name) | null |
185,699 | from __future__ import annotations
_MAGIC_STRICT_OR_STATIC: bytes = (STRICT_MAGIC_NUMBER + 2**15).to_bytes(
2, "little"
) + b"\r\n"
_MAGIC_NEITHER_STRICT_NOR_STATIC: bytes = (0).to_bytes(2, "little") + b"\r\n"
_MAGIC_LEN: int = len(_MAGIC_STRICT_OR_STATIC)
class StrictBytecodeError(ImportError):
pass
def _clas... | null |
185,700 | from __future__ import annotations
def code_to_strict_timestamp_pyc(
code: CodeType, strict_or_static: bool, mtime: int = 0, source_size: int = 0
) -> bytearray:
"Produce the data for a strict timestamp-based pyc."
data = bytearray(
_MAGIC_STRICT_OR_STATIC
if strict_or_static
else _M... | Byte-compile one Python source file to Python bytecode, using strict loader. :param file: The source file name. :param cfile: The target byte compiled file name. :param dfile: Purported file name, i.e. the file name that shows up in error messages. Defaults to the source file name. :param doraise: Flag indicating wheth... |
185,701 | from __future__ import annotations
The provided code snippet includes necessary dependencies for implementing the `init_static_python` function. Write a Python function `def init_static_python() -> None` to solve the following problem:
Idempotent global initialization of Static Python. Should be called at least once i... | Idempotent global initialization of Static Python. Should be called at least once if any Static modules/functions exist. |
185,702 | from __future__ import annotations
import ast
from ast import AST, Call, Constant, Name
from typing import List, Optional, Tuple, TypeVar
def is_mutable(node: AST) -> bool:
return isinstance(node, Name) and node.id == "mutable" | null |
185,703 | from __future__ import annotations
import ast
from ast import (
alias,
AnnAssign,
arg,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Call,
ClassDef,
Constant,
copy_location,
DictComp,
expr,
FunctionDef,
GeneratorExp,
Global,
Import,
ImportFrom,
Lam... | null |
185,704 | from __future__ import annotations
import ast
from ast import (
alias,
AnnAssign,
arg,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Call,
ClassDef,
Constant,
copy_location,
DictComp,
expr,
FunctionDef,
GeneratorExp,
Global,
Import,
ImportFrom,
Lam... | null |
185,705 | from __future__ import annotations
import ast
from ast import (
alias,
AnnAssign,
arg,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Call,
ClassDef,
Constant,
copy_location,
DictComp,
expr,
FunctionDef,
GeneratorExp,
Global,
Import,
ImportFrom,
Lam... | null |
185,706 | from __future__ import annotations
import ast
from ast import (
alias,
AnnAssign,
arg,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Call,
ClassDef,
Constant,
copy_location,
DictComp,
expr,
FunctionDef,
GeneratorExp,
Global,
Import,
ImportFrom,
Lam... | null |
185,707 | from __future__ import annotations
import ast
from ast import (
alias,
AnnAssign,
arg,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Call,
ClassDef,
Constant,
copy_location,
DictComp,
expr,
FunctionDef,
GeneratorExp,
Global,
Import,
ImportFrom,
Lam... | null |
185,708 | from __future__ import annotations
import ast
from ast import (
alias,
AnnAssign,
arg,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Call,
ClassDef,
Constant,
copy_location,
DictComp,
expr,
FunctionDef,
GeneratorExp,
Global,
Import,
ImportFrom,
Lam... | null |
185,709 | from __future__ import annotations
import ast
from typing import final, TypeVar
class AnnotationRemover(ast.NodeTransformer):
def visit_single_arg(self, arg: ast.arg) -> ast.arg:
arg.annotation = None
return arg
def visit_fn_arguments(self, node: ast.arguments) -> ast.arguments:
if node.... | null |
185,710 | from __future__ import annotations
import ast
from typing import final, TypeVar
The provided code snippet includes necessary dependencies for implementing the `_copy_attrs` function. Write a Python function `def _copy_attrs(src: ast.AST, dest: ast.AST) -> None` to solve the following problem:
Copies line and column in... | Copies line and column info from one node to another. |
185,711 | from __future__ import annotations
from typing import Type
TYPE_FREEZE_ENABLED = True
The provided code snippet includes necessary dependencies for implementing the `set_freeze_enabled` function. Write a Python function `def set_freeze_enabled(flag: bool) -> bool` to solve the following problem:
returns old value
Her... | returns old value |
185,712 | from __future__ import annotations
from typing import Type
Type = _alias(type, 1, inst=False, name='Type')
Type.__doc__ = \
"""A special construct usable to annotate class objects.
For example, suppose we have the following classes::
class User: ... # Abstract base for User classes
class BasicUs... | Indicates that a type defined in a strict module should support assigning additional variables to __dict__ to support migration. |
185,713 | from __future__ import annotations
from typing import Type
Type = _alias(type, 1, inst=False, name='Type')
Type.__doc__ = \
"""A special construct usable to annotate class objects.
For example, suppose we have the following classes::
class User: ... # Abstract base for User classes
class BasicUs... | Marks a type defined in a strict module to get slots automatically and no __dict__ is created |
185,714 | from __future__ import annotations
from typing import Type
Type = _alias(type, 1, inst=False, name='Type')
Type.__doc__ = \
"""A special construct usable to annotate class objects.
For example, suppose we have the following classes::
class User: ... # Abstract base for User classes
class BasicUs... | mark `name` to be part of __slots__ in obj |
185,715 | from __future__ import annotations
from typing import Type
def _mark_cached_property(obj: object, is_async: bool, original_dec: object) -> object:
return obj | null |
185,716 | from __future__ import annotations
import ast
import os.path
import symtable
import typing
from ast import (
alias,
AST,
AsyncFunctionDef,
ClassDef,
comprehension,
copy_location,
DictComp,
FunctionDef,
GeneratorExp,
iter_fields,
Lambda,
ListComp,
NodeVisitor,
SetC... | null |
185,717 | from __future__ import annotations
import ast
import os.path
import symtable
import typing
from ast import (
alias,
AST,
AsyncFunctionDef,
ClassDef,
comprehension,
copy_location,
DictComp,
FunctionDef,
GeneratorExp,
iter_fields,
Lambda,
ListComp,
NodeVisitor,
SetC... | null |
185,718 | from __future__ import annotations
import ast
import os.path
import symtable
import typing
from ast import (
alias,
AST,
AsyncFunctionDef,
ClassDef,
comprehension,
copy_location,
DictComp,
FunctionDef,
GeneratorExp,
iter_fields,
Lambda,
ListComp,
NodeVisitor,
SetC... | null |
185,719 | import _imp
import importlib
import sys
import zipimport
from importlib.machinery import (
BYTECODE_SUFFIXES,
ExtensionFileLoader,
FileFinder,
SOURCE_SUFFIXES,
SourceFileLoader,
SourcelessFileLoader,
)
from . import compile as python_compile
class PySourceFileLoader(SourceFileLoader):
def s... | null |
185,720 | import _imp
import importlib
import sys
import zipimport
from importlib.machinery import (
BYTECODE_SUFFIXES,
ExtensionFileLoader,
FileFinder,
SOURCE_SUFFIXES,
SourceFileLoader,
SourcelessFileLoader,
)
from . import compile as python_compile
def install() -> None:
"""Installs a loader which... | null |
185,721 | from __future__ import annotations
import ast
import sys
from typing import Callable, cast, Mapping, Tuple, Type
def make_qualname(parent_qualname: str | None, name: str) -> str:
if parent_qualname is None:
return name
return f"{parent_qualname}.{name}" | null |
185,722 | from __future__ import annotations
import ast
import sys
from typing import Callable, cast, Mapping, Tuple, Type
COMPARE_OPS: Mapping[Type[ast.cmpop], Callable[[object, object], bool]] = {
ast.Gt: lambda a, b: a > b,
ast.GtE: lambda a, b: a >= b,
ast.Lt: lambda a, b: a < b,
ast.LtE: lambda a, b: a <= b,... | A helper function, the result of this is used to determine whether we need to skip visiting dead code gated by sys.hexversion checks. |
185,723 | from __future__ import annotations
import ast
from ast import (
AST,
Attribute,
BinOp,
Call,
ClassDef,
Constant,
Expression,
Name,
Subscript,
)
from contextlib import nullcontext
from enum import Enum
from typing import (
cast,
ContextManager,
Dict,
List,
Optional... | Find all transitive dependency modules of `modname`. Given an `alldeps` dictionary of {modname: {name: {(module, name)}}}, return the transitive closure of module names depended on by `modname` (not including `modname` itself). |
185,724 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,725 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | Compute the class precedence list (mro) according to C3 |
185,726 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,727 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,728 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,729 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,730 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,731 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,732 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,733 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,734 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,735 | from __future__ import annotations
from __static__ import chkdict, chklist
import ast
import dataclasses
import sys
from ast import (
AnnAssign,
Assign,
AST,
AsyncFunctionDef,
Attribute,
Bytes,
Call,
ClassDef,
cmpop,
Constant,
copy_location,
expr,
FunctionDef,
Nam... | null |
185,736 | import os
import sys
try:
from importlib.machinery import SourceFileLoader
except ImportError:
import imp
def find_module(modname):
"""Finds and returns a module in the local dist/checkout.
"""
modpath = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "Lib")
... | Write C code contents to the target file object. |
185,751 | import argparse
import ast
import io
import re
import subprocess
import sys
import textwrap
from io import TextIOWrapper
from typing import List, Tuple
import unparse
def run_fuzzer(code_str: str, subprocesses: int, output_file: TextIOWrapper) -> None:
subprocess_arr = []
for i in range(subprocesses):
s... | null |
185,752 | import ast
import io
import os
import sys
The provided code snippet includes necessary dependencies for implementing the `interleave` function. Write a Python function `def interleave(inter, f, seq)` to solve the following problem:
Call f on each item in seq, calling inter() in between.
Here is the function:
def int... | Call f on each item in seq, calling inter() in between. |
185,753 | import ast
import io
import os
import sys
def roundtrip(filename, output=sys.stdout):
def testdir(a):
try:
names = [n for n in os.listdir(a) if n.endswith(".py")]
except OSError:
print("Directory not readable: %s" % a, file=sys.stderr)
else:
for n in names:
fullname = os... | null |
185,754 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,755 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,756 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,757 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,758 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,759 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,760 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,761 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,762 | import argparse
import dis
import enum
import random
import string
import sys
import textwrap
import types
from cinderx.compiler import compile, opcode_cinder, pyassem, pycodegen, symbols
from cinderx.compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_VARARGS,
... | null |
185,794 | from __future__ import division
from __future__ import print_function
import time
import os
import sys
import itertools
import threading
import subprocess
import socket
from optparse import OptionParser, SUPPRESS_HELP
import platform
LAT_END = "END"
def _sendto(sock, s, addr):
sock.sendto(s.encode('ascii'), addr)
... | null |
185,795 | from __future__ import division
from __future__ import print_function
import time
import os
import sys
import itertools
import threading
import subprocess
import socket
from optparse import OptionParser, SUPPRESS_HELP
import platform
latency_tasks = throughput_tasks
def run_latency_test(func, args, nthreads):
# Cre... | null |
185,796 | from __future__ import division
from __future__ import print_function
import time
import os
import sys
import itertools
import threading
import subprocess
import socket
from optparse import OptionParser, SUPPRESS_HELP
import platform
def _sendto(sock, s, addr):
sock.sendto(s.encode('ascii'), addr)
def _recv(sock, n... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.