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

improve type hint for run_task and run_thread #3459

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

zrr1999
Copy link
Contributor

@zrr1999 zrr1999 commented Jun 13, 2024

Description

Optimized the type annotations for run_task and run_thread, ensuring that the user's function can still retain annotation information even after wrapping another layer of run_task or run_thread.

In addition, it also supports kwargs for run_thread.

Test Code

# Test code for the review of this PR

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I signed the CLA.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass locally with my changes
  • I have made corresponding changes to the documentation (if applicable)

Screenshots (if applicable):

defb238bfd0b1c140d60fb6a88336398
->
71fdf5ba954fcc32cd9779fbe0aa9a72

Additional details

Copy link
Contributor

sourcery-ai bot commented Jun 13, 2024

Reviewer's Guide by Sourcery

This pull request adds type hints to various methods in the flet_core/page.py file. The changes primarily involve specifying the types of function parameters and return values using Python's type hinting system. This helps in improving code readability and maintainability by making the expected types explicit.

File-Level Changes

Files Changes
sdk/python/packages/flet-core/src/flet_core/page.py Added type hints to methods and introduced new type variables for better type safety and code clarity.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zrr1999 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 6 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@zrr1999 zrr1999 changed the title add type hint improve type hint for run_task and run_thread Jun 13, 2024
@FeodorFitsner FeodorFitsner merged commit c94826d into flet-dev:main Jun 14, 2024
2 checks passed
FeodorFitsner pushed a commit that referenced this pull request Jun 17, 2024
…ies to `Window` and `BrowserContextMenu` classes (#3463)

* initial commit

* commit

* update Window

* create BrowserContextMenu class

* chore: remove deprecation_warning and reformat deprecated

* change signal to SIG_DFL after exit_gracefully (#3466)

* improve type hint for run_task and run_thread (#3459)

* add type hint

* fix Future[RetT]

* feat(map): add missing py-events, better typing (#3464)

* initial commit

* commit

* update Window

* create BrowserContextMenu class

* chore: remove deprecation_warning and reformat deprecated

* Geolocator: rename some classes and methods

---------

Co-authored-by: Zhan Rongrui <46243324+zrr1999@users.noreply.github.com>
zrr1999 added a commit to zrr1999/flet that referenced this pull request Jul 17, 2024
zrr1999 added a commit to zrr1999/flet that referenced this pull request Jul 17, 2024
…ies to `Window` and `BrowserContextMenu` classes (flet-dev#3463)

* initial commit

* commit

* update Window

* create BrowserContextMenu class

* chore: remove deprecation_warning and reformat deprecated

* change signal to SIG_DFL after exit_gracefully (flet-dev#3466)

* improve type hint for run_task and run_thread (flet-dev#3459)

* add type hint

* fix Future[RetT]

* feat(map): add missing py-events, better typing (flet-dev#3464)

* initial commit

* commit

* update Window

* create BrowserContextMenu class

* chore: remove deprecation_warning and reformat deprecated

* Geolocator: rename some classes and methods

---------

Co-authored-by: Zhan Rongrui <46243324+zrr1999@users.noreply.github.com>
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.

3 participants