4 ms·
This is cool! I was hoping it would look something like: ‘’’ import diagrams calc_d = diagrams.new_diagram(“calculator_123”) calc_d.Datum("SuperNumber") class
by kovek 6y ago
This is cool! I was hoping it would look something like:
‘’’
import diagrams
calc_d = diagrams.new_diagram(“calculator_123”)
calc_d.Datum("SuperNumber")
class SuperNumber(int):
pass
@calc_d.Service(“Calculator”, “takes numbers and operations and operates”)
class Calculator(object):
@calc_d.Endpoint("Add", calls=["Increment"], main_data={"b": "SuperNumber})
def add(self, a, b: SuperNumber):
out = a
for i in range(b):
calc_d.multi(calls=["Increment"])
out = self.increment(out)
@calc_d.Function("Increment")
def increment(self, a):
return a+1
def integration_test():
calc_d.instantiate("Calculator")
calc = Calculator()
...
‘’’
EDIT: Dear dang and YC Hacker News, I would love to create code blocks using surrounding triple quotes..
- kitd 6y agoIndent with 4 spaces at the start of each line for code blocks.
- anamexis 6y agoThis is annoyingly difficult in a browser.
- Allezxandre 6y agoJust copy the text and use `sed` on your clipboard to transform your text. On macOS: pbpaste | sed 's/^.*$/ &/' | pbcopy
- yesenadam 6y agoPerhaps it's more readable/writeable with Awk: pbpaste | awk '{print " "$0}' | pbcopy Although this also seems to do the same thing pbpaste | sed 's/^/ &/' | pbcopy
- deleted 6y ago[deleted]
- kovek 6y agoFor anyone finding a solution to code blocks... I write these comments from Safari on my iPhone