We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Typo in docstring
In `coala/coalib/settings/Setting.py`,
In line 174, the word `of` should be replaced with `off`. 

--- 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/settings/Setting.py`
Content:
```
1 import os
2 from collections import Iterable, OrderedDict
3 
4 from coala_utils.decorators import (
5     enforce_signature,
6     generate_repr,
7 )
8 from coala_utils.string_processing.StringConverter import StringConverter
9 from coalib.bearlib.languages.Language import Language, UnknownLanguageError
10 from coalib.parsing.Globbing import glob_escape
11 from coalib.results.SourcePosition import SourcePosition
12 
13 
14 def path(obj, *args, **kwargs):
15     return obj.__path__(*args, **kwargs)
16 
17 
18 def path_list(obj, *args, **kwargs):
19     return obj.__path_list__(*args, **kwargs)
20 
21 
22 def url(obj, *args, **kwargs):
23     return obj.__url__(*args, **kwargs)
24 
25 
26 def glob(obj, *args, **kwargs):
27     """
28     Creates a path in which all special glob characters in all the
29     parent directories in the given setting are properly escaped.
30 
31     :param obj: The ``Setting`` object from which the key is obtained.
32     :return:    Returns a path in which special glob characters are escaped.
33     """
34     return obj.__glob__(*args, **kwargs)
35 
36 
37 def glob_list(obj, *args, **kwargs):
38     """
39     Creates a list of paths in which all special glob characters in all the
40     parent directories of all paths in the given setting are properly escaped.
41 
42     :param obj: The ``Setting`` object from which the key is obtained.
43     :return:    Returns a list of paths in which special glob characters are
44                 escaped.
45     """
46     return obj.__glob_list__(*args, **kwargs)
47 
48 
49 def language(name):
50     """
51     Convert a string into ``Language`` object.
52 
53     :param name:        String containing language name.
54     :return:            ``Language`` object.
55     :raises ValueError: If the ``name`` contain invalid language name.
56     """
57     try:
58         return Language[name]
59     except UnknownLanguageError as e:
60         raise ValueError(e)
61 
62 
63 def typed_list(conversion_func):
64     """
65     Creates a class that converts a setting into a list of elements each
66     converted with the given conversion function.
67 
68     :param conversion_func: The conversion function that converts a string into
69                             your desired list item object.
70     :return:                An instance of the created conversion class.
71     """
72 
73     class Converter:
74 
75         def __call__(self, setting):
76             return [conversion_func(StringConverter(elem))
77                     for elem in setting]
78 
79         def __repr__(self):
80             return 'typed_list(%s)' % conversion_func.__name__
81 
82     return Converter()
83 
84 
85 str_list = typed_list(str)
86 
87 
88 int_list = typed_list(int)
89 
90 
91 float_list = typed_list(float)
92 
93 
94 bool_list = typed_list(bool)
95 
96 
97 def typed_dict(key_type, value_type, default):
98     """
99     Creates a class that converts a setting into a dict with the given types.
100 
101     :param key_type:   The type conversion function for the keys.
102     :param value_type: The type conversion function for the values.
103     :param default:    The default value to use if no one is given by the user.
104     :return:           An instance of the created conversion class.
105     """
106 
107     class Converter:
108 
109         def __call__(self, setting):
110             return {key_type(StringConverter(key)):
111                     value_type(StringConverter(value))
112                     if value != '' else default
113                     for key, value in dict(setting).items()}
114 
115         def __repr__(self):
116             return 'typed_dict(%s, %s, default=%s)' % (
117                 key_type.__name__, value_type.__name__, default)
118 
119     return Converter()
120 
121 
122 def typed_ordered_dict(key_type, value_type, default):
123     """
124     Creates a class that converts a setting into an ordered dict with the
125     given types.
126 
127     :param key_type:   The type conversion function for the keys.
128     :param value_type: The type conversion function for the values.
129     :param default:    The default value to use if no one is given by the user.
130     :return:           An instance of the created conversion class.
131     """
132 
133     class Converter:
134 
135         def __call__(self, setting):
136             return OrderedDict((key_type(StringConverter(key)),
137                                 value_type(StringConverter(value))
138                                 if value != '' else default)
139                                for key, value in OrderedDict(setting).items())
140 
141         def __repr__(self):
142             return 'typed_ordered_dict(%s, %s, default=%s)' % (
143                 key_type.__name__, value_type.__name__, default)
144 
145     return Converter()
146 
147 
148 @generate_repr('key', 'value', 'origin', 'from_cli', 'to_append')
149 class Setting(StringConverter):
150     """
151     A Setting consists mainly of a key and a value. It mainly offers many
152     conversions into common data types.
153     """
154 
155     @enforce_signature
156     def __init__(self,
157                  key,
158                  value,
159                  origin: (str, SourcePosition) = '',
160                  strip_whitespaces: bool = True,
161                  list_delimiters: Iterable = (',', ';'),
162                  from_cli: bool = False,
163                  remove_empty_iter_elements: bool = True,
164                  to_append: bool = False):
165         """
166         Initializes a new Setting,
167 
168         :param key:                        The key of the Setting.
169         :param value:                      The value, if you apply conversions
170                                            to this object these will be applied
171                                            to this value.
172         :param origin:                     The originating file. This will be
173                                            used for path conversions and the
174                                            last part will be stripped of. If
175                                            you want to specify a directory as
176                                            origin be sure to end it with a
177                                            directory separator.
178         :param strip_whitespaces:          Whether to strip whitespaces from
179                                            the value or not
180         :param list_delimiters:            Delimiters for list conversion
181         :param from_cli:                   True if this setting was read by the
182                                            CliParser.
183         :param remove_empty_iter_elements: Whether to remove empty elements in
184                                            iterable values.
185         :param to_append:                  The boolean value if setting value
186                                            needs to be appended to a setting in
187                                            the defaults of a section.
188         """
189         self.to_append = to_append
190 
191         StringConverter.__init__(
192             self,
193             value,
194             strip_whitespaces=strip_whitespaces,
195             list_delimiters=list_delimiters,
196             remove_empty_iter_elements=remove_empty_iter_elements)
197 
198         self.from_cli = from_cli
199         self.key = key
200         self._origin = origin
201 
202     def __path__(self, origin=None, glob_escape_origin=False):
203         """
204         Determines the path of this setting.
205 
206         Note: You can also use this function on strings, in that case the
207         origin argument will be taken in every case.
208 
209         :param origin:             The origin file to take if no origin is
210                                    specified for the given setting. If you
211                                    want to provide a directory, make sure it
212                                    ends with a directory separator.
213         :param glob_escape_origin: When this is set to true, the origin of
214                                    this setting will be escaped with
215                                    ``glob_escape``.
216         :return:                   An absolute path.
217         :raises ValueError:        If no origin is specified in the setting
218                                    nor the given origin parameter.
219         """
220         strrep = str(self).strip()
221         if os.path.isabs(strrep):
222             return strrep
223 
224         if hasattr(self, 'origin') and self.origin != '':
225             origin = self.origin
226 
227         if origin is None:
228             raise ValueError('Cannot determine path without origin.')
229 
230         # We need to get full path before escaping since the full path
231         # may introduce unintended glob characters
232         origin = os.path.abspath(os.path.dirname(origin))
233 
234         if glob_escape_origin:
235             origin = glob_escape(origin)
236 
237         return os.path.normpath(os.path.join(origin, strrep))
238 
239     def __glob__(self, origin=None):
240         """
241         Determines the path of this setting with proper escaping of its
242         parent directories.
243 
244         :param origin:      The origin file to take if no origin is specified
245                             for the given setting. If you want to provide a
246                             directory, make sure it ends with a directory
247                             separator.
248         :return:            An absolute path in which the parent directories
249                             are escaped.
250         :raises ValueError: If no origin is specified in the setting nor the
251                             given origin parameter.
252         """
253         return Setting.__path__(self, origin, glob_escape_origin=True)
254 
255     def __path_list__(self):
256         """
257         Splits the value into a list and creates a path out of each item taking
258         the origin of the setting into account.
259 
260         :return: A list of absolute paths.
261         """
262         return [Setting.__path__(elem, self.origin) for elem in self]
263 
264     def __glob_list__(self):
265         """
266         Splits the value into a list and creates a path out of each item in
267         which the special glob characters in origin are escaped.
268 
269         :return: A list of absolute paths in which the special characters in
270                  the parent directories of the setting are escaped.
271         """
272         return [Setting.__glob__(elem, self.origin) for elem in self]
273 
274     def __iter__(self, remove_backslashes=True):
275         if self.to_append:
276             raise ValueError('Iteration on this object is invalid because the '
277                              'value is incomplete. Please access the value of '
278                              'the setting in a section to iterate through it.')
279         return StringConverter.__iter__(self, remove_backslashes)
280 
281     @property
282     def key(self):
283         return self._key
284 
285     @key.setter
286     def key(self, key):
287         newkey = str(key)
288         if newkey == '':
289             raise ValueError('An empty key is not allowed for a setting.')
290 
291         self._key = newkey
292 
293     @StringConverter.value.getter
294     def value(self):
295         if self.to_append:
296             raise ValueError('This property is invalid because the value is '
297                              'incomplete. Please access the value of the '
298                              'setting in a section to get the complete value.')
299         return self._value
300 
301     @property
302     def origin(self):
303         """
304         Returns the filename.
305         """
306         if isinstance(self._origin, SourcePosition):
307             return self._origin.filename
308         else:
309             return self._origin
310 
311     @property
312     def line_number(self):
313         if isinstance(self._origin, SourcePosition):
314             return self._origin.line
315         else:
316             raise TypeError("Instantiated with str 'origin' "
317                             'which does not have line numbers. '
318                             'Use SourcePosition for line numbers.')
319
```
--- 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/settings/Setting.py b/coalib/settings/Setting.py
--- a/coalib/settings/Setting.py
+++ b/coalib/settings/Setting.py
@@ -171,7 +171,7 @@
                                            to this value.
         :param origin:                     The originating file. This will be
                                            used for path conversions and the
-                                           last part will be stripped of. If
+                                           last part will be stripped off. If
                                            you want to specify a directory as
                                            origin be sure to end it with a
                                            directory separator.

{"golden_diff": "diff --git a/coalib/settings/Setting.py b/coalib/settings/Setting.py\n--- a/coalib/settings/Setting.py\n+++ b/coalib/settings/Setting.py\n@@ -171,7 +171,7 @@\n                                            to this value.\n         :param origin:                     The originating file. This will be\n                                            used for path conversions and the\n-                                           last part will be stripped of. If\n+                                           last part will be stripped off. If\n                                            you want to specify a directory as\n                                            origin be sure to end it with a\n                                            directory separator.\n", "issue": "Typo in docstring\nIn `coala/coalib/settings/Setting.py`,\r\nIn line 174, the word `of` should be replaced with `off`. \n", "before_files": [{"content": "import os\nfrom collections import Iterable, OrderedDict\n\nfrom coala_utils.decorators import (\n    enforce_signature,\n    generate_repr,\n)\nfrom coala_utils.string_processing.StringConverter import StringConverter\nfrom coalib.bearlib.languages.Language import Language, UnknownLanguageError\nfrom coalib.parsing.Globbing import glob_escape\nfrom coalib.results.SourcePosition import SourcePosition\n\n\ndef path(obj, *args, **kwargs):\n    return obj.__path__(*args, **kwargs)\n\n\ndef path_list(obj, *args, **kwargs):\n    return obj.__path_list__(*args, **kwargs)\n\n\ndef url(obj, *args, **kwargs):\n    return obj.__url__(*args, **kwargs)\n\n\ndef glob(obj, *args, **kwargs):\n    \"\"\"\n    Creates a path in which all special glob characters in all the\n    parent directories in the given setting are properly escaped.\n\n    :param obj: The ``Setting`` object from which the key is obtained.\n    :return:    Returns a path in which special glob characters are escaped.\n    \"\"\"\n    return obj.__glob__(*args, **kwargs)\n\n\ndef glob_list(obj, *args, **kwargs):\n    \"\"\"\n    Creates a list of paths in which all special glob characters in all the\n    parent directories of all paths in the given setting are properly escaped.\n\n    :param obj: The ``Setting`` object from which the key is obtained.\n    :return:    Returns a list of paths in which special glob characters are\n                escaped.\n    \"\"\"\n    return obj.__glob_list__(*args, **kwargs)\n\n\ndef language(name):\n    \"\"\"\n    Convert a string into ``Language`` object.\n\n    :param name:        String containing language name.\n    :return:            ``Language`` object.\n    :raises ValueError: If the ``name`` contain invalid language name.\n    \"\"\"\n    try:\n        return Language[name]\n    except UnknownLanguageError as e:\n        raise ValueError(e)\n\n\ndef typed_list(conversion_func):\n    \"\"\"\n    Creates a class that converts a setting into a list of elements each\n    converted with the given conversion function.\n\n    :param conversion_func: The conversion function that converts a string into\n                            your desired list item object.\n    :return:                An instance of the created conversion class.\n    \"\"\"\n\n    class Converter:\n\n        def __call__(self, setting):\n            return [conversion_func(StringConverter(elem))\n                    for elem in setting]\n\n        def __repr__(self):\n            return 'typed_list(%s)' % conversion_func.__name__\n\n    return Converter()\n\n\nstr_list = typed_list(str)\n\n\nint_list = typed_list(int)\n\n\nfloat_list = typed_list(float)\n\n\nbool_list = typed_list(bool)\n\n\ndef typed_dict(key_type, value_type, default):\n    \"\"\"\n    Creates a class that converts a setting into a dict with the given types.\n\n    :param key_type:   The type conversion function for the keys.\n    :param value_type: The type conversion function for the values.\n    :param default:    The default value to use if no one is given by the user.\n    :return:           An instance of the created conversion class.\n    \"\"\"\n\n    class Converter:\n\n        def __call__(self, setting):\n            return {key_type(StringConverter(key)):\n                    value_type(StringConverter(value))\n                    if value != '' else default\n                    for key, value in dict(setting).items()}\n\n        def __repr__(self):\n            return 'typed_dict(%s, %s, default=%s)' % (\n                key_type.__name__, value_type.__name__, default)\n\n    return Converter()\n\n\ndef typed_ordered_dict(key_type, value_type, default):\n    \"\"\"\n    Creates a class that converts a setting into an ordered dict with the\n    given types.\n\n    :param key_type:   The type conversion function for the keys.\n    :param value_type: The type conversion function for the values.\n    :param default:    The default value to use if no one is given by the user.\n    :return:           An instance of the created conversion class.\n    \"\"\"\n\n    class Converter:\n\n        def __call__(self, setting):\n            return OrderedDict((key_type(StringConverter(key)),\n                                value_type(StringConverter(value))\n                                if value != '' else default)\n                               for key, value in OrderedDict(setting).items())\n\n        def __repr__(self):\n            return 'typed_ordered_dict(%s, %s, default=%s)' % (\n                key_type.__name__, value_type.__name__, default)\n\n    return Converter()\n\n\n@generate_repr('key', 'value', 'origin', 'from_cli', 'to_append')\nclass Setting(StringConverter):\n    \"\"\"\n    A Setting consists mainly of a key and a value. It mainly offers many\n    conversions into common data types.\n    \"\"\"\n\n    @enforce_signature\n    def __init__(self,\n                 key,\n                 value,\n                 origin: (str, SourcePosition) = '',\n                 strip_whitespaces: bool = True,\n                 list_delimiters: Iterable = (',', ';'),\n                 from_cli: bool = False,\n                 remove_empty_iter_elements: bool = True,\n                 to_append: bool = False):\n        \"\"\"\n        Initializes a new Setting,\n\n        :param key:                        The key of the Setting.\n        :param value:                      The value, if you apply conversions\n                                           to this object these will be applied\n                                           to this value.\n        :param origin:                     The originating file. This will be\n                                           used for path conversions and the\n                                           last part will be stripped of. If\n                                           you want to specify a directory as\n                                           origin be sure to end it with a\n                                           directory separator.\n        :param strip_whitespaces:          Whether to strip whitespaces from\n                                           the value or not\n        :param list_delimiters:            Delimiters for list conversion\n        :param from_cli:                   True if this setting was read by the\n                                           CliParser.\n        :param remove_empty_iter_elements: Whether to remove empty elements in\n                                           iterable values.\n        :param to_append:                  The boolean value if setting value\n                                           needs to be appended to a setting in\n                                           the defaults of a section.\n        \"\"\"\n        self.to_append = to_append\n\n        StringConverter.__init__(\n            self,\n            value,\n            strip_whitespaces=strip_whitespaces,\n            list_delimiters=list_delimiters,\n            remove_empty_iter_elements=remove_empty_iter_elements)\n\n        self.from_cli = from_cli\n        self.key = key\n        self._origin = origin\n\n    def __path__(self, origin=None, glob_escape_origin=False):\n        \"\"\"\n        Determines the path of this setting.\n\n        Note: You can also use this function on strings, in that case the\n        origin argument will be taken in every case.\n\n        :param origin:             The origin file to take if no origin is\n                                   specified for the given setting. If you\n                                   want to provide a directory, make sure it\n                                   ends with a directory separator.\n        :param glob_escape_origin: When this is set to true, the origin of\n                                   this setting will be escaped with\n                                   ``glob_escape``.\n        :return:                   An absolute path.\n        :raises ValueError:        If no origin is specified in the setting\n                                   nor the given origin parameter.\n        \"\"\"\n        strrep = str(self).strip()\n        if os.path.isabs(strrep):\n            return strrep\n\n        if hasattr(self, 'origin') and self.origin != '':\n            origin = self.origin\n\n        if origin is None:\n            raise ValueError('Cannot determine path without origin.')\n\n        # We need to get full path before escaping since the full path\n        # may introduce unintended glob characters\n        origin = os.path.abspath(os.path.dirname(origin))\n\n        if glob_escape_origin:\n            origin = glob_escape(origin)\n\n        return os.path.normpath(os.path.join(origin, strrep))\n\n    def __glob__(self, origin=None):\n        \"\"\"\n        Determines the path of this setting with proper escaping of its\n        parent directories.\n\n        :param origin:      The origin file to take if no origin is specified\n                            for the given setting. If you want to provide a\n                            directory, make sure it ends with a directory\n                            separator.\n        :return:            An absolute path in which the parent directories\n                            are escaped.\n        :raises ValueError: If no origin is specified in the setting nor the\n                            given origin parameter.\n        \"\"\"\n        return Setting.__path__(self, origin, glob_escape_origin=True)\n\n    def __path_list__(self):\n        \"\"\"\n        Splits the value into a list and creates a path out of each item taking\n        the origin of the setting into account.\n\n        :return: A list of absolute paths.\n        \"\"\"\n        return [Setting.__path__(elem, self.origin) for elem in self]\n\n    def __glob_list__(self):\n        \"\"\"\n        Splits the value into a list and creates a path out of each item in\n        which the special glob characters in origin are escaped.\n\n        :return: A list of absolute paths in which the special characters in\n                 the parent directories of the setting are escaped.\n        \"\"\"\n        return [Setting.__glob__(elem, self.origin) for elem in self]\n\n    def __iter__(self, remove_backslashes=True):\n        if self.to_append:\n            raise ValueError('Iteration on this object is invalid because the '\n                             'value is incomplete. Please access the value of '\n                             'the setting in a section to iterate through it.')\n        return StringConverter.__iter__(self, remove_backslashes)\n\n    @property\n    def key(self):\n        return self._key\n\n    @key.setter\n    def key(self, key):\n        newkey = str(key)\n        if newkey == '':\n            raise ValueError('An empty key is not allowed for a setting.')\n\n        self._key = newkey\n\n    @StringConverter.value.getter\n    def value(self):\n        if self.to_append:\n            raise ValueError('This property is invalid because the value is '\n                             'incomplete. Please access the value of the '\n                             'setting in a section to get the complete value.')\n        return self._value\n\n    @property\n    def origin(self):\n        \"\"\"\n        Returns the filename.\n        \"\"\"\n        if isinstance(self._origin, SourcePosition):\n            return self._origin.filename\n        else:\n            return self._origin\n\n    @property\n    def line_number(self):\n        if isinstance(self._origin, SourcePosition):\n            return self._origin.line\n        else:\n            raise TypeError(\"Instantiated with str 'origin' \"\n                            'which does not have line numbers. '\n                            'Use SourcePosition for line numbers.')\n", "path": "coalib/settings/Setting.py"}], "after_files": [{"content": "import os\nfrom collections import Iterable, OrderedDict\n\nfrom coala_utils.decorators import (\n    enforce_signature,\n    generate_repr,\n)\nfrom coala_utils.string_processing.StringConverter import StringConverter\nfrom coalib.bearlib.languages.Language import Language, UnknownLanguageError\nfrom coalib.parsing.Globbing import glob_escape\nfrom coalib.results.SourcePosition import SourcePosition\n\n\ndef path(obj, *args, **kwargs):\n    return obj.__path__(*args, **kwargs)\n\n\ndef path_list(obj, *args, **kwargs):\n    return obj.__path_list__(*args, **kwargs)\n\n\ndef url(obj, *args, **kwargs):\n    return obj.__url__(*args, **kwargs)\n\n\ndef glob(obj, *args, **kwargs):\n    \"\"\"\n    Creates a path in which all special glob characters in all the\n    parent directories in the given setting are properly escaped.\n\n    :param obj: The ``Setting`` object from which the key is obtained.\n    :return:    Returns a path in which special glob characters are escaped.\n    \"\"\"\n    return obj.__glob__(*args, **kwargs)\n\n\ndef glob_list(obj, *args, **kwargs):\n    \"\"\"\n    Creates a list of paths in which all special glob characters in all the\n    parent directories of all paths in the given setting are properly escaped.\n\n    :param obj: The ``Setting`` object from which the key is obtained.\n    :return:    Returns a list of paths in which special glob characters are\n                escaped.\n    \"\"\"\n    return obj.__glob_list__(*args, **kwargs)\n\n\ndef language(name):\n    \"\"\"\n    Convert a string into ``Language`` object.\n\n    :param name:        String containing language name.\n    :return:            ``Language`` object.\n    :raises ValueError: If the ``name`` contain invalid language name.\n    \"\"\"\n    try:\n        return Language[name]\n    except UnknownLanguageError as e:\n        raise ValueError(e)\n\n\ndef typed_list(conversion_func):\n    \"\"\"\n    Creates a class that converts a setting into a list of elements each\n    converted with the given conversion function.\n\n    :param conversion_func: The conversion function that converts a string into\n                            your desired list item object.\n    :return:                An instance of the created conversion class.\n    \"\"\"\n\n    class Converter:\n\n        def __call__(self, setting):\n            return [conversion_func(StringConverter(elem))\n                    for elem in setting]\n\n        def __repr__(self):\n            return 'typed_list(%s)' % conversion_func.__name__\n\n    return Converter()\n\n\nstr_list = typed_list(str)\n\n\nint_list = typed_list(int)\n\n\nfloat_list = typed_list(float)\n\n\nbool_list = typed_list(bool)\n\n\ndef typed_dict(key_type, value_type, default):\n    \"\"\"\n    Creates a class that converts a setting into a dict with the given types.\n\n    :param key_type:   The type conversion function for the keys.\n    :param value_type: The type conversion function for the values.\n    :param default:    The default value to use if no one is given by the user.\n    :return:           An instance of the created conversion class.\n    \"\"\"\n\n    class Converter:\n\n        def __call__(self, setting):\n            return {key_type(StringConverter(key)):\n                    value_type(StringConverter(value))\n                    if value != '' else default\n                    for key, value in dict(setting).items()}\n\n        def __repr__(self):\n            return 'typed_dict(%s, %s, default=%s)' % (\n                key_type.__name__, value_type.__name__, default)\n\n    return Converter()\n\n\ndef typed_ordered_dict(key_type, value_type, default):\n    \"\"\"\n    Creates a class that converts a setting into an ordered dict with the\n    given types.\n\n    :param key_type:   The type conversion function for the keys.\n    :param value_type: The type conversion function for the values.\n    :param default:    The default value to use if no one is given by the user.\n    :return:           An instance of the created conversion class.\n    \"\"\"\n\n    class Converter:\n\n        def __call__(self, setting):\n            return OrderedDict((key_type(StringConverter(key)),\n                                value_type(StringConverter(value))\n                                if value != '' else default)\n                               for key, value in OrderedDict(setting).items())\n\n        def __repr__(self):\n            return 'typed_ordered_dict(%s, %s, default=%s)' % (\n                key_type.__name__, value_type.__name__, default)\n\n    return Converter()\n\n\n@generate_repr('key', 'value', 'origin', 'from_cli', 'to_append')\nclass Setting(StringConverter):\n    \"\"\"\n    A Setting consists mainly of a key and a value. It mainly offers many\n    conversions into common data types.\n    \"\"\"\n\n    @enforce_signature\n    def __init__(self,\n                 key,\n                 value,\n                 origin: (str, SourcePosition) = '',\n                 strip_whitespaces: bool = True,\n                 list_delimiters: Iterable = (',', ';'),\n                 from_cli: bool = False,\n                 remove_empty_iter_elements: bool = True,\n                 to_append: bool = False):\n        \"\"\"\n        Initializes a new Setting,\n\n        :param key:                        The key of the Setting.\n        :param value:                      The value, if you apply conversions\n                                           to this object these will be applied\n                                           to this value.\n        :param origin:                     The originating file. This will be\n                                           used for path conversions and the\n                                           last part will be stripped off. If\n                                           you want to specify a directory as\n                                           origin be sure to end it with a\n                                           directory separator.\n        :param strip_whitespaces:          Whether to strip whitespaces from\n                                           the value or not\n        :param list_delimiters:            Delimiters for list conversion\n        :param from_cli:                   True if this setting was read by the\n                                           CliParser.\n        :param remove_empty_iter_elements: Whether to remove empty elements in\n                                           iterable values.\n        :param to_append:                  The boolean value if setting value\n                                           needs to be appended to a setting in\n                                           the defaults of a section.\n        \"\"\"\n        self.to_append = to_append\n\n        StringConverter.__init__(\n            self,\n            value,\n            strip_whitespaces=strip_whitespaces,\n            list_delimiters=list_delimiters,\n            remove_empty_iter_elements=remove_empty_iter_elements)\n\n        self.from_cli = from_cli\n        self.key = key\n        self._origin = origin\n\n    def __path__(self, origin=None, glob_escape_origin=False):\n        \"\"\"\n        Determines the path of this setting.\n\n        Note: You can also use this function on strings, in that case the\n        origin argument will be taken in every case.\n\n        :param origin:             The origin file to take if no origin is\n                                   specified for the given setting. If you\n                                   want to provide a directory, make sure it\n                                   ends with a directory separator.\n        :param glob_escape_origin: When this is set to true, the origin of\n                                   this setting will be escaped with\n                                   ``glob_escape``.\n        :return:                   An absolute path.\n        :raises ValueError:        If no origin is specified in the setting\n                                   nor the given origin parameter.\n        \"\"\"\n        strrep = str(self).strip()\n        if os.path.isabs(strrep):\n            return strrep\n\n        if hasattr(self, 'origin') and self.origin != '':\n            origin = self.origin\n\n        if origin is None:\n            raise ValueError('Cannot determine path without origin.')\n\n        # We need to get full path before escaping since the full path\n        # may introduce unintended glob characters\n        origin = os.path.abspath(os.path.dirname(origin))\n\n        if glob_escape_origin:\n            origin = glob_escape(origin)\n\n        return os.path.normpath(os.path.join(origin, strrep))\n\n    def __glob__(self, origin=None):\n        \"\"\"\n        Determines the path of this setting with proper escaping of its\n        parent directories.\n\n        :param origin:      The origin file to take if no origin is specified\n                            for the given setting. If you want to provide a\n                            directory, make sure it ends with a directory\n                            separator.\n        :return:            An absolute path in which the parent directories\n                            are escaped.\n        :raises ValueError: If no origin is specified in the setting nor the\n                            given origin parameter.\n        \"\"\"\n        return Setting.__path__(self, origin, glob_escape_origin=True)\n\n    def __path_list__(self):\n        \"\"\"\n        Splits the value into a list and creates a path out of each item taking\n        the origin of the setting into account.\n\n        :return: A list of absolute paths.\n        \"\"\"\n        return [Setting.__path__(elem, self.origin) for elem in self]\n\n    def __glob_list__(self):\n        \"\"\"\n        Splits the value into a list and creates a path out of each item in\n        which the special glob characters in origin are escaped.\n\n        :return: A list of absolute paths in which the special characters in\n                 the parent directories of the setting are escaped.\n        \"\"\"\n        return [Setting.__glob__(elem, self.origin) for elem in self]\n\n    def __iter__(self, remove_backslashes=True):\n        if self.to_append:\n            raise ValueError('Iteration on this object is invalid because the '\n                             'value is incomplete. Please access the value of '\n                             'the setting in a section to iterate through it.')\n        return StringConverter.__iter__(self, remove_backslashes)\n\n    @property\n    def key(self):\n        return self._key\n\n    @key.setter\n    def key(self, key):\n        newkey = str(key)\n        if newkey == '':\n            raise ValueError('An empty key is not allowed for a setting.')\n\n        self._key = newkey\n\n    @StringConverter.value.getter\n    def value(self):\n        if self.to_append:\n            raise ValueError('This property is invalid because the value is '\n                             'incomplete. Please access the value of the '\n                             'setting in a section to get the complete value.')\n        return self._value\n\n    @property\n    def origin(self):\n        \"\"\"\n        Returns the filename.\n        \"\"\"\n        if isinstance(self._origin, SourcePosition):\n            return self._origin.filename\n        else:\n            return self._origin\n\n    @property\n    def line_number(self):\n        if isinstance(self._origin, SourcePosition):\n            return self._origin.line\n        else:\n            raise TypeError(\"Instantiated with str 'origin' \"\n                            'which does not have line numbers. '\n                            'Use SourcePosition for line numbers.')\n", "path": "coalib/settings/Setting.py"}]}