Skip to content

Commit c96c547

Browse files
authored
Merge pull request #186 from jelmer/ruff1
Migrate to ruff
2 parents e0e6234 + 387e812 commit c96c547

27 files changed

Lines changed: 902 additions & 660 deletions

‎.github/workflows/pythonpackage.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ jobs:
4444
- name: Install other dependencies
4545
run: |
4646
python -m pip install --upgrade pip
47-
pip install -U pip flake8 fastimport setuptools pytest pytest-cov
47+
pip install -U pip ruff fastimport setuptools pytest pytest-cov
4848
- name: Style checks
4949
run: |
50-
python -m flake8 subvertpy
50+
python -m ruff check subvertpy
51+
python -m ruff format --check subvertpy
5152
- name: Build (Linux)
5253
run: |
5354
pip install -e .

‎.travis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ script:
2626
- make check
2727
- make style
2828
install:
29-
- travis_retry pip install -U pip coverage codecov flake8
29+
- travis_retry pip install -U pip coverage codecov ruff
3030
before_install:
3131
- wget https://archive.apache.org/dist/subversion/subversion-${SVN_VERSION}.tar.gz
3232
- tar xvfz subversion-${SVN_VERSION}.tar.gz

‎Makefile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PYTHON = python3
2-
FLAKE8 ?= flake8
2+
RUFF ?= ruff
33
PYDOCTOR = pydoctor
44
PYDOCTOR_OPTIONS ?=
55
SETUP = $(PYTHON) setup.py
@@ -44,4 +44,5 @@ pydoctor:
4444
$(PYDOCTOR) $(PYDOCTOR_OPTIONS) --introspect-c-modules -c subvertpy.cfg --make-html
4545

4646
style:
47-
$(FLAKE8)
47+
$(RUFF) check
48+
$(RUFF) format --check

‎examples/ra_commit.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
# Note that a username provider needs to be provided, so that Subversion
1414
# knows who to record as the author of new commits made over this connection.
1515
repo_url = "file://%s" % os.path.abspath("tmprepo")
16-
conn = RemoteAccess(repo_url,
17-
auth=Auth([get_username_provider()]))
16+
conn = RemoteAccess(repo_url, auth=Auth([get_username_provider()]))
1817

1918
# Simple commit that adds a directory
2019
editor = conn.get_commit_editor({"svn:log": "Commit message"})

‎examples/ra_log.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
conn = RemoteAccess("svn://svn.samba.org/subvertpy/trunk")
77

8-
for (changed_paths, rev, revprops, has_children) in conn.iter_log(
9-
paths=None, start=0, end=conn.get_latest_revnum(),
10-
discover_changed_paths=True):
8+
for changed_paths, rev, revprops, has_children in conn.iter_log(
9+
paths=None, start=0, end=conn.get_latest_revnum(), discover_changed_paths=True
10+
):
1111
print("=" * 79)
1212
print("%d:" % rev)
1313
print("Revision properties:")
@@ -16,6 +16,5 @@
1616
print("")
1717

1818
print("Changed paths")
19-
for path, (action, from_path, from_rev, node_kind) in (
20-
changed_paths.items()):
19+
for path, (action, from_path, from_rev, node_kind) in changed_paths.items():
2120
print(" %s (%s)" % (path, action))

‎examples/ra_replay.py‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44

55
from subvertpy.ra import RemoteAccess, Auth, get_username_provider
66

7-
conn = RemoteAccess("svn://svn.gnome.org/svn/gnome-specimen/trunk",
8-
auth=Auth([get_username_provider()]))
7+
conn = RemoteAccess(
8+
"svn://svn.gnome.org/svn/gnome-specimen/trunk", auth=Auth([get_username_provider()])
9+
)
910

1011

1112
class MyFileEditor:
12-
1313
def change_prop(self, key, value):
1414
print("Change prop: %s -> %r" % (key, value))
1515

1616
def apply_textdelta(self, base_checksum):
1717
# This should return a function that can receive delta windows
1818
def apply_window(x):
1919
pass
20+
2021
return apply_window
2122

2223
def close(self):
2324
pass
2425

2526

2627
class MyDirEditor:
27-
2828
def open_directory(self, *args):
2929
print("Open dir: %s (base revnum: %r)" % args)
3030
return MyDirEditor()
@@ -38,8 +38,7 @@ def open_file(self, *args):
3838
return MyFileEditor()
3939

4040
def add_file(self, path, copyfrom_path=None, copyfrom_rev=-1):
41-
print("Add file: %s (from %r:%r)" %
42-
(path, copyfrom_path, copyfrom_rev))
41+
print("Add file: %s (from %r:%r)" % (path, copyfrom_path, copyfrom_rev))
4342
return MyFileEditor()
4443

4544
def change_prop(self, key, value):
@@ -53,7 +52,6 @@ def close(self):
5352

5453

5554
class MyEditor:
56-
5755
def set_target_revision(self, revnum):
5856
print("Target revision: %d" % revnum)
5957

‎examples/ra_shell.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def log_printer(changed_paths, rev, revprops, has_children=None):
2929

3030

3131
class RaCmd(cmd.Cmd):
32-
3332
@staticmethod
3433
def parse_path_revnum(line):
3534
args = line.split(" ")
@@ -59,7 +58,7 @@ def do_ls(self, args):
5958

6059
def do_cat(self, args):
6160
path, revnum = self.parse_path_revnum(args)
62-
outf = getattr(sys.stdout, 'buffer', sys.stdout)
61+
outf = getattr(sys.stdout, "buffer", sys.stdout)
6362
(fetched_rev, props) = conn.get_file(path, outf, revnum)
6463

6564
def do_reparent(self, args):
@@ -93,8 +92,13 @@ def do_get_repos_root(self, args):
9392
print(conn.get_repos_root())
9493

9594
def do_log(self, args):
96-
conn.get_log(callback=log_printer, paths=None, start=0,
97-
end=conn.get_latest_revnum(), discover_changed_paths=True)
95+
conn.get_log(
96+
callback=log_printer,
97+
paths=None,
98+
start=0,
99+
end=conn.get_latest_revnum(),
100+
discover_changed_paths=True,
101+
)
98102

99103

100104
cmdline = RaCmd()

‎pyproject.toml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[tool.ruff]
2+
exclude = [
3+
"build",
4+
".git",
5+
"build-pypy",
6+
".tox",
7+
"subversion-*",
8+
"serf-*",
9+
]

‎setup.cfg‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)