Tox fixes

This commit is contained in:
Ebag333
2017-02-05 15:39:07 -08:00
parent 603a8acdfc
commit be66ff1eec
35 changed files with 75 additions and 63 deletions

View File

@@ -23,16 +23,20 @@ from sqlalchemy.orm import relation, mapper, synonym
from eos.db import gamedata_meta
from eos.types import AlphaClone, AlphaCloneSkill
alphaclones_table = Table("alphaClones", gamedata_meta,
Column("alphaCloneID", Integer, primary_key=True),
Column("alphaCloneName", String),
)
alphaclones_table = Table(
"alphaClones",
gamedata_meta,
Column("alphaCloneID", Integer, primary_key=True),
Column("alphaCloneName", String),
)
alphacloneskskills_table = Table("alphaCloneSkills", gamedata_meta,
Column("alphaCloneID", Integer, ForeignKey("alphaClones.alphaCloneID"), primary_key=True),
Column("typeID", Integer, primary_key=True),
Column("level", Integer),
)
alphacloneskskills_table = Table(
"alphaCloneSkills",
gamedata_meta,
Column("alphaCloneID", Integer, ForeignKey("alphaClones.alphaCloneID"), primary_key=True),
Column("typeID", Integer, primary_key=True),
Column("level", Integer),
)
mapper(AlphaClone, alphaclones_table,
properties={

View File

@@ -33,7 +33,7 @@ class DatabaseCleanup:
results = saveddata_engine.execute(query)
return results
except sqlalchemy.exc.DatabaseError:
logger.error("Failed to connect to database or error executing query:\n%s",query)
logger.error("Failed to connect to database or error executing query:\n%s", query)
return None
@staticmethod

View File

@@ -22,11 +22,8 @@ from sqlalchemy.sql import and_
from eos.db import saveddata_session, sd_lock
from eos.db.saveddata.fit import projectedFits_table
from eos.db.util import processEager, processWhere
from eos.db import saveddata_session, sd_lock
from eos.types import *
from eos.db.saveddata.fit import projectedFits_table
from sqlalchemy.sql import and_
import eos.config
configVal = getattr(eos.config, "saveddataCache", None)

View File

@@ -4,7 +4,8 @@
# Items from market group: Ammunition & Charges > Command Burst Charges (15 of 15)
type = "active"
def handler(fit, module, context):
for x in xrange(1, 4):
value = module.getModifiedChargeAttr("warfareBuff{}Multiplier".format(x))
module.multiplyItemAttr("warfareBuff{}Value".format(x), value)
module.multiplyItemAttr("warfareBuff{}Value".format(x), value)

View File

@@ -1,5 +1,7 @@
# Not used by any item
type = "passive"
def handler(fit, module, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command Specialist"),
"commandBonusHidden", module.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships")

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Rabisu
type = "passive"
def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("eliteBonusLogistics1"), skill="Logistics Cruisers")
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("eliteBonusLogistics1"), skill="Logistics Cruisers")

View File

@@ -5,8 +5,7 @@ type = "active", "projected"
def handler(fit, src, context):
if "projected" in context and (
(hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
multiplier = src.amountActive if hasattr(src, "amountActive") else 1
amount = src.getModifiedItemAttr("energyNeutralizerAmount")
time = src.getModifiedItemAttr("duration")

View File

@@ -4,6 +4,8 @@
# Modules named like: Drone Mining Augmentor (8 of 8)
# Skill: Ice Harvesting Drone Operation
type = "passive"
def handler(fit, src, context):
lvl = src.level if "skill" in context else 1
fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Operation"), "duration", src.getModifiedItemAttr("rofBonus") * lvl)

View File

@@ -3,9 +3,11 @@
# Used by:
# Skill: Mining Director
type = "passive"
def handler(fit, src, context):
lvl = src.level
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)

View File

@@ -13,6 +13,8 @@ which warfareBuffID to run (shouldn't need this right now, but better safe than
'''
type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -21,5 +23,3 @@ def handler(fit, module, context, **kwargs):
if id:
fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Information Command Burst I (2 of 2)
type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id:
fit.addCommandBonus(id, value, module, kwargs['effect'])
fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Mining Foreman Burst I (2 of 2)
type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id:
fit.addCommandBonus(id, value, module, kwargs['effect'])
fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Shield Command Burst I (2 of 2)
type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id:
fit.addCommandBonus(id, value, module, kwargs['effect'])
fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Skirmish Command Burst I (2 of 2)
type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id:
fit.addCommandBonus(id, value, module, kwargs['effect'])
fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -3,6 +3,8 @@
# Used by:
# Modules from group: Titan Phenomena Generator (4 of 4)
type = "active", "gang"
def handler(fit, module, context, **kwargs):
for x in xrange(1, 5):
if module.getModifiedItemAttr("warfareBuff{}ID".format(x)):
@@ -11,7 +13,3 @@ def handler(fit, module, context, **kwargs):
if id:
fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,7 +4,8 @@ runTime = "late"
def handler(fit, module, context):
if "projected" not in context: return
if "projected" not in context:
return
bonus = module.getModifiedItemAttr("structureDamageAmount")
duration = module.getModifiedItemAttr("duration") / 1000.0
fit.extraAttributes.increase("hullRepair", bonus / duration)

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Rabisu
type = "passive"
def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("roleBonusRepairRange"))
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("roleBonusRepairRange"))

View File

@@ -3,6 +3,8 @@
# Used by:
# Ship: Apostle
type = "passive"
def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4"), skill="Amarr Carrier")
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4"), skill="Amarr Carrier")

View File

@@ -11,5 +11,5 @@ def handler(fit, module, context):
fit.modules.filteredChargeMultiply(lambda mod: mod.charge.requiresSkill("Rockets") or mod.charge.requiresSkill("Light Missiles"),
"{}Damage".format(type),
1 / module.getModifiedItemAttr("modeDamageBonusPostDiv"),
stackingPenalties = True,
stackingPenalties=True,
penaltyGroup="postDiv")

View File

@@ -4,4 +4,3 @@ type = "passive"
def handler(fit, src, context):
fit.extraAttributes.increase("maxTargetsLockedFromSkills", src.getModifiedItemAttr("structureRigMaxTargetBonus"))

View File

@@ -148,10 +148,6 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def item(self):
return self.__item
@property
def charge(self):
return self.__charge
@property
def hasAmmo(self):
return self.charge is not None

View File

@@ -487,11 +487,9 @@ class Fit(object):
self.ship.boostItemAttr("armor%sDamageResonance" % damageType, value)
if warfareBuffID == 14: # Armor Burst: Rapid Repair: Repair Duration/Capacitor
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill(
"Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"),
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"),
"capacitorNeed", value)
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill(
"Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"), "duration",
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"), "duration",
value)
if warfareBuffID == 15: # Armor Burst: Armor Reinforcement: Armor HP
@@ -512,9 +510,8 @@ class Fit(object):
"scan%sStrengthBonus" % scanType, value,
stackingPenalties=True)
for attr in (
"missileVelocityBonus", "explosionDelayBonus", "aoeVelocityBonus", "falloffBonus",
"maxRangeBonus", "aoeCloudSizeBonus", "trackingSpeedBonus"):
for attr in ("missileVelocityBonus", "explosionDelayBonus", "aoeVelocityBonus", "falloffBonus",
"maxRangeBonus", "aoeCloudSizeBonus", "trackingSpeedBonus"):
self.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Weapon Disruptor",
attr, value)

View File

@@ -5,13 +5,13 @@ from gui.bitmapLoader import BitmapLoader
import gui.mainFrame
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest
from service.settings import CRESTSettings
from wx.lib.intctrl import IntCtrl
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest
class PFCrestPref(PreferenceView):
title = "CREST"

View File

@@ -127,7 +127,7 @@ class MiningYieldViewFull(StatsView):
def refreshPanel(self, fit):
# If we did anything intresting, we'd update our labels to reflect the new fit's stats here
stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, u"%s m\u00B3/s",None),
stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, u"%s m\u00B3/s", None),
("labelFullminingyieldDrone", lambda: fit.droneYield, 3, 0, 0, u"%s m\u00B3/s", None),
("labelFullminingyieldTotal", lambda: fit.totalYield, 3, 0, 0, u"%s m\u00B3/s", None))

View File

@@ -230,7 +230,7 @@ class FittingView(d.Display):
if row != -1 and row not in self.blanks:
data = wx.PyTextDataObject()
data.SetText("fitting:"+str(self.mods[row].modPosition))
data.SetText("fitting:" + str(self.mods[row].modPosition))
dropSource = wx.DropSource(self)
dropSource.SetData(data)
@@ -403,7 +403,7 @@ class FittingView(d.Display):
return
if clone and mod2.isEmpty:
sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition)
sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition)
else:
sFit.swapModules(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition)
@@ -503,7 +503,7 @@ class FittingView(d.Display):
itemContext = "Tactical Mode"
fullContext = (srcContext, itemContext)
if not srcContext in tuple(fCtxt[0] for fCtxt in contexts):
if srcContext not in tuple(fCtxt[0] for fCtxt in contexts):
contexts.append(fullContext)
selection.append(mod)

View File

@@ -4,9 +4,6 @@ import json
import wx
import requests
if not 'wxMac' in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3,0)):
from service.crest import Crest, CrestModes
from service.port import Port
from service.fit import Fit
@@ -16,6 +13,9 @@ from eos.db import getItem
import gui.display as d
import gui.globalEvents as GE
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest, CrestModes
class CrestFittings(wx.Frame):
def __init__(self, parent):

View File

@@ -19,7 +19,6 @@
import os
import logging
logger = logging.getLogger(__name__)
import wx
@@ -39,6 +38,9 @@ try:
mplImported = False
except ImportError:
enabled = False
logger = logging.getLogger(__name__)
if not enabled:
logger.info("Problems importing matplotlib; continuing without graphs")

View File

@@ -834,7 +834,6 @@ class ItemEffects(wx.Panel):
If effect file does not exist, create it
"""
import os
file_ = config.getPyfaPath(os.path.join("eos", "effects", "%s.py" % event.GetText().lower()))
if not os.path.isfile(file_):

View File

@@ -31,6 +31,7 @@ ItemSelected, ITEM_SELECTED = wx.lib.newevent.NewEvent()
RECENTLY_USED_MODULES = -2
MAX_RECENTLY_USED_MODULES = 20
class MetaButton(wx.ToggleButton):
def __init__(self, *args, **kwargs):
super(MetaButton, self).__init__(*args, **kwargs)
@@ -50,6 +51,7 @@ class MetaButton(wx.ToggleButton):
self.Enable(True)
self.SetValue(self.userSelected)
class MarketBrowser(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python
# ==============================================================================
# Copyright (C) 2010 Diego Duclos
#

View File

@@ -5,3 +5,4 @@ pytest-capturelog==0.7
coverage==4.2
coveralls==1.1
codecov
tox

View File

@@ -88,7 +88,7 @@ class CharacterImportThread(threading.Thread):
skill.getAttribute("typeID"),
skill.getAttribute("level"),
)
char = sCharacter.new(name+" (EVEMon)")
char = sCharacter.new(name + " (EVEMon)")
sCharacter.apiUpdateCharSheet(char.ID, skills)
except Exception, e:
logger.error("Exception on character import:")

View File

@@ -34,14 +34,13 @@ from eos import db
from service.fit import Fit as svcFit
import wx
from service.market import Market
from eos.types import State, Slot, Module, Cargo, Ship, Drone, Implant, Booster, Citadel, Fighter, Fit
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest
from service.market import Market
logger = logging.getLogger("pyfa.service.port")
try:
@@ -65,7 +64,7 @@ INV_FLAG_FIGHTER = 158
class Port(object):
instance = None
@classmethod
def getInstance(cls):
if cls.instance is None:
@@ -685,7 +684,7 @@ class Port(object):
elif entityState == "Inactive":
d.amountActive = 0
f.drones.append(d)
elif droneItem.category.name == "Fighter": # EFT saves fighter as drones
elif droneItem.category.name == "Fighter": # EFT saves fighter as drones
ft = Fighter(droneItem)
ft.amount = int(droneAmount) if ft.amount <= ft.fighterSquadronMaxSize else ft.fighterSquadronMaxSize
f.fighters.append(ft)

View File

@@ -26,9 +26,6 @@ try:
from urllib.parse import quote
except ImportError: # pragma: no cover
from urllib import quote
import logging
import re
import config
logger = logging.getLogger("pycrest.eve")
cache_re = re.compile(r'max-age=([0-9]+)')

View File

@@ -12,4 +12,4 @@ commands = py.test -vv --cov Pyfa tests/
[testenv:pep8]
deps = flake8
commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E127,E501,E731,F401,F403,F405 service gui eos utils config.py pyfa.py --max-line-length=130
commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E501,E731,F401,F403,F405 service gui eos utils config.py pyfa.py --max-line-length=130