pyDiffTools 0.1.8__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.
- pydifftools/__init__.py +11 -0
- pydifftools/check_numbers.py +70 -0
- pydifftools/command_line.py +747 -0
- pydifftools/command_registry.py +65 -0
- pydifftools/comment_functions.py +39 -0
- pydifftools/continuous.py +194 -0
- pydifftools/copy_files.py +75 -0
- pydifftools/diff-doc.js +193 -0
- pydifftools/doc_contents.py +147 -0
- pydifftools/flowchart/__init__.py +15 -0
- pydifftools/flowchart/dot_to_yaml.py +114 -0
- pydifftools/flowchart/graph.py +620 -0
- pydifftools/flowchart/watch_graph.py +168 -0
- pydifftools/html_comments.py +33 -0
- pydifftools/html_uncomments.py +524 -0
- pydifftools/match_spaces.py +235 -0
- pydifftools/notebook/__init__.py +0 -0
- pydifftools/notebook/fast_build.py +1502 -0
- pydifftools/notebook/tex_to_qmd.py +319 -0
- pydifftools/onewordify.py +149 -0
- pydifftools/onewordify_undo.py +54 -0
- pydifftools/outline.py +173 -0
- pydifftools/rearrange_tex.py +188 -0
- pydifftools/searchacro.py +80 -0
- pydifftools/separate_comments.py +73 -0
- pydifftools/split_conflict.py +213 -0
- pydifftools/unseparate_comments.py +69 -0
- pydifftools/update_check.py +31 -0
- pydifftools/wrap_sentences.py +501 -0
- pydifftools/xml2xlsx.vbs +33 -0
- pydifftools-0.1.8.dist-info/METADATA +146 -0
- pydifftools-0.1.8.dist-info/RECORD +36 -0
- pydifftools-0.1.8.dist-info/WHEEL +5 -0
- pydifftools-0.1.8.dist-info/entry_points.txt +2 -0
- pydifftools-0.1.8.dist-info/licenses/LICENSE.md +28 -0
- pydifftools-0.1.8.dist-info/top_level.txt +1 -0
pydifftools/__init__.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from subprocess import Popen, PIPE
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from .command_registry import register_command
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@register_command(
|
|
8
|
+
"check numbers in a latex catalog (e.g. of numbered notebook) of items of"
|
|
9
|
+
" the form '\\item[anything number.anything]'",
|
|
10
|
+
help={
|
|
11
|
+
"start": "First number in the range to search",
|
|
12
|
+
"stop": "Last number in the range to search",
|
|
13
|
+
},
|
|
14
|
+
)
|
|
15
|
+
def num(start, stop):
|
|
16
|
+
"""Search a range of numbers in notebook list files and report matches."""
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
start = int(start)
|
|
20
|
+
stop = int(stop)
|
|
21
|
+
except Exception:
|
|
22
|
+
raise ValueError(
|
|
23
|
+
"I didn't understand the arguments" + repr([start, stop])
|
|
24
|
+
)
|
|
25
|
+
for thisnumber in range(start, stop + 1):
|
|
26
|
+
if os.name == "posix":
|
|
27
|
+
result = Popen(
|
|
28
|
+
[r'grep -Rice "%d\." ~/notebook/list*' % thisnumber],
|
|
29
|
+
shell=True,
|
|
30
|
+
stdout=PIPE,
|
|
31
|
+
)
|
|
32
|
+
else:
|
|
33
|
+
try:
|
|
34
|
+
result = Popen(
|
|
35
|
+
[
|
|
36
|
+
r"C:\Program Files\Git\bin\bash.exe",
|
|
37
|
+
"-c",
|
|
38
|
+
r'grep -rice "%d\." ~/notebook/list*' % thisnumber,
|
|
39
|
+
],
|
|
40
|
+
stdout=PIPE,
|
|
41
|
+
)
|
|
42
|
+
except Exception:
|
|
43
|
+
result = Popen(
|
|
44
|
+
[
|
|
45
|
+
r"C:\Program Files (x86)\Git\bin\bash.exe",
|
|
46
|
+
"-c",
|
|
47
|
+
r'grep -rice "%d\." ~/notebook/list*' % thisnumber,
|
|
48
|
+
],
|
|
49
|
+
stdout=PIPE,
|
|
50
|
+
)
|
|
51
|
+
matched_already = False
|
|
52
|
+
matched_multiple = False
|
|
53
|
+
full_string = []
|
|
54
|
+
for thisline in result.stdout.readlines():
|
|
55
|
+
if (not thisline.find(":0") > -1) and thisline.find(".tex:") > -1:
|
|
56
|
+
if not matched_already:
|
|
57
|
+
print(thisnumber, " ", end=" ")
|
|
58
|
+
if not thisline.find(":1") > -1:
|
|
59
|
+
matched_already = True
|
|
60
|
+
full_string.append(thisline.strip())
|
|
61
|
+
if matched_already: # more than one match
|
|
62
|
+
print("conflicting files:")
|
|
63
|
+
print("\n".join(full_string))
|
|
64
|
+
matched_multiple = True
|
|
65
|
+
matched_already = True
|
|
66
|
+
if not matched_multiple:
|
|
67
|
+
if matched_already:
|
|
68
|
+
print("single\t\t", full_string[-1][:-2])
|
|
69
|
+
else:
|
|
70
|
+
print(thisnumber, " has no match")
|