dart-tools 0.3.7__tar.gz → 0.3.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dart-tools might be problematic. Click here for more details.
- {dart-tools-0.3.7/dart_tools.egg-info → dart-tools-0.3.9}/PKG-INFO +1 -1
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart/dart.py +28 -6
- {dart-tools-0.3.7 → dart-tools-0.3.9/dart_tools.egg-info}/PKG-INFO +1 -1
- {dart-tools-0.3.7 → dart-tools-0.3.9}/pyproject.toml +1 -1
- {dart-tools-0.3.7 → dart-tools-0.3.9}/LICENSE +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/README.md +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart/__init__.py +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart/order_manager.py +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart_tools.egg-info/SOURCES.txt +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart_tools.egg-info/dependency_links.txt +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart_tools.egg-info/dist/dart-tools-0.3.3.tar.gz +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart_tools.egg-info/entry_points.txt +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart_tools.egg-info/requires.txt +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/dart_tools.egg-info/top_level.txt +0 -0
- {dart-tools-0.3.7 → dart-tools-0.3.9}/setup.cfg +0 -0
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"""A CLI to interact with the Dart web app."""
|
|
5
5
|
|
|
6
6
|
import argparse
|
|
7
|
+
from functools import wraps
|
|
7
8
|
import json
|
|
8
9
|
import os
|
|
9
10
|
import random
|
|
@@ -90,6 +91,17 @@ def _get_task_url(host, duid):
|
|
|
90
91
|
return f"{host}/search?t={duid}"
|
|
91
92
|
|
|
92
93
|
|
|
94
|
+
def suppress_exception(fn):
|
|
95
|
+
@wraps(fn)
|
|
96
|
+
def wrapper(*args, **kwargs):
|
|
97
|
+
try:
|
|
98
|
+
return fn(*args, **kwargs)
|
|
99
|
+
except Exception:
|
|
100
|
+
pass
|
|
101
|
+
|
|
102
|
+
return wrapper
|
|
103
|
+
|
|
104
|
+
|
|
93
105
|
def _exit_gracefully(_signal_received, _frame) -> None:
|
|
94
106
|
sys.exit("Quitting.")
|
|
95
107
|
|
|
@@ -178,13 +190,21 @@ class _Session:
|
|
|
178
190
|
class _Git:
|
|
179
191
|
@staticmethod
|
|
180
192
|
def _format_for_branch(s):
|
|
181
|
-
return re.sub(
|
|
193
|
+
return re.sub(
|
|
194
|
+
r"-{2,}", "-", re.sub(r"[^a-z0-9-]+", "-", s.lower().replace("'", ""))
|
|
195
|
+
).strip("-")
|
|
182
196
|
|
|
183
197
|
@staticmethod
|
|
184
198
|
def make_task_name(email, task):
|
|
185
199
|
username = _Git._format_for_branch(email.split("@")[0])
|
|
186
200
|
title = _Git._format_for_branch(task["title"])
|
|
187
|
-
|
|
201
|
+
long = f"{username}/{task['duid']}-{title}"
|
|
202
|
+
if len(long) <= 60:
|
|
203
|
+
return long
|
|
204
|
+
for i in range(1, 11):
|
|
205
|
+
if long[60 - i] == "-":
|
|
206
|
+
return long[: 60 - i]
|
|
207
|
+
return long[:60]
|
|
188
208
|
|
|
189
209
|
@staticmethod
|
|
190
210
|
def get_current_branch():
|
|
@@ -261,10 +281,12 @@ def print_version():
|
|
|
261
281
|
print(f"dart-tools version {_VERSION}")
|
|
262
282
|
|
|
263
283
|
|
|
284
|
+
@suppress_exception
|
|
264
285
|
def print_version_update_message_maybe():
|
|
265
286
|
latest = (
|
|
266
|
-
_run_cmd("pip index versions dart-tools 2>&1")
|
|
287
|
+
_run_cmd("pip --disable-pip-version-check index versions dart-tools 2>&1")
|
|
267
288
|
.rsplit("LATEST:", maxsplit=1)[-1]
|
|
289
|
+
.split("\n", maxsplit=1)[0]
|
|
268
290
|
.strip()
|
|
269
291
|
)
|
|
270
292
|
if latest == _VERSION or [int(e) for e in latest.split(".")] <= [
|
|
@@ -273,7 +295,7 @@ def print_version_update_message_maybe():
|
|
|
273
295
|
return
|
|
274
296
|
|
|
275
297
|
print(
|
|
276
|
-
f"A new version of dart-tools is available.
|
|
298
|
+
f"A new version of dart-tools is available. Upgrade from {_VERSION} to {latest} with\n\n pip install --upgrade dart-tools\n"
|
|
277
299
|
)
|
|
278
300
|
|
|
279
301
|
|
|
@@ -319,7 +341,7 @@ def _begin_task(config, session, user_email, get_task):
|
|
|
319
341
|
_Git.checkout_branch(branch_name)
|
|
320
342
|
|
|
321
343
|
print(
|
|
322
|
-
f"Started work on
|
|
344
|
+
f"Started work on\n\n {task['title']}\n {_get_task_url(config.host, task['duid'])}\n"
|
|
323
345
|
)
|
|
324
346
|
|
|
325
347
|
|
|
@@ -354,7 +376,7 @@ def begin_task():
|
|
|
354
376
|
return filtered_tasks[
|
|
355
377
|
pick(
|
|
356
378
|
[e["title"] for e in filtered_tasks],
|
|
357
|
-
"Which of your active,
|
|
379
|
+
"Which of your active, incomplete tasks are you beginning work on?",
|
|
358
380
|
"→",
|
|
359
381
|
)[1]
|
|
360
382
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|