diff --git a/eos/config.py b/eos/config.py index b8454b1f2..75f797d9c 100644 --- a/eos/config.py +++ b/eos/config.py @@ -3,6 +3,7 @@ from os.path import realpath, join, dirname, abspath from logbook import Logger import os + istravis = os.environ.get('TRAVIS') == 'true' pyfalog = Logger(__name__) diff --git a/eos/db/__init__.py b/eos/db/__init__.py index 680c67e1e..2647d9d10 100644 --- a/eos/db/__init__.py +++ b/eos/db/__init__.py @@ -47,7 +47,7 @@ gamedata_session = sessionmaker(bind=gamedata_engine, autoflush=False, expire_on # game db because we haven't reached gamedata_meta.create_all() try: config.gamedata_version = gamedata_session.execute( - "SELECT `field_value` FROM `metadata` WHERE `field_name` LIKE 'client_build'" + "SELECT `field_value` FROM `metadata` WHERE `field_name` LIKE 'client_build'" ).fetchone()[0] except Exception as e: pyfalog.warning("Missing gamedata version.") @@ -74,7 +74,8 @@ sd_lock = threading.Lock() # noinspection PyPep8 from eos.db.gamedata import alphaClones, attribute, category, effect, group, icon, item, marketGroup, metaData, metaGroup, queries, traits, unit # noinspection PyPep8 -from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, miscData, module, override, price, queries, skill, targetResists, user +from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, \ + miscData, module, override, price, queries, skill, targetResists, user # Import queries # noinspection PyPep8 diff --git a/eos/db/gamedata/alphaClones.py b/eos/db/gamedata/alphaClones.py index d18130358..970c3c31b 100644 --- a/eos/db/gamedata/alphaClones.py +++ b/eos/db/gamedata/alphaClones.py @@ -40,11 +40,11 @@ alphacloneskskills_table = Table( mapper(AlphaClone, alphaclones_table, properties={ - "ID": synonym("alphaCloneID"), + "ID" : synonym("alphaCloneID"), "skills": relation( - AlphaCloneSkill, - cascade="all,delete-orphan", - backref="clone") + AlphaCloneSkill, + cascade="all,delete-orphan", + backref="clone") }) mapper(AlphaCloneSkill, alphacloneskskills_table) diff --git a/eos/db/gamedata/attribute.py b/eos/db/gamedata/attribute.py index ac2f73978..20de4d1a9 100644 --- a/eos/db/gamedata/attribute.py +++ b/eos/db/gamedata/attribute.py @@ -45,11 +45,13 @@ mapper(Attribute, typeattributes_table, properties={"info": relation(AttributeInfo, lazy=False)}) mapper(AttributeInfo, attributes_table, - properties={"icon": relation(Icon), - "unit": relation(Unit), - "ID": synonym("attributeID"), - "name": synonym("attributeName"), - "description": deferred(attributes_table.c.description)}) + properties={ + "icon" : relation(Icon), + "unit" : relation(Unit), + "ID" : synonym("attributeID"), + "name" : synonym("attributeName"), + "description": deferred(attributes_table.c.description) + }) Attribute.ID = association_proxy("info", "attributeID") Attribute.name = association_proxy("info", "attributeName") diff --git a/eos/db/gamedata/category.py b/eos/db/gamedata/category.py index 884f93666..0fd84da79 100644 --- a/eos/db/gamedata/category.py +++ b/eos/db/gamedata/category.py @@ -31,7 +31,9 @@ categories_table = Table("invcategories", gamedata_meta, Column("iconID", Integer, ForeignKey("icons.iconID"))) mapper(Category, categories_table, - properties={"icon": relation(Icon), - "ID": synonym("categoryID"), - "name": synonym("categoryName"), - "description": deferred(categories_table.c.description)}) + properties={ + "icon" : relation(Icon), + "ID" : synonym("categoryID"), + "name" : synonym("categoryName"), + "description": deferred(categories_table.c.description) + }) diff --git a/eos/db/gamedata/effect.py b/eos/db/gamedata/effect.py index d766b29eb..861c3fa64 100644 --- a/eos/db/gamedata/effect.py +++ b/eos/db/gamedata/effect.py @@ -37,13 +37,17 @@ effects_table = Table("dgmeffects", gamedata_meta, Column("isOffensive", Boolean)) mapper(EffectInfo, effects_table, - properties={"ID": synonym("effectID"), - "name": synonym("effectName"), - "description": deferred(effects_table.c.description)}) + properties={ + "ID" : synonym("effectID"), + "name" : synonym("effectName"), + "description": deferred(effects_table.c.description) + }) mapper(Effect, typeeffects_table, - properties={"ID": synonym("effectID"), - "info": relation(EffectInfo, lazy=False)}) + properties={ + "ID" : synonym("effectID"), + "info": relation(EffectInfo, lazy=False) + }) Effect.name = association_proxy("info", "name") Effect.description = association_proxy("info", "description") diff --git a/eos/db/gamedata/group.py b/eos/db/gamedata/group.py index cd6763923..4373b2ca5 100644 --- a/eos/db/gamedata/group.py +++ b/eos/db/gamedata/group.py @@ -32,8 +32,10 @@ groups_table = Table("invgroups", gamedata_meta, Column("iconID", Integer, ForeignKey("icons.iconID"))) mapper(Group, groups_table, - properties={"category": relation(Category, backref="groups"), - "icon": relation(Icon), - "ID": synonym("groupID"), - "name": synonym("groupName"), - "description": deferred(groups_table.c.description)}) + properties={ + "category" : relation(Category, backref="groups"), + "icon" : relation(Icon), + "ID" : synonym("groupID"), + "name" : synonym("groupName"), + "description": deferred(groups_table.c.description) + }) diff --git a/eos/db/gamedata/icon.py b/eos/db/gamedata/icon.py index 396c5c582..9fd41605a 100644 --- a/eos/db/gamedata/icon.py +++ b/eos/db/gamedata/icon.py @@ -29,5 +29,7 @@ icons_table = Table("icons", gamedata_meta, Column("iconFile", String)) mapper(Icon, icons_table, - properties={"ID": synonym("iconID"), - "description": deferred(icons_table.c.description)}) + properties={ + "ID" : synonym("iconID"), + "description": deferred(icons_table.c.description) + }) diff --git a/eos/db/gamedata/item.py b/eos/db/gamedata/item.py index da43f9ef2..1e5d7421a 100644 --- a/eos/db/gamedata/item.py +++ b/eos/db/gamedata/item.py @@ -43,19 +43,20 @@ from .metaGroup import metatypes_table # noqa from .traits import traits_table # noqa mapper(Item, items_table, - properties={"group": relation(Group, backref="items"), - "icon": relation(Icon), - "_Item__attributes": relation(Attribute, collection_class=attribute_mapped_collection('name')), - "effects": relation(Effect, collection_class=attribute_mapped_collection('name')), - "metaGroup": relation(MetaType, + properties={ + "group" : relation(Group, backref="items"), + "icon" : relation(Icon), + "_Item__attributes": relation(Attribute, collection_class=attribute_mapped_collection('name')), + "effects" : relation(Effect, collection_class=attribute_mapped_collection('name')), + "metaGroup" : relation(MetaType, primaryjoin=metatypes_table.c.typeID == items_table.c.typeID, uselist=False), - "ID": synonym("typeID"), - "name": synonym("typeName"), - "description": deferred(items_table.c.description), - "traits": relation(Traits, - primaryjoin=traits_table.c.typeID == items_table.c.typeID, - uselist=False) - }) + "ID" : synonym("typeID"), + "name" : synonym("typeName"), + "description" : deferred(items_table.c.description), + "traits" : relation(Traits, + primaryjoin=traits_table.c.typeID == items_table.c.typeID, + uselist=False) + }) Item.category = association_proxy("group", "category") diff --git a/eos/db/gamedata/marketGroup.py b/eos/db/gamedata/marketGroup.py index c107c486d..faf88780b 100644 --- a/eos/db/gamedata/marketGroup.py +++ b/eos/db/gamedata/marketGroup.py @@ -33,10 +33,12 @@ marketgroups_table = Table("invmarketgroups", gamedata_meta, Column("iconID", Integer, ForeignKey("icons.iconID"))) mapper(MarketGroup, marketgroups_table, - properties={"items": relation(Item, backref="marketGroup"), - "parent": relation(MarketGroup, backref="children", - remote_side=[marketgroups_table.c.marketGroupID]), - "icon": relation(Icon), - "ID": synonym("marketGroupID"), - "name": synonym("marketGroupName"), - "description": deferred(marketgroups_table.c.description)}) + properties={ + "items" : relation(Item, backref="marketGroup"), + "parent" : relation(MarketGroup, backref="children", + remote_side=[marketgroups_table.c.marketGroupID]), + "icon" : relation(Icon), + "ID" : synonym("marketGroupID"), + "name" : synonym("marketGroupName"), + "description": deferred(marketgroups_table.c.description) + }) diff --git a/eos/db/gamedata/metaGroup.py b/eos/db/gamedata/metaGroup.py index 713e8a2c4..3c044a1cf 100644 --- a/eos/db/gamedata/metaGroup.py +++ b/eos/db/gamedata/metaGroup.py @@ -35,13 +35,17 @@ metatypes_table = Table("invmetatypes", gamedata_meta, Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID"))) mapper(MetaGroup, metagroups_table, - properties={"ID": synonym("metaGroupID"), - "name": synonym("metaGroupName")}) + properties={ + "ID" : synonym("metaGroupID"), + "name": synonym("metaGroupName") + }) mapper(MetaType, metatypes_table, - properties={"ID": synonym("metaGroupID"), - "parent": relation(Item, primaryjoin=metatypes_table.c.parentTypeID == items_table.c.typeID), - "items": relation(Item, primaryjoin=metatypes_table.c.typeID == items_table.c.typeID), - "info": relation(MetaGroup, lazy=False)}) + properties={ + "ID" : synonym("metaGroupID"), + "parent": relation(Item, primaryjoin=metatypes_table.c.parentTypeID == items_table.c.typeID), + "items" : relation(Item, primaryjoin=metatypes_table.c.typeID == items_table.c.typeID), + "info" : relation(MetaGroup, lazy=False) + }) MetaType.name = association_proxy("info", "name") diff --git a/eos/db/gamedata/queries.py b/eos/db/gamedata/queries.py index 673f1767f..30f51fe6b 100644 --- a/eos/db/gamedata/queries.py +++ b/eos/db/gamedata/queries.py @@ -152,7 +152,7 @@ def getCategory(lookfor, eager=None): category = gamedata_session.query(Category).get(lookfor) else: category = gamedata_session.query(Category).options(*processEager(eager)).filter( - Category.ID == lookfor).first() + Category.ID == lookfor).first() elif isinstance(lookfor, basestring): if lookfor in categoryNameMap: id = categoryNameMap[lookfor] @@ -160,11 +160,11 @@ def getCategory(lookfor, eager=None): category = gamedata_session.query(Category).get(id) else: category = gamedata_session.query(Category).options(*processEager(eager)).filter( - Category.ID == id).first() + Category.ID == id).first() else: # Category names are unique, so we can use first() instead of one() category = gamedata_session.query(Category).options(*processEager(eager)).filter( - Category.name == lookfor).first() + Category.name == lookfor).first() categoryNameMap[lookfor] = category.ID else: raise TypeError("Need integer or string as argument") @@ -181,7 +181,7 @@ def getMetaGroup(lookfor, eager=None): metaGroup = gamedata_session.query(MetaGroup).get(lookfor) else: metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter( - MetaGroup.ID == lookfor).first() + MetaGroup.ID == lookfor).first() elif isinstance(lookfor, basestring): if lookfor in metaGroupNameMap: id = metaGroupNameMap[lookfor] @@ -189,11 +189,11 @@ def getMetaGroup(lookfor, eager=None): metaGroup = gamedata_session.query(MetaGroup).get(id) else: metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter( - MetaGroup.ID == id).first() + MetaGroup.ID == id).first() else: # MetaGroup names are unique, so we can use first() instead of one() metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter( - MetaGroup.name == lookfor).first() + MetaGroup.name == lookfor).first() metaGroupNameMap[lookfor] = metaGroup.ID else: raise TypeError("Need integer or string as argument") @@ -207,7 +207,7 @@ def getMarketGroup(lookfor, eager=None): marketGroup = gamedata_session.query(MarketGroup).get(lookfor) else: marketGroup = gamedata_session.query(MarketGroup).options(*processEager(eager)).filter( - MarketGroup.ID == lookfor).first() + MarketGroup.ID == lookfor).first() else: raise TypeError("Need integer as argument") return marketGroup @@ -224,7 +224,7 @@ def getItemsByCategory(filter, where=None, eager=None): filter = processWhere(filter, where) return gamedata_session.query(Item).options(*processEager(eager)).join(Item.group, Group.category).filter( - filter).all() + filter).all() @cachedQuery(3, "where", "nameLike", "join") @@ -262,7 +262,7 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None): filter = processWhere(itemfilter, where) joinon = items_table.c.typeID == metatypes_table.c.typeID vars = gamedata_session.query(Item).options(*processEager(eager)).join((metatypes_table, joinon)).filter( - filter).all() + filter).all() if vars: return vars @@ -271,7 +271,7 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None): filter = processWhere(itemfilter, where) joinon = items_table.c.groupID == groups_table.c.groupID vars = gamedata_session.query(Item).options(*processEager(eager)).join((groups_table, joinon)).filter( - filter).all() + filter).all() return vars diff --git a/eos/db/gamedata/unit.py b/eos/db/gamedata/unit.py index 5c6556ef1..3fd49dac7 100644 --- a/eos/db/gamedata/unit.py +++ b/eos/db/gamedata/unit.py @@ -29,5 +29,7 @@ groups_table = Table("dgmunits", gamedata_meta, Column("displayName", String)) mapper(Unit, groups_table, - properties={"ID": synonym("unitID"), - "name": synonym("unitName")}) + properties={ + "ID" : synonym("unitID"), + "name": synonym("unitName") + }) diff --git a/eos/db/migrations/upgrade1.py b/eos/db/migrations/upgrade1.py index 5eb3478c6..22292dc4f 100644 --- a/eos/db/migrations/upgrade1.py +++ b/eos/db/migrations/upgrade1.py @@ -14,32 +14,32 @@ Migration 1 import sqlalchemy CONVERSIONS = { - 6135: [ # Scoped Cargo Scanner + 6135 : [ # Scoped Cargo Scanner 6133, # Interior Type-E Cargo Identifier ], - 6527: [ # Compact Ship Scanner + 6527 : [ # Compact Ship Scanner 6525, # Ta3 Perfunctory Vessel Probe 6529, # Speculative Ship Identifier I 6531, # Practical Type-E Ship Probe ], - 6569: [ # Scoped Survey Scanner + 6569 : [ # Scoped Survey Scanner 6567, # ML-3 Amphilotite Mining Probe 6571, # Rock-Scanning Sensor Array I 6573, # 'Dactyl' Type-E Asteroid Analyzer ], - 509: [ # 'Basic' Capacitor Flux Coil + 509 : [ # 'Basic' Capacitor Flux Coil 8163, # Partial Power Plant Manager: Capacitor Flux 8165, # Alpha Reactor Control: Capacitor Flux 8167, # Type-E Power Core Modification: Capacitor Flux 8169, # Marked Generator Refitting: Capacitor Flux ], - 8135: [ # Restrained Capacitor Flux Coil + 8135 : [ # Restrained Capacitor Flux Coil 8131, # Local Power Plant Manager: Capacitor Flux I ], - 8133: [ # Compact Capacitor Flux Coil + 8133 : [ # Compact Capacitor Flux Coil 8137, # Mark I Generator Refitting: Capacitor Flux ], - 3469: [ # Basic Co-Processor + 3469 : [ # Basic Co-Processor 8744, # Nanoelectrical Co-Processor 8743, # Nanomechanical CPU Enhancer 8746, # Quantum Co-Processor @@ -47,17 +47,17 @@ CONVERSIONS = { 15425, # Naiyon's Modified Co-Processor (never existed but convert # anyway as some fits may include it) ], - 8748: [ # Upgraded Co-Processor + 8748 : [ # Upgraded Co-Processor 8747, # Nanomechanical CPU Enhancer I 8750, # Quantum Co-Processor I 8749, # Photonic CPU Enhancer I ], - 1351: [ # Basic Reactor Control Unit + 1351 : [ # Basic Reactor Control Unit 8251, # Partial Power Plant Manager: Reaction Control 8253, # Alpha Reactor Control: Reaction Control 8257, # Marked Generator Refitting: Reaction Control ], - 8263: [ # Compact Reactor Control Unit + 8263 : [ # Compact Reactor Control Unit 8259, # Local Power Plant Manager: Reaction Control I 8265, # Mark I Generator Refitting: Reaction Control 8261, # Beta Reactor Control: Reaction Control I @@ -69,15 +69,15 @@ CONVERSIONS = { 31936: [ # Navy Micro Auxiliary Power Core 16543, # Micro 'Vigor' Core Augmentation ], - 8089: [ # Compact Light Missile Launcher + 8089 : [ # Compact Light Missile Launcher 8093, # Prototype 'Arbalest' Light Missile Launcher ], - 8091: [ # Ample Light Missile Launcher + 8091 : [ # Ample Light Missile Launcher 7993, # Experimental TE-2100 Light Missile Launcher ], # Surface Cargo Scanner I was removed from game, however no mention of # replacement module in patch notes. Morphing it to meta 0 module to be safe - 442: [ # Cargo Scanner I + 442 : [ # Cargo Scanner I 6129, # Surface Cargo Scanner I ] } diff --git a/eos/db/migrations/upgrade11.py b/eos/db/migrations/upgrade11.py index 475537b01..2811cf5be 100644 --- a/eos/db/migrations/upgrade11.py +++ b/eos/db/migrations/upgrade11.py @@ -14,7 +14,7 @@ CONVERSIONS = { 22947: ( # 'Beatnik' Small Remote Armor Repairer 23414, # 'Brotherhood' Small Remote Armor Repairer ), - 8295: ( # Type-D Restrained Shield Flux Coil + 8295 : ( # Type-D Restrained Shield Flux Coil 8293, # Beta Reactor Control: Shield Flux I ), 16499: ( # Heavy Knave Scoped Energy Nosferatu @@ -29,13 +29,13 @@ CONVERSIONS = { 16447: ( # Medium Solace Scoped Remote Armor Repairer 16445, # Medium 'Arup' Remote Armor Repairer ), - 508: ( # 'Basic' Shield Flux Coil + 508 : ( # 'Basic' Shield Flux Coil 8325, # Alpha Reactor Shield Flux 8329, # Marked Generator Refitting: Shield Flux 8323, # Partial Power Plant Manager: Shield Flux 8327, # Type-E Power Core Modification: Shield Flux ), - 1419: ( # 'Basic' Shield Power Relay + 1419 : ( # 'Basic' Shield Power Relay 8341, # Alpha Reactor Shield Power Relay 8345, # Marked Generator Refitting: Shield Power Relay 8339, # Partial Power Plant Manager: Shield Power Relay @@ -47,57 +47,57 @@ CONVERSIONS = { 16505: ( # Medium Ghoul Compact Energy Nosferatu 16511, # Medium Diminishing Power System Drain I ), - 8297: ( # Mark I Compact Shield Flux Coil + 8297 : ( # Mark I Compact Shield Flux Coil 8291, # Local Power Plant Manager: Reaction Shield Flux I ), 16455: ( # Large Solace Scoped Remote Armor Repairer 16453, # Large 'Arup' Remote Armor Repairer ), - 6485: ( # M51 Benefactor Compact Shield Recharger + 6485 : ( # M51 Benefactor Compact Shield Recharger 6491, # Passive Barrier Compensator I 6489, # 'Benefactor' Ward Reconstructor 6487, # Supplemental Screen Generator I ), - 5137: ( # Small Knave Scoped Energy Nosferatu + 5137 : ( # Small Knave Scoped Energy Nosferatu 5135, # E5 Prototype Energy Vampire ), - 8579: ( # Medium Murky Compact Remote Shield Booster + 8579 : ( # Medium Murky Compact Remote Shield Booster 8581, # Medium 'Atonement' Remote Shield Booster ), - 8531: ( # Small Murky Compact Remote Shield Booster + 8531 : ( # Small Murky Compact Remote Shield Booster 8533, # Small 'Atonement' Remote Shield Booster ), 16497: ( # Heavy Ghoul Compact Energy Nosferatu 16503, # Heavy Diminishing Power System Drain I ), - 4477: ( # Small Gremlin Compact Energy Neutralizer + 4477 : ( # Small Gremlin Compact Energy Neutralizer 4475, # Small Unstable Power Fluctuator I ), - 8337: ( # Mark I Compact Shield Power Relay + 8337 : ( # Mark I Compact Shield Power Relay 8331, # Local Power Plant Manager: Reaction Shield Power Relay I ), 23416: ( # 'Peace' Large Remote Armor Repairer 22951, # 'Pacifier' Large Remote Armor Repairer ), - 5141: ( # Small Ghoul Compact Energy Nosferatu + 5141 : ( # Small Ghoul Compact Energy Nosferatu 5139, # Small Diminishing Power System Drain I ), - 4471: ( # Small Infectious Scoped Energy Neutralizer + 4471 : ( # Small Infectious Scoped Energy Neutralizer 4473, # Small Rudimentary Energy Destabilizer I ), 16469: ( # Medium Infectious Scoped Energy Neutralizer 16465, # Medium Rudimentary Energy Destabilizer I ), - 8335: ( # Type-D Restrained Shield Power Relay + 8335 : ( # Type-D Restrained Shield Power Relay 8333, # Beta Reactor Control: Shield Power Relay I ), - 405: ( # 'Micro' Remote Shield Booster + 405 : ( # 'Micro' Remote Shield Booster 8631, # Micro Asymmetric Remote Shield Booster 8627, # Micro Murky Remote Shield Booster 8629, # Micro 'Atonement' Remote Shield Booster 8633, # Micro S95a Remote Shield Booster ), - 8635: ( # Large Murky Compact Remote Shield Booster + 8635 : ( # Large Murky Compact Remote Shield Booster 8637, # Large 'Atonement' Remote Shield Booster ), 16507: ( # Medium Knave Scoped Energy Nosferatu diff --git a/eos/db/migrations/upgrade12.py b/eos/db/migrations/upgrade12.py index 6e3a1d73b..59d6d08d9 100644 --- a/eos/db/migrations/upgrade12.py +++ b/eos/db/migrations/upgrade12.py @@ -13,26 +13,26 @@ CONVERSIONS = { 16461, # Multiphasic Bolt Array I 16463, # 'Pandemonium' Ballistic Enhancement ), - 5281: ( # Coadjunct Scoped Remote Sensor Booster + 5281 : ( # Coadjunct Scoped Remote Sensor Booster 7218, # Piercing ECCM Emitter I ), - 5365: ( # Cetus Scoped Burst Jammer + 5365 : ( # Cetus Scoped Burst Jammer 5359, # 1Z-3 Subversive ECM Eruption ), - 1973: ( # Sensor Booster I + 1973 : ( # Sensor Booster I 1947, # ECCM - Radar I 2002, # ECCM - Ladar I 2003, # ECCM - Magnetometric I 2004, # ECCM - Gravimetric I 2005, # ECCM - Omni I ), - 1951: ( # 'Basic' Tracking Enhancer + 1951 : ( # 'Basic' Tracking Enhancer 6322, # Beta-Nought Tracking Mode 6323, # Azimuth Descalloping Tracking Enhancer 6324, # F-AQ Delay-Line Scan Tracking Subroutines 6321, # Beam Parallax Tracking Program ), - 521: ( # 'Basic' Damage Control + 521 : ( # 'Basic' Damage Control 5829, # GLFF Containment Field 5831, # Interior Force Field Array 5835, # F84 Local Damage System @@ -42,13 +42,13 @@ CONVERSIONS = { 22939, # 'Boss' Remote Sensor Booster 22941, # 'Entrepreneur' Remote Sensor Booster ), - 5443: ( # Faint Epsilon Scoped Warp Scrambler + 5443 : ( # Faint Epsilon Scoped Warp Scrambler 5441, # Fleeting Progressive Warp Scrambler I ), - 1963: ( # Remote Sensor Booster I + 1963 : ( # Remote Sensor Booster I 1959, # ECCM Projector I ), - 6325: ( # Fourier Compact Tracking Enhancer + 6325 : ( # Fourier Compact Tracking Enhancer 6326, # Sigma-Nought Tracking Mode I 6327, # Auto-Gain Control Tracking Enhancer I 6328, # F-aQ Phase Code Tracking Subroutines @@ -68,19 +68,19 @@ CONVERSIONS = { 22919: ( # 'Monopoly' Magnetic Field Stabilizer 22917, # 'Capitalist' Magnetic Field Stabilizer I ), - 5839: ( # IFFA Compact Damage Control + 5839 : ( # IFFA Compact Damage Control 5841, # Emergency Damage Control I 5843, # F85 Peripheral Damage System I 5837, # Pseudoelectron Containment Field I ), - 522: ( # 'Micro' Cap Battery + 522 : ( # 'Micro' Cap Battery 4747, # Micro Ld-Acid Capacitor Battery I 4751, # Micro Ohm Capacitor Reserve I 4745, # Micro F-4a Ld-Sulfate Capacitor Charge Unit 4749, # Micro Peroxide Capacitor Power Cell 3480, # Micro Capacitor Battery II ), - 518: ( # 'Basic' Gyrostabilizer + 518 : ( # 'Basic' Gyrostabilizer 5915, # Lateral Gyrostabilizer 5919, # F-M2 Weapon Inertial Suspensor 5913, # Hydraulic Stabilization Actuator @@ -89,19 +89,19 @@ CONVERSIONS = { 19931: ( # Compulsive Scoped Multispectral ECM 19933, # 'Hypnos' Multispectral ECM I ), - 5403: ( # Faint Scoped Warp Disruptor + 5403 : ( # Faint Scoped Warp Disruptor 5401, # Fleeting Warp Disruptor I ), 23902: ( # 'Trebuchet' Heat Sink I 23900, # 'Mangonel' Heat Sink I ), - 1893: ( # 'Basic' Heat Sink + 1893 : ( # 'Basic' Heat Sink 5845, # Heat Exhaust System 5856, # C3S Convection Thermal Radiator 5855, # 'Boreas' Coolant System 5854, # Stamped Heat Sink ), - 6160: ( # F-90 Compact Sensor Booster + 6160 : ( # F-90 Compact Sensor Booster 20214, # Extra Radar ECCM Scanning Array I 20220, # Extra Ladar ECCM Scanning Array I 20226, # Extra Gravimetric ECCM Scanning Array I @@ -123,40 +123,40 @@ CONVERSIONS = { 19952: ( # Umbra Scoped Radar ECM 9520, # 'Penumbra' White Noise ECM ), - 1952: ( # Sensor Booster II + 1952 : ( # Sensor Booster II 2258, # ECCM - Omni II 2259, # ECCM - Gravimetric II 2260, # ECCM - Ladar II 2261, # ECCM - Magnetometric II 2262, # ECCM - Radar II ), - 5282: ( # Linked Enduring Sensor Booster + 5282 : ( # Linked Enduring Sensor Booster 7219, # Scattering ECCM Projector I ), - 1986: ( # Signal Amplifier I + 1986 : ( # Signal Amplifier I 2579, # Gravimetric Backup Array I 2583, # Ladar Backup Array I 2587, # Magnetometric Backup Array I 2591, # Multi Sensor Backup Array I 4013, # RADAR Backup Array I ), - 4871: ( # Large Compact Pb-Acid Cap Battery + 4871 : ( # Large Compact Pb-Acid Cap Battery 4875, # Large Ohm Capacitor Reserve I 4869, # Large F-4a Ld-Sulfate Capacitor Charge Unit 4873, # Large Peroxide Capacitor Power Cell ), - 1964: ( # Remote Sensor Booster II + 1964 : ( # Remote Sensor Booster II 1960, # ECCM Projector II ), - 5933: ( # Counterbalanced Compact Gyrostabilizer + 5933 : ( # Counterbalanced Compact Gyrostabilizer 5931, # Cross-Lateral Gyrostabilizer I 5935, # F-M3 Munition Inertial Suspensor 5929, # Pneumatic Stabilization Actuator I ), - 4025: ( # X5 Enduring Stasis Webifier + 4025 : ( # X5 Enduring Stasis Webifier 4029, # 'Langour' Drive Disruptor I ), - 4027: ( # Fleeting Compact Stasis Webifier + 4027 : ( # Fleeting Compact Stasis Webifier 4031, # Patterned Stasis Web I ), 22937: ( # 'Enterprise' Remote Tracking Computer @@ -165,7 +165,7 @@ CONVERSIONS = { 22929: ( # 'Marketeer' Tracking Computer 22927, # 'Economist' Tracking Computer I ), - 1987: ( # Signal Amplifier II + 1987 : ( # Signal Amplifier II 2580, # Gravimetric Backup Array II 2584, # Ladar Backup Array II 2588, # Magnetometric Backup Array II @@ -175,13 +175,13 @@ CONVERSIONS = { 19939: ( # Enfeebling Scoped Ladar ECM 9522, # Faint Phase Inversion ECM I ), - 5340: ( # P-S Compact Remote Tracking Computer + 5340 : ( # P-S Compact Remote Tracking Computer 5341, # 'Prayer' Remote Tracking Computer ), 19814: ( # Phased Scoped Target Painter 19808, # Partial Weapon Navigation ), - 1949: ( # 'Basic' Signal Amplifier + 1949 : ( # 'Basic' Signal Amplifier 1946, # Basic RADAR Backup Array 1982, # Basic Ladar Backup Array 1983, # Basic Gravimetric Backup Array @@ -222,10 +222,10 @@ CONVERSIONS = { 23416: ( # 'Peace' Large Remote Armor Repairer None, # 'Pacifier' Large Remote Armor Repairer ), - 6176: ( # F-12 Enduring Tracking Computer + 6176 : ( # F-12 Enduring Tracking Computer 6174, # Monopulse Tracking Mechanism I ), - 6159: ( # Alumel-Wired Enduring Sensor Booster + 6159 : ( # Alumel-Wired Enduring Sensor Booster 7917, # Alumel Radar ECCM Sensor Array I 7918, # Alumel Ladar ECCM Sensor Array I 7922, # Alumel Gravimetric ECCM Sensor Array I @@ -247,7 +247,7 @@ CONVERSIONS = { 7914, # Prototype ECCM Magnetometric Sensor Cluster 6158, # Prototype Sensor Booster ), - 5849: ( # Extruded Compact Heat Sink + 5849 : ( # Extruded Compact Heat Sink 5846, # Thermal Exhaust System I 5858, # C4S Coiled Circuit Thermal Radiator 5857, # 'Skadi' Coolant System I @@ -263,15 +263,15 @@ CONVERSIONS = { 22945: ( # 'Executive' Remote Sensor Dampener 22943, # 'Broker' Remote Sensor Dampener I ), - 6173: ( # Optical Compact Tracking Computer + 6173 : ( # Optical Compact Tracking Computer 6175, # 'Orion' Tracking CPU I ), - 5279: ( # F-23 Compact Remote Sensor Booster + 5279 : ( # F-23 Compact Remote Sensor Booster 7217, # Spot Pulsing ECCM I 7220, # Phased Muon ECCM Caster I 5280, # Connected Remote Sensor Booster ), - 4787: ( # Small Compact Pb-Acid Cap Battery + 4787 : ( # Small Compact Pb-Acid Cap Battery 4791, # Small Ohm Capacitor Reserve I 4785, # Small F-4a Ld-Sulfate Capacitor Charge Unit 4789, # Small Peroxide Capacitor Power Cell @@ -279,7 +279,7 @@ CONVERSIONS = { 19946: ( # BZ-5 Scoped Gravimetric ECM 9519, # FZ-3 Subversive Spatial Destabilizer ECM ), - 6073: ( # Medium Compact Pb-Acid Cap Battery + 6073 : ( # Medium Compact Pb-Acid Cap Battery 6097, # Medium Ohm Capacitor Reserve I 6111, # Medium F-4a Ld-Sulfate Capacitor Charge Unit 6083, # Medium Peroxide Capacitor Power Cell @@ -287,7 +287,7 @@ CONVERSIONS = { 21484: ( # 'Full Duplex' Ballistic Control System 21482, # Ballistic 'Purge' Targeting System I ), - 6296: ( # F-89 Compact Signal Amplifier + 6296 : ( # F-89 Compact Signal Amplifier 6218, # Protected Gravimetric Backup Cluster I 6222, # Protected Ladar Backup Cluster I 6226, # Protected Magnetometric Backup Cluster I @@ -324,7 +324,7 @@ CONVERSIONS = { 6293, # Wavelength Signal Enhancer I 6295, # Type-D Attenuation Signal Augmentation ), - 5302: ( # Phased Muon Scoped Sensor Dampener + 5302 : ( # Phased Muon Scoped Sensor Dampener 5300, # Indirect Scanning Dampening Unit I ), } diff --git a/eos/db/migrations/upgrade4.py b/eos/db/migrations/upgrade4.py index f8c670684..d1e46d10a 100644 --- a/eos/db/migrations/upgrade4.py +++ b/eos/db/migrations/upgrade4.py @@ -11,64 +11,64 @@ Migration 4 """ CONVERSIONS = { - 506: ( # 'Basic' Capacitor Power Relay + 506 : ( # 'Basic' Capacitor Power Relay 8205, # Alpha Reactor Control: Capacitor Power Relay 8209, # Marked Generator Refitting: Capacitor Power Relay 8203, # Partial Power Plant Manager: Capacity Power Relay 8207, # Type-E Power Core Modification: Capacitor Power Relay ), - 8177: ( # Mark I Compact Capacitor Power Relay + 8177 : ( # Mark I Compact Capacitor Power Relay 8173, # Beta Reactor Control: Capacitor Power Relay I ), - 8175: ( # Type-D Restrained Capacitor Power Relay + 8175 : ( # Type-D Restrained Capacitor Power Relay 8171, # Local Power Plant Manager: Capacity Power Relay I ), - 421: ( # 'Basic' Capacitor Recharger + 421 : ( # 'Basic' Capacitor Recharger 4425, # AGM Capacitor Charge Array, 4421, # F-a10 Buffer Capacitor Regenerator 4423, # Industrial Capacitor Recharger 4427, # Secondary Parallel Link-Capacitor ), - 4435: ( # Eutectic Compact Cap Recharger + 4435 : ( # Eutectic Compact Cap Recharger 4433, # Barton Reactor Capacitor Recharger I 4431, # F-b10 Nominal Capacitor Regenerator 4437, # Fixed Parallel Link-Capacitor I ), - 1315: ( # 'Basic' Expanded Cargohold + 1315 : ( # 'Basic' Expanded Cargohold 5483, # Alpha Hull Mod Expanded Cargo 5479, # Marked Modified SS Expanded Cargo 5481, # Partial Hull Conversion Expanded Cargo 5485, # Type-E Altered SS Expanded Cargo ), - 5493: ( # Type-D Restrained Expanded Cargo + 5493 : ( # Type-D Restrained Expanded Cargo 5491, # Beta Hull Mod Expanded Cargo 5489, # Local Hull Conversion Expanded Cargo I 5487, # Mark I Modified SS Expanded Cargo ), - 1401: ( # 'Basic' Inertial Stabilizers + 1401 : ( # 'Basic' Inertial Stabilizers 5523, # Alpha Hull Mod Inertial Stabilizers 5521, # Partial Hull Conversion Inertial Stabilizers 5525, # Type-E Altered SS Inertial Stabilizers ), - 5533: ( # Type-D Restrained Inertial Stabilizers + 5533 : ( # Type-D Restrained Inertial Stabilizers 5531, # Beta Hull Mod Inertial Stabilizers 5529, # Local Hull Conversion Inertial Stabilizers I 5527, # Mark I Modified SS Inertial Stabilizers 5519, # Marked Modified SS Inertial Stabilizers ), - 5239: ( # EP-S Gaussian Scoped Mining Laser + 5239 : ( # EP-S Gaussian Scoped Mining Laser 5241, # Dual Diode Mining Laser I ), - 5233: ( # Single Diode Basic Mining Laser + 5233 : ( # Single Diode Basic Mining Laser 5231, # EP-R Argon Ion Basic Excavation Pulse 5237, # Rubin Basic Particle Bore Stream 5235, # Xenon Basic Drilling Beam ), - 5245: ( # Particle Bore Compact Mining Laser + 5245 : ( # Particle Bore Compact Mining Laser 5243, # XeCl Drilling Beam I ), @@ -79,53 +79,53 @@ CONVERSIONS = { 22609, # Erin Mining Laser Upgrade ), - 1242: ( # 'Basic' Nanofiber Internal Structure + 1242 : ( # 'Basic' Nanofiber Internal Structure 5591, # Alpha Hull Mod Nanofiber Structure 5595, # Marked Modified SS Nanofiber Structure 5559, # Partial Hull Conversion Nanofiber Structure 5593, # Type-E Altered SS Nanofiber Structure ), - 5599: ( # Type-D Restrained Nanofiber Structure + 5599 : ( # Type-D Restrained Nanofiber Structure 5597, # Beta Hull Mod Nanofiber Structure 5561, # Local Hull Conversion Nanofiber Structure I 5601, # Mark I Modified SS Nanofiber Structure ), - 1192: ( # 'Basic' Overdrive Injector System + 1192 : ( # 'Basic' Overdrive Injector System 5613, # Alpha Hull Mod Overdrive Injector 5617, # Marked Modified SS Overdrive Injector 5611, # Partial Hull Conversion Overdrive Injector 5615, # Type-E Altered SS Overdrive Injector ), - 5631: ( # Type-D Restrained Overdrive Injector + 5631 : ( # Type-D Restrained Overdrive Injector 5629, # Beta Hull Mod Overdrive Injector 5627, # Local Hull Conversion Overdrive Injector I 5633, # Mark I Modified SS Overdrive Injector ), - 1537: ( # 'Basic' Power Diagnostic System + 1537 : ( # 'Basic' Power Diagnostic System 8213, # Alpha Reactor Control: Diagnostic System 8217, # Marked Generator Refitting: Diagnostic System 8211, # Partial Power Plant Manager: Diagnostic System 8215, # Type-E Power Core Modification: Diagnostic System 8255, # Type-E Power Core Modification: Reaction Control ), - 8225: ( # Mark I Compact Power Diagnostic System + 8225 : ( # Mark I Compact Power Diagnostic System 8221, # Beta Reactor Control: Diagnostic System I 8219, # Local Power Plant Manager: Diagnostic System I 8223, # Type-D Power Core Modification: Diagnostic System ), - 1240: ( # 'Basic' Reinforced Bulkheads + 1240 : ( # 'Basic' Reinforced Bulkheads 5677, # Alpha Hull Mod Reinforced Bulkheads 5681, # Marked Modified SS Reinforced Bulkheads 5675, # Partial Hull Conversion Reinforced Bulkheads 5679, # Type-E Altered SS Reinforced Bulkheads ), - 5649: ( # Mark I Compact Reinforced Bulkheads + 5649 : ( # Mark I Compact Reinforced Bulkheads 5645, # Beta Hull Mod Reinforced Bulkheads ), - 5647: ( # Type-D Restrained Reinforced Bulkheads + 5647 : ( # Type-D Restrained Reinforced Bulkheads 5643, # Local Hull Conversion Reinforced Bulkheads I ), } diff --git a/eos/db/migrations/upgrade8.py b/eos/db/migrations/upgrade8.py index 19185443b..0051034ec 100644 --- a/eos/db/migrations/upgrade8.py +++ b/eos/db/migrations/upgrade8.py @@ -8,16 +8,16 @@ Migration 8 """ CONVERSIONS = { - 8529: ( # Large F-S9 Regolith Compact Shield Extender + 8529 : ( # Large F-S9 Regolith Compact Shield Extender 8409, # Large Subordinate Screen Stabilizer I ), - 8419: ( # Large Azeotropic Restrained Shield Extender + 8419 : ( # Large Azeotropic Restrained Shield Extender 8489, # Large Supplemental Barrier Emitter I ), - 8517: ( # Medium F-S9 Regolith Compact Shield Extender + 8517 : ( # Medium F-S9 Regolith Compact Shield Extender 8397, # Medium Subordinate Screen Stabilizer I ), - 8433: ( # Medium Azeotropic Restrained Shield Extender + 8433 : ( # Medium Azeotropic Restrained Shield Extender 8477, # Medium Supplemental Barrier Emitter I ), 20627: ( # Small 'Trapper' Shield Extender @@ -28,10 +28,10 @@ CONVERSIONS = { 8387, # Micro Subordinate Screen Stabilizer I 8465, # Micro Supplemental Barrier Emitter I ), - 8521: ( # Small F-S9 Regolith Compact Shield Extender + 8521 : ( # Small F-S9 Regolith Compact Shield Extender 8401, # Small Subordinate Screen Stabilizer I ), - 8427: ( # Small Azeotropic Restrained Shield Extender + 8427 : ( # Small Azeotropic Restrained Shield Extender 8481, # Small Supplemental Barrier Emitter I ), 11343: ( # 100mm Crystalline Carbonide Restrained Plates diff --git a/eos/db/migrations/upgrade9.py b/eos/db/migrations/upgrade9.py index a2f5b6148..af23ff745 100644 --- a/eos/db/migrations/upgrade9.py +++ b/eos/db/migrations/upgrade9.py @@ -20,6 +20,6 @@ CREATE TABLE boostersTemp ( def upgrade(saveddata_engine): saveddata_engine.execute(tmpTable) saveddata_engine.execute( - "INSERT INTO boostersTemp (ID, itemID, fitID, active) SELECT ID, itemID, fitID, active FROM boosters") + "INSERT INTO boostersTemp (ID, itemID, fitID, active) SELECT ID, itemID, fitID, active FROM boosters") saveddata_engine.execute("DROP TABLE boosters") saveddata_engine.execute("ALTER TABLE boostersTemp RENAME TO boosters") diff --git a/eos/db/saveddata/character.py b/eos/db/saveddata/character.py index aaa8a3829..4d8dd882f 100644 --- a/eos/db/saveddata/character.py +++ b/eos/db/saveddata/character.py @@ -41,22 +41,22 @@ characters_table = Table("characters", saveddata_meta, mapper(Character, characters_table, properties={ "_Character__alphaCloneID": characters_table.c.alphaCloneID, - "savedName": characters_table.c.name, - "_Character__owner": relation( - User, - backref="characters"), - "_Character__skills": relation( - Skill, - backref="character", - cascade="all,delete-orphan"), - "_Character__implants": relation( - Implant, - collection_class=HandledImplantBoosterList, - cascade='all,delete-orphan', - backref='character', - single_parent=True, - primaryjoin=charImplants_table.c.charID == characters_table.c.ID, - secondaryjoin=charImplants_table.c.implantID == Implant.ID, - secondary=charImplants_table), + "savedName" : characters_table.c.name, + "_Character__owner" : relation( + User, + backref="characters"), + "_Character__skills" : relation( + Skill, + backref="character", + cascade="all,delete-orphan"), + "_Character__implants" : relation( + Implant, + collection_class=HandledImplantBoosterList, + cascade='all,delete-orphan', + backref='character', + single_parent=True, + primaryjoin=charImplants_table.c.charID == characters_table.c.ID, + secondaryjoin=charImplants_table.c.implantID == Implant.ID, + secondary=charImplants_table), } ) diff --git a/eos/db/saveddata/databaseRepair.py b/eos/db/saveddata/databaseRepair.py index d16c412b0..e40a022f0 100644 --- a/eos/db/saveddata/databaseRepair.py +++ b/eos/db/saveddata/databaseRepair.py @@ -168,7 +168,7 @@ class DatabaseCleanup(object): for table in ['drones', 'cargo', 'fighters']: pyfalog.debug("Running database cleanup for orphaned {0} items.", table) query = "SELECT COUNT(*) AS num FROM {} WHERE itemID IS NULL OR itemID = '' or itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format( - table) + table) results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) if results is None: @@ -178,14 +178,14 @@ class DatabaseCleanup(object): if row and row['num']: query = "DELETE FROM {} WHERE itemID IS NULL OR itemID = '' or itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format( - table) + table) delete = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) pyfalog.error("Database corruption found. Cleaning up {0} records.", delete.rowcount) for table in ['modules']: pyfalog.debug("Running database cleanup for orphaned {0} items.", table) query = "SELECT COUNT(*) AS num FROM {} WHERE itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format( - table) + table) results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) if results is None: @@ -216,7 +216,7 @@ class DatabaseCleanup(object): if row and row['num']: query = "UPDATE '{0}' SET '{1}Amount' = '0' WHERE {1}Amount IS NULL OR {1}Amount = ''".format(profileType, - damageType) + damageType) delete = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) pyfalog.error("Database corruption found. Cleaning up {0} records.", delete.rowcount) diff --git a/eos/db/saveddata/fighter.py b/eos/db/saveddata/fighter.py index bd7d8fd54..01eec00c8 100644 --- a/eos/db/saveddata/fighter.py +++ b/eos/db/saveddata/fighter.py @@ -41,11 +41,11 @@ fighter_abilities_table = Table("fightersAbilities", saveddata_meta, mapper(Fighter, fighters_table, properties={ - "owner": relation(Fit), + "owner" : relation(Fit), "_Fighter__abilities": relation( - FighterAbility, - backref="fighter", - cascade='all, delete, delete-orphan'), + FighterAbility, + backref="fighter", + cascade='all, delete, delete-orphan'), }) mapper(FighterAbility, fighter_abilities_table) diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index 8cbdb4d6f..99be30a55 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -100,7 +100,7 @@ class ProjectedFit(object): def __repr__(self): return "ProjectedFit(sourceID={}, victimID={}, amount={}, active={}) at {}".format( - self.sourceID, self.victimID, self.amount, self.active, hex(id(self)) + self.sourceID, self.victimID, self.amount, self.active, hex(id(self)) ) @@ -120,113 +120,113 @@ class CommandFit(object): def __repr__(self): return "CommandFit(boosterID={}, boostedID={}, active={}) at {}".format( - self.boosterID, self.boostedID, self.active, hex(id(self)) + self.boosterID, self.boostedID, self.active, hex(id(self)) ) es_Fit._Fit__projectedFits = association_proxy( - "victimOf", # look at the victimOf association... - "source_fit", # .. and return the source fits - creator=lambda sourceID, source_fit: ProjectedFit(sourceID, source_fit) + "victimOf", # look at the victimOf association... + "source_fit", # .. and return the source fits + creator=lambda sourceID, source_fit: ProjectedFit(sourceID, source_fit) ) es_Fit._Fit__commandFits = association_proxy( - "boostedOf", # look at the boostedOf association... - "booster_fit", # .. and return the booster fit - creator=lambda boosterID, booster_fit: CommandFit(boosterID, booster_fit) + "boostedOf", # look at the boostedOf association... + "booster_fit", # .. and return the booster fit + creator=lambda boosterID, booster_fit: CommandFit(boosterID, booster_fit) ) mapper(es_Fit, fits_table, properties={ - "_Fit__modules": relation( - Module, - collection_class=HandledModuleList, - primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), # noqa - order_by=modules_table.c.position, - cascade='all, delete, delete-orphan'), - "_Fit__projectedModules": relation( - Module, - collection_class=HandledProjectedModList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), # noqa - "owner": relation( - User, - backref="fits"), - "itemID": fits_table.c.shipID, - "shipID": fits_table.c.shipID, - "_Fit__boosters": relation( - Booster, - collection_class=HandledImplantBoosterList, - cascade='all, delete, delete-orphan', - single_parent=True), - "_Fit__drones": relation( - Drone, - collection_class=HandledDroneCargoList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), # noqa - "_Fit__fighters": relation( - Fighter, - collection_class=HandledDroneCargoList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), # noqa - "_Fit__cargo": relation( - Cargo, - collection_class=HandledDroneCargoList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(cargo_table.c.fitID == fits_table.c.ID)), - "_Fit__projectedDrones": relation( - Drone, - collection_class=HandledProjectedDroneList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), # noqa + "_Fit__modules" : relation( + Module, + collection_class=HandledModuleList, + primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), # noqa + order_by=modules_table.c.position, + cascade='all, delete, delete-orphan'), + "_Fit__projectedModules" : relation( + Module, + collection_class=HandledProjectedModList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), # noqa + "owner" : relation( + User, + backref="fits"), + "itemID" : fits_table.c.shipID, + "shipID" : fits_table.c.shipID, + "_Fit__boosters" : relation( + Booster, + collection_class=HandledImplantBoosterList, + cascade='all, delete, delete-orphan', + single_parent=True), + "_Fit__drones" : relation( + Drone, + collection_class=HandledDroneCargoList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), # noqa + "_Fit__fighters" : relation( + Fighter, + collection_class=HandledDroneCargoList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), # noqa + "_Fit__cargo" : relation( + Cargo, + collection_class=HandledDroneCargoList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(cargo_table.c.fitID == fits_table.c.ID)), + "_Fit__projectedDrones" : relation( + Drone, + collection_class=HandledProjectedDroneList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), # noqa "_Fit__projectedFighters": relation( - Fighter, - collection_class=HandledProjectedDroneList, - cascade='all, delete, delete-orphan', - single_parent=True, - primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), # noqa - "_Fit__implants": relation( - Implant, - collection_class=HandledImplantBoosterList, - cascade='all, delete, delete-orphan', - backref='fit', - single_parent=True, - primaryjoin=fitImplants_table.c.fitID == fits_table.c.ID, - secondaryjoin=fitImplants_table.c.implantID == Implant.ID, - secondary=fitImplants_table), - "_Fit__character": relation( - Character, - backref="fits"), - "_Fit__damagePattern": relation(DamagePattern), - "_Fit__targetResists": relation(TargetResists), - "projectedOnto": relationship( - ProjectedFit, - primaryjoin=projectedFits_table.c.sourceID == fits_table.c.ID, - backref='source_fit', - collection_class=attribute_mapped_collection('victimID'), - cascade='all, delete, delete-orphan'), - "victimOf": relationship( - ProjectedFit, - primaryjoin=fits_table.c.ID == projectedFits_table.c.victimID, - backref='victim_fit', - collection_class=attribute_mapped_collection('sourceID'), - cascade='all, delete, delete-orphan'), - "boostedOnto": relationship( - CommandFit, - primaryjoin=commandFits_table.c.boosterID == fits_table.c.ID, - backref='booster_fit', - collection_class=attribute_mapped_collection('boostedID'), - cascade='all, delete, delete-orphan'), - "boostedOf": relationship( - CommandFit, - primaryjoin=fits_table.c.ID == commandFits_table.c.boostedID, - backref='boosted_fit', - collection_class=attribute_mapped_collection('boosterID'), - cascade='all, delete, delete-orphan'), + Fighter, + collection_class=HandledProjectedDroneList, + cascade='all, delete, delete-orphan', + single_parent=True, + primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), # noqa + "_Fit__implants" : relation( + Implant, + collection_class=HandledImplantBoosterList, + cascade='all, delete, delete-orphan', + backref='fit', + single_parent=True, + primaryjoin=fitImplants_table.c.fitID == fits_table.c.ID, + secondaryjoin=fitImplants_table.c.implantID == Implant.ID, + secondary=fitImplants_table), + "_Fit__character" : relation( + Character, + backref="fits"), + "_Fit__damagePattern" : relation(DamagePattern), + "_Fit__targetResists" : relation(TargetResists), + "projectedOnto" : relationship( + ProjectedFit, + primaryjoin=projectedFits_table.c.sourceID == fits_table.c.ID, + backref='source_fit', + collection_class=attribute_mapped_collection('victimID'), + cascade='all, delete, delete-orphan'), + "victimOf" : relationship( + ProjectedFit, + primaryjoin=fits_table.c.ID == projectedFits_table.c.victimID, + backref='victim_fit', + collection_class=attribute_mapped_collection('sourceID'), + cascade='all, delete, delete-orphan'), + "boostedOnto" : relationship( + CommandFit, + primaryjoin=commandFits_table.c.boosterID == fits_table.c.ID, + backref='booster_fit', + collection_class=attribute_mapped_collection('boostedID'), + cascade='all, delete, delete-orphan'), + "boostedOf" : relationship( + CommandFit, + primaryjoin=fits_table.c.ID == commandFits_table.c.boostedID, + backref='boosted_fit', + collection_class=attribute_mapped_collection('boosterID'), + cascade='all, delete, delete-orphan'), } ) diff --git a/eos/db/saveddata/implantSet.py b/eos/db/saveddata/implantSet.py index 955accc07..aa2708bf8 100644 --- a/eos/db/saveddata/implantSet.py +++ b/eos/db/saveddata/implantSet.py @@ -34,13 +34,13 @@ implant_set_table = Table("implantSets", saveddata_meta, mapper(ImplantSet, implant_set_table, properties={ "_ImplantSet__implants": relation( - Implant, - collection_class=HandledImplantBoosterList, - cascade='all, delete, delete-orphan', - backref='set', - single_parent=True, - primaryjoin=implantsSetMap_table.c.setID == implant_set_table.c.ID, - secondaryjoin=implantsSetMap_table.c.implantID == Implant.ID, - secondary=implantsSetMap_table), + Implant, + collection_class=HandledImplantBoosterList, + cascade='all, delete, delete-orphan', + backref='set', + single_parent=True, + primaryjoin=implantsSetMap_table.c.setID == implant_set_table.c.ID, + secondaryjoin=implantsSetMap_table.c.implantID == Implant.ID, + secondary=implantsSetMap_table), } ) diff --git a/eos/db/saveddata/queries.py b/eos/db/saveddata/queries.py index f1f947296..4a58a8a82 100644 --- a/eos/db/saveddata/queries.py +++ b/eos/db/saveddata/queries.py @@ -176,7 +176,7 @@ def getCharacter(lookfor, eager=None): eager = processEager(eager) with sd_lock: character = saveddata_session.query(Character).options(*eager).filter( - Character.savedName == lookfor).first() + Character.savedName == lookfor).first() else: raise TypeError("Need integer or string as argument") return character @@ -356,12 +356,12 @@ def getDamagePattern(lookfor, eager=None): eager = processEager(eager) with sd_lock: pattern = saveddata_session.query(DamagePattern).options(*eager).filter( - DamagePattern.ID == lookfor).first() + DamagePattern.ID == lookfor).first() elif isinstance(lookfor, basestring): eager = processEager(eager) with sd_lock: pattern = saveddata_session.query(DamagePattern).options(*eager).filter( - DamagePattern.name == lookfor).first() + DamagePattern.name == lookfor).first() else: raise TypeError("Need integer or string as argument") return pattern @@ -377,12 +377,12 @@ def getTargetResists(lookfor, eager=None): eager = processEager(eager) with sd_lock: pattern = saveddata_session.query(TargetResists).options(*eager).filter( - TargetResists.ID == lookfor).first() + TargetResists.ID == lookfor).first() elif isinstance(lookfor, basestring): eager = processEager(eager) with sd_lock: pattern = saveddata_session.query(TargetResists).options(*eager).filter( - TargetResists.name == lookfor).first() + TargetResists.name == lookfor).first() else: raise TypeError("Need integer or string as argument") return pattern @@ -398,7 +398,7 @@ def getImplantSet(lookfor, eager=None): eager = processEager(eager) with sd_lock: pattern = saveddata_session.query(ImplantSet).options(*eager).filter( - TargetResists.ID == lookfor).first() + TargetResists.ID == lookfor).first() elif isinstance(lookfor, basestring): eager = processEager(eager) with sd_lock: diff --git a/eos/db/util.py b/eos/db/util.py index 151e2e38b..03a09aceb 100644 --- a/eos/db/util.py +++ b/eos/db/util.py @@ -20,16 +20,18 @@ from sqlalchemy.orm import eagerload from sqlalchemy.sql import and_ -replace = {"attributes": "_Item__attributes", - "modules": "_Fit__modules", - "projectedModules": "_Fit__projectedModules", - "boosters": "_Fit__boosters", - "drones": "_Fit__drones", - "projectedDrones": "_Fit__projectedDrones", - "implants": "_Fit__implants", - "character": "_Fit__character", - "damagePattern": "_Fit__damagePattern", - "projectedFits": "_Fit__projectedFits"} +replace = { + "attributes" : "_Item__attributes", + "modules" : "_Fit__modules", + "projectedModules": "_Fit__projectedModules", + "boosters" : "_Fit__boosters", + "drones" : "_Fit__drones", + "projectedDrones" : "_Fit__projectedDrones", + "implants" : "_Fit__implants", + "character" : "_Fit__character", + "damagePattern" : "_Fit__damagePattern", + "projectedFits" : "_Fit__projectedFits" +} def processEager(eager): diff --git a/eos/graph/fitDps.py b/eos/graph/fitDps.py index f09a2c34b..cfa70187a 100644 --- a/eos/graph/fitDps.py +++ b/eos/graph/fitDps.py @@ -27,10 +27,12 @@ pyfalog = Logger(__name__) class FitDpsGraph(Graph): - defaults = {"angle": 0, - "distance": 0, - "signatureRadius": None, - "velocity": 0} + defaults = { + "angle" : 0, + "distance" : 0, + "signatureRadius": None, + "velocity" : 0 + } def __init__(self, fit, data=None): Graph.__init__(self, fit, self.calcDps, data if data is not None else self.defaults) @@ -47,16 +49,16 @@ class FitDpsGraph(Graph): if not mod.isEmpty and mod.state >= State.ACTIVE: if "remoteTargetPaintFalloff" in mod.item.effects: ew['signatureRadius'].append( - 1 + (mod.getModifiedItemAttr("signatureRadiusBonus") / 100) * self.calculateModuleMultiplier( - mod, data)) + 1 + (mod.getModifiedItemAttr("signatureRadiusBonus") / 100) * self.calculateModuleMultiplier( + mod, data)) if "remoteWebifierFalloff" in mod.item.effects: if distance <= mod.getModifiedItemAttr("maxRange"): ew['velocity'].append(1 + (mod.getModifiedItemAttr("speedFactor") / 100)) elif mod.getModifiedItemAttr("falloffEffectiveness") > 0: # I am affected by falloff ew['velocity'].append( - 1 + (mod.getModifiedItemAttr("speedFactor") / 100) * self.calculateModuleMultiplier(mod, - data)) + 1 + (mod.getModifiedItemAttr("speedFactor") / 100) * self.calculateModuleMultiplier(mod, + data)) ew['signatureRadius'].sort(key=abssort) ew['velocity'].sort(key=abssort) @@ -85,7 +87,7 @@ class FitDpsGraph(Graph): if distance <= fit.extraAttributes["droneControlRange"]: for drone in fit.drones: multiplier = 1 if drone.getModifiedItemAttr("maxVelocity") > 1 else self.calculateTurretMultiplier( - drone, data) + drone, data) dps, _ = drone.damageStats(fit.targetResists) total += dps * multiplier @@ -149,7 +151,7 @@ class FitDpsGraph(Graph): damageReductionSensitivity = ability.fighter.getModifiedItemAttr("{}ReductionSensitivity".format(prefix)) if damageReductionSensitivity is None: damageReductionSensitivity = ability.fighter.getModifiedItemAttr( - "{}DamageReductionSensitivity".format(prefix)) + "{}DamageReductionSensitivity".format(prefix)) targetSigRad = explosionRadius if targetSigRad is None else targetSigRad sigRadiusFactor = targetSigRad / explosionRadius diff --git a/eos/saveddata/booster.py b/eos/saveddata/booster.py index 5ef2d78f6..b5f990349 100644 --- a/eos/saveddata/booster.py +++ b/eos/saveddata/booster.py @@ -64,29 +64,6 @@ class Booster(HandledItem, ItemAttrShortcut): self.__itemModifiedAttributes.overrides = self.__item.overrides self.__slot = self.__calculateSlot(self.__item) - # Legacy booster side effect code, disabling as not currently implemented - ''' - for effect in self.__item.effects.itervalues(): - if effect.isType("boosterSideEffect"): - s = SideEffect(self) - s.effect = effect - s.active = effect.ID in self.__activeSideEffectIDs - self.__sideEffects.append(s) - ''' - - # Legacy booster side effect code, disabling as not currently implemented - ''' - def iterSideEffects(self): - return self.__sideEffects.__iter__() - - def getSideEffect(self, name): - for sideEffect in self.iterSideEffects(): - if sideEffect.effect.name == name: - return sideEffect - - raise KeyError("SideEffect with %s as name not found" % name) - ''' - @property def itemModifiedAttributes(self): return self.__itemModifiedAttributes @@ -124,20 +101,15 @@ class Booster(HandledItem, ItemAttrShortcut): effect.activeByDefault: effect.handler(fit, self, ("booster",)) - # Legacy booster code, not fully implemented - ''' - for sideEffect in self.iterSideEffects(): - if sideEffect.active and sideEffect.effect.runTime == runTime: - sideEffect.effect.handler(fit, self, ("boosterSideEffect",)) - ''' - @validates("ID", "itemID", "ammoID", "active") def validator(self, key, val): - map = {"ID": lambda _val: isinstance(_val, int), - "itemID": lambda _val: isinstance(_val, int), - "ammoID": lambda _val: isinstance(_val, int), - "active": lambda _val: isinstance(_val, bool), - "slot": lambda _val: isinstance(_val, int) and 1 <= _val <= 3} + map = { + "ID" : lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "ammoID": lambda _val: isinstance(_val, int), + "active": lambda _val: isinstance(_val, bool), + "slot" : lambda _val: isinstance(_val, int) and 1 <= _val <= 3 + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) @@ -148,52 +120,4 @@ class Booster(HandledItem, ItemAttrShortcut): copy = Booster(self.item) copy.active = self.active - # Legacy booster side effect code, disabling as not currently implemented - ''' - origSideEffects = list(self.iterSideEffects()) - copySideEffects = list(copy.iterSideEffects()) - i = 0 - while i < len(origSideEffects): - copySideEffects[i].active = origSideEffects[i].active - i += 1 - ''' - return copy - - -# Legacy booster side effect code, disabling as not currently implemented -''' - class SideEffect(object): - def __init__(self, owner): - self.__owner = owner - self.__active = False - self.__effect = None - - @property - def active(self): - return self.__active - - @active.setter - def active(self, active): - if not isinstance(active, bool): - raise TypeError("Expecting a bool, not a " + type(active)) - - if active != self.__active: - if active: - self.__owner._Booster__activeSideEffectIDs.append(self.effect.ID) - else: - self.__owner._Booster__activeSideEffectIDs.remove(self.effect.ID) - - self.__active = active - - @property - def effect(self): - return self.__effect - - @effect.setter - def effect(self, effect): - if not hasattr(effect, "handler"): - raise TypeError("Need an effect with a handler") - - self.__effect = effect -''' diff --git a/eos/saveddata/cargo.py b/eos/saveddata/cargo.py index 57da22e79..7b6e71349 100644 --- a/eos/saveddata/cargo.py +++ b/eos/saveddata/cargo.py @@ -71,9 +71,11 @@ class Cargo(HandledItem, ItemAttrShortcut): @validates("fitID", "itemID", "amount") def validator(self, key, val): - map = {"fitID": lambda _val: isinstance(_val, int), - "itemID": lambda _val: isinstance(_val, int), - "amount": lambda _val: isinstance(_val, int)} + map = { + "fitID" : lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "amount": lambda _val: isinstance(_val, int) + } if key == "amount" and val > sys.maxint: val = sys.maxint diff --git a/eos/saveddata/character.py b/eos/saveddata/character.py index 067b9f98d..f962e891a 100644 --- a/eos/saveddata/character.py +++ b/eos/saveddata/character.py @@ -35,6 +35,35 @@ class Character(object): __itemIDMap = None __itemNameMap = None + def __init__(self, name, defaultLevel=None, initSkills=True): + self.savedName = name + self.__owner = None + self.defaultLevel = defaultLevel + self.__skills = [] + self.__skillIdMap = {} + self.dirtySkills = set() + self.alphaClone = None + + if initSkills: + for item in self.getSkillList(): + self.addSkill(Skill(item.ID, self.defaultLevel)) + + self.__implants = HandledImplantBoosterList() + self.apiKey = None + + @reconstructor + def init(self): + + self.__skillIdMap = {} + for skill in self.__skills: + self.__skillIdMap[skill.itemID] = skill + self.dirtySkills = set() + + self.alphaClone = None + + if self.alphaCloneID: + self.alphaClone = eos.db.getAlphaClone(self.alphaCloneID) + @classmethod def getSkillList(cls): if cls.__itemList is None: @@ -42,10 +71,6 @@ class Character(object): return cls.__itemList - @classmethod - def setSkillList(cls, list): - cls.__itemList = list - @classmethod def getSkillIDMap(cls): if cls.__itemIDMap is None: @@ -91,35 +116,6 @@ class Character(object): return all0 - def __init__(self, name, defaultLevel=None, initSkills=True): - self.savedName = name - self.__owner = None - self.defaultLevel = defaultLevel - self.__skills = [] - self.__skillIdMap = {} - self.dirtySkills = set() - self.alphaClone = None - - if initSkills: - for item in self.getSkillList(): - self.addSkill(Skill(item.ID, self.defaultLevel)) - - self.__implants = HandledImplantBoosterList() - self.apiKey = None - - @reconstructor - def init(self): - - self.__skillIdMap = {} - for skill in self.__skills: - self.__skillIdMap[skill.itemID] = skill - self.dirtySkills = set() - - self.alphaClone = None - - if self.alphaCloneID: - self.alphaClone = eos.db.getAlphaClone(self.alphaCloneID) - def apiUpdateCharSheet(self, skills): del self.__skills[:] self.__skillIdMap.clear() @@ -247,8 +243,8 @@ class Character(object): def clear(self): c = chain( - self.skills, - self.implants + self.skills, + self.implants ) for stuff in c: if stuff is not None and stuff != self: @@ -266,10 +262,12 @@ class Character(object): @validates("ID", "name", "apiKey", "ownerID") def validator(self, key, val): - map = {"ID": lambda _val: isinstance(_val, int), - "name": lambda _val: True, - "apiKey": lambda _val: _val is None or (isinstance(_val, basestring) and len(_val) > 0), - "ownerID": lambda _val: isinstance(_val, int) or _val is None} + map = { + "ID" : lambda _val: isinstance(_val, int), + "name" : lambda _val: True, + "apiKey" : lambda _val: _val is None or (isinstance(_val, basestring) and len(_val) > 0), + "ownerID": lambda _val: isinstance(_val, int) or _val is None + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) @@ -278,7 +276,7 @@ class Character(object): def __repr__(self): return "Character(ID={}, name={}) at {}".format( - self.ID, self.name, hex(id(self)) + self.ID, self.name, hex(id(self)) ) @@ -387,8 +385,10 @@ class Skill(HandledItem): if hasattr(self, "_Skill__ro") and self.__ro is True and key != "characterID": raise ReadOnlyException() - map = {"characterID": lambda _val: isinstance(_val, int), - "skillID": lambda _val: isinstance(_val, int)} + map = { + "characterID": lambda _val: isinstance(_val, int), + "skillID" : lambda _val: isinstance(_val, int) + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) @@ -401,7 +401,7 @@ class Skill(HandledItem): def __repr__(self): return "Skill(ID={}, name={}) at {}".format( - self.item.ID, self.item.name, hex(id(self)) + self.item.ID, self.item.name, hex(id(self)) ) diff --git a/eos/saveddata/citadel.py b/eos/saveddata/citadel.py index 90d7ab425..78bbde032 100644 --- a/eos/saveddata/citadel.py +++ b/eos/saveddata/citadel.py @@ -29,7 +29,7 @@ class Citadel(Ship): if item.category.name != "Structure": pyfalog.error("Passed item '{0}' (category: {1}) is not under Structure category", item.name, item.category.name) raise ValueError( - 'Passed item "%s" (category: (%s)) is not under Structure category' % (item.name, item.category.name)) + 'Passed item "%s" (category: (%s)) is not under Structure category' % (item.name, item.category.name)) def __deepcopy__(self, memo): copy = Citadel(self.item) @@ -37,5 +37,5 @@ class Citadel(Ship): def __repr__(self): return "Citadel(ID={}, name={}) at {}".format( - self.item.ID, self.item.name, hex(id(self)) + self.item.ID, self.item.name, hex(id(self)) ) diff --git a/eos/saveddata/crestchar.py b/eos/saveddata/crestchar.py index 51a32fe26..ce6ab14fe 100644 --- a/eos/saveddata/crestchar.py +++ b/eos/saveddata/crestchar.py @@ -32,13 +32,3 @@ class CrestChar(object): @reconstructor def init(self): pass - - ''' - @threads(1) - def fetchImage(self): - url = 'https://image.eveonline.com/character/%d_128.jpg'%self.ID - fp = urllib.urlopen(url) - data = fp.read() - fp.close() - self.img = StringIO(data) - ''' diff --git a/eos/saveddata/damagePattern.py b/eos/saveddata/damagePattern.py index f10e6b50b..2d32de6a2 100644 --- a/eos/saveddata/damagePattern.py +++ b/eos/saveddata/damagePattern.py @@ -62,10 +62,12 @@ class DamagePattern(object): return amount / (specificDivider or 1) - importMap = {"em": "em", - "therm": "thermal", - "kin": "kinetic", - "exp": "explosive"} + importMap = { + "em" : "em", + "therm": "thermal", + "kin" : "kinetic", + "exp" : "explosive" + } @classmethod def importPatterns(cls, text): diff --git a/eos/saveddata/drone.py b/eos/saveddata/drone.py index 647e0a99c..8734c268d 100644 --- a/eos/saveddata/drone.py +++ b/eos/saveddata/drone.py @@ -134,8 +134,8 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): cycleTime = self.getModifiedItemAttr(attr) volley = sum( - map(lambda d: (getter("%sDamage" % d) or 0) * (1 - getattr(targetResists, "%sAmount" % d, 0)), - self.DAMAGE_TYPES)) + map(lambda d: (getter("%sDamage" % d) or 0) * (1 - getattr(targetResists, "%sAmount" % d, 0)), + self.DAMAGE_TYPES)) volley *= self.amountActive volley *= self.getModifiedItemAttr("damageMultiplier") or 1 self.__volley = volley @@ -186,11 +186,13 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @validates("ID", "itemID", "chargeID", "amount", "amountActive") def validator(self, key, val): - map = {"ID": lambda _val: isinstance(_val, int), - "itemID": lambda _val: isinstance(_val, int), - "chargeID": lambda _val: isinstance(_val, int), - "amount": lambda _val: isinstance(_val, int) and _val >= 0, - "amountActive": lambda _val: isinstance(_val, int) and self.amount >= _val >= 0} + map = { + "ID" : lambda _val: isinstance(_val, int), + "itemID" : lambda _val: isinstance(_val, int), + "chargeID" : lambda _val: isinstance(_val, int), + "amount" : lambda _val: isinstance(_val, int) and _val >= 0, + "amountActive": lambda _val: isinstance(_val, int) and self.amount >= _val >= 0 + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) @@ -232,9 +234,9 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): for effect in self.item.effects.itervalues(): if effect.runTime == runTime and \ - effect.activeByDefault and \ + effect.activeByDefault and \ ((projected is True and effect.isType("projected")) or - projected is False and effect.isType("passive")): + projected is False and effect.isType("passive")): # See GH issue #765 if effect.getattr('grouped'): effect.handler(fit, self, context) diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index e10b5b3c5..1ea07ebfd 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -101,9 +101,11 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): return [FighterAbility(effect) for effect in self.item.effects.values()] def __calculateSlot(self, item): - types = {"Light": Slot.F_LIGHT, - "Support": Slot.F_SUPPORT, - "Heavy": Slot.F_HEAVY} + types = { + "Light" : Slot.F_LIGHT, + "Support": Slot.F_SUPPORT, + "Heavy" : Slot.F_HEAVY + } for t, slot in types.iteritems(): if self.getModifiedItemAttr("fighterSquadronIs{}".format(t)): @@ -219,11 +221,12 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @validates("ID", "itemID", "chargeID", "amount", "amountActive") def validator(self, key, val): - map = {"ID": lambda _val: isinstance(_val, int), - "itemID": lambda _val: isinstance(_val, int), - "chargeID": lambda _val: isinstance(_val, int), - "amount": lambda _val: isinstance(_val, int) and _val >= -1, - } + map = { + "ID" : lambda _val: isinstance(_val, int), + "itemID" : lambda _val: isinstance(_val, int), + "chargeID": lambda _val: isinstance(_val, int), + "amount" : lambda _val: isinstance(_val, int) and _val >= -1, + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/eos/saveddata/fighterAbility.py b/eos/saveddata/fighterAbility.py index efe429c41..b6b099a5c 100644 --- a/eos/saveddata/fighterAbility.py +++ b/eos/saveddata/fighterAbility.py @@ -132,7 +132,7 @@ class FighterAbility(object): else: volley = sum(map(lambda d2, d: (self.fighter.getModifiedItemAttr( - "{}Damage{}".format(self.attrPrefix, d2)) or 0) * + "{}Damage{}".format(self.attrPrefix, d2)) or 0) * (1 - getattr(targetResists, "{}Amount".format(d), 0)), self.DAMAGE_TYPES2, self.DAMAGE_TYPES)) diff --git a/eos/saveddata/implant.py b/eos/saveddata/implant.py index 240a51b0f..869e5c608 100644 --- a/eos/saveddata/implant.py +++ b/eos/saveddata/implant.py @@ -99,9 +99,11 @@ class Implant(HandledItem, ItemAttrShortcut): @validates("fitID", "itemID", "active") def validator(self, key, val): - map = {"fitID": lambda _val: isinstance(_val, int), - "itemID": lambda _val: isinstance(_val, int), - "active": lambda _val: isinstance(_val, bool)} + map = { + "fitID" : lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "active": lambda _val: isinstance(_val, bool) + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) @@ -115,5 +117,5 @@ class Implant(HandledItem, ItemAttrShortcut): def __repr__(self): return "Implant(ID={}, name={}) at {}".format( - self.item.ID, self.item.name, hex(id(self)) + self.item.ID, self.item.name, hex(id(self)) ) diff --git a/eos/saveddata/mode.py b/eos/saveddata/mode.py index 2b3108a9d..50413906d 100644 --- a/eos/saveddata/mode.py +++ b/eos/saveddata/mode.py @@ -26,7 +26,7 @@ class Mode(ItemAttrShortcut, HandledItem): if item.group.name != "Ship Modifiers": raise ValueError( - 'Passed item "%s" (category: (%s)) is not a Ship Modifier' % (item.name, item.category.name)) + 'Passed item "%s" (category: (%s)) is not a Ship Modifier' % (item.name, item.category.name)) self.__item = item self.__itemModifiedAttributes = ModifiedAttributeDict() diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 8287f349a..a44f8d135 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -326,8 +326,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): func = self.getModifiedItemAttr volley = sum(map( - lambda attr: (func("%sDamage" % attr) or 0) * (1 - getattr(targetResists, "%sAmount" % attr, 0)), - self.DAMAGE_TYPES)) + lambda attr: (func("%sDamage" % attr) or 0) * (1 - getattr(targetResists, "%sAmount" % attr, 0)), + self.DAMAGE_TYPES)) volley *= self.getModifiedItemAttr("damageMultiplier") or 1 if volley: cycleTime = self.cycleTime @@ -344,7 +344,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): else: if self.state >= State.ACTIVE: volley = self.getModifiedItemAttr("specialtyMiningAmount") or self.getModifiedItemAttr( - "miningAmount") or 0 + "miningAmount") or 0 if volley: cycleTime = self.cycleTime self.__miningyield = volley / (cycleTime / 1000.0) @@ -550,8 +550,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @staticmethod def __calculateHardpoint(item): - effectHardpointMap = {"turretFitted": Hardpoint.TURRET, - "launcherFitted": Hardpoint.MISSILE} + effectHardpointMap = { + "turretFitted" : Hardpoint.TURRET, + "launcherFitted": Hardpoint.MISSILE + } if item is None: return Hardpoint.NONE @@ -564,12 +566,14 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @staticmethod def __calculateSlot(item): - effectSlotMap = {"rigSlot": Slot.RIG, - "loPower": Slot.LOW, - "medPower": Slot.MED, - "hiPower": Slot.HIGH, - "subSystem": Slot.SUBSYSTEM, - "serviceSlot": Slot.SERVICE} + effectSlotMap = { + "rigSlot" : Slot.RIG, + "loPower" : Slot.LOW, + "medPower" : Slot.MED, + "hiPower" : Slot.HIGH, + "subSystem" : Slot.SUBSYSTEM, + "serviceSlot": Slot.SERVICE + } if item is None: return None for effectName, slot in effectSlotMap.iteritems(): @@ -582,9 +586,11 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @validates("ID", "itemID", "ammoID") def validator(self, key, val): - map = {"ID": lambda _val: isinstance(_val, int), - "itemID": lambda _val: _val is None or isinstance(_val, int), - "ammoID": lambda _val: isinstance(_val, int)} + map = { + "ID" : lambda _val: isinstance(_val, int), + "itemID": lambda _val: _val is None or isinstance(_val, int), + "ammoID": lambda _val: isinstance(_val, int) + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) @@ -628,8 +634,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): if effect.runTime == runTime and \ effect.activeByDefault and \ (effect.isType("offline") or - (effect.isType("passive") and self.state >= State.ONLINE) or - (effect.isType("active") and self.state >= State.ACTIVE)) and \ + (effect.isType("passive") and self.state >= State.ONLINE) or + (effect.isType("active") and self.state >= State.ACTIVE)) and \ (not gang or (gang and effect.isType("gang"))): chargeContext = ("moduleCharge",) @@ -751,7 +757,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): def __repr__(self): if self.item: return "Module(ID={}, name={}) at {}".format( - self.item.ID, self.item.name, hex(id(self)) + self.item.ID, self.item.name, hex(id(self)) ) else: return "EmptyModule() at {}".format(hex(id(self))) diff --git a/eos/saveddata/ship.py b/eos/saveddata/ship.py index 1e3fd41f0..b2b8e1d9e 100644 --- a/eos/saveddata/ship.py +++ b/eos/saveddata/ship.py @@ -29,14 +29,14 @@ pyfalog = Logger(__name__) class Ship(ItemAttrShortcut, HandledItem): EXTRA_ATTRIBUTES = { - "armorRepair": 0, - "hullRepair": 0, - "shieldRepair": 0, - "maxActiveDrones": 0, + "armorRepair" : 0, + "hullRepair" : 0, + "shieldRepair" : 0, + "maxActiveDrones" : 0, "maxTargetsLockedFromSkills": 2, - "droneControlRange": 20000, - "cloaked": False, - "siege": False + "droneControlRange" : 20000, + "cloaked" : False, + "siege" : False # We also have speedLimit for Entosis Link, but there seems to be an # issue with naming it exactly "speedLimit" due to unknown reasons. # Regardless, we don't have to put it here anyways - it will come up @@ -65,7 +65,7 @@ class Ship(ItemAttrShortcut, HandledItem): if item.category.name != "Ship": pyfalog.error("Passed item '{0}' (category: {1}) is not under Ship category", item.name, item.category.name) raise ValueError( - 'Passed item "%s" (category: (%s)) is not under Ship category' % (item.name, item.category.name)) + 'Passed item "%s" (category: (%s)) is not under Ship category' % (item.name, item.category.name)) @property def item(self): @@ -140,5 +140,5 @@ class Ship(ItemAttrShortcut, HandledItem): def __repr__(self): return "Ship(ID={}, name={}) at {}".format( - self.item.ID, self.item.name, hex(id(self)) + self.item.ID, self.item.name, hex(id(self)) ) diff --git a/eos/saveddata/user.py b/eos/saveddata/user.py index baf09d9f3..39e2eaed2 100644 --- a/eos/saveddata/user.py +++ b/eos/saveddata/user.py @@ -49,10 +49,12 @@ class User(object): @validates("ID", "username", "password", "admin") def validator(self, key, val): - map = {"ID": lambda _val: isinstance(_val, int), - "username": lambda _val: isinstance(_val, basestring), - "password": lambda _val: isinstance(_val, basestring) and len(_val) == 96, - "admin": lambda _val: isinstance(_val, bool)} + map = { + "ID" : lambda _val: isinstance(_val, int), + "username": lambda _val: isinstance(_val, basestring), + "password": lambda _val: isinstance(_val, basestring) and len(_val) == 96, + "admin" : lambda _val: isinstance(_val, bool) + } if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/tox.ini b/tox.ini index b92d0b45b..7fad13a2b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = pep8 +envlist = py27, pep8 skipsdist = True [testenv] @@ -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=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 --ignore=E121,E126,E127,E128,E203,E731 service gui eos utils config.py pyfa.py --max-line-length=165