aboutsummaryrefslogtreecommitdiffstats
path: root/import_issues.py
diff options
context:
space:
mode:
Diffstat (limited to 'import_issues.py')
-rwxr-xr-ximport_issues.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/import_issues.py b/import_issues.py
index 93c4128..c9ffffd 100755
--- a/import_issues.py
+++ b/import_issues.py
@@ -145,9 +145,27 @@ logging.basicConfig(
ID_RE = re.compile(r"^[0-9]+$")
+# todo.sr.ht seems to be limited to less than 16k comments
+# to be sure, we will do just 12k
+MAX_SIZE_COMMENT = 12 * 1024
+
tickets_to_be_closed = []
+def split_long_str(in_str: str, max_len: int = MAX_SIZE_COMMENT) -> list[str]:
+ out = []
+ tmp_str = ""
+ for line in in_str.splitlines(keepends=True):
+ if len(tmp_str + line) < max_len:
+ tmp_str += line
+ else:
+ out.append(tmp_str)
+ tmp_str = line
+ if len(tmp_str) > 0:
+ out.append(tmp_str)
+ return out
+
+
def get_labels(tracker: str) -> list[dict[str, str]]:
"""
collects labels for your named tracker