Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: port code from library-analyzer #16

Merged
merged 81 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
2e74014
Added the API model and docstring parsing - some imports are still mi…
Masara Aug 14, 2023
9170242
(WIP) Adjusted API model and removed docstring parsing - There are st…
Masara Aug 17, 2023
55d6681
(WIP) Added missing files, fixed imports and temporarily added astroi…
Masara Aug 21, 2023
ec2deb2
(WIP) Adjusted __init__.py files and imports
Masara Aug 21, 2023
432651e
(WIP) Adjusting some imports and ast visitor & walker
Masara Aug 22, 2023
d040c12
[WIP] _api.py: added checks for to_dict() in the API class, added _ge…
Masara Aug 26, 2023
024ebab
[WIP] adjusted to_dict() function of some classes in _api.py, refacto…
Masara Aug 28, 2023
55b46c4
[WIP] Added ast visitor for assignments and return statements, adjust…
Masara Aug 30, 2023
2ed81bd
[WIP] _api.py: removed global attributes for modules, added that func…
Masara Sep 5, 2023
f230e0b
[WIP] Added some tests
Masara Sep 5, 2023
bd65164
[WIP] Added more tests and added parameter data to json file output i…
Masara Sep 6, 2023
4fb50b2
[WIP] Added the remaining tests for _get_api.py
Masara Sep 6, 2023
7c273b4
[WIP] Added todos
Masara Sep 8, 2023
9e1da83
[WIP] _api.py: Functions have only one results which is also only has…
Masara Sep 13, 2023
e0b2127
[WIP] Parameter class is now a dataclass and fixed ast-visitor functi…
Masara Sep 14, 2023
e35d277
[WIP] Renamed the test data package some_package to test_package and …
Masara Sep 14, 2023
f081fa6
[WIP] Some bug fixes
Masara Sep 14, 2023
efa9b72
[WIP] added function to transform mypy type classes to our own python…
Masara Sep 22, 2023
fcc46a6
[WIP] Added test files and fixed a bug where enum instance names coul…
Masara Sep 22, 2023
bf63695
[WIP] Added reexport checks and corresponding test files
Masara Sep 26, 2023
3a6cfaa
[WIP] Added and adjusted tests, added some comments and adjusted resu…
Masara Sep 27, 2023
d4c136a
[WIP] adjusted tests
Masara Sep 27, 2023
2a5320c
[WIP] Refactoring and removing of unused functions
Masara Sep 27, 2023
8606f26
[WIP] Removing astroid from docstring parsers and adding mypy instead
Masara Sep 27, 2023
1cafa9f
[WIP] removed astroid from pyproject.toml
Masara Sep 27, 2023
ca2ebe0
[WIP] refactoring imports
Masara Sep 27, 2023
6f9410c
[WIP] Added raise if there are no files to analyse for mypy
Masara Sep 27, 2023
b2bd1ca
[WIP] Added more test cases and adjusted test files
Masara Sep 27, 2023
7c3caf3
fix: circular import
lars-reimann Sep 27, 2023
1c7ef88
[WIP] Added more test cases and added test data
Masara Sep 28, 2023
dc5a1ed
Merge remote-tracking branch 'origin/api_model' into api_model
Masara Sep 28, 2023
93938c5
Merge branch 'main' into api_model
Masara Sep 28, 2023
681e314
Refactoring
Masara Sep 28, 2023
9dbb316
Fixed linter
Masara Sep 28, 2023
d964487
Fixed linter
Masara Sep 28, 2023
c8d8e10
Added helper functions to get ClassDef, FuncDef and MypyFile body def…
Masara Sep 29, 2023
dc15d9d
fixed docstring_parsing tests and get_attribute_docstring functions (…
Masara Oct 2, 2023
2cfa51c
[WIP] fixing tests and adding docstring parsing to the ast_visitor
Masara Oct 3, 2023
31bbbf5
Fixed some tests and bugs
Masara Oct 3, 2023
09ceb72
Fixed all tests and some bugs
Masara Oct 4, 2023
10bed72
Merge branch 'main' into api_model
Masara Oct 4, 2023
89bb171
Fixed metadata errors for pytest
Masara Oct 4, 2023
0f1a716
Linter fixes
Masara Oct 4, 2023
fe18035
Linter fixes
Masara Oct 4, 2023
b009374
Linter fixes
Masara Oct 4, 2023
2e299bd
Linter fixes
Masara Oct 4, 2023
db6db04
Linter fixes
Masara Oct 4, 2023
f114465
Linter fixes
Masara Oct 4, 2023
72c96e4
refactoring, adjusting todos and Linter fixes
Masara Oct 4, 2023
609af1d
Linters ignore test data, adjusted _api.py class data exports (to_dic…
Masara Oct 5, 2023
23601f5
Removed unused functions & Refactoring
Masara Oct 6, 2023
171512a
Temporarily added linter file filters, since the mypy and ruff filter…
Masara Oct 6, 2023
2293c2e
Linter fixes
Masara Oct 6, 2023
16a87a4
Linter fixes & Refactoring
Masara Oct 6, 2023
146ff29
A lot of linter fixing & some refactoring
Masara Oct 6, 2023
074fa74
linter fixes
Masara Oct 6, 2023
898c589
linter fixes
Masara Oct 6, 2023
9ace2ed
linter fixes
Masara Oct 9, 2023
a2332eb
codecov test
Masara Oct 9, 2023
fe77151
fixing code coverage with "# pragma: no cover" comments
Masara Oct 9, 2023
61efeb4
Added syrupy for pytest snapshot testing, adjusted tests and added te…
Masara Oct 9, 2023
b627321
linter fixes
Masara Oct 9, 2023
5063365
linter fixes
Masara Oct 9, 2023
42f0c19
linter fixes
Masara Oct 9, 2023
4f6e94c
Commented out the create_type function for now, since it's unused. Ad…
Masara Oct 10, 2023
e2f3d78
style: apply automated linter fixes
megalinter-bot Oct 10, 2023
feb2288
style: apply automated linter fixes
megalinter-bot Oct 10, 2023
681647a
Commented out more yet unused functions
Masara Oct 10, 2023
c5165bf
Merge remote-tracking branch 'origin/api_model' into api_model
Masara Oct 10, 2023
1da5e19
Removed _typing_tokenizer.py (added it to a new branch docstring_pars…
Masara Oct 10, 2023
5c76902
Added snapshot test for main
Masara Oct 10, 2023
6e9c906
Refactoring & adding tests
Masara Oct 10, 2023
96be47b
Linter & bug fixes
Masara Oct 10, 2023
2ec1f1e
style: apply automated linter fixes
megalinter-bot Oct 10, 2023
1b9016a
style: apply automated linter fixes
megalinter-bot Oct 10, 2023
adf65af
Added missing tests
Masara Oct 10, 2023
4630be8
Merge remote-tracking branch 'origin/api_model' into api_model
Masara Oct 10, 2023
d12a707
Added missing tests
Masara Oct 10, 2023
c354e50
linter fixes
Masara Oct 10, 2023
d3d26d0
style: apply automated linter fixes
megalinter-bot Oct 10, 2023
86e115a
Added missing test cases
Masara Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/linters/.mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
disallow_incomplete_defs = true
disallow_untyped_defs = true
ignore_missing_imports = true
exclude = ["tests/data"]
2 changes: 2 additions & 0 deletions .github/linters/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ ignore = [
"TRY003",
]

extend-exclude = ["tests/data"]

[per-file-ignores]
"*test*.py" = [
# Undocumented declarations
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ __pycache__/
venv/

# Pytest outputs
.mypy_cache/
.pytest_cache/
htmlcov/
.coverage
Expand Down
2 changes: 1 addition & 1 deletion .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
EXTENDS: https://raw.githubusercontent.com/lars-reimann/.github/main/.mega-linter.yml

# Config
FILTER_REGEX_EXCLUDE: (\.github/workflows/|mkdocs.yml)
FILTER_REGEX_EXCLUDE: (\.github/workflows/|mkdocs.yml|tests/data)

# Workaround to also run prettier on other supported file types. We deactivate it for Markdown compared to the extended
# configuration since it breaks admonitions of Material for MkDocs.
Expand Down
243 changes: 152 additions & 91 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ generate-safeds-stubs = "safeds_stubgen.main:main"
[tool.poetry.dependencies]
python = "^3.11"
mypy = "^1.5.1"
docstring-parser = "^0.15"
syrupy = "^4.5.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.2"
pytest-cov = "^4.0.0"
setuptools = "^68.0.0"

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.5.3"
Expand All @@ -34,3 +37,4 @@ build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 120

2 changes: 2 additions & 0 deletions src/safeds_stubgen/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Safe-DS stubs generator."""
from __future__ import annotations
49 changes: 49 additions & 0 deletions src/safeds_stubgen/api_analyzer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""API-Analyzer for the Safe-DS stubs generator."""
from __future__ import annotations

from ._api import API, Attribute, Class, Function, Parameter, ParameterAssignment
from ._get_api import get_api
from ._mypy_helpers import get_classdef_definitions, get_funcdef_definitions, get_mypyfile_definitions
from ._package_metadata import distribution, distribution_version, package_root
from ._types import (
AbstractType,
BoundaryType,
DictType,
EnumType,
FinalType,
ListType,
LiteralType,
NamedType,
OptionalType,
SetType,
TupleType,
UnionType,
)

__all__ = [
"AbstractType",
"API",
"Attribute",
"BoundaryType",
"Class",
"DictType",
"distribution",
"distribution_version",
"EnumType",
"FinalType",
"Function",
"get_api",
"get_classdef_definitions",
"get_funcdef_definitions",
"get_mypyfile_definitions",
"ListType",
"LiteralType",
"NamedType",
"OptionalType",
"package_root",
"Parameter",
"ParameterAssignment",
"SetType",
"TupleType",
"UnionType",
]
Loading