fromrpython.rlibimportjitclassSignature(object):_immutable_=True_immutable_fields_=["argnames[*]"]__slots__=("argnames","varargname","kwargname")def__init__(self,argnames,varargname=None,kwargname=None):self.argnames=argnamesself.varargname=varargnameself.kwargname=kwargname@jit.elidabledeffind_argname(self,name):try:returnself.argnames.index(name)exceptValueError:return-1defnum_argnames(self):returnlen(self.argnames)defhas_vararg(self):returnself.varargnameisnotNonedefhas_kwarg(self):returnself.kwargnameisnotNonedefscope_length(self):scopelen=len(self.argnames)scopelen+=self.has_vararg()scopelen+=self.has_kwarg()returnscopelendefgetallvarnames(self):argnames=self.argnamesifself.varargnameisnotNone:argnames=argnames+[self.varargname]ifself.kwargnameisnotNone:argnames=argnames+[self.kwargname]returnargnamesdef__repr__(self):return"Signature(%r, %r, %r)"%(self.argnames,self.varargname,self.kwargname)def__eq__(self,other):ifnotisinstance(other,Signature):returnNotImplementedreturn(self.argnames==other.argnamesandself.varargname==other.varargnameandself.kwargname==other.kwargname)def__ne__(self,other):ifnotisinstance(other,Signature):returnNotImplementedreturnnotself==other# make it look tuply for its use in the annotatordef__len__(self):return3def__getitem__(self,i):ifi==0:returnself.argnamesifi==1:returnself.varargnameifi==2:returnself.kwargnameraiseIndexError