aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/attrs/attr/converters.py
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/python/attrs/attr/converters.py
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/attrs/attr/converters.py')
-rw-r--r--contrib/python/attrs/attr/converters.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/contrib/python/attrs/attr/converters.py b/contrib/python/attrs/attr/converters.py
index 2777db6d0a..d36652e31c 100644
--- a/contrib/python/attrs/attr/converters.py
+++ b/contrib/python/attrs/attr/converters.py
@@ -1,12 +1,12 @@
-"""
-Commonly useful converters.
-"""
-
-from __future__ import absolute_import, division, print_function
-
+"""
+Commonly useful converters.
+"""
+
+from __future__ import absolute_import, division, print_function
+
from ._compat import PY2
from ._make import NOTHING, Factory, pipe
-
+
if not PY2:
import inspect
@@ -20,25 +20,25 @@ __all__ = [
]
-def optional(converter):
- """
- A converter that allows an attribute to be optional. An optional attribute
- is one which can be set to ``None``.
-
+def optional(converter):
+ """
+ A converter that allows an attribute to be optional. An optional attribute
+ is one which can be set to ``None``.
+
Type annotations will be inferred from the wrapped converter's, if it
has any.
- :param callable converter: the converter that is used for non-``None``
- values.
-
+ :param callable converter: the converter that is used for non-``None``
+ values.
+
.. versionadded:: 17.1.0
- """
-
- def optional_converter(val):
- if val is None:
- return None
- return converter(val)
-
+ """
+
+ def optional_converter(val):
+ if val is None:
+ return None
+ return converter(val)
+
if not PY2:
sig = None
try:
@@ -56,7 +56,7 @@ def optional(converter):
sig.return_annotation
]
- return optional_converter
+ return optional_converter
def default_if_none(default=NOTHING, factory=None):