Skip to content

Commit 45fa08a

Browse files
Add precommit Black, run Black, and add PR template (#109)
1 parent d12260b commit 45fa08a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+543
-318
lines changed

.github/pull_request_template.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Summary
2+
3+
Please include a summary of the change and what the PR is trying to accomplish.
4+
List any dependencies that are required for this change.
5+
6+
## Changelog (optional)
7+
List of changes, to easily get an idea of what was done.
8+
9+
Example:
10+
- Created new route `awesome_new_route_of_doom`
11+
- Create alembic migration for new table, `every_table_but_combined`
12+
13+
## Type of change
14+
15+
Please delete options that are not relevant.
16+
17+
- [ ] Bug fix (non-breaking change which fixes an issue)
18+
- [ ] New feature (non-breaking change which adds functionality)
19+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
20+
- [ ] This change requires a documentation update
21+
22+
## Checklist:
23+
A quick checklist of things that should be done before the code is opened to review by others on the team.
24+
Delete any that are not applicable.
25+
26+
- [ ] Jira story/task is put into PR title
27+
- [ ] Code has been self-reviewed
28+
- [ ] Hard-to-understand areas have been commented
29+
- [ ] Documentation has been updated
30+
- [ ] My changes generate no new warnings
31+
- [ ] Unit tests have been added for base functionality and known edge cases
32+
- [ ] Any dependent changes have been merged and published in downstream modules
33+
- [ ] Any new GraphQL routes have descriptions for variables

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/psf/black
9+
rev: 19.3b0
10+
hooks:
11+
- id: black
12+
language_version: python3

docsrc/conf.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
# add these directories to sys.path here. If the directory is relative to the
1414
# documentation root, use os.path.abspath to make it absolute, like shown here.
1515

16-
sys.path.insert(0, os.path.abspath('../'))
16+
sys.path.insert(0, os.path.abspath("../"))
1717

1818

1919
# -- Project information -----------------------------------------------------
2020

21-
project = 'Indico Python Client'
22-
copyright = '2020, Indico'
23-
author = 'Indico'
21+
project = "Indico Python Client"
22+
copyright = "2020, Indico"
23+
author = "Indico"
2424

2525
# The full version, including alpha/beta/rc tags
26-
release = '3.1.0'
26+
release = "3.1.0"
2727

2828

2929
# -- General configuration ---------------------------------------------------
@@ -32,35 +32,35 @@
3232
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3333
# ones.
3434
extensions = [
35-
'sphinx_rtd_theme',
36-
'sphinx.ext.autodoc',
37-
'sphinx.ext.napoleon',
38-
'sphinx_autodoc_typehints'
35+
"sphinx_rtd_theme",
36+
"sphinx.ext.autodoc",
37+
"sphinx.ext.napoleon",
38+
"sphinx_autodoc_typehints",
3939
]
4040

4141
# Add any paths that contain templates here, relative to this directory.
42-
templates_path = ['_templates']
42+
templates_path = ["_templates"]
4343

4444
# List of patterns, relative to source directory, that match files and
4545
# directories to ignore when looking for source files.
4646
# This pattern also affects html_static_path and html_extra_path.
47-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
47+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
4848

4949

5050
# -- Options for HTML output -------------------------------------------------
5151

5252
# The theme to use for HTML and HTML Help pages. See the documentation for
5353
# a list of builtin themes.
5454
#
55-
html_theme = 'sphinx_rtd_theme'
55+
html_theme = "sphinx_rtd_theme"
5656

5757
# Add any paths that contain custom static files (such as style sheets) here,
5858
# relative to this directory. They are copied after the builtin static files,
5959
# so a file named "default.css" will overwrite the builtin "default.css".
60-
html_static_path = ['_static']
61-
html_style = 'css/indicotheme.css'
62-
html_logo = './_static/logo-white.png'
63-
html_favicon = './_static/favicon.png'
60+
html_static_path = ["_static"]
61+
html_style = "css/indicotheme.css"
62+
html_logo = "./_static/logo-white.png"
63+
html_favicon = "./_static/favicon.png"
6464
html_theme_options = {
65-
'style_nav_header_background': 'linear-gradient(to right top,#2c4658,#2f5f76,#2b7992,#2094ad,#04b1c6)'
66-
}
65+
"style_nav_header_background": "linear-gradient(to right top,#2c4658,#2f5f76,#2b7992,#2094ad,#04b1c6)"
66+
}

examples/ocr-object-parsing.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,25 @@
1414

1515
files_to_extract = client.call(
1616
DocumentExtraction(
17-
files=['./test_paragraphs.pdf'],
18-
json_config={'preset_config': 'standard'}
17+
files=["./test_paragraphs.pdf"], json_config={"preset_config": "standard"}
1918
)
2019
)
2120
extracted_file = client.call(JobStatus(id=files_to_extract[0].id, wait=True))
2221
json_result = client.call(RetrieveStorageObject(extracted_file.result))
2322

24-
# The code below shows how to get the OCR text from the 'json_result' object.
23+
# The code below shows how to get the OCR text from the 'json_result' object.
2524
# Note: it may vary slightly if you use DocumentExtraction configurations other than 'standard'
2625

2726
# Full Text
28-
full_document_text = json_result['text']
27+
full_document_text = json_result["text"]
2928

3029
# Doucment Text split by page
3130
text_by_page = list()
32-
for page in json_result['pages']:
33-
text_by_page.append(page['text'])
31+
for page in json_result["pages"]:
32+
text_by_page.append(page["text"])
3433

3534
# Document Text split by block (or paragraph)
3635
text_by_block = list()
37-
for page in json_result['pages']:
38-
for block in page['blocks']:
39-
text_by_block.append(block['text'])
36+
for page in json_result["pages"]:
37+
for block in page["blocks"]:
38+
text_by_block.append(block["text"])

examples/submission.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@
8585
Requires auto-review is enabled for workflow
8686
"""
8787
submission_ids = client.call(
88-
WorkflowSubmission(
89-
workflow_id=workflow_id, files=["my_file.pdf"]
90-
)
88+
WorkflowSubmission(workflow_id=workflow_id, files=["my_file.pdf"])
9189
)
9290
submissions = client.call(WaitForSubmissions(submission_ids))
9391
submission = submissions[0]

examples/train-classification-model.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
name="my_classification_model",
1919
dataset_id=dataset.id,
2020
source_column_id=dataset.datacolumn_by_name("text").id, # csv text column
21-
labelset_id=dataset.labelset_by_name(
22-
"Target_1"
23-
).id, # csv target class column
21+
labelset_id=dataset.labelset_by_name("Target_1").id, # csv target class column
2422
wait=True, # wait for training to finish
2523
)
2624
)

examples/workflow.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
# Send a document through the workflow
2222
# Get back one Job per file
2323
jobs = client.call(
24-
WorkflowSubmission(workflow_id=workflows[0].id, files=["./path/to/sample.pdf"], submission=False)
24+
WorkflowSubmission(
25+
workflow_id=workflows[0].id,
26+
files=["./path/to/sample.pdf"],
27+
submission=False,
28+
)
2529
)
2630
job = jobs[0]
2731

indico/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
from indico._version import get_versions
33

44
logging.basicConfig()
5-
Version = version = __version__ = VERSION = get_versions()['version']
5+
Version = version = __version__ = VERSION = get_versions()["version"]
66

77
from indico.client import *
88
from indico.client.request import *
99

1010
from ._version import get_versions
11-
__version__ = get_versions()['version']
11+
12+
__version__ = get_versions()["version"]
1213
del get_versions

0 commit comments

Comments
 (0)