summaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-03-16 08:50:30 +0100
committerAnthon van der Neut <anthon@mnt.org>2017-03-16 08:50:30 +0100
commitf75754aa90ea4d53f87aba5fce692185a25514c3 (patch)
tree678c37afebe1efd786d513e222a053a3cfe76a07 /util.py
parent65537ac45d2fe35a98322aea5e6056baa1aefd8a (diff)
downloadruamel.yaml-f75754aa90ea4d53f87aba5fce692185a25514c3.tar.gz
some changes for mypy --strict
Diffstat (limited to 'util.py')
-rw-r--r--util.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/util.py b/util.py
index 25c64e4..40aed9e 100644
--- a/util.py
+++ b/util.py
@@ -4,8 +4,9 @@
some helper functions that might be generally useful
"""
-from __future__ import print_function
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
+
+from typing import Any, Dict, Optional, List # NOQA
from .compat import text_type, binary_type
@@ -16,6 +17,7 @@ from .compat import text_type, binary_type
# that check this routines output against a known piece of your YAML
# before upgrades to this code break your round-tripped YAML
def load_yaml_guess_indent(stream, **kw):
+ # type: (Any, Any) -> Any
"""guess the indent and block sequence indent of yaml stream/string
returns round_trip_loaded stream, indent level, block sequence indent
@@ -27,6 +29,7 @@ def load_yaml_guess_indent(stream, **kw):
# load a yaml file guess the indentation, if you use TABs ...
def leading_spaces(l):
+ # type: (Any) -> int
idx = 0
while idx < len(l) and l[idx] == ' ':
idx += 1
@@ -76,6 +79,7 @@ def load_yaml_guess_indent(stream, **kw):
def configobj_walker(cfg):
+ # type: (Any) -> Any
"""
walks over a ConfigObj (INI file with comments) generating
corresponding YAML output (including comments
@@ -94,6 +98,7 @@ def configobj_walker(cfg):
def _walk_section(s, level=0):
+ # type: (Any, int) -> Any
from configobj import Section
assert isinstance(s, Section)
indent = u' ' * level