patch-fixer 0.2.2__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.
patch_fixer/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
from .patch_fixer import fix_patch
|
@@ -0,0 +1,400 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
import os
|
3
|
+
import re
|
4
|
+
import sys
|
5
|
+
from pathlib import Path
|
6
|
+
|
7
|
+
from git import Repo
|
8
|
+
|
9
|
+
path_regex = r'(?:/[A-Za-z0-9_.-]+)*'
|
10
|
+
regexes = {
|
11
|
+
"DIFF_LINE": re.compile(rf'diff --git (a{path_regex}+) (b{path_regex}+)'),
|
12
|
+
"MODE_LINE": re.compile(r'(new|deleted) file mode [0-7]{6}'),
|
13
|
+
"INDEX_LINE": re.compile(r'index [0-9a-f]{7,64}\.\.[0-9a-f]{7,64}(?: [0-7]{6})?|similarity index ([0-9]+)%'),
|
14
|
+
"BINARY_LINE": re.compile(rf'Binary files (a{path_regex}+|/dev/null) and (b{path_regex}+|/dev/null) differ'),
|
15
|
+
"RENAME_FROM": re.compile(rf'rename from ({path_regex})'),
|
16
|
+
"RENAME_TO": re.compile(rf'rename to ({path_regex})'),
|
17
|
+
"FILE_HEADER_START": re.compile(rf'--- (a{path_regex}+|/dev/null)'),
|
18
|
+
"FILE_HEADER_END": re.compile(rf'\+\+\+ (b{path_regex}+|/dev/null)'),
|
19
|
+
"HUNK_HEADER": re.compile(r'^@@ -(\d+),(\d+) \+(\d+),(\d+) @@(.*)$'),
|
20
|
+
"END_LINE": re.compile(r'\')
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
class MissingHunkError(Exception):
|
25
|
+
pass
|
26
|
+
|
27
|
+
|
28
|
+
def normalize_line(line):
|
29
|
+
if line.startswith('+'):
|
30
|
+
# safe to normalize new content
|
31
|
+
return '+' + line[1:].rstrip() + "\n"
|
32
|
+
else:
|
33
|
+
# preserve exactly (only normalize line endings)
|
34
|
+
return line.rstrip("\r\n") + "\n"
|
35
|
+
|
36
|
+
def find_hunk_start(context_lines, original_lines):
|
37
|
+
"""Search original_lines for context_lines and return start line index (0-based)."""
|
38
|
+
ctx = []
|
39
|
+
for line in context_lines:
|
40
|
+
if line.startswith(" "):
|
41
|
+
ctx.append(line.lstrip(" "))
|
42
|
+
elif line.startswith("-"):
|
43
|
+
ctx.append(line.lstrip("-"))
|
44
|
+
elif line.isspace() or line == "":
|
45
|
+
ctx.append(line)
|
46
|
+
if not ctx:
|
47
|
+
raise ValueError("Cannot search for empty hunk.")
|
48
|
+
for i in range(len(original_lines) - len(ctx) + 1):
|
49
|
+
# this part will fail if the diff is malformed beyond hunk header
|
50
|
+
equal_lines = [original_lines[i+j].strip() == ctx[j].strip() for j in range(len(ctx))]
|
51
|
+
if all(equal_lines):
|
52
|
+
return i
|
53
|
+
return 0
|
54
|
+
|
55
|
+
|
56
|
+
def match_line(line):
|
57
|
+
for line_type, regex in regexes.items():
|
58
|
+
match = regex.match(line)
|
59
|
+
if match:
|
60
|
+
return match.groups(), line_type
|
61
|
+
return None, None
|
62
|
+
|
63
|
+
|
64
|
+
def split_ab(match_groups):
|
65
|
+
a, b = match_groups
|
66
|
+
a = f"./{a[2:]}"
|
67
|
+
b = f"./{b[2:]}"
|
68
|
+
return a, b
|
69
|
+
|
70
|
+
|
71
|
+
def reconstruct_file_header(diff_line, header_type):
|
72
|
+
# reconstruct file header based on last diff line
|
73
|
+
diff_groups, diff_type = match_line(diff_line)
|
74
|
+
assert diff_type == "DIFF_LINE", "Indexing error in last diff calculation"
|
75
|
+
a, b = diff_groups
|
76
|
+
match header_type:
|
77
|
+
case "FILE_HEADER_START":
|
78
|
+
return f"--- {a}"
|
79
|
+
case "FILE_HEADER_END":
|
80
|
+
return f"+++ {b}"
|
81
|
+
case _:
|
82
|
+
raise ValueError(f"Unsupported header type: {header_type}")
|
83
|
+
|
84
|
+
|
85
|
+
def capture_hunk(current_hunk, original_lines, offset, last_hunk, hunk_context):
|
86
|
+
# compute line counts
|
87
|
+
old_count = sum(1 for l in current_hunk if l.startswith((' ', '-')))
|
88
|
+
new_count = sum(1 for l in current_hunk if l.startswith((' ', '+')))
|
89
|
+
|
90
|
+
# compute starting line in original file
|
91
|
+
old_start = find_hunk_start(current_hunk, original_lines) + 1
|
92
|
+
|
93
|
+
# if the line number descends, we either have a bad match or a new file
|
94
|
+
if old_start < last_hunk:
|
95
|
+
raise MissingHunkError
|
96
|
+
else:
|
97
|
+
new_start = old_start + offset
|
98
|
+
|
99
|
+
offset += (new_count - old_count)
|
100
|
+
|
101
|
+
last_hunk = old_start
|
102
|
+
|
103
|
+
# write corrected header
|
104
|
+
fixed_header = f"@@ -{old_start},{old_count} +{new_start},{new_count} @@{hunk_context}\n"
|
105
|
+
|
106
|
+
return fixed_header, offset, last_hunk
|
107
|
+
|
108
|
+
|
109
|
+
def regenerate_index(old_path, new_path, cur_dir):
|
110
|
+
repo = Repo(cur_dir)
|
111
|
+
mode = " 100644" # TODO: check if mode can be a different number
|
112
|
+
|
113
|
+
# file deletion
|
114
|
+
if new_path == "/dev/null":
|
115
|
+
old_sha = repo.git.hash_object(old_path)
|
116
|
+
new_sha = "0000000"
|
117
|
+
mode = "" # deleted file can't have a mode
|
118
|
+
|
119
|
+
else:
|
120
|
+
raise NotImplementedError(
|
121
|
+
"Regenerating index not yet supported in the general case, "
|
122
|
+
"as this would require manually applying the patch first."
|
123
|
+
)
|
124
|
+
|
125
|
+
return f"index {old_sha}..{new_sha}{mode}"
|
126
|
+
|
127
|
+
|
128
|
+
def fix_patch(patch_lines, original):
|
129
|
+
dir_mode = os.path.isdir(original)
|
130
|
+
original_path = Path(original).absolute()
|
131
|
+
|
132
|
+
# make relative paths in the diff work
|
133
|
+
os.chdir(original_path)
|
134
|
+
|
135
|
+
fixed_lines = []
|
136
|
+
current_hunk = []
|
137
|
+
current_file = None
|
138
|
+
first_hunk = True
|
139
|
+
offset = 0 # running tally of how perturbed the new line numbers are
|
140
|
+
last_hunk = 0 # start of last hunk (fixed lineno in changed file)
|
141
|
+
last_diff = 0 # start of last diff (lineno in patch file itself)
|
142
|
+
last_mode = 0 # most recent "new file mode" or "deleted file mode" line
|
143
|
+
last_index = 0 # most recent "index <hex>..<hex> <file_permissions>" line
|
144
|
+
file_start_header = False
|
145
|
+
file_end_header = False
|
146
|
+
look_for_rename = False
|
147
|
+
similarity_index = None
|
148
|
+
missing_index = False
|
149
|
+
hunk_context = ""
|
150
|
+
|
151
|
+
for i, line in enumerate(patch_lines):
|
152
|
+
match_groups, line_type = match_line(line)
|
153
|
+
match line_type:
|
154
|
+
case "DIFF_LINE":
|
155
|
+
if not first_hunk:
|
156
|
+
# process last hunk with header in previous file
|
157
|
+
try:
|
158
|
+
(
|
159
|
+
fixed_header,
|
160
|
+
offset,
|
161
|
+
last_hunk
|
162
|
+
) = capture_hunk(current_hunk, original_lines, offset, last_hunk, hunk_context)
|
163
|
+
except MissingHunkError:
|
164
|
+
raise NotImplementedError(f"Could not find hunk in {current_file}:"
|
165
|
+
f"\n\n{"\n".join(current_hunk)}")
|
166
|
+
fixed_lines.append(fixed_header)
|
167
|
+
fixed_lines.extend(current_hunk)
|
168
|
+
current_hunk = []
|
169
|
+
a, b = split_ab(match_groups)
|
170
|
+
if a != b:
|
171
|
+
raise ValueError(f"Diff paths do not match: \n{a}\n{b}")
|
172
|
+
fixed_lines.append(normalize_line(line))
|
173
|
+
last_diff = i
|
174
|
+
file_start_header = False
|
175
|
+
file_end_header = False
|
176
|
+
first_hunk = True
|
177
|
+
case "MODE_LINE":
|
178
|
+
if last_diff != i - 1:
|
179
|
+
raise NotImplementedError("Missing diff line not yet supported")
|
180
|
+
last_mode = i
|
181
|
+
fixed_lines.append(normalize_line(line))
|
182
|
+
case "INDEX_LINE":
|
183
|
+
# TODO: verify that mode is present for anything but deletion
|
184
|
+
last_index = i
|
185
|
+
similarity_index = match_groups[0]
|
186
|
+
if similarity_index:
|
187
|
+
look_for_rename = True
|
188
|
+
fixed_lines.append(normalize_line(line))
|
189
|
+
missing_index = False
|
190
|
+
case "BINARY_LINE":
|
191
|
+
raise NotImplementedError("Binary files not supported yet")
|
192
|
+
case "RENAME_FROM":
|
193
|
+
if not look_for_rename:
|
194
|
+
pass # TODO: handle missing index line
|
195
|
+
if last_index != i - 1:
|
196
|
+
missing_index = True # need this for existence check in RENAME_TO block
|
197
|
+
similarity_index = 100 # TODO: is this a dangerous assumption?
|
198
|
+
fixed_index = "similarity index 100%"
|
199
|
+
fixed_lines.append(normalize_line(fixed_index))
|
200
|
+
last_index = i - 1
|
201
|
+
look_for_rename = False
|
202
|
+
current_file = match_groups[0]
|
203
|
+
current_path = Path(current_file).absolute()
|
204
|
+
offset = 0
|
205
|
+
last_hunk = 0
|
206
|
+
if not Path.exists(current_path):
|
207
|
+
if similarity_index == 100:
|
208
|
+
fixed_lines.append(normalize_line(line))
|
209
|
+
look_for_rename = True
|
210
|
+
continue
|
211
|
+
raise NotImplementedError("Parsing files that were both renamed and modified is not yet supported.")
|
212
|
+
if dir_mode or current_path == original_path:
|
213
|
+
with open(current_path, encoding='utf-8') as f:
|
214
|
+
original_lines = [l.rstrip('\n') for l in f.readlines()]
|
215
|
+
fixed_lines.append(normalize_line(line))
|
216
|
+
# TODO: analogous boolean to `file_start_header`?
|
217
|
+
else:
|
218
|
+
raise FileNotFoundError(f"Filename {current_file} in `rename from` header does not match argument {original}")
|
219
|
+
case "RENAME_TO":
|
220
|
+
if last_index != i - 2:
|
221
|
+
if missing_index:
|
222
|
+
missing_index = False
|
223
|
+
last_index = i - 2
|
224
|
+
else:
|
225
|
+
raise NotImplementedError("Missing `rename from` header not yet supported.")
|
226
|
+
if look_for_rename:
|
227
|
+
# the old file doesn't exist, so we need to read this one
|
228
|
+
current_file = match_groups[0]
|
229
|
+
current_path = Path(current_file).absolute()
|
230
|
+
with open(current_path, encoding='utf-8') as f:
|
231
|
+
original_lines = [l.rstrip('\n') for l in f.readlines()]
|
232
|
+
fixed_lines.append(normalize_line(line))
|
233
|
+
look_for_rename = False
|
234
|
+
pass
|
235
|
+
case "FILE_HEADER_START":
|
236
|
+
if look_for_rename:
|
237
|
+
raise NotImplementedError("Replacing file header with rename not yet supported.")
|
238
|
+
if last_index != i - 1:
|
239
|
+
missing_index = True
|
240
|
+
last_index = i - 1
|
241
|
+
file_end_header = False
|
242
|
+
if current_file and not dir_mode:
|
243
|
+
raise ValueError("Diff references multiple files but only one provided.")
|
244
|
+
current_file = match_groups[0]
|
245
|
+
offset = 0
|
246
|
+
last_hunk = 0
|
247
|
+
if current_file == "/dev/null":
|
248
|
+
if last_diff > last_mode:
|
249
|
+
raise NotImplementedError("Missing mode line not yet supported")
|
250
|
+
fixed_lines.append(normalize_line(line))
|
251
|
+
file_start_header = True
|
252
|
+
continue
|
253
|
+
if current_file.startswith("a/"):
|
254
|
+
current_file = current_file[2:]
|
255
|
+
else:
|
256
|
+
line = line.replace(current_file, f"a/{current_file}")
|
257
|
+
current_path = Path(current_file).absolute()
|
258
|
+
if not current_path.exists():
|
259
|
+
raise FileNotFoundError(f"File header start points to non-existent file: {current_file}")
|
260
|
+
if dir_mode or Path(current_file) == Path(original):
|
261
|
+
with open(current_file, encoding='utf-8') as f:
|
262
|
+
original_lines = [l.rstrip('\n') for l in f.readlines()]
|
263
|
+
fixed_lines.append(normalize_line(line))
|
264
|
+
file_start_header = True
|
265
|
+
else:
|
266
|
+
raise FileNotFoundError(f"Filename {current_file} in header does not match argument {original}")
|
267
|
+
case "FILE_HEADER_END":
|
268
|
+
if look_for_rename:
|
269
|
+
raise NotImplementedError("Replacing file header with rename not yet supported.")
|
270
|
+
dest_file = match_groups[0]
|
271
|
+
dest_path = Path(dest_file).absolute()
|
272
|
+
if dest_file.startswith("b/"):
|
273
|
+
dest_file = dest_file[2:]
|
274
|
+
elif dest_file != "/dev/null":
|
275
|
+
line = line.replace(dest_file, f"b/{dest_file}")
|
276
|
+
if missing_index:
|
277
|
+
fixed_index = regenerate_index(current_file, dest_file, original_path)
|
278
|
+
fixed_lines.append(normalize_line(fixed_index))
|
279
|
+
last_index = i - 2
|
280
|
+
if not file_start_header:
|
281
|
+
if dest_file == "/dev/null":
|
282
|
+
if last_diff > last_mode:
|
283
|
+
raise NotImplementedError("Missing mode line not yet supported")
|
284
|
+
a = reconstruct_file_header(patch_lines[last_diff], "FILE_HEADER_START")
|
285
|
+
fixed_lines.append(normalize_line(a))
|
286
|
+
else:
|
287
|
+
# reconstruct file start header based on end header
|
288
|
+
a = match_groups[0].replace("b", "a")
|
289
|
+
fixed_lines.append(normalize_line(f"--- {a}"))
|
290
|
+
file_start_header = True
|
291
|
+
elif current_file == "/dev/null":
|
292
|
+
if dest_file == "/dev/null":
|
293
|
+
raise ValueError("File headers cannot both be /dev/null")
|
294
|
+
elif not dest_path.exists():
|
295
|
+
raise FileNotFoundError(f"File header end points to non-existent file: {dest_file}")
|
296
|
+
current_file = dest_file
|
297
|
+
current_path = Path(current_file).absolute()
|
298
|
+
if dir_mode or current_path == original_path:
|
299
|
+
# TODO: in dir mode, verify that current file exists in original path
|
300
|
+
with open(current_path, encoding='utf-8') as f:
|
301
|
+
original_lines = [l.rstrip('\n') for l in f.readlines()]
|
302
|
+
fixed_lines.append(normalize_line(line))
|
303
|
+
file_end_header = True
|
304
|
+
else:
|
305
|
+
raise FileNotFoundError(f"Filename {current_file} in header does not match argument {original}")
|
306
|
+
elif dest_file == "/dev/null":
|
307
|
+
# TODO: check if other modes are possible
|
308
|
+
if last_mode < last_diff:
|
309
|
+
last_mode = last_diff + 1
|
310
|
+
fixed_lines.insert(last_mode, "deleted file mode 100644")
|
311
|
+
last_index += 1 # index comes after mode
|
312
|
+
elif "deleted" not in fixed_lines[last_mode]:
|
313
|
+
fixed_lines[last_mode] = "deleted file mode 100644"
|
314
|
+
else:
|
315
|
+
fixed_lines.append("deleted file mode 100644")
|
316
|
+
elif current_file != dest_file:
|
317
|
+
raise ValueError(f"File headers do not match: \n{current_file}\n{dest_file}")
|
318
|
+
pass
|
319
|
+
case "HUNK_HEADER":
|
320
|
+
# fix missing file headers before capturing the hunk
|
321
|
+
if not file_end_header:
|
322
|
+
diff_line = patch_lines[last_diff]
|
323
|
+
if not file_start_header:
|
324
|
+
a = reconstruct_file_header(diff_line, "FILE_HEADER_START")
|
325
|
+
fixed_lines.append(normalize_line(a))
|
326
|
+
file_start_header = True
|
327
|
+
current_file = split_ab(match_line(diff_line))[0]
|
328
|
+
b = reconstruct_file_header(diff_line, "FILE_HEADER_END")
|
329
|
+
fixed_lines.append(normalize_line(b))
|
330
|
+
file_end_header = True
|
331
|
+
|
332
|
+
# we can't fix the hunk header before we've captured a hunk
|
333
|
+
if first_hunk:
|
334
|
+
first_hunk = False
|
335
|
+
hunk_context = match_groups[4]
|
336
|
+
continue
|
337
|
+
|
338
|
+
try:
|
339
|
+
(
|
340
|
+
fixed_header,
|
341
|
+
offset,
|
342
|
+
last_hunk
|
343
|
+
) = capture_hunk(current_hunk, original_lines, offset, last_hunk, hunk_context)
|
344
|
+
except MissingHunkError:
|
345
|
+
raise NotImplementedError(f"Could not find hunk in {current_file}:"
|
346
|
+
f"\n\n{"\n".join(current_hunk)}")
|
347
|
+
fixed_lines.append(fixed_header)
|
348
|
+
fixed_lines.extend(current_hunk)
|
349
|
+
current_hunk = []
|
350
|
+
hunk_context = match_groups[4]
|
351
|
+
case "END_LINE":
|
352
|
+
# TODO: add newline at end of file if user requests
|
353
|
+
fixed_lines.append(normalize_line(line))
|
354
|
+
case _:
|
355
|
+
# TODO: fuzzy string matching
|
356
|
+
# this is a normal line, add to current hunk
|
357
|
+
current_hunk.append(normalize_line(line))
|
358
|
+
|
359
|
+
# we need to process the last hunk since there's no new header to catch it
|
360
|
+
try:
|
361
|
+
(
|
362
|
+
fixed_header,
|
363
|
+
offset,
|
364
|
+
last_hunk
|
365
|
+
) = capture_hunk(current_hunk, original_lines, offset, last_hunk, hunk_context)
|
366
|
+
except MissingHunkError:
|
367
|
+
raise NotImplementedError(f"Could not find hunk in {current_file}:"
|
368
|
+
f"\n\n{"\n".join(current_hunk)}")
|
369
|
+
fixed_lines.append(fixed_header)
|
370
|
+
fixed_lines.extend(current_hunk)
|
371
|
+
|
372
|
+
# if original file didn't end with a newline, strip out the newline here
|
373
|
+
if not original_lines[-1].endswith("\n"):
|
374
|
+
fixed_lines[-1] = fixed_lines[-1].rstrip("\n")
|
375
|
+
|
376
|
+
return fixed_lines
|
377
|
+
|
378
|
+
|
379
|
+
def main():
|
380
|
+
if len(sys.argv) != 4:
|
381
|
+
print(f"Usage: {sys.argv[0]} <original_file> <broken.patch> <fixed.patch>")
|
382
|
+
sys.exit(1)
|
383
|
+
|
384
|
+
original = sys.argv[1]
|
385
|
+
patch_file = sys.argv[2]
|
386
|
+
output_file = sys.argv[3]
|
387
|
+
|
388
|
+
with open(patch_file, encoding='utf-8') as f:
|
389
|
+
patch_lines = f.readlines()
|
390
|
+
|
391
|
+
fixed_lines = fix_patch(patch_lines, original)
|
392
|
+
|
393
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
394
|
+
f.writelines(fixed_lines)
|
395
|
+
|
396
|
+
print(f"Fixed patch written to {output_file}")
|
397
|
+
|
398
|
+
if __name__ == "__main__":
|
399
|
+
main()
|
400
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: patch-fixer
|
3
|
+
Version: 0.2.2
|
4
|
+
Summary: Fixes erroneous git apply patches to the best of its ability.
|
5
|
+
Maintainer-email: Alex Mueller <amueller474@gmail.com>
|
6
|
+
License-Expression: Apache-2.0
|
7
|
+
Project-URL: Homepage, https://github.com/ajcm474/patch-fixer
|
8
|
+
Project-URL: Issues, https://github.com/ajcm474/patch-fixer/issues
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
10
|
+
Classifier: Intended Audience :: Developers
|
11
|
+
Classifier: Programming Language :: Python
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
19
|
+
Classifier: Topic :: Software Development
|
20
|
+
Requires-Python: >=3.10
|
21
|
+
Description-Content-Type: text/markdown
|
22
|
+
License-File: LICENSE
|
23
|
+
Requires-Dist: GitPython
|
24
|
+
Provides-Extra: test
|
25
|
+
Requires-Dist: pytest; extra == "test"
|
26
|
+
Requires-Dist: requests; extra == "test"
|
27
|
+
Dynamic: license-file
|
28
|
+
|
29
|
+
# patch-fixer
|
30
|
+
So you asked an LLM to generate a code diff, tried to apply it with `git apply`, and got a bunch of malformed patch errors? Well fear no more, `patch_fixer.py` is here to save the day... more or less.
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
```
|
34
|
+
git clone https://github.com/ajcm474/patch-fixer.git
|
35
|
+
cd patch-fixer
|
36
|
+
pip install -e .
|
37
|
+
```
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
```
|
41
|
+
python patch_fixer.py original broken.patch fixed.patch
|
42
|
+
```
|
43
|
+
where `original` is the file or directory you were trying to patch,
|
44
|
+
`broken.patch` is the malformed patch generated by the LLM,
|
45
|
+
and `fixed.patch` is the output file containing the (hopefully) fixed patch.
|
46
|
+
|
47
|
+
## Testing
|
48
|
+
Assuming you've already cloned the repo:
|
49
|
+
```
|
50
|
+
pip install -e .[test]
|
51
|
+
pytest
|
52
|
+
```
|
53
|
+
Note that some tests currently fail as this project is in the early alpha stage.
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
This is free and open source software, released under the Apache 2.0 License. See `LICENSE` for details.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
patch_fixer/__init__.py,sha256=bSp2H7JW2kz1WrT0dqlg64kZpklKPp1FZlDhq2XJ2uU,34
|
2
|
+
patch_fixer/patch_fixer.py,sha256=1Gf6LxQq3xhQVGeyD5W2-JKSJRgs9ty1C8F2QcEkyXQ,17469
|
3
|
+
patch_fixer-0.2.2.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
4
|
+
patch_fixer-0.2.2.dist-info/METADATA,sha256=VCH9g8_yHZfoPJrG9ZpYB0GPSPK8pG8NfeZZVuowsSs,2004
|
5
|
+
patch_fixer-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
+
patch_fixer-0.2.2.dist-info/top_level.txt,sha256=yyp3KjFgExJsrFsS9ZBCnkhb05xg8hPYhB7ncdpTOv0,12
|
7
|
+
patch_fixer-0.2.2.dist-info/RECORD,,
|
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
@@ -0,0 +1 @@
|
|
1
|
+
patch_fixer
|