Skip to content

Commit f2bd51d

Browse files
committed
🔨 run mypy in pre-commit
1 parent 401a48b commit f2bd51d

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

.github/workflows/linting.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ jobs:
2525
uses: actions/cache@v2
2626
with:
2727
path: ~/.cache/pip
28-
key: ${{ runner.os }}-dev-${{ hashFiles('**/setup.py') }}
28+
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
2929
restore-keys: |
30-
${{ runner.os }}-dev-
30+
${{ runner.os }}-pip-
3131
3232
- name: Install dependencies
3333
# We install the full dev requirements to make sure everything installs OK
3434
run: |
3535
python -m pip install pip
3636
pip install -e .[dev]
3737
38-
- name: Analysing the code with Black
39-
run: |
40-
black --check .
41-
42-
- name: Analysing the code with mypy
43-
run: |
44-
mypy --install-types --non-interactive ./mindee
38+
- name: Cache pre-commit
39+
uses: actions/cache@v2
40+
with:
41+
path: ~/.cache/pre-commit
42+
key: ${{ runner.os }}-prec-${{ hashFiles('.pre-commit-config.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-prec-
4545
46-
- name: Analysing the code with pylint
46+
- name: Run all static analysis
4747
run: |
48-
pylint ./mindee
48+
pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,14 @@ repos:
3232
args: [
3333
"-j2"
3434
]
35+
36+
- repo: https://github.com/pre-commit/mirrors-mypy
37+
rev: v0.942
38+
hooks:
39+
- id: mypy
40+
additional_dependencies:
41+
- toml
42+
- pikepdf
43+
- types-pytz
44+
- types-requests
45+
- types-setuptools

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Here's the TL;DR of getting started.
66
First, get an [API Key](https://developers.mindee.com/docs/make-your-first-request#create-an-api-key)
77

88
Then, install this library:
9-
```shell script
9+
```shell
1010
pip install mindee
1111
```
1212

mindee/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def doc_from_b64string(
319319
Load a document from a base64 encoded string.
320320
321321
:param input_string: Input to parse as base64 string
322-
:param filename: The url_name of the file (without the path)
322+
:param filename: The name of the file (without the path)
323323
:param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
324324
325325
* if 1: pages [0]
@@ -350,7 +350,7 @@ def doc_from_bytes(
350350
Load a document from raw bytes.
351351
352352
:param input_bytes: Raw byte input
353-
:param filename: The url_name of the file (without the path)
353+
:param filename: The name of the file (without the path)
354354
:param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a PDF with.
355355
356356
* if 1: pages [0]

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ strict_equality = true
99
disallow_any_unimported = true
1010
disallow_untyped_calls = true
1111

12-
[[tool.mypy.overrides]]
13-
module = ['pikepdf',]
14-
ignore_missing_imports = true
15-
1612
[tool.pylic]
1713
safe_licenses = [
1814
"Apache Software License",

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
dir_path = os.path.dirname(os.path.realpath(__file__))
88
version_file = os.path.join(dir_path, "mindee", "version")
9-
with open(version_file, "r", encoding="utf-8") as version_file:
10-
__version__ = version_file.read().strip()
9+
with open(version_file, "r", encoding="utf-8") as file_p:
10+
__version__ = file_p.read().strip()
1111

1212
setup(
1313
version=__version__,

0 commit comments

Comments
 (0)