Convert old style classes to new

This commit is contained in:
Ebag333
2017-02-08 23:06:39 -08:00
parent 32944f4c9c
commit 9a137bb158
16 changed files with 149 additions and 138 deletions

View File

@@ -23,7 +23,7 @@ import logging
logger = logging.getLogger(__name__)
class DatabaseCleanup:
class DatabaseCleanup(object):
def __init__(self):
pass
@@ -86,7 +86,8 @@ class DatabaseCleanup:
else:
uniform_damage_pattern_id = rows[0]['ID']
update_query = "UPDATE 'fits' SET 'damagePatternID' = {} " \
"WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(uniform_damage_pattern_id)
"WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(
uniform_damage_pattern_id)
update_results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, update_query)
logger.error("Database corruption found. Cleaning up %d records.", update_results.rowcount)
@@ -118,7 +119,7 @@ class DatabaseCleanup:
logger.error("More than one 'All 5' character found.")
else:
all5_id = rows[0]['ID']
update_query = "UPDATE 'fits' SET 'characterID' = " + str(all5_id) + \
update_query = "UPDATE 'fits' SET 'characterID' = " + str(all5_id) + \
" WHERE characterID not in (select ID from characters) OR characterID IS NULL"
update_results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, update_query)
logger.error("Database corruption found. Cleaning up %d records.", update_results.rowcount)
@@ -167,7 +168,8 @@ class DatabaseCleanup:
# See issue #954
for table in ['drones', 'cargo', 'fighters']:
logger.debug("Running database cleanup for orphaned %s 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)
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)
results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query)
if results is None:
@@ -176,13 +178,15 @@ class DatabaseCleanup:
row = results.first()
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)
query = "DELETE FROM {} WHERE itemID IS NULL OR itemID = '' or itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format(
table)
delete = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query)
logger.error("Database corruption found. Cleaning up %d records.", delete.rowcount)
for table in ['modules']:
logger.debug("Running database cleanup for orphaned %s items.", table)
query = "SELECT COUNT(*) AS num FROM {} WHERE itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format(table)
query = "SELECT COUNT(*) AS num FROM {} WHERE itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format(
table)
results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query)
if results is None:
@@ -202,7 +206,8 @@ class DatabaseCleanup:
for profileType in ['damagePatterns', 'targetResists']:
for damageType in ['em', 'thermal', 'kinetic', 'explosive']:
logger.debug("Running database cleanup for null %s values. (%s)", profileType, damageType)
query = "SELECT COUNT(*) AS num FROM {0} WHERE {1}Amount IS NULL OR {1}Amount = ''".format(profileType, damageType)
query = "SELECT COUNT(*) AS num FROM {0} WHERE {1}Amount IS NULL OR {1}Amount = ''".format(profileType,
damageType)
results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query)
if results is None:
@@ -211,7 +216,8 @@ class DatabaseCleanup:
row = results.first()
if row and row['num']:
query = "UPDATE '{0}' SET '{1}Amount' = '0' WHERE {1}Amount IS NULL OR Amount = ''".format(profileType, damageType)
query = "UPDATE '{0}' SET '{1}Amount' = '0' WHERE {1}Amount IS NULL OR Amount = ''".format(profileType,
damageType)
delete = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query)
logger.error("Database corruption found. Cleaning up %d records.", delete.rowcount)

View File

@@ -26,7 +26,7 @@ class ImportError(Exception):
pass
class DefaultDatabaseValues():
class DefaultDatabaseValues(object):
def __init__(self):
pass

View File

@@ -1,4 +1,4 @@
class Enum():
class Enum(object):
def __init__(self):
pass

View File

@@ -43,7 +43,7 @@ class ChargeAttrShortcut(object):
class ModifiedAttributeDict(collections.MutableMapping):
OVERRIDES = False
class CalculationPlaceholder():
class CalculationPlaceholder(object):
def __init__(self):
pass
@@ -359,7 +359,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
self.__afflict(attributeName, u"\u2263", value)
class Affliction():
class Affliction(object):
def __init__(self, type, amount):
self.type = type
self.amount = amount

View File

@@ -33,7 +33,7 @@ except ImportError:
from utils.compat import OrderedDict
class BitmapLoader():
class BitmapLoader(object):
try:
archive = zipfile.ZipFile(config.getPyfaPath('imgs.zip'), 'r')
except IOError:

View File

@@ -36,7 +36,7 @@ PageAdded, EVT_NOTEBOOK_PAGE_ADDED = wx.lib.newevent.NewEvent()
PageClosed, EVT_NOTEBOOK_PAGE_CLOSED = wx.lib.newevent.NewEvent()
class VetoAble():
class VetoAble(object):
def __init__(self):
self.__vetoed = False
@@ -47,7 +47,7 @@ class VetoAble():
return self.__vetoed
class NotebookTabChangeEvent():
class NotebookTabChangeEvent(object):
def __init__(self, old, new):
self.__old = old
self.__new = new
@@ -337,7 +337,7 @@ class PFNotebook(wx.Panel):
event.Skip()
class PFTabRenderer:
class PFTabRenderer(object):
def __init__(self, size=(36, 24), text=wx.EmptyString, img=None, inclination=6, closeButton=True):
"""
Renders a new tab
@@ -529,8 +529,8 @@ class PFTabRenderer:
self.tabRegion = wx.RegionFromBitmap(self.tabBackBitmap)
self.closeBtnRegion = wx.RegionFromBitmap(self.ctabCloseBmp)
self.closeBtnRegion.Offset(
self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2,
(self.tabHeight - self.ctabCloseBmp.GetHeight()) / 2
self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2,
(self.tabHeight - self.ctabCloseBmp.GetHeight()) / 2
)
def InitColors(self):
@@ -593,9 +593,9 @@ class PFTabRenderer:
cbmp = wx.BitmapFromImage(cimg)
mdc.DrawBitmap(
cbmp,
self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2,
(height - self.ctabCloseBmp.GetHeight()) / 2,
cbmp,
self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2,
(height - self.ctabCloseBmp.GetHeight()) / 2,
)
mdc.SelectObject(wx.NullBitmap)
@@ -611,11 +611,11 @@ class PFTabRenderer:
def __repr__(self):
return "PFTabRenderer(text={}, disabled={}) at {}".format(
self.text, self.disabled, hex(id(self))
self.text, self.disabled, hex(id(self))
)
class PFAddRenderer:
class PFAddRenderer(object):
def __init__(self):
"""Renders the add tab button"""
self.addImg = BitmapLoader.getImage("ctabadd", "gui")

View File

@@ -29,13 +29,13 @@ from service.fit import Fit
from eos.saveddata.drone import Drone as es_Drone
class DummyItem:
class DummyItem(object):
def __init__(self, txt):
self.name = txt
self.icon = None
class DummyEntry:
class DummyEntry(object):
def __init__(self, txt):
self.item = DummyItem(txt)

View File

@@ -31,13 +31,13 @@ from eos.saveddata.fighter import Fighter as es_Fighter
from eos.saveddata.module import Module as es_Module
class DummyItem:
class DummyItem(object):
def __init__(self, txt):
self.name = txt
self.icon = None
class DummyEntry:
class DummyEntry(object):
def __init__(self, txt):
self.item = DummyItem(txt)

View File

@@ -7,7 +7,7 @@ from service.fit import Fit
from service.market import Market
class exportHtml():
class exportHtml(object):
_instance = None
@classmethod

View File

@@ -20,7 +20,7 @@
import eos.db
class Attribute():
class Attribute(object):
instance = None
@classmethod

View File

@@ -28,9 +28,9 @@ class CrestModes(Enum):
USER = 1
class Crest():
class Crest(object):
clientIDs = {
Servers.TQ: 'f9be379951c046339dc13a00e6be7704',
Servers.TQ : 'f9be379951c046339dc13a00e6be7704',
Servers.SISI: 'af87365240d644f7950af563b8418bad'
}
@@ -78,11 +78,11 @@ 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')),
api_key=self.settings.get('clientSecret') if self.settings.get('mode') == CrestModes.USER else None,
redirect_uri=self.clientCallback,
testing=self.isTestServer
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
)
self.implicitCharacter = None
@@ -187,8 +187,8 @@ class Crest():
if 'access_token' in message: # implicit
eve = copy.deepcopy(self.eve)
eve.temptoken_authorize(
access_token=message['access_token'][0],
expires_in=int(message['expires_in'][0])
access_token=message['access_token'][0],
expires_in=int(message['expires_in'][0])
)
self.ssoTimer = threading.Timer(int(message['expires_in'][0]), self.logout)
self.ssoTimer.start()

View File

@@ -27,7 +27,7 @@ class ImportError(Exception):
pass
class DamagePattern():
class DamagePattern(object):
instance = None
@classmethod

View File

@@ -169,7 +169,7 @@ class SearchWorkerThread(threading.Thread):
self.cv.release()
class Market():
class Market(object):
instance = None
def __init__(self):
@@ -179,7 +179,7 @@ class Market():
serviceMarketRecentlyUsedModules = {"pyfaMarketRecentlyUsedModules": []}
self.serviceMarketRecentlyUsedModules = SettingsProvider.getInstance().getSettings(
"pyfaMarketRecentlyUsedModules", serviceMarketRecentlyUsedModules)
"pyfaMarketRecentlyUsedModules", serviceMarketRecentlyUsedModules)
# Start price fetcher
self.priceWorkerThread = PriceWorkerThread()
@@ -209,41 +209,41 @@ class Market():
self.les_grp.description = ""
self.les_grp.icon = None
self.ITEMS_FORCEGROUP = {
"Opux Luxury Yacht": self.les_grp,
"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
"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
"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
"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
"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
"Imp": self.les_grp, # AT13 prize
"Fiend": self.les_grp, # AT13 prize
"Caedes": self.les_grp, # AT14 prize
"Rabisu": self.les_grp, # AT14 prize
"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
"Imp" : self.les_grp, # AT13 prize
"Fiend" : self.les_grp, # AT13 prize
"Caedes" : self.les_grp, # AT14 prize
"Rabisu" : self.les_grp, # AT14 prize
}
self.ITEMS_FORCEGROUP_R = self.__makeRevDict(self.ITEMS_FORCEGROUP)
@@ -252,26 +252,26 @@ 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
"QA Damage Module": False,
"QA ECCM": False,
"QA Immunity Module": False,
"QA Multiship Module - 10 Players": False,
"QA Multiship Module - 20 Players": False,
"QA Multiship Module - 40 Players": False,
"QA Multiship Module - 5 Players": False,
"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,
"QA Multiship Module - 10 Players" : False,
"QA Multiship Module - 20 Players" : False,
"QA Multiship Module - 40 Players" : False,
"QA Multiship Module - 5 Players" : False,
"QA Remote Armor Repair System - 5 Players": False,
"QA Shield Transporter - 5 Players": False,
"Goru's Shuttle": False,
"Guristas Shuttle": False,
"Mobile Decoy Unit": False, # Seems to be left over test mod for deployables
"Tournament Micro Jump Unit": False, # Normally seen only on tournament arenas
"Council Diplomatic Shuttle": False, # CSM X celebration
"Civilian Gatling Railgun": True,
"Civilian Gatling Pulse Laser": True,
"Civilian Gatling Autocannon": True,
"Civilian Light Electron Blaster": True,
"QA Shield Transporter - 5 Players" : False,
"Goru's Shuttle" : False,
"Guristas Shuttle" : False,
"Mobile Decoy Unit" : False, # Seems to be left over test mod for deployables
"Tournament Micro Jump Unit" : False, # Normally seen only on tournament arenas
"Council Diplomatic Shuttle" : False, # CSM X celebration
"Civilian Gatling Railgun" : True,
"Civilian Gatling Pulse Laser" : True,
"Civilian Gatling Autocannon" : True,
"Civilian Light Electron Blaster" : True,
}
# do not publish ships that we convert
@@ -289,16 +289,18 @@ 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)
self.ITEMS_FORCEDMETAGROUP = {
"'Habitat' Miner I": ("Storyline", "Miner I"),
"'Wild' Miner I": ("Storyline", "Miner I"),
"Medium Nano Armor Repair Unit I": ("Tech I", "Medium Armor Repairer I"),
"'Habitat' Miner I" : ("Storyline", "Miner I"),
"'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():
@@ -309,57 +311,58 @@ class Market():
# 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,
"'Alpha' Data Analyzer I" : 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Codex' Data Analyzer I": 714,
"'Codex' Data Analyzer I" : 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Daemon' Data Analyzer I": 714,
"'Daemon' Data Analyzer I" : 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"'Libram' Data Analyzer I": 714,
"'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,
"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,
"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,
"Civilian Light Missile Launcher" : 640,
# Ship Equipment > Turrets & Bays > Missile Launchers > Light Missile Launchers
"Civilian Scourge Light Missile": 920,
"Civilian Scourge Light Missile" : 920,
# Ammunition & Charges > Missiles > Light Missiles > Standard Light Missiles
"Civilian Small Remote Armor Repairer": 1059,
"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,
"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,
"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,
"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,
"Hardwiring - Zainou 'Sharpshooter' ZMX11" : 1493,
# Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06
"Hardwiring - Zainou 'Sharpshooter' ZMX110": 1493,
"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,
"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,
"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,
"Terran Data Analyzer I" : 714,
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
"Tetrimon Data Analyzer I": 714
"Tetrimon Data Analyzer I" : 714
# Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners
}
@@ -617,7 +620,7 @@ class Market():
if hasattr(group, 'addItems'):
groupItems.update(group.addItems)
items = set(
filter(lambda item: self.getPublicityByItem(item) and self.getGroupByItem(item) == group, groupItems))
filter(lambda item: self.getPublicityByItem(item) and self.getGroupByItem(item) == group, groupItems))
return items
def getItemsByMarketGroup(self, mg, vars_=True):

View File

@@ -51,7 +51,7 @@ class TimeoutError(StandardError):
pass
class Network():
class Network(object):
# Request constants - every request must supply this, as it is checked if
# enabled or not via settings
ENABLED = 1
@@ -90,8 +90,10 @@ class Network():
# proxy_auth is a tuple of (login, password) or None
if proxy_auth is not None:
# add login:password@ in front of proxy address
proxy_handler = urllib2.ProxyHandler({'https': '{0}:{1}@{2}:{3}'.format(
proxy_auth[0], proxy_auth[1], proxy[0], proxy[1])})
proxy_handler = urllib2.ProxyHandler({
'https': '{0}:{1}@{2}:{3}'.format(
proxy_auth[0], proxy_auth[1], proxy[0], proxy[1])
})
else:
# build proxy handler with no login/pass info
proxy_handler = urllib2.ProxyHandler({'https': "{0}:{1}".format(proxy[0], proxy[1])})

View File

@@ -89,7 +89,7 @@ class CheckUpdateThread(threading.Thread):
return tuple(map(int, (v.split("."))))
class Update():
class Update(object):
instance = None
def CheckUpdate(self, callback):

View File

@@ -1,7 +1,7 @@
import time
class Timer():
class Timer(object):
def __init__(self, name='', logger=None):
self.name = name
self.start = time.time()
@@ -18,10 +18,10 @@ class Timer():
def checkpoint(self, name=''):
text = u'Timer - {timer} - {checkpoint} - {last:.2f}ms ({elapsed:.2f}ms elapsed)'.format(
timer=self.name,
checkpoint=unicode(name, "utf-8"),
last=self.last,
elapsed=self.elapsed
timer=self.name,
checkpoint=unicode(name, "utf-8"),
last=self.last,
elapsed=self.elapsed
).strip()
self.__last = time.time()
if self.logger: