Skip to content

Commit

Permalink
Fix a bunch of calls to functions that pass the wrong type of paramet…
Browse files Browse the repository at this point in the history
…er, the wrong number, etc.
  • Loading branch information
Ebag333 committed Feb 9, 2017
1 parent 3b91ec8 commit 7a2feb9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 39 deletions.
29 changes: 14 additions & 15 deletions eos/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================

import copy
import time
from copy import deepcopy
from itertools import chain
Expand Down Expand Up @@ -645,7 +644,7 @@ def calculateModifiedAttributes(self, targetFit=None, withBoosters=False, dirtyS
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
Expand Down Expand Up @@ -1257,16 +1256,16 @@ def fits(self):

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",
Expand All @@ -1280,17 +1279,17 @@ def __deepcopy__(self, memo):
"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(
Expand Down
4 changes: 2 additions & 2 deletions eos/saveddata/implantSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def exportSets(cls, *sets):

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
4 changes: 2 additions & 2 deletions gui/builtinStatsViews/capacitorViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def refreshPanel(self, fit):
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:
Expand Down
2 changes: 1 addition & 1 deletion gui/itemStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ def OnRightClick(self, event):
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()
Expand Down
13 changes: 0 additions & 13 deletions service/eveapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,19 +346,6 @@ def __getattr__(self, this):
# 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):
Expand Down
5 changes: 0 additions & 5 deletions service/prefetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@

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)
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7a2feb9

Please sign in to comment.