-
Notifications
You must be signed in to change notification settings - Fork 47
Developer Guide
Bhathiya Perera edited this page Jul 2, 2019
·
3 revisions
- Anyone is welcome to send PRs/Issues.
- If you are new to python try to communicate first on gitter or send a pull request and we can discuss stuff there. π
- Follow the coding guidelines mentioned below.
- Use
black .
to format the whole code base before committing. - Ensure you test the changes manually.
- Follow standard Python best practices.
- Avoid introducing any new library without discussing.
I'm using below code to generate the TOMATO
and LOCATIONS
to replace.
from pprint import pprint
TOMATO = r"""
"/'\/`\" {task1}
".-" "|/" "-." {task2}
"/" "\" {task3}
"'" "pydoro" "\" {task4}
";" "'" {status}
";" ";" {time}
":" "/" "."
"\" ".'" "/" {count}
"\" "____" ".'" {sets}
"""
tokens = []
cur_token = ""
total = len(TOMATO)
index = 0
rs = {}
while index < total:
c = TOMATO[index]
if c == '"':
if cur_token != "":
tokens.append(('', cur_token))
t = index + 1
while t < total and TOMATO[t] != '"':
t += 1
cur_token = TOMATO[index + 1: t]
tokens.append(('#00ff00', cur_token))
cur_token = ""
index = t
elif c == "{":
if cur_token != "":
tokens.append(('', cur_token))
t = index + 1
while t < total and TOMATO[t] != '}':
t += 1
cur_token = TOMATO[index + 1: t]
rs[cur_token] = len(tokens)
tokens.append(('', cur_token))
cur_token = ""
index = t
else:
cur_token += c
index += 1
if cur_token != "":
tokens.append(('', cur_token))
pprint(tokens)
print()
pprint(rs)
π π pydoro - Terminal Pomodoro Timer π π