Skip to content

Commit f37de89

Browse files
committed
Accept suggestions from new toolchain
1 parent 86665ba commit f37de89

38 files changed

+90
-98
lines changed

gitz/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from pathlib import Path
21
import sys
2+
from pathlib import Path
33

44
HOME_PAGE = 'https://github.com/rec/gitz/blob/master/README.rst'
55

gitz/git/combine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from . import GIT
21
import re
32
from typing import Union
43

4+
from . import GIT
5+
56
COMMIT_MSG_RE = re.compile(r'\[.* ([0-9a-z]+)\] (.*)')
67

78

8-
def combine(commits, squash: Union[None, str]):
9+
def combine(commits, squash: None | str):
910
# Yields a stream of commit id, message
1011
symbol = '+' if squash is None else 's'
1112

gitz/git/commit_segments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterator
1+
from collections.abc import Iterator
22

33

44
def segments(s: str) -> Iterator[str]:

gitz/git/delete.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
from . import GIT
2-
from . import functions
3-
from . import guess_origin
41
from ..program import PROGRAM
2+
from . import GIT, functions, guess_origin
53

64

75
def delete_remote_branch(remote, branch):
8-
rbranch = '%s/%s' % (remote, branch)
6+
rbranch = '{}/{}'.format(remote, branch)
97
cid, cmsg = functions.commit_message(rbranch)
108
GIT.push(remote, ':refs/heads/' + branch)
11-
PROGRAM.message('- %s@%s: %s' % (rbranch, cid, cmsg))
9+
PROGRAM.message('- {}@{}: {}'.format(rbranch, cid, cmsg))
1210

1311

1412
def delete_all(branches):
@@ -63,7 +61,7 @@ def delete_all(branches):
6361
if local_branches:
6462
for branch in local_branches:
6563
cid, cmsg = functions.commit_message(branch)
66-
PROGRAM.message('- %s@%s: %s' % (branch, cid, cmsg))
64+
PROGRAM.message('- {}@{}: {}'.format(branch, cid, cmsg))
6765
deleted_count += 1
6866
GIT.branch('-D', *local_branches)
6967

gitz/git/functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from . import GIT
21
from ..program import ARGS, PROGRAM
2+
from . import GIT
33

44
COMMIT_ID_LENGTH = 7
55

@@ -10,7 +10,7 @@ def _to_name(name, base='HEAD'):
1010
if name.startswith('~'):
1111
return base + name
1212
if name.isnumeric() and len(name) < COMMIT_ID_LENGTH:
13-
return '%s~%s' % (base, name)
13+
return '{}~{}'.format(base, name)
1414
return name
1515

1616

gitz/git/guess_origin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from . import functions
21
from ..program import ENV
2+
from . import functions
33

44

55
def guess_origin(origin=None, branch=None):
@@ -16,4 +16,4 @@ def guess_origin(origin=None, branch=None):
1616
rb = functions.remote_branches(False)
1717
return next(o for o in ENV.origin() if o in rb)
1818
except Exception:
19-
raise ValueError('Cannot determine origin')
19+
raise ValueError('Cannot determine origin') from None

gitz/git/mover.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
from . import GIT
2-
from . import functions
3-
from . import root
4-
from ..program import ARGS
5-
from ..program import ENV
6-
from ..program import PROGRAM
1+
from ..program import ARGS, ENV, PROGRAM
2+
from . import GIT, functions, root
73

84
ACTIONS = {'copy': ('copi', 'over'), 'rename': ('renam', 'from or two')}
95

@@ -106,7 +102,7 @@ def _move_remote(self):
106102
if self.is_rename:
107103
GIT.push(self.origin, ':' + self.source)
108104

109-
target = '%s/%s' % (self.origin, self.target)
105+
target = '{}/{}'.format(self.origin, self.target)
110106
GIT.branch('-u', target, self.target)
111107
msg = '{0.Word_root}ed {0.origin}/{0.source} -> {1} [{2}]'
112108
cid = functions.commit_id(target)

gitz/git/reference_branch.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1+
from ..program import ARGS, ENV, PROGRAM
12
from . import functions
2-
from ..program import ARGS
3-
from ..program import ENV
4-
from ..program import PROGRAM
53

64

75
def reference_branch(remote_branches=None):

gitz/git/repo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from . import GIT
2-
from . import functions
3-
from ..program import PROGRAM
4-
from tempfile import TemporaryDirectory
51
import contextlib
62
import functools
73
import os
4+
from tempfile import TemporaryDirectory
5+
6+
from ..program import PROGRAM
7+
from . import GIT, functions
88

99
# Generate deterministic commit IDs using fixed data. See
1010
# https://blog.thoughtram.io/git/2014/11/18/the-anatomy-of-a-git-commit.html

gitz/git/root.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from . import GIT
2-
from ..program import PROGRAM
3-
from pathlib import Path
41
import functools
52
import os
3+
from pathlib import Path
4+
5+
from ..program import PROGRAM
6+
from . import GIT
67

78

89
# See https://stackoverflow.com/questions/957928

0 commit comments

Comments
 (0)