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,067,501
is_duplicate_mapping
def is_duplicate_mapping( mapping: list[int], actual_types: list[Type], actual_kinds: list[ArgKind] ) -> bool: return ( len(mapping) > 1 # Multiple actuals can map to the same formal if they both come from # varargs (*args and **kwargs); in this case at runtime it is possible # t...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,004
5,026
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,502
replace_callable_return_type
def replace_callable_return_type(c: CallableType, new_ret_type: Type) -> CallableType: """Return a copy of a callable type with a different return type.""" return c.copy_modified(ret_type=new_ret_type)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,029
5,031
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,503
__init__
def __init__(self) -> None: super().__init__(any)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,042
5,043
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,504
visit_callable_type
def visit_callable_type(self, t: CallableType) -> bool: return self.query_types(t.arg_types) or t.accept(HasTypeVarQuery())
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,045
5,046
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,505
__init__
def __init__(self) -> None: super().__init__(any)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,052
5,053
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,506
visit_type_var
def visit_type_var(self, t: TypeVarType) -> bool: return True
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,055
5,056
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,507
has_erased_component
def has_erased_component(t: Type | None) -> bool: return t is not None and t.accept(HasErasedComponentsQuery())
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,059
5,060
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,508
__init__
def __init__(self) -> None: super().__init__(any)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,066
5,067
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,509
visit_erased_type
def visit_erased_type(self, t: ErasedType) -> bool: return True
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,069
5,070
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,510
has_uninhabited_component
def has_uninhabited_component(t: Type | None) -> bool: return t is not None and t.accept(HasUninhabitedComponentsQuery())
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,073
5,074
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,511
__init__
def __init__(self) -> None: super().__init__(any)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,080
5,081
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,512
visit_uninhabited_type
def visit_uninhabited_type(self, t: UninhabitedType) -> bool: return True
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,083
5,084
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,513
arg_approximate_similarity
def arg_approximate_similarity(actual: Type, formal: Type) -> bool: """Return if caller argument (actual) is roughly compatible with signature arg (formal). This function is deliberately loose and will report two types are similar as long as their "shapes" are plausibly the same. This is useful when w...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,087
5,147
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,514
is_typetype_like
def is_typetype_like(typ: ProperType) -> bool: return ( isinstance(typ, TypeType) or (isinstance(typ, FunctionLike) and typ.is_type_obj()) or (isinstance(typ, Instance) and typ.type.fullname == "builtins.type") )
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,108
5,113
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,515
any_causes_overload_ambiguity
def any_causes_overload_ambiguity( items: list[CallableType], return_types: list[Type], arg_types: list[Type], arg_kinds: list[ArgKind], arg_names: Sequence[str | None] | None, ) -> bool: """May an argument containing 'Any' cause ambiguous result type on call to overloaded function? Note th...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,150
5,205
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,516
all_same_types
def all_same_types(types: list[Type]) -> bool: if len(types) == 0: return True return all(is_same_type(t, types[0]) for t in types[1:])
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,208
5,211
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,517
merge_typevars_in_callables_by_name
def merge_typevars_in_callables_by_name( callables: Sequence[CallableType], ) -> tuple[list[CallableType], list[TypeVarType]]: """Takes all the typevars present in the callables and 'combines' the ones with the same name. For example, suppose we have two callables with signatures "f(x: T, y: S) -> T" and ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,214
5,256
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,518
try_getting_literal
def try_getting_literal(typ: Type) -> ProperType: """If possible, get a more precise literal type for a given type.""" typ = get_proper_type(typ) if isinstance(typ, Instance) and typ.last_known_value is not None: return typ.last_known_value return typ
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,259
5,264
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,519
is_expr_literal_type
def is_expr_literal_type(node: Expression) -> bool: """Returns 'true' if the given node is a Literal""" if isinstance(node, IndexExpr): base = node.base return isinstance(base, RefExpr) and base.fullname in LITERAL_TYPE_NAMES if isinstance(node, NameExpr): underlying = node.node ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,267
5,277
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,520
has_bytes_component
def has_bytes_component(typ: Type) -> bool: """Is this one of builtin byte types, or a union that contains it?""" typ = get_proper_type(typ) byte_types = {"builtins.bytes", "builtins.bytearray"} if isinstance(typ, UnionType): return any(has_bytes_component(t) for t in typ.items) if isinstanc...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,280
5,288
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,521
type_info_from_type
def type_info_from_type(typ: Type) -> TypeInfo | None: """Gets the TypeInfo for a type, indirecting through things like type variables and tuples.""" typ = get_proper_type(typ) if isinstance(typ, FunctionLike) and typ.is_type_obj(): return typ.type_object() if isinstance(typ, TypeType): ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,291
5,307
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,522
is_operator_method
def is_operator_method(fullname: str | None) -> bool: if fullname is None: return False short_name = fullname.split(".")[-1] return ( short_name in operators.op_methods.values() or short_name in operators.reverse_op_methods.values() or short_name in operators.unary_op_methods...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,310
5,318
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,523
get_partial_instance_type
def get_partial_instance_type(t: Type | None) -> PartialType | None: if t is None or not isinstance(t, PartialType) or t.type is None: return None return t
python
python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py
5,321
5,324
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,524
lookup_qualified
def lookup_qualified( self, name: str, ctx: Context, suppress_errors: bool = False ) -> SymbolTableNode | None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
56
59
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,525
lookup_fully_qualified
def lookup_fully_qualified(self, name: str) -> SymbolTableNode: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
62
63
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,526
lookup_fully_qualified_or_none
def lookup_fully_qualified_or_none(self, name: str) -> SymbolTableNode | None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
66
67
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,527
fail
def fail( self, msg: str, ctx: Context, serious: bool = False, *, blocker: bool = False, code: ErrorCode | None = None, ) -> None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.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,067,528
note
def note(self, msg: str, ctx: Context, *, code: ErrorCode | None = None) -> None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
82
83
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,529
record_incomplete_ref
def record_incomplete_ref(self) -> None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
86
87
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,530
defer
def defer(self, debug_context: Context | None = None, force_progress: bool = False) -> None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
90
91
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,531
is_incomplete_namespace
def is_incomplete_namespace(self, fullname: str) -> bool: """Is a module or class namespace potentially missing some definitions?""" raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
94
96
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,532
final_iteration
def final_iteration(self) -> bool: """Is this the final iteration of semantic analysis?""" raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
100
102
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,533
is_future_flag_set
def is_future_flag_set(self, flag: str) -> bool: """Is the specific __future__ feature imported""" raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
105
107
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,534
is_stub_file
def is_stub_file(self) -> bool: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
111
112
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,535
is_func_scope
def is_func_scope(self) -> bool: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
115
116
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,536
lookup
def lookup( self, name: str, ctx: Context, suppress_errors: bool = False ) -> SymbolTableNode | None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
133
136
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,537
named_type
def named_type(self, fullname: str, args: list[Type] | None = None) -> Instance: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
139
140
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,538
named_type_or_none
def named_type_or_none(self, fullname: str, args: list[Type] | None = None) -> Instance | None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
143
144
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,539
accept
def accept(self, node: Node) -> None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
147
148
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,540
anal_type
def anal_type( self, t: Type, *, tvar_scope: TypeVarLikeScope | None = None, allow_tuple_literal: bool = False, allow_unbound_tvars: bool = False, allow_required: bool = False, allow_placeholder: bool = False, report_invalid_types: bool = True, ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
151
162
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,541
get_and_bind_all_tvars
def get_and_bind_all_tvars(self, type_exprs: list[Expression]) -> list[TypeVarLikeType]: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
165
166
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,542
basic_new_typeinfo
def basic_new_typeinfo(self, name: str, basetype_or_fallback: Instance, line: int) -> TypeInfo: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
169
170
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,543
schedule_patch
def schedule_patch(self, priority: int, fn: Callable[[], None]) -> None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
173
174
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,544
add_symbol_table_node
def add_symbol_table_node(self, name: str, stnode: SymbolTableNode) -> bool: """Add node to the current symbol table.""" raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
177
179
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,545
current_symbol_table
def current_symbol_table(self) -> SymbolTable: """Get currently active symbol table. May be module, class, or local namespace. """ raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
182
187
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,546
add_symbol
def add_symbol( self, name: str, node: SymbolNode, context: Context, module_public: bool = True, module_hidden: bool = False, can_defer: bool = True, ) -> bool: """Add symbol to the current symbol table.""" raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
190
200
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,547
add_symbol_skip_local
def add_symbol_skip_local(self, name: str, node: SymbolNode) -> None: """Add symbol to the current symbol table, skipping locals. This is used to store symbol nodes in a symbol table that is going to be serialized (local namespaces are not serialized). See implementation docstring for m...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
203
210
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,548
parse_bool
def parse_bool(self, expr: Expression) -> bool | None: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
213
214
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,549
qualified_name
def qualified_name(self, n: str) -> str: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
217
218
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,550
is_typeshed_stub_file
def is_typeshed_stub_file(self) -> bool: raise NotImplementedError
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
222
223
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,551
set_callable_name
def set_callable_name(sig: Type, fdef: FuncDef) -> ProperType: sig = get_proper_type(sig) if isinstance(sig, FunctionLike): if fdef.info: if fdef.info.fullname in TPDICT_FB_NAMES: # Avoid exposing the internal _TypedDict name. class_name = "TypedDict" ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
226
239
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,552
calculate_tuple_fallback
def calculate_tuple_fallback(typ: TupleType) -> None: """Calculate a precise item type for the fallback of a tuple type. This must be called only after the main semantic analysis pass, since joins aren't available before that. Note that there is an apparent chicken and egg problem with respect to ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
242
258
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,553
__call__
def __call__(self, fully_qualified_name: str, args: list[Type] | None = None) -> Instance: ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
262
263
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,554
paramspec_args
def paramspec_args( name: str, fullname: str, id: TypeVarId | int, *, named_type_func: _NamedTypeCallback, line: int = -1, column: int = -1, prefix: Parameters | None = None, ) -> ParamSpecType: return ParamSpecType( name, fullname, id, flavor=ParamSpe...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
266
285
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,555
paramspec_kwargs
def paramspec_kwargs( name: str, fullname: str, id: TypeVarId | int, *, named_type_func: _NamedTypeCallback, line: int = -1, column: int = -1, prefix: Parameters | None = None, ) -> ParamSpecType: return ParamSpecType( name, fullname, id, flavor=ParamS...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
288
309
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,556
__init__
def __init__(self) -> None: super().__init__(any)
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
313
314
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,557
visit_placeholder_type
def visit_placeholder_type(self, t: PlaceholderType) -> bool: return True
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
316
317
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,558
has_placeholder
def has_placeholder(typ: Type) -> bool: """Check if a type contains any placeholder types (recursively).""" return typ.accept(HasPlaceholders())
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_shared.py
320
322
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,559
infer_decorator_signature_if_simple
def infer_decorator_signature_if_simple( dec: Decorator, analyzer: SemanticAnalyzerInterface ) -> None: """Try to infer the type of the decorated function. This lets us resolve additional references to decorated functions during type checking. Otherwise the type might not be available when we need ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_infer.py
20
71
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,560
is_identity_signature
def is_identity_signature(sig: Type) -> bool: """Is type a callable of form T -> T (where T is a type variable)?""" sig = get_proper_type(sig) if isinstance(sig, CallableType) and sig.arg_kinds == [ARG_POS]: if isinstance(sig.arg_types[0], TypeVarType) and isinstance(sig.ret_type, TypeVarType): ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_infer.py
74
80
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,561
calculate_return_type
def calculate_return_type(expr: Expression) -> ProperType | None: """Return the return type if we can calculate it. This only uses information available during semantic analysis so this will sometimes return None because of insufficient information (as type inference hasn't run yet). """ if isi...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_infer.py
83
104
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,562
find_fixed_callable_return
def find_fixed_callable_return(expr: Expression) -> CallableType | None: """Return the return type, if expression refers to a callable that returns a callable. But only do this if the return type has no type variables. Return None otherwise. This approximates things a lot as this is supposed to be called b...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal_infer.py
107
128
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,563
is_assumed_subtype
def is_assumed_subtype(left: Type, right: Type) -> bool: for (l, r) in reversed(TypeState._assuming): if get_proper_type(l) == get_proper_type(left) and get_proper_type( r ) == get_proper_type(right): return True return False
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
97
103
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,564
is_assumed_proper_subtype
def is_assumed_proper_subtype(left: Type, right: Type) -> bool: for (l, r) in reversed(TypeState._assuming_proper): if get_proper_type(l) == get_proper_type(left) and get_proper_type( r ) == get_proper_type(right): return True return False
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
106
112
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,565
get_assumptions
def get_assumptions(is_proper: bool) -> list[tuple[Type, Type]]: if is_proper: return TypeState._assuming_proper return TypeState._assuming
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
115
118
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,566
reset_all_subtype_caches
def reset_all_subtype_caches() -> None: """Completely reset all known subtype caches.""" TypeState._subtype_caches.clear()
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
121
123
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,567
reset_subtype_caches_for
def reset_subtype_caches_for(info: TypeInfo) -> None: """Reset subtype caches (if any) for a given supertype TypeInfo.""" if info in TypeState._subtype_caches: TypeState._subtype_caches[info].clear()
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
126
129
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,568
reset_all_subtype_caches_for
def reset_all_subtype_caches_for(info: TypeInfo) -> None: """Reset subtype caches (if any) for a given supertype TypeInfo and its MRO.""" for item in info.mro: TypeState.reset_subtype_caches_for(item)
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
132
135
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,569
is_cached_subtype_check
def is_cached_subtype_check(kind: SubtypeKind, left: Instance, right: Instance) -> bool: if left.last_known_value is not None or right.last_known_value is not None: # If there is a literal last known value, give up. There # will be an unbounded number of potential types to cache, ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
138
151
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,570
record_subtype_cache_entry
def record_subtype_cache_entry(kind: SubtypeKind, left: Instance, right: Instance) -> None: if left.last_known_value is not None or right.last_known_value is not None: # These are unlikely to match, due to the large space of # possible values. Avoid uselessly increasing cache sizes. ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
154
160
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,571
reset_protocol_deps
def reset_protocol_deps() -> None: """Reset dependencies after a full run or before a daemon shutdown.""" TypeState.proto_deps = {} TypeState._attempted_protocols.clear() TypeState._checked_against_members.clear() TypeState._rechecked_types.clear()
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
163
168
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,572
record_protocol_subtype_check
def record_protocol_subtype_check(left_type: TypeInfo, right_type: TypeInfo) -> None: assert right_type.is_protocol TypeState._rechecked_types.add(left_type) TypeState._attempted_protocols.setdefault(left_type.fullname, set()).add( right_type.fullname ) TypeState._che...
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
171
179
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,573
_snapshot_protocol_deps
def _snapshot_protocol_deps() -> dict[str, set[str]]: """Collect protocol attribute dependencies found so far from registered subtype checks. There are three kinds of protocol dependencies. For example, after a subtype check: x: Proto = C() the following dependencies will be gener...
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
182
234
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,574
update_protocol_deps
def update_protocol_deps(second_map: dict[str, set[str]] | None = None) -> None: """Update global protocol dependency map. We update the global map incrementally, using a snapshot only from recently type checked types. If second_map is given, update it as well. This is currently used by...
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
237
255
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,575
add_all_protocol_deps
def add_all_protocol_deps(deps: dict[str, set[str]]) -> None: """Add all known protocol dependencies to deps. This is used by tests and debug output, and also when collecting all collected or loaded dependencies as part of build. """ TypeState.update_protocol_deps() # just in c...
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
258
267
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,576
reset_global_state
def reset_global_state() -> None: """Reset most existing global state. Currently most of it is in this module. Few exceptions are strict optional status and and functools.lru_cache. """ TypeState.reset_all_subtype_caches() TypeState.reset_protocol_deps()
python
python-3.10.8.amd64/Lib/site-packages/mypy/typestate.py
270
277
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,577
__init__
def __init__(self, show_ids: bool = False) -> None: self.show_ids = show_ids self.id_mapper: IdMapper | None = None if show_ids: self.id_mapper = IdMapper()
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
29
33
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,578
get_id
def get_id(self, o: object) -> int | None: if self.id_mapper: return self.id_mapper.id(o) return None
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
35
38
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,579
format_id
def format_id(self, o: object) -> str: if self.id_mapper: return f"<{self.get_id(o)}>" else: return ""
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
40
44
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,580
dump
def dump(self, nodes: Sequence[object], obj: mypy.nodes.Context) -> str: """Convert a list of items to a multiline pretty-printed string. The tag is produced from the type name of obj and its line number. See mypy.util.dump_tagged for a description of the nodes argument. """ ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
46
57
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,581
func_helper
def func_helper(self, o: mypy.nodes.FuncItem) -> list[object]: """Return a list in a format suitable for dump() that represents the arguments and the body of a function. The caller can then decorate the array with information specific to methods, global functions or anonymous functions. ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
59
87
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,582
visit_mypy_file
def visit_mypy_file(self, o: mypy.nodes.MypyFile) -> str: # Skip implicit definitions. a: list[Any] = [o.defs] if o.is_bom: a.insert(0, "BOM") # Omit path to special file with name "main". This is used to simplify # test case descriptions; the file "main" is used by d...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
91
105
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,583
visit_import
def visit_import(self, o: mypy.nodes.Import) -> str: a = [] for id, as_id in o.ids: if as_id is not None: a.append(f"{id} : {as_id}") else: a.append(id) return f"Import:{o.line}({', '.join(a)})"
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
107
114
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,584
visit_import_from
def visit_import_from(self, o: mypy.nodes.ImportFrom) -> str: a = [] for name, as_name in o.names: if as_name is not None: a.append(f"{name} : {as_name}") else: a.append(name) return f"ImportFrom:{o.line}({'.' * o.relative + o.id}, [{', '.j...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
116
123
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,585
visit_import_all
def visit_import_all(self, o: mypy.nodes.ImportAll) -> str: return f"ImportAll:{o.line}({'.' * o.relative + o.id})"
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
125
126
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,586
visit_func_def
def visit_func_def(self, o: mypy.nodes.FuncDef) -> str: a = self.func_helper(o) a.insert(0, o.name) arg_kinds = {arg.kind for arg in o.arguments} if len(arg_kinds & {mypy.nodes.ARG_NAMED, mypy.nodes.ARG_NAMED_OPT}) > 0: a.insert(1, f"MaxPos({o.max_pos})") if o.abstrac...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
130
144
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,587
visit_overloaded_func_def
def visit_overloaded_func_def(self, o: mypy.nodes.OverloadedFuncDef) -> str: a: Any = o.items[:] if o.type: a.insert(0, o.type) if o.impl: a.insert(0, o.impl) if o.is_static: a.insert(-1, "Static") if o.is_class: a.insert(-1, "Class...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
146
156
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,588
visit_class_def
def visit_class_def(self, o: mypy.nodes.ClassDef) -> str: a = [o.name, o.defs.body] # Display base types unless they are implicitly just builtins.object # (in this case base_type_exprs is empty). if o.base_type_exprs: if o.info and o.info.bases: if len(o.info....
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
158
180
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,589
visit_var
def visit_var(self, o: mypy.nodes.Var) -> str: lst = "" # Add :nil line number tag if no line number is specified to remain # compatible with old test case descriptions that assume this. if o.line < 0: lst = ":nil" return "Var" + lst + "(" + o.name + ")"
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
182
188
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,590
visit_global_decl
def visit_global_decl(self, o: mypy.nodes.GlobalDecl) -> str: return self.dump([o.names], o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
190
191
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,591
visit_nonlocal_decl
def visit_nonlocal_decl(self, o: mypy.nodes.NonlocalDecl) -> str: return self.dump([o.names], o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
193
194
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,592
visit_decorator
def visit_decorator(self, o: mypy.nodes.Decorator) -> str: return self.dump([o.var, o.decorators, o.func], o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
196
197
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,593
visit_block
def visit_block(self, o: mypy.nodes.Block) -> str: return self.dump(o.body, o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
201
202
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,594
visit_expression_stmt
def visit_expression_stmt(self, o: mypy.nodes.ExpressionStmt) -> str: return self.dump([o.expr], o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
204
205
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,595
visit_assignment_stmt
def visit_assignment_stmt(self, o: mypy.nodes.AssignmentStmt) -> str: a: list[Any] = [] if len(o.lvalues) > 1: a = [("Lvalues", o.lvalues)] else: a = [o.lvalues[0]] a.append(o.rvalue) if o.type: a.append(o.type) return self.dump(a, o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
207
216
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,596
visit_operator_assignment_stmt
def visit_operator_assignment_stmt(self, o: mypy.nodes.OperatorAssignmentStmt) -> str: return self.dump([o.op, o.lvalue, o.rvalue], o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
218
219
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,597
visit_while_stmt
def visit_while_stmt(self, o: mypy.nodes.WhileStmt) -> str: a: list[Any] = [o.expr, o.body] if o.else_body: a.append(("Else", o.else_body.body)) return self.dump(a, o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
221
225
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,598
visit_for_stmt
def visit_for_stmt(self, o: mypy.nodes.ForStmt) -> str: a: list[Any] = [] if o.is_async: a.append(("Async", "")) a.append(o.index) if o.index_type: a.append(o.index_type) a.extend([o.expr, o.body]) if o.else_body: a.append(("Else", o.el...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
227
237
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,599
visit_return_stmt
def visit_return_stmt(self, o: mypy.nodes.ReturnStmt) -> str: return self.dump([o.expr], o)
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
239
240
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,600
visit_if_stmt
def visit_if_stmt(self, o: mypy.nodes.IfStmt) -> str: a: list[Any] = [] for i in range(len(o.expr)): a.append(("If", [o.expr[i]])) a.append(("Then", o.body[i].body)) if not o.else_body: return self.dump(a, o) else: return self.dump([a, ("E...
python
python-3.10.8.amd64/Lib/site-packages/mypy/strconv.py
242
251
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }