Skip to content

Commit 67eb871

Browse files
🔧 add sphinx to pre-commit
1 parent a3090e7 commit 67eb871

4 files changed

Lines changed: 25 additions & 8 deletions

File tree

.github/workflows/_static-analysis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,7 @@ jobs:
5252
${{ runner.os }}-prec-
5353
5454
- name: Run all static analysis
55+
env:
56+
SKIP: sphinx-html,sphinx-linkcheck
5557
run: |
5658
pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,18 @@ repos:
4141
- types-setuptools
4242
- importlib-metadata
4343
- types-Pillow
44+
- repo: local
45+
hooks:
46+
- id: sphinx-html
47+
name: Sphinx HTML build
48+
entry: make -C docs html
49+
language: system
50+
pass_filenames: false
51+
files: ^docs/.*$|^mindee/.*\.py$
52+
53+
- id: sphinx-linkcheck
54+
name: Sphinx Linkcheck
55+
entry: make -C docs linkcheck
56+
language: system
57+
pass_filenames: false
58+
files: ^docs/.*$|^mindee/.*\.py$

mindee/v2/parsing/inference/field/inference_fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ def __str__(self) -> str:
4242
return str_fields
4343

4444
def get_simple_field(self, field_name: str) -> "SimpleField":
45-
"""Retrieve the value of a simple field by its name."""
45+
"""Retrieve a simple field by its name."""
4646
field = self.get(field_name)
4747
if field and field.field_type == FieldType.SIMPLE:
4848
return cast("SimpleField", field)
4949
raise ValueError(f"Field {field_name} is not a SimpleField.")
5050

5151
def get_object_field(self, field_name: str) -> "ObjectField":
52-
"""Retrieve the value of an object field by its name."""
52+
"""Retrieve an object field by its name."""
5353
field = self.get(field_name)
5454
if field and field.field_type == FieldType.OBJECT:
5555
return cast("ObjectField", field)
5656
raise ValueError(f"Field {field_name} is not an ObjectField.")
5757

5858
def get_list_field(self, field_name: str) -> "ListField":
59-
"""Retrieve the value of a list field by its name."""
59+
"""Retrieve a list field by its name."""
6060
field = self.get(field_name)
6161
if field and field.field_type == FieldType.LIST:
6262
return cast("ListField", field)

mindee/v2/parsing/inference/field/object_field.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections.abc import Callable
22
from typing import TYPE_CHECKING, cast
33

4-
from mindee.parsing.common import StringDict
4+
from mindee.parsing.common.string_dict import StringDict
55
from mindee.v2.parsing.inference.field.base_field import BaseField, FieldType
66
from mindee.v2.parsing.inference.field.inference_fields import InferenceFields
77

@@ -51,7 +51,7 @@ def simple_fields(self) -> dict[str, "SimpleField"]:
5151
Extract and return all SimpleField fields from the `fields` attribute.
5252
5353
:return: A dictionary containing all fields that have a type of
54-
`FieldType.SIMPLE`.
54+
`FieldType.SIMPLE`.
5555
"""
5656
simple_fields = {}
5757
for field_key, field_value in self.fields.items():
@@ -80,8 +80,8 @@ def object_fields(self) -> dict[str, "ObjectField"]:
8080
Retrieves all ObjectField fields from the `fields` attribute of the instance.
8181
8282
:returns: A dictionary containing fields of type `FieldType.OBJECT`. The keys
83-
represent
84-
the field names, and the values are corresponding ObjectField objects.
83+
represent the field names, and the values are corresponding ObjectField
84+
objects.
8585
"""
8686
object_fields = {}
8787
for field_key, field_value in self.fields.items():
@@ -123,7 +123,7 @@ def get_object_field(self, field_name: str) -> "ObjectField":
123123
:type field_name: str
124124
:return: The `ObjectField` associated with the given field name.
125125
:raises ValueError: If the field specified by `field_name` is not an
126-
`ObjectField`.
126+
`ObjectField`.
127127
"""
128128
if self.fields[field_name].field_type != FieldType.OBJECT:
129129
raise ValueError(f"Field {field_name} is not an ObjectField.")

0 commit comments

Comments
 (0)