swh.alter.cli module#

class swh.alter.cli.SWHIDType[source]#

Bases: ParamType

name: str = 'swhid'#

the descriptive name of this type

convert(value, param, ctx) ExtendedSWHID[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.alter.cli.SwhidOrUrlParamType[source]#

Bases: ParamType

name: str = 'swhid or origin URL'#

the descriptive name of this type

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.

class swh.alter.cli.ClickLoggingHandler(level=0)[source]#

Bases: Handler

Handler displaying logs using click.secho(), passing the style extra attribute.

Initializes the instance - basically setting the formatter to None and the filter list to empty.

emit(record)[source]#

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

swh.alter.cli.progressbar(iterable: Iterable[V] | None = None, length: int | None = None, label: str | None = None, show_eta: bool = True, show_pos: bool = False, show_percent: bool | None = None, item_show_func: Callable[[V], str] | None = None) ProgressBar[V][source]#
swh.alter.cli.read_swhids(file: TextIO) Set['ExtendedSWHID'][source]#
swh.alter.cli.get_remover(ctx: click.Context, dry_run: bool = False) Remover[source]#
swh.alter.cli.prompting_object_decryption_key_provider(manifest, known_mnemonics=None, identity_files=None, show_decrypted_mnemonics=False) str[source]#
swh.alter.cli.get_object_decryption_key_provider(ctx) ObjectDecryptionKeyProvider[source]#
class swh.alter.cli.ContentSWHID[source]#

Bases: ParamType

name: str = 'swhid of a content object'#

the descriptive name of this type

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.