rms-filecache 2.0.0__tar.gz → 2.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {rms_filecache-2.0.0/rms_filecache.egg-info → rms_filecache-2.0.1}/PKG-INFO +4 -4
  2. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/README.md +3 -3
  3. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/filecache/_version.py +2 -2
  4. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/filecache/file_cache_path.py +9 -0
  5. {rms_filecache-2.0.0 → rms_filecache-2.0.1/rms_filecache.egg-info}/PKG-INFO +4 -4
  6. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/test_file_cache_path.py +35 -22
  7. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.coveragerc +0 -0
  8. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.flake8 +0 -0
  9. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.github/pull_request_template.md +0 -0
  10. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.github/workflows/publish_to_pypi.yml +0 -0
  11. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.github/workflows/publish_to_test_pypi.yml +0 -0
  12. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.github/workflows/run-tests.yml +0 -0
  13. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.gitignore +0 -0
  14. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/.readthedocs.yaml +0 -0
  15. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/LICENSE +0 -0
  16. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/docs/Makefile +0 -0
  17. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/docs/conf.py +0 -0
  18. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/docs/index.rst +0 -0
  19. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/docs/make.bat +0 -0
  20. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/docs/module.rst +0 -0
  21. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/filecache/__init__.py +0 -0
  22. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/filecache/file_cache.py +0 -0
  23. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/filecache/file_cache_source.py +0 -0
  24. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/filecache/file_cache_types.py +0 -0
  25. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/filecache/my_glob.py +0 -0
  26. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/mypy.ini +0 -0
  27. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/pyproject.toml +0 -0
  28. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/requirements.txt +0 -0
  29. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/rms_filecache.egg-info/SOURCES.txt +0 -0
  30. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/rms_filecache.egg-info/dependency_links.txt +0 -0
  31. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/rms_filecache.egg-info/requires.txt +0 -0
  32. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/rms_filecache.egg-info/top_level.txt +0 -0
  33. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/setup.cfg +0 -0
  34. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/test_files/expected/lorem1.txt +0 -0
  35. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/test_files/expected/subdir1/lorem1.txt +0 -0
  36. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/test_files/expected/subdir1/subdir2a/binary1.bin +0 -0
  37. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/test_files/expected/subdir1/subdir2b/binary1.bin +0 -0
  38. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/test_programs/locking.py +0 -0
  39. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/test_programs/multi_download.py +0 -0
  40. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/__init__.py +0 -0
  41. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/gs_lifecycle_config.json +0 -0
  42. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/gs_lifecycle_config_info.txt +0 -0
  43. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/s3_bucket_policy_read.txt +0 -0
  44. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/s3_bucket_policy_write.txt +0 -0
  45. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/s3_lifecycle_policy.txt +0 -0
  46. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/test_file_cache.py +0 -0
  47. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/test_file_cache_source.py +0 -0
  48. {rms_filecache-2.0.0 → rms_filecache-2.0.1}/tests/test_url_to_path.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rms-filecache
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: File cache for files retrieved from the cloud
5
5
  Maintainer-email: "Robert S. French" <rfrench@seti.org>
6
6
  License: Apache-2.0
@@ -181,7 +181,7 @@ accessible from a webserver at
181
181
  Finally, it could be accessible from Google Cloud Storage from the ``rms-node-holdings``
182
182
  bucket at
183
183
  ``gs://rms-node-holdings/pds3-holdings/volumes/COISS_2xxx/COISS_2001/voldesc.cat``. Before
184
- running the program, an environment variable could be set to one of these values::
184
+ running the program, an environment variable could be set to one of these values:
185
185
 
186
186
  ```sh
187
187
  $ export PDS3_HOLDINGS_SRC="~/pds3-holdings"
@@ -217,8 +217,8 @@ contents = voldesc_path.read_text()
217
217
  ```
218
218
 
219
219
  Finally, there are four classes that allow direct access to the four possible storage
220
- locations without invoking any caching behavior: :class:`FileCacheSourceLocal`,
221
- :class:`FileCacheSourceHTTP`, :class:`FileCacheSourceGS`, and :class:`FileSourceCacheS3`:
220
+ locations without invoking any caching behavior: `FileCacheSourceLocal`,
221
+ `FileCacheSourceHTTP`, `FileCacheSourceGS`, and `FileSourceCacheS3`:
222
222
 
223
223
  ```python
224
224
  from filecache import FileCacheSourceGS
@@ -149,7 +149,7 @@ accessible from a webserver at
149
149
  Finally, it could be accessible from Google Cloud Storage from the ``rms-node-holdings``
150
150
  bucket at
151
151
  ``gs://rms-node-holdings/pds3-holdings/volumes/COISS_2xxx/COISS_2001/voldesc.cat``. Before
152
- running the program, an environment variable could be set to one of these values::
152
+ running the program, an environment variable could be set to one of these values:
153
153
 
154
154
  ```sh
155
155
  $ export PDS3_HOLDINGS_SRC="~/pds3-holdings"
@@ -185,8 +185,8 @@ contents = voldesc_path.read_text()
185
185
  ```
186
186
 
187
187
  Finally, there are four classes that allow direct access to the four possible storage
188
- locations without invoking any caching behavior: :class:`FileCacheSourceLocal`,
189
- :class:`FileCacheSourceHTTP`, :class:`FileCacheSourceGS`, and :class:`FileSourceCacheS3`:
188
+ locations without invoking any caching behavior: `FileCacheSourceLocal`,
189
+ `FileCacheSourceHTTP`, `FileCacheSourceGS`, and `FileSourceCacheS3`:
190
190
 
191
191
  ```python
192
192
  from filecache import FileCacheSourceGS
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '2.0.0'
16
- __version_tuple__ = version_tuple = (2, 0, 0)
15
+ __version__ = version = '2.0.1'
16
+ __version_tuple__ = version_tuple = (2, 0, 1)
@@ -107,6 +107,9 @@ class FCPath:
107
107
 
108
108
  self._path = self._join(*paths)
109
109
 
110
+ if copy_from is None and len(paths) > 0 and isinstance(paths[0], FCPath):
111
+ copy_from = paths[0]
112
+
110
113
  if copy_from is not None:
111
114
  self._filecache = copy_from._filecache
112
115
  self._anonymous = copy_from._anonymous
@@ -473,6 +476,12 @@ class FCPath:
473
476
  else:
474
477
  return FCPath(other, self._path, copy_from=self)
475
478
 
479
+ @property
480
+ def name(self) -> str:
481
+ """The final component of the path."""
482
+
483
+ return FCPath._split(self._path)[1]
484
+
476
485
  @property
477
486
  def parent(self) -> FCPath:
478
487
  """The logical parent of the path.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rms-filecache
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: File cache for files retrieved from the cloud
5
5
  Maintainer-email: "Robert S. French" <rfrench@seti.org>
6
6
  License: Apache-2.0
@@ -181,7 +181,7 @@ accessible from a webserver at
181
181
  Finally, it could be accessible from Google Cloud Storage from the ``rms-node-holdings``
182
182
  bucket at
183
183
  ``gs://rms-node-holdings/pds3-holdings/volumes/COISS_2xxx/COISS_2001/voldesc.cat``. Before
184
- running the program, an environment variable could be set to one of these values::
184
+ running the program, an environment variable could be set to one of these values:
185
185
 
186
186
  ```sh
187
187
  $ export PDS3_HOLDINGS_SRC="~/pds3-holdings"
@@ -217,8 +217,8 @@ contents = voldesc_path.read_text()
217
217
  ```
218
218
 
219
219
  Finally, there are four classes that allow direct access to the four possible storage
220
- locations without invoking any caching behavior: :class:`FileCacheSourceLocal`,
221
- :class:`FileCacheSourceHTTP`, :class:`FileCacheSourceGS`, and :class:`FileSourceCacheS3`:
220
+ locations without invoking any caching behavior: `FileCacheSourceLocal`,
221
+ `FileCacheSourceHTTP`, `FileCacheSourceGS`, and `FileSourceCacheS3`:
222
222
 
223
223
  ```python
224
224
  from filecache import FileCacheSourceGS
@@ -24,28 +24,6 @@ HTTP_TEST_ROOT = 'https://storage.googleapis.com/rms-filecache-tests'
24
24
  GS_WRITABLE_TEST_BUCKET_ROOT = 'gs://rms-filecache-tests-writable'
25
25
 
26
26
 
27
- def _compare_to_expected_path(cache_path, filename):
28
- local_path = EXPECTED_DIR / filename
29
- mode = 'r'
30
- if filename.endswith('.bin'):
31
- mode = 'rb'
32
- with open(cache_path, mode) as fp:
33
- cache_data = fp.read()
34
- with open(local_path, mode) as fp:
35
- local_data = fp.read()
36
- assert cache_data == local_data
37
-
38
-
39
- def _compare_to_expected_data(cache_data, filename):
40
- local_path = EXPECTED_DIR / filename
41
- mode = 'r'
42
- if filename.endswith('.bin'):
43
- mode = 'rb'
44
- with open(local_path, mode) as fp:
45
- local_data = fp.read()
46
- assert cache_data == local_data
47
-
48
-
49
27
  def test__split_parts():
50
28
  # Local
51
29
  assert FCPath._split_parts('') == ('', '', '')
@@ -394,6 +372,24 @@ def test_joinpath():
394
372
  assert p2._anonymous
395
373
  assert p2._lock_timeout == 59
396
374
  assert p2._nthreads == 2
375
+ p3 = FCPath(p2)
376
+ assert str(p3) == 'a/c'
377
+ assert p3._filecache is fc
378
+ assert p3._anonymous
379
+ assert p3._lock_timeout == 59
380
+ assert p3._nthreads == 2
381
+ p4 = FCPath(p3, FCPath('e'))
382
+ assert str(p4) == 'a/c/e'
383
+ assert p4._filecache is fc
384
+ assert p4._anonymous
385
+ assert p4._lock_timeout == 59
386
+ assert p4._nthreads == 2
387
+ p5 = FCPath(str(p3), FCPath('e'))
388
+ assert str(p5) == 'a/c/e'
389
+ assert p5._filecache is not fc
390
+ assert not p5._anonymous
391
+ assert p5._lock_timeout is None
392
+ assert p5._nthreads is None
397
393
 
398
394
 
399
395
  def test_truediv():
@@ -434,6 +430,23 @@ def test_rtruediv():
434
430
  'http://bucket/a/b/c/d/e'
435
431
 
436
432
 
433
+ def test_name():
434
+ p = FCPath('')
435
+ assert p.name == ''
436
+ p = FCPath('c')
437
+ assert p.name == 'c'
438
+ p = FCPath('c.txt')
439
+ assert p.name == 'c.txt'
440
+ p = FCPath('/c.txt')
441
+ assert p.name == 'c.txt'
442
+ p = FCPath('a/b/c.txt')
443
+ assert p.name == 'c.txt'
444
+ p = FCPath('C:/a/b/c.txt')
445
+ assert p.name == 'c.txt'
446
+ p = FCPath('http://bucket/a/b/c')
447
+ assert p.name == 'c'
448
+
449
+
437
450
  def test_parent():
438
451
  p = FCPath('http://bucket/a/b/c', nthreads=3)
439
452
  p2 = p.parent
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes