8000 Refactoring: make the type of fullname str instead of Bogus[str] by JukkaL · Pull Request #14435 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Refactoring: make the type of fullname str instead of Bogus[str] #14435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Minor tweaks
  • Loading branch information
JukkaL committed Jan 13, 2023
commit 9ea5f03c5cdebb4a341626d5354cbb6ce333ba26
4 changes: 2 additions & 2 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def visit_call_expr_inner(self, e: CallExpr, allow_none_return: bool = False) ->
# get_method_hook() and get_method_signature_hook() will
# be invoked for these.
if (
fullname is None
not fullname
and isinstance(e.callee, MemberExpr)
and self.chk.has_type(e.callee.expr)
):
Expand Down Expand Up @@ -605,7 +605,7 @@ def method_fullname(self, object_type: Type, method_name: str) -> str | None:
elif isinstance(object_type, TupleType):
type_name = tuple_fallback(object_type).type.fullname

if type_name is not None:
if type_name:
return f"{type_name}.{method_name}"
else:
return None
Expand Down
2 changes: 1 addition & 1 deletion mypy/server/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def visit_assignment_stmt(self, o: AssignmentStmt) -> None:
fname = init.node.fullname
else:
fname = rvalue.callee.fullname
if fname is None:
if not fname:
return
for lv in o.lvalues:
if is 10000 instance(lv, RefExpr) and lv.fullname and lv.is_new_def:
Expand Down
2 changes: 1 addition & 1 deletion mypy/tvar_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def bind_existing(self, tvar_def: TypeVarLikeType) -> None:

def get_binding(self, item: str | SymbolTableNode) -> TypeVarLikeType | None:
fullname = item.fullname if isinstance(item, SymbolTableNode) else item
assert fullname is not None
assert fullname
if fullname in self.scope:
return self.scope[fullname]
elif self.parent is not None:
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ def load_global(self, expr: NameExpr) -> Value:
and isinstance(expr.node, TypeInfo)
and not self.is_synthetic_type(expr.node)
):
assert expr.fullname is not None
assert expr.fullname
return self.load_native_type_object(expr.fullname)
return self.load_global_str(expr.name, expr.line)

Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def load_type(builder: IRBuilder, typ: TypeInfo, line: int) -> Value:


def load_func(builder: IRBuilder, func_name: str, fullname: str | None, line: int) -> Value:
if fullname is not None and not fullname.startswith(builder.current_module):
if fullname and not fullname.startswith(builder.current_module):
# we're calling a function in a different module

# We can't use load_module_attr_by_fullname here because we need to load the function using
Expand Down
0