Skip to content

Commit eeb700c

Browse files
committed
Get back into tox's good graces
1 parent 9bb83d4 commit eeb700c

25 files changed

+43
-61
lines changed

eos/db/saveddata/character.py

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
from eos.saveddata.character import Character, Skill
3030
from eos.saveddata.ssocharacter import SsoCharacter
3131

32-
33-
34-
3532
characters_table = Table("characters", saveddata_meta,
3633
Column("ID", Integer, primary_key=True),
3734
Column("name", String, nullable=False),

eos/effects/warpscrambleblockmwdwithnpceffect.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def handler(fit, module, context):
1717
# this is such a dirty hack
1818
for mod in fit.modules:
1919
if not mod.isEmpty and mod.state > State.ONLINE and (
20-
mod.item.requiresSkill("Micro Jump Drive Operation")
21-
or mod.item.requiresSkill("High Speed Maneuvering")
20+
mod.item.requiresSkill("Micro Jump Drive Operation") or
21+
mod.item.requiresSkill("High Speed Maneuvering")
2222
):
2323
mod.state = State.ONLINE
2424
if not mod.isEmpty and mod.item.requiresSkill("Micro Jump Drive Operation") and mod.state > State.ONLINE:

eos/saveddata/character.py

-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ def setSsoCharacter(self, character, clientHash):
170170
if x.client == clientHash:
171171
self.__ssoCharacters.remove(x)
172172

173-
174173
def getSsoCharacter(self, clientHash):
175174
return next((x for x in self.__ssoCharacters if x.client == clientHash), None)
176175

eos/saveddata/ssocharacter.py

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def __init__(self, charID, name, client, accessToken=None, refreshToken=None):
3333
self.refreshToken = refreshToken
3434
self.accessTokenExpires = None
3535

36-
3736
@reconstructor
3837
def init(self):
3938
pass

gui/builtinPreferenceViews/pyfaEsiPreferences.py

+8-14
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ def populatePanel(self, panel):
4343
rbSizer = wx.BoxSizer(wx.HORIZONTAL)
4444
self.rbMode = wx.RadioBox(panel, -1, "Login Authentication Method", wx.DefaultPosition, wx.DefaultSize,
4545
['Local Server', 'Manual'], 1, wx.RA_SPECIFY_COLS)
46-
self.rbMode.SetItemToolTip(0, "This options starts a local webserver that the web application will call back to with information about the character login.")
47-
self.rbMode.SetItemToolTip(1, "This option prompts users to copy and paste information from the web application to allow for character login. Use this if having issues with the local server.")
46+
self.rbMode.SetItemToolTip(0, "This options starts a local webserver that the web application will call back to"
47+
" with information about the character login.")
48+
self.rbMode.SetItemToolTip(1, "This option prompts users to copy and paste information from the web application "
49+
"to allow for character login. Use this if having issues with the local server.")
4850

4951
self.rbSsoMode = wx.RadioBox(panel, -1, "SSO Mode", wx.DefaultPosition, wx.DefaultSize,
5052
['pyfa.io', 'Custom application'], 1, wx.RA_SPECIFY_COLS)
51-
self.rbSsoMode.SetItemToolTip(0, "This options routes SSO Logins through pyfa.io, allowing you to easily login without any configuration. When in doubt, use this option.")
52-
self.rbSsoMode.SetItemToolTip(1, "This option goes through EVE SSO directly, but requires more configuration. Use this is pyfa.io is blocked for some reason, or if you do not wish to route data throguh pyfa.io.")
53+
self.rbSsoMode.SetItemToolTip(0, "This options routes SSO Logins through pyfa.io, allowing you to easily login "
54+
"without any configuration. When in doubt, use this option.")
55+
self.rbSsoMode.SetItemToolTip(1, "This option goes through EVE SSO directly, but requires more configuration. Use "
56+
"this is pyfa.io is blocked for some reason, or if you do not wish to route data throguh pyfa.io.")
5357

5458
self.rbMode.SetSelection(self.settings.get('loginMode'))
5559
self.rbSsoMode.SetSelection(self.settings.get('ssoMode'))
@@ -70,12 +74,6 @@ def populatePanel(self, panel):
7074
mainSizer.Add(wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0,
7175
wx.EXPAND, 5)
7276

73-
# self.stInfo = wx.StaticText(panel, wx.ID_ANY,
74-
# u"Using custom applications details will let pyfa to access the SSO under your application, rather than the pyfa application that is automatically set up. This requires you to set up your own ESI client application and accept CCPs License Agreement. Additionally, when setting up your client, make sure the callback url is set to 'http://localhost:6461'. Please see the pyfa wiki for more information regarding this",
75-
# wx.DefaultPosition, wx.DefaultSize, 0)
76-
# self.stInfo.Wrap(dlgWidth)
77-
# mainSizer.Add(self.stInfo, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
78-
7977
fgAddrSizer = wx.FlexGridSizer(2, 2, 0, 0)
8078
fgAddrSizer.AddGrowableCol(1)
8179
fgAddrSizer.SetFlexibleDirection(wx.BOTH)
@@ -105,10 +103,6 @@ def populatePanel(self, panel):
105103

106104
mainSizer.Add(fgAddrSizer, 0, wx.EXPAND, 5)
107105

108-
109-
110-
timeoutSizer = wx.BoxSizer(wx.HORIZONTAL)
111-
112106
# self.stTimout = wx.StaticText(panel, wx.ID_ANY, "Timeout (seconds):", wx.DefaultPosition, wx.DefaultSize, 0)
113107
# self.stTimout.Wrap(-1)
114108
#

gui/builtinPreferenceViews/pyfaNetworkPreferences.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def populatePanel(self, panel):
150150
proxy = self.settings.autodetect()
151151

152152
if proxy is not None:
153-
addr, port = proxy
154-
txt = addr + ":" + str(port)
153+
addr, port = proxy
154+
txt = addr + ":" + str(port)
155155
else:
156-
txt = "None"
156+
txt = "None"
157157

158158
self.stPSAutoDetected.SetLabel("Auto-detected: " + txt)
159159
self.stPSAutoDetected.Disable()

gui/builtinStatsViews/firepowerViewFull.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def switchToMiningYieldView(self, event):
129129
# Remove effective label
130130
hsizer = self.headerPanel.GetSizer()
131131
hsizer.Hide(self.stEff)
132-
#self.stEff.Destroy()
132+
# self.stEff.Destroy()
133133

134134
# Get the new view
135135
view = StatsView.getView("miningyieldViewFull")(self.parent)

gui/characterEditor.py

-1
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ def charChanged(self, event):
830830
if sso is None:
831831
self.charChoice.SetSelection(noneID)
832832

833-
834833
#
835834
# if chars:
836835
# for charName in chars:

gui/characterSelection.py

-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ def refreshAPICallback(self, e=None):
170170
def charChanged(self, event):
171171
fitID = self.mainFrame.getActiveFit()
172172
charID = self.getActiveCharacter()
173-
sChar = Character.getInstance()
174173

175174
if charID == -1:
176175
# revert to previous character

gui/chrome_tabs.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#===============================================================================
1+
# ===============================================================================
22
#
33
# ToDo: Bug - when selecting close on a tab, sometimes the tab to the right is
44
# selected, most likely due to determination of mouse position
@@ -11,7 +11,7 @@
1111
# tab index?). This will also help with finding close buttons.
1212
# ToDo: Fix page preview code (PFNotebookPagePreview)
1313
#
14-
#= ==============================================================================
14+
# ===============================================================================
1515

1616
import wx
1717
import wx.lib.newevent
@@ -413,7 +413,7 @@ def GetMinSize(self):
413413
mdc.SelectObject(ebmp)
414414
mdc.SetFont(self.font)
415415
textSizeX, textSizeY = mdc.GetTextExtent(self.text)
416-
totalSize = self.left_width + self.right_width + textSizeX + self.close_btn_width / 2 + 16 + self.padding* 2
416+
totalSize = self.left_width + self.right_width + textSizeX + self.close_btn_width / 2 + 16 + self.padding * 2
417417
mdc.SelectObject(wx.NullBitmap)
418418
return totalSize, self.tab_height
419419

@@ -1478,4 +1478,3 @@ def OnCreate(self, event):
14781478
top = Frame("Test Chrome Tabs")
14791479
top.Show()
14801480
app.MainLoop()
1481-

gui/esiFittings.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def __init__(self, parent):
2929

3030
self.mainFrame = parent
3131
mainSizer = wx.BoxSizer(wx.VERTICAL)
32-
sEsi = Esi.getInstance()
3332

3433
characterSelectSizer = wx.BoxSizer(wx.HORIZONTAL)
3534

@@ -119,10 +118,11 @@ def fetchFittings(self, event):
119118
pyfalog.error(msg)
120119
self.statusbar.SetStatusText(msg)
121120
except APIException as ex:
122-
del waitDialog # Can't do this in a finally because then it obscures the message dialog
121+
# Can't do this in a finally because then it obscures the message dialog
122+
del waitDialog # noqa: F821
123123
ESIExceptionHandler(self, ex)
124124
except Exception as ex:
125-
del waitDialog
125+
del waitDialog # noqa: F821
126126
raise ex
127127

128128
def importFitting(self, event):
@@ -180,7 +180,6 @@ def __init__(self, parent):
180180
self.mainFrame = parent
181181
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
182182

183-
sEsi = Esi.getInstance()
184183
mainSizer = wx.BoxSizer(wx.VERTICAL)
185184
hSizer = wx.BoxSizer(wx.HORIZONTAL)
186185

@@ -232,7 +231,6 @@ def getActiveCharacter(self):
232231
return self.charChoice.GetClientData(selection) if selection is not None else None
233232

234233
def exportFitting(self, event):
235-
sPort = Port.getInstance()
236234
fitID = self.mainFrame.getActiveFit()
237235

238236
self.statusbar.SetStatusText("", 0)
@@ -242,12 +240,8 @@ def exportFitting(self, event):
242240
return
243241

244242
self.statusbar.SetStatusText("Sending request and awaiting response", 1)
245-
sEsi = Esi.getInstance()
246243

247244
try:
248-
sFit = Fit.getInstance()
249-
data = sPort.exportESI(sFit.getFit(fitID))
250-
res = sEsi.postFitting(self.getActiveCharacter(), data)
251245

252246
self.statusbar.SetStatusText("", 0)
253247
self.statusbar.SetStatusText("", 1)
@@ -307,7 +301,7 @@ def __init__(self, parent):
307301

308302
def ssoLogin(self, event):
309303
if (self):
310-
#todo: these events don't unbind properly when window is closed (?), hence the `if`. Figure out better way of doing this.
304+
# todo: these events don't unbind properly when window is closed (?), hence the `if`. Figure out better way of doing this.
311305
self.popCharList()
312306
event.Skip()
313307

gui/ssoLogin.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import wx
22

3+
34
class SsoLogin(wx.Dialog):
45
def __init__(self, parent):
56
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="SSO Login", size=wx.Size(400, 240))

gui/updateDialog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(self, parent, release, version):
7676
releaseDate.strftime('%B %d, %Y'),
7777
"<p class='text-danger'><b>This is a pre-release, be prepared for unstable features</b></p>" if version.is_prerelease else "",
7878
markdowner.convert(self.releaseInfo['body'])
79-
),"")
79+
), "")
8080

8181
notesSizer.Add(self.browser, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
8282
mainSizer.Add(notesSizer, 1, wx.EXPAND, 5)

gui/utils/exportHtml.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def generateFullHTML(self, sMkt, sFit, dnaUrl):
8686
<head>
8787
<title>Pyfa Fittings</title>
8888
<meta name="viewport" content="width=device-width, initial-scale=1">
89-
<meta charset="utf-8" />
89+
<meta charset="utf-8" />
9090
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
9191
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
9292
<script>

service/character.py

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def run(self):
123123

124124
wx.CallAfter(self.callback)
125125

126+
126127
class Character(object):
127128
instance = None
128129
skillReqsDict = {}

service/esi.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from service.settings import EsiSettings
1818
from service.esiAccess import EsiAccess
1919

20-
import wx
2120
from requests import Session
2221

2322
pyfalog = Logger(__name__)
@@ -108,7 +107,8 @@ def login(self):
108107
serverAddr = None
109108
# always start the local server if user is using client details. Otherwise, start only if they choose to do so.
110109
if self.settings.get('ssoMode') == SsoMode.CUSTOM or self.settings.get('loginMode') == LoginMethod.SERVER:
111-
serverAddr = self.startServer(6461 if self.settings.get('ssoMode') == SsoMode.CUSTOM else 0) # random port, or if it's custom application, use a defined port
110+
# random port, or if it's custom application, use a defined port
111+
serverAddr = self.startServer(6461 if self.settings.get('ssoMode') == SsoMode.CUSTOM else 0)
112112
uri = self.getLoginURI(serverAddr)
113113
webbrowser.open(uri)
114114
wx.PostEvent(self.mainFrame, GE.SsoLoggingIn(sso_mode=self.settings.get('ssoMode'), login_mode=self.settings.get('loginMode')))
@@ -181,4 +181,3 @@ def handleServerLogin(self, message):
181181
pyfalog.debug("Handling SSO login with: {0}", message)
182182

183183
self.handleLogin(message)
184-

service/esiAccess.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def get_refresh_token_params(self, refreshToken):
180180
data = {
181181
'grant_type': 'refresh_token',
182182
'refresh_token': refreshToken,
183-
}
183+
}
184184

185185
if self.settings.get('ssoMode') == SsoMode.AUTO:
186186
# data is all we really need, the rest is handled automatically by pyfa.io
@@ -281,4 +281,3 @@ def delete(self, ssoChar, endpoint, *args, **kwargs):
281281
self._before_request(ssoChar)
282282
endpoint = endpoint.format(**kwargs)
283283
return self._after_request(self._session.delete("{}{}".format(self.esi_url, endpoint)))
284-

service/fit.py

-2
Original file line numberDiff line numberDiff line change
@@ -1209,11 +1209,9 @@ def recalc(self, fit):
12091209
start_time = time()
12101210
pyfalog.info("=" * 10 + "recalc: {0}" + "=" * 10, fit.name)
12111211

1212-
12131212
fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"]
12141213
fit.clear()
12151214

12161215
fit.calculateModifiedAttributes()
12171216

12181217
pyfalog.info("=" * 10 + "recalc time: " + str(time() - start_time) + "=" * 10)
1219-

service/jargon/jargon.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@
2020
import config
2121
import pkg_resources
2222

23+
2324
class Jargon(object):
2425
def __init__(self, rawdata: dict):
2526
self._rawdata = rawdata
2627

2728
# copy the data to lowercase keys, ignore blank keys
28-
self._data = {str(k).lower():v for k,v in rawdata.items() if k}
29+
self._data = {str(k).lower(): v for k, v in rawdata.items() if k}
2930

3031
def get(self, term: str) -> str:
3132
return self._data.get(term.lower())
3233

33-
def get_rawdata() -> dict:
34+
def get_rawdata(self) -> dict:
3435
return self._rawdata
3536

3637
def apply(self, query):

service/jargon/loader.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626

2727
JARGON_PATH = os.path.join(config.savePath, 'jargon.yaml')
2828

29+
2930
class JargonLoader(object):
3031
def __init__(self, jargon_path: str):
3132
self.jargon_path = jargon_path
32-
self._jargon_mtime = 0 # type: int
33-
self._jargon = None # type: Jargon
33+
self._jargon_mtime = 0 # type: int
34+
self._jargon = None # type: Jargon
3435

3536
def get_jargon(self) -> Jargon:
3637
if self._is_stale():
@@ -58,7 +59,7 @@ def _get_jargon_file_mtime(self) -> int:
5859
def init_user_jargon(jargon_path):
5960
values = yaml.load(DEFAULT_DATA)
6061

61-
## Disabled for issue/1533; do not overwrite existing user config
62+
# Disabled for issue/1533; do not overwrite existing user config
6263
# if os.path.exists(jargon_path):
6364
# with open(jargon_path) as f:
6465
# custom_values = yaml.load(f)
@@ -72,11 +73,13 @@ def init_user_jargon(jargon_path):
7273
yaml.dump(values, stream=f, default_flow_style=False)
7374

7475
_instance = None
76+
7577
@staticmethod
7678
def instance(jargon_path=None):
7779
if not JargonLoader._instance:
7880
jargon_path = jargon_path or JARGON_PATH
7981
JargonLoader._instance = JargonLoader(jargon_path)
8082
return JargonLoader._instance
8183

84+
8285
JargonLoader.init_user_jargon(JARGON_PATH)

service/market.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
# Event which tells threads dependent on Market that it's initialized
4242
mktRdy = threading.Event()
4343

44+
4445
class ShipBrowserWorkerThread(threading.Thread):
4546
def __init__(self):
4647
threading.Thread.__init__(self)
@@ -113,10 +114,8 @@ def processSearches(self):
113114
else:
114115
filter_ = None
115116

116-
117117
jargon_request = self.jargonLoader.get_jargon().apply(request)
118118

119-
120119
results = []
121120
if len(request) >= config.minItemSearchLength:
122121
results = eos.db.searchItems(request, where=filter_,

service/marketSources/evemarketdata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class EveMarketData(object):
3535
def __init__(self, types, system, priceMap):
3636
data = {}
3737
baseurl = "https://eve-marketdata.com/api/item_prices.xml"
38-
data["system_id"] = system # Use Jita for market
38+
data["system_id"] = system # Use Jita for market
3939
data["type_ids"] = ','.join(str(x) for x in types)
4040

4141
network = Network.getInstance()

service/port.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
class ESIExportException(Exception):
5959
pass
6060

61+
6162
pyfalog = Logger(__name__)
6263

6364
EFT_SLOT_ORDER = [Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE]
@@ -349,7 +350,6 @@ def exportESI(cls, ofit, callback=None):
349350

350351
nested_dict = lambda: collections.defaultdict(nested_dict)
351352
fit = nested_dict()
352-
sEsi = Esi.getInstance()
353353
sFit = svcFit.getInstance()
354354

355355
# max length is 50 characters

0 commit comments

Comments
 (0)