Skip to content

Commit

Permalink
flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blitzmann committed May 9, 2017
1 parent 42e64a6 commit 3de63c5
Show file tree
Hide file tree
Showing 32 changed files with 86 additions and 41 deletions.
4 changes: 1 addition & 3 deletions eos/db/gamedata/effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
# ===============================================================================

from sqlalchemy import Column, String, Integer, Boolean, Table, ForeignKey
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import mapper, synonym, relation, deferred
from sqlalchemy.orm import mapper, synonym, deferred

from eos.db import gamedata_meta
from eos.gamedata import Effect, ItemEffect
Expand All @@ -45,4 +44,3 @@
})

mapper(ItemEffect, typeeffects_table)

2 changes: 2 additions & 0 deletions eos/db/gamedata/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def getItems(lookfor, eager=None):
results.sort(key=lambda x: lookfor.index(x.ID))
return results


@cachedQuery(1, "lookfor")
def getAlphaClone(lookfor, eager=None):
if isinstance(lookfor, int):
Expand Down Expand Up @@ -359,6 +360,7 @@ def directAttributeRequest(itemIDs, attrIDs):
result = gamedata_session.execute(q).fetchall()
return result


def getRequiredFor(itemID, attrMapping):
Attribute1 = aliased(Attribute)
Attribute2 = aliased(Attribute)
Expand Down
1 change: 0 additions & 1 deletion eos/db/migrations/upgrade23.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ def upgrade(saveddata_engine):
saveddata_engine.execute("SELECT secStatus FROM characters LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN secStatus FLOAT;")

6 changes: 3 additions & 3 deletions eos/db/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ def __repr__(self):
)

mapper(ProjectedFit, projectedFits_table,
properties={
"_ProjectedFit__amount": projectedFits_table.c.amount,
}
properties={
"_ProjectedFit__amount": projectedFits_table.c.amount,
}
)

mapper(CommandFit, commandFits_table)
5 changes: 1 addition & 4 deletions eos/db/saveddata/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================

from sqlalchemy import Table, Column, Integer, ForeignKey, CheckConstraint, Boolean, DateTime, select
from sqlalchemy import Table, Column, Integer, ForeignKey, CheckConstraint, Boolean, DateTime
from sqlalchemy.orm import relation, mapper
import datetime

Expand All @@ -40,6 +40,3 @@

mapper(Module, modules_table,
properties={"owner": relation(Fit)})



2 changes: 2 additions & 0 deletions eos/effects/concordsecstatustankbonus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
type = "passive"


def handler(fit, src, context):

# Get pilot sec status bonus directly here, instead of going through the intermediary effects
Expand Down
2 changes: 2 additions & 0 deletions eos/effects/elitebonuscoveropswarpvelocity1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
# Used by:
# Ship: Pacifier
type = "passive"


def handler(fit, src, context):
fit.ship.boostItemAttr("warpSpeedMultiplier", src.getModifiedItemAttr("eliteBonusCoverOps1"), skill="Covert Ops")
2 changes: 2 additions & 0 deletions eos/effects/elitebonusreconwarpvelocity3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
# Used by:
# Ship: Enforcer
type = "passive"


def handler(fit, src, context):
fit.ship.boostItemAttr("warpSpeedMultiplier", src.getModifiedItemAttr("eliteBonusReconShip3"), skill="Recon Ships")
2 changes: 2 additions & 0 deletions eos/effects/elitereconstasiswebbonus1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
# Used by:
# Ship: Enforcer
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Stasis Web", "maxRange", src.getModifiedItemAttr("eliteBonusReconShip1"), skill="Recon Ships")
8 changes: 6 additions & 2 deletions eos/effects/shipbonusdreadnoughta1energywarfareamountbonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Used by:
# Ship: Chemosh
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "powerTransferAmount", src.getModifiedItemAttr("shipBonusDreadnoughtA1"), skill="Amarr Dreadnought")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Neutralizer", "energyNeutralizerAmount", src.getModifiedItemAttr("shipBonusDreadnoughtA1"), skill="Amarr Dreadnought")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu",
"powerTransferAmount", src.getModifiedItemAttr("shipBonusDreadnoughtA1"), skill="Amarr Dreadnought")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Neutralizer",
"energyNeutralizerAmount", src.getModifiedItemAttr("shipBonusDreadnoughtA1"), skill="Amarr Dreadnought")
5 changes: 4 additions & 1 deletion eos/effects/shipbonusdreadnoughtm1webrangebonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
# Used by:
# Ship: Chemosh
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Stasis Web", "maxRange", src.getModifiedItemAttr("shipBonusDreadnoughtM1"), skill="Minmatar Dreadnought")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Stasis Web",
"maxRange", src.getModifiedItemAttr("shipBonusDreadnoughtM1"), skill="Minmatar Dreadnought")
5 changes: 4 additions & 1 deletion eos/effects/shipbonusforceauxiliarya1nosferatudrainamount.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
# Used by:
# Ship: Dagon
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "powerTransferAmount", src.getModifiedItemAttr("shipBonusForceAuxiliaryA1"), skill="Amarr Carrier")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu",
"powerTransferAmount", src.getModifiedItemAttr("shipBonusForceAuxiliaryA1"), skill="Amarr Carrier")
8 changes: 6 additions & 2 deletions eos/effects/shipbonusforceauxiliarya1nosferaturangebonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Used by:
# Ship: Dagon
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "maxRange", src.getModifiedItemAttr("shipBonusForceAuxiliaryA1"), skill="Amarr Carrier")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "falloffEffectiveness", src.getModifiedItemAttr("shipBonusForceAuxiliaryA1"), skill="Amarr Carrier")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu",
"maxRange", src.getModifiedItemAttr("shipBonusForceAuxiliaryA1"), skill="Amarr Carrier")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu",
"falloffEffectiveness", src.getModifiedItemAttr("shipBonusForceAuxiliaryA1"), skill="Amarr Carrier")
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
# Used by:
# Ship: Dagon
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "duration", src.getModifiedItemAttr("shipBonusForceAuxiliaryM1"), skill="Minmatar Carrier")
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"),
"duration", src.getModifiedItemAttr("shipBonusForceAuxiliaryM1"), skill="Minmatar Carrier")
8 changes: 6 additions & 2 deletions eos/effects/shipbonusmedmissileflighttimecc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Used by:
# Ship: Enforcer
type = "passive"


def handler(fit, src, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Heavy Missiles"), "explosionDelay", src.getModifiedItemAttr("shipBonusCC2"), skill="Caldari Cruiser")
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Heavy Assault Missiles"), "explosionDelay", src.getModifiedItemAttr("shipBonusCC2"), skill="Caldari Cruiser")
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Heavy Missiles"),
"explosionDelay", src.getModifiedItemAttr("shipBonusCC2"), skill="Caldari Cruiser")
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Heavy Assault Missiles"),
"explosionDelay", src.getModifiedItemAttr("shipBonusCC2"), skill="Caldari Cruiser")
2 changes: 2 additions & 0 deletions eos/effects/shipbonusrole3capitalenergydamagebonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
# Ship: Chemosh
# Ship: Molok
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Capital Energy Turret"), "damageMultiplier", src.getModifiedItemAttr("shipBonusRole3"))
2 changes: 2 additions & 0 deletions eos/effects/shipbonusrole4nosferatucpubonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
# Ship: Dagon
# Ship: Rabisu
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "cpu", src.getModifiedItemAttr("shipBonusRole4"))
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
# Used by:
# Ship: Dagon
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Capital Remote Armor Repair Systems"), "power", src.getModifiedItemAttr("shipBonusRole5"))
8 changes: 6 additions & 2 deletions eos/effects/shipbonussmallmissileflighttimecf1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Used by:
# Ship: Pacifier
type = "passive"


def handler(fit, src, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Rockets"), "explosionDelay", src.getModifiedItemAttr("shipBonusCF"), skill="Caldari Frigate")
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Light Missiles"), "explosionDelay", src.getModifiedItemAttr("shipBonusCF"), skill="Caldari Frigate")
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Rockets"),
"explosionDelay", src.getModifiedItemAttr("shipBonusCF"), skill="Caldari Frigate")
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Light Missiles"),
"explosionDelay", src.getModifiedItemAttr("shipBonusCF"), skill="Caldari Frigate")
5 changes: 4 additions & 1 deletion eos/effects/shipbonussptrofmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
# Used by:
# Ship: Pacifier
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Projectile Turret"), "speed", src.getModifiedItemAttr("shipBonusMF"), skill="Minmatar Frigate")
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Projectile Turret"),
"speed", src.getModifiedItemAttr("shipBonusMF"), skill="Minmatar Frigate")
8 changes: 6 additions & 2 deletions eos/effects/shipbonustitana1energywarfareamountbonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Used by:
# Ship: Molok
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu", "powerTransferAmount", src.getModifiedItemAttr("shipBonusTitanA1"), skill="Amarr Titan")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Neutralizer", "energyNeutralizerAmount", src.getModifiedItemAttr("shipBonusTitanA1"), skill="Amarr Titan")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Nosferatu",
"powerTransferAmount", src.getModifiedItemAttr("shipBonusTitanA1"), skill="Amarr Titan")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Neutralizer",
"energyNeutralizerAmount", src.getModifiedItemAttr("shipBonusTitanA1"), skill="Amarr Titan")
5 changes: 4 additions & 1 deletion eos/effects/shipbonustitanm1webrangebonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
# Used by:
# Ship: Molok
type = "passive"


def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Stasis Web", "maxRange", src.getModifiedItemAttr("shipBonusTitanM1"), skill="Minmatar Titan")
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Stasis Web",
"maxRange", src.getModifiedItemAttr("shipBonusTitanM1"), skill="Minmatar Titan")
8 changes: 4 additions & 4 deletions eos/effects/shipmoduletrackingdisruptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
type = "projected", "active"


def handler(fit, module, context, *args, **kwargs):
def handler(fit, module, context, *args, **kwargs):
if "projected" in context:
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"),
"trackingSpeed", module.getModifiedItemAttr("trackingSpeedBonus"),
stackingPenalties=True, *args, **kwargs)
stackingPenalties=True, *args, **kwargs)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"),
"maxRange", module.getModifiedItemAttr("maxRangeBonus"),
stackingPenalties=True, *args, **kwargs)
stackingPenalties=True, *args, **kwargs)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Gunnery"),
"falloff", module.getModifiedItemAttr("falloffBonus"),
stackingPenalties=True, *args, **kwargs)
stackingPenalties=True, *args, **kwargs)
3 changes: 2 additions & 1 deletion eos/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ def apply_rel_listeners(target, context):
listen(rel, 'append', rel_listener)
listen(rel, 'remove', rel_listener)


listen(Fit, 'load', apply_rel_listeners)
listen(Module, 'load', apply_col_listeners)
listen(Drone, 'load', apply_col_listeners)
listen(Fighter, 'load', apply_col_listeners)
listen(Cargo, 'load', apply_col_listeners)
listen(Implant, 'load', apply_col_listeners)
listen(Booster, 'load', apply_col_listeners)
listen(Booster, 'load', apply_col_listeners)
2 changes: 1 addition & 1 deletion eos/saveddata/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def setLevel(self, level, persist=False):
if item.group.category.ID == 16: # Skill category
if level < rlevel:
skill = self.character.getSkill(item.ID)
#print "Removing skill: {}, Dependant level: {}, Required level: {}".format(skill, level, rlevel)
# print "Removing skill: {}, Dependant level: {}, Required level: {}".format(skill, level, rlevel)
skill.setLevel(None, persist)
pyfalog.debug("Strict Skill levels enabled, time to process {}: {}".format(self.item.ID, time.time() - start))

Expand Down
2 changes: 1 addition & 1 deletion eos/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def mode(self, mode):
@property
def modifiedCoalesce(self):
"""
This is a property that should get whichever date is available for the fit. @todo: migrate old timestamp data
This is a property that should get whichever date is available for the fit. @todo: migrate old timestamp data
and ensure created / modified are set in database to get rid of this
"""
return self.modified or self.created or datetime.datetime.fromtimestamp(self.timestamp)
Expand Down
2 changes: 1 addition & 1 deletion gui/itemStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def getFullSkillTree(self, parentSkill, parent, sbIconId):
else:
itemIcon = -1

grand = self.reqTree.AppendItem(child, "{}".format(item.name), itemIcon)
self.reqTree.AppendItem(child, "{}".format(item.name), itemIcon)


class ItemEffects(wx.Panel):
Expand Down
1 change: 0 additions & 1 deletion gui/mainFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import sys
import os.path
from logbook import Logger
import datetime

import sqlalchemy
# noinspection PyPackageRequirements
Expand Down
6 changes: 3 additions & 3 deletions gui/shipBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def OnBrowserSearchBoxEsc(self, event):
def OnResize(self, event):
self.Refresh()

def ToggleRecentShips(self, bool = None, emitEvent = True):
def ToggleRecentShips(self, bool=None, emitEvent=True):
# this is so janky. Need to revaluate pretty much entire ship browser. >.<
toggle = bool if bool is not None else not self.shipBrowser.recentFits

Expand Down Expand Up @@ -958,7 +958,7 @@ def searchStage(self, event):

def importStage(self, event):
"""
The import stage handles both displaying fits after importing as well as displaying recent fits. todo: need to
The import stage handles both displaying fits after importing as well as displaying recent fits. todo: need to
reconcile these two better into a more uniform function, right now hacked together to get working
"""
self.lpane.ShowLoading(False)
Expand Down Expand Up @@ -1946,7 +1946,7 @@ def DrawItem(self, mdc):
mdc.SetFont(self.fontNormal)

fitDate = self.timestamp.strftime("%m/%d/%Y %H:%M")
fitLocalDate = fitDate #"%d/%02d/%02d %02d:%02d" % (fitDate[0], fitDate[1], fitDate[2], fitDate[3], fitDate[4])
fitLocalDate = fitDate # "%d/%02d/%02d %02d:%02d" % (fitDate[0], fitDate[1], fitDate[2], fitDate[3], fitDate[4])
pfdate = drawUtils.GetPartialText(mdc, fitLocalDate,
self.toolbarx - self.textStartx - self.padding * 2 - self.thoverw)

Expand Down
2 changes: 1 addition & 1 deletion pyfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import re
import sys
import traceback
from imp import find_module
from optparse import AmbiguousOptionError, BadOptionError, OptionParser

from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, StreamHandler, TimedRotatingFileHandler, WARNING, \
Expand Down Expand Up @@ -359,6 +358,7 @@ def handleGUIException(exc_type, exc_value, exc_traceback):
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
try:
import requests
config.requestsVersion = requests.__version
except ImportError:
raise PreCheckException("Cannot import requests. You can download requests from https://pypi.python.org/pypi/requests.")

Expand Down
2 changes: 1 addition & 1 deletion service/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def exportText(self):
data += u"Skills required for {}:\n".format(item)
data += u"{}{}: {}\n".format(" " * s["indent"], s["skill"], int(s["level"]))
data += u"-" * 79 + "\n"
except Exception, e:
except Exception:
pass

return data
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ commands = py.test -vv --cov Pyfa tests/
[testenv:pep8]
deps = flake8
# 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=E121,E126,E127,E128,E203,E731 service gui eos utils config.py pyfa.py --max-line-length=165
commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py,floatspin.py --ignore=E121,E126,E127,E128,E203,E731 service gui eos utils config.py pyfa.py --max-line-length=165

0 comments on commit 3de63c5

Please sign in to comment.