From 045c46c2ef652b8793bfd36ce31400c693b54438 Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Sun, 26 Feb 2023 02:52:51 +0100 Subject: Start using ruff for pyupgrade and isort (#6441) --- .pre-commit-config.yaml | 12 ------------ networkx/algorithms/centrality/betweenness_subset.py | 4 +++- ruff.toml | 11 +++++++++++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b822734b..886c2b93 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,22 +6,10 @@ repos: rev: 23.1.0 hooks: - id: black - - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 - hooks: - - id: pyupgrade - args: [--py38-plus] - repo: https://github.com/asottile/blacken-docs rev: 1.13.0 hooks: - id: blacken-docs - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - name: isort (python) - args: ["--profile", "black", "--filter-files", "--skip", "__init__.py"] - files: ^networkx/ - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.7.1 hooks: diff --git a/networkx/algorithms/centrality/betweenness_subset.py b/networkx/algorithms/centrality/betweenness_subset.py index 24e127b7..2a29b5fa 100644 --- a/networkx/algorithms/centrality/betweenness_subset.py +++ b/networkx/algorithms/centrality/betweenness_subset.py @@ -1,5 +1,7 @@ """Betweenness centrality measures for subsets of nodes.""" -from networkx.algorithms.centrality.betweenness import _add_edge_keys +from networkx.algorithms.centrality.betweenness import ( + _add_edge_keys, +) from networkx.algorithms.centrality.betweenness import ( _single_source_dijkstra_path_basic as dijkstra, ) diff --git a/ruff.toml b/ruff.toml index c9268b24..e0b0e30d 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,4 +1,6 @@ select = [ + "I", # isort + "UP", # pyupgrade "C4", # flake8-comprehensions "E713", # use 'key not in list' "PIE", # flake8-pie @@ -11,3 +13,12 @@ select = [ "SIM118", # use 'key in dict' "SIM2", # simplify boolean comparisons ] + +target-version = "py38" + +[per-file-ignores] +"__init__.py" = ["I"] +"setup.py" = ["I"] +"examples/*.py" = ["I"] +"doc/*.py" = ["I"] +"tools/*.py" = ["I"] -- cgit v1.2.1