8000 Support for `declared_type`, to give types to decorated functions by sixolet · Pull Request #3291 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Support for declared_type, to give types to decorated functions #3291

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

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
Oops errant prints
  • Loading branch information
sixolet committed May 1, 2017
commit 7bba6100377a2509e72d35a24545f3e17fb6226c
2 changes: 0 additions & 2 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2446,7 +2446,6 @@ def visit_decorator(self, dec: Decorator) -> None:
self.fail('"decorated_type" takes exactly one argument', d)
else:
dec.var.type = self.expr_to_analyzed_type(d.args[0])
print("Set type", dec.var.type)
elif (refers_to_fullname(d, 'typing.decorated_type') or
refers_to_fullname(d, 'mypy_extensions.decorated_type')):
self.fail('"decorated_type" must have a type as an argument', d)
Expand Down Expand Up @@ -3659,7 +3658,6 @@ def visit_decorator(self, dec: Decorator) -> None:
orig_sig = function_type(dec.func, self.builtin_type('function'))
sig.name = orig_sig.items()[0].name
dec.var.type = sig
print("Decorated var type of", dec.var.name(), "is now", dec.var.type)

def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
self.analyze(s.type)
Expand Down
0