Skip to content

Commit

Permalink
Fix legacy getargspec usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jan 3, 2023
1 parent fa18d32 commit 097245c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions law/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from collections import OrderedDict
from contextlib import contextmanager
from abc import ABCMeta, abstractmethod
from inspect import getargspec
import inspect

import luigi
import six
Expand All @@ -32,6 +32,8 @@

logger = get_logger(__name__)

getfullargspec = inspect.getfullargspec if six.PY3 else inspect.getargspec


class BaseRegister(luigi.task_register.Register):

Expand Down Expand Up @@ -257,9 +259,9 @@ def live_task_id(self):
# create a temporary dictionary of param_kwargs that is patched for the duration of the
# call to create the string representation of the parameters
param_kwargs = {attr: getattr(self, attr) for attr in self.param_kwargs}
# only_public was introduced in 2.8.0, so check if that arg exists
# only_public was introduced in luigi 2.8.0, so check if that arg exists
str_params_kwargs = {"only_significant": True}
if "only_public" in getargspec(self.to_str_params).args:
if "only_public" in getfullargspec(self.to_str_params).args:
str_params_kwargs["only_public"] = True
with patch_object(self, "param_kwargs", param_kwargs):
str_params = self.to_str_params(**str_params_kwargs)
Expand Down

0 comments on commit 097245c

Please sign in to comment.