floripy.file_formats package#

Submodules#

floripy.file_formats.plyfile module#

floripy.file_formats.plyfile.make2d(array, cols=None, dtype=None)[source]#

Make a 2D array from an array of arrays. The `cols’ and `dtype’ arguments can be omitted if the array is not empty.

exception floripy.file_formats.plyfile.PlyParseError(message, element=None, row=None, prop=None)[source]#

Bases: Exception

Raised when a PLY file cannot be parsed.

The attributes `element’, `row’, `property’, and `message’ give additional information.

add_note(object, /)#

Exception.add_note(note) – add a note to the exception

args#
with_traceback(object, /)#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class floripy.file_formats.plyfile.PlyData(elements=[], text=False, byte_order='=', comments=[], obj_info=[])[source]#

Bases: object

PLY file header and data.

A PlyData instance is created in one of two ways: by the static method PlyData.read (to read a PLY file), or directly from __init__ given a sequence of elements (which can then be written to a PLY file).

Attributes:
byte_order
elements
header

Provide PLY-formatted metadata for the instance.

Methods

read(stream)

Read PLY data from a readable file-like object or filename.

write(stream)

Write PLY data to a writeable file-like object or filename.

property elements#
property byte_order#
static read(stream)[source]#

Read PLY data from a readable file-like object or filename.

write(stream)[source]#

Write PLY data to a writeable file-like object or filename.

property header#

Provide PLY-formatted metadata for the instance.

class floripy.file_formats.plyfile.PlyElement(name, properties, count, comments=[])[source]#

Bases: object

PLY file element.

A client of this library doesn’t normally need to instantiate this directly, so the following is only for the sake of documenting the internals.

Creating a PlyElement instance is generally done in one of two ways: as a byproduct of PlyData.read (when reading a PLY file) and by PlyElement.describe (before writing a PLY file).

Attributes:
count
data
header

Format this element’s metadata as it would appear in a PLY header.

name
properties

Methods

describe(data, name[, len_types, val_types, ...])

Construct a PlyElement from an array's metadata.

dtype([byte_order])

Return the numpy dtype of the in-memory representation of the data.

ply_property

property count#
property data#
property properties#
ply_property(name)[source]#
property name#
dtype(byte_order='=')[source]#

Return the numpy dtype of the in-memory representation of the data. (If there are no list properties, and the PLY format is binary, then this also accurately describes the on-disk representation of the element.)

static describe(data, name, len_types={}, val_types={}, comments=[])[source]#

Construct a PlyElement from an array’s metadata.

len_types and val_types can be given as mappings from list property names to type strings (like ‘u1’, ‘f4’, etc., or ‘int8’, ‘float32’, etc.). These can be used to define the length and value types of list properties. List property lengths always default to type ‘u1’ (8-bit unsigned integer), and value types default to ‘i4’ (32-bit integer).

property header#

Format this element’s metadata as it would appear in a PLY header.

class floripy.file_formats.plyfile.PlyProperty(name, val_dtype)[source]#

Bases: object

PLY property description. This class is pure metadata; the data itself is contained in PlyElement instances.

Attributes:
name
val_dtype

Methods

dtype([byte_order])

Return the numpy dtype description for this property (as a tuple of strings).

property val_dtype#
property name#
dtype(byte_order='=')[source]#

Return the numpy dtype description for this property (as a tuple of strings).

class floripy.file_formats.plyfile.PlyListProperty(name, len_dtype, val_dtype)[source]#

Bases: PlyProperty

PLY list property description.

Attributes:
len_dtype
name
val_dtype

Methods

dtype([byte_order])

List properties always have a numpy dtype of "object".

list_dtype([byte_order])

Return the pair (len_dtype, val_dtype) (both numpy-friendly strings).

property len_dtype#
dtype(byte_order='=')[source]#

List properties always have a numpy dtype of “object”.

list_dtype(byte_order='=')[source]#

Return the pair (len_dtype, val_dtype) (both numpy-friendly strings).

property name#
property val_dtype#

floripy.file_formats.yamlio module#

Module for reading from and writing to yaml files.

Useful reference for yaml file: http://en.wikipedia.org/wiki/User:Baxter.brad/Drafts/YAML_Tutorial_and_Style_Guide Useful methods for pyYAML (ruamel.yaml is built on pyYAML): yaml.load(fh), yaml.load_all yaml.dump(fh), yaml.dump_all YAMLError(): exception Loader and Dumper (defaults are fine, but may be required if using LibYAML) Use the RoundTrip versions of loader and dumper for preserving comments and order of the dicts. e.g. ruamel.yaml.load(fh_yaml, ruamel.yaml.RoundTripLoader)

ruamel.yaml.dump(yaml_data, Dumper=ruamel.yaml.RoundTripDumper, explicit_start=True)

class floripy.file_formats.yamlio.ExplicitDumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)[source]#

Bases: SafeDumper

A dumper that will never emit aliases. Required make the output file human readable, at the expense of repeating redundant data.

Methods

add_implicit_resolver

add_multi_representer

add_path_resolver

add_representer

analyze_scalar

anchor_node

ascend_resolver

check_empty_document

check_empty_mapping

check_empty_sequence

check_resolver_prefix

check_simple_key

choose_scalar_style

close

descend_resolver

determine_block_hints

dispose

emit

expect_alias

expect_block_mapping

expect_block_mapping_key

expect_block_mapping_simple_value

expect_block_mapping_value

expect_block_sequence

expect_block_sequence_item

expect_document_end

expect_document_root

expect_document_start

expect_first_block_mapping_key

expect_first_block_sequence_item

expect_first_document_start

expect_first_flow_mapping_key

expect_first_flow_sequence_item

expect_flow_mapping

expect_flow_mapping_key

expect_flow_mapping_simple_value

expect_flow_mapping_value

expect_flow_sequence

expect_flow_sequence_item

expect_node

expect_nothing

expect_scalar

expect_stream_start

flush_stream

generate_anchor

ignore_aliases

increase_indent

need_events

need_more_events

open

prepare_anchor

prepare_tag

prepare_tag_handle

prepare_tag_prefix

prepare_version

process_anchor

process_scalar

process_tag

represent

represent_binary

represent_bool

represent_data

represent_date

represent_datetime

represent_dict

represent_float

represent_int

represent_list

represent_mapping

represent_none

represent_scalar

represent_sequence

represent_set

represent_str

represent_undefined

represent_yaml_object

resolve

serialize

serialize_node

write_double_quoted

write_folded

write_indent

write_indicator

write_line_break

write_literal

write_plain

write_single_quoted

write_stream_end

write_stream_start

write_tag_directive

write_version_directive

ignore_aliases(data)[source]#
ANCHOR_TEMPLATE = 'id%03d'#
DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map'#
DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str'#
DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq'#
DEFAULT_TAG_PREFIXES = {'!': '!', 'tag:yaml.org,2002:': '!!'}#
ESCAPE_REPLACEMENTS = {'\x00': '0', '\x07': 'a', '\x08': 'b', '\t': 't', '\n': 'n', '\x0b': 'v', '\x0c': 'f', '\r': 'r', '\x1b': 'e', '"': '"', '\\': '\\', '\x85': 'N', '\xa0': '_', '\u2028': 'L', '\u2029': 'P'}#
classmethod add_implicit_resolver(tag, regexp, first)#
classmethod add_multi_representer(data_type, representer)#
classmethod add_path_resolver(tag, path, kind=None)#
classmethod add_representer(data_type, representer)#
analyze_scalar(scalar)#
anchor_node(node)#
ascend_resolver()#
check_empty_document()#
check_empty_mapping()#
check_empty_sequence()#
check_resolver_prefix(depth, path, kind, current_node, current_index)#
check_simple_key()#
choose_scalar_style()#
close()#
descend_resolver(current_node, current_index)#
determine_block_hints(text)#
dispose()#
emit(event)#
expect_alias()#
expect_block_mapping()#
expect_block_mapping_key(first=False)#
expect_block_mapping_simple_value()#
expect_block_mapping_value()#
expect_block_sequence()#
expect_block_sequence_item(first=False)#
expect_document_end()#
expect_document_root()#
expect_document_start(first=False)#
expect_first_block_mapping_key()#
expect_first_block_sequence_item()#
expect_first_document_start()#
expect_first_flow_mapping_key()#
expect_first_flow_sequence_item()#
expect_flow_mapping()#
expect_flow_mapping_key()#
expect_flow_mapping_simple_value()#
expect_flow_mapping_value()#
expect_flow_sequence()#
expect_flow_sequence_item()#
expect_node(root=False, sequence=False, mapping=False, simple_key=False)#
expect_nothing()#
expect_scalar()#
expect_stream_start()#
flush_stream()#
generate_anchor(node)#
increase_indent(flow=False, indentless=False)#
inf_value = inf#
need_events(count)#
need_more_events()#
open()#
prepare_anchor(anchor)#
prepare_tag(tag)#
prepare_tag_handle(handle)#
prepare_tag_prefix(prefix)#
prepare_version(version)#
process_anchor(indicator)#
process_scalar()#
process_tag()#
represent(data)#
represent_binary(data)#
represent_bool(data)#
represent_data(data)#
represent_date(data)#
represent_datetime(data)#
represent_dict(data)#
represent_float(data)#
represent_int(data)#
represent_list(data)#
represent_mapping(tag, mapping, flow_style=None)#
represent_none(data)#
represent_scalar(tag, value, style=None)#
represent_sequence(tag, sequence, flow_style=None)#
represent_set(data)#
represent_str(data)#
represent_undefined(data)#
represent_yaml_object(tag, data, cls, flow_style=None)#
resolve(kind, value, implicit)#
serialize(node)#
serialize_node(node, parent, index)#
write_double_quoted(text, split=True)#
write_folded(text)#
write_indent()#
write_indicator(indicator, need_whitespace, whitespace=False, indention=False)#
write_line_break(data=None)#
write_literal(text)#
write_plain(text, split=True)#
write_single_quoted(text, split=True)#
write_stream_end()#
write_stream_start()#
write_tag_directive(handle_text, prefix_text)#
write_version_directive(version_text)#
yaml_implicit_resolvers = {'': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], '!': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '&': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '*': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '+': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE))], '-': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE))], '.': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE))], '0': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '1': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '2': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '3': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '4': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '5': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '6': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '7': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '8': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '9': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '<': [('tag:yaml.org,2002:merge', re.compile('^(?:<<)$'))], '=': [('tag:yaml.org,2002:value', re.compile('^(?:=)$'))], 'F': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'N': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 'O': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'T': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'Y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'f': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'n': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 'o': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 't': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], '~': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))]}#
yaml_multi_representers = {}#
yaml_path_resolvers = {}#
yaml_representers = {<class 'NoneType'>: <function SafeRepresenter.represent_none>, <class 'bool'>: <function SafeRepresenter.represent_bool>, <class 'bytes'>: <function SafeRepresenter.represent_binary>, <class 'datetime.date'>: <function SafeRepresenter.represent_date>, <class 'datetime.datetime'>: <function SafeRepresenter.represent_datetime>, <class 'dict'>: <function SafeRepresenter.represent_dict>, <class 'float'>: <function SafeRepresenter.represent_float>, <class 'int'>: <function SafeRepresenter.represent_int>, <class 'list'>: <function SafeRepresenter.represent_list>, <class 'set'>: <function SafeRepresenter.represent_set>, <class 'str'>: <function SafeRepresenter.represent_str>, <class 'tuple'>: <function SafeRepresenter.represent_list>, None: <function SafeRepresenter.represent_undefined>}#
floripy.file_formats.yamlio.read(fn)[source]#

Reads an yaml file.

Returns:
yamldictdict

Dict containing the contents of the yaml file.

floripy.file_formats.yamlio.write(yamldict, fn, **kwargs)[source]#

Writes to a yaml file.

Parameters:
yamldictdict

Dict to be written.

fnstring

Name of the file to which the dict yamldict will be written.

kwargs: default_flow_style, indent
floripy.file_formats.yamlio.append(yamldict, fn, default_flow_style=None, indent=4)[source]#

Appends to an yaml file. If the yaml file does not exist, it is created.

floripy.file_formats.yamlio.read_series(fn)[source]#

This is a generator object returning each YAML document. It will exhaust when there are no more documents to read. This is useful for reading a series of yaml documents contained in a single file.

Module contents#