swh.graph.cli module#

class swh.graph.cli.StepOption[source]#

Bases: ParamType

click type for specifying a compression step on the CLI

parse either individual steps, specified as step names or integers, or step ranges

name: str = 'compression step'#

the descriptive name of this type

convert(value, param, ctx) Set[CompressionStep][source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

class swh.graph.cli.PathlibPath(exists: bool = False, file_okay: bool = True, dir_okay: bool = True, writable: bool = False, readable: bool = True, resolve_path: bool = False, allow_dash: bool = False, path_type: Type[Any] | None = None, executable: bool = False)[source]#

Bases: Path

A Click path argument that returns a pathlib Path, not a string

convert(value, param, ctx)[source]#

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters:
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

swh.graph.cli.get_all_subclasses(cls)[source]#
swh.graph.cli.main()[source]#