iPython indexer infinite loop and crash

This commit is contained in:
Eriks Karls 2019-10-14 12:54:59 +03:00
parent 07c8881092
commit ca65a1ffe1
2 changed files with 58 additions and 61 deletions

View File

@ -99,14 +99,11 @@ class Citizen(classes.CitizenAPI):
@property @property
def __dict__(self): def __dict__(self):
ret = {} ret = super().__dict__
for key in dir(self):
if not key.startswith('_') and not callable(getattr(self, key)):
ret[key] = getattr(self, key)
ret.pop('reporter', None) ret.pop('reporter', None)
ret.pop('stop_threads', None) ret.pop('stop_threads', None)
ret.pop('_Citizen__last_war_update_data', None) ret.pop('_Citizen__last_war_update_data', None)
ret.update(all_battles=self.all_battles) # ret.update(all_battles=self.all_battles)
return ret return ret

View File

@ -161,13 +161,13 @@ class MyCompanies:
raise ErepublikException("Wrong function call") raise ErepublikException("Wrong function call")
@property # @property
def __dict__(self): # def __dict__(self):
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_'): # if not key.startswith('_'):
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class SlowRequests(Session): class SlowRequests(Session):
@ -297,13 +297,13 @@ class Config:
def wt(self): def wt(self):
return self.work and self.train return self.work and self.train
@property # @property
def __dict__(self) -> Dict[str, Union[bool, str, List[str]]]: # def __dict__(self) -> Dict[str, Union[bool, str, List[str]]]:
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_') and key not in ['email', 'password']: # if not key.startswith('_') and key not in ['email', 'password']:
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class Energy: class Energy:
@ -350,13 +350,13 @@ class Energy:
def available(self): def available(self):
return self.recovered + self.recoverable return self.recovered + self.recoverable
@property # @property
def __dict__(self): # def __dict__(self):
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_'): # if not key.startswith('_'):
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class Details(object): class Details(object):
@ -402,13 +402,13 @@ class Details(object):
next_level_up = (1 + (self.xp // 10)) * 10 next_level_up = (1 + (self.xp // 10)) * 10
return next_level_up - self.xp return next_level_up - self.xp
@property # @property
def __dict__(self): # def __dict__(self):
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_'): # if not key.startswith('_'):
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class Politics: class Politics:
@ -420,13 +420,13 @@ class Politics:
is_congressman: bool = False is_congressman: bool = False
is_country_president: bool = False is_country_president: bool = False
@property # @property
def __dict__(self): # def __dict__(self):
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_'): # if not key.startswith('_'):
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class House(object): class House(object):
@ -1014,13 +1014,13 @@ class BattleSide:
self.allies = [int(ally) for ally in allies] self.allies = [int(ally) for ally in allies]
self.deployed = [int(ally) for ally in deployed] self.deployed = [int(ally) for ally in deployed]
@property # @property
def __dict__(self): # def __dict__(self):
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_'): # if not key.startswith('_'):
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class BattleDivision: class BattleDivision:
@ -1039,13 +1039,13 @@ class BattleDivision:
self.dom_pts = dict({"inv": inv_pts, "def": def_pts}) self.dom_pts = dict({"inv": inv_pts, "def": def_pts})
self.wall = dict({"for": wall_for, "dom": wall_dom}) self.wall = dict({"for": wall_for, "dom": wall_dom})
@property # @property
def __dict__(self): # def __dict__(self):
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_'): # if not key.startswith('_'):
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class Battle(object): class Battle(object):
@ -1107,13 +1107,13 @@ class Battle(object):
self.id, utils.COUNTRIES[self.invader.id], utils.COUNTRIES[self.defender.id], self.zone_id, time_part self.id, utils.COUNTRIES[self.invader.id], utils.COUNTRIES[self.defender.id], self.zone_id, time_part
) )
@property # @property
def __dict__(self): # def __dict__(self):
ret = {} # ret = {}
for key in dir(self): # for key in dir(self):
if not key.startswith('_'): # if not key.startswith('_'):
ret[key] = getattr(self, key) # ret[key] = getattr(self, key)
return ret # return ret
class EnergyToFight: class EnergyToFight: