CIME.XML.archive_base.ArchiveBase
- class CIME.XML.archive_base.ArchiveBase(infile=None, schema=None, root_name_override=None, root_attrib_override=None, read_only=True)[source]
Bases:
GenericXML
Methods
__init__
Initialize an object
Add element node to self at root
attrib
change_file
Returns True if timestamp matches what is expected
copy
Checks if component should be excluded from testing.
get
gets all history files in directory from_dir with suffix (if provided) ignores files with ref_case in the name if ref_case is provided
get_child
This is the critical function, its interface and performance are crucial.
get_element_text
Returns an xml node corresponding to compname in comp_archive_spec
get_entry_attributes
get the xml text associated with name under root archive_entry returns None if no entry is found, expects only one entry
get the xml text associated with each of the hist_file_ext_regex entries based at root archive_entry (root is based on component name) returns a list of text entries or an empty list if no entries are found
get the xml text associated with each of the hist_file_extensions based at root archive_entry (root is based on component name) returns a list of text entries or an empty list if no entries are found
get_id
get the most recent history files in directory from_dir with suffix if provided
get_optional_child
get_raw_record
A value in the xml file may contain references to other xml variables or to environment variables.
get the xml text associated with each of the rest_file_extensions based at root archive_entry (root is based on component name) returns a list of text entries or an empty list if no entries are found
get_value is expected to be defined by the derived classes, if you get here the value was not found in the class.
get_values
get_version
has
invalidate
A subclass is doing caching, we need to lock the tree structure in order to avoid invalidating cache.
make_child
make_child_comment
name
pop
Read and parse an xml file into the object.
read_fd
remove_child
Get an xml element matching nodename with optional attributes.
scan_children
Get an xml element matching nodename with optional attributes.
set
set_element_text
set_name
set_text
ignore_type is not used in this flavor
text
to_string
unlock
validate_timestamp
validate an XML file against a provided schema file using pylint
Write an xml file from data in self
- class CacheEntry(tree, root, modtime)[source]
Bases:
tuple
- get_all_hist_files(casename, model, from_dir, suffix='', ref_case=None)[source]
gets all history files in directory from_dir with suffix (if provided) ignores files with ref_case in the name if ref_case is provided
- get_children(name=None, attributes=None, root=None)[source]
This is the critical function, its interface and performance are crucial.
You can specify attributes={key:None} if you want to select children with the key attribute but you don’t care what its value is.
- get_entry_value(name, archive_entry)[source]
get the xml text associated with name under root archive_entry returns None if no entry is found, expects only one entry
- get_hist_file_ext_regexes(archive_entry)[source]
get the xml text associated with each of the hist_file_ext_regex entries based at root archive_entry (root is based on component name) returns a list of text entries or an empty list if no entries are found
- get_hist_file_extensions(archive_entry)[source]
get the xml text associated with each of the hist_file_extensions based at root archive_entry (root is based on component name) returns a list of text entries or an empty list if no entries are found
- get_latest_hist_files(casename, model, from_dir, suffix='', ref_case=None)[source]
get the most recent history files in directory from_dir with suffix if provided
- get_resolved_value(raw_value, allow_unresolved_envvars=False, subgroup=None)[source]
A value in the xml file may contain references to other xml variables or to environment variables. These are refered to in the perl style with $name and $ENV{name}.
>>> obj = GenericXML() >>> os.environ["FOO"] = "BAR" >>> os.environ["BAZ"] = "BARF" >>> obj.get_resolved_value("one $ENV{FOO} two $ENV{BAZ} three") 'one BAR two BARF three' >>> obj.get_resolved_value("2 + 3 - 1") '4' >>> obj.get_resolved_value("0001-01-01") '0001-01-01' >>> obj.get_resolved_value("$SHELL{echo hi}") == 'hi' True
- get_rest_file_extensions(archive_entry)[source]
get the xml text associated with each of the rest_file_extensions based at root archive_entry (root is based on component name) returns a list of text entries or an empty list if no entries are found
- get_value(item, attribute=None, resolved=True, subgroup=None)[source]
get_value is expected to be defined by the derived classes, if you get here the value was not found in the class.
- lock()[source]
A subclass is doing caching, we need to lock the tree structure in order to avoid invalidating cache.
- read(infile, schema=None)[source]
Read and parse an xml file into the object. The schema variable can either be a path to an xsd schema file or a dictionary of paths to files by version.
- scan_child(nodename, attributes=None, root=None)[source]
Get an xml element matching nodename with optional attributes.
Error unless exactly one match.
- scan_optional_child(nodename, attributes=None, root=None)[source]
Get an xml element matching nodename with optional attributes.
Return None if no match.
- set_value(vid, value, subgroup=None, ignore_type=True)[source]
ignore_type is not used in this flavor