-
Notifications
You must be signed in to change notification settings - Fork 45
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
Lint: Utils module #350
base: develop
Are you sure you want to change the base?
Lint: Utils module #350
Changes from all commits
3b5578b
6c62bfd
738e3d0
f91ef77
8b8d54b
e1196e1
f4ec009
88810cf
71974b3
8d0263f
769a26f
2f2655b
e6da2ed
1c3602a
0e343d5
486708d
bdf74b3
dfad8dc
8d551e4
cf54e12
7720670
92ad905
65ad2e4
44416f5
ef04cc2
7064645
7aaedea
9e0d63d
03c9552
ddfd14f
9f5e427
e5f1b5c
fd9646b
b721f03
e7fc584
24fa8a5
259e7e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,7 +120,10 @@ def request_usgs_data( | |
|
||
# Use handle_caching to manage cache | ||
cached_data, metadata, cache_filepath = handle_caching( | ||
hash_params, cache_dir, write_json, clear_cache | ||
hash_params, | ||
cache_dir, | ||
cache_content={"data": None, "metadata": None, "write_json": write_json}, | ||
clear_cache_file=clear_cache, | ||
Comment on lines
+123
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. handle_caching reduced to only 5 inputs |
||
) | ||
|
||
if cached_data is not None: | ||
|
@@ -165,7 +168,12 @@ def request_usgs_data( | |
|
||
# After making the API request and processing the response, write the | ||
# response to a cache file | ||
handle_caching(hash_params, cache_dir, data=data, clear_cache_file=clear_cache) | ||
handle_caching( | ||
hash_params, | ||
cache_dir, | ||
cache_content={"data": data, "metadata": None, "write_json": None}, | ||
clear_cache_file=clear_cache, | ||
) | ||
Comment on lines
+171
to
+176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. handle_caching reduced to only 5 inputs |
||
|
||
if write_json: | ||
shutil.copy(cache_filepath, write_json) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,11 @@ def test_handle_caching_creates_cache(self): | |
Asserts: | ||
- The cache file is successfully created at the expected file path. | ||
""" | ||
handle_caching(self.hash_params, self.cache_dir, data=self.data) | ||
handle_caching( | ||
self.hash_params, | ||
self.cache_dir, | ||
cache_content={"data": self.data, "metadata": None, "write_json": None}, | ||
) | ||
Comment on lines
+96
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. handle_caching reduced to only 5 inputs |
||
|
||
cache_filename = ( | ||
hashlib.md5(self.hash_params.encode("utf-8")).hexdigest() + ".json" | ||
|
@@ -114,8 +118,18 @@ def test_handle_caching_retrieves_data(self): | |
Asserts: | ||
- The retrieved data matches the original sample DataFrame. | ||
""" | ||
handle_caching(self.hash_params, self.cache_dir, data=self.data) | ||
retrieved_data, _, _ = handle_caching(self.hash_params, self.cache_dir) | ||
handle_caching( | ||
self.hash_params, | ||
self.cache_dir, | ||
cache_content={"data": self.data, "metadata": None, "write_json": None}, | ||
) | ||
|
||
retrieved_data, _, _ = handle_caching( | ||
self.hash_params, | ||
self.cache_dir, | ||
cache_content={"data": None, "metadata": None, "write_json": None}, | ||
) | ||
|
||
Comment on lines
+121
to
+132
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. handle_caching reduced to only 5 inputs |
||
pd.testing.assert_frame_equal(self.data, retrieved_data, check_freq=False) | ||
|
||
def test_handle_caching_cdip_file_extension(self): | ||
|
@@ -132,7 +146,11 @@ def test_handle_caching_cdip_file_extension(self): | |
- The cache file with a ".pkl" extension is successfully created at the expected file path. | ||
""" | ||
cache_dir = os.path.join(self.cache_dir, "cdip") | ||
handle_caching(self.hash_params, cache_dir, data=self.data) | ||
handle_caching( | ||
self.hash_params, | ||
cache_dir, | ||
cache_content={"data": self.data, "metadata": None, "write_json": None}, | ||
) | ||
Comment on lines
+149
to
+153
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. handle_caching reduced to only 5 inputs |
||
|
||
cache_filename = ( | ||
hashlib.md5(self.hash_params.encode("utf-8")).hexdigest() + ".pkl" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add utils module to the linting enforcement