Yamlpath

Latest version: v3.8.2

Safety actively analyzes 630169 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 9

3.2.0

Enhancements:
* Expanded YAML Path Search Expressions such that the OPERAND of a Search
Expression may be a sub-YAML Path. This enables searching descendent nodes
-- without moving the document pointer -- to yield ancestors with matching
descendants. This has more utility when searching against Arrays-of-Hashes.

Bug Fixes:
* Date values in YAML could not be written to JSON streams; the JSON renderer
would generate an incompatibility error. Now, dates are written as Strings
to JSON. This affected: yaml-get, yaml-set (in stream mode), yaml-merge, and
yaml-paths.

3.1.0

Enhancements:
* yaml-set can now delete nodes when using --delete rather than other input
arguments.
* A new command-line tool has been created, yaml-validate, which validates
YAML/JSON/compatible single- and multi-documents (files or STDIN).

Bug Fixes:
* The yaml-merge command-line tool wasn't allowing Scalar values supplied via
STDIN -- with no structure, just bare Scalar values -- to be appended to
exising Array data structures; rather, it was wholly overwriting the
destination, deleting all pre-exisiting elements.
* The yaml-merge command-line tool wasn't accepting empty-strings as STDIN
documents; it was reporting a document-read error, instead. This turns out
to be useful when you want to use yaml-merge instead of yaml-set to
deliberately write an empty-string value at some --mergeat location within
the LHS document.
* The yaml-merge command would not accept any variation of "false" as a Scalar
value input; it was instead reporting a document-read error. This turns out
to be useful when using yaml-merge as if it were yaml-set to write a false
Boolean value to the LHS document at some --mergeat location.

API Changes:
* The func.get_yaml_data and func.get_yaml_multidoc_data functions now
return/yield tuples. The first field is the desired yaml_data (can be None
for empty documents) and the second field is a Boolean which indicates True
when the document loaded with no errors or False when an error occurred.
This is necessary in order to accept a bare "false" Scalar value as a
STDIN-supplied document.

3.0.0

Enhancements:
* Added a new YAML Path Segment Type: *
This is identical to a Search segment where the search term is `[.!=""]`.
This translates to "match every Hash key for which its name is not empty and
every Array element which is not empty". This operator also vertically
expands results from Collectors, effectively breaking them out from an Array-
per-line to one-Scalar-per-line. If you place this inside a Collector, the
results will still be collected into an Array.
* The * character now also serves as a wildcard character for key-names, Hash
values, and Array value comparisons, converting the segment to a Search. For
example, a YAML Path like `abc.d*` becomes `abc[.^d]`, `abc.*f` becomes
`abc[.$f]`, and `abc.*e*` becomes `abc[.=~/^.*e.*$/]`, and so on.
* Added a new YAML Path Segment Type: **
This new type is a "Traversal" segment which causes YAML Path operations to
deeply traverse the document from that point. When there are no further
segments in the YAML Path, every leaf node (Scalar value) is matched. When
the YAML Path has at least one further segment, it (and all further segments)
must match subsequent nodes (anywhere deeper than that point in the document)
or none are matched. Results can be collected.
* The yaml-merge and yaml-get command-line tools now treat the - pseudo-file as
implicit when NOT specified AND the session is non-TTY. This can be blocked
with --nostdin|-S. This enables, for example, piping into these commands
without being forced to specify the - pseudo-file as an argument to them.
* The yaml-merge command now enables users to force the merged document to be
written out as YAML or JSON via a new --document-format (-D) command-line
argument. When unset, the format will be based on the file-name extension of
the --output file when provided, or (last-resort) that of the first document
(AUTO).
* The yaml-merge command now accepts multi-document YAML files, created when
the YAML standard-specified End-of-Document, Start-of-Document marker pair
(...<EOL> followed by ---<EOL>) is present, like:
yaml
---
document: 1
...
---
document: 2

* The yaml-merge command now accepts multi-document JSON files, created when
there are multiple root-level entities, like:
json
{"document": 1}
{"document": 2}

* Because any document to yaml-merge can be a multi-document, it no longer
requires at least 2 YAML_FILEs be supplied on the command-line. If users
pass only a single file or stream that is not a multi-document file, its
content will merely be written out without any merging into it. This can be
useful for trivially converting any file from YAML to JSON or JSON to YAML,
like `yaml-merge --document-format=json file.yaml` or
`yaml-merge --document-format=yaml file.json`.
* The `yaml-set` command-line tool can now write changes to empty or minimally-
viable files, enabling users to build up new data files from scratch. The
file must already exist, even if completely empty. A non-empty, minimally-
viable file depends on document type. For example:
A minimally-viable YAML file:
yaml
---
The triple-dash is required.

Two versions of a minimally-viable JSON file:
json
{}

or:
json
[]

However, minimally-viable structure is necessary only for files with unusual
file-name extensions. When the file-name extension is one of yaml, yml, or
json (case-insensitive), the file can be completely empty and still result in
a YAML or JSON data structure.
* The `yaml-set` command-line tool now accepts empty-String values.
* The `yaml-merge` command-line tool now permits overwriting one of its input
files as long as `--overwrite` is used instead of `--output`; these are
mutually-exclusive options. To help users protect against accidental change,
a new `--backup` flag will cause the to-be-overwritten file to be renamed
with a ".bak" file-name extension. A pre-existing backup file with the same
name will be unceremoniously replaced.
* The `yaml-set` command-line tool now accepts an arbitrary set of characters
from which to derive `--random` values via a new `--random-from` argument.
This is especially useful when you need to limit or expand the characters
used and when you wish to favor some characters more than others (simply
repeat the favored characters more than other characters in the argument
value but do so under caution because doing so reduces randomness).
* The `yaml-set` command-line tool now accepts documents from STDIN, causing it
to write the resulting changes to STDOUT. This enables `yaml-set` to operate
as a stream editor, like `yaml-get` and `yaml-merge`.
* The `yaml-paths` command-line tool now accepts documents from STDIN. It also
now accepts multi-document YAML and JSON as file or STDIN input. Because it
is impossible to determine whether a file or stream contains multi-document
data without reading through the entire file more than once, output now always
displays the file-name (or STDIN) and -- new -- the document-index in which
matches were found. As before, users can turn off file-name display by
setting --nofile|-F. In previous, single-document versions, the file-name
display was automatically muted when there was only one YAML_FILE to process.

Bug Fixes:
* Collectors were breaking search nodes with Regular Expressions, making it
impossible for collected searches to return expected matches.
* Fixed the Known Issue which was logged at version 2.4.0; setting values which
override aliased key-value pairs now correctly adds the new key-value pair to
the DOM.
* When the left-most document was JSON, yaml-merge and yaml-set would both
improperly write out a YAML document start mark (---) and then a hybrid
JSON/YAML result rather than valid JSON.
* The yaml-merge command would "explode" LHS Anchored Hashes wherever they were
aliased when the RHS document modified the same Hash into which the alias was
used.
* Setting a Python-style Boolean value via `yaml-set` (True or False) without
setting --format=boolean would cause an error because ruamel.yaml was
expecting an integer, instead. It is no longer necessary to set --format in
this case. However, --format=boolean can still be useful to convert more
"Boolean like" values into true|false, like on, off, yes, no, true, false,
True, False, 1, 0.

Non-Breaking API Changes:
* The various protected _get_* methods of Processor were changed to reduce the
number of positional parameters while also allowing for new special-use
parameters for future changes. The formerly optional positional `parent` and
`parentref` parameters are now optional keyword arguments by the same names.
Because these were all protected methods and the affected parameters were
optional anyway, this is not deemed a breaking change; no one should have
been directly calling them.
* The get_yaml_editor function now supports several keyword arguments which
provide for some customization of the returned ruamel.yaml.YAML instance.
See its documentation for details. This is a non-breaking change as the
defaults for each new keyword argument set the behavior identical to what it
was before this change.
* The get_yaml_data function now returns False rather than None when there is
an issue attempting to load data. This is because an empty-but-viable
document correctly returns None but there is no valid YAML or JSON document
which can be comprised only of a Scalar Boolean. This is a non-breaking
change because None and False are equivalent for code like:
python
data = get_yaml_data(get_yaml_editor(), ConsoleLogger(), "file.yaml")
if not data:
print("No data")

However, you can now differentiate between "No data" and "Invalid document"
like so:
python
data = get_yaml_data(get_yaml_editor(), ConsoleLogger(), "file.yaml")
if data is None:
print("No data")
elif not data and isinstance(data, bool):
print("Invalid document")
else:
print("Got a non-empty document")

* The ConsolePrinter's debug method now prints vastly more detail and allows
for customization of the output. Read its documentation for details.

From this release forward, the version reported by all command-line tools is
synchronized with the version of the overall yamlpath installation.

2.4.3

Bug Fixes:
* Array-of-Hashes were not being detected for the purpose of applying merge
rules defined via the INI-style configuration file.
* Array-of-Hashes identity key inference was looking first to the LHS document.
This was backwards for an RHS-to-LHS merge and has been corrected.

The yaml-merge command now reports version 0.0.4 to reflect these changes.

2.4.2

Enhancements:
* In the INI file's [rules] section, different merge rules can now be applied
to specific parts -- no matter how deeply nested -- of the same Hash
structure.

Bug Fixes:
* The 3rd-party Python INI file parser had no way of differentiating between
the key and value of a YAML Path entry containing an = sign in its key, like
"/path[.=name]/key = left". This update reconstitutes such lines and
correctly parses an affected YAML Path from the merge rule.

The yaml-merge command now reports version 0.0.3 to reflect these changes.

2.4.1

Bug Fixes:
* The yaml-merge tool (and underlying Merger class) incorrectly assigned "None"
Anchors to all floating-point numbers. This prevented all merging when both
the LHS and RHS documents contained at least one floating-point number, each.
The yaml-merge command now reports version 0.0.2 to reflect this change.

Page 4 of 9

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.