memory-machine 0.0.1__tar.gz → 0.0.3__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 @@
1
+ include src/memory_machine/*.yaml
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: memory-machine
3
- Version: 0.0.1
3
+ Version: 0.0.3
4
4
  Summary: State machine enhancing the memory function of Abstract Intellect.
5
5
  Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
6
  Project-URL: Homepage, https://github.com/memory-machine/memory-machine
@@ -11,9 +11,11 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Requires-Dist: PyGithub>=2.3.0
15
+ Requires-Dist: PyYAML>=6.0.1
14
16
 
15
17
  # Memory Machine
16
- State machine enhancing the memory function of Abstract Intellect.
18
+ A machine enhancing the memory function of Abstract Intellect.
17
19
  <pre>
18
20
  pip install memory-machine
19
21
  </pre>
@@ -1,5 +1,5 @@
1
1
  # Memory Machine
2
- State machine enhancing the memory function of Abstract Intellect.
2
+ A machine enhancing the memory function of Abstract Intellect.
3
3
  <pre>
4
4
  pip install memory-machine
5
5
  </pre>
@@ -1,9 +1,13 @@
1
1
  [build-system]
2
- requires = ["setuptools>=67.0"]
2
+ requires = ["setuptools"]
3
3
  build-backend = "setuptools.build_meta"
4
+
5
+ [tool.setuptools.packages.find]
6
+ where = ["src"]
7
+
4
8
  [project]
5
9
  name = "memory-machine"
6
- version = "0.0.1"
10
+ version = "0.0.3"
7
11
  authors = [
8
12
  {name="Alexander Fedotov", email="alex.fedotov@aol.com"},
9
13
  ]
@@ -15,6 +19,10 @@ classifiers=[
15
19
  "License :: OSI Approved :: MIT License",
16
20
  "Operating System :: OS Independent",
17
21
  ]
22
+ dependencies = [
23
+ "PyGithub >= 2.3.0",
24
+ "PyYAML >= 6.0.1"
25
+ ]
18
26
  [project.urls]
19
27
  "Homepage" = "https://github.com/memory-machine/memory-machine"
20
28
  "Bug Tracker" = "https://github.com/memory-machine/memory-machine/issues"
@@ -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 = 'memory-machine'
14
+ PRIVATE_REPO_WITH_TEXT = 'memory_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
+ MEMORY_MACHINE = yaml.load(MACHINE_YAML, Loader=yaml.FullLoader)
@@ -0,0 +1,63 @@
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
+ disable_warnings()
18
+
19
+
20
+ # Repo
21
+ def connectto_repo(organization=None,
22
+ repository_name=None,
23
+ private=False):
24
+ """
25
+ Establish connection with a repository.
26
+ Return 'None' if connection fails.
27
+ """
28
+ gh = Github(github_token, verify=False)
29
+ if organization:
30
+ org = gh.get_organization(organization)
31
+ try:
32
+ repo = org.get_repo(f'{repository_name}')
33
+ except UnknownObjectException:
34
+ # print('Can not connect YOU to this repo in this organization')
35
+ repo = None
36
+ return repo
37
+ else:
38
+ user = gh.get_user()
39
+ try:
40
+ repo = user.get_repo(repository_name)
41
+ except UnknownObjectException:
42
+ # print('Can not connect YOU to this repo')
43
+ repo = None
44
+ return repo
45
+
46
+
47
+ def read_file(repository,
48
+ file_path):
49
+ """ Read a file in a repository
50
+ file_path: path to the file formatted as
51
+ 'directory_in_repo/subdirectory/file.ext'
52
+ """
53
+ try:
54
+ # Get the file if it exists
55
+ ingested_file = repository.get_contents(file_path)
56
+ content = ingested_file.decoded_content.decode("utf-8")
57
+
58
+ except UnknownObjectException:
59
+ # The file doesn't exist
60
+ # print('The file does not exist')
61
+ content = ''
62
+
63
+ return content
@@ -0,0 +1,2 @@
1
+ name: memory-machine
2
+ description: Machine that can enhances memory function.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: memory-machine
3
- Version: 0.0.1
3
+ Version: 0.0.3
4
4
  Summary: State machine enhancing the memory function of Abstract Intellect.
5
5
  Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
6
  Project-URL: Homepage, https://github.com/memory-machine/memory-machine
@@ -11,9 +11,11 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Requires-Dist: PyGithub>=2.3.0
15
+ Requires-Dist: PyYAML>=6.0.1
14
16
 
15
17
  # Memory Machine
16
- State machine enhancing the memory function of Abstract Intellect.
18
+ A machine enhancing the memory function of Abstract Intellect.
17
19
  <pre>
18
20
  pip install memory-machine
19
21
  </pre>
@@ -1,8 +1,12 @@
1
1
  LICENSE
2
+ MANIFEST.in
2
3
  README.md
3
4
  pyproject.toml
4
5
  src/memory_machine/__init__.py
6
+ src/memory_machine/githf.py
7
+ src/memory_machine/machina.yaml
5
8
  src/memory_machine.egg-info/PKG-INFO
6
9
  src/memory_machine.egg-info/SOURCES.txt
7
10
  src/memory_machine.egg-info/dependency_links.txt
11
+ src/memory_machine.egg-info/requires.txt
8
12
  src/memory_machine.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ PyGithub>=2.3.0
2
+ PyYAML>=6.0.1
@@ -1,7 +0,0 @@
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
- """
File without changes
File without changes