diff options
author | Anthon van der Neut <anthon@mnt.org> | 2015-07-03 06:49:16 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2015-07-03 06:49:16 +0200 |
commit | 52aea5baaaf1fbfc7602228cb82a269e1449ec43 (patch) | |
tree | 6e53704483b310c9f0019ffcf1c1d9787864d7c4 | |
parent | 591b1005706b0db167d5c55eefee7a0b0f0442e6 (diff) | |
download | ruamel.yaml-52aea5baaaf1fbfc7602228cb82a269e1449ec43.tar.gz |
parameterised maximum lenght of simple key
-rw-r--r-- | py/emitter.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/py/emitter.py b/py/emitter.py index c5c0286..2e5ebdc 100644 --- a/py/emitter.py +++ b/py/emitter.py @@ -40,6 +40,8 @@ class Emitter(object): u'tag:yaml.org,2002:': u'!!', } + MAX_SIMPLE_KEY_LENGTH = 128 + def __init__(self, stream, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None): @@ -499,7 +501,7 @@ class Emitter(object): if self.analysis is None: self.analysis = self.analyze_scalar(self.event.value) length += len(self.analysis.scalar) - return (length < 128 and ( + return (length < self.MAX_SIMPLE_KEY_LENGTH and ( isinstance(self.event, AliasEvent) or (isinstance(self.event, ScalarEvent) and not self.analysis.empty and not self.analysis.multiline) |