pyDiffTools 0.1.6__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.
@@ -0,0 +1,10 @@
1
+ # from subprocess import call
2
+ __all__ = [
3
+ "check_numbers",
4
+ "command_line",
5
+ "match_spaces",
6
+ "split_conflict",
7
+ "wrap_sentences",
8
+ "rearrange_tex",
9
+ "outline",
10
+ ]
@@ -0,0 +1,55 @@
1
+ from subprocess import Popen, PIPE
2
+ import os
3
+
4
+
5
+ def run(arguments):
6
+ try:
7
+ start, stop = list(map(int, arguments))
8
+ except:
9
+ raise ValueError("I didn't understand the arguments" + repr(arguments))
10
+ for thisnumber in range(start, stop + 1):
11
+ if os.name == "posix":
12
+ result = Popen(
13
+ [r'grep -Rice "%d\." ~/notebook/list*' % thisnumber],
14
+ shell=True,
15
+ stdout=PIPE,
16
+ )
17
+ else:
18
+ try:
19
+ result = Popen(
20
+ [
21
+ r"C:\Program Files\Git\bin\bash.exe",
22
+ "-c",
23
+ r'grep -rice "%d\." ~/notebook/list*' % thisnumber,
24
+ ],
25
+ stdout=PIPE,
26
+ )
27
+ except:
28
+ result = Popen(
29
+ [
30
+ r"C:\Program Files (x86)\Git\bin\bash.exe",
31
+ "-c",
32
+ r'grep -rice "%d\." ~/notebook/list*' % thisnumber,
33
+ ],
34
+ stdout=PIPE,
35
+ )
36
+ matched_already = False
37
+ matched_multiple = False
38
+ full_string = []
39
+ for thisline in result.stdout.readlines():
40
+ if (not thisline.find(":0") > -1) and thisline.find(".tex:") > -1:
41
+ if not matched_already:
42
+ print(thisnumber, " ", end=" ")
43
+ if not thisline.find(":1") > -1:
44
+ matched_already = True
45
+ full_string.append(thisline.strip())
46
+ if matched_already: # more than one match
47
+ print("conflicting files:")
48
+ print("\n".join(full_string))
49
+ matched_multiple = True
50
+ matched_already = True
51
+ if not matched_multiple:
52
+ if matched_already:
53
+ print("single\t\t", full_string[-1][:-2])
54
+ else:
55
+ print(thisnumber, " has no match")