lukhed-basic-utils 1.4.4__tar.gz → 1.4.6__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 (23) hide show
  1. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/PKG-INFO +1 -1
  2. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/githubCommon.py +38 -14
  3. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils.egg-info/PKG-INFO +1 -1
  4. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/setup.py +1 -1
  5. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/LICENSE +0 -0
  6. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/README.md +0 -0
  7. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/__init__.py +0 -0
  8. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/chartJsCommon.py +0 -0
  9. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/classCommon.py +0 -0
  10. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/fileCommon.py +0 -0
  11. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/listWorkCommon.py +0 -0
  12. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/mathCommon.py +0 -0
  13. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/osCommon.py +0 -0
  14. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/requestsCommon.py +0 -0
  15. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/stringCommon.py +0 -0
  16. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils/timeCommon.py +0 -0
  17. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils.egg-info/SOURCES.txt +0 -0
  18. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils.egg-info/dependency_links.txt +0 -0
  19. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils.egg-info/requires.txt +0 -0
  20. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/lukhed_basic_utils.egg-info/top_level.txt +0 -0
  21. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/setup.cfg +0 -0
  22. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/tests/test_osCommon.py +0 -0
  23. {lukhed_basic_utils-1.4.4 → lukhed_basic_utils-1.4.6}/tests/test_timeCommon.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lukhed_basic_utils
3
- Version: 1.4.4
3
+ Version: 1.4.6
4
4
  Summary: A collection of basic utility functions
5
5
  Home-page: https://github.com/lukhed/lukhed_basic_utils
6
6
  Author: lukhed
@@ -345,7 +345,16 @@ class GithubHelper:
345
345
  return None
346
346
 
347
347
  if decode:
348
- decoded = contents.decoded_content
348
+ if contents.encoding == "base64":
349
+ decoded = contents.decoded_content
350
+ elif contents.download_url:
351
+ # For large files, use the download URL to fetch the file content
352
+ response = rC.make_request(contents.download_url)
353
+ response.raise_for_status() # Ensure we notice bad responses
354
+ decoded = response.content
355
+ else:
356
+ raise ValueError(f"Unexpected file encoding: {contents.encoding}")
357
+
349
358
  if '.json' in repo_path:
350
359
  return json.loads(decoded)
351
360
  else:
@@ -533,7 +542,8 @@ class GithubHelper:
533
542
 
534
543
 
535
544
  class KeyManager(GithubHelper):
536
- def __init__(self, key_name, config_file_preference='local', github_config_dir=None, provide_key_data=None):
545
+ def __init__(self, key_name, config_file_preference='local', github_config_dir=None, provide_key_data=None,
546
+ force_setup=False):
537
547
  """
538
548
  This class manages api key storage and retrieval from new api creation through continued use.
539
549
  There are two options for storage set by the config_file_preference parameter:
@@ -569,11 +579,14 @@ class KeyManager(GithubHelper):
569
579
  (instead of going through the guided setup where you paste the key). This is helpful for complex keys
570
580
  that require more than one token or that have additional meta data with them. Two options:
571
581
  dict or the full path str to the file that contains the json.
582
+ force_setup : bool, optional
583
+ If True, will force the setup to occur and skip y/n prompts. Defaults to False.
572
584
  """
573
585
 
574
586
  self._config_dict = {}
575
587
  self._config_type = config_file_preference.lower()
576
588
  self._provided_key_data = provide_key_data
589
+ self._force_setup = force_setup
577
590
 
578
591
  # Key name and file based on parameters
579
592
  self.key_name = key_name
@@ -626,21 +639,32 @@ class KeyManager(GithubHelper):
626
639
  return False
627
640
 
628
641
  def _guided_api_key_setup(self):
629
- confirm = input((f"You don't have a key stored for '{self.key_name}'. Do you want to go through setup? (y/n)"))
630
- if confirm != 'y':
631
- print("OK, Exiting...")
632
- quit()
642
+ if self._force_setup:
643
+ pass
644
+ else:
645
+ confirm = input((f"You don't have a key stored for '{self.key_name}'. "
646
+ "Do you want to go through setup? (y/n)"))
647
+ if confirm != 'y':
648
+ print("OK, Exiting...")
649
+ quit()
633
650
 
634
651
  if self._config_type == 'github':
635
- input(("\n1. Starting setup\n"
636
- f"The key for '{self.key_name}' you provide in this setup will be stored on your private github repo: "
637
- f"'{self._gh_repo}/{self.key_file_name}'"
638
- "\nPress enter to continue"))
652
+ if self._provided_key_data:
653
+ pass
654
+ else:
655
+ input(("\n1. Starting setup\n"
656
+ f"The key for '{self.key_name}' you provide in this setup will be stored on your "
657
+ "private github repo: "
658
+ f"'{self._gh_repo}/{self.key_file_name}'"
659
+ "\nPress enter to continue"))
639
660
  elif self._config_type == 'local':
640
- input(("\n1. Starting setup\n"
641
- f"The key for '{self.key_name}' you provide in this setup will be stored locally at: "
642
- f"{self._local_key_storage} "
643
- "\nPress enter to continue"))
661
+ if self._provided_key_data:
662
+ pass
663
+ else:
664
+ input(("\n1. Starting setup\n"
665
+ f"The key for '{self.key_name}' you provide in this setup will be stored locally at: "
666
+ f"{self._local_key_storage} "
667
+ "\nPress enter to continue"))
644
668
  else:
645
669
  print(f"ERROR: '{self._config_type}' is not a valid config_file_preference")
646
670
  quit()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lukhed-basic-utils
3
- Version: 1.4.4
3
+ Version: 1.4.6
4
4
  Summary: A collection of basic utility functions
5
5
  Home-page: https://github.com/lukhed/lukhed_basic_utils
6
6
  Author: lukhed
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="lukhed_basic_utils",
5
- version="1.4.4",
5
+ version="1.4.6",
6
6
  description="A collection of basic utility functions",
7
7
  long_description=open("README.md").read(),
8
8
  long_description_content_type="text/markdown",