namelist_diff package

Submodules

namelist_diff.cli module

namelist_diff.config module

Namelist Diff Configuration

Configuration for the namelist diff tool follows the XDG standard. The configuration should be stored in a YAML file.

You can use the function write_default_config to generate a configuration file with the hard-coded defaults. Command line access for this command is available via:

$ nmldiff --write-default-config

The default configuration will be written to ${XDG_CONFIG_HOME}/nmldiff/nmldiff.yaml

Order of Precedence

Configuration is loaded in the following order:

  1. Command line

  2. Config file thats name is declared on the command line.

  3. Environment vars

  4. Local config file (if exists)

  5. Global config file (if exists)

  6. Hard-coded defaults in the code

class namelist_diff.config.AppConfig[source]

Bases: everett.component.RequiredConfigMixin

Contains the defaults for the nmldiff configuration

required_config = <everett.component.ConfigOptions object>
namelist_diff.config.CONFIG_FILES = ['/home/docs/.config/nmldiff/nmldiff.yml', '/etc/xdg/nmldiff/nmldiff.yml']

List of files where configuration information is searched for

namelist_diff.config.get_config(config_file=None)[source]

Loads the configuration

Loads either the user supplied configuration, the configuration in the XDG path, or the default config. Configuration may be given incompletely, so if you only supply the color (for example), other configuration values are taken from the defaults. The user can also supply a configuration as a dictionary as an argument to this function, this takes first priority.

config_filestr or Path

Which config to load

configdict

The configuration to use

>>> config = get_config()
>>> debug = config.get("debug")  # Evaluates to whatever debug is set in
                                 # the first configuration found
namelist_diff.config.write_default_config()[source]

Creates a default configuration file under the XDG Base Directory nmldiff/nmldiff.yaml

namelist_diff.namelist_diff module

Main module.

class namelist_diff.namelist_diff.NamelistDiff(nml1, nml2, config)[source]

Bases: object

diff()[source]
namelist_diff.namelist_diff.ansi_ljust(s, width)[source]
namelist_diff.namelist_diff.check_longest_line(s)[source]
namelist_diff.namelist_diff.color_green(s)[source]
namelist_diff.namelist_diff.color_red(s)[source]
namelist_diff.namelist_diff.color_string(s, color)[source]
namelist_diff.namelist_diff.color_yellow(s)[source]
namelist_diff.namelist_diff.determine_print_color(diff_type)[source]
namelist_diff.namelist_diff.determine_print_prefix(diff_type)[source]
namelist_diff.namelist_diff.format_entry(current_chapter, current_entry, all_diffs)[source]
namelist_diff.namelist_diff.format_nml(nml, fhdl, diff)[source]
namelist_diff.namelist_diff.format_remaining_diff(current_diff, all_diffs)[source]
namelist_diff.namelist_diff.namelist_to_iter(nml)[source]

Module contents

Top-level package for Namelist Diff.