Skip to content

Commit 280962e

Browse files
committed
migrate from blackt to ruff format + bump deps
1 parent b367f38 commit 280962e

File tree

7 files changed

+33
-20
lines changed

7 files changed

+33
-20
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.14
3+
rev: v0.2.2
44
hooks:
55
- id: ruff
66
args: [ --fix ]
7+
- id: ruff-format
78

89
- repo: https://github.com/RobertCraigie/pyright-python
9-
rev: v1.1.347
10+
rev: v1.1.351
1011
hooks:
1112
- id: pyright
1213

13-
- repo: https://github.com/FHPythonUtils/Blackt
14-
rev: '2024.0.1'
15-
hooks:
16-
- id: blackt
17-
1814
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
19-
rev: v1.3.2
15+
rev: v1.3.3
2016
hooks:
2117
- id: python-safety-dependencies-check
2218
files: pyproject.toml
@@ -39,7 +35,7 @@ repos:
3935
- id: mixed-line-ending
4036

4137
- repo: https://github.com/boidolr/pre-commit-images
42-
rev: v1.5.1
38+
rev: v1.5.2
4339
hooks:
4440
- id: optimize-jpg
4541
- id: optimize-png

licensecheck/formatter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def stripAnsi(string: str) -> str:
5151
Returns:
5252
-------
5353
str: plaintext, utf-8 string (safe for writing to files)
54+
5455
"""
5556
return re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])").sub("", string)
5657

@@ -66,6 +67,7 @@ def ansi(myLice: License, packages: list[PackageInfo]) -> str:
6667
Returns:
6768
-------
6869
str: string to send to specified output in ansi format
70+
6971
"""
7072
string = StringIO()
7173

@@ -113,6 +115,7 @@ def plainText(myLice: License, packages: list[PackageInfo]) -> str:
113115
Returns:
114116
-------
115117
str: string to send to specified output in plain text format
118+
116119
"""
117120
return stripAnsi(ansi(myLice, packages))
118121

@@ -128,6 +131,7 @@ def markdown(myLice: License, packages: list[PackageInfo]) -> str:
128131
Returns:
129132
-------
130133
str: string to send to specified output in markdown format
134+
131135
"""
132136
info = "\n".join(f"- **{k}**: {v}" for k, v in INFO.items())
133137
strBuf = [f"## Info\n\n{info}\n\n## Project License\n\n{printLicense(myLice)}\n"]
@@ -169,6 +173,7 @@ def raw(myLice: License, packages: list[PackageInfo]) -> str:
169173
Returns:
170174
-------
171175
str: string to send to specified output in raw json format
176+
172177
"""
173178
return json.dumps(
174179
{
@@ -191,6 +196,7 @@ def rawCsv(myLice: License, packages: list[PackageInfo]) -> str:
191196
Returns:
192197
-------
193198
str: string to send to specified output in raw csv format
199+
194200
"""
195201
_ = myLice
196202
string = StringIO()

licensecheck/get_deps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def getReqs(using: str, skipDependencies: list[ucstr]) -> set[ucstr]:
3636
Returns:
3737
-------
3838
set[str]: set of requirement packages
39+
3940
"""
4041

4142
_ = using.split(":", 1)
@@ -194,6 +195,7 @@ def getDepsWithLicenses(
194195
tuple[License, set[PackageInfo]]: tuple of
195196
my package license
196197
set of updated dependencies with licenseCompat set
198+
197199
"""
198200
reqs = getReqs(using, skipDependencies)
199201

licensecheck/license_matrix.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def licenseLookup(licenseStr: ucstr, ignoreLicenses: list[ucstr] | None = None)
6262
Returns:
6363
-------
6464
L: License represented by licenseStr
65+
6566
"""
6667
termToLicense = {
6768
"PUBLIC DOMAIN": L.PUBLIC,
@@ -124,6 +125,7 @@ def licenseType(lice: ucstr, ignoreLicenses: list[ucstr] | None = None) -> list[
124125
Returns:
125126
-------
126127
list[L]: the license
128+
127129
"""
128130
if len(lice or "") < 1:
129131
return [L.NO_LICENSE]
@@ -148,6 +150,7 @@ def depCompatWMyLice(
148150
Returns:
149151
-------
150152
bool: True if compatible, otherwise False
153+
151154
"""
152155

153156
# Protect against None

licensecheck/packageinfo.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def licenseFromClassifierlist(classifiers: list[str] | None | list[Any]) -> ucst
9393
Returns:
9494
-------
9595
str: the license name
96+
9697
"""
9798
if not classifiers:
9899
return UNKNOWN
@@ -116,6 +117,7 @@ def getPackages(reqs: set[ucstr]) -> set[PackageInfo]:
116117
Returns:
117118
-------
118119
set[PackageInfo]: set of dependencies
120+
119121
"""
120122
packageinfo = set()
121123
for requirement in reqs:
@@ -136,6 +138,7 @@ def getMyPackageMetadata() -> dict[str, Any]:
136138
Returns
137139
-------
138140
dict[str, Any]: {"classifiers": list[str], "license": ucstr}
141+
139142
"""
140143
if Path("setup.cfg").exists():
141144
config = configparser.ConfigParser()
@@ -161,6 +164,7 @@ def getMyPackageLicense() -> ucstr:
161164
Returns
162165
-------
163166
str: license name
167+
164168
"""
165169
metaData = getMyPackageMetadata()
166170
licenseClassifier = licenseFromClassifierlist(metaData.get("classifiers", []))
@@ -184,6 +188,7 @@ def getModuleSize(path: Path, name: ucstr) -> int:
184188
Returns:
185189
-------
186190
int: size in bytes
191+
187192
"""
188193
size = 0
189194
with contextlib.suppress(AttributeError):

pyproject.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,19 @@ licensecheck = 'licensecheck:cli'
2929
[tool.poetry.dependencies]
3030
python = "^3.8"
3131
requests = "<3,>=2.31.0"
32-
fhconfparser = "<2025,>=2023"
32+
fhconfparser = "<2026,>=2024.1"
3333
tomli = "<3,>=2.0.1"
3434
rich = "<14,>=13.7.0"
35-
requests-cache = "<2,>=1.1.1"
35+
requests-cache = "<2,>=1.2.0"
3636
packaging = "<24,>=23.2"
3737
loguru = "<2,>=0.7.2"
3838

3939
[tool.poetry.group.dev.dependencies]
40-
pytest = "^7.4.4"
40+
pytest = "^8.0.2"
4141
handsdown = "^2.1.0"
42-
coverage = "^7.4.0"
42+
coverage = "^7.4.3"
4343
ruff = "^0.1.13"
44-
blackt = "^2024.0.1"
45-
pyright = "^1.1.347"
44+
pyright = "^1.1.351"
4645
pytest-loguru = "^0.3.0"
4746

4847
[build-system]
@@ -73,9 +72,11 @@ fixable = ["ALL"]
7372
[tool.ruff.lint.per-file-ignores]
7473
"**/{tests,docs,tools}/*" = ["D", "S101", "E402"]
7574

76-
[tool.black]
77-
line-length = 100
78-
target-version = ["py38"]
75+
[tool.ruff.format]
76+
indent-style = "tab"
77+
docstring-code-format = true
78+
line-ending = "lf"
79+
7980

8081
[tool.pyright]
8182
venvPath = "."

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
fhconfparser<2025,>=2023
1+
fhconfparser<2026,>=2024.1
22
loguru<2,>=0.7.2
33
packaging<24,>=23.2
4-
requests-cache<2,>=1.1.1
4+
requests-cache<2,>=1.2.0
55
requests<3,>=2.31.0
66
rich<14,>=13.7.0
77
tomli<3,>=2.0.1

0 commit comments

Comments
 (0)