• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

Révision68c4802b824e95b44e4e669011899f7e3c3e71cb (tree)
l'heure2024-10-30 09:21:36
AuteurCorbin <cds@corb...>
CommiterCorbin

Message de Log

bk: Correctly extract templates.

I don't know why the cognitive weight of JSON vs S-expressions is so
heavy, but it really does seem to suck part of my attention at all
times, and I'd like for it to be better.

Change Summary

Modification

--- a/bk/bk.py
+++ b/bk/bk.py
@@ -109,7 +109,9 @@ def _2to3(v2, v3, author="Unknown"):
109109 "Total jets:", len(d["jets"]))
110110
111111 def getExpr(store, obj):
112- if obj.type_name == b"blob": return obj.as_raw_string().decode("utf-8")
112+ if obj.type_name == b"blob":
113+ s = obj.as_raw_string().decode("utf-8")
114+ return int(s[1:]) if s.startswith("_") else s
113115 elif obj.type_name == b"tree":
114116 pieces = {name: getExpr(store, store[sha])
115117 for (name, _, sha) in obj.iteritems()}
@@ -119,6 +121,7 @@ def getExpr(store, obj):
119121
120122 def sexpify(x):
121123 if isinstance(x, str): return x
124+ elif isinstance(x, int): return "@%d" % x
122125 else: return "(" + " ".join(sexpify(v) for v in x) + ")"
123126
124127 @cli.command()