Skip to content

Conversation

Antonyjin
Copy link
Member

@Antonyjin Antonyjin commented Mar 6, 2025

Adding type annotation for a better code clarity and safety. This has been done on the migration of pydantic branch, but adding it first because it should not break the code and facilitate the merge of the pydantic PR

Related ClickUp, GitHub or Jira tickets : ALEPH-XXX

Changes

Adding type annotation in the conf.py file for a better clarity and safety.

Due to the change mypy raised those errors because os.makedirs expects a valid path but variables can be None.
changes have been done about the path validation

src/aleph/vm/conf.py:412: error: Argument 1 to "makedirs" has incompatible type "Path | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]
src/aleph/vm/conf.py:413: error: Argument 1 to "makedirs" has incompatible type "Path | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]
src/aleph/vm/conf.py:414: error: Argument 1 to "makedirs" has incompatible type "Path | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]
src/aleph/vm/conf.py:415: error: Argument 1 to "makedirs" has incompatible type "Path | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]
src/aleph/vm/conf.py:431: error: Argument 1 to "makedirs" has incompatible type "Path | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]
src/aleph/vm/conf.py:433: error: Argument 1 to "makedirs" has incompatible type "Path | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]
src/aleph/vm/conf.py:434: error: Argument 1 to "makedirs" has incompatible type "Path | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]

Adding type annotation for a better code clarity and safety.
This has been done on the migration of pydantic branch, but adding it first because it should not
break the code and facilitate the merge of the pydantic PR
@Antonyjin Antonyjin linked an issue Mar 6, 2025 that may be closed by this pull request
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 86.44068% with 8 lines in your changes missing coverage. Please review.

Project coverage is 63.26%. Comparing base (1c2c180) to head (41ff093).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/aleph/vm/conf.py 86.44% 0 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #773      +/-   ##
==========================================
- Coverage   63.34%   63.26%   -0.08%     
==========================================
  Files          77       77              
  Lines        6848     6855       +7     
  Branches      568      576       +8     
==========================================
- Hits         4338     4337       -1     
  Misses       2329     2329              
- Partials      181      189       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Antonyjin Antonyjin marked this pull request as ready for review March 6, 2025 13:27
@Antonyjin Antonyjin requested a review from hoh March 6, 2025 13:36
@hoh hoh merged commit 8043bf0 into main Mar 10, 2025
31 checks passed
@hoh hoh deleted the antonyjin-add-more-type-annotations-for-a-proper-code branch March 10, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more type annotations for a proper code
2 participants