Package: node.ext.yaml
node.ext.yamlprovides a node implementation to yaml files.For more information on nodes seenodepackage.For more information on plumbing seeplumberpackage.UsageCreate a yaml file:fromnode.ext.yamlimportYamlFileclassMyYamlFile(YamlFile):@propertydeffs_path(self):return'/path/to/file.yaml'file=MyYamlFile()file['child']='Value'# write file to diskfile()Define factories for child nodes:fromnode.ext.yamlimportYamlNodeclassSpecificChild(YamlNode):passclassDefaultChild(YamlNode):passclassMyYamlFile(YamlFile):factories={'child':SpecificChild,'*':DefaultChild}Define a schema for node members:fromnodeimportschemafromnode.behaviorsimportSchemaAsAttributesfromplumberimportplumbing@plumbing(SchemaAsAttributes)classMyYamlFile(YamlFile):schema={'int_member':schema.Int(),'str_member':schema.Str()}file=MyYamlFile()file.attr['int_member']=1file.attr['str_member']=u'String'Schema members can be defined directly on class.Note: Be careful not to override existing API members.fromnode.behaviorsimportSchemaProperties@plumbing(SchemaProperties)classMyYamlFile(YamlFile):int_member=schema.Int()str_member=schema.Str()file=MyYamlFile()file.int_member=1file.str_member=u'String'Python VersionsPython 2.7, 3.3+ContributorsRobert NiederreiterChanges0.3 (2022-12-21)node.ext.yaml.behaviors.YamlSequenceStorageimplements now__contains__, which compares the storage values directly. This is needed
to make containment checks work because yaml child nodes are not cached on__getitem__.
[rnix]node.ext.yaml.behaviors.YamlMemberprovides nowdefault_mapping_factoryanddefault_sequence_factorysettings.
[rnix]node.ext.yaml.behaviors.YamlMemberinherits fromnode.behaviors.WildcardFactorynow.
[rnix]Usenode.behaviors.SequenceAdoptandnode.behaviors.SequenceOrderbehaviors onnode.ext.yaml.YamlSequence.
[rnix]Usenode.behaviors.MappingOrderbehavior in favor ofnode.behaviors.Orderas introduced innode1.2 onnode.ext.yaml.YamlMappingandnode.ext.yaml.YamlFile.
[rnix]0.2 (2022-10-06)InheritYamlRootStoragefromnode.ext.fs.FSLocation, which providesfs_pathproperty. Note thatfs_pathis handled as list now.
[rnix]InheritIYamlRootfromnode.ext.fs.interfaces.IFile.
[rnix]Package depends onnode.ext.fsnow.
[rnix]Replace deprecated use ofAdoptbyMappingAdopt.
[rnix]node.ext.yaml.YamlNodeandnode.ext.yaml.YamlFilenot provides a
default child factory any more.
[rnix]0.1 (2021-11-22)Initial work
[rnix]LicenseCopyright (c) 2021-2022, Node Contributors
All rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.