Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pre-commit to use modern black and ruff
Browse files Browse the repository at this point in the history
jacobtomlinson committed Jan 25, 2024
1 parent b209ec0 commit cf14e1c
Showing 5 changed files with 15 additions and 28 deletions.
14 changes: 9 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.12.1
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
exclude: versioneer.py
args:
- --target-version=py39
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.14'
hooks:
- id: flake8
language_version: python3
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
23 changes: 3 additions & 20 deletions dask_ctl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
from ._version import get_versions

__version__ = get_versions()["version"]
del get_versions

from . import config

from .discovery import (
discover_cluster_names,
discover_clusters,
list_discovery_methods,
)
from .lifecycle import (
get_cluster,
create_cluster,
scale_cluster,
delete_cluster,
list_clusters,
get_snippet,
)
from .proxy import ProxyCluster

import os.path

from dask.widgets import TEMPLATE_PATHS

__version__ = get_versions()["version"]
del get_versions

TEMPLATE_PATHS.append(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "widgets", "templates")
)
1 change: 0 additions & 1 deletion dask_ctl/cli.py
Original file line number Diff line number Diff line change
@@ -89,7 +89,6 @@ def list(discovery=None):
"""

async def _list():

with console.status("[bold green]Discovering clusters...") as status:
table = await generate_table(
discovery=discovery, status=status, console=console
4 changes: 3 additions & 1 deletion dask_ctl/discovery.py
Original file line number Diff line number Diff line change
@@ -101,7 +101,9 @@ async def discover_cluster_names(
warnings.warn(
f"Cluster discovery for {discovery_method} timed out."
)
except Exception as e: # We are calling code that is out of our control here, so handling broad exceptions
except (
Exception
) as e: # We are calling code that is out of our control here, so handling broad exceptions
if discovery is None:
warnings.warn(f"Cluster discovery for {discovery_method} failed.")
else:
1 change: 0 additions & 1 deletion dask_ctl/utils.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@


class _AsyncTimedIterator:

__slots__ = ("_iterator", "_timeout", "_sentinel")

def __init__(self, iterable, timeout):

0 comments on commit cf14e1c

Please sign in to comment.