sparclclient 1.2.3b8__py2.py3-none-any.whl → 1.2.4__py2.py3-none-any.whl
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.
- sparcl/Results.py +21 -3
- sparcl/__init__.py +2 -1
- sparcl/client.py +16 -2
- {sparclclient-1.2.3b8.dist-info → sparclclient-1.2.4.dist-info}/METADATA +2 -2
- {sparclclient-1.2.3b8.dist-info → sparclclient-1.2.4.dist-info}/RECORD +7 -7
- {sparclclient-1.2.3b8.dist-info → sparclclient-1.2.4.dist-info}/WHEEL +1 -1
- {sparclclient-1.2.3b8.dist-info → sparclclient-1.2.4.dist-info}/LICENSE +0 -0
sparcl/Results.py
CHANGED
|
@@ -10,7 +10,7 @@ from sparcl.utils import _AttrDict
|
|
|
10
10
|
# from sparcl.gather_2d import bin_spectra_records
|
|
11
11
|
import sparcl.exceptions as ex
|
|
12
12
|
from warnings import warn
|
|
13
|
-
|
|
13
|
+
import re
|
|
14
14
|
|
|
15
15
|
class Results(UserList):
|
|
16
16
|
def __init__(self, dict_list, client=None):
|
|
@@ -18,7 +18,7 @@ class Results(UserList):
|
|
|
18
18
|
self.hdr = dict_list[0]
|
|
19
19
|
self.recs = dict_list[1:]
|
|
20
20
|
self.client = client
|
|
21
|
-
self.fields = client.fields
|
|
21
|
+
self.fields = client.fields if client else []
|
|
22
22
|
self.to_science_fields()
|
|
23
23
|
|
|
24
24
|
# HACK 12/14/2023 -sp- to fix UUID problem presumably
|
|
@@ -41,7 +41,25 @@ class Results(UserList):
|
|
|
41
41
|
def info(self):
|
|
42
42
|
"""Info about this collection.
|
|
43
43
|
e.g. Warnings, parameters used to get the collection, etc."""
|
|
44
|
-
|
|
44
|
+
# Consolodate "Successfully found...." messages
|
|
45
|
+
cln_hdr = self.hdr.copy()
|
|
46
|
+
count = 0
|
|
47
|
+
success_msg = ""
|
|
48
|
+
info = []
|
|
49
|
+
for msg in cln_hdr['status']['info']:
|
|
50
|
+
if "Successfully" in msg:
|
|
51
|
+
matches = re.search('Successfully found ([0-9]*)', msg)
|
|
52
|
+
count += int(matches.groups()[0]) if len(matches.groups()) > 0 else 0 # noqa: E501
|
|
53
|
+
success_msg = msg
|
|
54
|
+
else:
|
|
55
|
+
info.append(msg)
|
|
56
|
+
|
|
57
|
+
if count > 0:
|
|
58
|
+
msg = re.sub(r'[0-9]+', str(count), success_msg, count=1)
|
|
59
|
+
info.append(msg)
|
|
60
|
+
|
|
61
|
+
cln_hdr['status']['info'] = info
|
|
62
|
+
return cln_hdr
|
|
45
63
|
|
|
46
64
|
@property
|
|
47
65
|
def count(self):
|
sparcl/__init__.py
CHANGED
sparcl/client.py
CHANGED
|
@@ -25,6 +25,7 @@ from warnings import warn
|
|
|
25
25
|
import pickle
|
|
26
26
|
import getpass
|
|
27
27
|
import datetime
|
|
28
|
+
import re
|
|
28
29
|
|
|
29
30
|
#!from pathlib import Path
|
|
30
31
|
import tempfile
|
|
@@ -223,7 +224,8 @@ class SparclClient: # was SparclApi()
|
|
|
223
224
|
msg = (
|
|
224
225
|
f"The SPARCL Client you are running expects an older "
|
|
225
226
|
f"version of the API services. "
|
|
226
|
-
f'Please upgrade to the latest "sparclclient"
|
|
227
|
+
f'Please upgrade to the latest "sparclclient" using '
|
|
228
|
+
f'"pip install --upgrade sparclclient". '
|
|
227
229
|
f"The Client you are using expected version "
|
|
228
230
|
f"{SparclClient.KNOWN_GOOD_API_VERSION} but got "
|
|
229
231
|
f"{self.apiversion} from the SPARCL Server "
|
|
@@ -944,7 +946,19 @@ class SparclClient: # was SparclApi()
|
|
|
944
946
|
print(f'{meta["status"]}')
|
|
945
947
|
|
|
946
948
|
if len(meta["status"].get("warnings", [])) > 0:
|
|
947
|
-
|
|
949
|
+
warnings = meta["status"].get("warnings")
|
|
950
|
+
if verbose:
|
|
951
|
+
print(f"There are {len(warnings)} warnings")
|
|
952
|
+
missingcount = 0
|
|
953
|
+
missing_message = re.sub(r' [0-9]+ ', ' %s ', warnings[0])
|
|
954
|
+
for i in warnings:
|
|
955
|
+
matches = re.match(r'.* ([0-9]+) out of the ([0-9]+).*', i)
|
|
956
|
+
if matches:
|
|
957
|
+
missingcount += int(matches.groups()[0])
|
|
958
|
+
|
|
959
|
+
# using old style substitution to avoid issue with the {} in the message # noqa: E501
|
|
960
|
+
warning_message = missing_message % (missingcount, limit, missingcount) # noqa: E501
|
|
961
|
+
warn(warning_message, stacklevel=2)
|
|
948
962
|
|
|
949
963
|
return Retrieved(results, client=self)
|
|
950
964
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: sparclclient
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4
|
|
4
4
|
Summary: A client for getting spectra and meta-data from NOIRLab.
|
|
5
5
|
Author-email: "S. Pothier" <datalab-spectro@noirlab.edu>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
sparcl/Results.py,sha256=
|
|
2
|
-
sparcl/__init__.py,sha256=
|
|
3
|
-
sparcl/client.py,sha256=
|
|
1
|
+
sparcl/Results.py,sha256=vnACjm8sp7MrsJ_5LTuKMuyRWqeBJxOxQM302cHmAlk,9159
|
|
2
|
+
sparcl/__init__.py,sha256=MFqKOmLgq-9ck83oZ7aOGe75k2-tk9LnxW6b9kXWA1s,1076
|
|
3
|
+
sparcl/client.py,sha256=r-N-vkuGASrBxsnerG-9HZkk5mHz8cFa8OWgvmxvO4E,38448
|
|
4
4
|
sparcl/conf.py,sha256=GFNDelaiVIAkjNjvFlG7HAlPpU39nqZmTPohQGmOcgI,928
|
|
5
5
|
sparcl/exceptions.py,sha256=ODtoGCi1HI4xwXBbbLT-gQqd9Jjb_8TmVj-Jz_b1tg4,4040
|
|
6
6
|
sparcl/fields.py,sha256=NZUBqDidpbXfeX5F4b306F323xZY2CRIx8eVv-HWTVU,5127
|
|
@@ -13,7 +13,7 @@ sparcl/utils.py,sha256=pDAk9roe7ezfVohnKcLMxFjjXHkp7EQLbgVNe5sSTrk,6259
|
|
|
13
13
|
sparcl/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
sparcl/benchmarks/benchmarks.py,sha256=OmlSdnAPLmcvGXsr-HzGyfAAcnoqlO0JQ4EIA7JGhZc,9424
|
|
15
15
|
sparcl/notebooks/sparcl-examples.ipynb,sha256=gEwMKI1x7A1YsVeCsQn1QoMO0ZuIhMUAu3qedTiQ7hM,169268
|
|
16
|
-
sparclclient-1.2.
|
|
17
|
-
sparclclient-1.2.
|
|
18
|
-
sparclclient-1.2.
|
|
19
|
-
sparclclient-1.2.
|
|
16
|
+
sparclclient-1.2.4.dist-info/LICENSE,sha256=y10EluGMCzGs9X4oYCYyix3l6u-lawB_vlGR8qe442Q,1576
|
|
17
|
+
sparclclient-1.2.4.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
18
|
+
sparclclient-1.2.4.dist-info/METADATA,sha256=errlfOkayqm8OFJrYAylrmFHCi1tmwGOuXv-4R8XLow,678
|
|
19
|
+
sparclclient-1.2.4.dist-info/RECORD,,
|
|
File without changes
|