Browse Source

fix #271: code bugs detected by sonarcloud

pull/287/head
Rossen Georgiev 5 years ago
parent
commit
a01bfe374f
  1. 1
      steam/client/builtins/gameservers.py
  2. 2
      steam/core/manifest.py
  3. 2
      steam/webapi.py
  4. 2
      steam/webauth.py
  5. 2
      tests/test_steamid.py

1
steam/client/builtins/gameservers.py

@ -40,6 +40,7 @@ from steam.enums import EResult
from steam.enums.emsg import EMsg from steam.enums.emsg import EMsg
from steam.utils import ip_to_int, ip_from_int from steam.utils import ip_to_int, ip_from_int
from steam.utils.proto import proto_to_dict from steam.utils.proto import proto_to_dict
from steam.exceptions import SteamError
class GameServers(object): class GameServers(object):

2
steam/core/manifest.py

@ -180,7 +180,7 @@ class DepotManifest(object):
try: try:
filename = symmetric_decrypt(filename, depot_key) filename = symmetric_decrypt(filename, depot_key)
except Exception: except Exception:
RuntimeError("Unable to decrypt filename for depot manifest") raise RuntimeError("Unable to decrypt filename for depot manifest")
mapping.filename = filename mapping.filename = filename

2
steam/webapi.py

@ -397,7 +397,7 @@ def webapi_request(url, method='GET', caller=None, session=None, params=None):
:rtype: :class:`dict`, :class:`lxml.etree.Element`, :class:`str` :rtype: :class:`dict`, :class:`lxml.etree.Element`, :class:`str`
""" """
if method not in ('GET', 'POST'): if method not in ('GET', 'POST'):
raise NotImplemented("HTTP method: %s" % repr(self.method)) raise ValueError("Only GET and POST methods are supported, got: %s" % repr(method))
if params is None: if params is None:
params = {} params = {}

2
steam/webauth.py

@ -230,8 +230,6 @@ class WebAuth(object):
self.password = '' self.password = ''
raise LoginIncorrect(resp['message']) raise LoginIncorrect(resp['message'])
return None
def cli_login(self, password='', captcha='', email_code='', twofactor_code='', language='english'): def cli_login(self, password='', captcha='', email_code='', twofactor_code='', language='english'):
"""Generates CLI prompts to perform the entire login process """Generates CLI prompts to perform the entire login process

2
tests/test_steamid.py

@ -185,7 +185,7 @@ class SteamID_initialization(unittest.TestCase):
class SteamID_properties(unittest.TestCase): class SteamID_properties(unittest.TestCase):
def test_repr(self): def test_repr(self):
# just to cover in coverage # just to cover in coverage
repr(SteamID()) self.assertTrue('SteamID' in repr(SteamID()))
def test_is_valid(self): def test_is_valid(self):
# default # default

Loading…
Cancel
Save