Skip to content

Commit

Permalink
delete redundant references
Browse files Browse the repository at this point in the history
  • Loading branch information
dg-pb committed Jun 25, 2024
1 parent 49b8c71 commit bc1fdbd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Lib/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def reduce(function, sequence, initial=_initial_missing):
################################################################################


class __PlaceholderTypeBase:
class PlaceholderTypeBase:
"""The type of the Placeholder singleton.
Used as a placeholder for partial arguments.
Expand All @@ -296,15 +296,16 @@ def __repr__(self):
def __reduce__(self):
return 'Placeholder'

def __placeholder_init_subclass__(cls, *args, **kwargs):
def placeholder_init_subclass(cls, *args, **kwargs):
raise TypeError(f"type '{cls.__name__}' is not an acceptable base type")

Placeholder = type(
'PlaceholderType',
(__PlaceholderTypeBase,),
{'__slots__': (), '__init_subclass__': __placeholder_init_subclass__}
(PlaceholderTypeBase,),
{'__slots__': (), '__init_subclass__': placeholder_init_subclass}
)()

del PlaceholderTypeBase, placeholder_init_subclass

def _partial_prepare_new(cls, func, args, keywords):
if args:
Expand Down Expand Up @@ -338,7 +339,6 @@ def _partial_prepare_new(cls, func, args, keywords):
func = func.func
return func, args, keywords, phcount


def _partial_prepare_call(self, args, keywords):
pto_phcount = self.placeholder_count
pto_args = self.args
Expand All @@ -360,7 +360,6 @@ def _partial_prepare_call(self, args, keywords):
keywords = {**self.keywords, **keywords}
return pto_args, args, keywords


def _partial_repr(self):
cls = type(self)
module = cls.__module__
Expand All @@ -370,7 +369,6 @@ def _partial_repr(self):
args.extend(f"{k}={v!r}" for k, v in self.keywords.items())
return f"{module}.{qualname}({', '.join(args)})"


# Purely functional, no descriptor behaviour
class partial:
"""New function with partial application of the given arguments
Expand Down

0 comments on commit bc1fdbd

Please sign in to comment.