swh.model.cli module#

class swh.model.cli.CoreSWHIDParamType[source]#

Bases: ParamType

Click argument that accepts a core SWHID and returns them as swh.model.swhids.CoreSWHID instances

name: str = 'SWHID'#

the descriptive name of this type

convert(value, param, ctx) CoreSWHID[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.model.cli.swhid_of_file(path) CoreSWHID[source]#
swh.model.cli.swhid_of_file_content(data) CoreSWHID[source]#
swh.model.cli.model_of_dir(path: bytes, exclude_patterns: Iterable[bytes] | None = None, update_info: Callable[[int], None] | None = None) Directory[source]#
swh.model.cli.swhid_of_dir(path: bytes, exclude_patterns: Iterable[bytes] | None = None) CoreSWHID[source]#
swh.model.cli.swhid_of_origin(url)[source]#
swh.model.cli.swhid_of_git_repo(path) CoreSWHID[source]#
swh.model.cli.identify_object(obj_type: str, follow_symlinks: bool, exclude_patterns: Iterable[bytes], obj) str[source]#