aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/attrs/attr/converters.py
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/python/attrs/attr/converters.py
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 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 d36652e31c..2777db6d0a 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):