summaryrefslogtreecommitdiff
path: root/Biz/Bild/Example.py
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-08-16 14:18:10 -0400
committerBen Sima <ben@bsima.me>2023-08-16 18:25:00 -0400
commit7d7e0c02351303489d5555627337a39b519b536a (patch)
tree794817b6d6046a265a129c910885339058773198 /Biz/Bild/Example.py
parent30d03210f7ac5b12235760f625bac5ff3aa3f85a (diff)
Get python targets building
I added 'black' to Biz/Lint.hs, but not the others because they rely on dependencies being in the PYTHONPATH to work, so they are only relevant in nix builds and repls. I also made some other tweaks to the python checkPhase and linted all the files. Everything should be building and linting correctly now.
Diffstat (limited to 'Biz/Bild/Example.py')
-rw-r--r--Biz/Bild/Example.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Biz/Bild/Example.py b/Biz/Bild/Example.py
index 78a8a6a..25686fa 100644
--- a/Biz/Bild/Example.py
+++ b/Biz/Bild/Example.py
@@ -1,15 +1,16 @@
+"""
+Example Python file that also serves as a test case for bild.
+fernet."""
# : out example
# : dep cryptography
import sys
-from typing import List
-
-from cryptography.fernet import Fernet
+import cryptography.fernet
def cryptic_hello(name: str) -> str:
"Example taken from `cryptography` docs."
- key = Fernet.generate_key()
- f = Fernet(key)
+ key = cryptography.fernet.Fernet.generate_key()
+ f = cryptography.fernet.Fernet(key)
token = f.encrypt(hello(name).encode("utf-8"))
ret = f.decrypt(token).decode("utf-8")
assert ret == hello(name)
@@ -17,10 +18,12 @@ def cryptic_hello(name: str) -> str:
def hello(name: str) -> str:
+ "Say hello"
return f"Hello {name}"
def main() -> None:
+ "Entrypoint"
if "test" in sys.argv:
print("testing success")
print(cryptic_hello("world"))