Skip to content

Replace deprecated inspect.getargspec with getfullargspec #26

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions python_actr/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def __init__(self,system,name,func):
self.system=system
self.name=name
self.base_utility=0
a,va,hk,d=inspect.getargspec(func)
self.keys=a
spec = inspect.getfullargspec(func)
self.keys = spec.args
patterns={}
for i,name in enumerate(a[:]):
for i,name in enumerate(spec.args[:]):
if name=='utility':
self.base_utility=d[i]
del a[i]
self.base_utility = spec.defaults[i]
del spec.args[i]
else:
patterns[name]=d[i]
patterns[name] = spec.defaults[i]
self.pattern_specs=patterns
self.pattern=pattern.Pattern(patterns)
self.bound=None
Expand Down Expand Up @@ -58,12 +58,12 @@ def _convert_info(self,objects,methods):
self._initializers=[]
self._keys_used=Set()
for k,v in list(methods.items()):
a,va,hk,d=inspect.getargspec(v)
if va is None and hk is None:
if d is None and len(a)==0:
spec = inspect.getfullargspec(v)
if spec.varargs is None and spec.varkw is None:
if spec.defaults is None and len(spec.args) == 0:
p=Production(self,k,v)
self._initializers.append(p)
if d is not None and a is not None and len(a)==len(d):
if spec.defaults is not None and spec.args is not None and len(spec.args) == len(spec.defaults):
p=Production(self,k,v)
self._keys_used.update(p.keys)
self._productions.append(p)
Expand Down