From 31c3101d6d7af4b86c77a8e195ccdd4d9d8d8398 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sun, 16 Sep 2018 01:11:16 -0400 Subject: [PATCH] Remove redundant parenthesis --- _development/helpers.py | 4 ++-- dist_assets/win/dist.py | 2 +- eos/gamedata.py | 8 ++++---- eos/modifiedAttributeDict.py | 2 +- eos/saveddata/module.py | 2 +- eos/saveddata/ship.py | 2 +- gui/builtinContextMenus/boosterSideEffects.py | 2 +- gui/builtinContextMenus/mutaplasmids.py | 2 +- gui/builtinStatsViews/priceViewFull.py | 10 +++++----- gui/builtinStatsViews/priceViewMinimal.py | 10 +++++----- gui/chrome_tabs.py | 4 ++-- gui/esiFittings.py | 4 ++-- scripts/effectUsedBy.py | 2 +- scripts/icons_update.py | 2 +- scripts/jsonToSql.py | 4 ++-- service/attribute.py | 4 ++-- service/character.py | 2 +- service/esi.py | 2 +- service/esiAccess.py | 8 ++++---- service/fit.py | 2 +- service/fitDeprecated.py | 2 +- service/port/efs.py | 4 ++-- service/prereqsCheck.py | 2 +- tests/test_unread_desc.py | 4 ++-- 24 files changed, 45 insertions(+), 45 deletions(-) diff --git a/_development/helpers.py b/_development/helpers.py index 8af8f9733..ad1447371 100644 --- a/_development/helpers.py +++ b/_development/helpers.py @@ -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, diff --git a/dist_assets/win/dist.py b/dist_assets/win/dist.py index a34ed3140..ec6da3928 100644 --- a/dist_assets/win/dist.py +++ b/dist_assets/win/dist.py @@ -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 diff --git a/eos/gamedata.py b/eos/gamedata.py index 0fc9482e2..9c14f23ac 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -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): diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 245087dcf..d660dd38b 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -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""" diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 3bb92dcf4..57aacf101 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -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: diff --git a/eos/saveddata/ship.py b/eos/saveddata/ship.py index 1e1dd30d6..a7cbc15b7 100644 --- a/eos/saveddata/ship.py +++ b/eos/saveddata/ship.py @@ -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()): diff --git a/gui/builtinContextMenus/boosterSideEffects.py b/gui/builtinContextMenus/boosterSideEffects.py index eb162c3e7..d6dbc38c6 100644 --- a/gui/builtinContextMenus/boosterSideEffects.py +++ b/gui/builtinContextMenus/boosterSideEffects.py @@ -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] diff --git a/gui/builtinContextMenus/mutaplasmids.py b/gui/builtinContextMenus/mutaplasmids.py index 253cdac60..98656b840 100644 --- a/gui/builtinContextMenus/mutaplasmids.py +++ b/gui/builtinContextMenus/mutaplasmids.py @@ -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] diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 9eb03ea22..767ad958f 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -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)) diff --git a/gui/builtinStatsViews/priceViewMinimal.py b/gui/builtinStatsViews/priceViewMinimal.py index ec1d5357f..8d6a5ce83 100644 --- a/gui/builtinStatsViews/priceViewMinimal.py +++ b/gui/builtinStatsViews/priceViewMinimal.py @@ -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)) diff --git a/gui/chrome_tabs.py b/gui/chrome_tabs.py index 95d79415d..b50073565 100644 --- a/gui/chrome_tabs.py +++ b/gui/chrome_tabs.py @@ -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 diff --git a/gui/esiFittings.py b/gui/esiFittings.py index c471a1334..20fc2ed74 100644 --- a/gui/esiFittings.py +++ b/gui/esiFittings.py @@ -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: diff --git a/scripts/effectUsedBy.py b/scripts/effectUsedBy.py index dc231c61c..aa5f878b3 100755 --- a/scripts/effectUsedBy.py +++ b/scripts/effectUsedBy.py @@ -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 diff --git a/scripts/icons_update.py b/scripts/icons_update.py index 663d168b9..73813c505 100644 --- a/scripts/icons_update.py +++ b/scripts/icons_update.py @@ -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 diff --git a/scripts/jsonToSql.py b/scripts/jsonToSql.py index eb3ea6cdc..24492637a 100755 --- a/scripts/jsonToSql.py +++ b/scripts/jsonToSql.py @@ -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) diff --git a/service/attribute.py b/service/attribute.py index b4c3453e9..b5ebcae66 100644 --- a/service/attribute.py +++ b/service/attribute.py @@ -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 diff --git a/service/character.py b/service/character.py index 2ff03de67..565d7d329 100644 --- a/service/character.py +++ b/service/character.py @@ -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) diff --git a/service/esi.py b/service/esi.py index 4b5f8198f..7b5247bec 100644 --- a/service/esi.py +++ b/service/esi.py @@ -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: diff --git a/service/esiAccess.py b/service/esiAccess.py index 905252b74..db1931fa2 100644 --- a/service/esiAccess.py +++ b/service/esiAccess.py @@ -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: diff --git a/service/fit.py b/service/fit.py index d3ac0f9d8..d830dda3e 100644 --- a/service/fit.py +++ b/service/fit.py @@ -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() diff --git a/service/fitDeprecated.py b/service/fitDeprecated.py index c145b858c..531191b9d 100644 --- a/service/fitDeprecated.py +++ b/service/fitDeprecated.py @@ -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 diff --git a/service/port/efs.py b/service/port/efs.py index b3342fb8f..4420adc90 100755 --- a/service/port/efs.py +++ b/service/port/efs.py @@ -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) diff --git a/service/prereqsCheck.py b/service/prereqsCheck.py index 60c258d0e..159468591 100644 --- a/service/prereqsCheck.py +++ b/service/prereqsCheck.py @@ -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: diff --git a/tests/test_unread_desc.py b/tests/test_unread_desc.py index 5fc54fd14..824475d4f 100644 --- a/tests/test_unread_desc.py +++ b/tests/test_unread_desc.py @@ -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()