chgksuite 0.27.0b1__py3-none-any.whl → 0.27.0b4__py3-none-any.whl
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.
- chgksuite/common.py +10 -8
- chgksuite/composer/__init__.py +2 -1
- chgksuite/composer/chgksuite_parser.py +14 -4
- chgksuite/version.py +1 -1
- {chgksuite-0.27.0b1.dist-info → chgksuite-0.27.0b4.dist-info}/METADATA +1 -1
- {chgksuite-0.27.0b1.dist-info → chgksuite-0.27.0b4.dist-info}/RECORD +10 -10
- {chgksuite-0.27.0b1.dist-info → chgksuite-0.27.0b4.dist-info}/WHEEL +0 -0
- {chgksuite-0.27.0b1.dist-info → chgksuite-0.27.0b4.dist-info}/entry_points.txt +0 -0
- {chgksuite-0.27.0b1.dist-info → chgksuite-0.27.0b4.dist-info}/licenses/LICENSE +0 -0
- {chgksuite-0.27.0b1.dist-info → chgksuite-0.27.0b4.dist-info}/top_level.txt +0 -0
chgksuite/common.py
CHANGED
|
@@ -37,11 +37,20 @@ except AttributeError:
|
|
|
37
37
|
lastdir = os.path.join(os.path.dirname(os.path.abspath("__file__")), "lastdir")
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
def get_chgksuite_dir():
|
|
41
|
+
chgksuite_dir = os.path.join(os.path.expanduser("~"), ".chgksuite")
|
|
42
|
+
if not os.path.isdir(chgksuite_dir):
|
|
43
|
+
os.mkdir(chgksuite_dir)
|
|
44
|
+
return chgksuite_dir
|
|
45
|
+
|
|
46
|
+
|
|
40
47
|
def init_logger(logger_name, debug=False):
|
|
41
48
|
logger = logging.getLogger(logger_name)
|
|
42
49
|
if not logger.handlers:
|
|
43
50
|
logger.setLevel(logging.DEBUG)
|
|
44
|
-
|
|
51
|
+
log_dir = get_chgksuite_dir()
|
|
52
|
+
log_path = os.path.join(log_dir, f"{logger_name}.log")
|
|
53
|
+
fh = logging.FileHandler(log_path, encoding="utf8")
|
|
45
54
|
fh.setLevel(logging.DEBUG)
|
|
46
55
|
ch = logging.StreamHandler()
|
|
47
56
|
if debug:
|
|
@@ -56,13 +65,6 @@ def init_logger(logger_name, debug=False):
|
|
|
56
65
|
return logger
|
|
57
66
|
|
|
58
67
|
|
|
59
|
-
def get_chgksuite_dir():
|
|
60
|
-
chgksuite_dir = os.path.join(os.path.expanduser("~"), ".chgksuite")
|
|
61
|
-
if not os.path.isdir(chgksuite_dir):
|
|
62
|
-
os.mkdir(chgksuite_dir)
|
|
63
|
-
return chgksuite_dir
|
|
64
|
-
|
|
65
|
-
|
|
66
68
|
def load_settings():
|
|
67
69
|
chgksuite_dir = get_chgksuite_dir()
|
|
68
70
|
settings_file = os.path.join(chgksuite_dir, "settings.toml")
|
chgksuite/composer/__init__.py
CHANGED
|
@@ -78,7 +78,8 @@ def parse_filepath(filepath, args=None):
|
|
|
78
78
|
with codecs.open(filepath, "r", "utf8") as input_file:
|
|
79
79
|
input_text = input_file.read()
|
|
80
80
|
input_text = input_text.replace("\r", "")
|
|
81
|
-
|
|
81
|
+
debug_dir = os.path.dirname(os.path.abspath(filepath))
|
|
82
|
+
return parse_4s(input_text, randomize=args.randomize, debug=args.debug, debug_dir=debug_dir)
|
|
82
83
|
|
|
83
84
|
|
|
84
85
|
def make_merged_filename(filelist):
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import codecs
|
|
2
|
+
import os
|
|
2
3
|
import random
|
|
3
4
|
import re
|
|
4
5
|
from collections import defaultdict
|
|
5
6
|
|
|
6
|
-
from chgksuite.common import
|
|
7
|
+
from chgksuite.common import (
|
|
8
|
+
QUESTION_LABELS,
|
|
9
|
+
check_question,
|
|
10
|
+
get_chgksuite_dir,
|
|
11
|
+
init_logger,
|
|
12
|
+
log_wrap,
|
|
13
|
+
)
|
|
7
14
|
from chgksuite.typotools import remove_excessive_whitespace as rew
|
|
8
15
|
|
|
9
16
|
REQUIRED_LABELS = set(["question", "answer"])
|
|
@@ -89,7 +96,7 @@ def replace_counters(string_):
|
|
|
89
96
|
return string_
|
|
90
97
|
|
|
91
98
|
|
|
92
|
-
def parse_4s(s, randomize=False, debug=False, logger=None):
|
|
99
|
+
def parse_4s(s, randomize=False, debug=False, logger=None, debug_dir=None):
|
|
93
100
|
logger = logger or init_logger("composer")
|
|
94
101
|
mapping = {
|
|
95
102
|
"#": "meta",
|
|
@@ -115,8 +122,11 @@ def parse_4s(s, randomize=False, debug=False, logger=None):
|
|
|
115
122
|
if s[0] == "\ufeff" and len(s) > 1:
|
|
116
123
|
s = s[1:]
|
|
117
124
|
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
if debug:
|
|
126
|
+
debug_dir = debug_dir or get_chgksuite_dir()
|
|
127
|
+
debug_path = os.path.join(debug_dir, "raw.debug")
|
|
128
|
+
with codecs.open(debug_path, "w", "utf8") as debugf:
|
|
129
|
+
debugf.write(log_wrap(s.split("\n")))
|
|
120
130
|
|
|
121
131
|
s = replace_counters(s)
|
|
122
132
|
|
chgksuite/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.27.
|
|
1
|
+
__version__ = "0.27.0b4"
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
chgksuite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
chgksuite/__main__.py,sha256=0-_jfloveTW3SZYW5XEagbyaHKGCiDhGNgcLxsT_dMs,140
|
|
3
3
|
chgksuite/cli.py,sha256=95Xj1jrnybtso9qSCAwgv6utCrhJF43oFXlH5LWyHKA,40918
|
|
4
|
-
chgksuite/common.py,sha256=
|
|
4
|
+
chgksuite/common.py,sha256=M4mYjVAzF7uk9ElF0XmO3eggxSFf2bPlKinT2nEZPXA,11350
|
|
5
5
|
chgksuite/parser.py,sha256=2UL-2dJtCFYEjakUfeh3n1E4epMKPo0pjdaC_cBZplM,45775
|
|
6
6
|
chgksuite/parser_db.py,sha256=gh5AM80UR_hQ0r_-AwWLbqZCl2V0j3HAgj6BilImXyc,11116
|
|
7
7
|
chgksuite/trello.py,sha256=I1JmIbZVJjJuuRO0g26fNt8deRo9hDlk1xBIf8w31Rs,14724
|
|
8
8
|
chgksuite/typotools.py,sha256=0fQOjt5H3NRl0JeGTp2x-k-2ZN68E9Z9WX8D7lCwXmA,12765
|
|
9
|
-
chgksuite/version.py,sha256=
|
|
9
|
+
chgksuite/version.py,sha256=DrRQ0PRyZarER4yjID16e6Pnohc_hFKkfGU7t8aYz0M,25
|
|
10
10
|
chgksuite/vulture_whitelist.py,sha256=P__p_X0zt10ivddIf81uyxsobV14vFg8uS2lt4foYpc,3582
|
|
11
|
-
chgksuite/composer/__init__.py,sha256=
|
|
12
|
-
chgksuite/composer/chgksuite_parser.py,sha256=
|
|
11
|
+
chgksuite/composer/__init__.py,sha256=k6bnuB8ftPsBY-Q-iLm42S10jWXAJebmYTdW_BZiKAM,6570
|
|
12
|
+
chgksuite/composer/chgksuite_parser.py,sha256=g1KP0Jm4Zt4I06WGbFfKz6qIv4x1bLuPozu4QOV2wfw,9049
|
|
13
13
|
chgksuite/composer/composer_common.py,sha256=kc-_Tc9NjevfXGj4fXoa9fye9AO0EuMSnEPJnS0n-aQ,16281
|
|
14
14
|
chgksuite/composer/db.py,sha256=71cINE_V8s6YidvqpmBmmlWbcXraUEGZA1xpVFAUENw,8173
|
|
15
15
|
chgksuite/composer/docx.py,sha256=W46glwffZFpIATrwe_100vl5ypobMwXADSfoaApyHl8,23716
|
|
@@ -54,9 +54,9 @@ chgksuite/resources/regexes_uz_cyr.json,sha256=D4AyaEPEY753I47Ky2Fwol_4kxQsl-Yu9
|
|
|
54
54
|
chgksuite/resources/template.docx,sha256=Do29TAsg3YbH0rRSaXhVzKEoh4pwXkklW_idWA34HVE,11189
|
|
55
55
|
chgksuite/resources/template.pptx,sha256=hEFWqE-yYpwZ8ejrMCJIPEyoMT3eDqaqtiEeQ7I4fyk,29777
|
|
56
56
|
chgksuite/resources/trello.json,sha256=M5Q9JR-AAJF1u16YtNAxDX-7c7VoVTXuq4POTqYvq8o,555
|
|
57
|
-
chgksuite-0.27.
|
|
58
|
-
chgksuite-0.27.
|
|
59
|
-
chgksuite-0.27.
|
|
60
|
-
chgksuite-0.27.
|
|
61
|
-
chgksuite-0.27.
|
|
62
|
-
chgksuite-0.27.
|
|
57
|
+
chgksuite-0.27.0b4.dist-info/licenses/LICENSE,sha256=_a1yfntuPmctLsuiE_08xMSORuCfGS8X5hQph2U_PUw,1081
|
|
58
|
+
chgksuite-0.27.0b4.dist-info/METADATA,sha256=29tViwWEKfBijnHY-xp3Tra4b6ekmyPuMS5Zx1mmX3c,1201
|
|
59
|
+
chgksuite-0.27.0b4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
60
|
+
chgksuite-0.27.0b4.dist-info/entry_points.txt,sha256=lqjX6ULQZGDt0rgouTXBuwEPiwKkDQkSiNsT877A_Jg,54
|
|
61
|
+
chgksuite-0.27.0b4.dist-info/top_level.txt,sha256=cSWiRBOGZW9nIO6Rv1IrEfwPgV2ZWs87QV9wPXeBGqM,10
|
|
62
|
+
chgksuite-0.27.0b4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|