Skip to content

Commit 5d144a2

Browse files
committed
add isort and flake8 and run pre-commit on all files
1 parent 8d68b29 commit 5d144a2

7 files changed

+51
-11
lines changed

.codespellrc

-4
This file was deleted.

.flake8

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length=79
3+
exclude =
4+
scripts/editProperties.py

.pre-commit-config.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,29 @@ repos:
1111
- id: check-ast
1212
- id: check-added-large-files
1313
- id: check-merge-conflict
14+
15+
# Sorts Python imports alphabetically and by section with `isort`.
16+
- repo: https://github.com/pycqa/isort
17+
rev: 5.13.2
18+
hooks:
19+
- id: isort
20+
args: [--settings-path, pyproject.toml]
21+
1422
- repo: https://github.com/psf/black
1523
rev: 24.3.0
1624
hooks:
1725
- id: black
26+
1827
- repo: https://github.com/codespell-project/codespell
1928
rev: v2.2.6
2029
hooks:
2130
- id: codespell
31+
args: [--toml, pyproject.toml]
32+
additional_dependencies: [tomli]
33+
34+
- repo: https://github.com/pyCQA/flake8
35+
rev: 7.1.0
36+
hooks:
37+
- id: flake8
38+
args: [--config, .flake8, --verbose]
39+
additional_dependencies: [flake8-bugbear]

pyproject.toml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[tool.black]
2+
line-length = 79
3+
4+
[tool.codespell]
5+
skip = "env,venv,*.svg,pyproject.toml"
6+
ignore-words-list = "HSI"
7+
builtin = "clear,rare"
8+
9+
[tool.isort]
10+
combine_as_imports = true
11+
line_length = 79
12+
profile = "black"
13+
skip_gitignore = true

scripts/editProperties.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
23
import rdflib as rl
34
from pytablewriter import MarkdownTableWriter
45

@@ -81,7 +82,11 @@ def edit_properties(version):
8182
writer.value_matrix = []
8283
del props["klass_desc"]
8384
for val, comment in sorted(props.items()):
84-
property = [val[2], comment, f"[{val[1]}{val[2]}]({val[1]}{val[2]})"]
85+
property = [
86+
val[2],
87+
comment,
88+
f"[{val[1]}{val[2]}]({val[1]}{val[2]})",
89+
]
8590
writer.value_matrix.append(property)
8691
writer.margin = 1 # add a whitespace for both sides of each cell
8792
doc.append("\n")

scripts/jsonParser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import os
21
import json
2+
import os
33

44
schema_dirs = ["contexts", "schemas", "terms"]
55
tested = 0
6-
for root, dirs, files in os.walk(".", topdown=True):
6+
for root, _, files in os.walk(".", topdown=True):
77
if os.path.basename(root) in schema_dirs:
88
for name in files:
99
with open(os.path.join(root, name)) as fp:

scripts/makeRelease.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import json
12
import os
23
import sys
3-
import json
4-
from pyld import jsonld
5-
import rdflib as rl
64
from shutil import copyfile
5+
6+
import rdflib as rl
7+
from pyld import jsonld
8+
79
from reproschema.jsonldutils import to_newformat
810

911

@@ -12,7 +14,9 @@ def create_release(version):
1214
terms = []
1315
for root, _, files in os.walk("terms"):
1416
for name in files:
15-
terms.extend(json.loads(to_newformat(os.path.join(root, name), "jsonld")))
17+
terms.extend(
18+
json.loads(to_newformat(os.path.join(root, name), "jsonld"))
19+
)
1620

1721
kwargs = {"algorithm": "URDNA2015", "format": "application/n-quads"}
1822
data = jsonld.normalize(terms, kwargs)

0 commit comments

Comments
 (0)