sparclclient 1.2.6b12__py2.py3-none-any.whl → 1.2.6b13__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/__init__.py +1 -1
- sparcl/client.py +57 -52
- {sparclclient-1.2.6b12.dist-info → sparclclient-1.2.6b13.dist-info}/METADATA +1 -1
- {sparclclient-1.2.6b12.dist-info → sparclclient-1.2.6b13.dist-info}/RECORD +6 -6
- {sparclclient-1.2.6b12.dist-info → sparclclient-1.2.6b13.dist-info}/LICENSE +0 -0
- {sparclclient-1.2.6b12.dist-info → sparclclient-1.2.6b13.dist-info}/WHEEL +0 -0
sparcl/__init__.py
CHANGED
sparcl/client.py
CHANGED
|
@@ -197,7 +197,8 @@ class SparclClient: # was SparclApi()
|
|
|
197
197
|
self.verbose = verbose
|
|
198
198
|
self.show_curl = show_curl # Show CURL equivalent of client method
|
|
199
199
|
#!self.internal_names = internal_names
|
|
200
|
-
self.c_timeout = min(MAX_CONNECT_TIMEOUT,
|
|
200
|
+
self.c_timeout = min(MAX_CONNECT_TIMEOUT,
|
|
201
|
+
float(connect_timeout)) # seconds
|
|
201
202
|
self.r_timeout = min(MAX_READ_TIMEOUT, float(read_timeout)) # seconds
|
|
202
203
|
|
|
203
204
|
# require response within this num seconds
|
|
@@ -342,7 +343,8 @@ class SparclClient: # was SparclApi()
|
|
|
342
343
|
self.renew_token = None
|
|
343
344
|
self.token_exp = None
|
|
344
345
|
msg = (
|
|
345
|
-
'Could not login with given credentials.
|
|
346
|
+
'Could not login with given credentials. '
|
|
347
|
+
'Reverted to "Anonymous" user.'
|
|
346
348
|
)
|
|
347
349
|
return msg
|
|
348
350
|
|
|
@@ -410,10 +412,10 @@ class SparclClient: # was SparclApi()
|
|
|
410
412
|
parameter of client.retrieve().
|
|
411
413
|
|
|
412
414
|
Args:
|
|
413
|
-
dataset_list (:obj:`list`, optional): List of
|
|
414
|
-
which to get the default fields. Defaults
|
|
415
|
-
will return the intersection of default
|
|
416
|
-
data sets hosted on the SPARCL database.
|
|
415
|
+
dataset_list (:obj:`list` of :obj:`str`, optional): List of
|
|
416
|
+
data sets from which to get the default fields. Defaults
|
|
417
|
+
to None, which will return the intersection of default
|
|
418
|
+
fields in all data sets hosted on the SPARCL database.
|
|
417
419
|
|
|
418
420
|
Returns:
|
|
419
421
|
List of fields tagged as 'default' from DATASET_LIST.
|
|
@@ -441,10 +443,10 @@ class SparclClient: # was SparclApi()
|
|
|
441
443
|
of client.retrieve().
|
|
442
444
|
|
|
443
445
|
Args:
|
|
444
|
-
dataset_list (:obj:`list`, optional): List of data
|
|
445
|
-
which to get all fields. Defaults to None, which
|
|
446
|
-
will return the intersection of all fields in all
|
|
447
|
-
|
|
446
|
+
dataset_list (:obj:`list` of :obj:`str`, optional): List of data
|
|
447
|
+
sets from which to get all fields. Defaults to None, which
|
|
448
|
+
will return the intersection of all fields in all data sets
|
|
449
|
+
hosted on the SPARCL database.
|
|
448
450
|
|
|
449
451
|
Returns:
|
|
450
452
|
List of fields tagged as 'all' from DATASET_LIST.
|
|
@@ -477,7 +479,8 @@ class SparclClient: # was SparclApi()
|
|
|
477
479
|
return True
|
|
478
480
|
|
|
479
481
|
def _common_internal(self, *, science_fields=None, dataset_list=None):
|
|
480
|
-
self._validate_science_fields(science_fields,
|
|
482
|
+
self._validate_science_fields(science_fields,
|
|
483
|
+
dataset_list=dataset_list)
|
|
481
484
|
|
|
482
485
|
if dataset_list is None:
|
|
483
486
|
dataset_list = self.fields.all_drs
|
|
@@ -497,10 +500,10 @@ class SparclClient: # was SparclApi()
|
|
|
497
500
|
client.retreive().
|
|
498
501
|
|
|
499
502
|
Args:
|
|
500
|
-
dataset_list (:obj:`list`, optional): List of data
|
|
501
|
-
which to get available fields. Defaults to None,
|
|
502
|
-
will return the intersection of all available fields
|
|
503
|
-
all data sets hosted on the SPARCL database.
|
|
503
|
+
dataset_list (:obj:`list` of :obj:`str`, optional): List of data
|
|
504
|
+
sets from which to get available fields. Defaults to None,
|
|
505
|
+
which will return the intersection of all available fields
|
|
506
|
+
in all data sets hosted on the SPARCL database.
|
|
504
507
|
|
|
505
508
|
Returns:
|
|
506
509
|
Set of fields available from data sets in DATASET_LIST.
|
|
@@ -553,10 +556,10 @@ class SparclClient: # was SparclApi()
|
|
|
553
556
|
"""Find records in the SPARCL database.
|
|
554
557
|
|
|
555
558
|
Args:
|
|
556
|
-
outfields (:obj:`list`, optional): List of
|
|
557
|
-
Only CORE fields may be passed to
|
|
558
|
-
Defaults to None, which will return
|
|
559
|
-
and _dr fields.
|
|
559
|
+
outfields (:obj:`list` of :obj:`str`, optional): List of
|
|
560
|
+
fields to return. Only CORE fields may be passed to
|
|
561
|
+
this parameter. Defaults to None, which will return
|
|
562
|
+
only the sparcl_id and _dr fields.
|
|
560
563
|
|
|
561
564
|
constraints (:obj:`dict`, optional): Key-Value pairs of
|
|
562
565
|
constraints to place on the record selection. The Key
|
|
@@ -601,9 +604,10 @@ class SparclClient: # was SparclApi()
|
|
|
601
604
|
#! dataset_list=dataset_list) # DLS-401
|
|
602
605
|
dr = list(dataset_list)[0]
|
|
603
606
|
if len(constraints) > 0:
|
|
604
|
-
self._validate_science_fields(constraints.keys(),
|
|
607
|
+
self._validate_science_fields(constraints.keys(),
|
|
608
|
+
dataset_list=dataset_list)
|
|
605
609
|
constraints = {
|
|
606
|
-
self.fields._internal_name(k, dr): v for k, v in constraints.items()
|
|
610
|
+
self.fields._internal_name(k, dr): v for k, v in constraints.items() # noqa: E501
|
|
607
611
|
}
|
|
608
612
|
uparams = dict(
|
|
609
613
|
limit=limit,
|
|
@@ -637,16 +641,18 @@ class SparclClient: # was SparclApi()
|
|
|
637
641
|
print(f"Record key counts: {ut.count_values(found.records)}")
|
|
638
642
|
return found
|
|
639
643
|
|
|
640
|
-
def missing(
|
|
644
|
+
def missing(
|
|
645
|
+
self, uuid_list, *, dataset_list=None, countOnly=False, verbose=False
|
|
646
|
+
):
|
|
641
647
|
"""Return the subset of sparcl_ids in the given uuid_list that are
|
|
642
648
|
NOT stored in the SPARCL database.
|
|
643
649
|
|
|
644
650
|
Args:
|
|
645
|
-
uuid_list (:obj:`list`): List of sparcl_ids.
|
|
651
|
+
uuid_list (:obj:`list` of :obj:`str`): List of sparcl_ids.
|
|
646
652
|
|
|
647
|
-
dataset_list (:obj:`list`, optional): List of data
|
|
648
|
-
which to find missing sparcl_ids. Defaults to None,
|
|
649
|
-
all data sets hosted on the SPARCL database.
|
|
653
|
+
dataset_list (:obj:`list` of :obj:`str`, optional): List of data
|
|
654
|
+
sets from which to find missing sparcl_ids. Defaults to None,
|
|
655
|
+
meaning all data sets hosted on the SPARCL database.
|
|
650
656
|
|
|
651
657
|
countOnly (:obj:`bool`, optional): Set to True to return only
|
|
652
658
|
a count of the missing sparcl_ids from the uuid_list.
|
|
@@ -661,8 +667,8 @@ class SparclClient: # was SparclApi()
|
|
|
661
667
|
|
|
662
668
|
Example:
|
|
663
669
|
>>> client = SparclClient()
|
|
664
|
-
>>>
|
|
665
|
-
>>> client.missing(
|
|
670
|
+
>>> sparcl_ids = ['ddbb57ee-8e90-4a0d-823b-0f5d97028076',]
|
|
671
|
+
>>> client.missing(uuid_list=sparcl_ids)
|
|
666
672
|
['ddbb57ee-8e90-4a0d-823b-0f5d97028076']
|
|
667
673
|
"""
|
|
668
674
|
|
|
@@ -697,11 +703,11 @@ class SparclClient: # was SparclApi()
|
|
|
697
703
|
NOT stored in the SPARCL database.
|
|
698
704
|
|
|
699
705
|
Args:
|
|
700
|
-
specid_list (:obj:`list`): List of specids.
|
|
706
|
+
specid_list (:obj:`list` of :obj:`int`): List of specids.
|
|
701
707
|
|
|
702
|
-
dataset_list (:obj:`list`, optional): List of data
|
|
703
|
-
which to find missing specids. Defaults to None,
|
|
704
|
-
all data sets hosted on the SPARCL database.
|
|
708
|
+
dataset_list (:obj:`list` of :obj:`str`, optional): List of data
|
|
709
|
+
sets from which to find missing specids. Defaults to None,
|
|
710
|
+
meaning all data sets hosted on the SPARCL database.
|
|
705
711
|
|
|
706
712
|
countOnly (:obj:`bool`, optional): Set to True to return only
|
|
707
713
|
a count of the missing specids from the specid_list.
|
|
@@ -716,10 +722,9 @@ class SparclClient: # was SparclApi()
|
|
|
716
722
|
|
|
717
723
|
Example:
|
|
718
724
|
>>> client = SparclClient()
|
|
719
|
-
>>>
|
|
720
|
-
>>> specids
|
|
721
|
-
|
|
722
|
-
['bad_id']
|
|
725
|
+
>>> specids = [398913623742323421, 6181239242670493696]
|
|
726
|
+
>>> client.missing_specids(specid_list=specids)
|
|
727
|
+
[398913623742323421]
|
|
723
728
|
"""
|
|
724
729
|
if dataset_list is None:
|
|
725
730
|
dataset_list = self.fields.all_drs
|
|
@@ -785,15 +790,15 @@ class SparclClient: # was SparclApi()
|
|
|
785
790
|
sparcl_ids.
|
|
786
791
|
|
|
787
792
|
Args:
|
|
788
|
-
uuid_list (:obj:`list`): List of sparcl_ids.
|
|
793
|
+
uuid_list (:obj:`list` of :obj:`str`): List of sparcl_ids.
|
|
789
794
|
|
|
790
|
-
include (:obj:`list`, optional): List of field
|
|
791
|
-
in each record. Defaults to 'DEFAULT',
|
|
792
|
-
the fields tagged as 'default'.
|
|
795
|
+
include (:obj:`list` of :obj:`str`, optional): List of field
|
|
796
|
+
names to include in each record. Defaults to 'DEFAULT',
|
|
797
|
+
which will return the fields tagged as 'default'.
|
|
793
798
|
|
|
794
|
-
dataset_list (:obj:`list`, optional): List of data
|
|
795
|
-
which to retrieve spectra data. Defaults to None,
|
|
796
|
-
data sets hosted on the SPARCL database.
|
|
799
|
+
dataset_list (:obj:`list` of :obj:`str`, optional): List of data
|
|
800
|
+
sets from which to retrieve spectra data. Defaults to None,
|
|
801
|
+
meaning all data sets hosted on the SPARCL database.
|
|
797
802
|
|
|
798
803
|
limit (:obj:`int`, optional): Maximum number of records to
|
|
799
804
|
return. Defaults to 500. Maximum allowed is 24,000.
|
|
@@ -988,15 +993,15 @@ class SparclClient: # was SparclApi()
|
|
|
988
993
|
specids.
|
|
989
994
|
|
|
990
995
|
Args:
|
|
991
|
-
specid_list (:obj:`list`): List of specids.
|
|
996
|
+
specid_list (:obj:`list` of :obj:`int`): List of specids.
|
|
992
997
|
|
|
993
|
-
include (:obj:`list`, optional): List of field
|
|
994
|
-
in each record. Defaults to 'DEFAULT',
|
|
995
|
-
the fields tagged as 'default'.
|
|
998
|
+
include (:obj:`list` of :obj:`str`, optional): List of field
|
|
999
|
+
names to include in each record. Defaults to 'DEFAULT',
|
|
1000
|
+
which will return the fields tagged as 'default'.
|
|
996
1001
|
|
|
997
|
-
dataset_list (:obj:`list`, optional): List of data
|
|
998
|
-
which to retrieve spectra data. Defaults to None,
|
|
999
|
-
data sets hosted on the SPARCL database.
|
|
1002
|
+
dataset_list (:obj:`list` of :obj:`str`, optional): List of data
|
|
1003
|
+
sets from which to retrieve spectra data. Defaults to None,
|
|
1004
|
+
meaning all data sets hosted on the SPARCL database.
|
|
1000
1005
|
|
|
1001
1006
|
limit (:obj:`int`, optional): Maximum number of records to
|
|
1002
1007
|
return. Defaults to 500. Maximum allowed is 24,000.
|
|
@@ -1047,9 +1052,9 @@ class SparclClient: # was SparclApi()
|
|
|
1047
1052
|
usrcount = len(specid_list)
|
|
1048
1053
|
dbcount = found.count
|
|
1049
1054
|
warn = (
|
|
1050
|
-
f"UserWarning: Some
|
|
1055
|
+
f"UserWarning: Some specIDs were not found. "
|
|
1051
1056
|
f"{usrcount - dbcount} out of the {usrcount} requested "
|
|
1052
|
-
f"
|
|
1057
|
+
f"specids have no records available in the SPARCL database "
|
|
1053
1058
|
f"associated with DataSets {dr_list}."
|
|
1054
1059
|
)
|
|
1055
1060
|
print(warn)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
sparcl/Results.py,sha256=vnACjm8sp7MrsJ_5LTuKMuyRWqeBJxOxQM302cHmAlk,9159
|
|
2
|
-
sparcl/__init__.py,sha256=
|
|
3
|
-
sparcl/client.py,sha256=
|
|
2
|
+
sparcl/__init__.py,sha256=nzI5cO-Rr3chwX0dScwd-8pzeEigrpiyu-Vh_psbFic,1125
|
|
3
|
+
sparcl/client.py,sha256=a3uUD19yi_hHAkRtpk-A2gXQ_w1l1LktDFLCrUUAcV0,39876
|
|
4
4
|
sparcl/conf.py,sha256=GFNDelaiVIAkjNjvFlG7HAlPpU39nqZmTPohQGmOcgI,928
|
|
5
5
|
sparcl/exceptions.py,sha256=sznmOMGENHvxutSXlRVWqi87bR2Qiebka7LyR3mAII0,4244
|
|
6
6
|
sparcl/fields.py,sha256=NZUBqDidpbXfeX5F4b306F323xZY2CRIx8eVv-HWTVU,5127
|
|
@@ -15,7 +15,7 @@ sparcl/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
15
15
|
sparcl/benchmarks/benchmarks.py,sha256=OmlSdnAPLmcvGXsr-HzGyfAAcnoqlO0JQ4EIA7JGhZc,9424
|
|
16
16
|
sparcl/benchmarks/sparcl_benchmarking.ipynb,sha256=gwof2hqM9Qb49qzRX-mky7WNqXZCMSB7ry8bX8dImxc,17559
|
|
17
17
|
sparcl/notebooks/sparcl-examples.ipynb,sha256=gEwMKI1x7A1YsVeCsQn1QoMO0ZuIhMUAu3qedTiQ7hM,169268
|
|
18
|
-
sparclclient-1.2.
|
|
19
|
-
sparclclient-1.2.
|
|
20
|
-
sparclclient-1.2.
|
|
21
|
-
sparclclient-1.2.
|
|
18
|
+
sparclclient-1.2.6b13.dist-info/LICENSE,sha256=y10EluGMCzGs9X4oYCYyix3l6u-lawB_vlGR8qe442Q,1576
|
|
19
|
+
sparclclient-1.2.6b13.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
20
|
+
sparclclient-1.2.6b13.dist-info/METADATA,sha256=IGZU4IteE-oPqmbyRJMlWC4Gx9QzHKQK4MeeYDlG8hA,681
|
|
21
|
+
sparclclient-1.2.6b13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|