/usr/lib/python3/dist-packages/landscape/lib/__pycache__
Edit: /usr/lib/python3/dist-packages/landscape/lib/__pycache__/config.cpython-310.pyc (10218B)
o
c0 @ s d dl mZ d dlmZ d dlmZ d dlZd dlZd dlZd dl m
Z
mZ d dlm
Z d dlmZ ddd ZG d
d deZG dd
d
eZdddZdS ) )absolute_import) getLogger)OptionParserN) ConfigObjConfigObjError)
StringType)clic C s2 d}|dur
|d |7 }| jddd||d dS )z>Add common config-related CLI options to the given arg parser.zUUse config from this file (any command line options override settings from the file).Nz (default: {!r})z-cz--configFILE)metavardefaulthelp)format
add_option)parserfilenamecfgfilehelp r 6/usr/lib/python3/dist-packages/landscape/lib/config.pyadd_cli_options s
r c @ s" e Zd Zi ZdddZdd ZdS )ConfigSpecOptionParserNc C s t | | d S N)r __init__)selfunsaved_optionsr r r r s zConfigSpecOptionParser.__init__c O s4 t j| g|R i |}tt| t| |S r )r r printdirget_opt_string)r argskwargsoptionr r r r s z!ConfigSpecOptionParser.add_optionr )__name__
__module____qualname___config_spec_definitionsr r r r r r r s
r c s e Zd ZdZdZdZdZdZdZdZ dd Z
dd Zdd Zd#d
dZ
fdd
Zdd Zd$ddZdd Zdd Zdd Zd#ddZdd Zd%ddZdd Zd!d" Z ZS )&BaseConfigurationaS Base class for configuration implementations.
@cvar required_options: Optionally, a sequence of key names to require when
reading or writing a configuration.
@cvar unsaved_options: Optionally, a sequence of key names to never write
to the configuration file. This is useful when you want to provide
command-line options that should never end up in a configuration file.
@cvar default_config_filenames: A sequence of filenames to check when
reading or writing a configuration.
Default values for supported options are set as in make_parser.
Nr c C sF i | _ g | _i | _d | _i | _| | _| jj | _ | jj
d S r )_set_options_command_line_args_command_line_options_config_filename_config_file_optionsmake_parser_parserdefaultscopy_command_line_defaultsclearr r r r r = s
zBaseConfiguration.__init__c C s | j | j| j| jfD ]}||v r|| } nq
| jd|dd r&d}nt|t|t rE| j
d|dd }|durE|d|}|S )a Find and return the value of the given configuration parameter.
The following sources will be searched:
- The attributes that were explicitly set on this object,
- The parameters specified on the command line,
- The parameters specified in the configuration file, and
- The defaults.
If no values are found and the parameter does exist as a possible
parameter, C{None} is returned.
Otherwise C{AttributeError} is raised.
z--_-N)r% r' r) r. r+
has_optionreplaceAttributeError
isinstance
basestring
get_option
convert_value)r nameoptionsvaluer r r r __getattr__I s"
zBaseConfiguration.__getattr__c C s8 | }| j |_| j |_| j|_| j |_|S )zX
Return a new configuration object, with the same settings as this one.
) __class__r% r- r' r( r) )r configr r r clonei s zBaseConfiguration.clonec C s$ z| |W S ty | Y S w )z5Return the value of the C{name} option or C{default}.)r= r5 )r r: r r r r gett s
zBaseConfiguration.getc s. | drtt| || dS || j|<