Remove redundant parenthesis

This commit is contained in:
blitzmann
2018-09-16 01:11:16 -04:00
parent 5850026aa9
commit 31c3101d6d
24 changed files with 45 additions and 45 deletions

View File

@@ -100,8 +100,8 @@ def DBInMemory():
import eos.db
# Output debug info to help us troubleshoot Travis
print((eos.db.saveddata_engine))
print((eos.db.gamedata_engine))
print(eos.db.saveddata_engine)
print(eos.db.gamedata_engine)
helper = {
'config': eos.config,

View File

@@ -38,7 +38,7 @@ call([
iscc,
os.path.join(os.getcwd(), "dist_assets", "win", "pyfa-setup.iss"),
"/dMyAppVersion=%s" % (config['version']),
"/dMyAppExpansion=%s" % (expansion),
"/dMyAppExpansion=%s" % expansion,
"/dMyAppDir=%s" % source,
"/dMyOutputDir=%s" % os.path.join(os.getcwd(), "dist"),
"/dMyOutputFile=%s" % fileName]) # stdout=devnull, stderr=devnull

View File

@@ -166,14 +166,14 @@ class Effect(EqBase):
t = t if isinstance(t, tuple) or t is None else (t,)
self.__type = t
except (ImportError) as e:
except ImportError as e:
# Effect probably doesn't exist, so create a dummy effect and flag it with a warning.
self.__handler = effectDummy
self.__runTime = "normal"
self.__activeByDefault = True
self.__type = None
pyfalog.debug("ImportError generating handler: {0}", e)
except (AttributeError) as e:
except AttributeError as e:
# Effect probably exists but there is an issue with it. Turn it into a dummy effect so we can continue, but flag it with an error.
self.__handler = effectDummy
self.__runTime = "normal"
@@ -630,8 +630,8 @@ class Unit(EqBase):
def attributeIDCallback(v):
v = int(v)
if not v: # some attributes come through with a value of 0? See #1387
return "%d" % (v)
attribute = eos.db.getAttributeInfo(v, eager=("unit"))
return "%d" % v
attribute = eos.db.getAttributeInfo(v, eager="unit")
return "%s (%d)" % (attribute.name.capitalize(), v)
def TranslateValue(self, value):

View File

@@ -382,7 +382,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
if resist:
afflictPenal += "r"
self.__afflict(attributeName, "%s*" % (afflictPenal), multiplier, multiplier != 1)
self.__afflict(attributeName, "%s*" % afflictPenal, multiplier, multiplier != 1)
def boost(self, attributeName, boostFactor, skill=None, *args, **kwargs):
"""Boost value by some percentage"""

View File

@@ -649,7 +649,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
for i in range(5):
itemChargeGroup = self.getModifiedItemAttr('chargeGroup' + str(i), None)
if itemChargeGroup is not None:
g = eos.db.getGroup(int(itemChargeGroup), eager=("items.attributes"))
g = eos.db.getGroup(int(itemChargeGroup), eager="items.attributes")
if g is None:
continue
for singleItem in g.items:

View File

@@ -131,7 +131,7 @@ class Ship(ItemAttrShortcut, HandledItem):
return None
items = []
g = eos.db.getGroup("Ship Modifiers", eager=("items.attributes"))
g = eos.db.getGroup("Ship Modifiers", eager="items.attributes")
for item in g.items:
# Rely on name detection because race is not reliable
if item.name.lower().startswith(self.item.name.lower()):

View File

@@ -16,7 +16,7 @@ class BoosterSideEffect(ContextMenu):
# if not self.settings.get('fighterAbilities'):
# return False
if self.mainFrame.getActiveFit() is None or srcContext not in ("boosterItem"):
if self.mainFrame.getActiveFit() is None or srcContext not in "boosterItem":
return False
self.booster = selection[0]

View File

@@ -18,7 +18,7 @@ class MutaplasmidCM(ContextMenu):
# if not self.settings.get('ammoPattern'):
# return False
if srcContext not in ("fittingModule") or self.mainFrame.getActiveFit() is None:
if srcContext not in "fittingModule" or self.mainFrame.getActiveFit() is None:
return False
mod = selection[0]

View File

@@ -129,15 +129,15 @@ class PriceViewFull(StatsView):
total_price = 0
if (self.settings.get("ship")):
if self.settings.get("ship"):
total_price += ship_price
if (self.settings.get("modules")):
if self.settings.get("modules"):
total_price += module_price
if (self.settings.get("drones")):
if self.settings.get("drones"):
total_price += drone_price + fighter_price
if (self.settings.get("cargo")):
if self.settings.get("cargo"):
total_price += cargo_price
if (self.settings.get("character")):
if self.settings.get("character"):
total_price += booster_price + implant_price
self.labelPriceShip.SetLabel("%s ISK" % formatAmount(ship_price, 3, 3, 9, currency=True))

View File

@@ -125,15 +125,15 @@ class PriceViewMinimal(StatsView):
total_price = 0
if (self.settings.get("ship")):
if self.settings.get("ship"):
total_price += ship_price
if (self.settings.get("modules")):
if self.settings.get("modules"):
total_price += module_price
if (self.settings.get("drones")):
if self.settings.get("drones"):
total_price += drone_price + fighter_price
if (self.settings.get("cargo")):
if self.settings.get("cargo"):
total_price += cargo_price
if (self.settings.get("character")):
if self.settings.get("character"):
total_price += booster_price + implant_price
self.labelPriceShip.SetLabel("%s ISK" % formatAmount(ship_price, 3, 3, 9, currency=True))

View File

@@ -30,7 +30,7 @@ PageAdded, EVT_NOTEBOOK_PAGE_ADDED = wx.lib.newevent.NewEvent()
PageClosed, EVT_NOTEBOOK_PAGE_CLOSED = wx.lib.newevent.NewEvent()
class VetoAble():
class VetoAble:
def __init__(self):
self.__vetoed = False
@@ -41,7 +41,7 @@ class VetoAble():
return self.__vetoed
class NotebookTabChangeEvent():
class NotebookTabChangeEvent:
def __init__(self, old, new):
self.__old = old
self.__new = new

View File

@@ -319,7 +319,7 @@ class SsoCharacterMgmt(wx.Dialog):
self.Centre(wx.BOTH)
def ssoLogin(self, event):
if (self):
if self:
# todo: these events don't unbind properly when window is closed (?), hence the `if`. Figure out better way of doing this.
self.popCharList()
event.Skip()
@@ -384,7 +384,7 @@ class FittingsTreeView(wx.Panel):
dict = {}
fits = data
for fit in fits:
if (fit['fitting_id'] in sEsi.fittings_deleted):
if fit['fitting_id'] in sEsi.fittings_deleted:
continue
ship = getItem(fit['ship_type_id'])
if ship is None:

View File

@@ -410,7 +410,7 @@ else:
if not effect_file.startswith('__'):
file_name, file_extension = effect_file.rsplit('.', 1)
# Ignore non-py files and exclude implementation-specific 'effects'
if file_extension == "py" and not file_name in ("__init__"):
if file_extension == "py" and not file_name in "__init__":
effect_list.append(file_name)
# Stage 2

View File

@@ -65,7 +65,7 @@ graphics = graphicIDsLoader.load(os.path.join(to_path, 'graphicIDs.fsdbinary'))
graphics_py_ob = {}
for x, v in graphics.items():
if (hasattr(v, 'iconFolder')):
if hasattr(v, 'iconFolder'):
graphics_py_ob[x] = v.iconFolder
# Add children to market group list

View File

@@ -239,7 +239,7 @@ def main(db, json_path):
row['iconFile'] = row['iconFile'].lower().replace('modules/', '').replace('.png', '')
if jsonName is 'clonegrades':
if (row['alphaCloneID'] not in tmp):
if row['alphaCloneID'] not in tmp:
cloneParent = eos.gamedata.AlphaClone()
setattr(cloneParent, 'alphaCloneID', row['alphaCloneID'])
setattr(cloneParent, 'alphaCloneName', row['alphaCloneName'])
@@ -247,7 +247,7 @@ def main(db, json_path):
tmp.append(row['alphaCloneID'])
for k, v in row.items():
if (isinstance(v, str)):
if isinstance(v, str):
v = v.strip()
setattr(instance, fieldMap.get(k, k), v)

View File

@@ -33,10 +33,10 @@ class Attribute(object):
@staticmethod
def getAttributeInfo(identity):
if isinstance(identity, (int, str)):
info = eos.db.getAttributeInfo(identity, eager=("unit"))
info = eos.db.getAttributeInfo(identity, eager="unit")
elif isinstance(identity, (int, float)):
id_ = int(identity)
info = eos.db.getAttributeInfo(id_, eager=("unit"))
info = eos.db.getAttributeInfo(id_, eager="unit")
else:
info = None
return info

View File

@@ -337,7 +337,7 @@ class Character(object):
@staticmethod
def getApiDetails(charID):
# todo: fix this (or get rid of?)
return ("", "", "", [])
return "", "", "", []
char = eos.db.getCharacter(charID)
if char.chars is not None:
chars = json.loads(char.chars)

View File

@@ -138,7 +138,7 @@ class Esi(EsiAccess):
def handleLogin(self, message):
# we already have authenticated stuff for the auto mode
if (self.settings.get('ssoMode') == SsoMode.AUTO):
if self.settings.get('ssoMode') == SsoMode.AUTO:
ssoInfo = message['SSOInfo'][0]
auth_response = json.loads(base64.b64decode(ssoInfo))
else:

View File

@@ -63,7 +63,7 @@ class APIException(Exception):
elif 'message' in self.response:
return 'HTTP Error %s: %s' % (self.status_code,
self.response['message'])
return 'HTTP Error %s' % (self.status_code)
return 'HTTP Error %s' % self.status_code
class ESIEndpoints(Enum):
@@ -89,7 +89,7 @@ class EsiAccess(object):
@property
def sso_url(self):
if (self.settings.get("ssoMode") == SsoMode.CUSTOM):
if self.settings.get("ssoMode") == SsoMode.CUSTOM:
return "https://login.eveonline.com"
return "https://www.pyfa.io"
@@ -136,7 +136,7 @@ class EsiAccess(object):
def getLoginURI(self, redirect=None):
self.state = str(uuid.uuid4())
if (self.settings.get("ssoMode") == SsoMode.AUTO):
if self.settings.get("ssoMode") == SsoMode.AUTO:
args = {
'state': self.state,
'pyfa_version': config.version,
@@ -256,7 +256,7 @@ class EsiAccess(object):
self._session.headers.update(self.get_oauth_header(ssoChar.accessToken))
def _after_request(self, resp):
if ("warning" in resp.headers):
if "warning" in resp.headers:
pyfalog.warn("{} - {}".format(resp.headers["warning"], resp.url))
if resp.status_code >= 400:

View File

@@ -42,7 +42,7 @@ from utils.deprecated import deprecated
pyfalog = Logger(__name__)
class DeferRecalc():
class DeferRecalc:
def __init__(self, fitID):
self.fitID = fitID
self.sFit = Fit.getInstance()

View File

@@ -458,7 +458,7 @@ class FitDeprecated(object):
if m.isValidState(State.ACTIVE):
m.state = State.ACTIVE
if (recalc):
if recalc:
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
self.recalc(fit)
# Then, check states of all modules and change where needed. This will recalc if needed

View File

@@ -26,7 +26,7 @@ class RigSize(Enum):
CAPITAL = 4
class EfsPort():
class EfsPort:
wepTestSet = {}
version = 0.01
@@ -497,7 +497,7 @@ class EfsPort():
# Since the effect modules are fairly opaque a mock test fit is used to test the impact of traits.
# standin class used to prevent . notation causing issues when used as an arg
class standin():
class standin:
pass
tf = standin()
tf.modules = HandledList(turrets + launchers)

View File

@@ -9,7 +9,7 @@ class PreCheckException(Exception):
pass
class PreCheckMessage():
class PreCheckMessage:
def __init__(self, msg):
# wx may not be installed, in which case print to console. For all other prechecks, should pop up a MessageDialog
try:

View File

@@ -64,8 +64,8 @@ def print_db_info():
import eos
print()
print("------------ data base connection info ------------")
print((eos.db.saveddata_engine))
print((eos.db.gamedata_engine))
print(eos.db.saveddata_engine)
print(eos.db.gamedata_engine)
print()