Large pep8 compliance to make work for Tox

This commit is contained in:
Ebag333
2016-12-13 21:23:01 -08:00
parent b2a5a20650
commit be53dedb18
50 changed files with 2216 additions and 2066 deletions

View File

@@ -19,8 +19,10 @@
import eos.db
class Attribute():
instance = None
@classmethod
def getInstance(cls):
if cls.instance is None:

View File

@@ -40,6 +40,7 @@ from eos.saveddata.fighter import Fighter as es_Fighter
logger = logging.getLogger(__name__)
class CharacterImportThread(threading.Thread):
def __init__(self, paths, callback):
threading.Thread.__init__(self)
@@ -80,6 +81,7 @@ class CharacterImportThread(threading.Thread):
wx.CallAfter(self.callback)
class SkillBackupThread(threading.Thread):
def __init__(self, path, saveFmt, activeFit, callback):
threading.Thread.__init__(self)
@@ -100,11 +102,12 @@ class SkillBackupThread(threading.Thread):
with gzip.open(path, mode='wb') as backupFile:
backupFile.write(backupData)
else:
with open(path, mode='w',encoding='utf-8') as backupFile:
with open(path, mode='w', encoding='utf-8') as backupFile:
backupFile.write(backupData)
wx.CallAfter(self.callback)
class Character(object):
instance = None
skillReqsDict = {}
@@ -151,7 +154,7 @@ class Character(object):
for s in self.skillReqsDict['skills']:
skillKey = str(s["skillID"]) + "::" + s["skill"] + "::" + str(int(s["level"]))
if skillKey in skillsSeen:
pass # Duplicate skills confuse EVEMon
pass # Duplicate skills confuse EVEMon
else:
skillsSeen.add(skillKey)
entry = ElementTree.SubElement(root, "entry")
@@ -230,7 +233,7 @@ class Character(object):
group = eos.db.getGroup(groupID)
skills = []
for skill in group.items:
if skill.published == True:
if skill.published is True:
skills.append((skill.ID, skill.name))
return skills
@@ -305,7 +308,7 @@ class Character(object):
if char.name == charName:
charID = char.characterID
if charID == None:
if charID is None:
return
sheet = auth.character(charID).CharacterSheet()

View File

@@ -16,16 +16,18 @@ from service.pycrest.eve import EVE
logger = logging.getLogger(__name__)
class Servers(Enum):
TQ = 0
SISI = 1
class CrestModes(Enum):
IMPLICIT = 0
USER = 1
class Crest():
class Crest():
clientIDs = {
Servers.TQ: 'f9be379951c046339dc13a00e6be7704',
Servers.SISI: 'af87365240d644f7950af563b8418bad'
@@ -36,9 +38,10 @@ class Crest():
clientTest = True
_instance = None
@classmethod
def getInstance(cls):
if cls._instance == None:
if cls._instance is None:
cls._instance = Crest()
return cls._instance
@@ -74,7 +77,8 @@ class Crest():
# Base EVE connection that is copied to all characters
self.eve = EVE(
client_id=self.settings.get('clientID') if self.settings.get('mode') == CrestModes.USER else self.clientIDs.get(self.settings.get('server')),
client_id=self.settings.get('clientID') if self.settings.get(
'mode') == CrestModes.USER else self.clientIDs.get(self.settings.get('server')),
api_key=self.settings.get('clientSecret') if self.settings.get('mode') == CrestModes.USER else None,
redirect_uri=self.clientCallback,
testing=self.isTestServer
@@ -134,16 +138,16 @@ class Crest():
def getFittings(self, charID):
char = self.getCrestCharacter(charID)
return char.eve.get('%scharacters/%d/fittings/'%(char.eve._authed_endpoint,char.ID))
return char.eve.get('%scharacters/%d/fittings/' % (char.eve._authed_endpoint, char.ID))
def postFitting(self, charID, json):
#@todo: new fitting ID can be recovered from Location header, ie: Location -> https://api-sisi.testeveonline.com/characters/1611853631/fittings/37486494/
# @todo: new fitting ID can be recovered from Location header, ie: Location -> https://api-sisi.testeveonline.com/characters/1611853631/fittings/37486494/
char = self.getCrestCharacter(charID)
return char.eve.post('%scharacters/%d/fittings/'%(char.eve._authed_endpoint,char.ID), data=json)
return char.eve.post('%scharacters/%d/fittings/' % (char.eve._authed_endpoint, char.ID), data=json)
def delFitting(self, charID, fittingID):
char = self.getCrestCharacter(charID)
return char.eve.delete('%scharacters/%d/fittings/%d/'%(char.eve._authed_endpoint, char.ID, fittingID))
return char.eve.delete('%scharacters/%d/fittings/%d/' % (char.eve._authed_endpoint, char.ID, fittingID))
def logout(self):
"""Logout of implicit character"""
@@ -160,7 +164,8 @@ class Crest():
logging.debug("Starting server")
if self.httpd:
self.stopServer()
time.sleep(1) # we need this to ensure that the previous get_request finishes, and then the socket will close
time.sleep(1)
# we need this to ensure that the previous get_request finishes, and then the socket will close
self.httpd = StoppableHTTPServer(('', 6461), AuthHandler)
thread.start_new_thread(self.httpd.serve, (self.handleLogin,))
@@ -175,7 +180,7 @@ class Crest():
logger.warn("OAUTH state mismatch")
return
logger.debug("Handling CREST login with: %s"%message)
logger.debug("Handling CREST login with: %s" % message)
if 'access_token' in message: # implicit
eve = copy.deepcopy(self.eve)
@@ -193,7 +198,7 @@ class Crest():
self.implicitCharacter = CrestChar(info['CharacterID'], info['CharacterName'])
self.implicitCharacter.eve = eve
#self.implicitCharacter.fetchImage()
# self.implicitCharacter.fetchImage()
wx.PostEvent(self.mainFrame, GE.SsoLogin(type=CrestModes.IMPLICIT))
elif 'code' in message:

View File

@@ -22,12 +22,14 @@ import copy
import eos.db
from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern
class ImportError(Exception):
pass
pass
class DamagePattern():
instance = None
@classmethod
def getInstance(cls):
if cls.instance is None:

View File

@@ -174,6 +174,7 @@ proxySSL = False
_default_useragent = "eveapi.py/1.3"
_useragent = None # use set_user_agent() to set this.
# -----------------------------------------------------------------------------
@@ -309,6 +310,7 @@ def _ParseXML(response, fromContext, storeFunc):
return result
# -----------------------------------------------------------------------------
# API Classes
# -----------------------------------------------------------------------------
@@ -414,7 +416,8 @@ class _RootContext(_Context):
if retrieve_fallback:
# implementor is handling fallbacks...
try:
return _ParseXML(response, True, store and (lambda obj: cache.store(self._host, path, kw, response, obj)))
return _ParseXML(response, True,
store and (lambda obj: cache.store(self._host, path, kw, response, obj)))
except Error as e:
response = retrieve_fallback(self._host, path, kw, reason=e)
if response is not None:
@@ -563,7 +566,9 @@ class _Parser(object):
if not self.container._cols or (numAttr > numCols):
# the row data contains more attributes than were defined.
self.container._cols = attributes[0::2]
self.container.append([_castfunc(attributes[i], attributes[i + 1]) for i in xrange(0, len(attributes), 2)])
self.container.append(
[_castfunc(attributes[i], attributes[i + 1]) for i in xrange(0, len(attributes), 2)]
)
# </hack>
this._isrow = True
@@ -675,9 +680,11 @@ class _Parser(object):
# into a Rowset, adding the sibling element and this one.
rs = Rowset()
rs.__catch = rs._name = this._name
row = [_castfunc(attributes[i], attributes[i + 1]) for i in xrange(0, len(attributes), 2)] + [getattr(this, col) for col in attributes2]
row = [_castfunc(attributes[i], attributes[i + 1]) for i in xrange(0, len(attributes), 2)] + \
[getattr(this, col) for col in attributes2]
rs.append(row)
row = [getattr(sibling, attributes[i]) for i in xrange(0, len(attributes), 2)] + [getattr(sibling, col) for col in attributes2]
row = [getattr(sibling, attributes[i]) for i in xrange(0, len(attributes), 2)] + \
[getattr(sibling, col) for col in attributes2]
rs.append(row)
rs._cols = [attributes[i] for i in xrange(0, len(attributes), 2)] + [col for col in attributes2]
setattr(self.container, this._name, rs)

View File

@@ -17,39 +17,30 @@
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import locale
import copy
import threading
import logging
import wx
from codecs import open
import xml.parsers.expat
import eos.db
from eos.types import State, Slot, Module, Drone, Fighter, Fit as FitType
from eos.saveddata.ship import Ship as es_Ship
from eos.saveddata.citadel import Citadel as es_Citadel
from eos.saveddata.implant import Implant as es_Implant
from eos.saveddata.booster import Booster as es_Booster
from eos.saveddata.module import Module as es_Module
from eos.saveddata.fighter import Fighter as es_Fighter
from eos.saveddata.drone import Drone as es_Drone
from eos.saveddata.cargo import Cargo as es_Cargo
from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern
from service.market import Market
from service.damagePattern import DamagePattern
from service.character import Character
from eos.saveddata.character import Character as saveddata_Character
from eos.saveddata.citadel import Citadel as es_Citadel
from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern
from eos.saveddata.drone import Drone as es_Drone
from eos.saveddata.fighter import Fighter as es_Fighter
from eos.saveddata.implant import Implant as es_Implant
from eos.saveddata.module import Module as es_Module
from eos.saveddata.ship import Ship as es_Ship
from eos.types import State, Slot, Fit as FitType
from service.character import Character
from service.damagePattern import DamagePattern
from service.fleet import Fleet
from service.market import Market
from service.settings import SettingsProvider
logger = logging.getLogger(__name__)
class Fit(object):
instance = None

View File

@@ -1,217 +1,218 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import copy
import eos.db
from eos.saveddata.fleet import Fleet as Fleet_
from eos.saveddata.fleet import Fleet as Wing
from eos.saveddata.fleet import Fleet as Squad
class Fleet(object):
instance = None
@classmethod
def getInstance(cls):
if cls.instance is None:
cls.instance = Fleet()
return cls.instance
def __init__(self):
pass
def getFleetList(self):
fleetList = []
fleets = eos.db.getFleetList()
for fleet in fleets:
fleetList.append((fleet.ID, fleet.name, fleet.count()))
return fleetList
def getFleetByID(self, ID):
f = eos.db.getFleet(ID)
return f
def addFleet(self):
f = Fleet_()
eos.db.save(f)
return f
def renameFleet(self, fleet, newName):
fleet.name = newName
eos.db.commit()
def copyFleet(self, fleet):
newFleet = copy.deepcopy(fleet)
eos.db.save(newFleet)
return newFleet
def copyFleetByID(self, ID):
fleet = self.getFleetByID(ID)
return self.copyFleet(fleet)
def deleteFleet(self, fleet):
eos.db.remove(fleet)
def deleteFleetByID(self, ID):
fleet = self.getFleetByID(ID)
self.deleteFleet(fleet)
def makeLinearFleet(self, fit):
f = Fleet_()
w = Wing()
f.wings.append(w)
s = Squad()
w.squads.append(s)
s.members.append(fit)
fit.fleet = f
eos.db.save(f)
def setLinearFleetCom(self, boostee, booster):
#if boostee == booster:
# return
if self.getLinearFleet(boostee) is None:
self.removeAssociatedFleetData(boostee)
self.makeLinearFleet(boostee)
squadIDs = set(eos.db.getSquadsIDsWithFitID(boostee.ID))
squad = eos.db.getSquad(squadIDs.pop())
if squad.wing.gang.leader is not None and booster is None:
try:
squad.wing.gang.leader.boostsFits.remove(boostee.ID)
except KeyError:
pass
squad.wing.gang.leader = booster
if self.anyBoosters(squad) is False:
self.removeAssociatedFleetData(boostee)
from service.fit import Fit
sFit = Fit.getInstance()
sFit.recalc(boostee, withBoosters=True)
def setLinearWingCom(self, boostee, booster):
#if boostee == booster:
# return
if self.getLinearFleet(boostee) is None:
self.removeAssociatedFleetData(boostee)
self.makeLinearFleet(boostee)
squadIDs = set(eos.db.getSquadsIDsWithFitID(boostee.ID))
squad = eos.db.getSquad(squadIDs.pop())
if squad.wing.leader is not None and booster is None:
try:
squad.wing.leader.boostsFits.remove(boostee.ID)
except KeyError:
pass
squad.wing.leader = booster
if self.anyBoosters(squad) is False:
self.removeAssociatedFleetData(boostee)
from service.fit import Fit
sFit = Fit.getInstance()
sFit.recalc(boostee, withBoosters=True)
def setLinearSquadCom(self, boostee, booster):
#if boostee == booster:
# return
if self.getLinearFleet(boostee) is None:
self.removeAssociatedFleetData(boostee)
self.makeLinearFleet(boostee)
squadIDs = set(eos.db.getSquadsIDsWithFitID(boostee.ID))
squad = eos.db.getSquad(squadIDs.pop())
if squad.leader is not None and booster is None:
try:
squad.leader.boostsFits.remove(boostee.ID)
except KeyError:
pass
squad.leader = booster
if self.anyBoosters(squad) is False:
self.removeAssociatedFleetData(boostee)
from service.fit import Fit
sFit = Fit.getInstance()
sFit.recalc(boostee, withBoosters=True)
def getLinearFleet(self, fit):
sqIDs = eos.db.getSquadsIDsWithFitID(fit.ID)
if len(sqIDs) != 1:
return None
s = eos.db.getSquad(sqIDs[0])
if len(s.members) != 1:
return None
w = s.wing
if len(w.squads) != 1:
return None
f = w.gang
if len(f.wings) != 1:
return None
return f
def removeAssociatedFleetData(self, fit):
squadIDs = set(eos.db.getSquadsIDsWithFitID(fit.ID))
if len(squadIDs) == 0:
return
squads = list(eos.db.getSquad(sqID) for sqID in squadIDs)
wingIDs = set(squad.wing.ID for squad in squads)
fleetIDs = set(squad.wing.gang.ID for squad in squads)
for fleetID in fleetIDs:
fleet = eos.db.getFleet(fleetID)
for wing in fleet.wings:
wingIDs.add(wing.ID)
for wingID in wingIDs:
wing = eos.db.getWing(wingID)
for squad in wing.squads:
squadIDs.add(squad.ID)
for squadID in squadIDs:
squad = eos.db.getSquad(squadID)
if squad.leader is not None:
try:
squad.leader.boostsFits.remove(fit.ID)
except KeyError:
pass
eos.db.remove(squad)
for wingID in wingIDs:
wing = eos.db.getWing(wingID)
if wing.leader is not None:
try:
wing.leader.boostsFits.remove(fit.ID)
except KeyError:
pass
eos.db.remove(wing)
for fleetID in fleetIDs:
fleet = eos.db.getFleet(fleetID)
if fleet.leader is not None:
try:
fleet.leader.boostsFits.remove(fit.ID)
except KeyError:
pass
eos.db.remove(fleet)
fit.fleet = None
return
def anyBoosters(self, squad):
wing = squad.wing
fleet = wing.gang
if squad.leader is None and wing.leader is None and fleet.leader is None:
return False
return True
def loadLinearFleet(self, fit):
if self.getLinearFleet(fit) is None:
return None
squadID = eos.db.getSquadsIDsWithFitID(fit.ID)[0]
s = eos.db.getSquad(squadID)
w = s.wing
f = w.gang
return (f.leader, w.leader, s.leader)
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import copy
import eos.db
from eos.saveddata.fleet import Fleet as Fleet_
from eos.saveddata.fleet import Fleet as Wing
from eos.saveddata.fleet import Fleet as Squad
class Fleet(object):
instance = None
@classmethod
def getInstance(cls):
if cls.instance is None:
cls.instance = Fleet()
return cls.instance
def __init__(self):
pass
def getFleetList(self):
fleetList = []
fleets = eos.db.getFleetList()
for fleet in fleets:
fleetList.append((fleet.ID, fleet.name, fleet.count()))
return fleetList
def getFleetByID(self, ID):
f = eos.db.getFleet(ID)
return f
def addFleet(self):
f = Fleet_()
eos.db.save(f)
return f
def renameFleet(self, fleet, newName):
fleet.name = newName
eos.db.commit()
def copyFleet(self, fleet):
newFleet = copy.deepcopy(fleet)
eos.db.save(newFleet)
return newFleet
def copyFleetByID(self, ID):
fleet = self.getFleetByID(ID)
return self.copyFleet(fleet)
def deleteFleet(self, fleet):
eos.db.remove(fleet)
def deleteFleetByID(self, ID):
fleet = self.getFleetByID(ID)
self.deleteFleet(fleet)
def makeLinearFleet(self, fit):
f = Fleet_()
w = Wing()
f.wings.append(w)
s = Squad()
w.squads.append(s)
s.members.append(fit)
fit.fleet = f
eos.db.save(f)
def setLinearFleetCom(self, boostee, booster):
# if boostee == booster:
# return
if self.getLinearFleet(boostee) is None:
self.removeAssociatedFleetData(boostee)
self.makeLinearFleet(boostee)
squadIDs = set(eos.db.getSquadsIDsWithFitID(boostee.ID))
squad = eos.db.getSquad(squadIDs.pop())
if squad.wing.gang.leader is not None and booster is None:
try:
squad.wing.gang.leader.boostsFits.remove(boostee.ID)
except KeyError:
pass
squad.wing.gang.leader = booster
if self.anyBoosters(squad) is False:
self.removeAssociatedFleetData(boostee)
from service.fit import Fit
sFit = Fit.getInstance()
sFit.recalc(boostee, withBoosters=True)
def setLinearWingCom(self, boostee, booster):
# if boostee == booster:
# return
if self.getLinearFleet(boostee) is None:
self.removeAssociatedFleetData(boostee)
self.makeLinearFleet(boostee)
squadIDs = set(eos.db.getSquadsIDsWithFitID(boostee.ID))
squad = eos.db.getSquad(squadIDs.pop())
if squad.wing.leader is not None and booster is None:
try:
squad.wing.leader.boostsFits.remove(boostee.ID)
except KeyError:
pass
squad.wing.leader = booster
if self.anyBoosters(squad) is False:
self.removeAssociatedFleetData(boostee)
from service.fit import Fit
sFit = Fit.getInstance()
sFit.recalc(boostee, withBoosters=True)
def setLinearSquadCom(self, boostee, booster):
# if boostee == booster:
# return
if self.getLinearFleet(boostee) is None:
self.removeAssociatedFleetData(boostee)
self.makeLinearFleet(boostee)
squadIDs = set(eos.db.getSquadsIDsWithFitID(boostee.ID))
squad = eos.db.getSquad(squadIDs.pop())
if squad.leader is not None and booster is None:
try:
squad.leader.boostsFits.remove(boostee.ID)
except KeyError:
pass
squad.leader = booster
if self.anyBoosters(squad) is False:
self.removeAssociatedFleetData(boostee)
from service.fit import Fit
sFit = Fit.getInstance()
sFit.recalc(boostee, withBoosters=True)
def getLinearFleet(self, fit):
sqIDs = eos.db.getSquadsIDsWithFitID(fit.ID)
if len(sqIDs) != 1:
return None
s = eos.db.getSquad(sqIDs[0])
if len(s.members) != 1:
return None
w = s.wing
if len(w.squads) != 1:
return None
f = w.gang
if len(f.wings) != 1:
return None
return f
def removeAssociatedFleetData(self, fit):
squadIDs = set(eos.db.getSquadsIDsWithFitID(fit.ID))
if len(squadIDs) == 0:
return
squads = list(eos.db.getSquad(sqID) for sqID in squadIDs)
wingIDs = set(squad.wing.ID for squad in squads)
fleetIDs = set(squad.wing.gang.ID for squad in squads)
for fleetID in fleetIDs:
fleet = eos.db.getFleet(fleetID)
for wing in fleet.wings:
wingIDs.add(wing.ID)
for wingID in wingIDs:
wing = eos.db.getWing(wingID)
for squad in wing.squads:
squadIDs.add(squad.ID)
for squadID in squadIDs:
squad = eos.db.getSquad(squadID)
if squad.leader is not None:
try:
squad.leader.boostsFits.remove(fit.ID)
except KeyError:
pass
eos.db.remove(squad)
for wingID in wingIDs:
wing = eos.db.getWing(wingID)
if wing.leader is not None:
try:
wing.leader.boostsFits.remove(fit.ID)
except KeyError:
pass
eos.db.remove(wing)
for fleetID in fleetIDs:
fleet = eos.db.getFleet(fleetID)
if fleet.leader is not None:
try:
fleet.leader.boostsFits.remove(fit.ID)
except KeyError:
pass
eos.db.remove(fleet)
fit.fleet = None
return
def anyBoosters(self, squad):
wing = squad.wing
fleet = wing.gang
if squad.leader is None and wing.leader is None and fleet.leader is None:
return False
return True
def loadLinearFleet(self, fit):
if self.getLinearFleet(fit) is None:
return None
squadID = eos.db.getSquadsIDsWithFitID(fit.ID)[0]
s = eos.db.getSquad(squadID)
w = s.wing
f = w.gang
return (f.leader, w.leader, s.leader)

View File

@@ -24,9 +24,11 @@ from service.market import Market
from eos.saveddata.implant import Implant as es_Implant
from eos.saveddata.implantSet import ImplantSet as es_ImplantSet
class ImportError(Exception):
pass
class ImplantSets(object):
instance = None

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
import re
import threading
@@ -43,6 +43,7 @@ logger = logging.getLogger(__name__)
# Event which tells threads dependent on Market that it's initialized
mktRdy = threading.Event()
class ShipBrowserWorkerThread(threading.Thread):
def run(self):
self.queue = Queue.Queue()
@@ -73,6 +74,7 @@ class ShipBrowserWorkerThread(threading.Thread):
except:
pass
class PriceWorkerThread(threading.Thread):
def run(self):
self.queue = Queue.Queue()
@@ -107,6 +109,7 @@ class PriceWorkerThread(threading.Thread):
self.wait[itemID] = []
self.wait[itemID].append(callback)
class SearchWorkerThread(threading.Thread):
def run(self):
self.cv = threading.Condition()
@@ -131,7 +134,7 @@ class SearchWorkerThread(threading.Thread):
elif filterOn: # filter by selected categories
filter = e_Category.name.in_(filterOn)
else:
filter=None
filter = None
results = eos.db.searchItems(request, where=filter,
join=(e_Item.group, e_Group.category),
@@ -150,15 +153,18 @@ class SearchWorkerThread(threading.Thread):
self.cv.notify()
self.cv.release()
class Market():
instance = None
def __init__(self):
self.priceCache = {}
#Init recently used module storage
# Init recently used module storage
serviceMarketRecentlyUsedModules = {"pyfaMarketRecentlyUsedModules": []}
self.serviceMarketRecentlyUsedModules = SettingsProvider.getInstance().getSettings("pyfaMarketRecentlyUsedModules", serviceMarketRecentlyUsedModules)
self.serviceMarketRecentlyUsedModules = SettingsProvider.getInstance().getSettings(
"pyfaMarketRecentlyUsedModules", serviceMarketRecentlyUsedModules)
# Start price fetcher
self.priceWorkerThread = PriceWorkerThread()
@@ -188,36 +194,37 @@ class Market():
self.les_grp.description = ""
self.les_grp.icon = None
self.ITEMS_FORCEGROUP = {
"Opux Luxury Yacht": self.les_grp, # One of those is wedding present at CCP fanfest, another was hijacked from ISD guy during an event
"Opux Luxury Yacht": self.les_grp,
# One of those is wedding present at CCP fanfest, another was hijacked from ISD guy during an event
"Silver Magnate": self.les_grp, # Amarr Championship prize
"Gold Magnate": self.les_grp, # Amarr Championship prize
"Armageddon Imperial Issue": self.les_grp, # Amarr Championship prize
"Apocalypse Imperial Issue": self.les_grp, # Amarr Championship prize
"Guardian-Vexor": self.les_grp, # Illegal rewards for the Gallente Frontier Tour Lines event arc
"Megathron Federate Issue": self.les_grp, # Reward during Crielere event
"Apocalypse Imperial Issue": self.les_grp, # Amarr Championship prize
"Guardian-Vexor": self.les_grp, # Illegal rewards for the Gallente Frontier Tour Lines event arc
"Megathron Federate Issue": self.les_grp, # Reward during Crielere event
"Raven State Issue": self.les_grp, # AT4 prize
"Tempest Tribal Issue": self.les_grp, # AT4 prize
"Apotheosis": self.les_grp, # 5th EVE anniversary present
"Zephyr": self.les_grp, # 2010 new year gift
"Primae": self.les_grp, # Promotion of planetary interaction
"Freki": self.les_grp, # AT7 prize
"Mimir": self.les_grp, # AT7 prize
"Utu": self.les_grp, # AT8 prize
"Adrestia": self.les_grp, # AT8 prize
"Echelon": self.les_grp, # 2011 new year gift
"Malice": self.les_grp, # AT9 prize
"Vangel": self.les_grp, # AT9 prize
"Cambion": self.les_grp, # AT10 prize
"Etana": self.les_grp, # AT10 prize
"Chremoas": self.les_grp, # AT11 prize :(
"Moracha": self.les_grp, # AT11 prize
"Stratios Emergency Responder": self.les_grp, # Issued for Somer Blink lottery
"Miasmos Quafe Ultra Edition": self.les_grp, # Gift to people who purchased FF HD stream
"Tempest Tribal Issue": self.les_grp, # AT4 prize
"Apotheosis": self.les_grp, # 5th EVE anniversary present
"Zephyr": self.les_grp, # 2010 new year gift
"Primae": self.les_grp, # Promotion of planetary interaction
"Freki": self.les_grp, # AT7 prize
"Mimir": self.les_grp, # AT7 prize
"Utu": self.les_grp, # AT8 prize
"Adrestia": self.les_grp, # AT8 prize
"Echelon": self.les_grp, # 2011 new year gift
"Malice": self.les_grp, # AT9 prize
"Vangel": self.les_grp, # AT9 prize
"Cambion": self.les_grp, # AT10 prize
"Etana": self.les_grp, # AT10 prize
"Chremoas": self.les_grp, # AT11 prize :(
"Moracha": self.les_grp, # AT11 prize
"Stratios Emergency Responder": self.les_grp, # Issued for Somer Blink lottery
"Miasmos Quafe Ultra Edition": self.les_grp, # Gift to people who purchased FF HD stream
"InterBus Shuttle": self.les_grp,
"Leopard": self.les_grp, # 2013 new year gift
"Whiptail": self.les_grp, # AT12 prize
"Chameleon": self.les_grp, # AT12 prize
"Victorieux Luxury Yacht": self.les_grp, # Worlds Collide prize \o/ chinese getting owned
"Leopard": self.les_grp, # 2013 new year gift
"Whiptail": self.les_grp, # AT12 prize
"Chameleon": self.les_grp, # AT12 prize
"Victorieux Luxury Yacht": self.les_grp, # Worlds Collide prize \o/ chinese getting owned
"Imp": self.les_grp, # AT13 prize
"Fiend": self.les_grp, # AT13 prize
}
@@ -228,8 +235,8 @@ class Market():
# List of items which are forcibly published or hidden
self.ITEMS_FORCEPUBLISHED = {
"Data Subverter I": False, # Not used in EVE, probably will appear with Dust link
"QA Cross Protocol Analyzer": False, # QA modules used by CCP internally
"Data Subverter I": False, # Not used in EVE, probably will appear with Dust link
"QA Cross Protocol Analyzer": False, # QA modules used by CCP internally
"QA Damage Module": False,
"QA ECCM": False,
"QA Immunity Module": False,
@@ -265,7 +272,7 @@ class Market():
# List of groups which are forcibly published
self.GROUPS_FORCEPUBLISHED = {
"Prototype Exploration Ship": False } # We moved the only ship from this group to other group anyway
"Prototype Exploration Ship": False} # We moved the only ship from this group to other group anyway
# Dictionary of items with forced meta groups, uses following format:
# Item name: (metagroup name, parent type name)
@@ -274,75 +281,96 @@ class Market():
"'Wild' Miner I": ("Storyline", "Miner I"),
"Medium Nano Armor Repair Unit I": ("Tech I", "Medium Armor Repairer I"),
"Large 'Reprieve' Vestment Reconstructer I": ("Storyline", "Large Armor Repairer I"),
"Khanid Navy Torpedo Launcher": ("Faction", "Torpedo Launcher I"),}
"Khanid Navy Torpedo Launcher": ("Faction", "Torpedo Launcher I"), }
# Parent type name: set(item names)
self.ITEMS_FORCEDMETAGROUP_R = {}
for item, value in self.ITEMS_FORCEDMETAGROUP.items():
parent = value[1]
if not parent in self.ITEMS_FORCEDMETAGROUP_R:
if parent not in self.ITEMS_FORCEDMETAGROUP_R:
self.ITEMS_FORCEDMETAGROUP_R[parent] = set()
self.ITEMS_FORCEDMETAGROUP_R[parent].add(item)
# Dictionary of items with forced market group (service assumes they have no
# market group assigned in db, otherwise they'll appear in both original and forced groups)
self.ITEMS_FORCEDMARKETGROUP = {
"'Alpha' Data Analyzer I": 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Codex' Data Analyzer I": 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Daemon' Data Analyzer I": 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Libram' Data Analyzer I": 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Advanced Cerebral Accelerator": 977, # Implants & Boosters > Booster
"Civilian Damage Control": 615, # Ship Equipment > Hull & Armor > Damage Controls
"Civilian EM Ward Field": 1695, # Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners
"Civilian Explosive Deflection Field": 1694, # Ship Equipment > Shield > Shield Hardeners > Explosive Shield Hardeners
"Civilian Hobgoblin": 837, # Drones > Combat Drones > Light Scout Drones
"Civilian Kinetic Deflection Field": 1693, # Ship Equipment > Shield > Shield Hardeners > Kinetic Shield Hardeners
"Civilian Light Missile Launcher": 640, # Ship Equipment > Turrets & Bays > Missile Launchers > Light Missile Launchers
"Civilian Scourge Light Missile": 920, # Ammunition & Charges > Missiles > Light Missiles > Standard Light Missiles
"Civilian Small Remote Armor Repairer": 1059, # Ship Equipment > Hull & Armor > Remote Armor Repairers > Small
"Civilian Small Remote Shield Booster": 603, # Ship Equipment > Shield > Remote Shield Boosters > Small
"Civilian Stasis Webifier": 683, # Ship Equipment > Electronic Warfare > Stasis Webifiers
"Civilian Thermic Dissipation Field": 1692, # Ship Equipment > Shield > Shield Hardeners > Thermal Shield Hardeners
"Civilian Warp Disruptor": 1935, # Ship Equipment > Electronic Warfare > Warp Disruptors
"Hardwiring - Zainou 'Sharpshooter' ZMX10": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX100": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX1000": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX11": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX110": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX1100": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Nugoehuvi Synth Blue Pill Booster": 977, # Implants & Boosters > Booster
"Prototype Cerebral Accelerator": 977, # Implants & Boosters > Booster
"Prototype Iris Probe Launcher": 712, # Ship Equipment > Turrets & Bays > Scan Probe Launchers
"Shadow": 1310, # Drones > Combat Drones > Fighter Bombers
"Sleeper Data Analyzer I": 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Standard Cerebral Accelerator": 977, # Implants & Boosters > Booster
"Talocan Data Analyzer I": 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Terran Data Analyzer I": 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Tetrimon Data Analyzer I": 714 # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Alpha' Data Analyzer I": 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Codex' Data Analyzer I": 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Daemon' Data Analyzer I": 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Libram' Data Analyzer I": 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Advanced Cerebral Accelerator": 977, # Implants & Boosters > Booster
"Civilian Damage Control": 615, # Ship Equipment > Hull & Armor > Damage Controls
"Civilian EM Ward Field": 1695, # Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners
"Civilian Explosive Deflection Field": 1694,
# Ship Equipment > Shield > Shield Hardeners > Explosive Shield Hardeners
"Civilian Hobgoblin": 837, # Drones > Combat Drones > Light Scout Drones
"Civilian Kinetic Deflection Field": 1693,
# Ship Equipment > Shield > Shield Hardeners > Kinetic Shield Hardeners
"Civilian Light Missile Launcher": 640,
# Ship Equipment > Turrets & Bays > Missile Launchers > Light Missile Launchers
"Civilian Scourge Light Missile": 920,
# Ammunition & Charges > Missiles > Light Missiles > Standard Light Missiles
"Civilian Small Remote Armor Repairer": 1059,
# Ship Equipment > Hull & Armor > Remote Armor Repairers > Small
"Civilian Small Remote Shield Booster": 603, # Ship Equipment > Shield > Remote Shield Boosters > Small
"Civilian Stasis Webifier": 683, # Ship Equipment > Electronic Warfare > Stasis Webifiers
"Civilian Thermic Dissipation Field": 1692,
# Ship Equipment > Shield > Shield Hardeners > Thermal Shield Hardeners
"Civilian Warp Disruptor": 1935, # Ship Equipment > Electronic Warfare > Warp Disruptors
"Hardwiring - Zainou 'Sharpshooter' ZMX10": 1493,
# Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX100": 1493,
# Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX1000": 1493,
# Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX11": 1493,
# Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX110": 1493,
# Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX1100": 1493,
# Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Nugoehuvi Synth Blue Pill Booster": 977, # Implants & Boosters > Booster
"Prototype Cerebral Accelerator": 977, # Implants & Boosters > Booster
"Prototype Iris Probe Launcher": 712, # Ship Equipment > Turrets & Bays > Scan Probe Launchers
"Shadow": 1310, # Drones > Combat Drones > Fighter Bombers
"Sleeper Data Analyzer I": 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Standard Cerebral Accelerator": 977, # Implants & Boosters > Booster
"Talocan Data Analyzer I": 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Terran Data Analyzer I": 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Tetrimon Data Analyzer I": 714
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
}
self.ITEMS_FORCEDMARKETGROUP_R = self.__makeRevDict(self.ITEMS_FORCEDMARKETGROUP)
self.FORCEDMARKETGROUP = {
685: False, # Ship Equipment > Electronic Warfare > ECCM
681: False, # Ship Equipment > Electronic Warfare > Sensor Backup Arrays
685: False, # Ship Equipment > Electronic Warfare > ECCM
681: False, # Ship Equipment > Electronic Warfare > Sensor Backup Arrays
}
# Misc definitions
# 0 is for items w/o meta group
self.META_MAP = OrderedDict([("normal", frozenset((0, 1, 2, 14))),
self.META_MAP = OrderedDict([("normal", frozenset((0, 1, 2, 14))),
("faction", frozenset((4, 3))),
("complex", frozenset((6,))),
("officer", frozenset((5,)))])
self.SEARCH_CATEGORIES = ("Drone", "Module", "Subsystem", "Charge", "Implant", "Deployable", "Fighter", "Structure", "Structure Module")
self.SEARCH_CATEGORIES = (
"Drone", "Module", "Subsystem", "Charge", "Implant", "Deployable", "Fighter", "Structure", "Structure Module")
self.SEARCH_GROUPS = ("Ice Product",)
self.ROOT_MARKET_GROUPS = (9, # Modules
self.ROOT_MARKET_GROUPS = (9, # Modules
1111, # Rigs
157, # Drones
11, # Ammo
157, # Drones
11, # Ammo
1112, # Subsystems
24, # Implants & Boosters
404, # Deployables
24, # Implants & Boosters
404, # Deployables
2202, # Structure Equipment
2203 # Structure Modifications
2203 # Structure Modifications
)
# Tell other threads that Market is at their service
mktRdy.set()
@@ -560,7 +588,8 @@ class Market():
groupItems = set(group.items)
if hasattr(group, 'addItems'):
groupItems.update(group.addItems)
items = set(filter(lambda item: self.getPublicityByItem(item) and self.getGroupByItem(item) == group, groupItems))
items = set(
filter(lambda item: self.getPublicityByItem(item) and self.getGroupByItem(item) == group, groupItems))
return items
def getItemsByMarketGroup(self, mg, vars=True):

View File

@@ -29,21 +29,27 @@ from service.settings import NetworkSettings
timeout = 3
socket.setdefaulttimeout(timeout)
class Error(StandardError):
def __init__(self, msg=None):
self.message = msg
class RequestError(StandardError):
pass
class AuthenticationError(StandardError):
pass
pass
class ServerError(StandardError):
pass
pass
class TimeoutError(StandardError):
pass
pass
class Network():
# Request constants - every request must supply this, as it is checked if
@@ -73,7 +79,8 @@ class Network():
raise Error("Access not enabled - please enable in Preferences > Network")
# Set up some things for the request
versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName, config.expansionVersion)
versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName,
config.expansionVersion)
headers = {"User-Agent": "pyfa {0} (Python-urllib2)".format(versionString)}
proxy = NetworkSettings.getInstance().getProxySettings()

View File

@@ -171,6 +171,7 @@ class Port(object):
return fits
"""Service which houses all import/export format functions"""
@classmethod
def exportCrest(cls, ofit, callback=None):
# A few notes:
@@ -379,6 +380,7 @@ class Port(object):
if len(s) > 10:
return s[:10] + "..."
return s
logger.exception("Couldn't import ship data %r", [logtransform(s) for s in info])
return None
@@ -821,7 +823,8 @@ class Port(object):
slot = module.slot
if slot not in stuff:
stuff[slot] = []
curr = module.item.name if module.item else ("[Empty %s slot]" % Slot.getName(slot).capitalize() if slot is not None else "")
curr = module.item.name if module.item else (
"[Empty %s slot]" % Slot.getName(slot).capitalize() if slot is not None else "")
if module.charge and sFit.serviceFittingOptions["exportCharges"]:
curr += ", %s" % module.charge.name
if module.state == State.OFFLINE:
@@ -1075,6 +1078,7 @@ class FitBackupThread(threading.Thread):
# Send done signal to GUI
wx.CallAfter(self.callback, -1)
class FitImportThread(threading.Thread):
def __init__(self, paths, callback):
threading.Thread.__init__(self)

View File

@@ -1,70 +1,72 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import threading
import os
import config
from eos import db
from eos.db import migration
from eos.db.saveddata.loadDefaultDatabaseValues import DefaultDatabaseValues
from eos.saveddata.character import Character as es_Character
class PrefetchThread(threading.Thread):
def run(self):
# We're a daemon thread, as such, interpreter might get shut down while we do stuff
# Make sure we don't throw tracebacks to console
try:
es_Character.setSkillList(db.getItemsByCategory("Skill", eager=("effects", "attributes", "attributes.info.icon", "attributes.info.unit", "icon")))
except:
pass
prefetch = PrefetchThread()
prefetch.daemon = True
prefetch.start()
# The following code does not belong here, however until we rebuild skeletons
# to include modified pyfa.py, this is the best place to put it. See GH issue
# #176
# @ todo: move this to pyfa.py
# Make sure the saveddata db exists
if config.savePath and not os.path.exists(config.savePath):
os.mkdir(config.savePath)
if config.saveDB and os.path.isfile(config.saveDB):
# If database exists, run migration after init'd database
db.saveddata_meta.create_all()
migration.update(db.saveddata_engine)
# Import default database values
# Import values that must exist otherwise Pyfa breaks
DefaultDatabaseValues.importRequiredDefaults()
elif config.saveDB:
# If database does not exist, do not worry about migration. Simply
# create and set version
db.saveddata_meta.create_all()
db.saveddata_engine.execute('PRAGMA user_version = {}'.format(migration.getAppVersion()))
# Import default database values
# Import values that must exist otherwise Pyfa breaks
DefaultDatabaseValues.importRequiredDefaults()
# Import default values for damage profiles
DefaultDatabaseValues.importDamageProfileDefaults()
# Import default values for target resist profiles
DefaultDatabaseValues.importResistProfileDefaults()
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import threading
import os
import config
from eos import db
from eos.db import migration
from eos.db.saveddata.loadDefaultDatabaseValues import DefaultDatabaseValues
from eos.saveddata.character import Character as es_Character
class PrefetchThread(threading.Thread):
def run(self):
# We're a daemon thread, as such, interpreter might get shut down while we do stuff
# Make sure we don't throw tracebacks to console
try:
es_Character.setSkillList(db.getItemsByCategory("Skill", eager=(
"effects", "attributes", "attributes.info.icon", "attributes.info.unit", "icon")))
except:
pass
prefetch = PrefetchThread()
prefetch.daemon = True
prefetch.start()
# The following code does not belong here, however until we rebuild skeletons
# to include modified pyfa.py, this is the best place to put it. See GH issue
# #176
# @ todo: move this to pyfa.py
# Make sure the saveddata db exists
if config.savePath and not os.path.exists(config.savePath):
os.mkdir(config.savePath)
if config.saveDB and os.path.isfile(config.saveDB):
# If database exists, run migration after init'd database
db.saveddata_meta.create_all()
migration.update(db.saveddata_engine)
# Import default database values
# Import values that must exist otherwise Pyfa breaks
DefaultDatabaseValues.importRequiredDefaults()
elif config.saveDB:
# If database does not exist, do not worry about migration. Simply
# create and set version
db.saveddata_meta.create_all()
db.saveddata_engine.execute('PRAGMA user_version = {}'.format(migration.getAppVersion()))
# Import default database values
# Import values that must exist otherwise Pyfa breaks
DefaultDatabaseValues.importRequiredDefaults()
# Import default values for damage profiles
DefaultDatabaseValues.importDamageProfileDefaults()
# Import default values for target resist profiles
DefaultDatabaseValues.importResistProfileDefaults()

View File

@@ -22,7 +22,6 @@ try:
except ImportError: # pragma: no cover
import cPickle as pickle
logger = logging.getLogger("pycrest.eve")
cache_re = re.compile(r'max-age=([0-9]+)')

View File

@@ -67,7 +67,7 @@ class WeakCiphersHTTPSConnection(urllib3.connection.VerifiedHTTPSConnection): #
warnings.warn((
'System time is way off (before {0}). This will probably '
'lead to SSL verification errors').format(
urllib3.connection.RECENT_DATE),
urllib3.connection.RECENT_DATE),
SystemTimeWarning
)
@@ -103,13 +103,11 @@ class WeakCiphersHTTPSConnection(urllib3.connection.VerifiedHTTPSConnection): #
class WeakCiphersHTTPSConnectionPool(
urllib3.connectionpool.HTTPSConnectionPool):
urllib3.connectionpool.HTTPSConnectionPool):
ConnectionCls = WeakCiphersHTTPSConnection
class WeakCiphersPoolManager(urllib3.poolmanager.PoolManager):
def _new_pool(self, scheme, host, port):
if scheme == 'https':
return WeakCiphersHTTPSConnectionPool(host, port, **(self.connection_pool_kw))

View File

@@ -77,7 +77,6 @@ class AuthHandler(BaseHTTPServer.BaseHTTPRequestHandler):
# http://code.activestate.com/recipes/425210-simple-stoppable-server-using-socket-timeout/
class StoppableHTTPServer(BaseHTTPServer.HTTPServer):
def server_bind(self):
BaseHTTPServer.HTTPServer.server_bind(self)
self.settings = CRESTSettings.getInstance()

View File

@@ -119,9 +119,9 @@ class NetworkSettings(object):
_instance = None
# constants for serviceNetworkDefaultSettings["mode"] parameter
PROXY_MODE_NONE = 0 # 0 - No proxy
PROXY_MODE_NONE = 0 # 0 - No proxy
PROXY_MODE_AUTODETECT = 1 # 1 - Auto-detected proxy settings
PROXY_MODE_MANUAL = 2 # 2 - Manual proxy settings
PROXY_MODE_MANUAL = 2 # 2 - Manual proxy settings
@classmethod
def getInstance(cls):
@@ -254,8 +254,15 @@ class HTMLExportSettings(object):
return cls._instance
def __init__(self):
serviceHTMLExportDefaultSettings = {"enabled": False, "path": config.pyfaPath + os.sep + 'pyfaFits.html', "minimal": False}
self.serviceHTMLExportSettings = SettingsProvider.getInstance().getSettings("pyfaServiceHTMLExportSettings", serviceHTMLExportDefaultSettings)
serviceHTMLExportDefaultSettings = {
"enabled": False,
"path": config.pyfaPath + os.sep + 'pyfaFits.html',
"minimal": False
}
self.serviceHTMLExportSettings = SettingsProvider.getInstance().getSettings(
"pyfaServiceHTMLExportSettings",
serviceHTMLExportDefaultSettings
)
def getEnabled(self):
return self.serviceHTMLExportSettings["enabled"]
@@ -295,7 +302,10 @@ class UpdateSettings(object):
# prerelease - If True, suppress prerelease notifications
# version - Set to release tag that user does not want notifications for
serviceUpdateDefaultSettings = {"prerelease": True, 'version': None}
self.serviceUpdateSettings = SettingsProvider.getInstance().getSettings("pyfaServiceUpdateSettings", serviceUpdateDefaultSettings)
self.serviceUpdateSettings = SettingsProvider.getInstance().getSettings(
"pyfaServiceUpdateSettings",
serviceUpdateDefaultSettings
)
def get(self, type):
return self.serviceUpdateSettings[type]
@@ -315,13 +325,15 @@ class CRESTSettings(object):
return cls._instance
def __init__(self):
# mode
# 0 - Implicit authentication
# 1 - User-supplied client details
serviceCRESTDefaultSettings = {"mode": 0, "server": 0, "clientID": "", "clientSecret": "", "timeout": 60}
self.serviceCRESTSettings = SettingsProvider.getInstance().getSettings("pyfaServiceCRESTSettings", serviceCRESTDefaultSettings)
self.serviceCRESTSettings = SettingsProvider.getInstance().getSettings(
"pyfaServiceCRESTSettings",
serviceCRESTDefaultSettings
)
def get(self, type):
return self.serviceCRESTSettings[type]
@@ -329,5 +341,4 @@ class CRESTSettings(object):
def set(self, type, value):
self.serviceCRESTSettings[type] = value
# @todo: migrate fit settings (from fit service) here?

View File

@@ -24,10 +24,12 @@ from eos.saveddata.targetResists import TargetResists as es_TargetResists
class ImportError(Exception):
pass
pass
class TargetResists(object):
instance = None
@classmethod
def getInstance(cls):
if cls.instance is None:

View File

@@ -42,7 +42,10 @@ class CheckUpdateThread(threading.Thread):
try:
response = network.request('https://api.github.com/repos/pyfa-org/Pyfa/releases', network.UPDATE)
jsonResponse = json.loads(response.read())
jsonResponse.sort(key=lambda x: calendar.timegm(dateutil.parser.parse(x['published_at']).utctimetuple()), reverse=True)
jsonResponse.sort(
key=lambda x: calendar.timegm(dateutil.parser.parse(x['published_at']).utctimetuple()),
reverse=True
)
for release in jsonResponse:
# Suppress pre releases
@@ -63,7 +66,9 @@ class CheckUpdateThread(threading.Thread):
else:
rVersion = release['tag_name'].replace('v', '', 1)
if config.tag is 'git' and not release['prerelease'] and self.versiontuple(rVersion) >= self.versiontuple(config.version):
if config.tag is 'git' and \
not release['prerelease'] and \
self.versiontuple(rVersion) >= self.versiontuple(config.version):
wx.CallAfter(self.callback, release) # git (dev/Singularity) -> Stable
elif config.expansionName is not "Singularity":
if release['prerelease']: