Fix typing hints breaking due to function declarations being parsed before the class definition is added

This commit is contained in:
Maff 2019-05-21 20:43:00 +01:00
parent 0ef8f7182d
commit d7e7528c10
1 changed files with 4 additions and 3 deletions

View File

@ -152,6 +152,7 @@ class Py3CX:
pass pass
def __init__(self, tcx): def __init__(self, tcx):
self.tcx=tcx self.tcx=tcx
self.calllist=None
self.extlist=None self.extlist=None
def refresh_sysstat(self): def refresh_sysstat(self):
sysstat=self.tcx.rq.get('SystemStatus').json() sysstat=self.tcx.rq.get('SystemStatus').json()
@ -208,7 +209,7 @@ class Py3CX:
self.refresh_inroute() self.refresh_inroute()
self.refresh_sysstat() self.refresh_sysstat()
@property @property
def list_extensions(self) -> typing.List[Py3CX._Extension]: def list_extensions(self) -> typing.List['Py3CX._Extension']:
if self.extlist is None: if self.extlist is None:
self.extlist=ReadOnlyObject(self.tcx, api='ExtensionList') self.extlist=ReadOnlyObject(self.tcx, api='ExtensionList')
self.extlist.refresh() self.extlist.refresh()
@ -229,7 +230,7 @@ class Py3CX:
ret.append(this) ret.append(this)
return ret return ret
@property @property
def list_calls(self) -> typing.List[Py3CX._Call]: def list_calls(self) -> typing.List['Py3CX._Call']:
if self.calllist is None: if self.calllist is None:
self.calllist=ReadOnlyObject(self.tcx, api='activeCalls') self.calllist=ReadOnlyObject(self.tcx, api='activeCalls')
self.calllist.refresh() self.calllist.refresh()
@ -270,7 +271,7 @@ class Py3CX:
return False return False
return True return True
@property @property
def system(self) -> Py3CX._PhoneSystem: def system(self) -> 'Py3CX._PhoneSystem':
assert self.authenticated, "Py3CX not authenticated yet!" assert self.authenticated, "Py3CX not authenticated yet!"
if self.__tcxsystem is None: if self.__tcxsystem is None:
self.__tcxsystem=Py3CX._PhoneSystem(self) self.__tcxsystem=Py3CX._PhoneSystem(self)