Skip to content

Make hash and size a lazy property#1837

Merged
simonw merged 4 commits intosimonw:mainfrom
fgregg:cache_hash
Oct 27, 2022
Merged

Make hash and size a lazy property#1837
simonw merged 4 commits intosimonw:mainfrom
fgregg:cache_hash

Conversation

@fgregg
Copy link
Contributor

@fgregg fgregg commented Oct 6, 2022

Many apologies, @simonw. My previous PR #1835 did not really solve the problem because the name of the database is often not known to database object in the init method.

I took a cue from how you dealt with this issue and made hash a lazy property and did something similar with size.


📚 Documentation preview 📚: https://datasette--1837.org.readthedocs.build/en/1837/

@codecov
Copy link

codecov bot commented Oct 7, 2022

Codecov Report

Base: 92.50% // Head: 92.50% // No change to project coverage 👍

Coverage data is based on head (c12447e) compared to base (eff1124).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1837   +/-   ##
=======================================
  Coverage   92.50%   92.50%           
=======================================
  Files          35       35           
  Lines        4400     4400           
=======================================
  Hits         4070     4070           
  Misses        330      330           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@simonw
Copy link
Owner

simonw commented Oct 27, 2022

Yeah this is better, thanks!

@simonw simonw merged commit b912d92 into simonw:main Oct 27, 2022
simonw pushed a commit that referenced this pull request Oct 28, 2022
* use inspect data for hash and file size
* make hash and cached_size lazy properties
* move hash property near size
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.

2 participants