diff --git a/.gitignore b/.gitignore index 3826b80..868bc01 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,7 @@ src # Pycharm .idea +.DS_Store # test files .pytest_cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 78c72c3..d7fc1c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: # Autoformat: Python code, syntax patterns are modernized - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.19.1 hooks: - id: pyupgrade args: @@ -17,7 +17,7 @@ repos: # Autoformat: Python code - repo: https://github.com/PyCQA/autoflake - rev: v2.2.1 + rev: v2.3.1 hooks: - id: autoflake # args ref: https://github.com/PyCQA/autoflake#advanced-usage @@ -26,13 +26,13 @@ repos: # Autoformat: Python - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 6.0.0 hooks: - id: isort # Autoformat: Python - repo: https://github.com/psf/black - rev: 23.10.1 + rev: 25.1.0 hooks: - id: black @@ -41,22 +41,24 @@ repos: rev: v6.2.1 hooks: - id: beautysh + additional_dependencies: + - setuptools # Autoformat: markdown, yaml - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v4.0.0-alpha.8 hooks: - id: prettier # Lint: Python code - repo: https://github.com/PyCQA/flake8 - rev: "6.1.0" + rev: "7.1.1" hooks: - id: flake8 # Misc autoformatting and linting - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: end-of-file-fixer - id: requirements-txt-fixer diff --git a/dockerspawner/dockerspawner.py b/dockerspawner/dockerspawner.py index 352ab60..399ff36 100644 --- a/dockerspawner/dockerspawner.py +++ b/dockerspawner/dockerspawner.py @@ -1,6 +1,7 @@ """ A Spawner for JupyterHub that runs each user's server in a separate docker container """ + import asyncio import inspect import json diff --git a/dockerspawner/swarmspawner.py b/dockerspawner/swarmspawner.py index 45c156d..4c84b6e 100644 --- a/dockerspawner/swarmspawner.py +++ b/dockerspawner/swarmspawner.py @@ -1,6 +1,7 @@ """ A Spawner for JupyterHub that runs each user's server in a separate docker service """ + import asyncio from pprint import pformat from textwrap import dedent @@ -201,9 +202,9 @@ async def create_object(self): mem_limit=self.mem_limit, mem_reservation=self.mem_guarantee, cpu_limit=int(self.cpu_limit * 1e9) if self.cpu_limit else None, - cpu_reservation=int(self.cpu_guarantee * 1e9) - if self.cpu_guarantee - else None, + cpu_reservation=( + int(self.cpu_guarantee * 1e9) if self.cpu_guarantee else None + ), ) resources_kwargs.update(self.extra_resources_spec) resources_spec = Resources(**resources_kwargs) diff --git a/tests/conftest.py b/tests/conftest.py index b191eb7..b79dbbe 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """pytest config for dockerspawner tests""" + import inspect import json import os diff --git a/tests/test_dockerspawner.py b/tests/test_dockerspawner.py index 2be2bc9..064d70a 100644 --- a/tests/test_dockerspawner.py +++ b/tests/test_dockerspawner.py @@ -1,4 +1,5 @@ """Tests for DockerSpawner class""" + import asyncio import json import logging diff --git a/tests/test_swarmspawner.py b/tests/test_swarmspawner.py index 02d4728..68d0f78 100644 --- a/tests/test_swarmspawner.py +++ b/tests/test_swarmspawner.py @@ -1,4 +1,5 @@ """Tests for SwarmSpawner""" + import asyncio from jupyterhub.tests.mocking import public_url diff --git a/tests/test_systemuserspawner.py b/tests/test_systemuserspawner.py index eff4783..9021fb5 100644 --- a/tests/test_systemuserspawner.py +++ b/tests/test_systemuserspawner.py @@ -1,4 +1,5 @@ """Tests for SwarmSpawner""" + from getpass import getuser from jupyterhub.tests.mocking import public_url diff --git a/tests/volumes_test.py b/tests/volumes_test.py index 1103634..a08d1ce 100644 --- a/tests/volumes_test.py +++ b/tests/volumes_test.py @@ -1,5 +1,4 @@ -"""Test volume manipulation logic -""" +"""Test volume manipulation logic""" import types