Skip to content

Commit fba870e

Browse files

34 files changed

+503
-425
lines changed

CHANGES

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ Temporarily add `Faker` as a dependency (due to pytest), track longterm fix on (
604604

605605
Before: `project.parent_dir`
606606

607-
After: `project.parent.dir`.
607+
After: `project.parent.path`.
608608

609609
- `repo_name` switched from attribute to property
610610

@@ -722,13 +722,13 @@ Temporarily add `Faker` as a dependency (due to pytest), track longterm fix on (
722722
`libvcs.sync.{module}.{Module}Project`
723723
- `repo_dir` param is renamed to `dir`:
724724

725-
Before: `GitSync(url='...', repo_dir='...')`
725+
Before: `GitSync(url='...', repo_path='...')`
726726

727-
After: `GitSync(url='...', dir='...')`
727+
After: `GitSync(url='...', path='...')`
728728

729729
#324
730730

731-
- `dir` to `pathlib`, `BaseSync.path` -> `BaseSync.dir`
731+
- `dir` to `pathlib`, `BaseSync.path` -> `BaseSync.path`
732732
- Logging functions moved to {attr}`libvcs.sync.base.BaseSync.log` (#322)
733733
- Rename `ProjectLoggingAdapter` to `CmdLoggingAdapter`
734734
- `CmdLoggingAdapter`: Rename `repo_name` param to `keyword`
@@ -768,7 +768,7 @@ Temporarily add `Faker` as a dependency (due to pytest), track longterm fix on (
768768
```python
769769
repo = GitSync(
770770
url="https://github.com/vcs-python/libvcs",
771-
repo_dir=checkout,
771+
repo_path=checkout,
772772
remotes={
773773
'gitlab': 'https://gitlab.com/vcs-python/libvcs',
774774
}
@@ -778,7 +778,7 @@ Temporarily add `Faker` as a dependency (due to pytest), track longterm fix on (
778778
```python
779779
repo = GitSync(
780780
url="https://github.com/vcs-python/libvcs",
781-
repo_dir=checkout,
781+
repo_path=checkout,
782782
remotes={
783783
'gitlab': {
784784
'fetch_url': 'https://gitlab.com/vcs-python/libvcs',

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Simple [`subprocess`](https://docs.python.org/3/library/subprocess.html) wrapper
8383
import pathlib
8484
from libvcs.cmd.git import Git
8585

86-
git = Git(dir=pathlib.Path.cwd() / 'my_git_repo')
86+
git = Git(path=pathlib.Path.cwd() / 'my_git_repo')
8787
git.clone(url='https://github.com/vcs-python/libvcs.git')
8888
```
8989

@@ -98,7 +98,7 @@ from libvcs.sync.git import GitSync
9898

9999
repo = GitSync(
100100
url="https://github.com/vcs-python/libvcs",
101-
dir=pathlib.Path().cwd() / "my_repo",
101+
path=pathlib.Path().cwd() / "my_repo",
102102
remotes={
103103
'gitlab': 'https://gitlab.com/vcs-python/libvcs'
104104
}
@@ -136,7 +136,7 @@ def test_repo_git_remote_checkout(
136136
) -> None:
137137
git_server = create_git_remote_repo()
138138
git_repo_checkout_dir = projects_path / "my_git_checkout"
139-
git_repo = GitSync(dir=str(git_repo_checkout_dir), url=f"file://{git_server!s}")
139+
git_repo = GitSync(path=str(git_repo_checkout_dir), url=f"file://{git_server!s}")
140140

141141
git_repo.obtain()
142142
git_repo.update_repo()

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
master_doc = "index"
5454

5555
project = about["__title__"]
56-
copyright = about["__copyright__"]
56+
project_copyright = about["__copyright__"]
5757

5858
version = "%s" % (".".join(about["__version__"].split("."))[:2])
5959
release = "%s" % (about["__version__"])
@@ -97,7 +97,7 @@
9797
"sidebar/navigation.html",
9898
"sidebar/projects.html",
9999
"sidebar/scroll-end.html",
100-
]
100+
],
101101
}
102102

103103
# linkify_issues

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,11 @@ select = [
141141
"F", # pyflakes
142142
"I", # isort
143143
"UP", # pyupgrade
144+
"A", # flake8-builtins
144145
"B", # flake8-bugbear
145146
"C4", # flake8-comprehensions
147+
"COM", # flake8-commas
148+
"EM", # flake8-errmsg
146149
"Q", # flake8-quotes
147150
"PTH", # flake8-use-pathlib
148151
"SIM", # flake8-simplify
@@ -151,6 +154,9 @@ select = [
151154
"RUF", # Ruff-specific rules
152155
"D", # pydocstyle
153156
]
157+
ignore = [
158+
"COM812", # missing trailing comma, ruff format conflict
159+
]
154160

155161
[tool.ruff.lint.isort]
156162
known-first-party = [

src/libvcs/_internal/module_loading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@ def import_string(import_name: str, silent: bool = False) -> t.Any:
108108
except ImportError as e:
109109
if not silent:
110110
raise ImportStringError(import_name, e).with_traceback(
111-
sys.exc_info()[2]
111+
sys.exc_info()[2],
112112
) from None
113113
return None

src/libvcs/_internal/run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def __init__(self, bin_name: str, keyword: str, *args: Any, **kwargs: Any) -> No
6565
logging.LoggerAdapter.__init__(self, *args, **kwargs)
6666

6767
def process(
68-
self, msg: str, kwargs: MutableMapping[str, Any]
68+
self,
69+
msg: str,
70+
kwargs: MutableMapping[str, Any],
6971
) -> tuple[Any, MutableMapping[str, Any]]:
7072
"""Add additional context information for loggers."""
7173
prefixed_dict = {}
@@ -89,7 +91,8 @@ def __call__(self, output: AnyStr, timestamp: datetime.datetime) -> None:
8991
_ENV: "TypeAlias" = Mapping[str, str]
9092
else:
9193
_ENV: "TypeAlias" = Union[
92-
Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath]
94+
Mapping[bytes, StrOrBytesPath],
95+
Mapping[str, StrOrBytesPath],
9396
]
9497

9598
_CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]]

src/libvcs/_internal/shortcuts.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, url: str, vcs: str, *args: object):
3636
def create_project(
3737
*,
3838
url: str,
39-
dir: StrPath,
39+
path: StrPath,
4040
vcs: t.Literal["git"],
4141
progress_callback: t.Optional[ProgressCallbackProtocol] = None,
4242
**kwargs: dict[t.Any, t.Any],
@@ -48,7 +48,7 @@ def create_project(
4848
def create_project(
4949
*,
5050
url: str,
51-
dir: StrPath,
51+
path: StrPath,
5252
vcs: t.Literal["svn"],
5353
progress_callback: t.Optional[ProgressCallbackProtocol] = None,
5454
**kwargs: dict[t.Any, t.Any],
@@ -60,7 +60,7 @@ def create_project(
6060
def create_project(
6161
*,
6262
url: str,
63-
dir: StrPath,
63+
path: StrPath,
6464
vcs: t.Literal["hg"],
6565
progress_callback: t.Optional[ProgressCallbackProtocol] = ...,
6666
**kwargs: dict[t.Any, t.Any],
@@ -71,7 +71,7 @@ def create_project(
7171
def create_project(
7272
*,
7373
url: str,
74-
dir: StrPath,
74+
path: StrPath,
7575
vcs: t.Optional[VCSLiteral] = None,
7676
progress_callback: t.Optional[ProgressCallbackProtocol] = None,
7777
**kwargs: dict[t.Any, t.Any],
@@ -84,7 +84,7 @@ def create_project(
8484
>>> r = create_project(
8585
... url=f'file://{create_git_remote_repo()}',
8686
... vcs='git',
87-
... dir=tmp_path
87+
... path=tmp_path
8888
... )
8989
9090
>>> isinstance(r, GitSync)
@@ -95,7 +95,7 @@ def create_project(
9595
>>> r = create_project(
9696
... # Note the git+ before the URL
9797
... url=f'git+file://{create_git_remote_repo()}',
98-
... dir=tmp_path
98+
... path=tmp_path
9999
... )
100100
101101
>>> isinstance(r, GitSync)
@@ -120,10 +120,14 @@ def is_vcs(val: t.Any) -> "TypeGuard[VCSLiteral]":
120120
raise VCSNotSupported(url=url, vcs=vcs_matches[0].vcs)
121121

122122
if vcs == "git":
123-
return GitSync(url=url, dir=dir, progress_callback=progress_callback, **kwargs)
123+
return GitSync(
124+
url=url, path=path, progress_callback=progress_callback, **kwargs
125+
)
124126
elif vcs == "hg":
125-
return HgSync(url=url, dir=dir, progress_callback=progress_callback, **kwargs)
127+
return HgSync(url=url, path=path, progress_callback=progress_callback, **kwargs)
126128
elif vcs == "svn":
127-
return SvnSync(url=url, dir=dir, progress_callback=progress_callback, **kwargs)
129+
return SvnSync(
130+
url=url, path=path, progress_callback=progress_callback, **kwargs
131+
)
128132
else:
129133
raise InvalidVCS("VCS %s is not a valid VCS" % vcs)

src/libvcs/_internal/subprocess.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: NOQA: A002
12
r"""Invocable :mod:`subprocess` wrapper.
23
34
Defer running a subprocess, such as by handing to an executor.
@@ -73,7 +74,8 @@ def __init__(self, output: str, *args: object):
7374
_ENV: "TypeAlias" = Mapping[str, str]
7475
else:
7576
_ENV: "TypeAlias" = Union[
76-
Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath]
77+
Mapping[bytes, StrOrBytesPath],
78+
Mapping[str, StrOrBytesPath],
7779
]
7880
_FILE: "TypeAlias" = Union[None, int, IO[Any]]
7981
_TXT: "TypeAlias" = Union[bytes, str]

src/libvcs/_internal/types.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
""":class:`os.PathLike` or :class:`str`"""
1717

1818
StrOrBytesPath: "TypeAlias" = Union[
19-
str, bytes, PathLike[str], PathLike[bytes] # stable
19+
str,
20+
bytes,
21+
PathLike[str],
22+
PathLike[bytes], # stable
2023
]
2124
""":class:`os.PathLike`, :class:`str` or :term:`bytes-like object`"""
2225

0 commit comments

Comments
 (0)