Skip to content

Commit 9464fc9

Browse files
authored
Try fixing the hooks (#56)
Signed-off-by: David ML Brown Jr <dmlb2000@gmail.com>
1 parent 65b4c45 commit 9464fc9

34 files changed

+1316
-931
lines changed

.github/workflows/pre-commit.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
name: pre-commit
1+
name: Run Pre-Commit
22

33
on:
4-
pull_request:
4+
pull_request: {}
55
push:
66
branches: [main]
77

88
jobs:
99
pre-commit:
10-
runs-on: ubuntu-latest
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest]
14+
python-version: ['3.8', '3.9']
1115
steps:
1216
- uses: actions/checkout@v2
13-
- uses: actions/setup-python@v2
17+
- uses: actions/setup-python@v3
18+
with:
19+
python-version: ${{ matrix.python-version }}
1420
- uses: pre-commit/action@v2.0.3

.github/workflows/pypi.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish to PyPi
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v*
9+
10+
jobs:
11+
deploy:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
python-version: ['3.10']
17+
steps:
18+
- name: Publish package
19+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
20+
uses: pypa/gh-action-pypi-publish@release/v1
21+
with:
22+
user: __token__
23+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/pytest.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Run PyTest
2+
23
on:
3-
pull_request:
4+
pull_request: {}
45
push:
56
branches: [main]
67

@@ -24,7 +25,7 @@ jobs:
2425
run: |
2526
python --version
2627
pip --version
27-
pip install coverage pep257 pre-commit pylint pytest readthedocs-sphinx-ext recommonmark setuptools sphinx sphinx-rtd-theme
28+
pip install coverage pep257 pre-commit pylint pytest readthedocs-sphinx-ext recommonmark setuptools sphinx sphinx-rtd-theme wheel
2829
pip install .
2930
cd tests
3031
coverage run --include='*/site-packages/jsonpath2/*' --omit='*/site-packages/jsonpath2/parser/JSONPath*' -m pytest -xv

.github/workflows/sphinx.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
name: Run Sphinx Test
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
branches: [main]
7+
18
jobs:
29
build:
310
runs-on: ${{ matrix.os }}
@@ -19,7 +26,7 @@ jobs:
1926
run: |
2027
python --version
2128
pip --version
22-
pip install coverage pep257 pre-commit pylint pytest readthedocs-sphinx-ext recommonmark setuptools sphinx sphinx-rtd-theme
29+
pip install coverage pep257 pre-commit pylint pytest readthedocs-sphinx-ext recommonmark setuptools sphinx sphinx-rtd-theme docutils==0.16
2330
pip install .
2431
cd docs
2532
sphinx-build -T -E -b readthedocs -d _build/doctrees-readthedocs -D language=en . _build/html

.pre-commit-config.yaml

Lines changed: 34 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,40 @@
11
exclude: 'jsonpath2/parser/JSONPath.*'
22
repos:
3-
- repo: https://github.com/pre-commit/mirrors-autopep8
4-
rev: v1.5.2
5-
hooks:
6-
- id: autopep8
7-
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
84
rev: v2.5.0
95
hooks:
10-
- id: fix-encoding-pragma
11-
- id: trailing-whitespace
12-
- id: flake8
13-
args: [--max-line-length=120]
14-
- id: check-merge-conflict
15-
- id: double-quote-string-fixer
16-
- id: end-of-file-fixer
17-
- id: debug-statements
18-
- id: check-added-large-files
19-
- id: check-ast
20-
- id: check-byte-order-marker
21-
- id: check-case-conflict
22-
- id: check-docstring-first
23-
- id: check-executables-have-shebangs
24-
types: [python]
25-
- id: check-json
26-
- id: check-vcs-permalinks
27-
- id: mixed-line-ending
28-
- id: name-tests-test
29-
- id: pretty-format-json
30-
args:
31-
- --autofix
32-
- --top-keys=_id
33-
- id: sort-simple-yaml
34-
files: '.yaml$'
35-
- id: check-symlinks
36-
- id: check-yaml
37-
- id: detect-private-key
38-
- id: trailing-whitespace
39-
- repo: local
6+
- id: fix-encoding-pragma
7+
- id: trailing-whitespace
8+
- id: check-merge-conflict
9+
- id: end-of-file-fixer
10+
- id: debug-statements
11+
- id: check-added-large-files
12+
- id: check-ast
13+
- id: check-byte-order-marker
14+
- id: check-case-conflict
15+
- id: check-docstring-first
16+
- id: check-executables-have-shebangs
17+
types: [python]
18+
- id: check-json
19+
- id: check-vcs-permalinks
20+
- id: mixed-line-ending
21+
- id: name-tests-test
22+
- id: pretty-format-json
23+
args:
24+
- --autofix
25+
- --top-keys=_id
26+
- id: sort-simple-yaml
27+
files: '.yaml$'
28+
- id: check-symlinks
29+
- id: check-yaml
30+
- id: detect-private-key
31+
- id: trailing-whitespace
32+
- repo: https://github.com/psf/black
33+
rev: 22.3.0
4034
hooks:
41-
- id: pep257
42-
name: pep257
43-
entry: python -m pep257
44-
language: system
45-
types: [python]
46-
- id: pylint
47-
name: pylint
48-
entry: python -m pylint --rcfile=pylintrc
49-
language: system
50-
types: [python]
51-
- repo: https://github.com/Lucas-C/pre-commit-hooks
52-
rev: v1.1.7
35+
- id: black
36+
- repo: https://github.com/Lucas-C/pre-commit-hooks
37+
rev: v1.1.13
5338
hooks:
54-
- id: remove-tabs
55-
- id: remove-crlf
39+
- id: remove-tabs
40+
- id: remove-crlf

docs/conf.py

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
from recommonmark.parser import CommonMarkParser
2222
from recommonmark.transform import AutoStructify
2323

24-
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'tests'))
24+
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "tests"))
2525

2626
# -- Project information -----------------------------------------------------
2727

28-
project = 'JSONPath2 Library'
29-
copyright = '2019, David Brown'
30-
author = 'David Brown'
28+
project = "JSONPath2 Library"
29+
copyright = "2019, David Brown"
30+
author = "David Brown"
3131

3232
# The short X.Y version
33-
version = ''
33+
version = ""
3434
# The full version, including alpha/beta/rc tags
35-
release = ''
35+
release = ""
3636

3737

3838
# -- General configuration ---------------------------------------------------
@@ -45,24 +45,24 @@
4545
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4646
# ones.
4747
extensions = [
48-
'sphinx.ext.autodoc',
49-
'sphinx.ext.viewcode',
50-
'readthedocs_ext.readthedocs'
48+
"sphinx.ext.autodoc",
49+
"sphinx.ext.viewcode",
50+
"readthedocs_ext.readthedocs",
5151
]
5252

5353
# Add any paths that contain templates here, relative to this directory.
54-
templates_path = ['_templates']
54+
templates_path = ["_templates"]
5555

5656
# The suffix(es) of source filenames.
5757
# You can specify multiple suffix as a list of string:
5858

5959
source_suffix = {
60-
'.rst': 'restructuredtext',
61-
'.md': 'markdown',
60+
".rst": "restructuredtext",
61+
".md": "markdown",
6262
}
6363

6464
# The master toctree document.
65-
master_doc = 'index'
65+
master_doc = "index"
6666

6767
# The language for content autogenerated by Sphinx. Refer to documentation
6868
# for a list of supported languages.
@@ -74,18 +74,18 @@
7474
# List of patterns, relative to source directory, that match files and
7575
# directories to ignore when looking for source files.
7676
# This pattern also affects html_static_path and html_extra_path.
77-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
77+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
7878

7979
# The name of the Pygments (syntax highlighting) style to use.
80-
pygments_style = 'sphinx'
80+
pygments_style = "sphinx"
8181

8282

8383
# -- Options for HTML output -------------------------------------------------
8484

8585
# The theme to use for HTML and HTML Help pages. See the documentation for
8686
# a list of builtin themes.
8787
#
88-
html_theme = 'sphinx_rtd_theme'
88+
html_theme = "sphinx_rtd_theme"
8989

9090
# Theme options are theme-specific and customize the look and feel of a theme
9191
# further. For a list of options available for each theme, see the
@@ -96,7 +96,7 @@
9696
# Add any paths that contain custom static files (such as style sheets) here,
9797
# relative to this directory. They are copied after the builtin static files,
9898
# so a file named "default.css" will overwrite the builtin "default.css".
99-
html_static_path = ['_static']
99+
html_static_path = ["_static"]
100100

101101
# Custom sidebar templates, must be a dictionary that maps document names
102102
# to template names.
@@ -112,7 +112,7 @@
112112
# -- Options for HTMLHelp output ---------------------------------------------
113113

114114
# Output file base name for HTML help builder.
115-
htmlhelp_basename = 'JSONPath2doc'
115+
htmlhelp_basename = "JSONPath2doc"
116116

117117

118118
# -- Options for LaTeX output ------------------------------------------------
@@ -121,15 +121,12 @@
121121
# The paper size ('letterpaper' or 'a4paper').
122122
#
123123
# 'papersize': 'letterpaper',
124-
125124
# The font size ('10pt', '11pt' or '12pt').
126125
#
127126
# 'pointsize': '10pt',
128-
129127
# Additional stuff for the LaTeX preamble.
130128
#
131129
# 'preamble': '',
132-
133130
# Latex figure (float) alignment
134131
#
135132
# 'figure_align': 'htbp',
@@ -139,19 +136,21 @@
139136
# (source start file, target name, title,
140137
# author, documentclass [howto, manual, or own class]).
141138
latex_documents = [
142-
(master_doc, 'JSONPath2.tex', 'Python JSONPath2 Documentation',
143-
'David Brown', 'manual'),
139+
(
140+
master_doc,
141+
"JSONPath2.tex",
142+
"Python JSONPath2 Documentation",
143+
"David Brown",
144+
"manual",
145+
),
144146
]
145147

146148

147149
# -- Options for manual page output ------------------------------------------
148150

149151
# One entry per manual page. List of tuples
150152
# (source start file, name, description, authors, manual section).
151-
man_pages = [
152-
(master_doc, 'jsonpath2', 'Python JSONPath2 Documentation',
153-
[author], 1)
154-
]
153+
man_pages = [(master_doc, "jsonpath2", "Python JSONPath2 Documentation", [author], 1)]
155154

156155

157156
# -- Options for Texinfo output ----------------------------------------------
@@ -160,9 +159,15 @@
160159
# (source start file, target name, title, author,
161160
# dir menu entry, description, category)
162161
texinfo_documents = [
163-
(master_doc, 'JSONPath2', 'Python JSONPath2 Documentation',
164-
author, 'JSONPath2', 'Python implementation for JSONPath expressions.',
165-
'Miscellaneous'),
162+
(
163+
master_doc,
164+
"JSONPath2",
165+
"Python JSONPath2 Documentation",
166+
author,
167+
"JSONPath2",
168+
"Python implementation for JSONPath expressions.",
169+
"Miscellaneous",
170+
),
166171
]
167172

168173

@@ -181,26 +186,30 @@
181186
# epub_uid = ''
182187

183188
# A list of files that should not be packed into the epub file.
184-
epub_exclude_files = ['search.html']
189+
epub_exclude_files = ["search.html"]
185190

186191

187192
# -- Extension configuration -------------------------------------------------
188193
autodoc_default_options = {
189-
'member-order': 'bysource',
190-
'special-members': '__init__',
191-
'undoc-members': None,
192-
'exclude-members': '__weakref__'
194+
"member-order": "bysource",
195+
"special-members": "__init__",
196+
"undoc-members": None,
197+
"exclude-members": "__weakref__",
193198
}
194199

195200
# app setup hook
196201

197202

198203
def setup(app):
199204
"""Setup the hooks for recommonmark."""
200-
app.add_config_value('recommonmark_config', {
201-
# 'url_resolver': lambda url: github_doc_root + url,
202-
'auto_toc_tree_section': 'Contents',
203-
'enable_eval_rst': True,
204-
}, True)
205+
app.add_config_value(
206+
"recommonmark_config",
207+
{
208+
# 'url_resolver': lambda url: github_doc_root + url,
209+
"auto_toc_tree_section": "Contents",
210+
"enable_eval_rst": True,
211+
},
212+
True,
213+
)
205214
app.add_source_parser(CommonMarkParser)
206215
app.add_transform(AutoStructify)

jsonpath2/expression.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def __eq__(self, other: object) -> bool:
1313
return isinstance(other, self.__class__) and (self.__dict__ == other.__dict__)
1414

1515
@abstractmethod
16-
def evaluate(self, root_value: object, current_value: object) -> bool: # pragma: no cover abstract method
16+
def evaluate(
17+
self, root_value: object, current_value: object
18+
) -> bool: # pragma: no cover abstract method
1719
"""Abstract method to evaluate the expression."""
1820
raise NotImplementedError()

0 commit comments

Comments
 (0)