File: single_file_diff

package info (click to toggle)
python-flake8 3.2.1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 1,076 kB
  • sloc: python: 5,037; sh: 20; makefile: 18
file content (27 lines) | stat: -rw-r--r-- 715 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff --git a/flake8/utils.py b/flake8/utils.py
index f6ce384..7cd12b0 100644
--- a/flake8/utils.py
+++ b/flake8/utils.py
@@ -75,8 +75,8 @@ def stdin_get_value():
     return cached_value.getvalue()


-def parse_unified_diff():
-    # type: () -> List[str]
+def parse_unified_diff(diff=None):
+    # type: (str) -> List[str]
     """Parse the unified diff passed on stdin.

     :returns:
@@ -84,7 +84,10 @@ def parse_unified_diff():
     :rtype:
         dict
     """
-    diff = stdin_get_value()
+    # Allow us to not have to patch out stdin_get_value
+    if diff is None:
+        diff = stdin_get_value()
+
     number_of_rows = None
     current_path = None
     parsed_paths = collections.defaultdict(set)