How to use the cruise-control-client.cruisecontrolclient.client.CCParameter.RegularExpressionParameter.AbstractRegularExpressionParameter function in cruise-control-client

To help you get started, we’ve selected a few cruise-control-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github linkedin / cruise-control / cruise-control-client / cruisecontrolclient / client / CCParameter / RegularExpressionParameter.py View on Github external
else:
            raise ValueError(f"{self.value} must be either a string or a re.Pattern")


class ExcludedTopicsParameter(AbstractRegularExpressionParameter):
    """excluded_topics=[pattern]"""

    name = "excluded_topics"
    description = "A regular expression matching which topics to exclude from this endpoint's action"
    argparse_properties = {
        "args": ("--excluded-topics", "--exclude-topics", "--exclude-topic"),
        "kwargs": dict(help=description, metavar="REGEX"),
    }


class TopicParameter(AbstractRegularExpressionParameter):
    """topic=[topic]"""

    name = "topic"
    description = "A regular expression matching the desired topics"
    argparse_properties = {
        "args": ("--topic",),
        "kwargs": dict(help=description, metavar="REGEX"),
    }
github linkedin / cruise-control / cruise-control-client / cruisecontrolclient / client / CCParameter / RegularExpressionParameter.py View on Github external
#
            # This allows us to store a value that is the closest to what
            # cruise-control expects.
            self.value = self.value.pattern
        elif type(self.value) == str:
            # A string is not necessarily a regular expression; verify whether
            # it compiles into one.
            try:
                re.compile(self.value)
            except re.error as e:
                raise ValueError(f"{self.value} is not a valid regular expression", e)
        else:
            raise ValueError(f"{self.value} must be either a string or a re.Pattern")


class ExcludedTopicsParameter(AbstractRegularExpressionParameter):
    """excluded_topics=[pattern]"""

    name = "excluded_topics"
    description = "A regular expression matching which topics to exclude from this endpoint's action"
    argparse_properties = {
        "args": ("--excluded-topics", "--exclude-topics", "--exclude-topic"),
        "kwargs": dict(help=description, metavar="REGEX"),
    }


class TopicParameter(AbstractRegularExpressionParameter):
    """topic=[topic]"""

    name = "topic"
    description = "A regular expression matching the desired topics"
    argparse_properties = {