Avoid using deprecated inspect.getargspec()

This commit is contained in:
Maurizio Porrato 2019-02-11 21:08:21 +00:00
parent 110297ffb8
commit e05c892eaf
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
from cmd import Cmd
from datetime import datetime, time
from inspect import getargspec
from inspect import signature, Signature
from shlex import shlex
from time import sleep
@ -133,9 +133,9 @@ class EufyIR(EufyRawIR):
def lexer(f):
def g(self, args):
argv = tuple(x.lower() for x in shlex(args))
s = getargspec(f)
maxargs = len(s.args or [])
minargs = maxargs - len(s.defaults or [])
s = signature(f)
maxargs = len(s.parameters)
minargs = len([x for _,x in s.parameters.items() if x.default is not Signature.empty])
if minargs <= len(argv) + 1 <= maxargs:
return f(self, *argv)
else: