Fix a bunch of calls to functions that pass the wrong type of parameter, the wrong number, etc.
This commit is contained in:
@@ -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
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
1
tox.ini
1
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
|
||||
|
||||
Reference in New Issue
Block a user