lukhed-basic-utils 1.1.0__tar.gz → 1.2.0__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.
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/PKG-INFO +1 -1
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/githubCommon.py +27 -7
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils.egg-info/PKG-INFO +1 -1
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils.egg-info/SOURCES.txt +0 -1
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/setup.py +1 -1
- lukhed_basic_utils-1.1.0/lukhed_basic_utils/commonCommon.py +0 -9
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/LICENSE +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/README.md +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/__init__.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/classCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/fileCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/listWorkCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/mathCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/osCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/requestsCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/stringCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils/timeCommon.py +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils.egg-info/dependency_links.txt +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils.egg-info/requires.txt +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils.egg-info/top_level.txt +0 -0
- {lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from lukhed_basic_utils import osCommon as osC
|
|
2
2
|
from lukhed_basic_utils import fileCommon as fC
|
|
3
|
-
from lukhed_basic_utils import commonCommon as cC
|
|
4
3
|
from github import Github
|
|
5
4
|
from github.Repository import Repository
|
|
6
5
|
from github.GithubException import UnknownObjectException
|
|
@@ -8,7 +7,7 @@ import json
|
|
|
8
7
|
from typing import Optional
|
|
9
8
|
|
|
10
9
|
class GithubHelper:
|
|
11
|
-
def __init__(self, project='your_project_name', repo_name=None):
|
|
10
|
+
def __init__(self, project='your_project_name', repo_name=None, set_config_directory=None):
|
|
12
11
|
"""
|
|
13
12
|
A helper class for interacting with GitHub repositories, handling authentication,
|
|
14
13
|
and various file operations within a repository.
|
|
@@ -24,6 +23,9 @@ class GithubHelper:
|
|
|
24
23
|
'your_project_name'. Project names are not case sensitive.
|
|
25
24
|
repo_name (str, optional): Name of the repository to activate immediately
|
|
26
25
|
after instantiation. Defaults to None.
|
|
26
|
+
set_config_directory (str, optional): Full path to the directory that contains your GithubHelper config
|
|
27
|
+
file (token file). Default is None and this class will create a directory in your working directory
|
|
28
|
+
called 'lukhedConfig' to store the GithubHelper config file.
|
|
27
29
|
|
|
28
30
|
Attributes:
|
|
29
31
|
_resource_dir (str): Path to the lukhed config directory.
|
|
@@ -40,8 +42,15 @@ class GithubHelper:
|
|
|
40
42
|
"""
|
|
41
43
|
|
|
42
44
|
# Check setup upon instantiation
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
if set_config_directory is None:
|
|
46
|
+
osC.check_create_dir_structure(['lukhedConfig'])
|
|
47
|
+
self._resource_dir = osC.create_file_path_string(['lukhedConfig'])
|
|
48
|
+
else:
|
|
49
|
+
self._resource_dir = set_config_directory
|
|
50
|
+
if not osC.check_if_dir_exists(self._resource_dir):
|
|
51
|
+
print(f"ERROR: The config directory '{set_config_directory}' does not exist. Exiting...")
|
|
52
|
+
quit()
|
|
53
|
+
|
|
45
54
|
self._github_config_file = osC.append_to_dir(self._resource_dir, 'githubConfig.json')
|
|
46
55
|
self._github_config = []
|
|
47
56
|
self.user = None
|
|
@@ -55,7 +64,7 @@ class GithubHelper:
|
|
|
55
64
|
|
|
56
65
|
|
|
57
66
|
###################
|
|
58
|
-
# Setup/
|
|
67
|
+
# Setup/Config
|
|
59
68
|
###################
|
|
60
69
|
def _check_setup(self, project):
|
|
61
70
|
need_setup = True
|
|
@@ -77,9 +86,20 @@ class GithubHelper:
|
|
|
77
86
|
self._prompt_for_setup()
|
|
78
87
|
|
|
79
88
|
def _activate_project(self, project):
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
try:
|
|
90
|
+
projects = [x['project'].lower() for x in self._github_config]
|
|
91
|
+
except Exception as e:
|
|
92
|
+
input((f"ERROR: Error while trying to parse the config file. It may be corrupt."
|
|
93
|
+
"You can delete the config directory and go through setup again. Press any button to quit."))
|
|
94
|
+
quit()
|
|
82
95
|
|
|
96
|
+
try:
|
|
97
|
+
project = project.lower()
|
|
98
|
+
except Exception as e:
|
|
99
|
+
input((f"ERROR: Error while trying to parse project name '{project}'. Try another project name. "
|
|
100
|
+
"Press any button to quit."))
|
|
101
|
+
quit()
|
|
102
|
+
|
|
83
103
|
if project in projects:
|
|
84
104
|
# Get the index of the item
|
|
85
105
|
index = projects.index(project)
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="lukhed_basic_utils",
|
|
5
|
-
version="1.
|
|
5
|
+
version="1.2.0",
|
|
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",
|
|
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
|
{lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils.egg-info/requires.txt
RENAMED
|
File without changes
|
{lukhed_basic_utils-1.1.0 → lukhed_basic_utils-1.2.0}/lukhed_basic_utils.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|