diff options
author | Anthon van der Neut <anthon@mnt.org> | 2021-04-19 08:17:05 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2021-04-19 08:17:05 +0200 |
commit | 3d77f16e00124b74e150625396617b41e41da014 (patch) | |
tree | ed01337ba7c78a5a5e68255a7a574e00e78556fc /compat.py | |
parent | 54cb146e541b557471a19fcd884abd7e441d85b8 (diff) | |
download | ruamel.yaml-3d77f16e00124b74e150625396617b41e41da014.tar.gz |
removed (object), prepare new RTScanner
Diffstat (limited to 'compat.py')
-rw-r--r-- | compat.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -95,7 +95,7 @@ if 'RUAMELDEBUG' in os.environ: if bool(_debug): - class ObjectCounter(object): + class ObjectCounter: def __init__(self): # type: () -> None self.map = {} # type: Dict[Any, Any] @@ -128,7 +128,7 @@ def dbg(val=None): return _debug & val -class Nprint(object): +class Nprint: def __init__(self, file_name=None): # type: (Any) -> None self._max_print = None # type: Any @@ -162,6 +162,9 @@ class Nprint(object): self._max_print = i self._count = None + def fp(self, mode='a'): + out = sys.stdout if self._file_name is None else open(self._file_name, mode) + return out nprint = Nprint() nprintf = Nprint('/var/tmp/ruamel.yaml.log') |