You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:10:18 UTC
[buildstream] 01/06: _yaml.py: Stop stripping whitespace from
loaded YAML
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/stop-stripping-whitespace
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit c5060461949444e81c37437010878beda973bcb8
Author: Tristan Van Berkom <tr...@codethink.co.uk>
AuthorDate: Tue Dec 11 18:36:59 2018 +0900
_yaml.py: Stop stripping whitespace from loaded YAML
Whitespace is already stripped from strings by the YAML library unless
it is explicitly quoted to have leading and trailing whitespace.
This fixes issue #403
---
buildstream/_yaml.py | 7 -------
1 file changed, 7 deletions(-)
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py
index 8d7302b..125d0e1 100644
--- a/buildstream/_yaml.py
+++ b/buildstream/_yaml.py
@@ -360,9 +360,6 @@ _sentinel = object()
# Raises:
# LoadError, when the value found is not of the expected type
#
-# Note:
-# Returned strings are stripped of leading and trailing whitespace
-#
def node_get(node, expected_type, key, indices=None, *, default_value=_sentinel, allow_none=False):
value = node.get(key, default_value)
provenance = node_get_provenance(node)
@@ -407,10 +404,6 @@ def node_get(node, expected_type, key, indices=None, *, default_value=_sentinel,
"{}: Value of '{}' is not of the expected type '{}'"
.format(provenance, path, expected_type.__name__))
- # Trim it at the bud, let all loaded strings from yaml be stripped of whitespace
- if isinstance(value, str):
- value = value.strip()
-
return value