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 |
|---|---|---|---|---|---|---|---|
6,068,901 | visit_typeddict_type | def visit_typeddict_type(self, typ: TypedDictType) -> None:
for value_type in typ.items.values():
value_type.accept(self)
typ.fallback.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 495 | 498 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,902 | visit_raw_expression_type | def visit_raw_expression_type(self, t: RawExpressionType) -> None:
pass | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 500 | 501 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,903 | visit_literal_type | def visit_literal_type(self, typ: LiteralType) -> None:
typ.fallback.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 503 | 504 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,904 | visit_unbound_type | def visit_unbound_type(self, typ: UnboundType) -> None:
for arg in typ.args:
arg.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 506 | 508 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,905 | visit_type_list | def visit_type_list(self, typ: TypeList) -> None:
for item in typ.items:
item.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 510 | 512 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,906 | visit_callable_argument | def visit_callable_argument(self, typ: CallableArgument) -> None:
typ.typ.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 514 | 515 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,907 | visit_ellipsis_type | def visit_ellipsis_type(self, typ: EllipsisType) -> None:
pass | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 517 | 518 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,908 | visit_star_type | def visit_star_type(self, typ: StarType) -> None:
typ.type.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 520 | 521 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,909 | visit_uninhabited_type | def visit_uninhabited_type(self, typ: UninhabitedType) -> None:
pass | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 523 | 524 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,910 | visit_union_type | def visit_union_type(self, typ: UnionType) -> None:
for item in typ.items:
item.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 526 | 528 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,911 | visit_placeholder_type | def visit_placeholder_type(self, t: PlaceholderType) -> None:
for item in t.args:
item.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 530 | 532 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,912 | fixup | def fixup(self, node: SN) -> SN:
if node in self.replacements:
new = self.replacements[node]
return cast(SN, new)
return node | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 536 | 540 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,913 | replace_nodes_in_symbol_table | def replace_nodes_in_symbol_table(
symbols: SymbolTable, replacements: dict[SymbolNode, SymbolNode]
) -> None:
for name, node in symbols.items():
if node.node:
if node.node in replacements:
new = replacements[node.node]
old = node.node
# Needed... | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/astmerge.py | 543 | 556 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,914 | isproperty | def isproperty(o: object, attr: str) -> bool:
return isinstance(getattr(type(o), attr, None), property) | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/objgraph.py | 36 | 37 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,915 | get_edge_candidates | def get_edge_candidates(o: object) -> Iterator[tuple[object, object]]:
# use getattr because mypyc expects dict, not mappingproxy
if "__getattribute__" in getattr(type(o), "__dict__"): # noqa: B009
return
if type(o) not in COLLECTION_TYPE_BLACKLIST:
for attr in dir(o):
try:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/objgraph.py | 40 | 57 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,916 | get_edges | def get_edges(o: object) -> Iterator[tuple[object, object]]:
for s, e in get_edge_candidates(o):
if isinstance(e, FUNCTION_TYPES):
# We don't want to collect methods, but do want to collect values
# in closures and self pointers to other objects
if hasattr(e, "__closure_... | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/objgraph.py | 60 | 74 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,917 | get_reachable_graph | def get_reachable_graph(root: object) -> tuple[dict[int, object], dict[int, tuple[int, object]]]:
parents = {}
seen = {id(root): root}
worklist = [root]
while worklist:
o = worklist.pop()
for s, e in get_edges(o):
if id(e) in seen:
continue
parents... | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/objgraph.py | 77 | 90 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,918 | get_path | def get_path(
o: object, seen: dict[int, object], parents: dict[int, tuple[int, object]]
) -> list[tuple[object, object]]:
path = []
while id(o) in parents:
pid, attr = parents[id(o)]
o = seen[pid]
path.append((attr, o))
path.reverse()
return path | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/objgraph.py | 93 | 102 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,919 | make_trigger | def make_trigger(name: str) -> str:
return f"<{name}>" | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/trigger.py | 13 | 14 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,920 | make_wildcard_trigger | def make_wildcard_trigger(module: str) -> str:
"""Special trigger fired when any top-level name is changed in a module.
Note that this is different from a module trigger, as module triggers are only
fired if the module is created, deleted, or replaced with a non-module, whereas
a wildcard trigger is tr... | python | python-3.10.8.amd64/Lib/site-packages/mypy/server/trigger.py | 17 | 26 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,921 | force_path | def force_path(location, require_exists=True):
if not isinstance(location, Path):
location = Path(location)
if require_exists and not location.exists():
raise ValueError(f"Can't read file: {location}")
return location | python | python-3.10.8.amd64/Lib/site-packages/srsly/util.py | 20 | 25 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,922 | force_string | def force_string(location):
if isinstance(location, str):
return location
return str(location) | python | python-3.10.8.amd64/Lib/site-packages/srsly/util.py | 28 | 31 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,923 | __init__ | def __init__(self, typ="safe", pure=True):
YAML.__init__(self, typ=typ, pure=pure)
self.default_flow_style = False
self.allow_unicode = True
self.encoding = "utf-8" | python | python-3.10.8.amd64/Lib/site-packages/srsly/_yaml_api.py | 11 | 15 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,924 | dump | def dump(self, data, stream=None, **kw):
inefficient = False
if stream is None:
inefficient = True
stream = StringIO()
YAML.dump(self, data, stream, **kw)
if inefficient:
return stream.getvalue() | python | python-3.10.8.amd64/Lib/site-packages/srsly/_yaml_api.py | 18 | 25 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,925 | yaml_dumps | def yaml_dumps(
data: YAMLInput,
indent_mapping: int = 2,
indent_sequence: int = 4,
indent_offset: int = 2,
sort_keys: bool = False,
) -> str:
"""Serialize an object to a YAML string. See the ruamel.yaml docs on
indentation for more details on the expected format.
https://yaml.readthedoc... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_yaml_api.py | 28 | 49 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,926 | yaml_loads | def yaml_loads(data: Union[str, IO]) -> YAMLOutput:
"""Deserialize unicode or a file object a Python object.
data (str / file): The data to deserialize.
RETURNS: The deserialized Python object.
"""
yaml = CustomYaml()
try:
return yaml.load(data)
except Exception as e:
raise ... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_yaml_api.py | 52 | 62 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,927 | read_yaml | def read_yaml(path: FilePath) -> YAMLOutput:
"""Load YAML from file or standard input.
location (FilePath): The file path. "-" for reading from stdin.
RETURNS (YAMLOutput): The loaded content.
"""
if path == "-": # reading from sys.stdin
data = sys.stdin.read()
return yaml_loads(da... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_yaml_api.py | 65 | 76 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,928 | write_yaml | def write_yaml(
path: FilePath,
data: YAMLInput,
indent_mapping: int = 2,
indent_sequence: int = 4,
indent_offset: int = 2,
sort_keys: bool = False,
) -> None:
"""Create a .json file and dump contents or write to standard
output.
location (FilePath): The file path. "-" for writing t... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_yaml_api.py | 79 | 109 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,929 | is_yaml_serializable | def is_yaml_serializable(obj: Any) -> bool:
"""Check if a Python object is YAML-serializable (strict).
obj: The object to check.
RETURNS (bool): Whether the object is YAML-serializable.
"""
try:
yaml_dumps(obj)
return True
except RepresenterError:
return False | python | python-3.10.8.amd64/Lib/site-packages/srsly/_yaml_api.py | 112 | 122 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,930 | msgpack_dumps | def msgpack_dumps(data: JSONInputBin) -> bytes:
"""Serialize an object to a msgpack byte string.
data: The data to serialize.
RETURNS (bytes): The serialized bytes.
"""
return msgpack.dumps(data, use_bin_type=True) | python | python-3.10.8.amd64/Lib/site-packages/srsly/_msgpack_api.py | 8 | 14 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,931 | msgpack_loads | def msgpack_loads(data: bytes, use_list: bool = True) -> JSONOutputBin:
"""Deserialize msgpack bytes to a Python object.
data (bytes): The data to deserialize.
use_list (bool): Don't use tuples instead of lists. Can make
deserialization slower.
RETURNS: The deserialized Python object.
"""
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_msgpack_api.py | 17 | 29 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,932 | write_msgpack | def write_msgpack(path: FilePath, data: JSONInputBin) -> None:
"""Create a msgpack file and dump contents.
location (FilePath): The file path.
data (JSONInputBin): The data to serialize.
"""
file_path = force_path(path, require_exists=False)
with file_path.open("wb") as f:
msgpack.dump(... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_msgpack_api.py | 32 | 40 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,933 | read_msgpack | def read_msgpack(path: FilePath, use_list: bool = True) -> JSONOutputBin:
"""Load a msgpack file.
location (FilePath): The file path.
use_list (bool): Don't use tuples instead of lists. Can make
deserialization slower.
RETURNS (JSONOutputBin): The loaded and deserialized content.
"""
fi... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_msgpack_api.py | 43 | 57 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,934 | json_dumps | def json_dumps(
data: JSONInput, indent: Optional[int] = 0, sort_keys: bool = False
) -> str:
"""Serialize an object to a JSON string.
data: The JSON-serializable data.
indent (int): Number of spaces used to indent JSON.
sort_keys (bool): Sort dictionary keys. Falls back to json module for now.
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 10 | 27 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,935 | json_loads | def json_loads(data: Union[str, bytes]) -> JSONOutput:
"""Deserialize unicode or bytes to a Python object.
data (str / bytes): The data to deserialize.
RETURNS: The deserialized Python object.
"""
# Avoid transforming the string '-' into the int '0'
if data == "-":
raise ValueError("Exp... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 30 | 39 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,936 | read_json | def read_json(path: FilePath) -> JSONOutput:
"""Load JSON from file or standard input.
path (FilePath): The file path. "-" for reading from stdin.
RETURNS (JSONOutput): The loaded JSON content.
"""
if path == "-": # reading from sys.stdin
data = sys.stdin.read()
return ujson.loads(... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 42 | 53 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,937 | read_gzip_json | def read_gzip_json(path: FilePath) -> JSONOutput:
"""Load JSON from a gzipped file.
location (FilePath): The file path.
RETURNS (JSONOutput): The loaded JSON content.
"""
file_path = force_string(path)
with gzip.open(file_path, "r") as f:
return ujson.load(f) | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 56 | 64 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,938 | write_json | def write_json(path: FilePath, data: JSONInput, indent: int = 2) -> None:
"""Create a .json file and dump contents or write to standard
output.
location (FilePath): The file path. "-" for writing to stdout.
data (JSONInput): The JSON-serializable data to output.
indent (int): Number of spaces used ... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 67 | 81 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,939 | write_gzip_json | def write_gzip_json(path: FilePath, data: JSONInput, indent: int = 2) -> None:
"""Create a .json.gz file and dump contents.
path (FilePath): The file path.
data (JSONInput): The JSON-serializable data to output.
indent (int): Number of spaces used to indent JSON.
"""
json_data = json_dumps(data... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 84 | 94 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,940 | read_jsonl | def read_jsonl(path: FilePath, skip: bool = False) -> Iterable[JSONOutput]:
"""Read a .jsonl file or standard input and yield contents line by line.
Blank lines will always be skipped.
path (FilePath): The file path. "-" for reading from stdin.
skip (bool): Skip broken lines and don't raise ValueError.... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 97 | 112 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,941 | write_jsonl | def write_jsonl(
path: FilePath,
lines: Iterable[JSONInput],
append: bool = False,
append_new_line: bool = True,
) -> None:
"""Create a .jsonl file and dump contents or write to standard output.
location (FilePath): The file path. "-" for writing to stdout.
lines (Sequence[JSONInput]): The ... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 115 | 139 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,942 | is_json_serializable | def is_json_serializable(obj: Any) -> bool:
"""Check if a Python object is JSON-serializable.
obj: The object to check.
RETURNS (bool): Whether the object is JSON-serializable.
"""
if hasattr(obj, "__call__"):
# Check this separately here to prevent infinite recursions
return False
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 142 | 155 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,943 | _yield_json_lines | def _yield_json_lines(
stream: Iterable[str], skip: bool = False
) -> Iterable[JSONOutput]:
line_no = 1
for line in stream:
line = line.strip()
if line == "":
continue
try:
yield ujson.loads(line)
except ValueError:
if skip:
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/_json_api.py | 158 | 172 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,944 | pickle_dumps | def pickle_dumps(data: JSONInput, protocol: Optional[int] = None) -> bytes:
"""Serialize a Python object with pickle.
data: The object to serialize.
protocol (int): Protocol to use. -1 for highest.
RETURNS (bytes): The serialized object.
"""
return cloudpickle.dumps(data, protocol=protocol) | python | python-3.10.8.amd64/Lib/site-packages/srsly/_pickle_api.py | 7 | 14 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,945 | pickle_loads | def pickle_loads(data: bytes) -> JSONOutput:
"""Deserialize bytes with pickle.
data (bytes): The data to deserialize.
RETURNS: The deserialized Python object.
"""
return cloudpickle.loads(data) | python | python-3.10.8.amd64/Lib/site-packages/srsly/_pickle_api.py | 17 | 23 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,946 | ensure_bytes | def ensure_bytes(string):
"""Ensure a string is returned as a bytes object, encoded as utf8."""
if isinstance(string, unicode):
return string.encode("utf8")
else:
return string | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/util.py | 9 | 14 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,947 | encode_numpy | def encode_numpy(obj, chain=None):
"""
Data encoder for serializing numpy data types.
"""
if not has_numpy:
return obj if chain is None else chain(obj)
if has_cupy and isinstance(obj, cupy.ndarray):
obj = obj.get()
if isinstance(obj, np.ndarray):
# If the dtype is structu... | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/_msgpack_numpy.py | 26 | 55 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,948 | tostr | def tostr(x):
if isinstance(x, bytes):
return x.decode()
else:
return str(x) | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/_msgpack_numpy.py | 58 | 62 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,949 | decode_numpy | def decode_numpy(obj, chain=None):
"""
Decoder for deserializing numpy data types.
"""
try:
if b"nd" in obj:
if obj[b"nd"] is True:
# Check if b'kind' is in obj to enable decoding of data
# serialized with older versions (#20):
if b"k... | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/_msgpack_numpy.py | 65 | 94 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,950 | __init__ | def __init__(self, *args, **kwargs):
default = kwargs.get("default")
for encoder in msgpack_encoders.get_all().values():
default = functools.partial(encoder, chain=default)
kwargs["default"] = default
super(Packer, self).__init__(*args, **kwargs) | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/__init__.py | 26 | 31 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,951 | __init__ | def __init__(self, *args, **kwargs):
object_hook = kwargs.get("object_hook")
for decoder in msgpack_decoders.get_all().values():
object_hook = functools.partial(decoder, chain=object_hook)
kwargs["object_hook"] = object_hook
super(Unpacker, self).__init__(*args, **kwargs) | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/__init__.py | 35 | 40 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,952 | pack | def pack(o, stream, **kwargs):
"""
Pack an object and write it to a stream.
"""
packer = Packer(**kwargs)
stream.write(packer.pack(o)) | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/__init__.py | 43 | 48 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,953 | packb | def packb(o, **kwargs):
"""
Pack an object and return the packed bytes.
"""
return Packer(**kwargs).pack(o) | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/__init__.py | 51 | 55 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,954 | unpack | def unpack(stream, **kwargs):
"""
Unpack a packed object from a stream.
"""
if "object_pairs_hook" not in kwargs:
object_hook = kwargs.get("object_hook")
for decoder in msgpack_decoders.get_all().values():
object_hook = functools.partial(decoder, chain=object_hook)
kw... | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/__init__.py | 58 | 67 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,955 | unpackb | def unpackb(packed, **kwargs):
"""
Unpack a packed object.
"""
if "object_pairs_hook" not in kwargs:
object_hook = kwargs.get("object_hook")
for decoder in msgpack_decoders.get_all().values():
object_hook = functools.partial(decoder, chain=object_hook)
kwargs["object_... | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/__init__.py | 70 | 79 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,956 | __init__ | def __init__(self, unpacked, extra):
self.unpacked = unpacked
self.extra = extra | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/exceptions.py | 37 | 39 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,957 | __str__ | def __str__(self):
return "unpack(b) received extra data." | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/exceptions.py | 41 | 42 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,958 | __new__ | def __new__(cls, code, data):
if not isinstance(code, int):
raise TypeError("code must be int")
if not isinstance(data, bytes):
raise TypeError("data must be bytes")
if not 0 <= code <= 127:
raise ValueError("code must be 0~127")
return super(ExtType, ... | python | python-3.10.8.amd64/Lib/site-packages/srsly/msgpack/_ext_type.py | 7 | 14 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,959 | f | def f():
a = 1
def g():
return a
return g | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 71 | 76 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,960 | g | def g():
return a | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 74 | 75 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,961 | _get_or_create_tracker_id | def _get_or_create_tracker_id(class_def):
with _DYNAMIC_CLASS_TRACKER_LOCK:
class_tracker_id = _DYNAMIC_CLASS_TRACKER_BY_CLASS.get(class_def)
if class_tracker_id is None:
class_tracker_id = uuid.uuid4().hex
_DYNAMIC_CLASS_TRACKER_BY_CLASS[class_def] = class_tracker_id
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 105 | 112 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,962 | _lookup_class_or_track | def _lookup_class_or_track(class_tracker_id, class_def):
if class_tracker_id is not None:
with _DYNAMIC_CLASS_TRACKER_LOCK:
class_def = _DYNAMIC_CLASS_TRACKER_BY_ID.setdefault(
class_tracker_id, class_def)
_DYNAMIC_CLASS_TRACKER_BY_CLASS[class_def] = class_tracker_id
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 115 | 121 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,963 | register_pickle_by_value | def register_pickle_by_value(module):
"""Register a module to make it functions and classes picklable by value.
By default, functions and classes that are attributes of an importable
module are to be pickled by reference, that is relying on re-importing
the attribute from the module at load time.
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 124 | 162 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,964 | unregister_pickle_by_value | def unregister_pickle_by_value(module):
"""Unregister that the input module should be pickled by value."""
if not isinstance(module, types.ModuleType):
raise ValueError(
f"Input should be a module object, got {str(module)} instead"
)
if module.__name__ not in _PICKLE_BY_VALUE_MOD... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 165 | 174 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,965 | list_registry_pickle_by_value | def list_registry_pickle_by_value():
return _PICKLE_BY_VALUE_MODULES.copy() | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 177 | 178 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,966 | _is_registered_pickle_by_value | def _is_registered_pickle_by_value(module):
module_name = module.__name__
if module_name in _PICKLE_BY_VALUE_MODULES:
return True
while True:
parent_name = module_name.rsplit(".", 1)[0]
if parent_name == module_name:
break
if parent_name in _PICKLE_BY_VALUE_MODULE... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 181 | 192 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,967 | _whichmodule | def _whichmodule(obj, name):
"""Find the module an object belongs to.
This function differs from ``pickle.whichmodule`` in two ways:
- it does not mangle the cases where obj's module is __main__ and obj was
not found in any module.
- Errors arising during module introspection are ignored, as thos... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 195 | 238 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,968 | _should_pickle_by_reference | def _should_pickle_by_reference(obj, name=None):
"""Test whether an function or a class should be pickled by reference
Pickling by reference means by that the object (typically a function or a
class) is an attribute of a module that is assumed to be importable in the
target Python environment. Loadi... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 241 | 275 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,969 | _lookup_module_and_qualname | def _lookup_module_and_qualname(obj, name=None):
if name is None:
name = getattr(obj, '__qualname__', None)
if name is None: # pragma: no cover
# This used to be needed for Python 2.7 support but is probably not
# needed anymore. However we keep the __name__ introspection in case
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 278 | 315 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,970 | _extract_code_globals | def _extract_code_globals(co):
"""
Find all globals names read or written to by codeblock co
"""
out_names = _extract_code_globals_cache.get(co)
if out_names is None:
# We use a dict with None values instead of a set to get a
# deterministic order (assuming Python 3.6+) and avoid int... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 318 | 342 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,971 | _find_imported_submodules | def _find_imported_submodules(code, top_level_dependencies):
"""
Find currently imported submodules used by a function.
Submodules used by a function need to be detected and referenced for the
function to work correctly at depickling time. Because submodules can be
referenced as attribute of their ... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 345 | 389 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,972 | cell_set | def cell_set(cell, value):
"""Set the value of a closure cell.
The point of this function is to set the cell_contents attribute of a cell
after its creation. This operation is necessary in case the cell contains a
reference to the function the cell belongs to, as when calling the
function's constru... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 392 | 454 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,973 | _make_cell_set_template_code | def _make_cell_set_template_code():
def _cell_set_factory(value):
lambda: cell
cell = value
co = _cell_set_factory.__code__
_cell_set_template_code = types.CodeType(
co.co_argcount,
co.co_kwonlyargcount, # Python 3 only argument
co.co_nlocals,
co.co_stacks... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 457 | 481 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,974 | _cell_set_factory | def _cell_set_factory(value):
lambda: cell
cell = value | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 458 | 460 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,975 | _builtin_type | def _builtin_type(name):
if name == "ClassType": # pragma: no cover
# Backward compat to load pickle files generated with cloudpickle
# < 1.3 even if loading pickle files from older versions is not
# officially supported.
return type
return getattr(types, name) | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 502 | 508 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,976 | _walk_global_ops | def _walk_global_ops(code):
"""
Yield referenced name for all global-referencing instructions in *code*.
"""
for instr in dis.get_instructions(code):
op = instr.opcode
if op in GLOBAL_OPS:
yield instr.argval | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 511 | 518 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,977 | _extract_class_dict | def _extract_class_dict(cls):
"""Retrieve a copy of the dict of a class without the inherited methods"""
clsdict = dict(cls.__dict__) # copy dict proxy to a dict
if len(cls.__bases__) == 1:
inherited_dict = cls.__bases__[0].__dict__
else:
inherited_dict = {}
for base in reversed... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 521 | 540 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,978 | _is_parametrized_type_hint | def _is_parametrized_type_hint(obj):
# This is very cheap but might generate false positives. So try to
# narrow it down is good as possible.
type_module = getattr(type(obj), '__module__', None)
from_typing_extensions = type_module == 'typing_extensions'
from_typing = type_module... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 544 | 579 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,979 | _create_parametrized_type_hint | def _create_parametrized_type_hint(origin, args):
return origin[args] | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 581 | 582 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,980 | parametrized_type_hint_getinitargs | def parametrized_type_hint_getinitargs(obj):
# The distorted type check sematic for typing construct becomes:
# ``type(obj) is type(TypeHint)``, which means "obj is a
# parametrized TypeHint"
if type(obj) is type(Literal): # pragma: no branch
initargs = (Literal, obj.__values__)
elif type(o... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 588 | 615 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,981 | is_tornado_coroutine | def is_tornado_coroutine(func):
"""
Return whether *func* is a Tornado coroutine function.
Running coroutines are not supported.
"""
if 'tornado.gen' not in sys.modules:
return False
gen = sys.modules['tornado.gen']
if not hasattr(gen, "is_coroutine_function"):
# Tornado vers... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 620 | 631 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,982 | _rebuild_tornado_coroutine | def _rebuild_tornado_coroutine(func):
from tornado import gen
return gen.coroutine(func) | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 634 | 636 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,983 | subimport | def subimport(name):
# We cannot do simply: `return __import__(name)`: Indeed, if ``name`` is
# the name of a submodule, __import__ will return the top-level root module
# of this submodule. For instance, __import__('os.path') returns the `os`
# module.
__import__(name)
return sys.modules[name] | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 644 | 650 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,984 | dynamic_subimport | def dynamic_subimport(name, vars):
mod = types.ModuleType(name)
mod.__dict__.update(vars)
mod.__dict__['__builtins__'] = builtins.__dict__
return mod | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 653 | 657 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,985 | _gen_ellipsis | def _gen_ellipsis():
return Ellipsis | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 660 | 661 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,986 | _gen_not_implemented | def _gen_not_implemented():
return NotImplemented | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 664 | 665 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,987 | _get_cell_contents | def _get_cell_contents(cell):
try:
return cell.cell_contents
except ValueError:
# sentinel used by ``_fill_function`` which will leave the cell empty
return _empty_cell_value | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 668 | 673 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,988 | instance | def instance(cls):
"""Create a new instance of a class.
Parameters
----------
cls : type
The class to create an instance of.
Returns
-------
instance : cls
A new instance of ``cls``.
"""
return cls() | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 676 | 689 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,989 | __reduce__ | def __reduce__(cls):
return cls.__name__ | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 697 | 698 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,990 | _fill_function | def _fill_function(*args):
"""Fills in the rest of function data into the skeleton function object
The skeleton itself is create by _make_skel_func().
"""
if len(args) == 2:
func = args[0]
state = args[1]
elif len(args) == 5:
# Backwards compat for cloudpickle v0.4.0, after ... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 701 | 763 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,991 | _make_function | def _make_function(code, globals, name, argdefs, closure):
# Setting __builtins__ in globals is needed for nogil CPython.
globals["__builtins__"] = __builtins__
return types.FunctionType(code, globals, name, argdefs, closure) | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 766 | 769 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,992 | _make_empty_cell | def _make_empty_cell():
if False:
# trick the compiler into creating an empty cell in our lambda
cell = None
raise AssertionError('this route should not be executed')
return (lambda: cell).__closure__[0] | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 772 | 778 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,993 | _make_cell | def _make_cell(value=_empty_cell_value):
cell = _make_empty_cell()
if value is not _empty_cell_value:
cell_set(cell, value)
return cell | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 781 | 785 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,994 | _make_skel_func | def _make_skel_func(code, cell_count, base_globals=None):
""" Creates a skeleton function object that contains just the provided
code and the correct number of cells in func_closure. All other
func attributes (e.g. func_globals) are empty.
"""
# This function is deprecated and should be rem... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 788 | 812 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,995 | _make_skeleton_class | def _make_skeleton_class(type_constructor, name, bases, type_kwargs,
class_tracker_id, extra):
"""Build dynamic class with an empty __dict__ to be filled once memoized
If class_tracker_id is not None, try to lookup an existing class definition
matching that id. If none is found, tr... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 815 | 831 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,996 | _rehydrate_skeleton_class | def _rehydrate_skeleton_class(skeleton_class, class_dict):
"""Put attributes from `class_dict` back on `skeleton_class`.
See CloudPickler.save_dynamic_class for more info.
"""
registry = None
for attrname, attr in class_dict.items():
if attrname == "_abc_impl":
registry = attr
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 834 | 849 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,997 | _make_skeleton_enum | def _make_skeleton_enum(bases, name, qualname, members, module,
class_tracker_id, extra):
"""Build dynamic enum with an empty __dict__ to be filled once memoized
The creation of the enum class is inspired by the code of
EnumMeta._create_.
If class_tracker_id is not None, try to... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 852 | 879 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,998 | _make_typevar | def _make_typevar(name, bound, constraints, covariant, contravariant,
class_tracker_id):
tv = typing.TypeVar(
name, *constraints, bound=bound,
covariant=covariant, contravariant=contravariant
)
if class_tracker_id is not None:
return _lookup_class_or_track(class_tra... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 882 | 892 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,999 | _decompose_typevar | def _decompose_typevar(obj):
return (
obj.__name__, obj.__bound__, obj.__constraints__,
obj.__covariant__, obj.__contravariant__,
_get_or_create_tracker_id(obj),
) | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 895 | 900 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,069,000 | _typevar_reduce | def _typevar_reduce(obj):
# TypeVar instances require the module information hence why we
# are not using the _should_pickle_by_reference directly
module_and_name = _lookup_module_and_qualname(obj, name=obj.__name__)
if module_and_name is None:
return (_make_typevar, _decompose_typevar(obj))
... | python | python-3.10.8.amd64/Lib/site-packages/srsly/cloudpickle/cloudpickle.py | 903 | 913 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.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.