diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-03-09 21:51:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 21:51:35 +0100 |
commit | 9aa1228d6294a9de72f6becac0eb1e825fee0e6b (patch) | |
tree | b2ae66b316a8a9545655e66a44b36843d1fe0ea9 /astroid/objects.py | |
parent | 0aa7c393b1f3df249c83d49abab6c0f8f5feae02 (diff) | |
download | astroid-git-9aa1228d6294a9de72f6becac0eb1e825fee0e6b.tar.gz |
Deprecate passing ``doc`` to ``PartialFunction`` (#1456)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'astroid/objects.py')
-rw-r--r-- | astroid/objects.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/astroid/objects.py b/astroid/objects.py index 4b387c28..37ab87d3 100644 --- a/astroid/objects.py +++ b/astroid/objects.py @@ -25,7 +25,7 @@ leads to an inferred FrozenSet: import sys from typing import TYPE_CHECKING -from astroid import bases, util +from astroid import bases, decorators, util from astroid.exceptions import ( AttributeInferenceError, InferenceError, @@ -266,11 +266,14 @@ class DictValues(bases.Proxy): class PartialFunction(scoped_nodes.FunctionDef): """A class representing partial function obtained via functools.partial""" + @decorators.deprecate_arguments(doc="Use the postinit arg 'doc_node' instead") def __init__( self, call, name=None, doc=None, lineno=None, col_offset=None, parent=None ): # TODO: Pass end_lineno and end_col_offset as well - super().__init__(name, doc, lineno, col_offset, parent=None) + super().__init__(name, lineno=lineno, col_offset=col_offset, parent=None) + # Assigned directly to prevent triggering the DeprecationWarning. + self._doc = doc # A typical FunctionDef automatically adds its name to the parent scope, # but a partial should not, so defer setting parent until after init self.parent = parent |