sparclclient 1.2.6b12__tar.gz → 1.2.6b13__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 (39) hide show
  1. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/PKG-INFO +1 -1
  2. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/__init__.py +1 -1
  3. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/client.py +57 -52
  4. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/tests/tests_api.py +1 -1
  5. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/.github/workflows/django.yml +0 -0
  6. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/.gitignore +0 -0
  7. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/.pre-commit-config.yaml +0 -0
  8. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/.readthedocs.yaml +0 -0
  9. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/LICENSE +0 -0
  10. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/Makefile +0 -0
  11. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/README.md +0 -0
  12. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/make.bat +0 -0
  13. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/pyproject.toml +0 -0
  14. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/requirements-client.txt +0 -0
  15. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/requirements-internal.txt +0 -0
  16. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/requirements.txt +0 -0
  17. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/source/conf.py +0 -0
  18. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/source/index.rst +0 -0
  19. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/source/sparcl.rst +0 -0
  20. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/Results.py +0 -0
  21. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/benchmarks/Benchmark_SPARCL_example.ipynb +0 -0
  22. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/benchmarks/__init__.py +0 -0
  23. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/benchmarks/benchmarks.py +0 -0
  24. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/benchmarks/sparcl_benchmarking.ipynb +0 -0
  25. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/conf.py +0 -0
  26. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/exceptions.py +0 -0
  27. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/fields.py +0 -0
  28. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/gather_2d.py +0 -0
  29. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/notebooks/sparcl-examples.ipynb +0 -0
  30. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/resample_spectra.py +0 -0
  31. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/sparc.ini +0 -0
  32. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/type_conversion.py +0 -0
  33. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/unsupported.py +0 -0
  34. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/sparcl/utils.py +0 -0
  35. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/tests/expected_dev1.py +0 -0
  36. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/tests/expected_pat.py +0 -0
  37. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/tests/methods_tests.py +0 -0
  38. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/tests/utils.py +0 -0
  39. {sparclclient-1.2.6b12 → sparclclient-1.2.6b13}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sparclclient
3
- Version: 1.2.6b12
3
+ Version: 1.2.6b13
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
@@ -35,4 +35,4 @@ __all__ = ["client", "align_records"]
35
35
  #__version__ = "1.2.3"
36
36
  #__version__ = "1.2.4"
37
37
  #__version__ = "1.2.5"
38
- __version__ = "1.2.6b12"
38
+ __version__ = "1.2.6b13"
@@ -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, float(connect_timeout)) # seconds
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. Reverted to "Anonymous" user.'
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 data sets from
414
- which to get the default fields. Defaults to None, which
415
- will return the intersection of default fields in all
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 sets from
445
- which to get all fields. Defaults to None, which
446
- will return the intersection of all fields in all
447
- data sets hosted on the SPARCL database.
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, dataset_list=dataset_list)
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 sets from
501
- which to get available fields. Defaults to None, which
502
- will return the intersection of all available fields in
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 fields to return.
557
- Only CORE fields may be passed to this parameter.
558
- Defaults to None, which will return only the sparcl_id
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(), dataset_list=dataset_list)
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(self, uuid_list, *, dataset_list=None, countOnly=False, verbose=False):
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 sets from
648
- which to find missing sparcl_ids. Defaults to None, meaning
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
- >>> ids = ['ddbb57ee-8e90-4a0d-823b-0f5d97028076',]
665
- >>> client.missing(ids)
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 sets from
703
- which to find missing specids. Defaults to None, meaning
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
- >>> found = client.find(outfields=['specid'], limit=2)
720
- >>> specids = [f.specid for f in found.records]
721
- >>> client.missing_specids(specids + ['bad_id'])
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 names to include
791
- in each record. Defaults to 'DEFAULT', which will return
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 sets from
795
- which to retrieve spectra data. Defaults to None, meaning all
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 names to include
994
- in each record. Defaults to 'DEFAULT', which will return
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 sets from
998
- which to retrieve spectra data. Defaults to None, meaning all
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 SPECIDs were not found. "
1055
+ f"UserWarning: Some specIDs were not found. "
1051
1056
  f"{usrcount - dbcount} out of the {usrcount} requested "
1052
- f"uuids have no records available in the SPARCL database "
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)
@@ -287,7 +287,7 @@ class SparclClientTest(unittest.TestCase):
287
287
 
288
288
  def test_missing_specids_1(self):
289
289
  """Specids (not UUID) missing"""
290
- badid = "NOT_SPEC_ID"
290
+ badid = 0
291
291
  specids = set([badid] + self.specid_list0[:1])
292
292
  missing = set(self.client.missing_specids(specids, verbose=False))
293
293
  if showact:
File without changes
File without changes