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

feat: port code from library-analyzer #16

merged 81 commits into from
Oct 12, 2023

Conversation

Masara
Copy link
Contributor

@Masara Masara commented Sep 21, 2023

Summary of Changes

  • Moved API and docstring parser functionality from Library-Analyzer to this project.
  • Removed astroid and added mypy for file parsing and adjusted the AST walker & visitor.
  • Adjusted docstring parsers to work with mypy.
  • Added snapshot testing for pytest.

…t_types() for Attribute class types (WIP) | _ast_visitor_mypy.py: added attribute check to enter_moduledef(), enter_classdef() checks for a docstring and superclasses, leave_classdef() and leave_moduledef() stack fixes, extended enter_functiondef(), added leave_enum() | adjusted _ast_walker.py | refactored _get_api.py
…red _ast_visitor_mypy.py + added enum handling + added missing function handling functionalities + contructor handling for classes, removed unused functions, added test data and file
…tions can have multiple results, added Literal class for the Parameter default_value field, added Typ class for type fields; _ast_visitor_mypy.py: rebuild assignmentstmt and resultstmt functions, added utility functions for handling the creation of Type objects; Some refactoring and expansion of the test data files
… the type hint information, adjusted Parameter Class (added is_optional field), temporaty removed most of Type class usages and added strings instead, removed value field for enum instances, removed Literal Class; _ast_visitor_mypy.py: removes resultstmt enter and leave functions, adjusted other enter and leave functions with better parsing; refactored test file
@Masara Masara changed the title Api model feat: ...Todo Sep 21, 2023
@Masara Masara changed the title feat: ...Todo feat: Api-Model etc (todo) Sep 21, 2023
@lars-reimann
Copy link
Member

Regarding the conflicts in poetry.lock and pyproject.toml: It's best to take the files from main and then add any missing dependencies again using poetry add.

@Masara
Copy link
Contributor Author

Masara commented Sep 21, 2023

@lars-reimann Eine Frage zu den "results": Wenn es keinen Result, also keinen Type Hint für den Return Typ, gibt, wie soll das dargestellt werden? Soll das als "None" oder als "Any" dargestellt werden oder soll dann für die jeweilige Funktion gar kein Result eingetragen und gespeichert werden?

… type classes & adjusted how results are handled
@lars-reimann
Copy link
Member

lars-reimann commented Sep 22, 2023

Wenn es weder einen Type Hint noch einen Eintrag in der Doku gibt (oder explizit None gesetzt wurde), soll die Liste der Ergebnisse leer sein. Ggf. kann man die Analyse weiter verbessern, indem man noch schaut, welche Werte returned werden.

@Masara
Copy link
Contributor Author

Masara commented Oct 9, 2023

@lars-reimann Ich habe syrupy hinzugefügt und snapshot testing hinzugefügt wie gewünscht war. Beim MegaLinter gibt es nur noch ein Problem, welches ich nicht lösen kann: src/safeds_stubgen/api_analyzer/_types.py:467: error: Cannot instantiate abstract class "AbstractType" with abstract attribute "to_dict" [abstract] Kannst du da vielleicht helfen?

@Masara
Copy link
Contributor Author

Masara commented Oct 10, 2023

@lars-reimann Ich bin hier soweit fertig und der Pull Request könnte nun von dir abgenommen werden.

@Masara Masara marked this pull request as ready for review October 11, 2023 11:07
@Masara Masara requested review from a team and lars-reimann as code owners October 11, 2023 11:07
@lars-reimann lars-reimann changed the title feat: Api-Model etc (todo) feat: port code from library-analyzer Oct 12, 2023
@lars-reimann lars-reimann merged commit 5e0b3b1 into main Oct 12, 2023
9 checks passed
@lars-reimann lars-reimann deleted the api_model branch October 12, 2023 11:22
lars-reimann pushed a commit that referenced this pull request Nov 29, 2023
## [0.1.0](v0.0.1...v0.1.0) (2023-11-29)

### Features

* drop Python 3.10 and add Python 3.12 ([#23](#23)) ([091826d](091826d))
* port code from `library-analyzer` ([#16](#16)) ([5e0b3b1](5e0b3b1))

### Bug Fixes

* Added handling for boolean default values for parameters ([#25](#25)) ([1ff250d](1ff250d))
* **deps-dev:** bump urllib3 from 2.0.6 to 2.0.7 ([#26](#26)) ([ff1a33b](ff1a33b)), closes [#3144](https://github.com/Safe-DS/Stub-Generator/issues/3144)
* Fixed bugs for analyzing packages and api data creation. ([#27](#27)) ([80215a3](80215a3))
@lars-reimann
Copy link
Member

🎉 This PR is included in version 0.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Included in a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants