id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
6,068,301 | accept | def accept(self, node: Node) -> None:
try:
node.accept(self)
except Exception as err:
report_internal_error(err, self.errors.file, node.line, self.errors, self.options) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,913 | 5,917 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,302 | expr_to_analyzed_type | def expr_to_analyzed_type(
self, expr: Expression, report_invalid_types: bool = True, allow_placeholder: bool = False
) -> Type | None:
if isinstance(expr, CallExpr):
# This is a legacy syntax intended mostly for Python 2, we keep it for
# backwards compatibility, but new fea... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,919 | 5,946 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,303 | analyze_type_expr | def analyze_type_expr(self, expr: Expression) -> None:
# There are certain expressions that mypy does not need to semantically analyze,
# since they analyzed solely as type. (For example, indexes in type alias definitions
# and base classes in class defs). External consumers of the mypy AST may ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,948 | 5,956 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,304 | type_analyzer | def type_analyzer(
self,
*,
tvar_scope: TypeVarLikeScope | None = None,
allow_tuple_literal: bool = False,
allow_unbound_tvars: bool = False,
allow_placeholder: bool = False,
allow_required: bool = False,
allow_param_spec_literals: bool = False,
re... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,958 | 5,986 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,305 | expr_to_unanalyzed_type | def expr_to_unanalyzed_type(self, node: Expression) -> ProperType:
return expr_to_unanalyzed_type(node, self.options, self.is_stub_file) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,988 | 5,989 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,306 | anal_type | def anal_type(
self,
typ: Type,
*,
tvar_scope: TypeVarLikeScope | None = None,
allow_tuple_literal: bool = False,
allow_unbound_tvars: bool = False,
allow_placeholder: bool = False,
allow_required: bool = False,
allow_param_spec_literals: bool = Fa... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,991 | 6,039 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,307 | class_type | def class_type(self, self_type: Type) -> Type:
return TypeType.make_normalized(self_type) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,041 | 6,042 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,308 | schedule_patch | def schedule_patch(self, priority: int, patch: Callable[[], None]) -> None:
self.patches.append((priority, patch)) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,044 | 6,045 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,309 | report_hang | def report_hang(self) -> None:
print("Deferral trace:")
for mod, line in self.deferral_debug_context:
print(f" {mod}:{line}")
self.errors.report(
-1,
-1,
"INTERNAL ERROR: maximum semantic analysis iteration count reached",
blocker=Tr... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,047 | 6,056 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,310 | add_plugin_dependency | def add_plugin_dependency(self, trigger: str, target: str | None = None) -> None:
"""Add dependency from trigger to a target.
If the target is not given explicitly, use the current target.
"""
if target is None:
target = self.scope.current_target()
self.cur_mod_node.... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,058 | 6,065 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,311 | add_type_alias_deps | def add_type_alias_deps(self, aliases_used: Iterable[str], target: str | None = None) -> None:
"""Add full names of type aliases on which the current node depends.
This is used by fine-grained incremental mode to re-check the corresponding nodes.
If `target` is None, then the target node used w... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,067 | 6,079 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,312 | is_mangled_global | def is_mangled_global(self, name: str) -> bool:
# A global is mangled if there exists at least one renamed variant.
return unmangle(name) + "'" in self.globals | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,081 | 6,083 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,313 | is_initial_mangled_global | def is_initial_mangled_global(self, name: str) -> bool:
# If there are renamed definitions for a global, the first one has exactly one prime.
return name == unmangle(name) + "'" | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,085 | 6,087 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,314 | parse_bool | def parse_bool(self, expr: Expression) -> bool | None:
if isinstance(expr, NameExpr):
if expr.fullname == "builtins.True":
return True
if expr.fullname == "builtins.False":
return False
return None | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,089 | 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,068,315 | set_future_import_flags | def set_future_import_flags(self, module_name: str) -> None:
if module_name in FUTURE_IMPORTS:
self.modules[self.cur_mod_id].future_import_flags.add(FUTURE_IMPORTS[module_name]) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,097 | 6,099 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,316 | is_future_flag_set | def is_future_flag_set(self, flag: str) -> bool:
return self.modules[self.cur_mod_id].is_future_flag_set(flag) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,101 | 6,102 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,317 | replace_implicit_first_type | def replace_implicit_first_type(sig: FunctionLike, new: Type) -> FunctionLike:
if isinstance(sig, CallableType):
if len(sig.arg_types) == 0:
return sig
return sig.copy_modified(arg_types=[new] + sig.arg_types[1:])
elif isinstance(sig, Overloaded):
return Overloaded(
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,105 | 6,115 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,318 | refers_to_fullname | def refers_to_fullname(node: Expression, fullnames: str | tuple[str, ...]) -> bool:
"""Is node a name or member expression with the given full name?"""
if not isinstance(fullnames, tuple):
fullnames = (fullnames,)
if not isinstance(node, RefExpr):
return False
if node.fullname in fullna... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,118 | 6,129 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,319 | refers_to_class_or_function | def refers_to_class_or_function(node: Expression) -> bool:
"""Does semantically analyzed node refer to a class?"""
return isinstance(node, RefExpr) and isinstance(
node.node, (TypeInfo, FuncDef, OverloadedFuncDef)
) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,132 | 6,136 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,320 | find_duplicate | def find_duplicate(list: list[T]) -> T | None:
"""If the list has duplicates, return one of the duplicates.
Otherwise, return None.
"""
for i in range(1, len(list)):
if list[i] in list[:i]:
return list[i]
return None | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,139 | 6,147 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,321 | remove_imported_names_from_symtable | def remove_imported_names_from_symtable(names: SymbolTable, module: str) -> None:
"""Remove all imported names from the symbol table of a module."""
removed: list[str] = []
for name, node in names.items():
if node.node is None:
continue
fullname = node.node.fullname
prefi... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,150 | 6,161 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,322 | make_any_non_explicit | def make_any_non_explicit(t: Type) -> Type:
"""Replace all Any types within in with Any that has attribute 'explicit' set to False"""
return t.accept(MakeAnyNonExplicit()) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,164 | 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,068,323 | visit_any | def visit_any(self, t: AnyType) -> Type:
if t.type_of_any == TypeOfAny.explicit:
return t.copy_modified(TypeOfAny.special_form)
return t | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,170 | 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,068,324 | visit_type_alias_type | def visit_type_alias_type(self, t: TypeAliasType) -> Type:
return t.copy_modified(args=[a.accept(self) for a in t.args]) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.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,068,325 | apply_semantic_analyzer_patches | def apply_semantic_analyzer_patches(patches: list[tuple[int, Callable[[], None]]]) -> None:
"""Call patch callbacks in the right order.
This should happen after semantic analyzer pass 3.
"""
patches_by_priority = sorted(patches, key=lambda x: x[0])
for priority, patch_func in patches_by_priority:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,179 | 6,186 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,326 | names_modified_by_assignment | def names_modified_by_assignment(s: AssignmentStmt) -> list[NameExpr]:
"""Return all unqualified (short) names assigned to in an assignment statement."""
result: list[NameExpr] = []
for lvalue in s.lvalues:
result += names_modified_in_lvalue(lvalue)
return result | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,189 | 6,194 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,327 | names_modified_in_lvalue | def names_modified_in_lvalue(lvalue: Lvalue) -> list[NameExpr]:
"""Return all NameExpr assignment targets in an Lvalue."""
if isinstance(lvalue, NameExpr):
return [lvalue]
elif isinstance(lvalue, StarExpr):
return names_modified_in_lvalue(lvalue.expr)
elif isinstance(lvalue, (ListExpr, T... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,197 | 6,208 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,328 | is_same_var_from_getattr | def is_same_var_from_getattr(n1: SymbolNode | None, n2: SymbolNode | None) -> bool:
"""Do n1 and n2 refer to the same Var derived from module-level __getattr__?"""
return (
isinstance(n1, Var)
and n1.from_module_getattr
and isinstance(n2, Var)
and n2.from_module_getattr
a... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,211 | 6,219 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,329 | dummy_context | def dummy_context() -> Context:
return TempNode(AnyType(TypeOfAny.special_form)) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,222 | 6,223 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,330 | is_valid_replacement | def is_valid_replacement(old: SymbolTableNode, new: SymbolTableNode) -> bool:
"""Can symbol table node replace an existing one?
These are the only valid cases:
1. Placeholder gets replaced with a non-placeholder
2. Placeholder that isn't known to become type replaced with a
placeholder that can... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,226 | 6,240 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,331 | is_same_symbol | def is_same_symbol(a: SymbolNode | None, b: SymbolNode | None) -> bool:
return (
a == b
or (isinstance(a, PlaceholderNode) and isinstance(b, PlaceholderNode))
or is_same_var_from_getattr(a, b)
) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,243 | 6,248 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,332 | is_trivial_body | def is_trivial_body(block: Block) -> bool:
"""Returns 'true' if the given body is "trivial" -- if it contains just a "pass",
"..." (ellipsis), or "raise NotImplementedError()". A trivial body may also
start with a statement containing just a string (e.g. a docstring).
Note: functions that raise other k... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 6,251 | 6,292 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,333 | __init__ | def __init__(self, chk: mypy.checker.TypeChecker, msg: MessageBuilder, plugin: Plugin) -> None:
self.chk = chk
self.msg = msg
self.plugin = plugin
self.type_context = []
self.self_match_types = self.generate_types_from_names(self_match_type_names)
self.non_sequence_match... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 106 | 115 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,334 | accept | def accept(self, o: Pattern, type_context: Type) -> PatternType:
self.type_context.append(type_context)
result = o.accept(self)
self.type_context.pop()
return result | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 117 | 122 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,335 | visit_as_pattern | def visit_as_pattern(self, o: AsPattern) -> PatternType:
current_type = self.type_context[-1]
if o.pattern is not None:
pattern_type = self.accept(o.pattern, current_type)
typ, rest_type, type_map = pattern_type
else:
typ, rest_type, type_map = current_type, U... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 124 | 139 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,336 | visit_or_pattern | def visit_or_pattern(self, o: OrPattern) -> PatternType:
current_type = self.type_context[-1]
#
# Check all the subpatterns
#
pattern_types = []
for pattern in o.patterns:
pattern_type = self.accept(pattern, current_type)
pattern_types.append(patt... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 141 | 188 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,337 | visit_value_pattern | def visit_value_pattern(self, o: ValuePattern) -> PatternType:
current_type = self.type_context[-1]
typ = self.chk.expr_checker.accept(o.expr)
typ = coerce_to_literal(typ)
narrowed_type, rest_type = self.chk.conditional_types_with_intersection(
current_type, [get_type_range(t... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 190 | 199 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,338 | visit_singleton_pattern | def visit_singleton_pattern(self, o: SingletonPattern) -> PatternType:
current_type = self.type_context[-1]
value: bool | None = o.value
if isinstance(value, bool):
typ = self.chk.expr_checker.infer_literal_expr_type(value, "builtins.bool")
elif value is None:
typ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 201 | 214 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,339 | visit_sequence_pattern | def visit_sequence_pattern(self, o: SequencePattern) -> PatternType:
#
# check for existence of a starred pattern
#
current_type = get_proper_type(self.type_context[-1])
if not self.can_match_sequence(current_type):
return self.early_non_match()
star_positions... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 216 | 314 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,340 | get_sequence_type | def get_sequence_type(self, t: Type) -> Type | None:
t = get_proper_type(t)
if isinstance(t, AnyType):
return AnyType(TypeOfAny.from_another_any, t)
if isinstance(t, UnionType):
items = [self.get_sequence_type(item) for item in t.items]
not_none_items = [item ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 316 | 331 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,341 | contract_starred_pattern_types | def contract_starred_pattern_types(
self, types: list[Type], star_pos: int | None, num_patterns: int
) -> list[Type]:
"""
Contracts a list of types in a sequence pattern depending on the position of a starred
capture pattern.
For example if the sequence pattern [a, *b, c] is... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 333 | 352 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,342 | expand_starred_pattern_types | def expand_starred_pattern_types(
self, types: list[Type], star_pos: int | None, num_types: int
) -> list[Type]:
"""Undoes the contraction done by contract_starred_pattern_types.
For example if the sequence pattern is [a, *b, c] and types [bool, int, str] are extended
to length 4 th... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 354 | 369 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,343 | visit_starred_pattern | def visit_starred_pattern(self, o: StarredPattern) -> PatternType:
captures: dict[Expression, Type] = {}
if o.capture is not None:
list_type = self.chk.named_generic_type("builtins.list", [self.type_context[-1]])
captures[o.capture] = list_type
return PatternType(self.typ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 371 | 376 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,344 | visit_mapping_pattern | def visit_mapping_pattern(self, o: MappingPattern) -> PatternType:
current_type = get_proper_type(self.type_context[-1])
can_match = True
captures: dict[Expression, Type] = {}
for key, value in zip(o.keys, o.values):
inner_type = self.get_mapping_item_type(o, current_type, ke... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 378 | 412 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,345 | get_mapping_item_type | def get_mapping_item_type(
self, pattern: MappingPattern, mapping_type: Type, key: Expression
) -> Type | None:
mapping_type = get_proper_type(mapping_type)
if isinstance(mapping_type, TypedDictType):
with self.msg.filter_errors() as local_errors:
result: Type | N... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 414 | 435 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,346 | get_simple_mapping_item_type | def get_simple_mapping_item_type(
self, pattern: MappingPattern, mapping_type: Type, key: Expression
) -> Type:
result, _ = self.chk.expr_checker.check_method_call_by_name(
"__getitem__", mapping_type, [key], [ARG_POS], pattern
)
return result | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 437 | 443 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,347 | visit_class_pattern | def visit_class_pattern(self, o: ClassPattern) -> PatternType:
current_type = get_proper_type(self.type_context[-1])
#
# Check class type
#
type_info = o.class_ref.node
if type_info is None:
return PatternType(AnyType(TypeOfAny.from_error), AnyType(TypeOfAny.... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 445 | 591 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,348 | should_self_match | def should_self_match(self, typ: Type) -> bool:
typ = get_proper_type(typ)
if isinstance(typ, Instance) and typ.type.is_named_tuple:
return False
for other in self.self_match_types:
if is_subtype(typ, other):
return True
return False | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 593 | 600 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,349 | can_match_sequence | def can_match_sequence(self, typ: ProperType) -> bool:
if isinstance(typ, UnionType):
return any(self.can_match_sequence(get_proper_type(item)) for item in typ.items)
for other in self.non_sequence_match_types:
# We have to ignore promotions, as memoryview should match, but bytes... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 602 | 612 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,350 | generate_types_from_names | def generate_types_from_names(self, type_names: list[str]) -> list[Type]:
types: list[Type] = []
for name in type_names:
try:
types.append(self.chk.named_type(name))
except KeyError as e:
# Some built in types are not defined in all test cases
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 614 | 623 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,351 | update_type_map | def update_type_map(
self, original_type_map: dict[Expression, Type], extra_type_map: dict[Expression, Type]
) -> None:
# Calculating this would not be needed if TypeMap directly used literal hashes instead of
# expressions, as suggested in the TODO above it's definition
already_capt... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 625 | 638 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,352 | construct_sequence_child | def construct_sequence_child(self, outer_type: Type, inner_type: Type) -> Type:
"""
If outer_type is a child class of typing.Sequence returns a new instance of
outer_type, that is a Sequence of inner_type. If outer_type is not a child class of
typing.Sequence just returns a Sequence of i... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 640 | 665 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,353 | early_non_match | def early_non_match(self) -> PatternType:
return PatternType(UninhabitedType(), self.type_context[-1], {}) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 667 | 668 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,354 | get_match_arg_names | def get_match_arg_names(typ: TupleType) -> list[str | None]:
args: list[str | None] = []
for item in typ.items:
values = try_getting_str_literals_from_type(item)
if values is None or len(values) != 1:
args.append(None)
else:
args.append(values[0])
return args | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 671 | 679 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,355 | get_var | def get_var(expr: Expression) -> Var:
"""
Warning: this in only true for expressions captured by a match statement.
Don't call it from anywhere else
"""
assert isinstance(expr, NameExpr)
node = expr.node
assert isinstance(node, Var)
return node | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 682 | 690 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,356 | get_type_range | def get_type_range(typ: Type) -> mypy.checker.TypeRange:
typ = get_proper_type(typ)
if (
isinstance(typ, Instance)
and typ.last_known_value
and isinstance(typ.last_known_value.value, bool)
):
typ = typ.last_known_value
return mypy.checker.TypeRange(typ, is_upper_bound=Fal... | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 693 | 701 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,357 | is_uninhabited | def is_uninhabited(typ: Type) -> bool:
return isinstance(get_proper_type(typ), UninhabitedType) | python | python-3.10.8.amd64/Lib/site-packages/mypy/checkpattern.py | 704 | 705 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,358 | visit_var | def visit_var(self, var: Var) -> None:
self.visit_optional_type(var.type) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 30 | 31 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,359 | visit_func | def visit_func(self, o: FuncItem) -> None:
super().visit_func(o)
self.visit_optional_type(o.type) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 33 | 35 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,360 | visit_class_def | def visit_class_def(self, o: ClassDef) -> None:
# TODO: Should we visit generated methods/variables as well, either here or in
# TraverserVisitor?
super().visit_class_def(o)
info = o.info
if info:
for base in info.bases:
base.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 37 | 44 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,361 | visit_type_alias_expr | def visit_type_alias_expr(self, o: TypeAliasExpr) -> None:
super().visit_type_alias_expr(o)
o.type.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 46 | 48 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,362 | visit_type_var_expr | def visit_type_var_expr(self, o: TypeVarExpr) -> None:
super().visit_type_var_expr(o)
o.upper_bound.accept(self)
for value in o.values:
value.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 50 | 54 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,363 | visit_typeddict_expr | def visit_typeddict_expr(self, o: TypedDictExpr) -> None:
super().visit_typeddict_expr(o)
self.visit_optional_type(o.info.typeddict_type) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 56 | 58 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,364 | visit_namedtuple_expr | def visit_namedtuple_expr(self, o: NamedTupleExpr) -> None:
super().visit_namedtuple_expr(o)
assert o.info.tuple_type
o.info.tuple_type.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 60 | 63 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,365 | visit__promote_expr | def visit__promote_expr(self, o: PromoteExpr) -> None:
super().visit__promote_expr(o)
o.type.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 65 | 67 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,366 | visit_newtype_expr | def visit_newtype_expr(self, o: NewTypeExpr) -> None:
super().visit_newtype_expr(o)
self.visit_optional_type(o.old_type) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 69 | 71 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,367 | visit_assignment_stmt | def visit_assignment_stmt(self, o: AssignmentStmt) -> None:
super().visit_assignment_stmt(o)
self.visit_optional_type(o.type) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 75 | 77 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,368 | visit_for_stmt | def visit_for_stmt(self, o: ForStmt) -> None:
super().visit_for_stmt(o)
self.visit_optional_type(o.index_type) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 79 | 81 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,369 | visit_with_stmt | def visit_with_stmt(self, o: WithStmt) -> None:
super().visit_with_stmt(o)
for typ in o.analyzed_types:
typ.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 83 | 86 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,370 | visit_cast_expr | def visit_cast_expr(self, o: CastExpr) -> None:
super().visit_cast_expr(o)
o.type.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 90 | 92 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,371 | visit_assert_type_expr | def visit_assert_type_expr(self, o: AssertTypeExpr) -> None:
super().visit_assert_type_expr(o)
o.type.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 94 | 96 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,372 | visit_type_application | def visit_type_application(self, o: TypeApplication) -> None:
super().visit_type_application(o)
for t in o.types:
t.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 98 | 101 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,373 | visit_optional_type | def visit_optional_type(self, t: Type | None) -> None:
if t:
t.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/mixedtraverser.py | 105 | 107 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,374 | __init__ | def __init__(
self,
*,
# Non-proper subtype flags
ignore_type_params: bool = False,
ignore_pos_arg_names: bool = False,
ignore_declared_variance: bool = False,
# Supported for both proper and non-proper
ignore_promotions: bool = False,
ignore_uninh... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 75 | 97 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,375 | check_context | def check_context(self, proper_subtype: bool) -> None:
# Historically proper and non-proper subtypes were defined using different helpers
# and different visitors. Check if flag values are such that we definitely support.
if proper_subtype:
assert (
not self.ignore_ty... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 99 | 109 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,376 | is_subtype | def is_subtype(
left: Type,
right: Type,
*,
subtype_context: SubtypeContext | None = None,
ignore_type_params: bool = False,
ignore_pos_arg_names: bool = False,
ignore_declared_variance: bool = False,
ignore_promotions: bool = False,
ignore_uninhabited: bool = False,
options: Opt... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 112 | 177 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,377 | is_proper_subtype | def is_proper_subtype(
left: Type,
right: Type,
*,
subtype_context: SubtypeContext | None = None,
ignore_promotions: bool = False,
ignore_uninhabited: bool = False,
erase_instances: bool = False,
keep_erased_types: bool = False,
) -> bool:
"""Is left a proper subtype of right?
F... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 180 | 222 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,378 | is_equivalent | def is_equivalent(
a: Type,
b: Type,
*,
ignore_type_params: bool = False,
ignore_pos_arg_names: bool = False,
options: Options | None = None,
subtype_context: SubtypeContext | None = None,
) -> bool:
return is_subtype(
a,
b,
ignore_type_params=ignore_type_params,
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 225 | 248 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,379 | is_same_type | def is_same_type(
a: Type, b: Type, ignore_promotions: bool = True, subtype_context: SubtypeContext | None = None
) -> bool:
"""Are these types proper subtypes of each other?
This means types may have different representation (e.g. an alias, or
a non-simplified union) but are semantically exchangeable ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 251 | 267 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,380 | _is_subtype | def _is_subtype(
left: Type, right: Type, subtype_context: SubtypeContext, proper_subtype: bool
) -> bool:
subtype_context.check_context(proper_subtype)
orig_right = right
orig_left = left
left = get_proper_type(left)
right = get_proper_type(right)
if not proper_subtype and (
isinst... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 272 | 327 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,381 | check_item | def check_item(left: Type, right: Type, subtype_context: SubtypeContext) -> bool:
if proper_subtype:
return is_proper_subtype(left, right, subtype_context=subtype_context)
return is_subtype(left, right, subtype_context=subtype_context) | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 290 | 293 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,382 | check_type_parameter | def check_type_parameter(
lefta: Type, righta: Type, variance: int, proper_subtype: bool, subtype_context: SubtypeContext
) -> bool:
def check(left: Type, right: Type) -> bool:
return (
is_proper_subtype(left, right, subtype_context=subtype_context)
if proper_subtype
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 330 | 352 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,383 | check | def check(left: Type, right: Type) -> bool:
return (
is_proper_subtype(left, right, subtype_context=subtype_context)
if proper_subtype
else is_subtype(left, right, subtype_context=subtype_context)
) | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 333 | 338 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,384 | ignore_type_parameter | def ignore_type_parameter(
lefta: Type, righta: Type, variance: int, proper_subtype: bool, subtype_context: SubtypeContext
) -> bool:
return True | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 355 | 358 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,385 | __init__ | def __init__(self, right: Type, subtype_context: SubtypeContext, proper_subtype: bool) -> None:
self.right = get_proper_type(right)
self.orig_right = right
self.proper_subtype = proper_subtype
self.subtype_context = subtype_context
self.check_type_parameter = (
ignore... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 362 | 371 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,386 | build_subtype_kind | def build_subtype_kind(subtype_context: SubtypeContext, proper_subtype: bool) -> SubtypeKind:
return (
state.strict_optional,
proper_subtype,
subtype_context.ignore_type_params,
subtype_context.ignore_pos_arg_names,
subtype_context.ignore_declared_vari... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 374 | 384 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,387 | _is_subtype | def _is_subtype(self, left: Type, right: Type) -> bool:
if self.proper_subtype:
return is_proper_subtype(left, right, subtype_context=self.subtype_context)
return is_subtype(left, right, subtype_context=self.subtype_context) | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 386 | 389 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,388 | visit_unbound_type | def visit_unbound_type(self, left: UnboundType) -> bool:
# This can be called if there is a bad type annotation. The result probably
# doesn't matter much but by returning True we simplify these bad types away
# from unions, which could filter out some bogus messages.
return True | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 394 | 398 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,389 | visit_any | def visit_any(self, left: AnyType) -> bool:
return isinstance(self.right, AnyType) if self.proper_subtype else True | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 400 | 401 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,390 | visit_none_type | def visit_none_type(self, left: NoneType) -> bool:
if state.strict_optional:
if isinstance(self.right, NoneType) or is_named_instance(
self.right, "builtins.object"
):
return True
if isinstance(self.right, Instance) and self.right.type.is_proto... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 403 | 417 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,391 | visit_uninhabited_type | def visit_uninhabited_type(self, left: UninhabitedType) -> bool:
# We ignore this for unsafe overload checks, so that and empty list and
# a list of int will be considered non-overlapping.
if isinstance(self.right, UninhabitedType):
return True
return not self.subtype_context... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 419 | 424 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,392 | visit_erased_type | def visit_erased_type(self, left: ErasedType) -> bool:
# This may be encountered during type inference. The result probably doesn't
# matter much.
# TODO: it actually does matter, figure out more principled logic about this.
if self.subtype_context.keep_erased_types:
return F... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 426 | 432 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,393 | visit_deleted_type | def visit_deleted_type(self, left: DeletedType) -> bool:
return True | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 434 | 435 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,394 | visit_instance | def visit_instance(self, left: Instance) -> bool:
if left.type.fallback_to_any and not self.proper_subtype:
if isinstance(self.right, NoneType):
# NOTE: `None` is a *non-subclassable* singleton, therefore no class
# can by a subtype of it, even with an `Any` fallback.... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 437 | 598 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,395 | check_mixed | def check_mixed(
unpacked_type: ProperType, compare_to: tuple[Type, ...]
) -> bool:
if isinstance(unpacked_type, TypeVarTupleType):
return False
if isinstance(unpacked_type, AnyType):
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 493 | 507 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,396 | visit_type_var | def visit_type_var(self, left: TypeVarType) -> bool:
right = self.right
if isinstance(right, TypeVarType) and left.id == right.id:
return True
if left.values and self._is_subtype(UnionType.make_union(left.values), right):
return True
return self._is_subtype(left.u... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 600 | 606 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,397 | visit_param_spec | def visit_param_spec(self, left: ParamSpecType) -> bool:
right = self.right
if (
isinstance(right, ParamSpecType)
and right.id == left.id
and right.flavor == left.flavor
):
return True
return self._is_subtype(left.upper_bound, self.right) | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 608 | 616 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,398 | visit_type_var_tuple | def visit_type_var_tuple(self, left: TypeVarTupleType) -> bool:
right = self.right
if isinstance(right, TypeVarTupleType) and right.id == left.id:
return True
return self._is_subtype(left.upper_bound, self.right) | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 618 | 622 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,399 | visit_unpack_type | def visit_unpack_type(self, left: UnpackType) -> bool:
if isinstance(self.right, UnpackType):
return self._is_subtype(left.type, self.right.type)
return False | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 624 | 627 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,400 | visit_parameters | def visit_parameters(self, left: Parameters) -> bool:
if isinstance(self.right, Parameters) or isinstance(self.right, CallableType):
right = self.right
if isinstance(right, CallableType):
right = right.with_unpacked_kwargs()
return are_parameters_compatible(
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/subtypes.py | 629 | 641 | {
"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.