8000 Fix --warn-return-any for NotImplemented by drtyrsa · Pull Request #4545 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix --warn-return-any for NotImplemented #4545

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 3 commits into from
Feb 6, 2018
Merged
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
Reformat a long condition
It's okay to move 'and' to the start of the next line.
  • Loading branch information
gvanrossum authored Feb 6, 2018
commit a8ac19839e107c495781dc607c91f0c137e6811a
8 changes: 4 additions & 4 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2180,10 +2180,10 @@ def check_return_stmt(self, s: ReturnStmt) -> None:
if isinstance(typ, AnyType):
# (Unless you asked to be warned in that case, and the
# function is not declared to return Any)
if (self.options.warn_return_any and not self.current_node_deferred and
not is_proper_subtype(AnyType(TypeOfAny.special_form),
return_type) and
not (defn.name() in BINARY_MAGIC_METHODS and
if (self.options.warn_return_any
and not self.current_node_deferred
and not is_proper_subtype(AnyType(TypeOfAny.special_form), return_type)
and not (defn.name() in BINARY_MAGIC_METHODS and
is_literal_not_implemented(s.expr))):
self.msg.incorrectly_returning_any(return_type, s)
return
Expand Down
0