Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Cleanup for Services #907

Merged
merged 53 commits into from
Jan 28, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d963327
Make it run again
Ebag333 Dec 2, 2016
ea8a4c0
Eliminate export calling fit.py (no need)
Ebag333 Dec 2, 2016
6ef57e7
Missed imports. Fixed now.
Ebag333 Dec 3, 2016
510492e
More refactoring, elimited another recursive import
Ebag333 Dec 4, 2016
d3b6bc1
so many pep8 fixes
a-tal Dec 4, 2016
ab9c925
non-standard - use forces coding declarations
a-tal Dec 4, 2016
874bfb3
missed a type
a-tal Dec 4, 2016
4a9b1df
pep8 fixes
a-tal Dec 4, 2016
b4dd65c
dont use built-in function format as a var name
a-tal Dec 4, 2016
57f930c
Cherry pick commits from @a-tal
Ebag333 Dec 14, 2016
b2a5a20
Travis and CodeCov files
Ebag333 Dec 14, 2016
be53ded
Large pep8 compliance to make work for Tox
Ebag333 Dec 14, 2016
28404cd
bajillion pep8 fixes to pass tox
Ebag333 Dec 14, 2016
622a734
remove lazy import. Fix test
Ebag333 Dec 14, 2016
e3b5929
Make some imports more explicit
Ebag333 Dec 14, 2016
627977a
Purging fleet bonuses from code base
Ebag333 Sep 15, 2016
7bd8ca5
Removed actual fleet files. Cleaned up __init__.py that had references.
Ebag333 Nov 7, 2016
dfa728a
Handle Lockbreaker, Void, and Focused Void Bombs
Ebag333 Nov 7, 2016
39b7d9f
Change to shorthand unicode
Ebag333 Nov 7, 2016
a440ed3
Drop unicode
Ebag333 Nov 7, 2016
38bf143
Fighters for export and import functions
IndictionEve Nov 10, 2016
08b5abc
Handle unicode, utf8, and windows-1252
Ebag333 Nov 27, 2016
7532bcd
Clean up some stuff left over from cherry picks
Ebag333 Dec 14, 2016
84dc93a
bump release
blitzmann Dec 2, 2016
9ecfc47
Bump dev, fix for #874
blitzmann Dec 3, 2016
9f4b319
Adding Fighter Support CREST
IndictionEve Dec 4, 2016
7fbd893
Revert "Remove effect files that are not used by any item"
blitzmann Dec 5, 2016
edfa130
Fix tooltip order
Ebag333 Dec 5, 2016
1a127bb
Add ability to look at tactical mode item info.
Ebag333 Dec 8, 2016
2eacadf
Don't use try for fittingView, and don't show remove item for modes.
Ebag333 Dec 9, 2016
ea3a374
Add logging, because why not
Ebag333 Dec 9, 2016
b529a28
Implement fittingMode
Ebag333 Dec 9, 2016
96ddb0b
Fixed a few issues with command bursts
blitzmann Dec 9, 2016
52257d6
fix a couple command effects
blitzmann Dec 10, 2016
df859a2
Fix for #883
blitzmann Dec 10, 2016
9cfa074
fix for #871
blitzmann Dec 10, 2016
57edc32
Clean up new tactical mode stats stuff
blitzmann Dec 10, 2016
4186e19
bump stable
blitzmann Dec 11, 2016
9df87f6
bump dev
blitzmann Dec 11, 2016
eccf405
fixed parameters in call when adding neuts to structures.
Drezil Dec 11, 2016
bb216aa
wrong index in tuple.
Drezil Dec 11, 2016
0d44cbf
clean up path stuff
blitzmann Dec 12, 2016
200ff5a
Fix titan command effects
blitzmann Dec 12, 2016
37f8253
oops
blitzmann Dec 12, 2016
0ebb992
more clean up
blitzmann Dec 12, 2016
956fa7a
Fixing some issues due to import cleanup
Ebag333 Dec 14, 2016
658a87c
Single line change to fix most (all??) of the problems
Ebag333 Dec 15, 2016
4fb07cc
Bunch of pep8 and inspection cleanup
Ebag333 Dec 15, 2016
f76f44e
Fix port references, imports, and add some logging
Ebag333 Dec 15, 2016
c858fc2
Remove an inline import. Fix a reference that is missing.
Ebag333 Dec 15, 2016
d7c71f5
fix some, missed import references.
Ebag333 Dec 16, 2016
af7272c
fix dual reference back to same object
Ebag333 Dec 16, 2016
836504e
Expand gitattributes to cover a few more scenarios
Ebag333 Jan 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions eos/db/saveddata/loadDefaultDatabaseValues.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# ===============================================================================

import eos.db
import eos.types

from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern
from eos.saveddata.targetResists import TargetResists as es_TargetResists

class ImportError(Exception):
pass
Expand Down Expand Up @@ -118,7 +118,7 @@ def importDamageProfileDefaults(cls):
name, em, therm, kin, exp = damageProfileRow
damageProfile = eos.db.getDamagePattern(name)
if damageProfile is None:
damageProfile = eos.types.DamagePattern(em, therm, kin, exp)
damageProfile = es_DamagePattern(em, therm, kin, exp)
damageProfile.name = name
eos.db.save(damageProfile)

Expand Down Expand Up @@ -180,7 +180,7 @@ def importResistProfileDefaults(cls):
name, em, therm, kin, exp = targetResistProfileRow
resistsProfile = eos.db.eos.db.getTargetResists(name)
if resistsProfile is None:
resistsProfile = eos.types.TargetResists(em, therm, kin, exp)
resistsProfile = es_TargetResists(em, therm, kin, exp)
resistsProfile.name = name
eos.db.save(resistsProfile)

Expand All @@ -192,6 +192,6 @@ def importRequiredDefaults(cls):
name, em, therm, kin, exp = damageProfileRow
damageProfile = eos.db.getDamagePattern(name)
if damageProfile is None:
damageProfile = eos.types.DamagePattern(em, therm, kin, exp)
damageProfile = es_DamagePattern(em, therm, kin, exp)
damageProfile.name = name
eos.db.save(damageProfile)
8 changes: 0 additions & 8 deletions eos/effectHandlerHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import logging

import eos.db
import eos.types

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -160,13 +159,6 @@ def remove(self, mod):
for i in xrange(oldPos, len(self)):
self[i].position -= 1

def toDummy(self, index):
mod = self[index]
if not mod.isEmpty:
dummy = eos.types.Module.buildEmpty(mod.slot)
dummy.position = index
self[index] = dummy

def toModule(self, index, mod):
mod.position = index
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this moved to the Module class? Methinks this should remain as a property of the collection.

self[index] = mod
Expand Down
16 changes: 8 additions & 8 deletions eos/saveddata/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,13 @@


class State(Enum):
def __init__(self):
pass

OFFLINE = -1
ONLINE = 0
ACTIVE = 1
OVERHEATED = 2


class Slot(Enum):
def __init__(self):
pass

# These are self-explanatory
LOW = 1
Expand All @@ -65,15 +60,13 @@ def __init__(self):


class Hardpoint(Enum):
def __init__(self):
pass

NONE = 0
MISSILE = 1
TURRET = 2


class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut, list):
"""An instance of this class represents a module together with its charge and modified attributes"""
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
MINING_ATTRIBUTES = ("miningAmount",)
Expand Down Expand Up @@ -141,6 +134,13 @@ def build(self):
self.__chargeModifiedAttributes.original = self.__charge.attributes
self.__chargeModifiedAttributes.overrides = self.__charge.overrides

def toDummy(self, index):
mod = self[index]
if not mod.isEmpty:
dummy = Module.buildEmpty(mod.slot)
dummy.position = index
self[index] = dummy

@classmethod
def buildEmpty(cls, slot):
empty = Module(None)
Expand Down
6 changes: 4 additions & 2 deletions gui/builtinContextMenus/amount.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import gui.globalEvents as GE
import wx
from service.fit import Fit
from eos.saveddata.cargo import Cargo as es_Cargo
from eos.saveddata.fighter import Fighter as es_Fighter

class ChangeAmount(ContextMenu):
def __init__(self):
Expand Down Expand Up @@ -50,11 +52,11 @@ def change(self, event):
mainFrame = gui.mainFrame.MainFrame.getInstance()
fitID = mainFrame.getActiveFit()

if isinstance(self.thing, eos.types.Cargo):
if isinstance(self.thing, es_Cargo):
sFit.addCargo(fitID, self.thing.item.ID, int(self.input.GetLineText(0)), replace=True)
elif isinstance(self.thing, eos.types.Fit):
sFit.changeAmount(fitID, self.thing, int(self.input.GetLineText(0)))
elif isinstance(self.thing, eos.types.Fighter):
elif isinstance(self.thing, es_Fighter):
sFit.changeActiveFighters(fitID, self.thing, int(self.input.GetLineText(0)))

wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID))
Expand Down
4 changes: 2 additions & 2 deletions gui/commandView.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import gui.droneView
from gui.builtinViewColumns.state import State
from gui.contextMenu import ContextMenu
import eos.types
from service.fit import Fit
from service.market import Market
from eos.saveddata.drone import Drone as es_Drone


class DummyItem:
Expand Down Expand Up @@ -108,7 +108,7 @@ def handleDrag(self, type, fitID):

def startDrag(self, event):
row = event.GetIndex()
if row != -1 and isinstance(self.get(row), eos.types.Drone):
if row != -1 and isinstance(self.get(row), es_Drone):
data = wx.PyTextDataObject()
data.SetText("command:"+str(self.GetItemData(row)))

Expand Down
2 changes: 2 additions & 0 deletions gui/crestFittings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import requests

from service.crest import CrestModes
from service.crest import Crest
from service.fit import Fit

from eos.types import Cargo
from eos.db import getItem
Expand Down
3 changes: 2 additions & 1 deletion gui/mainFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ def backupToXml(self, event):
"Backing up %d fits to: %s"%(max, filePath),
maximum=max, parent=self,
style=wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME)
sFit.backupFits(filePath, self.backupCallback)

Port.backupFits(filePath, self.backupCallback)
self.progressDialog.ShowModal()

def exportHtml(self, event):
Expand Down
10 changes: 5 additions & 5 deletions gui/projectedView.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def handleDrag(self, type, fitID):

def startDrag(self, event):
row = event.GetIndex()
if row != -1 and isinstance(self.get(row), eos.types.Drone):
if row != -1 and isinstance(self.get(row), es_Drone):
data = wx.PyTextDataObject()
data.SetText("projected:"+str(self.GetItemData(row)))

Expand All @@ -134,7 +134,7 @@ def mergeDrones(self, x, y, itemID):

def _merge(self, src, dst):
dstDrone = self.get(dst)
if isinstance(dstDrone, eos.types.Drone):
if isinstance(dstDrone, es_Drone):
sFit = Fit.getInstance()
fitID = self.mainFrame.getActiveFit()
if sFit.mergeDrones(fitID, self.get(src), dstDrone, True):
Expand Down Expand Up @@ -247,15 +247,15 @@ def spawnMenu(self):
item = self.get(sel)
if item is None: return
sMkt = Market.getInstance()
if isinstance(item, eos.types.Drone):
if isinstance(item, es_Drone):
srcContext = "projectedDrone"
itemContext = sMkt.getCategoryByItem(item.item).name
context = ((srcContext, itemContext),)
elif isinstance(item, eos.types.Fighter):
elif isinstance(item, es_Fighter):
srcContext = "projectedFighter"
itemContext = sMkt.getCategoryByItem(item.item).name
context = ((srcContext, itemContext),)
elif isinstance(item, eos.types.Module):
elif isinstance(item, es_Module):
modSrcContext = "projectedModule"
modItemContext = sMkt.getCategoryByItem(item.item).name
modFullContext = (modSrcContext, modItemContext)
Expand Down
2 changes: 2 additions & 0 deletions service/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ def getAttributeInfo(self, identity):
elif isinstance(identity, (int, float)):
id = int(identity)
info = eos.db.getAttributeInfo(id, eager=("icon", "unit"))
else:
info = None
return info
20 changes: 12 additions & 8 deletions service/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@

import config
import eos.db
import eos.types
from service.eveapi import EVEAPIConnection, ParseXML

from eos.saveddata.implant import Implant as es_Implant
from eos.saveddata.character import Character as es_Character
from eos.saveddata.module import Slot as es_Slot, Module as es_Module
from eos.saveddata.fighter import Fighter as es_Fighter

logger = logging.getLogger(__name__)

class CharacterImportThread(threading.Thread):
Expand Down Expand Up @@ -175,13 +179,13 @@ def importCharacter(self, path, callback):
thread.start()

def all0(self):
return eos.types.Character.getAll0()
return es_Character.getAll0()

def all0ID(self):
return self.all0().ID

def all5(self):
return eos.types.Character.getAll5()
return es_Character.getAll5()

def all5ID(self):
return self.all5().ID
Expand Down Expand Up @@ -248,7 +252,7 @@ def getCharName(self, charID):
return eos.db.getCharacter(charID).name

def new(self, name="New Character"):
char = eos.types.Character(name)
char = es_Character(name)
eos.db.save(char)
return char

Expand Down Expand Up @@ -344,7 +348,7 @@ def addImplant(self, charID, itemID):
logger.error("Trying to add implant to read-only character")
return

implant = eos.types.Implant(eos.db.getItem(itemID))
implant = es_Implant(eos.db.getItem(itemID))
char.implants.append(implant)
eos.db.commit()

Expand All @@ -361,17 +365,17 @@ def checkRequirements(self, fit):
toCheck = []
reqs = {}
for thing in itertools.chain(fit.modules, fit.drones, fit.fighters, (fit.ship,)):
if isinstance(thing, eos.types.Module) and thing.slot == eos.types.Slot.RIG:
if isinstance(thing, es_Module) and thing.slot == es_Slot.RIG:
continue
for attr in ("item", "charge"):
if attr == "charge" and isinstance(thing, eos.types.Fighter):
if attr == "charge" and isinstance(thing, es_Fighter):
# Fighter Bombers are automatically charged with micro bombs.
# These have skill requirements attached, but aren't used in EVE.
continue
subThing = getattr(thing, attr, None)
subReqs = {}
if subThing is not None:
if isinstance(thing, eos.types.Fighter) and attr == "charge":
if isinstance(thing, es_Fighter) and attr == "charge":
continue
self._checkRequirements(fit, fit.character, subThing, subReqs)
if subReqs:
Expand Down
9 changes: 4 additions & 5 deletions service/damagePattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import copy

import eos.db
import eos.types

from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern

class ImportError(Exception):
pass
Expand All @@ -41,7 +40,7 @@ def getDamagePattern(self, name):
return eos.db.getDamagePattern(name)

def newPattern(self, name):
p = eos.types.DamagePattern(0, 0, 0, 0)
p = es_DamagePattern(0, 0, 0, 0)
p.name = name
eos.db.save(p)
return p
Expand All @@ -67,7 +66,7 @@ def importPatterns(self, text):
for pattern in current:
lookup[pattern.name] = pattern

imports, num = eos.types.DamagePattern.importPatterns(text)
imports, num = es_DamagePattern.importPatterns(text)
for pattern in imports:
if pattern.name in lookup:
match = lookup[pattern.name]
Expand All @@ -89,4 +88,4 @@ def exportPatterns(self):
del patterns[i]

patterns.sort(key=lambda p: p.name)
return eos.types.DamagePattern.exportPatterns(*patterns)
return es_DamagePattern.exportPatterns(*patterns)
Loading