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 docstring and type annotation of as_cached #3729

Merged
merged 4 commits into from
Aug 10, 2022

Conversation

MarcSkovMadsen
Copy link
Collaborator

@MarcSkovMadsen MarcSkovMadsen commented Jul 30, 2022

I'm trying to help a user on discourse. I wanted to use as_cached for the first time.

Its just much faster (for me) to look at an example before I study the more systematic documentation. So I added an example.

I added a better type annotation than return type None as described here https://stackoverflow.com/questions/62153257/specify-type-annotation-for-python-function-returning-type-of-argument

Comments

  • Why did you pick the name as_cached. Its not a term I know from elsewhere. It does not give me associations to anything I already know and love which would have been helpful 😄 .

@MarcSkovMadsen MarcSkovMadsen changed the title add example to docstring of as_cached Improve docstring and type annotation of as_cached Jul 30, 2022
@codecov
Copy link

codecov bot commented Jul 30, 2022

Codecov Report

Merging #3729 (5fd0d94) into master (7a4c221) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master    #3729      +/-   ##
==========================================
- Coverage   83.76%   83.76%   -0.01%     
==========================================
  Files         210      210              
  Lines       30202    30203       +1     
==========================================
  Hits        25300    25300              
- Misses       4902     4903       +1     
Flag Coverage Δ
ui-tests 33.23% <50.00%> (-0.01%) ⬇️
unitexamples-tests 77.08% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
panel/io/state.py 68.11% <50.00%> (-0.15%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MarcSkovMadsen
Copy link
Collaborator Author

I looked at the failing tests. They don't seem related to this PR as far as I can see.

Copy link
Member

@maximlt maximlt left a comment

Choose a reason for hiding this comment

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

Thanks Marc!

In particular on the typing improvement, TIL!

I made a suggestion to improve the example.

Why did you pick the name as_cached. Its not a term I know from elsewhere. It does not give me associations to anything I already know and love which would have been helpful 😄 .

Naming is hard! I can't reply for Philipp, but if you have other names to suggest I guess it's never too late, in particular if they're a net improvement over the current state.

I looked at the failing tests. They don't seem related to this PR as far as I can see.

They seem related actually, pre-commit failed because of a trailing whitespace: https://github.com/holoviz/panel/runs/7589741660?check_suite_focus=true#step:5:79

panel/io/state.py Outdated Show resolved Hide resolved
Marc Skov Madsen and others added 4 commits August 10, 2022 20:03
@philippjfr philippjfr force-pushed the feature/as-cached-docs-example branch from d91ddde to 5fd0d94 Compare August 10, 2022 18:44
@philippjfr philippjfr merged commit 3d789ef into master Aug 10, 2022
@philippjfr philippjfr deleted the feature/as-cached-docs-example branch August 10, 2022 19:39
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