We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Result.py: Add docstring regarding the case that line or column is None
The output generated by coala can have ```line``` being ```None``` or ```column``` being ```None```.

```column = None``` means there is an error with the whole line.
```line = None``` means the whole file. The reason behind it is that it's an unknown line means it can occur anywhere in the file.

All combinations with None values and numbers for line and column are allowed, except ```line=None``` and ```column=<some number>```

This should be clarified in the documentation.

(ref: http://api.coala.io/en/latest/coalib.results.html#module-coalib.results.Result)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `coalib/results/Result.py`
Content:
```
1 import uuid
2 from os.path import relpath
3 
4 from coala_utils.decorators import (
5     enforce_signature, generate_ordering, generate_repr, get_public_members)
6 from coalib.bearlib.aspects import aspectbase
7 from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
8 from coalib.results.SourceRange import SourceRange
9 
10 
11 # Omit additional info, debug message and diffs for brevity
12 @generate_repr(('id', hex),
13                'origin',
14                'affected_code',
15                ('severity', RESULT_SEVERITY.reverse.get),
16                'confidence',
17                'message',
18                ('aspect', lambda aspect: type(aspect).__qualname__),
19                'applied_actions')
20 @generate_ordering('affected_code',
21                    'severity',
22                    'confidence',
23                    'origin',
24                    'message_base',
25                    'message_arguments',
26                    'aspect',
27                    'additional_info',
28                    'diffs',
29                    'debug_msg',
30                    'applied_actions')
31 class Result:
32     """
33     A result is anything that has an origin and a message.
34 
35     Optionally it might affect a file.
36 
37     Result messages can also have arguments. The message is python
38     style formatted with these arguments.
39 
40     >>> r = Result('origin','{arg1} and {arg2}', \
41            message_arguments={'arg1': 'foo', 'arg2': 'bar'})
42     >>> r.message
43     'foo and bar'
44 
45     Message arguments may be changed later. The result message
46     will also reflect these changes.
47 
48     >>> r.message_arguments = {'arg1': 'spam', 'arg2': 'eggs'}
49     >>> r.message
50     'spam and eggs'
51 
52     """
53 
54     @enforce_signature
55     def __init__(self,
56                  origin,
57                  message: str,
58                  affected_code: (tuple, list) = (),
59                  severity: int = RESULT_SEVERITY.NORMAL,
60                  additional_info: str = '',
61                  debug_msg='',
62                  diffs: (dict, None) = None,
63                  confidence: int = 100,
64                  aspect: (aspectbase, None) = None,
65                  message_arguments: dict = {},
66                  applied_actions: dict = {}):
67         """
68         :param origin:
69             Class name or creator object of this object.
70         :param message:
71             Base message to show with this result.
72         :param affected_code:
73             A tuple of ``SourceRange`` objects pointing to related positions
74             in the source code.
75         :param severity:
76             Severity of this result.
77         :param additional_info:
78             A long description holding additional information about the issue
79             and/or how to fix it. You can use this like a manual entry for a
80             category of issues.
81         :param debug_msg:
82             A message which may help the user find out why this result was
83             yielded.
84         :param diffs:
85             A dictionary with filename as key and ``Diff`` object
86             associated with it as value.
87         :param confidence:
88             A number between 0 and 100 describing the likelihood of this result
89             being a real issue.
90         :param aspect:
91             An aspectclass instance which this result is associated to.
92             Note that this should be a leaf of the aspect tree!
93             (If you have a node, spend some time figuring out which of
94             the leafs exactly your result belongs to.)
95         :param message_arguments:
96             Arguments to be provided to the base message.
97         :param applied_actions:
98             A dictionary that contains the result, file_dict, file_diff_dict and
99             the section for an action.
100         :raises ValueError:
101             Raised when confidence is not between 0 and 100.
102         :raises KeyError:
103             Raised when message_base can not be formatted with
104             message_arguments.
105         """
106         origin = origin or ''
107         if not isinstance(origin, str):
108             origin = origin.__class__.__name__
109         if severity not in RESULT_SEVERITY.reverse:
110             raise ValueError('severity is not a valid RESULT_SEVERITY')
111 
112         self.origin = origin
113         self.message_base = message
114         self.message_arguments = message_arguments
115         self.applied_actions = applied_actions
116         if message_arguments:
117             self.message_base.format(**self.message_arguments)
118         self.debug_msg = debug_msg
119         self.additional_info = additional_info
120         # Sorting is important for tuple comparison
121         self.affected_code = tuple(sorted(affected_code))
122         self.severity = severity
123         if confidence < 0 or confidence > 100:
124             raise ValueError('Value of confidence should be between 0 and 100.')
125         self.confidence = confidence
126         self.diffs = diffs
127         self.id = uuid.uuid4().int
128         self.aspect = aspect
129         if self.aspect and not self.additional_info:
130             self.additional_info = '{} {}'.format(
131                 aspect.Docs.importance_reason, aspect.Docs.fix_suggestions)
132 
133     @property
134     def message(self):
135         if not self.message_arguments:
136             return self.message_base
137         return self.message_base.format(**self.message_arguments)
138 
139     @message.setter
140     def message(self, value: str):
141         self.message_base = value
142 
143     def set_applied_actions(self, applied_actions):
144         self.applied_actions = applied_actions
145 
146     def get_applied_actions(self):
147         return self.applied_actions
148 
149     @classmethod
150     @enforce_signature
151     def from_values(cls,
152                     origin,
153                     message: str,
154                     file: str,
155                     line: (int, None) = None,
156                     column: (int, None) = None,
157                     end_line: (int, None) = None,
158                     end_column: (int, None) = None,
159                     severity: int = RESULT_SEVERITY.NORMAL,
160                     additional_info: str = '',
161                     debug_msg='',
162                     diffs: (dict, None) = None,
163                     confidence: int = 100,
164                     aspect: (aspectbase, None) = None,
165                     message_arguments: dict = {}):
166         """
167         Creates a result with only one SourceRange with the given start and end
168         locations.
169 
170         :param origin:
171             Class name or creator object of this object.
172         :param message:
173             Base message to show with this result.
174         :param message_arguments:
175             Arguments to be provided to the base message
176         :param file:
177             The related file.
178         :param line:
179             The first related line in the file. (First line is 1)
180         :param column:
181             The column indicating the first character. (First character is 1)
182         :param end_line:
183             The last related line in the file.
184         :param end_column:
185             The column indicating the last character.
186         :param severity:
187             Severity of this result.
188         :param additional_info:
189             A long description holding additional information about the issue
190             and/or how to fix it. You can use this like a manual entry for a
191             category of issues.
192         :param debug_msg:
193             A message which may help the user find out why this result was
194             yielded.
195         :param diffs:
196             A dictionary with filename as key and ``Diff`` object
197             associated with it as value.
198         :param confidence:
199             A number between 0 and 100 describing the likelihood of this result
200             being a real issue.
201         :param aspect:
202             An Aspect object which this result is associated to. Note that this
203             should be a leaf of the aspect tree! (If you have a node, spend
204             some time figuring out which of the leafs exactly your result
205             belongs to.)
206         """
207         source_range = SourceRange.from_values(file,
208                                                line,
209                                                column,
210                                                end_line,
211                                                end_column)
212 
213         return cls(origin=origin,
214                    message=message,
215                    affected_code=(source_range,),
216                    severity=severity,
217                    additional_info=additional_info,
218                    debug_msg=debug_msg,
219                    diffs=diffs,
220                    confidence=confidence,
221                    aspect=aspect,
222                    message_arguments=message_arguments)
223 
224     def to_string_dict(self):
225         """
226         Makes a dictionary which has all keys and values as strings and
227         contains all the data that the base Result has.
228 
229         FIXME: diffs are not serialized ATM.
230         FIXME: Only the first SourceRange of affected_code is serialized. If
231         there are more, this data is currently missing.
232 
233         :return: Dictionary with keys and values as string.
234         """
235         retval = {}
236 
237         members = ['id',
238                    'additional_info',
239                    'debug_msg',
240                    'message',
241                    'message_base',
242                    'message_arguments',
243                    'origin',
244                    'confidence']
245 
246         for member in members:
247             value = getattr(self, member)
248             retval[member] = '' if value is None else str(value)
249 
250         retval['severity'] = str(RESULT_SEVERITY.reverse.get(
251             self.severity, ''))
252         if len(self.affected_code) > 0:
253             retval['file'] = self.affected_code[0].file
254             line = self.affected_code[0].start.line
255             retval['line_nr'] = '' if line is None else str(line)
256         else:
257             retval['file'], retval['line_nr'] = '', ''
258 
259         return retval
260 
261     @enforce_signature
262     def apply(self, file_dict: dict):
263         """
264         Applies all contained diffs to the given file_dict. This operation will
265         be done in-place.
266 
267         :param file_dict: A dictionary containing all files with filename as
268                           key and all lines a value. Will be modified.
269         """
270         for filename, diff in self.diffs.items():
271             file_dict[filename] = diff.modified
272 
273     def __add__(self, other):
274         """
275         Joins those patches to one patch.
276 
277         :param other: The other patch.
278         """
279         assert isinstance(self.diffs, dict)
280         assert isinstance(other.diffs, dict)
281 
282         for filename in other.diffs:
283             if filename in self.diffs:
284                 self.diffs[filename] += other.diffs[filename]
285             else:
286                 self.diffs[filename] = other.diffs[filename]
287 
288         return self
289 
290     def overlaps(self, ranges):
291         """
292         Determines if the result overlaps with source ranges provided.
293 
294         :param ranges: A list SourceRange objects to check for overlap.
295         :return:       True if the ranges overlap with the result.
296         """
297         if isinstance(ranges, SourceRange):
298             ranges = [ranges]
299 
300         for range in ranges:
301             for self_range in self.affected_code:
302                 if range.overlaps(self_range):
303                     return True
304 
305         return False
306 
307     def location_repr(self):
308         """
309         Retrieves a string, that briefly represents
310         the affected code of the result.
311 
312         :return: A string containing all of the affected files
313                  separated by a comma.
314         """
315 
316         if not self.affected_code:
317             return 'the whole project'
318 
319         # Set important to exclude duplicate file names
320         range_paths = set(sourcerange.file
321                           for sourcerange in self.affected_code)
322 
323         return ', '.join(repr(relpath(range_path))
324                          for range_path in sorted(range_paths))
325 
326     def __json__(self, use_relpath=False):
327         _dict = get_public_members(self)
328         if use_relpath and _dict['diffs']:
329             _dict['diffs'] = {relpath(file): diff
330                               for file, diff in _dict['diffs'].items()}
331         _dict['aspect'] = type(self.aspect).__qualname__
332         return _dict
333
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/coalib/results/Result.py b/coalib/results/Result.py
--- a/coalib/results/Result.py
+++ b/coalib/results/Result.py
@@ -177,8 +177,12 @@
             The related file.
         :param line:
             The first related line in the file. (First line is 1)
+            line = None means an unknown line occurs anywhere in the file.
         :param column:
             The column indicating the first character. (First character is 1)
+            column = None means there is an error with the whole line.
+            All combinations of None values are allowed for line and column,
+            Except line = None and column = <some number>
         :param end_line:
             The last related line in the file.
         :param end_column:

{"golden_diff": "diff --git a/coalib/results/Result.py b/coalib/results/Result.py\n--- a/coalib/results/Result.py\n+++ b/coalib/results/Result.py\n@@ -177,8 +177,12 @@\n             The related file.\n         :param line:\n             The first related line in the file. (First line is 1)\n+            line = None means an unknown line occurs anywhere in the file.\n         :param column:\n             The column indicating the first character. (First character is 1)\n+            column = None means there is an error with the whole line.\n+            All combinations of None values are allowed for line and column,\n+            Except line = None and column = <some number>\n         :param end_line:\n             The last related line in the file.\n         :param end_column:\n", "issue": "Result.py: Add docstring regarding the case that line or column is None\nThe output generated by coala can have ```line``` being ```None``` or ```column``` being ```None```.\r\n\r\n```column = None``` means there is an error with the whole line.\r\n```line = None``` means the whole file. The reason behind it is that it's an unknown line means it can occur anywhere in the file.\r\n\r\nAll combinations with None values and numbers for line and column are allowed, except ```line=None``` and ```column=<some number>```\r\n\r\nThis should be clarified in the documentation.\r\n\r\n(ref: http://api.coala.io/en/latest/coalib.results.html#module-coalib.results.Result)\n", "before_files": [{"content": "import uuid\nfrom os.path import relpath\n\nfrom coala_utils.decorators import (\n    enforce_signature, generate_ordering, generate_repr, get_public_members)\nfrom coalib.bearlib.aspects import aspectbase\nfrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY\nfrom coalib.results.SourceRange import SourceRange\n\n\n# Omit additional info, debug message and diffs for brevity\n@generate_repr(('id', hex),\n               'origin',\n               'affected_code',\n               ('severity', RESULT_SEVERITY.reverse.get),\n               'confidence',\n               'message',\n               ('aspect', lambda aspect: type(aspect).__qualname__),\n               'applied_actions')\n@generate_ordering('affected_code',\n                   'severity',\n                   'confidence',\n                   'origin',\n                   'message_base',\n                   'message_arguments',\n                   'aspect',\n                   'additional_info',\n                   'diffs',\n                   'debug_msg',\n                   'applied_actions')\nclass Result:\n    \"\"\"\n    A result is anything that has an origin and a message.\n\n    Optionally it might affect a file.\n\n    Result messages can also have arguments. The message is python\n    style formatted with these arguments.\n\n    >>> r = Result('origin','{arg1} and {arg2}', \\\n           message_arguments={'arg1': 'foo', 'arg2': 'bar'})\n    >>> r.message\n    'foo and bar'\n\n    Message arguments may be changed later. The result message\n    will also reflect these changes.\n\n    >>> r.message_arguments = {'arg1': 'spam', 'arg2': 'eggs'}\n    >>> r.message\n    'spam and eggs'\n\n    \"\"\"\n\n    @enforce_signature\n    def __init__(self,\n                 origin,\n                 message: str,\n                 affected_code: (tuple, list) = (),\n                 severity: int = RESULT_SEVERITY.NORMAL,\n                 additional_info: str = '',\n                 debug_msg='',\n                 diffs: (dict, None) = None,\n                 confidence: int = 100,\n                 aspect: (aspectbase, None) = None,\n                 message_arguments: dict = {},\n                 applied_actions: dict = {}):\n        \"\"\"\n        :param origin:\n            Class name or creator object of this object.\n        :param message:\n            Base message to show with this result.\n        :param affected_code:\n            A tuple of ``SourceRange`` objects pointing to related positions\n            in the source code.\n        :param severity:\n            Severity of this result.\n        :param additional_info:\n            A long description holding additional information about the issue\n            and/or how to fix it. You can use this like a manual entry for a\n            category of issues.\n        :param debug_msg:\n            A message which may help the user find out why this result was\n            yielded.\n        :param diffs:\n            A dictionary with filename as key and ``Diff`` object\n            associated with it as value.\n        :param confidence:\n            A number between 0 and 100 describing the likelihood of this result\n            being a real issue.\n        :param aspect:\n            An aspectclass instance which this result is associated to.\n            Note that this should be a leaf of the aspect tree!\n            (If you have a node, spend some time figuring out which of\n            the leafs exactly your result belongs to.)\n        :param message_arguments:\n            Arguments to be provided to the base message.\n        :param applied_actions:\n            A dictionary that contains the result, file_dict, file_diff_dict and\n            the section for an action.\n        :raises ValueError:\n            Raised when confidence is not between 0 and 100.\n        :raises KeyError:\n            Raised when message_base can not be formatted with\n            message_arguments.\n        \"\"\"\n        origin = origin or ''\n        if not isinstance(origin, str):\n            origin = origin.__class__.__name__\n        if severity not in RESULT_SEVERITY.reverse:\n            raise ValueError('severity is not a valid RESULT_SEVERITY')\n\n        self.origin = origin\n        self.message_base = message\n        self.message_arguments = message_arguments\n        self.applied_actions = applied_actions\n        if message_arguments:\n            self.message_base.format(**self.message_arguments)\n        self.debug_msg = debug_msg\n        self.additional_info = additional_info\n        # Sorting is important for tuple comparison\n        self.affected_code = tuple(sorted(affected_code))\n        self.severity = severity\n        if confidence < 0 or confidence > 100:\n            raise ValueError('Value of confidence should be between 0 and 100.')\n        self.confidence = confidence\n        self.diffs = diffs\n        self.id = uuid.uuid4().int\n        self.aspect = aspect\n        if self.aspect and not self.additional_info:\n            self.additional_info = '{} {}'.format(\n                aspect.Docs.importance_reason, aspect.Docs.fix_suggestions)\n\n    @property\n    def message(self):\n        if not self.message_arguments:\n            return self.message_base\n        return self.message_base.format(**self.message_arguments)\n\n    @message.setter\n    def message(self, value: str):\n        self.message_base = value\n\n    def set_applied_actions(self, applied_actions):\n        self.applied_actions = applied_actions\n\n    def get_applied_actions(self):\n        return self.applied_actions\n\n    @classmethod\n    @enforce_signature\n    def from_values(cls,\n                    origin,\n                    message: str,\n                    file: str,\n                    line: (int, None) = None,\n                    column: (int, None) = None,\n                    end_line: (int, None) = None,\n                    end_column: (int, None) = None,\n                    severity: int = RESULT_SEVERITY.NORMAL,\n                    additional_info: str = '',\n                    debug_msg='',\n                    diffs: (dict, None) = None,\n                    confidence: int = 100,\n                    aspect: (aspectbase, None) = None,\n                    message_arguments: dict = {}):\n        \"\"\"\n        Creates a result with only one SourceRange with the given start and end\n        locations.\n\n        :param origin:\n            Class name or creator object of this object.\n        :param message:\n            Base message to show with this result.\n        :param message_arguments:\n            Arguments to be provided to the base message\n        :param file:\n            The related file.\n        :param line:\n            The first related line in the file. (First line is 1)\n        :param column:\n            The column indicating the first character. (First character is 1)\n        :param end_line:\n            The last related line in the file.\n        :param end_column:\n            The column indicating the last character.\n        :param severity:\n            Severity of this result.\n        :param additional_info:\n            A long description holding additional information about the issue\n            and/or how to fix it. You can use this like a manual entry for a\n            category of issues.\n        :param debug_msg:\n            A message which may help the user find out why this result was\n            yielded.\n        :param diffs:\n            A dictionary with filename as key and ``Diff`` object\n            associated with it as value.\n        :param confidence:\n            A number between 0 and 100 describing the likelihood of this result\n            being a real issue.\n        :param aspect:\n            An Aspect object which this result is associated to. Note that this\n            should be a leaf of the aspect tree! (If you have a node, spend\n            some time figuring out which of the leafs exactly your result\n            belongs to.)\n        \"\"\"\n        source_range = SourceRange.from_values(file,\n                                               line,\n                                               column,\n                                               end_line,\n                                               end_column)\n\n        return cls(origin=origin,\n                   message=message,\n                   affected_code=(source_range,),\n                   severity=severity,\n                   additional_info=additional_info,\n                   debug_msg=debug_msg,\n                   diffs=diffs,\n                   confidence=confidence,\n                   aspect=aspect,\n                   message_arguments=message_arguments)\n\n    def to_string_dict(self):\n        \"\"\"\n        Makes a dictionary which has all keys and values as strings and\n        contains all the data that the base Result has.\n\n        FIXME: diffs are not serialized ATM.\n        FIXME: Only the first SourceRange of affected_code is serialized. If\n        there are more, this data is currently missing.\n\n        :return: Dictionary with keys and values as string.\n        \"\"\"\n        retval = {}\n\n        members = ['id',\n                   'additional_info',\n                   'debug_msg',\n                   'message',\n                   'message_base',\n                   'message_arguments',\n                   'origin',\n                   'confidence']\n\n        for member in members:\n            value = getattr(self, member)\n            retval[member] = '' if value is None else str(value)\n\n        retval['severity'] = str(RESULT_SEVERITY.reverse.get(\n            self.severity, ''))\n        if len(self.affected_code) > 0:\n            retval['file'] = self.affected_code[0].file\n            line = self.affected_code[0].start.line\n            retval['line_nr'] = '' if line is None else str(line)\n        else:\n            retval['file'], retval['line_nr'] = '', ''\n\n        return retval\n\n    @enforce_signature\n    def apply(self, file_dict: dict):\n        \"\"\"\n        Applies all contained diffs to the given file_dict. This operation will\n        be done in-place.\n\n        :param file_dict: A dictionary containing all files with filename as\n                          key and all lines a value. Will be modified.\n        \"\"\"\n        for filename, diff in self.diffs.items():\n            file_dict[filename] = diff.modified\n\n    def __add__(self, other):\n        \"\"\"\n        Joins those patches to one patch.\n\n        :param other: The other patch.\n        \"\"\"\n        assert isinstance(self.diffs, dict)\n        assert isinstance(other.diffs, dict)\n\n        for filename in other.diffs:\n            if filename in self.diffs:\n                self.diffs[filename] += other.diffs[filename]\n            else:\n                self.diffs[filename] = other.diffs[filename]\n\n        return self\n\n    def overlaps(self, ranges):\n        \"\"\"\n        Determines if the result overlaps with source ranges provided.\n\n        :param ranges: A list SourceRange objects to check for overlap.\n        :return:       True if the ranges overlap with the result.\n        \"\"\"\n        if isinstance(ranges, SourceRange):\n            ranges = [ranges]\n\n        for range in ranges:\n            for self_range in self.affected_code:\n                if range.overlaps(self_range):\n                    return True\n\n        return False\n\n    def location_repr(self):\n        \"\"\"\n        Retrieves a string, that briefly represents\n        the affected code of the result.\n\n        :return: A string containing all of the affected files\n                 separated by a comma.\n        \"\"\"\n\n        if not self.affected_code:\n            return 'the whole project'\n\n        # Set important to exclude duplicate file names\n        range_paths = set(sourcerange.file\n                          for sourcerange in self.affected_code)\n\n        return ', '.join(repr(relpath(range_path))\n                         for range_path in sorted(range_paths))\n\n    def __json__(self, use_relpath=False):\n        _dict = get_public_members(self)\n        if use_relpath and _dict['diffs']:\n            _dict['diffs'] = {relpath(file): diff\n                              for file, diff in _dict['diffs'].items()}\n        _dict['aspect'] = type(self.aspect).__qualname__\n        return _dict\n", "path": "coalib/results/Result.py"}], "after_files": [{"content": "import uuid\nfrom os.path import relpath\n\nfrom coala_utils.decorators import (\n    enforce_signature, generate_ordering, generate_repr, get_public_members)\nfrom coalib.bearlib.aspects import aspectbase\nfrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY\nfrom coalib.results.SourceRange import SourceRange\n\n\n# Omit additional info, debug message and diffs for brevity\n@generate_repr(('id', hex),\n               'origin',\n               'affected_code',\n               ('severity', RESULT_SEVERITY.reverse.get),\n               'confidence',\n               'message',\n               ('aspect', lambda aspect: type(aspect).__qualname__),\n               'applied_actions')\n@generate_ordering('affected_code',\n                   'severity',\n                   'confidence',\n                   'origin',\n                   'message_base',\n                   'message_arguments',\n                   'aspect',\n                   'additional_info',\n                   'diffs',\n                   'debug_msg',\n                   'applied_actions')\nclass Result:\n    \"\"\"\n    A result is anything that has an origin and a message.\n\n    Optionally it might affect a file.\n\n    Result messages can also have arguments. The message is python\n    style formatted with these arguments.\n\n    >>> r = Result('origin','{arg1} and {arg2}', \\\n           message_arguments={'arg1': 'foo', 'arg2': 'bar'})\n    >>> r.message\n    'foo and bar'\n\n    Message arguments may be changed later. The result message\n    will also reflect these changes.\n\n    >>> r.message_arguments = {'arg1': 'spam', 'arg2': 'eggs'}\n    >>> r.message\n    'spam and eggs'\n\n    \"\"\"\n\n    @enforce_signature\n    def __init__(self,\n                 origin,\n                 message: str,\n                 affected_code: (tuple, list) = (),\n                 severity: int = RESULT_SEVERITY.NORMAL,\n                 additional_info: str = '',\n                 debug_msg='',\n                 diffs: (dict, None) = None,\n                 confidence: int = 100,\n                 aspect: (aspectbase, None) = None,\n                 message_arguments: dict = {},\n                 applied_actions: dict = {}):\n        \"\"\"\n        :param origin:\n            Class name or creator object of this object.\n        :param message:\n            Base message to show with this result.\n        :param affected_code:\n            A tuple of ``SourceRange`` objects pointing to related positions\n            in the source code.\n        :param severity:\n            Severity of this result.\n        :param additional_info:\n            A long description holding additional information about the issue\n            and/or how to fix it. You can use this like a manual entry for a\n            category of issues.\n        :param debug_msg:\n            A message which may help the user find out why this result was\n            yielded.\n        :param diffs:\n            A dictionary with filename as key and ``Diff`` object\n            associated with it as value.\n        :param confidence:\n            A number between 0 and 100 describing the likelihood of this result\n            being a real issue.\n        :param aspect:\n            An aspectclass instance which this result is associated to.\n            Note that this should be a leaf of the aspect tree!\n            (If you have a node, spend some time figuring out which of\n            the leafs exactly your result belongs to.)\n        :param message_arguments:\n            Arguments to be provided to the base message.\n        :param applied_actions:\n            A dictionary that contains the result, file_dict, file_diff_dict and\n            the section for an action.\n        :raises ValueError:\n            Raised when confidence is not between 0 and 100.\n        :raises KeyError:\n            Raised when message_base can not be formatted with\n            message_arguments.\n        \"\"\"\n        origin = origin or ''\n        if not isinstance(origin, str):\n            origin = origin.__class__.__name__\n        if severity not in RESULT_SEVERITY.reverse:\n            raise ValueError('severity is not a valid RESULT_SEVERITY')\n\n        self.origin = origin\n        self.message_base = message\n        self.message_arguments = message_arguments\n        self.applied_actions = applied_actions\n        if message_arguments:\n            self.message_base.format(**self.message_arguments)\n        self.debug_msg = debug_msg\n        self.additional_info = additional_info\n        # Sorting is important for tuple comparison\n        self.affected_code = tuple(sorted(affected_code))\n        self.severity = severity\n        if confidence < 0 or confidence > 100:\n            raise ValueError('Value of confidence should be between 0 and 100.')\n        self.confidence = confidence\n        self.diffs = diffs\n        self.id = uuid.uuid4().int\n        self.aspect = aspect\n        if self.aspect and not self.additional_info:\n            self.additional_info = '{} {}'.format(\n                aspect.Docs.importance_reason, aspect.Docs.fix_suggestions)\n\n    @property\n    def message(self):\n        if not self.message_arguments:\n            return self.message_base\n        return self.message_base.format(**self.message_arguments)\n\n    @message.setter\n    def message(self, value: str):\n        self.message_base = value\n\n    def set_applied_actions(self, applied_actions):\n        self.applied_actions = applied_actions\n\n    def get_applied_actions(self):\n        return self.applied_actions\n\n    @classmethod\n    @enforce_signature\n    def from_values(cls,\n                    origin,\n                    message: str,\n                    file: str,\n                    line: (int, None) = None,\n                    column: (int, None) = None,\n                    end_line: (int, None) = None,\n                    end_column: (int, None) = None,\n                    severity: int = RESULT_SEVERITY.NORMAL,\n                    additional_info: str = '',\n                    debug_msg='',\n                    diffs: (dict, None) = None,\n                    confidence: int = 100,\n                    aspect: (aspectbase, None) = None,\n                    message_arguments: dict = {}):\n        \"\"\"\n        Creates a result with only one SourceRange with the given start and end\n        locations.\n\n        :param origin:\n            Class name or creator object of this object.\n        :param message:\n            Base message to show with this result.\n        :param message_arguments:\n            Arguments to be provided to the base message\n        :param file:\n            The related file.\n        :param line:\n            The first related line in the file. (First line is 1)\n            line = None means an unknown line occurs anywhere in the file.\n        :param column:\n            The column indicating the first character. (First character is 1)\n            column = None means there is an error with the whole line.\n            All combinations of None values are allowed for line and column,\n            Except line = None and column = <some number>\n        :param end_line:\n            The last related line in the file.\n        :param end_column:\n            The column indicating the last character.\n        :param severity:\n            Severity of this result.\n        :param additional_info:\n            A long description holding additional information about the issue\n            and/or how to fix it. You can use this like a manual entry for a\n            category of issues.\n        :param debug_msg:\n            A message which may help the user find out why this result was\n            yielded.\n        :param diffs:\n            A dictionary with filename as key and ``Diff`` object\n            associated with it as value.\n        :param confidence:\n            A number between 0 and 100 describing the likelihood of this result\n            being a real issue.\n        :param aspect:\n            An Aspect object which this result is associated to. Note that this\n            should be a leaf of the aspect tree! (If you have a node, spend\n            some time figuring out which of the leafs exactly your result\n            belongs to.)\n        \"\"\"\n        source_range = SourceRange.from_values(file,\n                                               line,\n                                               column,\n                                               end_line,\n                                               end_column)\n\n        return cls(origin=origin,\n                   message=message,\n                   affected_code=(source_range,),\n                   severity=severity,\n                   additional_info=additional_info,\n                   debug_msg=debug_msg,\n                   diffs=diffs,\n                   confidence=confidence,\n                   aspect=aspect,\n                   message_arguments=message_arguments)\n\n    def to_string_dict(self):\n        \"\"\"\n        Makes a dictionary which has all keys and values as strings and\n        contains all the data that the base Result has.\n\n        FIXME: diffs are not serialized ATM.\n        FIXME: Only the first SourceRange of affected_code is serialized. If\n        there are more, this data is currently missing.\n\n        :return: Dictionary with keys and values as string.\n        \"\"\"\n        retval = {}\n\n        members = ['id',\n                   'additional_info',\n                   'debug_msg',\n                   'message',\n                   'message_base',\n                   'message_arguments',\n                   'origin',\n                   'confidence']\n\n        for member in members:\n            value = getattr(self, member)\n            retval[member] = '' if value is None else str(value)\n\n        retval['severity'] = str(RESULT_SEVERITY.reverse.get(\n            self.severity, ''))\n        if len(self.affected_code) > 0:\n            retval['file'] = self.affected_code[0].file\n            line = self.affected_code[0].start.line\n            retval['line_nr'] = '' if line is None else str(line)\n        else:\n            retval['file'], retval['line_nr'] = '', ''\n\n        return retval\n\n    @enforce_signature\n    def apply(self, file_dict: dict):\n        \"\"\"\n        Applies all contained diffs to the given file_dict. This operation will\n        be done in-place.\n\n        :param file_dict: A dictionary containing all files with filename as\n                          key and all lines a value. Will be modified.\n        \"\"\"\n        for filename, diff in self.diffs.items():\n            file_dict[filename] = diff.modified\n\n    def __add__(self, other):\n        \"\"\"\n        Joins those patches to one patch.\n\n        :param other: The other patch.\n        \"\"\"\n        assert isinstance(self.diffs, dict)\n        assert isinstance(other.diffs, dict)\n\n        for filename in other.diffs:\n            if filename in self.diffs:\n                self.diffs[filename] += other.diffs[filename]\n            else:\n                self.diffs[filename] = other.diffs[filename]\n\n        return self\n\n    def overlaps(self, ranges):\n        \"\"\"\n        Determines if the result overlaps with source ranges provided.\n\n        :param ranges: A list SourceRange objects to check for overlap.\n        :return:       True if the ranges overlap with the result.\n        \"\"\"\n        if isinstance(ranges, SourceRange):\n            ranges = [ranges]\n\n        for range in ranges:\n            for self_range in self.affected_code:\n                if range.overlaps(self_range):\n                    return True\n\n        return False\n\n    def location_repr(self):\n        \"\"\"\n        Retrieves a string, that briefly represents\n        the affected code of the result.\n\n        :return: A string containing all of the affected files\n                 separated by a comma.\n        \"\"\"\n\n        if not self.affected_code:\n            return 'the whole project'\n\n        # Set important to exclude duplicate file names\n        range_paths = set(sourcerange.file\n                          for sourcerange in self.affected_code)\n\n        return ', '.join(repr(relpath(range_path))\n                         for range_path in sorted(range_paths))\n\n    def __json__(self, use_relpath=False):\n        _dict = get_public_members(self)\n        if use_relpath and _dict['diffs']:\n            _dict['diffs'] = {relpath(file): diff\n                              for file, diff in _dict['diffs'].items()}\n        _dict['aspect'] = type(self.aspect).__qualname__\n        return _dict\n", "path": "coalib/results/Result.py"}]}