diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 2632707c7..359ba6a0f 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -17,7 +17,6 @@ # along with eos. If not, see . # =============================================================================== -import copy import time from copy import deepcopy from itertools import chain @@ -645,7 +644,7 @@ class Fit(object): shadow = True # Don't inspect this, we genuinely want to reassign self # noinspection PyMethodFirstArgAssignment - self = copy.deepcopy(self) + self = deepcopy(self) logger.debug("Handling self projection - making shadow copy of fit. %r => %r", copied, self) # we delete the fit because when we copy a fit, flush() is # called to properly handle projection updates. However, we do @@ -1257,16 +1256,16 @@ class Fit(object): return True - def __deepcopy__(self, memo): - copy = Fit() + def __deepcopy__(self, memo=None): + copy_ship = Fit() # Character and owner are not copied - copy.character = self.__character - copy.owner = self.owner - copy.ship = deepcopy(self.ship, memo) - copy.name = "%s copy" % self.name - copy.damagePattern = self.damagePattern - copy.targetResists = self.targetResists - copy.notes = self.notes + copy_ship.character = self.__character + copy_ship.owner = self.owner + copy_ship.ship = deepcopy(self.ship) + copy_ship.name = "%s copy" % self.name + copy_ship.damagePattern = self.damagePattern + copy_ship.targetResists = self.targetResists + copy_ship.notes = self.notes toCopy = ( "modules", @@ -1280,17 +1279,17 @@ class Fit(object): "projectedFighters") for name in toCopy: orig = getattr(self, name) - c = getattr(copy, name) + c = getattr(copy_ship, name) for i in orig: - c.append(deepcopy(i, memo)) + c.append(deepcopy(i)) for fit in self.projectedFits: - copy.__projectedFits[fit.ID] = fit + copy_ship.__projectedFits[fit.ID] = fit # this bit is required -- see GH issue # 83 eos.db.saveddata_session.flush() eos.db.saveddata_session.refresh(fit) - return copy + return copy_ship def __repr__(self): return u"Fit(ID={}, ship={}, name={}) at {}".format( diff --git a/eos/saveddata/implantSet.py b/eos/saveddata/implantSet.py index 2daaaa3eb..ca0334fff 100644 --- a/eos/saveddata/implantSet.py +++ b/eos/saveddata/implantSet.py @@ -48,13 +48,13 @@ class ImplantSet(object): return out.strip() - def __deepcopy__(self, memo): + def __deepcopy__(self): copy = ImplantSet(self.name) copy.name = "%s copy" % self.name orig = getattr(self, 'implants') c = getattr(copy, 'implants') for i in orig: - c.append(deepcopy(i, memo)) + c.append(deepcopy(i)) return copy diff --git a/gui/builtinStatsViews/capacitorViewFull.py b/gui/builtinStatsViews/capacitorViewFull.py index 6dab28404..f85b35e4c 100644 --- a/gui/builtinStatsViews/capacitorViewFull.py +++ b/gui/builtinStatsViews/capacitorViewFull.py @@ -131,8 +131,8 @@ class CapacitorViewFull(StatsView): capStable = fit.capStable if fit is not None else False lblNameTime = "label%sCapacitorTime" lblNameState = "label%sCapacitorState" - if isinstance(capState, tuple): - t = "%.1f%%-%.1f%%" % capState + if isinstance(capState, tuple) and len(capState) >= 2: + t = ("{0}%-{1}%", capState[0], capState[1]) s = "" else: if capStable: diff --git a/gui/itemStats.py b/gui/itemStats.py index 9e4145fff..e14ecc27a 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -856,7 +856,7 @@ class ItemEffects(wx.Panel): elif 'wxMac' in wx.PlatformInfo: os.system("open " + file_) else: - subprocess.call(["xdg-open", file_]) + subprocess.call({"xdg-open": file_}) def RefreshValues(self, event): self.Freeze() diff --git a/service/eveapi.py b/service/eveapi.py index 67a238f47..d0bb067a7 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -346,19 +346,6 @@ class _Context(object): # perform arcane attribute majick trick return _Context(self._root, self._path + "/" + this, self.parameters) - def __call__(self, **kw): - if kw: - # specified keywords override contextual ones - for k, v in self.parameters.iteritems(): - if k not in kw: - kw[k] = v - else: - # no keywords provided, just update with contextual ones. - kw.update(self.parameters) - - # now let the root context handle it further - return self._root(self._path, **kw) - class _AuthContext(_Context): def character(self, characterID): diff --git a/service/prefetch.py b/service/prefetch.py index dda8a319f..06e6894c2 100644 --- a/service/prefetch.py +++ b/service/prefetch.py @@ -29,11 +29,6 @@ import logging logger = logging.getLogger(__name__) -# The following code does not belong here, however until we rebuild skeletons -# to include modified pyfa.py, this is the best place to put it. See GH issue -# #176 -# @ todo: move this to pyfa.py - # Make sure the saveddata db exists if config.savePath and not os.path.exists(config.savePath): os.mkdir(config.savePath) diff --git a/tox.ini b/tox.ini index 9e9d26985..adafb434a 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,5 @@ commands = py.test -vv --cov Pyfa tests/ [testenv:pep8] deps = flake8 -# TODO: Remove F class exceptions once all imports are fixed # TODO: Remove E731 and convert lambdas to defs commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E731 service gui eos utils config.py pyfa.py --max-line-length=165