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

Add more type hints #3499

Merged
merged 11 commits into from May 12, 2022
Merged

Add more type hints #3499

merged 11 commits into from May 12, 2022

Conversation

MarcSkovMadsen
Copy link
Collaborator

Adds typehints to button.py and selected dependencies.

panel/links.py Outdated Show resolved Hide resolved
panel/links.py Outdated Show resolved Hide resolved
panel/reactive.py Outdated Show resolved Hide resolved
@MarcSkovMadsen MarcSkovMadsen changed the title Add typehints to button.py and selected dependencies Add more type hints May 8, 2022
@philippjfr philippjfr marked this pull request as ready for review May 12, 2022 17:18
@philippjfr philippjfr force-pushed the feature/add-typehints branch 2 times, most recently from da70943 to 4644970 Compare May 12, 2022 17:49
panel/util.py Outdated Show resolved Hide resolved
@@ -256,33 +264,36 @@ def datetime_as_utctimestamp(value):
return value.replace(tzinfo=dt.timezone.utc).timestamp() * 1000


def is_number(s):
def is_number(s: Any) -> bool:
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be even better to make this a type guard def is_number(s: Any) -> TypeGuard[float] (needs typing_extensions for now). This way s will be known to be a float in if is_number(s): or after assert is_number(s).

@philippjfr
Copy link
Member

I'm going to merge and continue in another PR. Otherwise we're inviting tons of merge conflicts.

@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #3499 (9f7a7be) into master (d3a7fc9) will decrease coverage by 0.04%.
The diff coverage is 82.11%.

@@            Coverage Diff             @@
##           master    #3499      +/-   ##
==========================================
- Coverage   82.80%   82.76%   -0.05%     
==========================================
  Files         199      199              
  Lines       27296    27332      +36     
==========================================
+ Hits        22603    22620      +17     
- Misses       4693     4712      +19     
Impacted Files Coverage Δ
panel/links.py 83.46% <67.92%> (-3.58%) ⬇️
panel/param.py 86.85% <75.00%> (ø)
panel/widgets/button.py 91.78% <83.33%> (-2.43%) ⬇️
panel/reactive.py 76.82% <85.71%> (-0.11%) ⬇️
panel/layout/base.py 91.95% <90.10%> (+1.14%) ⬆️
panel/util.py 85.38% <97.22%> (+0.22%) ⬆️
panel/tests/layout/test_base.py 100.00% <100.00%> (ø)
panel/tests/test_viewable.py 100.00% <100.00%> (ø)
panel/viewable.py 68.22% <100.00%> (ø)
panel/widgets/file_selector.py 84.61% <100.00%> (+0.09%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3a7fc9...9f7a7be. Read the comment docs.

@philippjfr philippjfr merged commit 869549c into master May 12, 2022
@philippjfr philippjfr deleted the feature/add-typehints branch May 12, 2022 21:53
philippjfr added a commit that referenced this pull request May 16, 2022
Co-authored-by: Marc Skov Madsen <masma@orsted.dk>
Co-authored-by: Philipp Rudiger <prudiger@anaconda.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.

None yet

3 participants