/usr/lib/python3/dist-packages/certbot_apache/_internal
NameSizeModeActions
augeas_lens/-0755rm
tls_configs/-0755rm
__pycache__/-0755rm
apacheparser.py73320644editdlrm
apache_util.py71290644editdlrm
assertions.py50410644editdlrm
augeasparser.py196250644editdlrm
configurator.py1118920644editdlrm
constants.py32710644editdlrm
display_ops.py41380644editdlrm
dualparser.py129160644editdlrm
entrypoint.py27750644editdlrm
http_01.py87330644editdlrm
interfaces.py220380644editdlrm
obj.py88870644editdlrm
override_arch.py6760644editdlrm
override_centos.py83160644editdlrm
override_darwin.py6040644editdlrm
override_debian.py51050644editdlrm
override_fedora.py33850644editdlrm
override_gentoo.py23600644editdlrm
override_suse.py6700644editdlrm
override_void.py6810644editdlrm
parser.py359810644editdlrm
parsernode_util.py53020644editdlrm
__init__.py290644editdlrm
Edit: /usr/lib/python3/dist-packages/certbot_apache/_internal/parsernode_util.py (5302B)
"""ParserNode utils""" def validate_kwargs(kwargs, required_names): """ Ensures that the kwargs dict has all the expected values. This function modifies the kwargs dictionary, and hence the returned dictionary should be used instead in the caller function instead of the original kwargs. :param dict kwargs: Dictionary of keyword arguments to validate. :param list required_names: List of required parameter names. """ validated_kwargs = {} for name in required_names: try: validated_kwargs[name] = kwargs.pop(name) except KeyError: raise TypeError("Required keyword argument: {} undefined.".format(name)) # Raise exception if unknown key word arguments are found. if kwargs: unknown = ", ".join(kwargs.keys()) raise TypeError("Unknown keyword argument(s): {}".format(unknown)) return validated_kwargs def parsernode_kwargs(kwargs): """ Validates keyword arguments for ParserNode. This function modifies the kwargs dictionary, and hence the returned dictionary should be used instead in the caller function instead of the original kwargs. If metadata is provided, the otherwise required argument "filepath" may be omitted if the implementation is able to extract its value from the metadata. This usecase is handled within this function. Filepath defaults to None. :param dict kwargs: Keyword argument dictionary to validate. :returns: Tuple of validated and prepared arguments. """ # As many values of ParserNode instances can be derived from the metadata, # (ancestor being a common exception here) make sure we permit it here as well. if "metadata" in kwargs: # Filepath can be derived from the metadata in Augeas implementation. # Default is None, as in this case the responsibility of populating this # variable lies on the implementation. kwargs.setdefault("filepath", None) kwargs.setdefault("dirty", False) kwargs.setdefault("metadata", {}) kwargs = validate_kwargs(kwargs, ["ancestor", "dirty", "filepath", "metadata"]) return kwargs["ancestor"], kwargs["dirty"], kwargs["filepath"], kwargs["metadata"] def commentnode_kwargs(kwargs): """ Validates keyword arguments for CommentNode and sets the default values for optional kwargs. This function modifies the kwargs dictionary, and hence the returned dictionary should be used instead in the caller function instead of the original kwargs. If metadata is provided, the otherwise required argument "comment" may be omitted if the implementation is able to extract its value from the metadata. This usecase is handled within this function. :param dict kwargs: Keyword argument dictionary to validate. :returns: Tuple of validated and prepared arguments and ParserNode kwargs. """ # As many values of ParserNode instances can be derived from the metadata, # (ancestor being a common exception here) make sure we permit it here as well. if "metadata" in kwargs: kwargs.setdefault("comment", None) # Filepath can be derived from the metadata in Augeas implementation. # Default is None, as in this case the responsibility of populating this # variable lies on the implementation. kwargs.setdefault("filepath", None) kwargs.setdefault("dirty", False) kwargs.setdefault("metadata", {}) kwargs = validate_kwargs(kwargs, ["ancestor", "dirty", "filepath", "comment", "metadata"]) comment = kwargs.pop("comment") return comment, kwargs def directivenode_kwargs(kwargs): """ Validates keyword arguments for DirectiveNode and BlockNode and sets the default values for optional kwargs. This function modifies the kwargs dictionary, and hence the returned dictionary should be used instead in the caller function instead of the original kwargs. If metadata is provided, the otherwise required argument "name" may be omitted if the implementation is able to extract its value from the metadata. This usecase is handled within this function. :param dict kwargs: Keyword argument dictionary to validate. :returns: Tuple of validated and prepared arguments and ParserNode kwargs. """ # As many values of ParserNode instances can be derived from the metadata, # (ancestor being a common exception here) make sure we permit it here as well. if "metadata" in kwargs: kwargs.setdefault("name", None) # Filepath can be derived from the metadata in Augeas implementation. # Default is None, as in this case the responsibility of populating this # variable lies on the implementation. kwargs.setdefault("filepath", None) kwargs.setdefault("dirty", False) kwargs.setdefault("enabled", True) kwargs.setdefault("parameters", ()) kwargs.setdefault("metadata", {}) kwargs = validate_kwargs(kwargs, ["ancestor", "dirty", "filepath", "name", "parameters", "enabled", "metadata"]) name = kwargs.pop("name") parameters = kwargs.pop("parameters") enabled = kwargs.pop("enabled") return name, parameters, enabled, kwargs