Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 45f5e5b

Browse files
authored
refactor(parser): strategy pattern for documentation parsing (#812)
* refactor(parser): move function that creates parameter list * refactor(parser): documentation parsing strategy * refactor(parser): extract parsing of NumpyDoc into strategy * refactor(parser): clean up structure * refactor(parser): update API model * refactor(parser): use injected documentation parser for class and function documentation * refactor(parser): remove references to now outdated code * refactor(parser): minor changes * fix(parser): crash * perf(parser): improve performance of numpydoc parser * refactor(parser): further restructuring * build: set mypy python version to 3.10 * build: set mypy python version to 3.10 * style: fix linter errors * style: fix linter errors * style: apply automatic fixes of linters Co-authored-by: lars-reimann <[email protected]>
1 parent d2d3a06 commit 45f5e5b

Some content is hidden

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

50 files changed

+959
-269
lines changed

package-parser/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ dist/
2525
htmlcov/
2626
.coverage
2727

28+
# Test __init__.py files
29+
tests/**/__init__.py
30+
2831
# Output of this tool
2932
out/
3033
tmp/

package-parser/package_parser/cli/_run_annotations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import json
22
from pathlib import Path
33

4-
from package_parser.model.annotations import AnnotationStore
5-
from package_parser.model.api import API
6-
from package_parser.model.usages import UsageCountStore
74
from package_parser.processing.annotations import generate_annotations
5+
from package_parser.processing.annotations.model import AnnotationStore
6+
from package_parser.processing.api.model import API
7+
from package_parser.processing.usages.model import UsageCountStore
88
from package_parser.utils import ensure_file_exists
99

1010

package-parser/package_parser/cli/_run_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
from package_parser.cli._json_encoder import CustomEncoder
66
from package_parser.cli._shared_constants import _API_KEY
7-
from package_parser.model.api import API
87
from package_parser.processing.api import get_api
8+
from package_parser.processing.api.model import API
99
from package_parser.processing.dependencies import get_dependencies
1010
from package_parser.utils import ensure_file_exists
1111

package-parser/package_parser/model/__init__.py

Whitespace-only changes.

package-parser/package_parser/model/api/__init__.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

package-parser/package_parser/processing/annotations/_generate_annotations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
from package_parser.model.annotations import AnnotationStore
2-
from package_parser.model.api import API
3-
from package_parser.model.usages import UsageCountStore
41
from package_parser.processing.annotations._generate_boundary_annotations import (
52
_generate_boundary_annotations,
63
)
@@ -16,6 +13,9 @@
1613
from package_parser.processing.annotations._usages_preprocessor import (
1714
_preprocess_usages,
1815
)
16+
from package_parser.processing.annotations.model import AnnotationStore
17+
from package_parser.processing.api.model import API
18+
from package_parser.processing.usages.model import UsageCountStore
1919

2020

2121
def generate_annotations(api: API, usages: UsageCountStore) -> AnnotationStore:

package-parser/package_parser/processing/annotations/_generate_boundary_annotations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from package_parser.model.annotations import (
1+
from package_parser.processing.annotations.model import (
22
AnnotationStore,
33
BoundaryAnnotation,
44
Interval,
55
)
6-
from package_parser.model.api import API
6+
from package_parser.processing.api.model import API
77

88
from ._constants import autogen_author
99

package-parser/package_parser/processing/annotations/_generate_enum_annotations.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import re
22

3-
from package_parser.model.annotations import AnnotationStore, EnumAnnotation, EnumPair
4-
from package_parser.model.api import API
3+
from package_parser.processing.annotations.model import (
4+
AnnotationStore,
5+
EnumAnnotation,
6+
EnumPair,
7+
)
8+
from package_parser.processing.api.model import API
59

610
from ._constants import autogen_author
711

package-parser/package_parser/processing/annotations/_generate_parameter_importance_annotations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from typing import Any, Optional
22

3-
from package_parser.model.annotations import (
3+
from package_parser.processing.annotations.model import (
44
AnnotationStore,
55
ConstantAnnotation,
66
OptionalAnnotation,
77
RequiredAnnotation,
88
)
9-
from package_parser.model.api import API, Parameter
10-
from package_parser.model.usages import UsageCountStore
9+
from package_parser.processing.api.model import API, Parameter
10+
from package_parser.processing.usages.model import UsageCountStore
1111

1212
from ._constants import autogen_author
1313

package-parser/package_parser/processing/annotations/_generate_remove_annotations.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
from package_parser.model.annotations import AnnotationStore, RemoveAnnotation
2-
from package_parser.model.api import API
3-
from package_parser.model.usages import UsageCountStore
1+
from package_parser.processing.annotations.model import (
2+
AnnotationStore,
3+
RemoveAnnotation,
4+
)
5+
from package_parser.processing.api.model import API
6+
from package_parser.processing.usages.model import UsageCountStore
47

58
from ._constants import autogen_author
69

0 commit comments

Comments
 (0)