-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Stubgen: split @abstractproperty #8066
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -647,11 +647,14 @@ def process_name_expr_decorator(self, expr: NameExpr, context: Decorator) -> boo | |
'asyncio.coroutines', | ||
'types'): | ||
self.add_coroutine_decorator(context.func, name, name) | ||
elif any(self.refers_to_fullname(name, target) | ||
for target in ('abc.abstractmethod', 'abc.abstractproperty')): | ||
elif self.refers_to_fullname(name, 'abc.abstractmethod'): | ||
self.add_decorator(name) | ||
self.import_tracker.require_name(name) | ||
is_abstract = True | ||
elif self.refers_to_fullname(name, 'abc.abstractproperty'): | ||
self.add_decorator('property') | ||
self.add_decorator('abc.abstractmethod') | ||
is_abstract = True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to be more specific about here. (The previous commit has incorrect tests) |
||
return is_abstract | ||
|
||
def refers_to_fullname(self, name: str, fullname: str) -> bool: | ||
|
@@ -674,8 +677,13 @@ def process_member_expr_decorator(self, expr: MemberExpr, context: Decorator) -> | |
(expr.expr.name == 'abc' or | ||
self.import_tracker.reverse_alias.get('abc')) and | ||
expr.name in ('abstractmethod', 'abstractproperty')): | ||
self.import_tracker.require_name(expr.expr.name) | ||
self.add_decorator('%s.%s' % (expr.expr.name, expr.name)) | ||
if expr.name == 'abstractproperty': | ||
self.import_tracker.require_name(expr.expr.name) | ||
self.add_decorator('%s' % ('property')) | ||
self.add_decorator('%s.%s' % (expr.expr.name, 'abstractmethod')) | ||
else: | ||
self.import_tracker.require_name(expr.expr.name) | ||
self.add_decorator('%s.%s' % (expr.expr.name, expr.name)) | ||
is_abstract = True | ||
elif expr.name == 'coroutine': | ||
if (isinstance(expr.expr, MemberExpr) and | ||
|
Uh oh!
There was an error while loading. Please reload this page.