geoseeq 0.5.6a5__tar.gz → 0.5.6a7__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/PKG-INFO +1 -1
  2. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/main.py +1 -1
  3. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/remote_object.py +9 -0
  4. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/result/file_download.py +29 -10
  5. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq.egg-info/PKG-INFO +1 -1
  6. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/pyproject.toml +1 -1
  7. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/setup.py +1 -1
  8. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/LICENSE +0 -0
  9. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/README.md +0 -0
  10. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/__init__.py +0 -0
  11. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/app.py +0 -0
  12. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/blob_constructors.py +0 -0
  13. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/bulk_creators.py +0 -0
  14. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/__init__.py +0 -0
  15. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/constants.py +0 -0
  16. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/copy.py +0 -0
  17. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/detail.py +0 -0
  18. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/download.py +0 -0
  19. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/fastq_utils.py +0 -0
  20. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/get_eula.py +0 -0
  21. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/manage.py +0 -0
  22. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/progress_bar.py +0 -0
  23. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/run.py +0 -0
  24. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/search.py +0 -0
  25. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/shared_params/__init__.py +0 -0
  26. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/shared_params/common_state.py +0 -0
  27. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/shared_params/config.py +0 -0
  28. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/shared_params/id_handlers.py +0 -0
  29. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/shared_params/obj_getters.py +0 -0
  30. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/shared_params/opts_and_args.py +0 -0
  31. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/upload/__init__.py +0 -0
  32. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/upload/upload.py +0 -0
  33. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/upload/upload_advanced.py +0 -0
  34. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/upload/upload_reads.py +0 -0
  35. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/user.py +0 -0
  36. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/utils.py +0 -0
  37. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/cli/view.py +0 -0
  38. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/constants.py +0 -0
  39. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/contrib/__init__.py +0 -0
  40. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/contrib/ncbi/__init__.py +0 -0
  41. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/contrib/ncbi/api.py +0 -0
  42. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/contrib/ncbi/bioproject.py +0 -0
  43. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/contrib/ncbi/cli.py +0 -0
  44. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/contrib/ncbi/setup_logging.py +0 -0
  45. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/file_system_cache.py +0 -0
  46. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/id_constructors/__init__.py +0 -0
  47. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/id_constructors/from_blobs.py +0 -0
  48. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/id_constructors/from_ids.py +0 -0
  49. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/id_constructors/from_names.py +0 -0
  50. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/id_constructors/from_uuids.py +0 -0
  51. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/id_constructors/resolvers.py +0 -0
  52. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/id_constructors/utils.py +0 -0
  53. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/knex.py +0 -0
  54. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/organization.py +0 -0
  55. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/pipeline.py +0 -0
  56. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/__init__.py +0 -0
  57. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/constants.py +0 -0
  58. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/highcharts.py +0 -0
  59. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/map/__init__.py +0 -0
  60. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/map/base_layer.py +0 -0
  61. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/map/map.py +0 -0
  62. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/map/overlay.py +0 -0
  63. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/plotting/selectable.py +0 -0
  64. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/project.py +0 -0
  65. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/result/__init__.py +0 -0
  66. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/result/bioinfo.py +0 -0
  67. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/result/file_upload.py +0 -0
  68. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/result/result_file.py +0 -0
  69. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/result/result_folder.py +0 -0
  70. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/result/utils.py +0 -0
  71. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/sample.py +0 -0
  72. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/search.py +0 -0
  73. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/upload_download_manager.py +0 -0
  74. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/user.py +0 -0
  75. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/utils.py +0 -0
  76. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/__init__.py +0 -0
  77. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/checksum.py +0 -0
  78. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/cli.py +0 -0
  79. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/clone.py +0 -0
  80. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/constants.py +0 -0
  81. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/vc_cache.py +0 -0
  82. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/vc_dir.py +0 -0
  83. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/vc_sample.py +0 -0
  84. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/vc/vc_stub.py +0 -0
  85. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq/work_orders.py +0 -0
  86. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq.egg-info/SOURCES.txt +0 -0
  87. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq.egg-info/dependency_links.txt +0 -0
  88. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq.egg-info/entry_points.txt +0 -0
  89. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/geoseeq.egg-info/top_level.txt +0 -0
  90. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/setup.cfg +0 -0
  91. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/tests/__init__.py +0 -0
  92. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/tests/test_api_client.py +0 -0
  93. {geoseeq-0.5.6a5 → geoseeq-0.5.6a7}/tests/test_plotting.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geoseeq
3
- Version: 0.5.6a5
3
+ Version: 0.5.6a7
4
4
  Summary: GeoSeeq command line tools and python API
5
5
  Author: David C. Danko
6
6
  Author-email: "David C. Danko" <dcdanko@biotia.io>
@@ -53,7 +53,7 @@ def version():
53
53
  Use of this tool implies acceptance of the GeoSeeq End User License Agreement.
54
54
  Run `geoseeq eula show` to view the EULA.
55
55
  """
56
- click.echo('0.5.6a5') # remember to update setup
56
+ click.echo('0.5.6a7') # remember to update setup
57
57
 
58
58
 
59
59
  @main.group('advanced')
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from pandas import to_datetime
2
3
 
3
4
  from requests.exceptions import HTTPError
4
5
 
@@ -57,6 +58,14 @@ class RemoteObject:
57
58
 
58
59
  def cache_blob(self, blob):
59
60
  return self.cache.cache_blob(self, blob)
61
+
62
+ @property
63
+ def updated_at_timestamp(self):
64
+ """Return the updated_at field as a unix timestamp (in seconds).
65
+
66
+ timestamp from servercomes as a string: '2024-03-13T09:06:56.582551Z'
67
+ """
68
+ return to_datetime(self.updated_at).timestamp()
60
69
 
61
70
  def load_blob(self, blob, allow_overwrite=False):
62
71
  logger.debug(f"Loading blob. {blob}")
@@ -2,7 +2,7 @@
2
2
  import urllib.request
3
3
  import logging
4
4
  import requests
5
- from os.path import basename, getsize, join, isfile
5
+ from os.path import basename, getsize, join, isfile, getmtime
6
6
  from pathlib import Path
7
7
  from tempfile import NamedTemporaryFile
8
8
 
@@ -82,12 +82,30 @@ class ResultFileDownload:
82
82
  return url
83
83
  else:
84
84
  return self.stored_data[key]
85
+
86
+
87
+ def _download_flag_path(self, filename, flag_suffix='.gs_downloaded'):
88
+ return filename + flag_suffix
89
+
90
+ def download_needs_update(self, filename, flag_suffix='.gs_downloaded', slack=5):
91
+ """Return True if the file needs to be downloaded, False otherwise.
92
+
93
+ If either the file or the flag file does not exist, return True.
94
+ If the flag file is older than `updated_at` in the result, return True.
95
+ Otherwise, return False.
96
+ """
97
+ if isfile(filename) and isfile(self._download_flag_path(filename, flag_suffix)):
98
+ if self.updated_at_timestamp - getmtime(self._download_flag_path(filename, flag_suffix)) > slack:
99
+ return True
100
+ return False
101
+ return True
85
102
 
86
103
  def download(self, filename=None, flag_suffix='.gs_downloaded', cache=True, head=None, progress_tracker=None):
87
104
  """Return a local filepath to the file in this result. Download the file if necessary.
88
105
 
89
106
  When the file is downloaded, it is cached in the result object. Subsequent calls to download
90
- on this object will return the cached file unless cache=False is specified.
107
+ on this object will return the cached file unless cache=False is specified or the file is updated
108
+ on the server.
91
109
 
92
110
  A flag file is created when the file download is complete. Subsequent calls to download
93
111
  will return the cached file if the flag file exists unless cache=False is specified.
@@ -101,13 +119,14 @@ class ResultFileDownload:
101
119
  filename = self._cached_filename
102
120
 
103
121
  blob_type = self.stored_data.get("__type__", "").lower()
104
- if cache and self._cached_filename:
105
- return self._cached_filename
106
- flag_filename = filename + flag_suffix
107
- if cache and flag_suffix:
108
- # check if file and flag file exist, if so, return filename
109
- if isfile(filename) and isfile(flag_filename):
110
- return filename
122
+ needs_update = self.download_needs_update(filename, flag_suffix)
123
+ if not needs_update:
124
+ if cache and self._cached_filename:
125
+ return self._cached_filename
126
+ if cache and flag_suffix:
127
+ # check if file and flag file exist, if so, return filename
128
+ if isfile(filename) and isfile(self._download_flag_path(filename, flag_suffix)):
129
+ return filename
111
130
 
112
131
  url = self.get_download_url()
113
132
  filepath = download_url(
@@ -116,7 +135,7 @@ class ResultFileDownload:
116
135
  )
117
136
  if cache and flag_suffix:
118
137
  # create flag file
119
- open(flag_filename, 'a').close()
138
+ open(self._download_flag_path(filename, flag_suffix), 'a').close()
120
139
  if cache:
121
140
  self._cached_filename = filepath
122
141
  return filepath
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geoseeq
3
- Version: 0.5.6a5
3
+ Version: 0.5.6a7
4
4
  Summary: GeoSeeq command line tools and python API
5
5
  Author: David C. Danko
6
6
  Author-email: "David C. Danko" <dcdanko@biotia.io>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "geoseeq"
7
- version = "0.5.6a5"
7
+ version = "0.5.6a7"
8
8
  authors = [
9
9
  { name="David C. Danko", email="dcdanko@biotia.io" },
10
10
  ]
@@ -5,7 +5,7 @@ import setuptools
5
5
 
6
6
  setuptools.setup(
7
7
  name='geoseeq',
8
- version='0.5.6a5', # remember to update version string in CLI as well
8
+ version='0.5.6a7', # remember to update version string in CLI as well
9
9
  author="David C. Danko",
10
10
  author_email='dcdanko@biotia.io',
11
11
  description=open('README.md').read(),
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes