sparclclient 1.2.5b1__tar.gz → 1.2.6b1__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.
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/PKG-INFO +1 -1
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/__init__.py +2 -1
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/client.py +8 -3
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/tests/expected_pat.py +11 -8
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/tests/tests_api.py +13 -23
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/.github/workflows/django.yml +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/.gitignore +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/.pre-commit-config.yaml +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/.readthedocs.yaml +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/LICENSE +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/Makefile +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/README.md +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/make.bat +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/pyproject.toml +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/requirements-client.txt +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/requirements-internal.txt +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/requirements.txt +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/source/conf.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/source/index.rst +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/source/sparcl.rst +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/Results.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/benchmarks/Benchmark_SPARCL_example.ipynb +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/benchmarks/__init__.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/benchmarks/benchmarks.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/benchmarks/sparcl_benchmarking.ipynb +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/conf.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/exceptions.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/fields.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/gather_2d.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/notebooks/sparcl-examples.ipynb +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/resample_spectra.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/sparc.ini +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/type_conversion.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/unsupported.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/utils.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/tests/expected_dev1.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/tests/methods_tests.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/tests/utils.py +0 -0
- {sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/tox.ini +0 -0
|
@@ -159,6 +159,9 @@ class SparclClient: # was SparclApi()
|
|
|
159
159
|
wait for server to send a response. Generally time to
|
|
160
160
|
wait for first byte. Defaults to 5400.
|
|
161
161
|
|
|
162
|
+
announcement (:obj:`bool`, optional): SPARCL announcements.
|
|
163
|
+
Defaults to True.
|
|
164
|
+
|
|
162
165
|
Example:
|
|
163
166
|
>>> client = SparclClient()
|
|
164
167
|
|
|
@@ -179,6 +182,7 @@ class SparclClient: # was SparclApi()
|
|
|
179
182
|
show_curl=False,
|
|
180
183
|
connect_timeout=1.1, # seconds
|
|
181
184
|
read_timeout=90 * 60, # seconds
|
|
185
|
+
announcement=True,
|
|
182
186
|
):
|
|
183
187
|
"""Create client instance."""
|
|
184
188
|
session = requests.Session()
|
|
@@ -203,6 +207,7 @@ class SparclClient: # was SparclApi()
|
|
|
203
207
|
# (connect timeout, read timeout) in seconds
|
|
204
208
|
self.timeout = (self.c_timeout, self.r_timeout)
|
|
205
209
|
# @@@ read timeout should be a function of the POST payload size
|
|
210
|
+
self.announcement = f"{self.rooturl}/sparc/announcement/"
|
|
206
211
|
|
|
207
212
|
if verbose:
|
|
208
213
|
print(f"apiurl={self.apiurl}")
|
|
@@ -948,9 +953,9 @@ class SparclClient: # was SparclApi()
|
|
|
948
953
|
"spectra/sec)"
|
|
949
954
|
)
|
|
950
955
|
print(f'{meta["status"]}')
|
|
951
|
-
|
|
952
|
-
# Format/consolodate the server messages to one message with
|
|
953
|
-
# files
|
|
956
|
+
|
|
957
|
+
# Format/consolodate the server messages to one message with
|
|
958
|
+
# the count of missing files
|
|
954
959
|
if len(meta["status"].get("warnings", [])) > 0:
|
|
955
960
|
warnings = meta["status"].get("warnings")
|
|
956
961
|
if verbose:
|
|
@@ -98,30 +98,33 @@ authorized_1 = {
|
|
|
98
98
|
|
|
99
99
|
authorized_2 = {
|
|
100
100
|
"Loggedin_As": "test_user_2@noirlab.edu",
|
|
101
|
-
"Authorized_Datasets": {"BOSS-DR16", "DESI-EDR", "SDSS-DR16"},
|
|
101
|
+
"Authorized_Datasets": {"BOSS-DR16", "DESI-DR1", "DESI-EDR", "SDSS-DR16"},
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
authorized_3 = {
|
|
105
105
|
"Loggedin_As": "Anonymous",
|
|
106
|
-
"Authorized_Datasets": {"BOSS-DR16", "DESI-EDR", "SDSS-DR16"},
|
|
106
|
+
"Authorized_Datasets": {"BOSS-DR16", "DESI-DR1", "DESI-EDR", "SDSS-DR16"},
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
# Private and Public
|
|
110
110
|
pub_1 = ["BOSS-DR16"]
|
|
111
|
-
pub_all = ["BOSS-DR16", "DESI-EDR", "SDSS-DR16"]
|
|
112
|
-
priv = ["
|
|
111
|
+
pub_all = ["BOSS-DR16", "DESI-DR1", "DESI-EDR", "SDSS-DR16"]
|
|
112
|
+
priv = ["SDSS-DR17-test", "BOSS-DR17", "SDSS-DR17"]
|
|
113
113
|
all_all = pub_all + priv
|
|
114
114
|
all_all.sort()
|
|
115
115
|
privpub1 = [pub_all[0], priv[0]]
|
|
116
116
|
unauth = "test_user_2@noirlab.edu"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
msg = "Find Results: 1000 records"
|
|
118
|
+
# OLD as of July 9, 2025
|
|
119
|
+
#auth_find_1 = privpub1
|
|
120
|
+
#auth_find_2 = ['DESI-DR1', 'DESI-EDR']
|
|
121
|
+
auth_find_1 = auth_find_2 = auth_find_4 = auth_find_6 = msg
|
|
120
122
|
auth_find_3 = auth_retrieve_3 = (f"[DSDENIED] uname='{unauth}' is declined "
|
|
121
123
|
f"access to datasets={[priv[0]]}; "
|
|
122
124
|
f"drs_requested={privpub1} "
|
|
123
125
|
f"my_auth={pub_all}")
|
|
124
|
-
|
|
126
|
+
# OLD as of July 9, 2025
|
|
127
|
+
#auth_find_4 = auth_find_6 = pub_all
|
|
125
128
|
auth_find_5 = auth_retrieve_6 = ("[DSDENIED] uname='ANONYMOUS' is declined "
|
|
126
129
|
f"access to datasets={[priv[0]]}; "
|
|
127
130
|
f"drs_requested={privpub1} "
|
|
@@ -296,11 +296,9 @@ class SparclClientTest(unittest.TestCase):
|
|
|
296
296
|
|
|
297
297
|
def test_retrieve_0(self):
|
|
298
298
|
"""Get spectra using small list of SPECIDS."""
|
|
299
|
-
drs = ["SDSS-DR16", "BOSS-DR16", "DESI-EDR"]
|
|
300
299
|
res = self.client.retrieve_by_specid(
|
|
301
300
|
self.specid_list0,
|
|
302
|
-
include=["sparcl_id", "specid", "flux"]
|
|
303
|
-
dataset_list=drs,
|
|
301
|
+
include=["sparcl_id", "specid", "flux"]
|
|
304
302
|
)
|
|
305
303
|
actual = sorted(res.records[0].keys())
|
|
306
304
|
if showact:
|
|
@@ -312,10 +310,9 @@ class SparclClientTest(unittest.TestCase):
|
|
|
312
310
|
"""Get spectra using small list of uuids."""
|
|
313
311
|
name = "retrieve_0b"
|
|
314
312
|
uuids = self.uuid_list0
|
|
315
|
-
drs = ["SDSS-DR16", "BOSS-DR16", "DESI-EDR"]
|
|
316
313
|
|
|
317
314
|
tic()
|
|
318
|
-
res = self.client.retrieve(uuids
|
|
315
|
+
res = self.client.retrieve(uuids)
|
|
319
316
|
self.timing[name] = toc()
|
|
320
317
|
actual = sorted(res.records[0].keys())
|
|
321
318
|
|
|
@@ -356,11 +353,9 @@ class SparclClientTest(unittest.TestCase):
|
|
|
356
353
|
|
|
357
354
|
def test_retrieve_5(self):
|
|
358
355
|
"""Limit number of records returned by retrieve_by_specid."""
|
|
359
|
-
drs = ["SDSS-DR16", "BOSS-DR16", "DESI-EDR"]
|
|
360
356
|
res = self.client.retrieve_by_specid(
|
|
361
357
|
self.specid_list5,
|
|
362
358
|
include=["specid", "ivar"],
|
|
363
|
-
dataset_list=drs,
|
|
364
359
|
limit=2,
|
|
365
360
|
)
|
|
366
361
|
actual = len(res.records)
|
|
@@ -485,8 +480,7 @@ class SparclClientTest(unittest.TestCase):
|
|
|
485
480
|
ids = self.uuid_list2
|
|
486
481
|
|
|
487
482
|
tic()
|
|
488
|
-
|
|
489
|
-
res = self.client.retrieve(ids, dataset_list=drs)
|
|
483
|
+
res = self.client.retrieve(ids)
|
|
490
484
|
self.timing[name] = toc()
|
|
491
485
|
res_reorder = res.reorder(ids)
|
|
492
486
|
actual = [f["sparcl_id"] for f in res_reorder.records]
|
|
@@ -500,8 +494,7 @@ class SparclClientTest(unittest.TestCase):
|
|
|
500
494
|
specids = self.specid_list2
|
|
501
495
|
|
|
502
496
|
tic()
|
|
503
|
-
|
|
504
|
-
res = self.client.retrieve_by_specid(specids, dataset_list=drs)
|
|
497
|
+
res = self.client.retrieve_by_specid(specids)
|
|
505
498
|
self.timing[name] = toc()
|
|
506
499
|
res_reorder = res.reorder(specids)
|
|
507
500
|
actual = [f["specid"] for f in res_reorder.records]
|
|
@@ -516,9 +509,8 @@ class SparclClientTest(unittest.TestCase):
|
|
|
516
509
|
ids = self.uuid_list3
|
|
517
510
|
|
|
518
511
|
tic()
|
|
519
|
-
drs = ["SDSS-DR16", "BOSS-DR16", "DESI-EDR"]
|
|
520
512
|
with self.assertWarns(Warning):
|
|
521
|
-
res = self.client.retrieve(ids
|
|
513
|
+
res = self.client.retrieve(ids)
|
|
522
514
|
self.timing[name] = toc()
|
|
523
515
|
with self.assertWarns(Warning):
|
|
524
516
|
res_reorder = res.reorder(ids)
|
|
@@ -534,8 +526,7 @@ class SparclClientTest(unittest.TestCase):
|
|
|
534
526
|
specids = self.specid_list3
|
|
535
527
|
|
|
536
528
|
tic()
|
|
537
|
-
|
|
538
|
-
res = self.client.retrieve_by_specid(specids, dataset_list=drs)
|
|
529
|
+
res = self.client.retrieve_by_specid(specids)
|
|
539
530
|
self.timing[name] = toc()
|
|
540
531
|
with self.assertWarns(Warning):
|
|
541
532
|
res_reorder = res.reorder(specids)
|
|
@@ -554,8 +545,7 @@ class SparclClientTest(unittest.TestCase):
|
|
|
554
545
|
og_ids = []
|
|
555
546
|
|
|
556
547
|
tic()
|
|
557
|
-
|
|
558
|
-
res = self.client.retrieve(ids, dataset_list=drs)
|
|
548
|
+
res = self.client.retrieve(ids)
|
|
559
549
|
self.timing[name] = toc()
|
|
560
550
|
with self.assertRaises(ex.NoIDs):
|
|
561
551
|
res.reorder(og_ids)
|
|
@@ -568,8 +558,7 @@ class SparclClientTest(unittest.TestCase):
|
|
|
568
558
|
og_specids = []
|
|
569
559
|
|
|
570
560
|
tic()
|
|
571
|
-
|
|
572
|
-
res = self.client.retrieve_by_specid(specids, dataset_list=drs)
|
|
561
|
+
res = self.client.retrieve_by_specid(specids)
|
|
573
562
|
self.timing[name] = toc()
|
|
574
563
|
with self.assertRaises(ex.NoIDs):
|
|
575
564
|
res.reorder(og_specids)
|
|
@@ -756,8 +745,8 @@ class AuthTest(unittest.TestCase):
|
|
|
756
745
|
cls.unauth_user = "test_user_2@noirlab.edu"
|
|
757
746
|
|
|
758
747
|
# Dataset lists
|
|
759
|
-
cls.Pub = ["BOSS-DR16", "DESI-EDR", "SDSS-DR16"]
|
|
760
|
-
cls.Priv = ["
|
|
748
|
+
cls.Pub = ["BOSS-DR16", "DESI-DR1", "DESI-EDR", "SDSS-DR16"]
|
|
749
|
+
cls.Priv = ["SDSS-DR17-test", "BOSS-DR17", "SDSS-DR17"]
|
|
761
750
|
cls.PrivPub = cls.Priv + cls.Pub
|
|
762
751
|
cls.PrivPub.sort()
|
|
763
752
|
cls.PrivPub1 = [cls.Priv[0], cls.Pub[0]]
|
|
@@ -921,7 +910,7 @@ class AuthTest(unittest.TestCase):
|
|
|
921
910
|
print(f"authorized_3: actual={actual}")
|
|
922
911
|
self.assertEqual(actual, exp.authorized_3, msg="Actual to Expected")
|
|
923
912
|
|
|
924
|
-
def auth_find(self, user, drs, expvar, cons={}, limit=
|
|
913
|
+
def auth_find(self, user, drs, expvar, cons={}, limit=1000):
|
|
925
914
|
expected = eval(expvar) # e.g. 'ep.retrieve_N'
|
|
926
915
|
#!print(f'{expvar}: {user=} {drs=} ')
|
|
927
916
|
self.silent_login(user, usrpw)
|
|
@@ -943,7 +932,8 @@ class AuthTest(unittest.TestCase):
|
|
|
943
932
|
#!if showact:
|
|
944
933
|
#! print(f"{expvar}: {found.records=}")
|
|
945
934
|
|
|
946
|
-
actual = sorted(set([r._dr for r in found.records]))
|
|
935
|
+
#actual = sorted(set([r._dr for r in found.records]))
|
|
936
|
+
actual = str(found)
|
|
947
937
|
except Exception as err:
|
|
948
938
|
actual = str(err)
|
|
949
939
|
finally:
|
|
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
|
{sparclclient-1.2.5b1 → sparclclient-1.2.6b1}/sparcl/benchmarks/Benchmark_SPARCL_example.ipynb
RENAMED
|
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
|