Skip to content

Commit fb60857

Browse files
author
Sylvain MARIE
committed
Flake8 fixes
1 parent ccc3ee9 commit fb60857

File tree

9 files changed

+39
-25
lines changed

9 files changed

+39
-25
lines changed

pyfields/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
3+
#
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
15
from .typing_utils import FieldTypeError
26
from .core import field, Field, FieldError, MandatoryFieldInitError, UnsupportedOnNativeFieldError, \
37
ReadOnlyFieldError, NoneError

pyfields/autofields_.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Authors: Sylvain Marie <[email protected]>
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
23
#
3-
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
45
import sys
56
from copy import deepcopy
67
from inspect import isdatadescriptor, ismethoddescriptor

pyfields/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Authors: Sylvain Marie <[email protected]>
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
23
#
3-
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
4-
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
55
import sys
66
from enum import Enum
77
from textwrap import dedent

pyfields/helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Authors: Sylvain Marie <[email protected]>
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
23
#
3-
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
45
import sys
56
from copy import copy, deepcopy
67
from inspect import getmro, isclass

pyfields/init_makers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Authors: Sylvain Marie <[email protected]>
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
23
#
3-
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
45
import sys
56
from inspect import isfunction, getmro
67
from itertools import islice

pyfields/init_makers.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
3+
#
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
15
from typing import Union, Any, Callable, Iterable
26

37
from pyfields.core import Field

pyfields/typing_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Authors: Sylvain Marie <[email protected]>
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
23
#
3-
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
45
import sys
56

67

pyfields/validate_n_convert.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Authors: Sylvain Marie <[email protected]>
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
23
#
3-
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
45
import sys
56
from collections import OrderedDict
67

@@ -29,7 +30,7 @@
2930
ValidationFunc = Union[Callable[[Any], Any],
3031
Callable[[Any, Any], Any],
3132
Callable[[Any, Any, Any], Any]]
32-
"""A validation function is a callable with signature (val), (obj, val) or (obj, field, val), returning `True`
33+
"""A validation function is a callable with signature (val), (obj, val) or (obj, field, val), returning `True`
3334
or `None` in case of success"""
3435

3536
try:
@@ -55,8 +56,8 @@
5556
Iterable[ValidatorDef],
5657
Mapping[VFDefinitionElement, Union[VFDefinitionElement,
5758
Tuple[VFDefinitionElement, ...]]]]
58-
"""Several validators can be provided as a singleton, iterable, or dict-like. In that case the value can be a
59-
single variable or a tuple, and it will be combined with the key to form the validator. So you can use any of
59+
"""Several validators can be provided as a singleton, iterable, or dict-like. In that case the value can be a
60+
single variable or a tuple, and it will be combined with the key to form the validator. So you can use any of
6061
the elements defining a validators as the key."""
6162

6263
# shortcut name used everywhere. Less explicit
@@ -171,7 +172,7 @@ def make_validator_callable(validation_callable, # type: ValidationFunc
171172
raise ValueError(
172173
"validation function should accept 1, 2, or 3 arguments at least. `f(val)`, `f(obj, val)` or "
173174
"`f(obj, field, val)`")
174-
elif nb_args == 1 or (nb_args == 0 and nbvarargs >= 1): # varargs default to one argument (compliance with old mini lambda)
175+
elif nb_args == 1 or (nb_args == 0 and nbvarargs >= 1): # varargs default to one argument (compliance with old mini lambda) # noqa
175176
# `f(val)`
176177
def new_validation_callable(val, **ctx):
177178
return validation_callable(val)
@@ -337,7 +338,7 @@ def __init__(self, convert_fun, name=None, accepts_fun=None):
337338
ConverterFunc = Union[Callable[[Any], Any],
338339
Callable[[Any, Any], Any],
339340
Callable[[Any, Any, Any], Any]]
340-
"""A converter function is a callable with signature (val), (obj, val) or (obj, field, val), returning the
341+
"""A converter function is a callable with signature (val), (obj, val) or (obj, field, val), returning the
341342
converted value in case of success"""
342343

343344
try:
@@ -364,15 +365,16 @@ def __init__(self, convert_fun, name=None, accepts_fun=None):
364365
Converters = OneOrSeveralConverterDefinitions
365366

366367

367-
def make_3params_callable(f, # Union[ValidationFunc, ConverterFunc]
368+
def make_3params_callable(f, # type: Union[ValidationFunc, ConverterFunc]
368369
is_mini_lambda=False # type: bool
369370
):
370371
# type: (...) -> Callable[[Any, 'Field', Any], Any]
371372
"""
372373
Transforms the provided validation or conversion callable into a callable with 3 arguments (obj, field, val).
373374
374375
:param f:
375-
:param is_mini_lambda: a boolean indicating if the function comes from a mini lambda. In which case we know the signature has one param only (x)
376+
:param is_mini_lambda: a boolean indicating if the function comes from a mini lambda. In which case we know the
377+
signature has one param only (x)
376378
:return:
377379
"""
378380
# support several cases for the function signature
@@ -600,7 +602,7 @@ def __str__(self):
600602
% (self.value_to_convert, err_dct_to_str(self.err_dct))
601603

602604

603-
def err_dct_to_str(err_dct # Dict[Converter, str]
605+
def err_dct_to_str(err_dct # type: Dict[Converter, str]
604606
):
605607
# type: (...) -> str
606608
msg = ""
@@ -617,7 +619,7 @@ class DetailedConversionResults(object):
617619
__slots__ = 'value_to_convert', 'field', 'obj', 'err_dct', 'winning_converter', 'converted_value'
618620

619621
def __init__(self, value_to_convert, field, obj, err_dct, winning_converter, converted_value):
620-
self.value_to_convert= value_to_convert
622+
self.value_to_convert = value_to_convert
621623
self.field = field
622624
self.obj = obj
623625
self.err_dct = err_dct

pyfields/validate_n_convert.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Authors: Sylvain Marie <[email protected]>
1+
# Authors: Sylvain MARIE <[email protected]>
2+
# + All contributors to <https://github.com/smarie/python-pyfields>
23
#
3-
# Copyright (c) Schneider Electric Industries, 2019. All right reserved.
4-
4+
# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE>
55
from valid8 import Validator, ValidationError, ValidationFailure
66
from valid8.base import getfullargspec as v8_getfullargspec, get_callable_name, is_mini_lambda
77

0 commit comments

Comments
 (0)