Skip to content

Commit 3d5211a

Browse files
author
Sylvain MARIE
committed
Replaced tuple type hint with Sequence, which is better for longer-term evolutions.
1 parent e8b41be commit 3d5211a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

yamlable/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __exit__(self, exception_type, exception_value, traceback):
2929
import six
3030

3131
try: # python 3.5+
32-
from typing import Union, TypeVar, Dict, Any, Tuple
32+
from typing import Union, TypeVar, Dict, Any, Sequence
3333

3434
Y = TypeVar('Y', bound='AbstractYamlObject')
3535

@@ -64,9 +64,9 @@ class AbstractYamlObject(six.with_metaclass(ABCMeta, object)):
6464
# " as yaml scalars." % type(self).__name__)
6565
#
6666
# def __to_yaml_sequence__(self):
67-
# # type: (...) -> Tuple[Any]
67+
# # type: (...) -> Sequence[Any]
6868
# """
69-
# Implementors should transform the object into a tuple containing all information necessary to decode the
69+
# Implementors should transform the object into a Sequence containing all information necessary to decode the
7070
# object as a YAML sequence in the future.
7171
#
7272
# Default implementation raises an error.
@@ -118,12 +118,12 @@ def __from_yaml_scalar__(cls, # type: Type[Y]
118118

119119
@classmethod
120120
def __from_yaml_sequence__(cls, # type: Type[Y]
121-
seq, # type: Tuple[Any]
121+
seq, # type: Sequence[Any]
122122
yaml_tag # type: str
123123
):
124124
# type: (...) -> Y
125125
"""
126-
Implementors should transform the given tuple (read from yaml by the pyYaml stack) into an object instance.
126+
Implementors should transform the given Sequence (read from yaml by the pyYaml stack) into an object instance.
127127
The yaml tag associated to this object, read in the yaml document, is provided in parameter.
128128
129129
Note that for YamlAble and YamlObject2 subclasses, if this method is called the yaml tag will already have
@@ -288,7 +288,7 @@ def read_yaml_node_as_dict(loader, node):
288288

289289

290290
def read_yaml_node_as_sequence(loader, node):
291-
# type: (...) -> Tuple
291+
# type: (...) -> Sequence
292292
"""
293293
Utility method to read a yaml node into a sequence
294294

0 commit comments

Comments
 (0)