recalling-machine 0.0.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Alexander Fedotov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ include src/recalling_machine/*.yaml
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.1
2
+ Name: recalling-machine
3
+ Version: 0.0.1
4
+ Summary: A Machine that recalls what was memorized.
5
+ Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
+ Project-URL: Homepage, https://github.com/recalling-machine/recalling-machine
7
+ Project-URL: Bug Tracker, https://github.com/recalling-machine/recalling-machine/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: PyGithub>=2.3.0
15
+ Requires-Dist: PyYAML>=6.0.1
16
+
17
+ # recalling-machine
18
+ A Machine that recalls what was memorized.
19
+ <pre>
20
+ pip install recalling-machine
21
+ </pre>
22
+ Then:
23
+ ```Python
24
+ # Python
25
+ import recalling_machine
26
+ ```
@@ -0,0 +1,10 @@
1
+ # recalling-machine
2
+ A Machine that recalls what was memorized.
3
+ <pre>
4
+ pip install recalling-machine
5
+ </pre>
6
+ Then:
7
+ ```Python
8
+ # Python
9
+ import recalling_machine
10
+ ```
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=67.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.setuptools.packages.find]
6
+ where = ["src"]
7
+
8
+ [project]
9
+ name = "recalling-machine"
10
+ version = "0.0.1"
11
+ authors = [
12
+ {name="Alexander Fedotov", email="alex.fedotov@aol.com"},
13
+ ]
14
+ description = "A Machine that recalls what was memorized."
15
+ readme = "README.md"
16
+ requires-python = ">=3.10"
17
+ classifiers=[
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ ]
22
+ dependencies = [
23
+ "PyGithub >= 2.3.0",
24
+ "PyYAML >= 6.0.1"
25
+ ]
26
+ [project.urls]
27
+ "Homepage" = "https://github.com/recalling-machine/recalling-machine"
28
+ "Bug Tracker" = "https://github.com/recalling-machine/recalling-machine/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Python
3
+
4
+ """Copyright (c) Alexander Fedotov.
5
+ This source code is licensed under the license found in the
6
+ LICENSE file in the root directory of this source tree.
7
+ """
8
+ import os
9
+ from . import githf
10
+ import yaml
11
+
12
+
13
+ MACHINE_ORGANIZATION_NAME = 'recalling-machine' # or other organization
14
+ PRIVATE_REPO_WITH_TEXT = 'recalling_machine'
15
+
16
+ try:
17
+ gh = githf.connectto_repo(organization=MACHINE_ORGANIZATION_NAME,
18
+ repository_name=PRIVATE_REPO_WITH_TEXT,
19
+ private=True)
20
+ MACHINE_YAML = githf.read_file(repository=gh, file_path='machina.yaml')
21
+
22
+ except Exception as e:
23
+ machina_path = os.path.join(os.path.dirname(__file__), 'machina.yaml')
24
+ with open(machina_path, 'r') as yaml_file:
25
+ MACHINE_YAML = yaml_file.read()
26
+
27
+ RECALLING_MACHINE = yaml.load(MACHINE_YAML, Loader=yaml.FullLoader)
@@ -0,0 +1,64 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Python
3
+
4
+ """Copyright (c) Alexander Fedotov.
5
+ This source code is licensed under the license found in the
6
+ LICENSE file in the root directory of this source tree.
7
+ """
8
+ from os import environ
9
+ from github import Github, UnknownObjectException
10
+ from urllib3 import disable_warnings
11
+
12
+
13
+ github_token = environ.get('GITHUB_TOKEN', '')
14
+ github_name = environ.get('GITHUB_NAME', '')
15
+ github_email = environ.get('GITHUB_EMAIL', '')
16
+
17
+ # The useless urllib3 warning is too maddening for an ordinary human being.
18
+ disable_warnings()
19
+
20
+
21
+ # Repo
22
+ def connectto_repo(organization=None,
23
+ repository_name=None,
24
+ private=False):
25
+ """
26
+ Establish connection with a repository.
27
+ Return 'None' if connection fails.
28
+ """
29
+ gh = Github(github_token, verify=False)
30
+ if organization:
31
+ org = gh.get_organization(organization)
32
+ try:
33
+ repo = org.get_repo(f'{repository_name}')
34
+ except UnknownObjectException:
35
+ # print('Can not connect YOU to this repo in this organization')
36
+ repo = None
37
+ return repo
38
+ else:
39
+ user = gh.get_user()
40
+ try:
41
+ repo = user.get_repo(repository_name)
42
+ except UnknownObjectException:
43
+ # print('Can not connect YOU to this repo')
44
+ repo = None
45
+ return repo
46
+
47
+
48
+ def read_file(repository,
49
+ file_path):
50
+ """ Read a file in a repository
51
+ file_path: path to the file formatted as
52
+ 'directory_in_repo/subdirectory/file.ext'
53
+ """
54
+ try:
55
+ # Get the file if it exists
56
+ ingested_file = repository.get_contents(file_path)
57
+ content = ingested_file.decoded_content.decode("utf-8")
58
+
59
+ except UnknownObjectException:
60
+ # The file doesn't exist
61
+ # print('The file does not exist')
62
+ content = ''
63
+
64
+ return content
@@ -0,0 +1,2 @@
1
+ name: recalling-machine
2
+ description: A machine that recalls what was memorized.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.1
2
+ Name: recalling-machine
3
+ Version: 0.0.1
4
+ Summary: A Machine that recalls what was memorized.
5
+ Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
+ Project-URL: Homepage, https://github.com/recalling-machine/recalling-machine
7
+ Project-URL: Bug Tracker, https://github.com/recalling-machine/recalling-machine/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: PyGithub>=2.3.0
15
+ Requires-Dist: PyYAML>=6.0.1
16
+
17
+ # recalling-machine
18
+ A Machine that recalls what was memorized.
19
+ <pre>
20
+ pip install recalling-machine
21
+ </pre>
22
+ Then:
23
+ ```Python
24
+ # Python
25
+ import recalling_machine
26
+ ```
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/recalling_machine/__init__.py
6
+ src/recalling_machine/githf.py
7
+ src/recalling_machine/machina.yaml
8
+ src/recalling_machine.egg-info/PKG-INFO
9
+ src/recalling_machine.egg-info/SOURCES.txt
10
+ src/recalling_machine.egg-info/dependency_links.txt
11
+ src/recalling_machine.egg-info/requires.txt
12
+ src/recalling_machine.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ PyGithub>=2.3.0
2
+ PyYAML>=6.0.1
@@ -0,0 +1 @@
1
+ recalling_machine