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,101 | analyze_class_keywords | def analyze_class_keywords(self, defn: ClassDef) -> None:
for value in defn.keywords.values():
value.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,552 | 1,554 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,102 | enter_class | def enter_class(self, info: TypeInfo) -> None:
# Remember previous active class
self.type_stack.append(self.type)
self.locals.append(None) # Add class scope
self.is_comprehension_stack.append(False)
self.block_depth.append(-1) # The class body increments this to 0
self.... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,556 | 1,563 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,103 | leave_class | def leave_class(self) -> None:
"""Restore analyzer state."""
self.block_depth.pop()
self.locals.pop()
self.is_comprehension_stack.pop()
self.type = self.type_stack.pop()
self.missing_names.pop() | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,565 | 1,571 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,104 | analyze_class_decorator | def analyze_class_decorator(self, defn: ClassDef, decorator: Expression) -> None:
decorator.accept(self)
if isinstance(decorator, RefExpr):
if decorator.fullname in RUNTIME_PROTOCOL_DECOS:
if defn.info.is_protocol:
defn.info.runtime_protocol = True
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,573 | 1,582 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,105 | clean_up_bases_and_infer_type_variables | def clean_up_bases_and_infer_type_variables(
self, defn: ClassDef, base_type_exprs: list[Expression], context: Context
) -> tuple[list[Expression], list[TypeVarLikeType], bool]:
"""Remove extra base classes such as Generic and infer type vars.
For example, consider this class:
cl... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,584 | 1,652 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,106 | analyze_class_typevar_declaration | def analyze_class_typevar_declaration(self, base: Type) -> tuple[TypeVarLikeList, bool] | None:
"""Analyze type variables declared using Generic[...] or Protocol[...].
Args:
base: Non-analyzed base class
Return None if the base class does not declare type variables. Otherwise,
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,654 | 1,684 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,107 | analyze_unbound_tvar | def analyze_unbound_tvar(self, t: Type) -> tuple[str, TypeVarLikeExpr] | None:
if not isinstance(t, UnboundType):
return None
unbound = t
sym = self.lookup_qualified(unbound.name, unbound)
if sym and isinstance(sym.node, PlaceholderNode):
self.record_incomplete_re... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,686 | 1,710 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,108 | get_all_bases_tvars | def get_all_bases_tvars(
self, base_type_exprs: list[Expression], removed: list[int]
) -> TypeVarLikeList:
"""Return all type variable references in bases."""
tvars: TypeVarLikeList = []
for i, base_expr in enumerate(base_type_exprs):
if i not in removed:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,712 | 1,726 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,109 | get_and_bind_all_tvars | def get_and_bind_all_tvars(self, type_exprs: list[Expression]) -> list[TypeVarLikeType]:
"""Return all type variable references in item type expressions.
This is a helper for generic TypedDicts and NamedTuples. Essentially it is
a simplified version of the logic we use for ClassDef bases. We du... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,728 | 1,749 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,110 | prepare_class_def | def prepare_class_def(
self, defn: ClassDef, info: TypeInfo | None = None, custom_names: bool = False
) -> None:
"""Prepare for the analysis of a class definition.
Create an empty TypeInfo and store it in a symbol table, or if the 'info'
argument is provided, store it instead (used ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,751 | 1,794 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,111 | make_empty_type_info | def make_empty_type_info(self, defn: ClassDef) -> TypeInfo:
if (
self.is_module_scope()
and self.cur_mod_id == "builtins"
and defn.name in CORE_BUILTIN_CLASSES
):
# Special case core built-in classes. A TypeInfo was already
# created for it bef... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,796 | 1,810 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,112 | get_name_repr_of_expr | def get_name_repr_of_expr(self, expr: Expression) -> str | None:
"""Try finding a short simplified textual representation of a base class expression."""
if isinstance(expr, NameExpr):
return expr.name
if isinstance(expr, MemberExpr):
return get_member_expr_fullname(expr)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,812 | 1,822 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,113 | analyze_base_classes | def analyze_base_classes(
self, base_type_exprs: list[Expression]
) -> tuple[list[tuple[ProperType, Expression]], bool] | None:
"""Analyze base class types.
Return None if some definition was incomplete. Otherwise, return a tuple
with these items:
* List of (analyzed type,... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,824 | 1,862 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,114 | configure_base_classes | def configure_base_classes(
self, defn: ClassDef, bases: list[tuple[ProperType, Expression]]
) -> None:
"""Set up base classes.
This computes several attributes on the corresponding TypeInfo defn.info
related to the base classes: defn.info.bases, defn.info.mro, and
miscellan... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,864 | 1,921 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,115 | configure_tuple_base_class | def configure_tuple_base_class(self, defn: ClassDef, base: TupleType) -> Instance:
info = defn.info
# There may be an existing valid tuple type from previous semanal iterations.
# Use equality to check if it is the case.
if info.tuple_type and info.tuple_type != base and not has_placeho... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,923 | 1,941 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,116 | set_dummy_mro | def set_dummy_mro(self, info: TypeInfo) -> None:
# Give it an MRO consisting of just the class itself and object.
info.mro = [info, self.object_type().type]
info.bad_mro = True | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,943 | 1,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,117 | calculate_class_mro | def calculate_class_mro(
self, defn: ClassDef, obj_type: Callable[[], Instance] | None = None
) -> None:
"""Calculate method resolution order for a class.
`obj_type` exists just to fill in empty base class list in case of an error.
"""
try:
calculate_mro(defn.inf... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,948 | 1,969 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,118 | update_metaclass | def update_metaclass(self, defn: ClassDef) -> None:
"""Lookup for special metaclass declarations, and update defn fields accordingly.
* six.with_metaclass(M, B1, B2, ...)
* @six.add_metaclass(M)
* future.utils.with_metaclass(M, B1, B2, ...)
* past.utils.with_metaclass(M, B1, B2,... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 1,971 | 2,018 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,119 | verify_base_classes | def verify_base_classes(self, defn: ClassDef) -> bool:
info = defn.info
cycle = False
for base in info.bases:
baseinfo = base.type
if self.is_base_class(info, baseinfo):
self.fail("Cycle in inheritance hierarchy", defn)
cycle = True
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,020 | 2,032 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,120 | is_base_class | def is_base_class(self, t: TypeInfo, s: TypeInfo) -> bool:
"""Determine if t is a base class of s (but do not use mro)."""
# Search the base class graph for t, starting from s.
worklist = [s]
visited = {s}
while worklist:
nxt = worklist.pop()
if nxt == t:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,034 | 2,047 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,121 | analyze_metaclass | def analyze_metaclass(self, defn: ClassDef) -> None:
if defn.metaclass:
metaclass_name = None
if isinstance(defn.metaclass, NameExpr):
metaclass_name = defn.metaclass.name
elif isinstance(defn.metaclass, MemberExpr):
metaclass_name = get_member... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,049 | 2,116 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,122 | visit_import | def visit_import(self, i: Import) -> None:
self.statement = i
for id, as_id in i.ids:
# Modules imported in a stub file without using 'import X as X' won't get exported
# When implicit re-exporting is disabled, we have the same behavior as stubs.
use_implicit_reexport... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,122 | 2,142 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,123 | visit_import_from | def visit_import_from(self, imp: ImportFrom) -> None:
self.statement = imp
module_id = self.correct_relative_import(imp)
module = self.modules.get(module_id)
for id, as_id in imp.names:
fullname = module_id + "." + id
self.set_future_import_flags(fullname)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,144 | 2,226 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,124 | process_imported_symbol | def process_imported_symbol(
self,
node: SymbolTableNode,
module_id: str,
id: str,
imported_id: str,
fullname: str,
module_public: bool,
context: ImportBase,
) -> None:
module_hidden = not module_public and (
# `from package import ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,228 | 2,285 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,125 | report_missing_module_attribute | def report_missing_module_attribute(
self,
import_id: str,
source_id: str,
imported_id: str,
module_public: bool,
module_hidden: bool,
context: Node,
) -> None:
# Missing attribute.
if self.is_incomplete_namespace(import_id):
# We d... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,287 | 2,336 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,126 | process_import_over_existing_name | def process_import_over_existing_name(
self,
imported_id: str,
existing_symbol: SymbolTableNode,
module_symbol: SymbolTableNode,
import_node: ImportBase,
) -> bool:
if existing_symbol.node is module_symbol.node:
# We added this symbol on previous iteration... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,338 | 2,368 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,127 | correct_relative_import | def correct_relative_import(self, node: ImportFrom | ImportAll) -> str:
import_id, ok = correct_relative_import(
self.cur_mod_id, node.relative, node.id, self.cur_mod_node.is_package_init_file()
)
if not ok:
self.fail("Relative import climbs too many namespaces", node)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,370 | 2,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,128 | visit_import_all | def visit_import_all(self, i: ImportAll) -> None:
i_id = self.correct_relative_import(i)
if i_id in self.modules:
m = self.modules[i_id]
if self.is_incomplete_namespace(i_id):
# Any names could be missing from the current namespace if the target module
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,378 | 2,409 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,129 | visit_assignment_expr | def visit_assignment_expr(self, s: AssignmentExpr) -> None:
s.value.accept(self)
self.analyze_lvalue(s.target, escape_comprehensions=True, has_explicit_value=True) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,415 | 2,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,130 | visit_assignment_stmt | def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
self.statement = s
# Special case assignment like X = X.
if self.analyze_identity_global_assignment(s):
return
tag = self.track_incomplete_refs()
# Here we have a chicken and egg problem: at this stage we ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,419 | 2,489 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,131 | analyze_identity_global_assignment | def analyze_identity_global_assignment(self, s: AssignmentStmt) -> bool:
"""Special case 'X = X' in global scope.
This allows supporting some important use cases.
Return true if special casing was applied.
"""
if not isinstance(s.rvalue, NameExpr) or len(s.lvalues) != 1:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,491 | 2,530 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,132 | should_wait_rhs | def should_wait_rhs(self, rv: Expression) -> bool:
"""Can we already classify this r.h.s. of an assignment or should we wait?
This returns True if we don't have enough information to decide whether
an assignment is just a normal variable definition or a special form.
Always return False... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,532 | 2,559 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,133 | can_be_type_alias | def can_be_type_alias(self, rv: Expression, allow_none: bool = False) -> bool:
"""Is this a valid r.h.s. for an alias definition?
Note: this function should be only called for expressions where self.should_wait_rhs()
returns False.
"""
if isinstance(rv, RefExpr) and self.is_type... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,561 | 2,582 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,134 | can_possibly_be_index_alias | def can_possibly_be_index_alias(self, s: AssignmentStmt) -> bool:
"""Like can_be_type_alias(), but simpler and doesn't require analyzed rvalue.
Instead, use lvalues/annotations structure to figure out whether this can
potentially be a type alias definition. Another difference from above functio... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,584 | 2,601 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,135 | basic_type_applications_set | def basic_type_applications_set(self, s: AssignmentStmt) -> Iterator[None]:
old = self.basic_type_applications
# As an optimization, only use the double visit logic if this
# can possibly be a recursive type alias.
self.basic_type_applications = self.can_possibly_be_index_alias(s)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,604 | 2,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,136 | is_type_ref | def is_type_ref(self, rv: Expression, bare: bool = False) -> bool:
"""Does this expression refer to a type?
This includes:
* Special forms, like Any or Union
* Classes (except subscripted enums)
* Other type aliases
* PlaceholderNodes with becomes_typeinfo=True (... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,614 | 2,667 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,137 | is_none_alias | def is_none_alias(self, node: Expression) -> bool:
"""Is this a r.h.s. for a None alias?
We special case the assignments like Void = type(None), to allow using
Void in type annotations.
"""
if isinstance(node, CallExpr):
if (
isinstance(node.callee, N... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,669 | 2,692 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,138 | record_special_form_lvalue | def record_special_form_lvalue(self, s: AssignmentStmt) -> None:
"""Record minimal necessary information about l.h.s. of a special form.
This exists mostly for compatibility with the old semantic analyzer.
"""
lvalue = s.lvalues[0]
assert isinstance(lvalue, NameExpr)
lva... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,694 | 2,704 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,139 | analyze_enum_assign | def analyze_enum_assign(self, s: AssignmentStmt) -> bool:
"""Check if s defines an Enum."""
if isinstance(s.rvalue, CallExpr) and isinstance(s.rvalue.analyzed, EnumCallExpr):
# Already analyzed enum -- nothing to do here.
return True
return self.enum_call_analyzer.process... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,706 | 2,711 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,140 | analyze_namedtuple_assign | def analyze_namedtuple_assign(self, s: AssignmentStmt) -> bool:
"""Check if s defines a namedtuple."""
if isinstance(s.rvalue, CallExpr) and isinstance(s.rvalue.analyzed, NamedTupleExpr):
if s.rvalue.analyzed.info.tuple_type and not has_placeholder(
s.rvalue.analyzed.info.tup... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,713 | 2,747 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,141 | analyze_typeddict_assign | def analyze_typeddict_assign(self, s: AssignmentStmt) -> bool:
"""Check if s defines a typed dict."""
if isinstance(s.rvalue, CallExpr) and isinstance(s.rvalue.analyzed, TypedDictExpr):
if s.rvalue.analyzed.info.typeddict_type and not has_placeholder(
s.rvalue.analyzed.info.t... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,749 | 2,776 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,142 | analyze_lvalues | def analyze_lvalues(self, s: AssignmentStmt) -> None:
# We cannot use s.type, because analyze_simple_literal_type() will set it.
explicit = s.unanalyzed_type is not None
if self.is_final_type(s.unanalyzed_type):
# We need to exclude bare Final.
assert isinstance(s.unanaly... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,778 | 2,801 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,143 | apply_dynamic_class_hook | def apply_dynamic_class_hook(self, s: AssignmentStmt) -> None:
if not isinstance(s.rvalue, CallExpr):
return
fname = None
call = s.rvalue
while True:
if isinstance(call.callee, RefExpr):
fname = call.callee.fullname
# check if method ca... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,803 | 2,830 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,144 | unwrap_final | def unwrap_final(self, s: AssignmentStmt) -> bool:
"""Strip Final[...] if present in an assignment.
This is done to invoke type inference during type checking phase for this
assignment. Also, Final[...] doesn't affect type in any way -- it is rather an
access qualifier for given `Var`.
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,832 | 2,885 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,145 | check_final_implicit_def | def check_final_implicit_def(self, s: AssignmentStmt) -> None:
"""Do basic checks for final declaration on self in __init__.
Additional re-definition checks are performed by `analyze_lvalue`.
"""
if not s.is_final_def:
return
lval = s.lvalues[0]
assert isinst... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,887 | 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,068,146 | store_final_status | def store_final_status(self, s: AssignmentStmt) -> None:
"""If this is a locally valid final declaration, set the corresponding flag on `Var`."""
if s.is_final_def:
if len(s.lvalues) == 1 and isinstance(s.lvalues[0], RefExpr):
node = s.lvalues[0].node
if isins... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,908 | 2,964 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,147 | flatten_lvalues | def flatten_lvalues(self, lvalues: list[Expression]) -> list[Expression]:
res: list[Expression] = []
for lv in lvalues:
if isinstance(lv, (TupleExpr, ListExpr)):
res.extend(self.flatten_lvalues(lv.items))
else:
res.append(lv)
return res | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,966 | 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,068,148 | unbox_literal | def unbox_literal(self, e: Expression) -> int | float | bool | str | None:
if isinstance(e, (IntExpr, FloatExpr, StrExpr)):
return e.value
elif isinstance(e, NameExpr) and e.name in ("True", "False"):
return True if e.name == "True" else False
return None | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,975 | 2,980 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,149 | process_type_annotation | def process_type_annotation(self, s: AssignmentStmt) -> None:
"""Analyze type annotation or infer simple literal type."""
if s.type:
lvalue = s.lvalues[-1]
allow_tuple_literal = isinstance(lvalue, TupleExpr)
analyzed = self.anal_type(s.type, allow_tuple_literal=allow_... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 2,982 | 3,016 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,150 | is_annotated_protocol_member | def is_annotated_protocol_member(self, s: AssignmentStmt) -> bool:
"""Check whether a protocol member is annotated.
There are some exceptions that can be left unannotated, like ``__slots__``."""
return any(
(isinstance(lv, NameExpr) and lv.name != "__slots__" and lv.is_inferred_def)... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,018 | 3,025 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,151 | analyze_simple_literal_type | def analyze_simple_literal_type(self, rvalue: Expression, is_final: bool) -> Type | None:
"""Return builtins.int if rvalue is an int literal, etc.
If this is a 'Final' context, we return "Literal[...]" instead."""
if self.options.semantic_analysis_only or self.function_stack:
# Skip... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,027 | 3,062 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,152 | analyze_alias | def analyze_alias(
self, rvalue: Expression, allow_placeholder: bool = False
) -> tuple[Type | None, list[str], set[str], list[str]]:
"""Check if 'rvalue' is a valid type allowed for aliasing (e.g. not a type variable).
If yes, return the corresponding type, a list of
qualified type... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,064 | 3,100 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,153 | is_pep_613 | def is_pep_613(self, s: AssignmentStmt) -> bool:
if s.unanalyzed_type is not None and isinstance(s.unanalyzed_type, UnboundType):
lookup = self.lookup_qualified(s.unanalyzed_type.name, s, suppress_errors=True)
if lookup and lookup.fullname in TYPE_ALIAS_NAMES:
return True... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,102 | 3,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,154 | check_and_set_up_type_alias | def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool:
"""Check if assignment creates a type alias and set it up as needed.
Return True if it is a type alias (even if the target is not ready),
or False otherwise.
Note: the resulting types for subscripted (including generic) ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,109 | 3,272 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,155 | disable_invalid_recursive_aliases | def disable_invalid_recursive_aliases(
self, s: AssignmentStmt, current_node: TypeAlias
) -> None:
"""Prohibit and fix recursive type aliases that are invalid/unsupported."""
messages = []
if invalid_recursive_alias({current_node}, current_node.target):
messages.append("I... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,274 | 3,289 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,156 | analyze_lvalue | def analyze_lvalue(
self,
lval: Lvalue,
nested: bool = False,
explicit_type: bool = False,
is_final: bool = False,
escape_comprehensions: bool = False,
has_explicit_value: bool = False,
) -> None:
"""Analyze an lvalue or assignment target.
Arg... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,291 | 3,336 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,157 | analyze_name_lvalue | def analyze_name_lvalue(
self,
lvalue: NameExpr,
explicit_type: bool,
is_final: bool,
escape_comprehensions: bool,
has_explicit_value: bool,
) -> None:
"""Analyze an lvalue that targets a name expression.
Arguments are similar to "analyze_lvalue".
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,338 | 3,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,158 | is_final_redefinition | def is_final_redefinition(self, kind: int, name: str) -> bool:
if kind == GDEF:
return self.is_mangled_global(name) and not self.is_initial_mangled_global(name)
elif kind == MDEF and self.type:
return unmangle(name) + "'" in self.type.names
return False | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,400 | 3,405 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,159 | is_alias_for_final_name | def is_alias_for_final_name(self, name: str) -> bool:
if self.is_func_scope():
if not name.endswith("'"):
# Not a mangled name -- can't be an alias
return False
name = unmangle(name)
assert self.locals[-1] is not None, "No locals at function sc... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,407 | 3,427 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,160 | make_name_lvalue_var | def make_name_lvalue_var(
self, lvalue: NameExpr, kind: int, inferred: bool, has_explicit_value: bool
) -> Var:
"""Return a Var node for an lvalue that is a name expression."""
name = lvalue.name
v = Var(name)
v.set_line(lvalue)
v.is_inferred = inferred
if kin... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,429 | 3,449 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,161 | make_name_lvalue_point_to_existing_def | def make_name_lvalue_point_to_existing_def(
self, lval: NameExpr, explicit_type: bool, is_final: bool
) -> None:
"""Update an lvalue to point to existing definition in the same scope.
Arguments are similar to "analyze_lvalue".
Assume that an existing name exists.
"""
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,451 | 3,476 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,162 | analyze_tuple_or_list_lvalue | def analyze_tuple_or_list_lvalue(self, lval: TupleExpr, explicit_type: bool = False) -> None:
"""Analyze an lvalue or assignment target that is a list or tuple."""
items = lval.items
star_exprs = [item for item in items if isinstance(item, StarExpr)]
if len(star_exprs) > 1:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,478 | 3,496 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,163 | analyze_member_lvalue | def analyze_member_lvalue(self, lval: MemberExpr, explicit_type: bool, is_final: bool) -> None:
"""Analyze lvalue that is a member expression.
Arguments:
lval: The target lvalue
explicit_type: Assignment has type annotation
is_final: Is the target final
"""
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,498 | 3,552 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,164 | is_self_member_ref | def is_self_member_ref(self, memberexpr: MemberExpr) -> bool:
"""Does memberexpr to refer to an attribute of self?"""
if not isinstance(memberexpr.expr, NameExpr):
return False
node = memberexpr.expr.node
return isinstance(node, Var) and node.is_self | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,554 | 3,559 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,165 | check_lvalue_validity | def check_lvalue_validity(self, node: Expression | SymbolNode | None, ctx: Context) -> None:
if isinstance(node, TypeVarExpr):
self.fail("Invalid assignment target", ctx)
elif isinstance(node, TypeInfo):
self.fail(message_registry.CANNOT_ASSIGN_TO_TYPE, ctx) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,561 | 3,565 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,166 | store_declared_types | def store_declared_types(self, lvalue: Lvalue, typ: Type) -> None:
if isinstance(typ, StarType) and not isinstance(lvalue, StarExpr):
self.fail("Star type only allowed for starred expressions", lvalue)
if isinstance(lvalue, RefExpr):
lvalue.is_inferred_def = False
if ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,567 | 3,595 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,167 | process_typevar_declaration | def process_typevar_declaration(self, s: AssignmentStmt) -> bool:
"""Check if s declares a TypeVar; it yes, store it in symbol table.
Return True if this looks like a type variable declaration (but maybe
with errors), otherwise return False.
"""
call = self.get_typevarlike_decla... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,597 | 3,670 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,168 | check_typevarlike_name | def check_typevarlike_name(self, call: CallExpr, name: str, context: Context) -> bool:
"""Checks that the name of a TypeVar or ParamSpec matches its variable."""
name = unmangle(name)
assert isinstance(call.callee, RefExpr)
typevarlike_type = (
call.callee.name if isinstance(... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,672 | 3,689 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,169 | get_typevarlike_declaration | def get_typevarlike_declaration(
self, s: AssignmentStmt, typevarlike_types: tuple[str, ...]
) -> CallExpr | None:
"""Returns the call expression if `s` is a declaration of `typevarlike_type`
(TypeVar or ParamSpec), or None otherwise.
"""
if len(s.lvalues) != 1 or not isinsta... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,691 | 3,707 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,170 | process_typevar_parameters | def process_typevar_parameters(
self,
args: list[Expression],
names: list[str | None],
kinds: list[ArgKind],
num_values: int,
context: Context,
) -> tuple[int, Type] | None:
has_values = num_values > 0
covariant = False
contravariant = False
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,709 | 3,790 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,171 | extract_typevarlike_name | def extract_typevarlike_name(self, s: AssignmentStmt, call: CallExpr) -> str | None:
if not call:
return None
lvalue = s.lvalues[0]
assert isinstance(lvalue, NameExpr)
if s.type:
self.fail("Cannot declare the type of a TypeVar or similar construct", s)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,792 | 3,804 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,172 | process_paramspec_declaration | def process_paramspec_declaration(self, s: AssignmentStmt) -> bool:
"""Checks if s declares a ParamSpec; if yes, store it in symbol table.
Return True if this looks like a ParamSpec (maybe with errors), otherwise return False.
In the future, ParamSpec may accept bounds and variance arguments, ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,806 | 3,843 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,173 | process_typevartuple_declaration | def process_typevartuple_declaration(self, s: AssignmentStmt) -> bool:
"""Checks if s declares a TypeVarTuple; if yes, store it in symbol table.
Return True if this looks like a TypeVarTuple (maybe with errors), otherwise return False.
"""
call = self.get_typevarlike_declaration(
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,845 | 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,068,174 | basic_new_typeinfo | def basic_new_typeinfo(self, name: str, basetype_or_fallback: Instance, line: int) -> TypeInfo:
if self.is_func_scope() and not self.type and "@" not in name:
name += "@" + str(line)
class_def = ClassDef(name, Block([]))
if self.is_func_scope() and not self.type:
# Full n... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,879 | 3,900 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,175 | analyze_value_types | def analyze_value_types(self, items: list[Expression]) -> list[Type]:
"""Analyze types from values expressions in type variable definition."""
result: list[Type] = []
for node in items:
try:
analyzed = self.anal_type(
self.expr_to_unanalyzed_type(n... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,902 | 3,919 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,176 | check_classvar | def check_classvar(self, s: AssignmentStmt) -> None:
"""Check if assignment defines a class variable."""
lvalue = s.lvalues[0]
if len(s.lvalues) != 1 or not isinstance(lvalue, RefExpr):
return
if not s.type or not self.is_classvar(s.type):
return
if self.i... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,921 | 3,945 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,177 | is_classvar | def is_classvar(self, typ: Type) -> bool:
if not isinstance(typ, UnboundType):
return False
sym = self.lookup_qualified(typ.name, typ)
if not sym or not sym.node:
return False
return sym.node.fullname == "typing.ClassVar" | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,947 | 3,953 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,178 | is_final_type | def is_final_type(self, typ: Type | None) -> bool:
if not isinstance(typ, UnboundType):
return False
sym = self.lookup_qualified(typ.name, typ)
if not sym or not sym.node:
return False
return sym.node.fullname in FINAL_TYPE_NAMES | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,955 | 3,961 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,179 | fail_invalid_classvar | def fail_invalid_classvar(self, context: Context) -> None:
self.fail(message_registry.CLASS_VAR_OUTSIDE_OF_CLASS, context) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,963 | 3,964 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,180 | process_module_assignment | def process_module_assignment(
self, lvals: list[Lvalue], rval: Expression, ctx: AssignmentStmt
) -> None:
"""Propagate module references across assignments.
Recursively handles the simple form of iterable unpacking; doesn't
handle advanced unpacking with *rest, dictionary unpacking... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 3,966 | 4,036 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,181 | process__all__ | def process__all__(self, s: AssignmentStmt) -> None:
"""Export names if argument is a __all__ assignment."""
if (
len(s.lvalues) == 1
and isinstance(s.lvalues[0], NameExpr)
and s.lvalues[0].name == "__all__"
and s.lvalues[0].kind == GDEF
and is... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,038 | 4,047 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,182 | process__deletable__ | def process__deletable__(self, s: AssignmentStmt) -> None:
if not self.options.mypyc:
return
if (
len(s.lvalues) == 1
and isinstance(s.lvalues[0], NameExpr)
and s.lvalues[0].name == "__deletable__"
and s.lvalues[0].kind == MDEF
):
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,049 | 4,070 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,183 | process__slots__ | def process__slots__(self, s: AssignmentStmt) -> None:
"""
Processing ``__slots__`` if defined in type.
See: https://docs.python.org/3/reference/datamodel.html#slots
"""
# Later we can support `__slots__` defined as `__slots__ = other = ('a', 'b')`
if (
isins... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,072 | 4,130 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,184 | visit_block | def visit_block(self, b: Block) -> None:
if b.is_unreachable:
return
self.block_depth[-1] += 1
for s in b.body:
self.accept(s)
self.block_depth[-1] -= 1 | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,136 | 4,142 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,185 | visit_block_maybe | def visit_block_maybe(self, b: Block | None) -> None:
if b:
self.visit_block(b) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,144 | 4,146 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,186 | visit_expression_stmt | def visit_expression_stmt(self, s: ExpressionStmt) -> None:
self.statement = s
s.expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,148 | 4,150 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,187 | visit_return_stmt | def visit_return_stmt(self, s: ReturnStmt) -> None:
self.statement = s
if not self.is_func_scope():
self.fail('"return" outside function', s)
if s.expr:
s.expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,152 | 4,157 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,188 | visit_raise_stmt | def visit_raise_stmt(self, s: RaiseStmt) -> None:
self.statement = s
if s.expr:
s.expr.accept(self)
if s.from_expr:
s.from_expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,159 | 4,164 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,189 | visit_assert_stmt | def visit_assert_stmt(self, s: AssertStmt) -> None:
self.statement = s
if s.expr:
s.expr.accept(self)
if s.msg:
s.msg.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,166 | 4,171 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,190 | visit_operator_assignment_stmt | def visit_operator_assignment_stmt(self, s: OperatorAssignmentStmt) -> None:
self.statement = s
s.lvalue.accept(self)
s.rvalue.accept(self)
if (
isinstance(s.lvalue, NameExpr)
and s.lvalue.name == "__all__"
and s.lvalue.kind == GDEF
and isi... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,173 | 4,183 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,191 | visit_while_stmt | def visit_while_stmt(self, s: WhileStmt) -> None:
self.statement = s
s.expr.accept(self)
self.loop_depth += 1
s.body.accept(self)
self.loop_depth -= 1
self.visit_block_maybe(s.else_body) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,185 | 4,191 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,192 | visit_for_stmt | def visit_for_stmt(self, s: ForStmt) -> None:
if s.is_async:
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, s, code=codes.SYNTAX)
self.statement = s
s.expr.accept(self)
# Bind ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,193 | 4,216 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,193 | visit_break_stmt | def visit_break_stmt(self, s: BreakStmt) -> None:
self.statement = s
if self.loop_depth == 0:
self.fail('"break" outside loop', s, serious=True, blocker=True) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,218 | 4,221 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,194 | visit_continue_stmt | def visit_continue_stmt(self, s: ContinueStmt) -> None:
self.statement = s
if self.loop_depth == 0:
self.fail('"continue" outside loop', s, serious=True, blocker=True) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,223 | 4,226 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,195 | visit_if_stmt | def visit_if_stmt(self, s: IfStmt) -> None:
self.statement = s
infer_reachability_of_if_statement(s, self.options)
for i in range(len(s.expr)):
s.expr[i].accept(self)
self.visit_block(s.body[i])
self.visit_block_maybe(s.else_body) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,228 | 4,234 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,196 | visit_try_stmt | def visit_try_stmt(self, s: TryStmt) -> None:
self.statement = s
self.analyze_try_stmt(s, self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,236 | 4,238 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,197 | analyze_try_stmt | def analyze_try_stmt(self, s: TryStmt, visitor: NodeVisitor[None]) -> None:
s.body.accept(visitor)
for type, var, handler in zip(s.types, s.vars, s.handlers):
if type:
type.accept(visitor)
if var:
self.analyze_lvalue(var)
handler.accept... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,240 | 4,251 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,198 | visit_with_stmt | def visit_with_stmt(self, s: WithStmt) -> None:
self.statement = s
types: list[Type] = []
if s.is_async:
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
self.fail(message_registry.ASYNC_WITH_OUTSIDE_COROUTINE, s, code=codes.SYNTAX)
i... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,253 | 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,068,199 | visit_del_stmt | def visit_del_stmt(self, s: DelStmt) -> None:
self.statement = s
s.expr.accept(self)
if not self.is_valid_del_target(s.expr):
self.fail("Invalid delete target", s) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,303 | 4,307 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,200 | is_valid_del_target | def is_valid_del_target(self, s: Expression) -> bool:
if isinstance(s, (IndexExpr, NameExpr, MemberExpr)):
return True
elif isinstance(s, (TupleExpr, ListExpr)):
return all(self.is_valid_del_target(item) for item in s.items)
else:
return False | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,309 | 4,315 | {
"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.