commit 8d16035dc11345e3675d7524f64ccb899ca7fafa
parent 92ab8a3cef41702a04343e06e4f7e162564b8131
Author: lash <dev@holbrook.no>
Date: Tue, 15 Nov 2022 04:52:01 +0000
Add identity uri generator
Diffstat:
5 files changed, 115 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,6 +1,10 @@
+- 0.1.3
+ ? Make message settable with mod command
+ ? Make assignment settable with mod command
+- 0.1.2
+ ? Task assignments
- 0.1.1
* MIME message log for issues
- ? Make message settable with mod command
- 0.1.0
* Tools for:
- Add issue
diff --git a/piknik/identity.py b/piknik/identity.py
@@ -0,0 +1,14 @@
+import hashlib
+
+class Identity:
+
+ def __init__(self, fingerprint):
+ self.fp = bytes.fromhex(fingerprint)
+
+
+ def uri(self):
+ h = hashlib.sha256()
+ h.update(self.fp)
+ z = h.digest()
+ return 'sha256:' + z.hex()
+
diff --git a/setup.cfg b/setup.cfg
@@ -0,0 +1,38 @@
+[metadata]
+name = piknik
+version = 0.1.0
+description = CLI issue tracker
+author = Louis Holbrook
+author_email = dev@holbrook.no
+url = https://git.defalsify.org/eth-cache
+keywords =
+ bugs
+ issues
+ tracker
+ productivity
+ git
+ pgp
+classifiers =
+ Programming Language :: Python :: 3
+ Operating System :: OS Independent
+ Development Status :: 3 - Alpha
+ Topic :: Software Development :: Libraries
+ Environment :: Console
+ Intended Audience :: Developers
+ License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
+license = GPLv3+
+licence_files =
+ LICENSE
+
+[options]
+include_package_data = True
+python_requires = >= 3.7
+packages =
+ piknik
+
+[options.entry_points]
+console_scripts =
+ piknik-add = piknik.runnable.add.py:main
+ piknik-mod = piknik.runnable.mod.py:main
+ piknik-list = piknik.runnable.list.py:main
+ piknik-show = piknik.runnable.show.py:main
diff --git a/setup.py b/setup.py
@@ -0,0 +1,27 @@
+from setuptools import setup
+import os
+
+
+requirements = []
+f = open('requirements.txt', 'r')
+while True:
+ l = f.readline()
+ if l == '':
+ break
+ requirements.append(l.rstrip())
+f.close()
+
+test_requirements = []
+f = open('test_requirements.txt', 'r')
+while True:
+ l = f.readline()
+ if l == '':
+ break
+ test_requirements.append(l.rstrip())
+f.close()
+
+
+setup(
+ install_requires=requirements,
+ tests_require=test_requirements,
+ )
diff --git a/tests/test_assign.py b/tests/test_assign.py
@@ -0,0 +1,31 @@
+# standard imports
+import unittest
+import logging
+import json
+
+logging.basicConfig(level=logging.DEBUG)
+logg = logging.getLogger()
+
+from piknik import Issue
+from piknik.identity import Identity
+
+
+class TestAssign(unittest.TestCase):
+
+ def setUp(self):
+ self.alice = 'F3FAF668E82EF5124D5187BAEF26F4682343F692'
+
+ def test_identity_pointer(self):
+ check = "sha256:65ea9b0609341322903823660bf45326f473d903ee7d327dff442f46d68eacd9"
+ p = Identity(self.alice)
+ r = p.uri()
+ self.assertEqual(r, check)
+
+
+ def test_basic(self):
+ o = Issue('foo')
+ #p = Identity()
+
+
+if __name__ == '__main__':
+ unittest.main()