Browse Source

upgrade black

Fabian Peter Hammerle 3 years ago
parent
commit
af65a67357
4 changed files with 19 additions and 12 deletions
  1. 1 1
      Pipfile
  2. 3 4
      Pipfile.lock
  3. 4 2
      tests/test_api.py
  4. 11 5
      tooncher/__init__.py

+ 1 - 1
Pipfile

@@ -9,7 +9,7 @@ tooncher = {editable = true, path = "."}
 [dev-packages]
 # black requires python>=3.6
 # https://github.com/psf/black/commit/e74117f172e29e8a980e2c9de929ad50d3769150#diff-2eeaed663bd0d25b7e608891384b7298R51
-black = {version = "==19.10b0", markers = "python_version >= '3.6'"}
+black = {version = "==20.8b1", markers = "python_version >= '3.6'"}
 mypy = "*"
 pylint = "*"
 pylint-import-requirements = "*"

+ 3 - 4
Pipfile.lock

@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "9a4acff4a9fe7ad2b39336a908ba16f6c27500542162206ff22ee3a1ed78d0ea"
+            "sha256": "04a2c49ad876a958de7fa67727a5a6c97d155c2ef2269a69c42de02c8875e140"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -63,12 +63,11 @@
         },
         "black": {
             "hashes": [
-                "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b",
-                "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"
+                "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"
             ],
             "index": "pypi",
             "markers": "python_version >= '3.6'",
-            "version": "==19.10b0"
+            "version": "==20.8b1"
         },
         "click": {
             "hashes": [

+ 4 - 2
tests/test_api.py

@@ -32,7 +32,8 @@ def test_start_engine_mac():
         with unittest.mock.patch("sys.platform", "darwin"):
             # python3.5's pathlib.Path.resolve raises FileNotFoundError
             with unittest.mock.patch(
-                "pathlib.Path.resolve", new=lambda p: p.with_suffix(".resolved"),
+                "pathlib.Path.resolve",
+                new=lambda p: p.with_suffix(".resolved"),
             ):
                 tooncher.start_engine(
                     engine_path=engine_path,
@@ -61,7 +62,8 @@ def test_start_engine_xorg():
         with unittest.mock.patch("os.environ", {"XAUTHORITY": "/home/me/.Xauthority"}):
             with unittest.mock.patch("sys.platform", "linux"):
                 with unittest.mock.patch(  # python3.5
-                    "pathlib.Path.resolve", new=lambda p: p.with_suffix(".resolved"),
+                    "pathlib.Path.resolve",
+                    new=lambda p: p.with_suffix(".resolved"),
                 ):
                     tooncher.start_engine(
                         engine_path=pathlib.PosixPath(

+ 11 - 5
tooncher/__init__.py

@@ -99,14 +99,17 @@ def _login(
     else:
         raise Exception("either specify username or queue token")
     resp_data = _api_request(
-        url=_LOGIN_API_URL, params=req_params, validate_ssl_cert=validate_ssl_cert,
+        url=_LOGIN_API_URL,
+        params=req_params,
+        validate_ssl_cert=validate_ssl_cert,
     )
     if resp_data["success"] == "true":
         return _LoginSuccessful(
-            playcookie=resp_data["cookie"], gameserver=resp_data["gameserver"],
+            playcookie=resp_data["cookie"],
+            gameserver=resp_data["gameserver"],
         )
     if resp_data["success"] == "delayed":
-        return _LoginDelayed(queue_token=resp_data["queueToken"],)
+        return _LoginDelayed(queue_token=resp_data["queueToken"])
     raise Exception(repr(resp_data))
 
 
@@ -118,11 +121,14 @@ def launch(
     cpu_limit_percent: typing.Optional[int] = None,
 ) -> None:
     result = _login(
-        username=username, password=password, validate_ssl_cert=validate_ssl_certs,
+        username=username,
+        password=password,
+        validate_ssl_cert=validate_ssl_certs,
     )
     if isinstance(result, _LoginDelayed):
         result = _login(
-            queue_token=result.queue_token, validate_ssl_cert=validate_ssl_certs,
+            queue_token=result.queue_token,
+            validate_ssl_cert=validate_ssl_certs,
         )
     if not isinstance(result, _LoginSuccessful):
         raise Exception("unexpected response: {!r}".format(result))