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,201 | visit_global_decl | def visit_global_decl(self, g: GlobalDecl) -> None:
self.statement = g
for name in g.names:
if name in self.nonlocal_decls[-1]:
self.fail(f'Name "{name}" is nonlocal and global', g)
self.global_decls[-1].add(name) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,317 | 4,322 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,202 | visit_nonlocal_decl | def visit_nonlocal_decl(self, d: NonlocalDecl) -> None:
self.statement = d
if self.is_module_scope():
self.fail("nonlocal declaration not allowed at module level", d)
else:
for name in d.names:
for table in reversed(self.locals[:-1]):
i... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,324 | 4,345 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,203 | visit_match_stmt | def visit_match_stmt(self, s: MatchStmt) -> None:
self.statement = s
infer_reachability_of_match_statement(s, self.options)
s.subject.accept(self)
for i in range(len(s.patterns)):
s.patterns[i].accept(self)
guard = s.guards[i]
if guard is not None:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,347 | 4,356 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,204 | visit_name_expr | def visit_name_expr(self, expr: NameExpr) -> None:
n = self.lookup(expr.name, expr)
if n:
self.bind_name_expr(expr, n) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,362 | 4,365 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,205 | bind_name_expr | def bind_name_expr(self, expr: NameExpr, sym: SymbolTableNode) -> None:
"""Bind name expression to a symbol table node."""
if isinstance(sym.node, TypeVarExpr) and self.tvar_scope.get_binding(sym):
self.fail(
'"{}" is a type variable and only valid in type ' "context".format(... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,367 | 4,378 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,206 | visit_super_expr | def visit_super_expr(self, expr: SuperExpr) -> None:
if not self.type and not expr.call.args:
self.fail('"super" used outside class', expr)
return
expr.info = self.type
for arg in expr.call.args:
arg.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,380 | 4,386 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,207 | visit_tuple_expr | def visit_tuple_expr(self, expr: TupleExpr) -> None:
for item in expr.items:
if isinstance(item, StarExpr):
item.valid = True
item.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,388 | 4,392 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,208 | visit_list_expr | def visit_list_expr(self, expr: ListExpr) -> None:
for item in expr.items:
if isinstance(item, StarExpr):
item.valid = True
item.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,394 | 4,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,209 | visit_set_expr | def visit_set_expr(self, expr: SetExpr) -> None:
for item in expr.items:
if isinstance(item, StarExpr):
item.valid = True
item.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,400 | 4,404 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,210 | visit_dict_expr | def visit_dict_expr(self, expr: DictExpr) -> None:
for key, value in expr.items:
if key is not None:
key.accept(self)
value.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,406 | 4,410 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,211 | visit_star_expr | def visit_star_expr(self, expr: StarExpr) -> None:
if not expr.valid:
# XXX TODO Change this error message
self.fail("Can use starred expression only as assignment target", expr)
else:
expr.expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,412 | 4,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,212 | visit_yield_from_expr | def visit_yield_from_expr(self, e: YieldFromExpr) -> None:
if not self.is_func_scope():
self.fail('"yield from" outside function', e, serious=True, blocker=True)
elif self.is_comprehension_stack[-1]:
self.fail(
'"yield from" inside comprehension or generator expre... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,419 | 4,434 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,213 | visit_call_expr | def visit_call_expr(self, expr: CallExpr) -> None:
"""Analyze a call expression.
Some call expressions are recognized as special forms, including
cast(...).
"""
expr.callee.accept(self)
if refers_to_fullname(expr.callee, "typing.cast"):
# Special form cast(..... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,436 | 4,555 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,214 | translate_dict_call | def translate_dict_call(self, call: CallExpr) -> DictExpr | None:
"""Translate 'dict(x=y, ...)' to {'x': y, ...} and 'dict()' to {}.
For other variants of dict(...), return None.
"""
if not all(kind == ARG_NAMED for kind in call.arg_kinds):
# Must still accept those args.
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,557 | 4,575 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,215 | check_fixed_args | def check_fixed_args(self, expr: CallExpr, numargs: int, name: str) -> bool:
"""Verify that expr has specified number of positional args.
Return True if the arguments are valid.
"""
s = "s"
if numargs == 1:
s = ""
if len(expr.args) != numargs:
sel... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,577 | 4,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,216 | visit_member_expr | def visit_member_expr(self, expr: MemberExpr) -> None:
base = expr.expr
base.accept(self)
if isinstance(base, RefExpr) and isinstance(base.node, MypyFile):
# Handle module attribute.
sym = self.get_module_symbol(base.node, expr.name)
if sym:
if... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,593 | 4,637 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,217 | visit_op_expr | def visit_op_expr(self, expr: OpExpr) -> None:
expr.left.accept(self)
if expr.op in ("and", "or"):
inferred = infer_condition_value(expr.left, self.options)
if (inferred in (ALWAYS_FALSE, MYPY_FALSE) and expr.op == "and") or (
inferred in (ALWAYS_TRUE, MYPY_TRUE)... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,639 | 4,654 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,218 | visit_comparison_expr | def visit_comparison_expr(self, expr: ComparisonExpr) -> None:
for operand in expr.operands:
operand.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,656 | 4,658 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,219 | visit_unary_expr | def visit_unary_expr(self, expr: UnaryExpr) -> None:
expr.expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,660 | 4,661 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,220 | visit_index_expr | def visit_index_expr(self, expr: IndexExpr) -> None:
base = expr.base
base.accept(self)
if (
isinstance(base, RefExpr)
and isinstance(base.node, TypeInfo)
and not base.node.is_generic()
):
expr.index.accept(self)
elif (
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,663 | 4,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,221 | analyze_type_application | def analyze_type_application(self, expr: IndexExpr) -> None:
"""Analyze special form -- type application (either direct or via type aliasing)."""
types = self.analyze_type_application_args(expr)
if types is None:
return
base = expr.base
expr.analyzed = TypeApplication... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,681 | 4,713 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,222 | analyze_type_application_args | def analyze_type_application_args(self, expr: IndexExpr) -> list[Type] | None:
"""Analyze type arguments (index) in a type application.
Return None if anything was incomplete.
"""
index = expr.index
tag = self.track_incomplete_refs()
self.analyze_type_expr(index)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,715 | 4,788 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,223 | visit_slice_expr | def visit_slice_expr(self, expr: SliceExpr) -> None:
if expr.begin_index:
expr.begin_index.accept(self)
if expr.end_index:
expr.end_index.accept(self)
if expr.stride:
expr.stride.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,790 | 4,796 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,224 | visit_cast_expr | def visit_cast_expr(self, expr: CastExpr) -> None:
expr.expr.accept(self)
analyzed = self.anal_type(expr.type)
if analyzed is not None:
expr.type = analyzed | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,798 | 4,802 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,225 | visit_assert_type_expr | def visit_assert_type_expr(self, expr: AssertTypeExpr) -> None:
expr.expr.accept(self)
analyzed = self.anal_type(expr.type)
if analyzed is not None:
expr.type = analyzed | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,804 | 4,808 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,226 | visit_reveal_expr | def visit_reveal_expr(self, expr: RevealExpr) -> None:
if expr.kind == REVEAL_TYPE:
if expr.expr is not None:
expr.expr.accept(self)
else:
# Reveal locals doesn't have an inner expression, there's no
# need to traverse inside it
pass | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,810 | 4,817 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,227 | visit_type_application | def visit_type_application(self, expr: TypeApplication) -> None:
expr.expr.accept(self)
for i in range(len(expr.types)):
analyzed = self.anal_type(expr.types[i])
if analyzed is not None:
expr.types[i] = analyzed | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,819 | 4,824 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,228 | visit_list_comprehension | def visit_list_comprehension(self, expr: ListComprehension) -> None:
if any(expr.generator.is_async):
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, expr, code=codes.SYNTAX)
expr.generator.acce... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,826 | 4,831 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,229 | visit_set_comprehension | def visit_set_comprehension(self, expr: SetComprehension) -> None:
if any(expr.generator.is_async):
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, expr, code=codes.SYNTAX)
expr.generator.accept... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,833 | 4,838 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,230 | visit_dictionary_comprehension | def visit_dictionary_comprehension(self, expr: DictionaryComprehension) -> None:
if any(expr.is_async):
if not self.is_func_scope() or not self.function_stack[-1].is_coroutine:
self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, expr, code=codes.SYNTAX)
with self.enter(e... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,840 | 4,849 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,231 | visit_generator_expr | def visit_generator_expr(self, expr: GeneratorExpr) -> None:
with self.enter(expr):
self.analyze_comp_for(expr)
expr.left_expr.accept(self)
self.analyze_comp_for_2(expr) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,851 | 4,855 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,232 | analyze_comp_for | def analyze_comp_for(self, expr: GeneratorExpr | DictionaryComprehension) -> None:
"""Analyses the 'comp_for' part of comprehensions (part 1).
That is the part after 'for' in (x for x in l if p). This analyzes
variables and conditions which are analyzed in a local scope.
"""
for... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,857 | 4,871 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,233 | analyze_comp_for_2 | def analyze_comp_for_2(self, expr: GeneratorExpr | DictionaryComprehension) -> None:
"""Analyses the 'comp_for' part of comprehensions (part 2).
That is the part after 'for' in (x for x in l if p). This analyzes
the 'l' part which is analyzed in the surrounding scope.
"""
expr.s... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,873 | 4,879 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,234 | visit_lambda_expr | def visit_lambda_expr(self, expr: LambdaExpr) -> None:
self.analyze_arg_initializers(expr)
self.analyze_function_body(expr) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,881 | 4,883 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,235 | visit_conditional_expr | def visit_conditional_expr(self, expr: ConditionalExpr) -> None:
expr.if_expr.accept(self)
expr.cond.accept(self)
expr.else_expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,885 | 4,888 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,236 | visit__promote_expr | def visit__promote_expr(self, expr: PromoteExpr) -> None:
analyzed = self.anal_type(expr.type)
if analyzed is not None:
expr.type = analyzed | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,890 | 4,893 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,237 | visit_yield_expr | def visit_yield_expr(self, e: YieldExpr) -> None:
if not self.is_func_scope():
self.fail('"yield" outside function', e, serious=True, blocker=True)
elif self.is_comprehension_stack[-1]:
self.fail(
'"yield" inside comprehension or generator expression',
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,895 | 4,914 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,238 | visit_await_expr | def visit_await_expr(self, expr: AwaitExpr) -> None:
if not self.is_func_scope():
self.fail('"await" outside function', expr)
elif not self.function_stack[-1].is_coroutine:
self.fail('"await" outside coroutine ("async def")', expr)
expr.expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,916 | 4,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,239 | visit_as_pattern | def visit_as_pattern(self, p: AsPattern) -> None:
if p.pattern is not None:
p.pattern.accept(self)
if p.name is not None:
self.analyze_lvalue(p.name) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,927 | 4,931 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,240 | visit_or_pattern | def visit_or_pattern(self, p: OrPattern) -> None:
for pattern in p.patterns:
pattern.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,933 | 4,935 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,241 | visit_value_pattern | def visit_value_pattern(self, p: ValuePattern) -> None:
p.expr.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,937 | 4,938 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,242 | visit_sequence_pattern | def visit_sequence_pattern(self, p: SequencePattern) -> None:
for pattern in p.patterns:
pattern.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,940 | 4,942 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,243 | visit_starred_pattern | def visit_starred_pattern(self, p: StarredPattern) -> None:
if p.capture is not None:
self.analyze_lvalue(p.capture) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,944 | 4,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,244 | visit_mapping_pattern | def visit_mapping_pattern(self, p: MappingPattern) -> None:
for key in p.keys:
key.accept(self)
for value in p.values:
value.accept(self)
if p.rest is not None:
self.analyze_lvalue(p.rest) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,948 | 4,954 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,245 | visit_class_pattern | def visit_class_pattern(self, p: ClassPattern) -> None:
p.class_ref.accept(self)
for pos in p.positionals:
pos.accept(self)
for v in p.keyword_values:
v.accept(self) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,956 | 4,961 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,246 | lookup | def lookup(
self, name: str, ctx: Context, suppress_errors: bool = False
) -> SymbolTableNode | None:
"""Look up an unqualified (no dots) name in all active namespaces.
Note that the result may contain a PlaceholderNode. The caller may
want to defer in that case.
Generate a... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 4,967 | 5,030 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,247 | is_active_symbol_in_class_body | def is_active_symbol_in_class_body(self, node: SymbolNode | None) -> bool:
"""Can a symbol defined in class body accessed at current statement?
Only allow access to class attributes textually after
the definition, so that it's possible to fall back to the
outer scope. Example:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,032 | 5,058 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,248 | is_textually_before_statement | def is_textually_before_statement(self, node: SymbolNode) -> bool:
"""Check if a node is defined textually before the current statement
Note that decorated functions' line number are the same as
the top decorator.
"""
assert self.statement
line_diff = self.statement.line... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,060 | 5,077 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,249 | is_overloaded_item | def is_overloaded_item(self, node: SymbolNode, statement: Statement) -> bool:
"""Check whether the function belongs to the overloaded variants"""
if isinstance(node, OverloadedFuncDef) and isinstance(statement, FuncDef):
in_items = statement in {
item.func if isinstance(item,... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,079 | 5,090 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,250 | is_defined_in_current_module | def is_defined_in_current_module(self, fullname: str | None) -> bool:
if fullname is None:
return False
return module_prefix(self.modules, fullname) == self.cur_mod_id | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,092 | 5,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,251 | lookup_qualified | def lookup_qualified(
self, name: str, ctx: Context, suppress_errors: bool = False
) -> SymbolTableNode | None:
"""Lookup a qualified name in all activate namespaces.
Note that the result may contain a PlaceholderNode. The caller may
want to defer in that case.
Generate an ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,097 | 5,145 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,252 | lookup_type_node | def lookup_type_node(self, expr: Expression) -> SymbolTableNode | None:
try:
t = self.expr_to_unanalyzed_type(expr)
except TypeTranslationError:
return None
if isinstance(t, UnboundType):
n = self.lookup_qualified(t.name, expr, suppress_errors=True)
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,147 | 5,155 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,253 | get_module_symbol | def get_module_symbol(self, node: MypyFile, name: str) -> SymbolTableNode | None:
"""Look up a symbol from a module.
Return None if no matching symbol could be bound.
"""
module = node.fullname
names = node.names
sym = names.get(name)
if not sym:
full... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,157 | 5,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,254 | is_missing_module | def is_missing_module(self, module: str) -> bool:
return module in self.missing_modules | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,188 | 5,189 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,255 | implicit_symbol | def implicit_symbol(
self, sym: SymbolTableNode, name: str, parts: list[str], source_type: AnyType
) -> SymbolTableNode:
"""Create symbol for a qualified name reference through Any type."""
if sym.node is None:
basename = None
else:
basename = sym.node.fullnam... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,191 | 5,206 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,256 | create_getattr_var | def create_getattr_var(
self, getattr_defn: SymbolTableNode, name: str, fullname: str
) -> Var | None:
"""Create a dummy variable using module-level __getattr__ return type.
If not possible, return None.
Note that multiple Var nodes can be created for a single name. We
can ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,208 | 5,231 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,257 | lookup_fully_qualified | def lookup_fully_qualified(self, fullname: str) -> SymbolTableNode:
ret = self.lookup_fully_qualified_or_none(fullname)
assert ret is not None, fullname
return ret | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,233 | 5,236 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,258 | lookup_fully_qualified_or_none | def lookup_fully_qualified_or_none(self, fullname: str) -> SymbolTableNode | None:
"""Lookup a fully qualified name that refers to a module-level definition.
Don't assume that the name is defined. This happens in the global namespace --
the local module namespace is ignored. This does not deref... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,238 | 5,259 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,259 | object_type | def object_type(self) -> Instance:
return self.named_type("builtins.object") | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,261 | 5,262 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,260 | str_type | def str_type(self) -> Instance:
return self.named_type("builtins.str") | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,264 | 5,265 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,261 | named_type | def named_type(self, fullname: str, args: list[Type] | None = None) -> Instance:
sym = self.lookup_fully_qualified(fullname)
assert sym, "Internal error: attempted to construct unknown type"
node = sym.node
assert isinstance(node, TypeInfo)
if args:
# TODO: assert len... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,267 | 5,275 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,262 | named_type_or_none | def named_type_or_none(self, fullname: str, args: list[Type] | None = None) -> Instance | None:
sym = self.lookup_fully_qualified_or_none(fullname)
if not sym or isinstance(sym.node, PlaceholderNode):
return None
node = sym.node
if isinstance(node, TypeAlias):
ass... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,277 | 5,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,263 | builtin_type | def builtin_type(self, fully_qualified_name: str) -> Instance:
"""Legacy function -- use named_type() instead."""
return self.named_type(fully_qualified_name) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,291 | 5,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,264 | lookup_current_scope | def lookup_current_scope(self, name: str) -> SymbolTableNode | None:
if self.locals[-1] is not None:
return self.locals[-1].get(name)
elif self.type is not None:
return self.type.names.get(name)
else:
return self.globals.get(name) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,295 | 5,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,265 | add_symbol | def add_symbol(
self,
name: str,
node: SymbolNode,
context: Context,
module_public: bool = True,
module_hidden: bool = False,
can_defer: bool = True,
escape_comprehensions: bool = False,
) -> bool:
"""Add symbol to the currently active symbol t... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,307 | 5,337 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,266 | add_symbol_skip_local | def add_symbol_skip_local(self, name: str, node: SymbolNode) -> None:
"""Same as above, but skipping the local namespace.
This doesn't check for previous definition and is only used
for serialization of method-level classes.
Classes defined within methods can be exposed through an
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,339 | 5,359 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,267 | add_symbol_table_node | def add_symbol_table_node(
self,
name: str,
symbol: SymbolTableNode,
context: Context | None = None,
can_defer: bool = True,
escape_comprehensions: bool = False,
) -> bool:
"""Add symbol table node to the currently active symbol table.
Return True if ... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,361 | 5,418 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,268 | add_redefinition | def add_redefinition(self, names: SymbolTable, name: str, symbol: SymbolTableNode) -> None:
"""Add a symbol table node that reflects a redefinition as a function or a class.
Redefinitions need to be added to the symbol table so that they can be found
through AST traversal, but they have dummy n... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,420 | 5,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,269 | add_local | def add_local(self, node: Var | FuncDef | OverloadedFuncDef, context: Context) -> None:
"""Add local variable or function."""
assert self.is_func_scope()
name = node.name
node._fullname = name
self.add_symbol(name, node, context) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,451 | 5,456 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,270 | add_module_symbol | def add_module_symbol(
self, id: str, as_id: str, context: Context, module_public: bool, module_hidden: bool
) -> None:
"""Add symbol that is a reference to a module object."""
if id in self.modules:
node = self.modules[id]
self.add_symbol(
as_id, node... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,458 | 5,474 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,271 | _get_node_for_class_scoped_import | def _get_node_for_class_scoped_import(
self, name: str, symbol_node: SymbolNode | None, context: Context
) -> SymbolNode | None:
if symbol_node is None:
return None
# I promise this type checks; I'm just making mypyc issues go away.
# mypyc is absolutely convinced that `s... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,476 | 5,516 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,272 | add_imported_symbol | def add_imported_symbol(
self,
name: str,
node: SymbolTableNode,
context: Context,
module_public: bool,
module_hidden: bool,
) -> None:
"""Add an alias to an existing symbol through import."""
assert not module_hidden or not module_public
symb... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,518 | 5,537 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,273 | add_unknown_imported_symbol | def add_unknown_imported_symbol(
self,
name: str,
context: Context,
target_name: str | None,
module_public: bool,
module_hidden: bool,
) -> None:
"""Add symbol that we don't know what it points to because resolving an import failed.
This can happen if... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,539 | 5,576 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,274 | tvar_scope_frame | def tvar_scope_frame(self, frame: TypeVarLikeScope) -> Iterator[None]:
old_scope = self.tvar_scope
self.tvar_scope = frame
yield
self.tvar_scope = old_scope | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,583 | 5,587 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,275 | defer | def defer(self, debug_context: Context | None = None, force_progress: bool = False) -> None:
"""Defer current analysis target to be analyzed again.
This must be called if something in the current target is
incomplete or has a placeholder node. However, this must *not*
be called during t... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,589 | 5,615 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,276 | track_incomplete_refs | def track_incomplete_refs(self) -> Tag:
"""Return tag that can be used for tracking references to incomplete names."""
return self.num_incomplete_refs | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,617 | 5,619 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,277 | found_incomplete_ref | def found_incomplete_ref(self, tag: Tag) -> bool:
"""Have we encountered an incomplete reference since starting tracking?"""
return self.num_incomplete_refs != tag | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,621 | 5,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,278 | record_incomplete_ref | def record_incomplete_ref(self) -> None:
"""Record the encounter of an incomplete reference and defer current analysis target."""
self.defer()
self.num_incomplete_refs += 1 | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,625 | 5,628 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,279 | mark_incomplete | def mark_incomplete(
self,
name: str,
node: Node,
becomes_typeinfo: bool = False,
module_public: bool = True,
module_hidden: bool = False,
) -> None:
"""Mark a definition as incomplete (and defer current analysis target).
Also potentially mark the cur... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,630 | 5,664 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,280 | is_incomplete_namespace | def is_incomplete_namespace(self, fullname: str) -> bool:
"""Is a module or class namespace potentially missing some definitions?
If a name is missing from an incomplete namespace, we'll need to defer the
current analysis target.
"""
return fullname in self.incomplete_namespaces | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,666 | 5,672 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,281 | process_placeholder | def process_placeholder(self, name: str, kind: str, ctx: Context) -> None:
"""Process a reference targeting placeholder node.
If this is not a final iteration, defer current node,
otherwise report an error.
The 'kind' argument indicates if this a name or attribute expression
(u... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,674 | 5,686 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,282 | cannot_resolve_name | def cannot_resolve_name(self, name: str, kind: str, ctx: Context) -> None:
self.fail(f'Cannot resolve {kind} "{name}" (possible cyclic definition)', ctx)
if self.options.enable_recursive_aliases and self.is_func_scope():
self.note("Recursive types are not allowed at function scope", ctx) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,688 | 5,691 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,283 | qualified_name | def qualified_name(self, name: str) -> str:
if self.type is not None:
return self.type._fullname + "." + name
elif self.is_func_scope():
return name
else:
return self.cur_mod_id + "." + name | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,693 | 5,699 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,284 | enter | def enter(
self, function: FuncItem | GeneratorExpr | DictionaryComprehension
) -> Iterator[None]:
"""Enter a function, generator or comprehension scope."""
names = self.saved_locals.setdefault(function, SymbolTable())
self.locals.append(names)
is_comprehension = isinstance(f... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,702 | 5,723 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,285 | is_func_scope | def is_func_scope(self) -> bool:
return self.locals[-1] is not None | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,725 | 5,726 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,286 | is_nested_within_func_scope | def is_nested_within_func_scope(self) -> bool:
"""Are we underneath a function scope, even if we are in a nested class also?"""
return any(l is not None for l in self.locals) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,728 | 5,730 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,287 | is_class_scope | def is_class_scope(self) -> bool:
return self.type is not None and not self.is_func_scope() | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,732 | 5,733 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,288 | is_module_scope | def is_module_scope(self) -> bool:
return not (self.is_class_scope() or self.is_func_scope()) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,735 | 5,736 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,289 | current_symbol_kind | def current_symbol_kind(self) -> int:
if self.is_class_scope():
kind = MDEF
elif self.is_func_scope():
kind = LDEF
else:
kind = GDEF
return kind | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,738 | 5,745 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,290 | current_symbol_table | def current_symbol_table(self, escape_comprehensions: bool = False) -> SymbolTable:
if self.is_func_scope():
assert self.locals[-1] is not None
if escape_comprehensions:
assert len(self.locals) == len(self.is_comprehension_stack)
# Retrieve the symbol tabl... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,747 | 5,774 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,291 | is_global_or_nonlocal | def is_global_or_nonlocal(self, name: str) -> bool:
return self.is_func_scope() and (
name in self.global_decls[-1] or name in self.nonlocal_decls[-1]
) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,776 | 5,779 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,292 | add_exports | def add_exports(self, exp_or_exps: Iterable[Expression] | Expression) -> None:
exps = [exp_or_exps] if isinstance(exp_or_exps, Expression) else exp_or_exps
for exp in exps:
if isinstance(exp, StrExpr):
self.all_exports.append(exp.value) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,781 | 5,785 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,293 | name_not_defined | def name_not_defined(self, name: str, ctx: Context, namespace: str | None = None) -> None:
incomplete = self.is_incomplete_namespace(namespace or self.cur_mod_id)
if (
namespace is None
and self.type
and not self.is_func_scope()
and self.incomplete_type_st... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,787 | 5,826 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,294 | already_defined | def already_defined(
self, name: str, ctx: Context, original_ctx: SymbolTableNode | SymbolNode | None, noun: str
) -> None:
if isinstance(original_ctx, SymbolTableNode):
node: SymbolNode | None = original_ctx.node
elif isinstance(original_ctx, SymbolNode):
node = orig... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,828 | 5,851 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,295 | name_already_defined | def name_already_defined(
self, name: str, ctx: Context, original_ctx: SymbolTableNode | SymbolNode | None = None
) -> None:
self.already_defined(name, ctx, original_ctx, noun="Name") | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,853 | 5,856 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,296 | attribute_already_defined | def attribute_already_defined(
self, name: str, ctx: Context, original_ctx: SymbolTableNode | SymbolNode | None = None
) -> None:
self.already_defined(name, ctx, original_ctx, noun="Attribute") | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,858 | 5,861 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,297 | is_local_name | def is_local_name(self, name: str) -> bool:
"""Does name look like reference to a definition in the current module?"""
return self.is_defined_in_current_module(name) or "." not in name | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,863 | 5,865 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,298 | in_checked_function | def in_checked_function(self) -> bool:
"""Should we type-check the current function?
- Yes if --check-untyped-defs is set.
- Yes outside functions.
- Yes in annotated functions.
- No otherwise.
"""
if self.options.check_untyped_defs or not self.function_stack:
... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,867 | 5,891 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,068,299 | fail | def fail(
self,
msg: str,
ctx: Context,
serious: bool = False,
*,
code: ErrorCode | None = None,
blocker: bool = False,
) -> None:
if not serious and not self.in_checked_function():
return
# In case it's a bug and we don't really ha... | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,893 | 5,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,300 | note | def note(self, msg: str, ctx: Context, code: ErrorCode | None = None) -> None:
if not self.in_checked_function():
return
self.errors.report(ctx.get_line(), ctx.get_column(), msg, severity="note", code=code) | python | python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py | 5,908 | 5,911 | {
"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.