[ot][spam]gpt-4 completions

Undescribed Horrific Abuse, One Victim & Survivor of Many gmkarl at gmail.com
Sun Mar 19 06:02:45 PDT 2023


{"time": "2023-03-19T09:00:35.442328", "lm": "spellbook", "url":
"https://dashboard.scale.com/spellbook/api/v2/deploy/", "app_id":
"sm43s5r", "input": "\n    lm/lm and lm/log subpackages\n\ndiff --git
a/lm/log/jsonfiles.py b/lm/log/jsonfiles.py\nnew file mode 100644\n---
/dev/null\n+++ b/lm/log/jsonfiles.py\n@@ -0,0 +1,21 @@\n+import
aiofiles\n+import datetime\n+import json\n+import os\n+\n+class
jsonfiles:\n+    def __init__(self, path = os.path.abspath(os.curdir),
prefix = '', suffix = ''):\n+        self.path = path\n+
self.prefix = prefix\n+        self.suffix = suffix\n+    async def
__aenter__(self):\n+        self.timestamp =
datetime.datetime.now().isoformat()\n+        fn =
os.path.join(self.path,
f'{self.prefix}{self.timestamp}{self.suffix}.json')\n+
self.filectx = aiofiles.open(fn, 'w')\n+        self.file = await
self.filectx.__aenter__()\n+    async def __aexit__(self, *params,
**kwparams):\n+        await self.filectx.__aexit__(*params,
**kwparams)\n+    async def __call__(self, **kwparams):\n+
await self.file.write(\n+            json.dumps(kwparams)\n+
)\n\n    stubbed arweave log file with the example from pyarweave for
reference\n\ndiff --git a/lm/log/arweaveditems.py
b/lm/log/arweaveditems.py\nnew file mode 100755\n--- /dev/null\n+++
b/lm/log/arweaveditems.py\n@@ -0,0 +1,28 @@\n+#!/usr/bin/env
python3\n+\n+import datetime\n+from ar import Peer, Wallet,
DataItem\n+from bundlr import Node\n+\n+print('Generating a wallet
...')\n+wallet = Wallet.generate()\n+\n+print('Uploading \"Hello,
world.\" ...')\n+di = DataItem(data = b'Hello,
world.')\n+di.sign(wallet.rsa)\n+\n+node = Node()\n+result =
node.send_tx(di.tobytes())\n+txid = result['id']\n+\n+peer =
Peer()\n+\n+# bundlr used to return an expected block height but now
seems to return some timestamp  2022-11\n+# communicate with bundlr
for details on their api.\n+#current_block =
peer.current_block()\n+#eta = current_block['timestamp'] +
(result['block'] - current_block['height']) * 60 * 2\n+eta =
int(result['timestamp']/1000)\n+\n+eta =
datetime.datetime.fromtimestamp(eta)\n+\n+print(f'{peer.api_url}/{result[\"id\"]}
timestamp={eta.isoformat()}')\n\n    replaced the stub content with a
normalized log class with the same interface as jsonfiles\n\n",
"output": "diff --git a/lm/log/arweaveditems.py
b/lm/log/arweaveditems.py\nindex e69de29..c1d0a6b 100755\n---
a/lm/log/arweaveditems.py\n+++ b/lm/log/arweaveditems.py\n@@ -1,28
+1,33 @@\n #!/usr/bin/env python3\n \n import datetime\n-from ar
import Peer, Wallet, DataItem\n-from bundlr import Node\n+import
aiofiles\n+import json\n+import os\n+from arweave import Wallet,
Transaction\n+from arweave.peer import Peer\n \n-print('Generating a
wallet ...')\n-wallet = Wallet.generate()\n+class arweaveditems:\n+
def __init__(self, wallet=None, peer=None):\n+        self.wallet =
wallet or Wallet.generate()\n+        self.peer = peer or Peer()\n
\n-print('Uploading \"Hello, world.\" ...')\n-di = DataItem(data =
b'Hello, world.')\n-di.sign(wallet.rsa)\n+    async def
__aenter__(self):\n+        pass\n \n-node = Node()\n-result =
node.send_tx(di.tobytes())\n-txid = result['id']\n+    async def
__aexit__(self, *params, **kwparams):\n+        pass\n \n-peer =
Peer()\n+    async def __call__(self, **kwparams):\n+        data =
json.dumps(kwparams).encode()\n+        tx = Transaction(data=data,
wallet=self.wallet)\n+        await tx.sign()\n+        await
self.peer.submit_transaction(tx)\n \n-# bundlr used to return an
expected block height but now seems to return some timestamp
2022-11\n-# communicate with bundlr for details on their
api.\n-#current_block = peer.current_block()\n-#eta =
current_block['timestamp'] + (result['block'] -
current_block['height']) * 60 * 2\n-eta =
int(result['timestamp']/1000)\n+        # Return the transaction ID
and the estimated confirmation time\n+        eta =
datetime.datetime.fromtimestamp(tx.last_tx_timestamp)\n+        return
tx.id, eta.isoformat()\n \n-eta =
datetime.datetime.fromtimestamp(eta)\n-\n-print(f'{peer.api_url}/{result[\"id\"]}
timestamp={eta.isoformat()}')"}


More information about the cypherpunks mailing list