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,901
visit_del_stmt
def visit_del_stmt(self, s: DelStmt) -> None: if isinstance(s.expr, IndexExpr): e = s.expr m = MemberExpr(e.base, "__delitem__") m.line = s.line m.column = s.column c = CallExpr(m, [e.index], [nodes.ARG_POS], [None]) c.line = s.line ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,274
4,290
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,902
visit_decorator
def visit_decorator(self, e: Decorator) -> None: for d in e.decorators: if isinstance(d, RefExpr): if d.fullname == "typing.no_type_check": e.var.type = AnyType(TypeOfAny.special_form) e.var.is_ready = True return i...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,292
4,340
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,903
check_for_untyped_decorator
def check_for_untyped_decorator( self, func: FuncDef, dec_type: Type, dec_expr: Expression ) -> None: if ( self.options.disallow_untyped_decorators and is_typed_callable(func.type) and is_untyped_decorator(dec_type) ): self.msg.typed_function_u...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,342
4,350
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,904
check_incompatible_property_override
def check_incompatible_property_override(self, e: Decorator) -> None: if not e.var.is_settable_property and e.func.info: name = e.func.name for base in e.func.info.mro[1:]: base_attr = base.names.get(name) if not base_attr: continue ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,352
4,364
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,905
visit_with_stmt
def visit_with_stmt(self, s: WithStmt) -> None: exceptions_maybe_suppressed = False for expr, target in zip(s.expr, s.target): if s.is_async: exit_ret_type = self.check_async_with_item(expr, target, s.unanalyzed_type is None) else: exit_ret_type = ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,366
4,401
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,906
check_untyped_after_decorator
def check_untyped_after_decorator(self, typ: Type, func: FuncDef) -> None: if not self.options.disallow_any_decorated or self.is_stub: return if mypy.checkexpr.has_any_type(typ): self.msg.untyped_decorated_function(typ, func)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,403
4,408
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,907
check_async_with_item
def check_async_with_item( self, expr: Expression, target: Expression | None, infer_lvalue_type: bool ) -> Type: echk = self.expr_checker ctx = echk.accept(expr) obj = echk.check_method_call_by_name("__aenter__", ctx, [], [], expr)[0] obj = echk.check_awaitable_expr( ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,410
4,427
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,908
check_with_item
def check_with_item( self, expr: Expression, target: Expression | None, infer_lvalue_type: bool ) -> Type: echk = self.expr_checker ctx = echk.accept(expr) obj = echk.check_method_call_by_name("__enter__", ctx, [], [], expr)[0] if target: self.check_assignment(tar...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,429
4,441
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,909
visit_break_stmt
def visit_break_stmt(self, s: BreakStmt) -> None: self.binder.handle_break()
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,443
4,444
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,910
visit_continue_stmt
def visit_continue_stmt(self, s: ContinueStmt) -> None: self.binder.handle_continue() return None
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,446
4,448
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,911
visit_match_stmt
def visit_match_stmt(self, s: MatchStmt) -> None: with self.binder.frame_context(can_skip=False, fall_through=0): subject_type = get_proper_type(self.expr_checker.accept(s.subject)) if isinstance(subject_type, DeletedType): self.msg.deleted_as_rvalue(subject_type, s) ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,450
4,504
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,912
infer_variable_types_from_type_maps
def infer_variable_types_from_type_maps(self, type_maps: list[TypeMap]) -> dict[Var, Type]: all_captures: dict[Var, list[tuple[NameExpr, Type]]] = defaultdict(list) for tm in type_maps: if tm is not None: for expr, typ in tm.items(): if isinstance(expr, Na...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,506
4,542
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,913
remove_capture_conflicts
def remove_capture_conflicts(self, type_map: TypeMap, inferred_types: dict[Var, Type]) -> None: if type_map: for expr, typ in list(type_map.items()): if isinstance(expr, NameExpr): node = expr.node assert isinstance(node, Var) ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,544
4,551
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,914
make_fake_typeinfo
def make_fake_typeinfo( self, curr_module_fullname: str, class_gen_name: str, class_short_name: str, bases: list[Instance], ) -> tuple[ClassDef, TypeInfo]: # Build the fake ClassDef and TypeInfo together. # The ClassDef is full of lies and doesn't actually con...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,553
4,573
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,915
intersect_instances
def intersect_instances( self, instances: tuple[Instance, Instance], ctx: Context ) -> Instance | None: """Try creating an ad-hoc intersection of the given instances. Note that this function does *not* try and create a full-fledged intersection type. Instead, it returns an instance ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,575
4,657
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,916
_get_base_classes
def _get_base_classes(instances_: tuple[Instance, Instance]) -> list[Instance]: base_classes_ = [] for inst in instances_: if inst.type.is_intersection: expanded = inst.type.bases else: expanded = [inst] for...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,603
4,613
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,917
_make_fake_typeinfo_and_full_name
def _make_fake_typeinfo_and_full_name( base_classes_: list[Instance], curr_module_: MypyFile ) -> tuple[TypeInfo, str]: names_list = pretty_seq([x.type.name for x in base_classes_], "and") short_name = f"<subclass of {names_list}>" full_name_ = gen_unique_name(sho...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,615
4,624
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,918
intersect_instance_callable
def intersect_instance_callable(self, typ: Instance, callable_type: CallableType) -> Instance: """Creates a fake type that represents the intersection of an Instance and a CallableType. It operates by creating a bare-minimum dummy TypeInfo that subclasses type and adds a __call__ method matchin...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,659
4,684
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,919
make_fake_callable
def make_fake_callable(self, typ: Instance) -> Instance: """Produce a new type that makes type Callable with a generic callable type.""" fallback = self.named_type("builtins.function") callable_type = CallableType( [AnyType(TypeOfAny.explicit), AnyType(TypeOfAny.explicit)], ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,686
4,699
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,920
partition_by_callable
def partition_by_callable( self, typ: Type, unsound_partition: bool ) -> tuple[list[Type], list[Type]]: """Partitions a type into callable subtypes and uncallable subtypes. Thus, given: `callables, uncallables = partition_by_callable(type)` If we assert `callable(type)` the...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,701
4,785
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,921
conditional_callable_type_map
def conditional_callable_type_map( self, expr: Expression, current_type: Type | None ) -> tuple[TypeMap, TypeMap]: """Takes in an expression and the current type of the expression. Returns a 2-tuple: The first element is a map from the expression to the restricted type if it were ca...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,787
4,815
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,922
_is_truthy_type
def _is_truthy_type(self, t: ProperType) -> bool: return ( ( isinstance(t, Instance) and bool(t.type) and not t.type.has_readable_member("__bool__") and not t.type.has_readable_member("__len__") ) or isinstance(t...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,817
4,830
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,923
_check_for_truthy_type
def _check_for_truthy_type(self, t: Type, expr: Expression) -> None: if not state.strict_optional: return # if everything can be None, all bets are off t = get_proper_type(t) if not self._is_truthy_type(t): return def format_expr_type() -> str: typ ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,832
4,860
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,924
format_expr_type
def format_expr_type() -> str: typ = format_type(t) if isinstance(expr, MemberExpr): return f'Member "{expr.name}" has type {typ}' elif isinstance(expr, RefExpr) and expr.fullname: return f'"{expr.fullname}" has type {typ}' elif isinstance(...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,840
4,853
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,925
find_type_equals_check
def find_type_equals_check( self, node: ComparisonExpr, expr_indices: list[int] ) -> tuple[TypeMap, TypeMap]: """Narrow types based on any checks of the type ``type(x) == T`` Args: node: The node that might contain the comparison expr_indices: The list of indices of ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,862
4,938
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,926
is_type_call
def is_type_call(expr: CallExpr) -> bool: """Is expr a call to type with one argument?""" return refers_to_fullname(expr.callee, "builtins.type") and len(expr.args) == 1
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,873
4,875
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,927
combine_maps
def combine_maps(list_maps: list[TypeMap]) -> TypeMap: """Combine all typemaps in list_maps into one typemap""" result_map = {} for d in list_maps: if d is not None: result_map.update(d) return result_map
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,921
4,927
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,928
find_isinstance_check
def find_isinstance_check(self, node: Expression) -> tuple[TypeMap, TypeMap]: """Find any isinstance checks (within a chain of ands). Includes implicit and explicit checks for None and calls to callable. Also includes TypeGuard functions. Return value is a map of variables to their typ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,940
4,957
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,929
find_isinstance_check_helper
def find_isinstance_check_helper(self, node: Expression) -> tuple[TypeMap, TypeMap]: if is_true_literal(node): return {}, None if is_false_literal(node): return None, {} if isinstance(node, CallExpr) and len(node.args) != 0: expr = collapse_walrus(node.args[0...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
4,959
5,206
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,930
is_exactly_literal_type
def is_exactly_literal_type(t: Type) -> bool: return isinstance(get_proper_type(t), LiteralType)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.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,931
has_no_custom_eq_checks
def has_no_custom_eq_checks(t: Type) -> bool: return not custom_special_method( t, "__eq__", check_all=False ) and not custom_special_method(t, "__ne__", check_all=False)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,076
5,079
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,932
propagate_up_typemap_info
def propagate_up_typemap_info(self, new_types: TypeMap) -> TypeMap: """Attempts refining parent expressions of any MemberExpr or IndexExprs in new_types. Specifically, this function accepts two mappings of expression to original types: the original mapping (existing_types), and a new mapping (n...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,208
5,249
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,933
refine_parent_types
def refine_parent_types(self, expr: Expression, expr_type: Type) -> Mapping[Expression, Type]: """Checks if the given expr is a 'lookup operation' into a union and iteratively refines the parent types based on the 'expr_type'. For example, if 'expr' is an expression like 'a.b.c.d', we'll potent...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,251
5,369
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,934
replay_lookup
def replay_lookup(new_parent_type: ProperType) -> Type | None: with self.msg.filter_errors() as w: member_type = analyze_member_access( name=member_name, typ=new_parent_type, context=parent_ex...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,275
5,292
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,935
replay_lookup
def replay_lookup(new_parent_type: ProperType) -> Type | None: if not isinstance(new_parent_type, TypedDictType): return None try: assert str_literals is not None member_types = [new_paren...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,307
5,315
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,936
replay_lookup
def replay_lookup(new_parent_type: ProperType) -> Type | None: if not isinstance(new_parent_type, TupleType): return None try: assert int_literals is not None member_ty...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,321
5,329
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,937
refine_identity_comparison_expression
def refine_identity_comparison_expression( self, operands: list[Expression], operand_types: list[Type], chain_indices: list[int], narrowable_operand_indices: AbstractSet[int], is_valid_target: Callable[[ProperType], bool], coerce_only_in_literal_context: bool, ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,371
5,500
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,938
refine_away_none_in_comparison
def refine_away_none_in_comparison( self, operands: list[Expression], operand_types: list[Type], chain_indices: list[int], narrowable_operand_indices: AbstractSet[int], ) -> tuple[TypeMap, TypeMap]: """Produces conditional type maps refining away None in an identity/e...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,502
5,532
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,939
check_subtype
def check_subtype( self, subtype: Type, supertype: Type, context: Context, msg: str | ErrorMessage = message_registry.INCOMPATIBLE_TYPES, subtype_label: str | None = None, supertype_label: str | None = None, *, code: ErrorCode | None = None, ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,538
5,608
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,940
get_precise_awaitable_type
def get_precise_awaitable_type(self, typ: Type, local_errors: ErrorWatcher) -> Type | None: """If type implements Awaitable[X] with non-Any X, return X. In all other cases return None. This method must be called in context of local_errors. """ if isinstance(get_proper_type(typ),...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,610
5,630
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,941
checking_await_set
def checking_await_set(self) -> Iterator[None]: self.checking_missing_await = True try: yield finally: self.checking_missing_await = False
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,633
5,638
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,942
check_possible_missing_await
def check_possible_missing_await( self, subtype: Type, supertype: Type, context: Context ) -> None: """Check if the given type becomes a subtype when awaited.""" if self.checking_missing_await: # Avoid infinite recursion. return with self.checking_await_set(),...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,640
5,653
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,943
contains_none
def contains_none(self, t: Type) -> bool: t = get_proper_type(t) return ( isinstance(t, NoneType) or (isinstance(t, UnionType) and any(self.contains_none(ut) for ut in t.items)) or (isinstance(t, TupleType) and any(self.contains_none(tt) for tt in t.items)) ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,655
5,666
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,944
should_suppress_optional_error
def should_suppress_optional_error(self, related_types: list[Type]) -> bool: return self.suppress_none_errors and any(self.contains_none(t) for t in related_types)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,668
5,669
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,945
named_type
def named_type(self, name: str) -> Instance: """Return an instance type with given name and implicit Any type args. For example, named_type('builtins.object') produces the 'object' type. """ # Assume that the name refers to a type. sym = self.lookup_qualified(name) node ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,671
5,684
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,946
named_generic_type
def named_generic_type(self, name: str, args: list[Type]) -> Instance: """Return an instance with the given name and type arguments. Assume that the number of arguments is correct. Assume that the name refers to a compatible generic type. """ info = self.lookup_typeinfo(name) ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,686
5,695
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,947
lookup_typeinfo
def lookup_typeinfo(self, fullname: str) -> TypeInfo: # Assume that the name refers to a class. sym = self.lookup_qualified(fullname) node = sym.node assert isinstance(node, TypeInfo) return node
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,697
5,702
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,948
type_type
def type_type(self) -> Instance: """Return instance type 'type'.""" return self.named_type("builtins.type")
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,704
5,706
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,949
str_type
def str_type(self) -> Instance: """Return instance type 'str'.""" return self.named_type("builtins.str")
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,708
5,710
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,950
store_type
def store_type(self, node: Expression, typ: Type) -> None: """Store the type of a node in the type map.""" self._type_maps[-1][node] = typ
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,712
5,714
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,951
has_type
def has_type(self, node: Expression) -> bool: for m in reversed(self._type_maps): if node in m: return True return False
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,716
5,720
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,952
lookup_type_or_none
def lookup_type_or_none(self, node: Expression) -> Type | None: for m in reversed(self._type_maps): if node in m: return m[node] return None
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,722
5,726
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,953
lookup_type
def lookup_type(self, node: Expression) -> Type: for m in reversed(self._type_maps): t = m.get(node) if t is not None: return t raise KeyError(node)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,728
5,733
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,954
store_types
def store_types(self, d: dict[Expression, Type]) -> None: self._type_maps[-1].update(d)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,735
5,736
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,955
local_type_map
def local_type_map(self) -> Iterator[dict[Expression, Type]]: """Store inferred types into a temporary type map (returned). This can be used to perform type checking "experiments" without affecting exported types (which are used by mypyc). """ temp_type_map: dict[Expression, Typ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,739
5,748
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,956
in_checked_function
def in_checked_function(self) -> bool: """Should we type-check the current function? - Yes if --check-untyped-defs is set. - Yes outside functions. - Yes in annotated functions. - No otherwise. """ return ( self.options.check_untyped_defs or not self....
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,750
5,760
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,957
lookup
def lookup(self, name: str) -> SymbolTableNode: """Look up a definition from the symbol table with the given name.""" if name in self.globals: return self.globals[name] else: b = self.globals.get("__builtins__", None) if b: table = cast(MypyFil...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,762
5,772
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,958
lookup_qualified
def lookup_qualified(self, name: str) -> SymbolTableNode: if "." not in name: return self.lookup(name) else: parts = name.split(".") n = self.modules[parts[0]] for i in range(1, len(parts) - 1): sym = n.names.get(parts[i]) a...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,774
5,802
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,959
enter_partial_types
def enter_partial_types( self, *, is_function: bool = False, is_class: bool = False ) -> Iterator[None]: """Enter a new scope for collecting partial types. Also report errors for (some) variables which still have partial types, i.e. we couldn't infer a complete type. """ ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,805
5,857
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,960
handle_partial_var_type
def handle_partial_var_type( self, typ: PartialType, is_lvalue: bool, node: Var, context: Context ) -> Type: """Handle a reference to a partial type through a var. (Used by checkexpr and checkmember.) """ in_scope, is_local, partial_types = self.find_partial_types_in_all_sco...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,859
5,886
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,961
fixup_partial_type
def fixup_partial_type(self, typ: Type) -> Type: """Convert a partial type that we couldn't resolve into something concrete. This means, for None we make it Optional[Any], and for anything else we fill in all of the type arguments with Any. """ if not isinstance(typ, PartialType...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,888
5,899
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,962
is_defined_in_base_class
def is_defined_in_base_class(self, var: Var) -> bool: if var.info: for base in var.info.mro[1:]: if base.get(var.name) is not None: return True if var.info.fallback_to_any: return True return False
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,901
5,908
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,963
find_partial_types
def find_partial_types(self, var: Var) -> dict[Var, Context] | None: """Look for an active partial type scope containing variable. A scope is active if assignments in the current context can refine a partial type originally defined in the scope. This is affected by the local_partial_types ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,910
5,920
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,964
find_partial_types_in_all_scopes
def find_partial_types_in_all_scopes( self, var: Var ) -> tuple[bool, bool, dict[Var, Context] | None]: """Look for partial type scope containing variable. Return tuple (is the scope active, is the scope a local scope, scope). """ for scope in reversed(self.partial_types): ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,922
5,945
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,965
temp_node
def temp_node(self, t: Type, context: Context | None = None) -> TempNode: """Create a temporary node with the given, fixed type.""" return TempNode(t, context=context)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,947
5,949
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,966
fail
def fail( self, msg: str | ErrorMessage, context: Context, *, code: ErrorCode | None = None ) -> None: """Produce an error message.""" if isinstance(msg, ErrorMessage): self.msg.fail(msg.value, context, code=msg.code) return self.msg.fail(msg, context, code=co...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,951
5,958
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,967
note
def note( self, msg: str, context: Context, offset: int = 0, *, code: ErrorCode | None = None ) -> None: """Produce a note.""" self.msg.note(msg, context, offset=offset, code=code)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,960
5,964
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,968
iterable_item_type
def iterable_item_type(self, instance: Instance) -> Type: iterable = map_instance_to_supertype(instance, self.lookup_typeinfo("typing.Iterable")) item_type = iterable.args[0] if not isinstance(get_proper_type(item_type), AnyType): # This relies on 'map_instance_to_supertype' returnin...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,966
5,982
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,969
function_type
def function_type(self, func: FuncBase) -> FunctionLike: return function_type(func, self.named_type("builtins.function"))
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,984
5,985
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,970
push_type_map
def push_type_map(self, type_map: TypeMap) -> None: if type_map is None: self.binder.unreachable() else: for expr, type in type_map.items(): self.binder.put(expr, type)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,987
5,992
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,971
infer_issubclass_maps
def infer_issubclass_maps(self, node: CallExpr, expr: Expression) -> tuple[TypeMap, TypeMap]: """Infer type restrictions for an expression in issubclass call.""" vartype = self.lookup_type(expr) type = self.get_isinstance_type(node.args[1]) if isinstance(vartype, TypeVarType): ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
5,994
6,022
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,972
conditional_types_with_intersection
def conditional_types_with_intersection( self, expr_type: Type, type_ranges: list[TypeRange] | None, ctx: Context, default: None = None, ) -> tuple[Type | None, Type | None]: ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,025
6,032
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,973
conditional_types_with_intersection
def conditional_types_with_intersection( self, expr_type: Type, type_ranges: list[TypeRange] | None, ctx: Context, default: Type ) -> tuple[Type, Type]: ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,035
6,038
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,974
conditional_types_with_intersection
def conditional_types_with_intersection( self, expr_type: Type, type_ranges: list[TypeRange] | None, ctx: Context, default: Type | None = None, ) -> tuple[Type | None, Type | None]: initial_types = conditional_types(expr_type, type_ranges, default) # For some ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,040
6,085
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,975
is_writable_attribute
def is_writable_attribute(self, node: Node) -> bool: """Check if an attribute is writable""" if isinstance(node, Var): return True elif isinstance(node, OverloadedFuncDef) and node.is_property: first_item = cast(Decorator, node.items[0]) return first_item.var....
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,087
6,095
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,976
get_isinstance_type
def get_isinstance_type(self, expr: Expression) -> list[TypeRange] | None: if isinstance(expr, OpExpr) and expr.op == "|": left = self.get_isinstance_type(expr.left) right = self.get_isinstance_type(expr.right) if left is None or right is None: return None ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,097
6,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,977
is_literal_enum
def is_literal_enum(self, n: Expression) -> bool: """Returns true if this expression (with the given type context) is an Enum literal. For example, if we had an enum: class Foo(Enum): A = 1 B = 2 ...and if the expression 'Foo' referred to that enum ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,130
6,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,978
__init__
def __init__(self) -> None: self.arg_types: set[TypeVarType] = set()
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,172
6,173
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,979
visit_type_var
def visit_type_var(self, t: TypeVarType) -> None: self.arg_types.add(t)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,175
6,176
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,980
conditional_types
def conditional_types( current_type: Type, proposed_type_ranges: list[TypeRange] | None, default: None = None ) -> tuple[Type | None, Type | None]: ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,180
6,183
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,981
conditional_types
def conditional_types( current_type: Type, proposed_type_ranges: list[TypeRange] | None, default: Type ) -> tuple[Type, Type]: ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,187
6,190
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,982
conditional_types
def conditional_types( current_type: Type, proposed_type_ranges: list[TypeRange] | None, default: Type | None = None ) -> tuple[Type | None, Type | None]: """Takes in the current type and a proposed type of an expression. Returns a 2-tuple: The first element is the proposed type, if the expression can ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,193
6,242
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,983
conditional_types_to_typemaps
def conditional_types_to_typemaps( expr: Expression, yes_type: Type | None, no_type: Type | None ) -> tuple[TypeMap, TypeMap]: maps: list[TypeMap] = [] for typ in (yes_type, no_type): proper_type = get_proper_type(typ) if isinstance(proper_type, UninhabitedType): maps.append(None...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,245
6,259
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,984
gen_unique_name
def gen_unique_name(base: str, table: SymbolTable) -> str: """Generate a name that does not appear in table by appending numbers to base.""" if base not in table: return base i = 1 while base + str(i) in table: i += 1 return base + str(i)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,262
6,269
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,985
is_true_literal
def is_true_literal(n: Expression) -> bool: """Returns true if this expression is the 'True' literal/keyword.""" return refers_to_fullname(n, "builtins.True") or isinstance(n, IntExpr) and n.value != 0
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,272
6,274
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,986
is_false_literal
def is_false_literal(n: Expression) -> bool: """Returns true if this expression is the 'False' literal/keyword.""" return refers_to_fullname(n, "builtins.False") or isinstance(n, IntExpr) and n.value == 0
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,277
6,279
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,987
is_literal_none
def is_literal_none(n: Expression) -> bool: """Returns true if this expression is the 'None' literal/keyword.""" return isinstance(n, NameExpr) and n.fullname == "builtins.None"
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,282
6,284
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,988
is_literal_not_implemented
def is_literal_not_implemented(n: Expression) -> bool: return isinstance(n, NameExpr) and n.fullname == "builtins.NotImplemented"
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,287
6,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,989
builtin_item_type
def builtin_item_type(tp: Type) -> Type | None: """Get the item type of a builtin container. If 'tp' is not one of the built containers (these includes NamedTuple and TypedDict) or if the container is not parameterized (like List or List[Any]) return None. This function is used to narrow optional types...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,291
6,331
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,990
and_conditional_maps
def and_conditional_maps(m1: TypeMap, m2: TypeMap) -> TypeMap: """Calculate what information we can learn from the truth of (e1 and e2) in terms of the information that we can learn from the truth of e1 and the truth of e2. """ if m1 is None or m2 is None: # One of the conditions can never ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,334
6,353
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,991
or_conditional_maps
def or_conditional_maps(m1: TypeMap, m2: TypeMap) -> TypeMap: """Calculate what information we can learn from the truth of (e1 or e2) in terms of the information that we can learn from the truth of e1 and the truth of e2. """ if m1 is None: return m2 if m2 is None: return m1 ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,356
6,375
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,992
reduce_conditional_maps
def reduce_conditional_maps(type_maps: list[tuple[TypeMap, TypeMap]]) -> tuple[TypeMap, TypeMap]: """Reduces a list containing pairs of if/else TypeMaps into a single pair. We "and" together all of the if TypeMaps and "or" together the else TypeMaps. So for example, if we had the input: [ ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,378
6,412
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,993
convert_to_typetype
def convert_to_typetype(type_map: TypeMap) -> TypeMap: converted_type_map: dict[Expression, Type] = {} if type_map is None: return None for expr, typ in type_map.items(): t = typ if isinstance(t, TypeVarType): t = t.upper_bound # TODO: should we only allow unions ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,415
6,428
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,994
flatten
def flatten(t: Expression) -> list[Expression]: """Flatten a nested sequence of tuples/lists into one list of nodes.""" if isinstance(t, TupleExpr) or isinstance(t, ListExpr): return [b for a in t.items for b in flatten(a)] elif isinstance(t, StarExpr): return flatten(t.expr) else: ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,431
6,438
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,995
flatten_types
def flatten_types(t: Type) -> list[Type]: """Flatten a nested sequence of tuples into one list of nodes.""" t = get_proper_type(t) if isinstance(t, TupleType): return [b for a in t.items for b in flatten_types(a)] else: return [t]
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,441
6,447
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,996
expand_func
def expand_func(defn: FuncItem, map: dict[TypeVarId, Type]) -> FuncItem: visitor = TypeTransformVisitor(map) ret = visitor.node(defn) assert isinstance(ret, FuncItem) return ret
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,450
6,454
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,997
__init__
def __init__(self, map: dict[TypeVarId, Type]) -> None: super().__init__() self.map = map
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,458
6,460
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,998
type
def type(self, type: Type) -> Type: return expand_type(type, self.map)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,462
6,463
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,067,999
are_argument_counts_overlapping
def are_argument_counts_overlapping(t: CallableType, s: CallableType) -> bool: """Can a single call match both t and s, based just on positional argument counts?""" min_args = max(t.min_args, s.min_args) max_args = min(t.max_possible_positional_args(), s.max_possible_positional_args()) return min_args <...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,466
6,470
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,000
is_unsafe_overlapping_overload_signatures
def is_unsafe_overlapping_overload_signatures( signature: CallableType, other: CallableType ) -> bool: """Check if two overloaded signatures are unsafely overlapping or partially overlapping. We consider two functions 's' and 't' to be unsafely overlapping if both of the following are true: 1. s'...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,473
6,522
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }