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,401 | erased_signature_similarity | def erased_signature_similarity(
self,
arg_types: list[Type],
arg_kinds: list[ArgKind],
arg_names: Sequence[str | None] | None,
args: list[Expression],
callee: CallableType,
context: Context,
) -> bool:
"""Determine whether arguments could match the si... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,530 | 2,581 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,402 | check_arg | def check_arg(
caller_type: Type,
original_ccaller_type: Type,
caller_kind: ArgKind,
callee_type: Type,
n: int,
m: int,
callee: CallableType,
object_type: Type | None,
context: Context,
outer_context:... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,552 | 2,567 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,403 | apply_generic_arguments | def apply_generic_arguments(
self,
callable: CallableType,
types: Sequence[Type | None],
context: Context,
skip_unsatisfied: bool = False,
) -> CallableType:
"""Simple wrapper around mypy.applytype.apply_generic_arguments."""
return applytype.apply_generic_arg... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,583 | 2,597 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,404 | check_any_type_call | def check_any_type_call(self, args: list[Expression], callee: Type) -> tuple[Type, Type]:
self.infer_arg_types_in_empty_context(args)
callee = get_proper_type(callee)
if isinstance(callee, AnyType):
return (
AnyType(TypeOfAny.from_another_any, source_any=callee),
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,599 | 2,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,405 | check_union_call | def check_union_call(
self,
callee: UnionType,
args: list[Expression],
arg_kinds: list[ArgKind],
arg_names: Sequence[str | None] | None,
context: Context,
) -> tuple[Type, Type]:
with self.msg.disable_type_names():
results = [
self.... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,610 | 2,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,406 | visit_member_expr | def visit_member_expr(self, e: MemberExpr, is_lvalue: bool = False) -> Type:
"""Visit member expression (of form e.id)."""
self.chk.module_refs.update(extract_refexpr_names(e))
result = self.analyze_ordinary_member_access(e, is_lvalue)
return self.narrow_type_from_binder(e, result) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,626 | 2,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,407 | analyze_ordinary_member_access | def analyze_ordinary_member_access(self, e: MemberExpr, is_lvalue: bool) -> Type:
"""Analyse member expression or member lvalue."""
if e.kind is not None:
# This is a reference to a module attribute.
return self.analyze_ref_expr(e)
else:
# This is a reference ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,632 | 2,660 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,408 | analyze_external_member_access | def analyze_external_member_access(
self, member: str, base_type: Type, context: Context
) -> Type:
"""Analyse member access that is external, i.e. it cannot
refer to private definitions. Return the result type.
"""
# TODO remove; no private definitions in mypy
return... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,662 | 2,680 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,409 | is_literal_context | def is_literal_context(self) -> bool:
return is_literal_type_like(self.type_context[-1]) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,682 | 2,683 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,410 | infer_literal_expr_type | def infer_literal_expr_type(self, value: LiteralValue, fallback_name: str) -> Type:
"""Analyzes the given literal expression and determines if we should be
inferring an Instance type, a Literal[...] type, or an Instance that
remembers the original literal. We...
1. ...Infer a normal Ins... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,685 | 2,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,411 | concat_tuples | def concat_tuples(self, left: TupleType, right: TupleType) -> TupleType:
"""Concatenate two fixed length tuples."""
return TupleType(
items=left.items + right.items, fallback=self.named_type("builtins.tuple")
) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,712 | 2,716 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,412 | visit_int_expr | def visit_int_expr(self, e: IntExpr) -> Type:
"""Type check an integer literal (trivial)."""
return self.infer_literal_expr_type(e.value, "builtins.int") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,718 | 2,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,413 | visit_str_expr | def visit_str_expr(self, e: StrExpr) -> Type:
"""Type check a string literal (trivial)."""
return self.infer_literal_expr_type(e.value, "builtins.str") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,722 | 2,724 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,414 | visit_bytes_expr | def visit_bytes_expr(self, e: BytesExpr) -> Type:
"""Type check a bytes literal (trivial)."""
return self.infer_literal_expr_type(e.value, "builtins.bytes") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,726 | 2,728 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,415 | visit_float_expr | def visit_float_expr(self, e: FloatExpr) -> Type:
"""Type check a float literal (trivial)."""
return self.named_type("builtins.float") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,730 | 2,732 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,416 | visit_complex_expr | def visit_complex_expr(self, e: ComplexExpr) -> Type:
"""Type check a complex literal."""
return self.named_type("builtins.complex") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,734 | 2,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,417 | visit_ellipsis | def visit_ellipsis(self, e: EllipsisExpr) -> Type:
"""Type check '...'."""
return self.named_type("builtins.ellipsis") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,738 | 2,740 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,418 | visit_op_expr | def visit_op_expr(self, e: OpExpr) -> Type:
"""Type check a binary operator expression."""
if e.op == "and" or e.op == "or":
return self.check_boolean_op(e, e)
if e.op == "*" and isinstance(e.left, ListExpr):
# Expressions of form [...] * e get special type inference.
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,742 | 2,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,419 | visit_comparison_expr | def visit_comparison_expr(self, e: ComparisonExpr) -> Type:
"""Type check a comparison expression.
Comparison expressions are type checked consecutive-pair-wise
That is, 'a < b > c == d' is check as 'a < b and b > c and c == d'
"""
result: Type | None = None
sub_result: ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,774 | 2,890 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,420 | find_partial_type_ref_fast_path | def find_partial_type_ref_fast_path(self, expr: Expression) -> Type | None:
"""If expression has a partial generic type, return it without additional checks.
In particular, this does not generate an error about a missing annotation.
Otherwise, return None.
"""
if not isinstance... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,892 | 2,906 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,421 | dangerous_comparison | def dangerous_comparison(
self, left: Type, right: Type, original_container: Type | None = None
) -> bool:
"""Check for dangerous non-overlapping comparisons like 42 == 'no'.
The original_container is the original container type for 'in' checks
(and None for equality checks).
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,908 | 2,973 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,422 | check_method_call_by_name | def check_method_call_by_name(
self,
method: str,
base_type: Type,
args: list[Expression],
arg_kinds: list[ArgKind],
context: Context,
original_type: Type | None = None,
) -> tuple[Type, Type]:
"""Type check a call to a named method on an object.
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 2,975 | 3,009 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,423 | check_union_method_call_by_name | def check_union_method_call_by_name(
self,
method: str,
base_type: UnionType,
args: list[Expression],
arg_kinds: list[ArgKind],
context: Context,
original_type: Type | None = None,
) -> tuple[Type, Type]:
"""Type check a call to a named method on an ob... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,011 | 3,037 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,424 | check_method_call | def check_method_call(
self,
method_name: str,
base_type: Type,
method_type: Type,
args: list[Expression],
arg_kinds: list[ArgKind],
context: Context,
) -> tuple[Type, Type]:
"""Type check a call to a method with the given name and type on an object.
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,039 | 3,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,425 | check_op_reversible | def check_op_reversible(
self,
op_name: str,
left_type: Type,
left_expr: Expression,
right_type: Type,
right_expr: Expression,
context: Context,
) -> tuple[Type, Type]:
def lookup_operator(op_name: str, base_type: Type) -> Type | None:
"""L... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,069 | 3,244 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,426 | lookup_operator | def lookup_operator(op_name: str, base_type: Type) -> Type | None:
"""Looks up the given operator and returns the corresponding type,
if it exists."""
# This check is an important performance optimization,
# even though it is mostly a subset of
# analyze_memb... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,078 | 3,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,427 | lookup_definer | def lookup_definer(typ: Instance, attr_name: str) -> str | None:
"""Returns the name of the class that contains the actual definition of attr_name.
So if class A defines foo and class B subclasses A, running
'get_class_defined_in(B, "foo")` would return the full name of A.
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,104 | 3,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,428 | check_op | def check_op(
self,
method: str,
base_type: Type,
arg: Expression,
context: Context,
allow_reverse: bool = False,
) -> tuple[Type, Type]:
"""Type check a binary operation which maps to a method call.
Return tuple (result type, inferred operator method... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,246 | 3,357 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,429 | check_boolean_op | def check_boolean_op(self, e: OpExpr, context: Context) -> Type:
"""Type check a boolean operation ('and' or 'or')."""
# A boolean operation can evaluate to either of the operands.
# We use the current type context to guide the type inference of of
# the left operand. We also use the l... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,359 | 3,435 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,430 | check_list_multiply | def check_list_multiply(self, e: OpExpr) -> Type:
"""Type check an expression of form '[...] * e'.
Type inference is special-cased for this common construct.
"""
right_type = self.accept(e.right)
if is_subtype(right_type, self.named_type("builtins.int")):
# Special c... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,437 | 3,451 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,431 | visit_assignment_expr | def visit_assignment_expr(self, e: AssignmentExpr) -> Type:
value = self.accept(e.value)
self.chk.check_assignment(e.target, e.value)
self.chk.check_final(e)
self.chk.store_type(e.target, value)
self.find_partial_type_ref_fast_path(e.target)
return value | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,453 | 3,459 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,432 | visit_unary_expr | def visit_unary_expr(self, e: UnaryExpr) -> Type:
"""Type check an unary operation ('not', '-', '+' or '~')."""
operand_type = self.accept(e.expr)
op = e.op
if op == "not":
result: Type = self.bool_type()
else:
method = operators.unary_op_methods[op]
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,461 | 3,471 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,433 | visit_index_expr | def visit_index_expr(self, e: IndexExpr) -> Type:
"""Type check an index expression (base[index]).
It may also represent type application.
"""
result = self.visit_index_expr_helper(e)
result = self.narrow_type_from_binder(e, result)
p_result = get_proper_type(result)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,473 | 3,487 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,434 | visit_index_expr_helper | def visit_index_expr_helper(self, e: IndexExpr) -> Type:
if e.analyzed:
# It's actually a type application.
return self.accept(e.analyzed)
left_type = self.accept(e.base)
return self.visit_index_with_type(left_type, e) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,489 | 3,494 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,435 | visit_index_with_type | def visit_index_with_type(
self, left_type: Type, e: IndexExpr, original_type: ProperType | None = None
) -> Type:
"""Analyze type of an index expression for a given type of base expression.
The 'original_type' is used for error messages (currently used for union types).
"""
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,496 | 3,556 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,436 | visit_tuple_slice_helper | def visit_tuple_slice_helper(self, left_type: TupleType, slic: SliceExpr) -> Type:
begin: Sequence[int | None] = [None]
end: Sequence[int | None] = [None]
stride: Sequence[int | None] = [None]
if slic.begin_index:
begin_raw = self.try_getting_int_literals(slic.begin_index)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,558 | 3,584 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,437 | try_getting_int_literals | def try_getting_int_literals(self, index: Expression) -> list[int] | None:
"""If the given expression or type corresponds to an int literal
or a union of int literals, returns a list of the underlying ints.
Otherwise, returns None.
Specifically, this function is guaranteed to return a l... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,586 | 3,618 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,438 | nonliteral_tuple_index_helper | def nonliteral_tuple_index_helper(self, left_type: TupleType, index: Expression) -> Type:
self.check_method_call_by_name("__getitem__", left_type, [index], [ARG_POS], context=index)
# We could return the return type from above, but unions are often better than the join
union = make_simplified_un... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,620 | 3,626 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,439 | visit_typeddict_index_expr | def visit_typeddict_index_expr(self, td_type: TypedDictType, index: Expression) -> Type:
if isinstance(index, StrExpr):
key_names = [index.value]
else:
typ = get_proper_type(self.accept(index))
if isinstance(typ, UnionType):
key_types: list[Type] = lis... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,628 | 3,661 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,440 | visit_enum_index_expr | def visit_enum_index_expr(
self, enum_type: TypeInfo, index: Expression, context: Context
) -> Type:
string_type: Type = self.named_type("builtins.str")
self.chk.check_subtype(
self.accept(index),
string_type,
context,
"Enum index should be a s... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,663 | 3,674 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,441 | visit_cast_expr | def visit_cast_expr(self, expr: CastExpr) -> Type:
"""Type check a cast expression."""
source_type = self.accept(
expr.expr,
type_context=AnyType(TypeOfAny.special_form),
allow_none_return=True,
always_allow_any=True,
)
target_type = expr.t... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,676 | 3,697 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,442 | visit_assert_type_expr | def visit_assert_type_expr(self, expr: AssertTypeExpr) -> Type:
source_type = self.accept(
expr.expr,
type_context=self.type_context[-1],
allow_none_return=True,
always_allow_any=True,
)
target_type = expr.type
if not is_same_type(source_ty... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,699 | 3,709 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,443 | visit_reveal_expr | def visit_reveal_expr(self, expr: RevealExpr) -> Type:
"""Type check a reveal_type expression."""
if expr.kind == REVEAL_TYPE:
assert expr.expr is not None
revealed_type = self.accept(
expr.expr, type_context=self.type_context[-1], allow_none_return=True
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,711 | 3,738 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,444 | visit_type_application | def visit_type_application(self, tapp: TypeApplication) -> Type:
"""Type check a type application (expr[type, ...]).
There are two different options here, depending on whether expr refers
to a type alias or directly to a generic class. In the first case we need
to use a dedicated functi... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,740 | 3,776 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,445 | visit_type_alias_expr | def visit_type_alias_expr(self, alias: TypeAliasExpr) -> Type:
"""Right hand side of a type alias definition.
It has the same type as if the alias itself was used in a runtime context.
For example, here:
A = reveal_type(List[T])
reveal_type(A)
both `reveal_type... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,778 | 3,792 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,446 | alias_type_in_runtime_context | def alias_type_in_runtime_context(
self, alias: TypeAlias, no_args: bool, ctx: Context, *, alias_definition: bool = False
) -> Type:
"""Get type of a type alias (could be generic) in a runtime expression.
Note that this function can be called only if the alias appears _not_
as a tar... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,794 | 3,845 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,447 | apply_type_arguments_to_callable | def apply_type_arguments_to_callable(
self, tp: Type, args: Sequence[Type], ctx: Context
) -> Type:
"""Apply type arguments to a generic callable type coming from a type object.
This will first perform type arguments count checks, report the
error as needed, and return the correct k... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,847 | 3,870 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,448 | visit_list_expr | def visit_list_expr(self, e: ListExpr) -> Type:
"""Type check a list expression [...]."""
return self.check_lst_expr(e, "builtins.list", "<list>") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,872 | 3,874 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,449 | visit_set_expr | def visit_set_expr(self, e: SetExpr) -> Type:
return self.check_lst_expr(e, "builtins.set", "<set>") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,876 | 3,877 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,450 | fast_container_type | def fast_container_type(
self, e: ListExpr | SetExpr | TupleExpr, container_fullname: str
) -> Type | None:
"""
Fast path to determine the type of a list or set literal,
based on the list of entries. This mostly impacts large
module-level constant definitions.
Limita... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,879 | 3,911 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,451 | check_lst_expr | def check_lst_expr(self, e: ListExpr | SetExpr | TupleExpr, fullname: str, tag: str) -> Type:
# fast path
t = self.fast_container_type(e, fullname)
if t:
return t
# Translate into type checking a generic function call.
# Used for list and set expressions, as well as ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,913 | 3,939 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,452 | visit_tuple_expr | def visit_tuple_expr(self, e: TupleExpr) -> Type:
"""Type check a tuple expression."""
# Try to determine type context for type inference.
type_context = get_proper_type(self.type_context[-1])
type_context_items = None
if isinstance(type_context, UnionType):
tuples_in... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 3,941 | 4,001 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,453 | fast_dict_type | def fast_dict_type(self, e: DictExpr) -> Type | None:
"""
Fast path to determine the type of a dict literal,
based on the list of entries. This mostly impacts large
module-level constant definitions.
Limitations:
- no active type context
- only supported star e... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,003 | 4,048 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,454 | visit_dict_expr | def visit_dict_expr(self, e: DictExpr) -> Type:
"""Type check a dict expression.
Translate it into a call to dict(), with provisions for **expr.
"""
# if the dict literal doesn't match TypedDict, check_typeddict_call_with_dict reports
# an error, but returns the TypedDict type t... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,050 | 4,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,455 | find_typeddict_context | def find_typeddict_context(
self, context: Type | None, dict_expr: DictExpr
) -> TypedDictType | None:
context = get_proper_type(context)
if isinstance(context, TypedDictType):
return context
elif isinstance(context, UnionType):
items = []
for item... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,131 | 4,152 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,456 | visit_lambda_expr | def visit_lambda_expr(self, e: LambdaExpr) -> Type:
"""Type check lambda expression."""
self.chk.check_default_args(e, body_is_trivial=False)
inferred_type, type_override = self.infer_lambda_type_using_context(e)
if not inferred_type:
self.chk.return_types.append(AnyType(Type... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,154 | 4,184 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,457 | infer_lambda_type_using_context | def infer_lambda_type_using_context(
self, e: LambdaExpr
) -> tuple[CallableType | None, CallableType | None]:
"""Try to infer lambda expression type using context.
Return None if could not infer type.
The second item in the return type is the type_override parameter for check_func_... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,186 | 4,241 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,458 | visit_super_expr | def visit_super_expr(self, e: SuperExpr) -> Type:
"""Type check a super expression (non-lvalue)."""
# We have an expression like super(T, var).member
# First compute the types of T and var
types = self._super_arg_types(e)
if isinstance(types, tuple):
type_type, inst... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,243 | 4,301 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,459 | _super_arg_types | def _super_arg_types(self, e: SuperExpr) -> Type | tuple[Type, Type]:
"""
Computes the types of the type and instance expressions in super(T, instance), or the
implicit ones for zero-argument super() expressions. Returns a single type for the whole
super expression when possible (for er... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,303 | 4,383 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,460 | visit_slice_expr | def visit_slice_expr(self, e: SliceExpr) -> Type:
expected = make_optional_type(self.named_type("builtins.int"))
for index in [e.begin_index, e.end_index, e.stride]:
if index:
t = self.accept(index)
self.chk.check_subtype(t, expected, index, message_registry.I... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,385 | 4,391 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,461 | visit_list_comprehension | def visit_list_comprehension(self, e: ListComprehension) -> Type:
return self.check_generator_or_comprehension(
e.generator, "builtins.list", "<list-comprehension>"
) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,393 | 4,396 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,462 | visit_set_comprehension | def visit_set_comprehension(self, e: SetComprehension) -> Type:
return self.check_generator_or_comprehension(
e.generator, "builtins.set", "<set-comprehension>"
) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,398 | 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,463 | visit_generator_expr | def visit_generator_expr(self, e: GeneratorExpr) -> Type:
# If any of the comprehensions use async for, the expression will return an async generator
# object, or if the left-side expression uses await.
if any(e.is_async) or has_await_expression(e.left_expr):
typ = "typing.AsyncGener... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,403 | 4,416 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,464 | check_generator_or_comprehension | def check_generator_or_comprehension(
self,
gen: GeneratorExpr,
type_name: str,
id_for_messages: str,
additional_args: list[Type] | None = None,
) -> Type:
"""Type check a generator expression or a list comprehension."""
additional_args = additional_args or []... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,418 | 4,443 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,465 | visit_dictionary_comprehension | def visit_dictionary_comprehension(self, e: DictionaryComprehension) -> Type:
"""Type check a dictionary comprehension."""
with self.chk.binder.frame_context(can_skip=True, fall_through=0):
self.check_for_comp(e)
# Infer the type of the list comprehension by using a synthetic ge... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,445 | 4,465 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,466 | check_for_comp | def check_for_comp(self, e: GeneratorExpr | DictionaryComprehension) -> None:
"""Check the for_comp part of comprehensions. That is the part from 'for':
... for x in y if z
Note: This adds the type information derived from the condlists to the current binder.
"""
for index, sequ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,467 | 4,494 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,467 | visit_conditional_expr | def visit_conditional_expr(self, e: ConditionalExpr, allow_none_return: bool = False) -> Type:
self.accept(e.cond)
ctx = self.type_context[-1]
# Gain type information from isinstance if it is there
# but only for the current expression
if_map, else_map = self.chk.find_isinstance... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,496 | 4,570 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,468 | analyze_cond_branch | def analyze_cond_branch(
self,
map: dict[Expression, Type] | None,
node: Expression,
context: Type | None,
allow_none_return: bool = False,
) -> Type:
with self.chk.binder.frame_context(can_skip=True, fall_through=0):
if map is None:
# We s... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,572 | 4,586 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,469 | accept | def accept(
self,
node: Expression,
type_context: Type | None = None,
allow_none_return: bool = False,
always_allow_any: bool = False,
is_callee: bool = False,
) -> Type:
"""Type check a node in the given type context. If allow_none_return
is True and... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,592 | 4,642 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,470 | named_type | def named_type(self, name: str) -> Instance:
"""Return an instance type with type given by the name and no type
arguments. Alias for TypeChecker.named_type.
"""
return self.chk.named_type(name) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,644 | 4,648 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,471 | is_valid_var_arg | def is_valid_var_arg(self, typ: Type) -> bool:
"""Is a type valid as a *args argument?"""
typ = get_proper_type(typ)
return (
isinstance(typ, TupleType)
or is_subtype(
typ,
self.chk.named_generic_type("typing.Iterable", [AnyType(TypeOfAny.s... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,650 | 4,661 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,472 | is_valid_keyword_var_arg | def is_valid_keyword_var_arg(self, typ: Type) -> bool:
"""Is a type valid as a **kwargs argument?"""
return (
is_subtype(
typ,
self.chk.named_generic_type(
"typing.Mapping",
[self.named_type("builtins.str"), AnyType(Type... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,663 | 4,680 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,473 | has_member | def has_member(self, typ: Type, member: str) -> bool:
"""Does type have member with the given name?"""
# TODO: refactor this to use checkmember.analyze_member_access, otherwise
# these two should be carefully kept in sync.
# This is much faster than analyze_member_access, though, and so ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,682 | 4,719 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,474 | not_ready_callback | def not_ready_callback(self, name: str, context: Context) -> None:
"""Called when we can't infer the type of a variable because it's not ready yet.
Either defer type checking of the enclosing function to the next
pass or report an error.
"""
self.chk.handle_cannot_determine_type... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,721 | 4,727 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,475 | visit_yield_expr | def visit_yield_expr(self, e: YieldExpr) -> Type:
return_type = self.chk.return_types[-1]
expected_item_type = self.chk.get_generator_yield_type(return_type, False)
if e.expr is None:
if (
not isinstance(get_proper_type(expected_item_type), (NoneType, AnyType))
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,729 | 4,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,476 | visit_await_expr | def visit_await_expr(self, e: AwaitExpr, allow_none_return: bool = False) -> Type:
expected_type = self.type_context[-1]
if expected_type is not None:
expected_type = self.chk.named_generic_type("typing.Awaitable", [expected_type])
actual_type = get_proper_type(self.accept(e.expr, ex... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,750 | 4,762 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,477 | check_awaitable_expr | def check_awaitable_expr(
self, t: Type, ctx: Context, msg: str | ErrorMessage, ignore_binder: bool = False
) -> Type:
"""Check the argument to `await` and extract the type of value.
Also used by `async for` and `async with`.
"""
if not self.chk.check_subtype(
t,... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,764 | 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,478 | visit_yield_from_expr | def visit_yield_from_expr(self, e: YieldFromExpr, allow_none_return: bool = False) -> Type:
# NOTE: Whether `yield from` accepts an `async def` decorated
# with `@types.coroutine` (or `@asyncio.coroutine`) depends on
# whether the generator containing the `yield from` is itself
# thus de... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,787 | 4,854 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,479 | visit_temp_node | def visit_temp_node(self, e: TempNode) -> Type:
return e.type | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,856 | 4,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,480 | visit_type_var_expr | def visit_type_var_expr(self, e: TypeVarExpr) -> Type:
return AnyType(TypeOfAny.special_form) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,859 | 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,481 | visit_paramspec_expr | def visit_paramspec_expr(self, e: ParamSpecExpr) -> Type:
return AnyType(TypeOfAny.special_form) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,862 | 4,863 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,482 | visit_type_var_tuple_expr | def visit_type_var_tuple_expr(self, e: TypeVarTupleExpr) -> Type:
return AnyType(TypeOfAny.special_form) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,865 | 4,866 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,483 | visit_newtype_expr | def visit_newtype_expr(self, e: NewTypeExpr) -> Type:
return AnyType(TypeOfAny.special_form) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,868 | 4,869 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,484 | visit_namedtuple_expr | def visit_namedtuple_expr(self, e: NamedTupleExpr) -> Type:
tuple_type = e.info.tuple_type
if tuple_type:
if self.chk.options.disallow_any_unimported and has_any_from_unimported_type(
tuple_type
):
self.msg.unimported_type_becomes_any("NamedTuple t... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,871 | 4,881 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,485 | visit_enum_call_expr | def visit_enum_call_expr(self, e: EnumCallExpr) -> Type:
for name, value in zip(e.items, e.values):
if value is not None:
typ = self.accept(value)
if not isinstance(get_proper_type(typ), AnyType):
var = e.info.names[name].node
i... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,883 | 4,896 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,486 | visit_typeddict_expr | def visit_typeddict_expr(self, e: TypedDictExpr) -> Type:
return AnyType(TypeOfAny.special_form) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,898 | 4,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,487 | visit__promote_expr | def visit__promote_expr(self, e: PromoteExpr) -> Type:
return e.type | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,901 | 4,902 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,488 | visit_star_expr | def visit_star_expr(self, e: StarExpr) -> StarType:
return StarType(self.accept(e.expr)) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,904 | 4,905 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,489 | object_type | def object_type(self) -> Instance:
"""Return instance type 'object'."""
return self.named_type("builtins.object") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,907 | 4,909 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,490 | bool_type | def bool_type(self) -> Instance:
"""Return instance type 'bool'."""
return self.named_type("builtins.bool") | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,911 | 4,913 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,491 | narrow_type_from_binder | def narrow_type_from_binder(self, expr: Expression, known_type: Type) -> Type:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,916 | 4,917 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,492 | narrow_type_from_binder | def narrow_type_from_binder(
self, expr: Expression, known_type: Type, skip_non_overlapping: bool
) -> Type | None:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,920 | 4,923 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,493 | narrow_type_from_binder | def narrow_type_from_binder(
self, expr: Expression, known_type: Type, skip_non_overlapping: bool = False
) -> Type | None:
"""Narrow down a known type of expression using information in conditional type binder.
If 'skip_non_overlapping' is True, return None if the type and restriction are
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,925 | 4,947 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,494 | has_any_type | def has_any_type(t: Type, ignore_in_type_obj: bool = False) -> bool:
"""Whether t contains an Any type"""
return t.accept(HasAnyType(ignore_in_type_obj)) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,950 | 4,952 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,495 | __init__ | def __init__(self, ignore_in_type_obj: bool) -> None:
super().__init__(any)
self.ignore_in_type_obj = ignore_in_type_obj | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,956 | 4,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,496 | visit_any | def visit_any(self, t: AnyType) -> bool:
return t.type_of_any != TypeOfAny.special_form # special forms are not real Any types | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,960 | 4,961 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,497 | visit_callable_type | def visit_callable_type(self, t: CallableType) -> bool:
if self.ignore_in_type_obj and t.is_type_obj():
return False
return super().visit_callable_type(t) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,963 | 4,966 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,498 | has_coroutine_decorator | def has_coroutine_decorator(t: Type) -> bool:
"""Whether t came from a function decorated with `@coroutine`."""
t = get_proper_type(t)
return isinstance(t, Instance) and t.type.fullname == "typing.AwaitableGenerator" | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,969 | 4,972 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,499 | is_async_def | def is_async_def(t: Type) -> bool:
"""Whether t came from a function defined using `async def`."""
# In check_func_def(), when we see a function decorated with
# `@typing.coroutine` or `@async.coroutine`, we change the
# return type to typing.AwaitableGenerator[...], so that its
# type is compatible... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,975 | 4,996 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,067,500 | is_non_empty_tuple | def is_non_empty_tuple(t: Type) -> bool:
t = get_proper_type(t)
return isinstance(t, TupleType) and bool(t.items) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkexpr.py | 4,999 | 5,001 | {
"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.