Skip to content

Commit

Permalink
Deprecate passing doc to PartialFunction (#1456)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Mueller <[email protected]>
  • Loading branch information
DanielNoord and cdce8p authored Mar 9, 2022
1 parent 0aa7c39 commit 9aa1228
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions astroid/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import sys
from typing import TYPE_CHECKING

from astroid import bases, util
from astroid import bases, decorators, util
from astroid.exceptions import (
AttributeInferenceError,
InferenceError,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9aa1228

Please sign in to comment.