summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2015-07-03 06:49:16 +0200
committerAnthon van der Neut <anthon@mnt.org>2015-07-03 06:49:16 +0200
commit52aea5baaaf1fbfc7602228cb82a269e1449ec43 (patch)
tree6e53704483b310c9f0019ffcf1c1d9787864d7c4
parent591b1005706b0db167d5c55eefee7a0b0f0442e6 (diff)
downloadruamel.yaml-52aea5baaaf1fbfc7602228cb82a269e1449ec43.tar.gz
parameterised maximum lenght of simple key
-rw-r--r--py/emitter.py4
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)