swh.objstorage.backends.winery.cli module#
- swh.objstorage.backends.winery.cli.install_signal_handlers(signal_handler: Callable[[int, FrameType | None], None])[source]#
Install the signal handler for SIGINT and SIGTERM
- class swh.objstorage.backends.winery.cli.Duration(pattern: str = '(?:(?P<years>\\d+)\\s*y(?:ears?)?)?\\s*(?:(?P<weeks>\\d+)\\s*w(?:eeks?)?)?\\s*(?:(?P<days>\\d+)\\s*d(?:ays?)?)?\\s*(?:(?P<hours>\\d+)\\s*h(?:ours?)?)?\\s*(?:(?P<minutes>\\d+)\\s*m(?:inutes?)?)?\\s*(?:(?P<seconds>\\d+)\\s*s(?:econds?)?)?')[source]#
Bases:
ParamTypeA Duration object.
The pattern used for matching must include the following named groups: - years: Matches the number of years. - weeks: Matches the number of weeks. - days: Matches the number of days. - hours: Matches the number of hours. - minutes: Matches the number of minutes. - seconds: Matches the number of seconds.
Each group is optional, but the pattern must be structured to capture these groups if present.
- DEFAULT_PATTERN = '(?:(?P<years>\\d+)\\s*y(?:ears?)?)?\\s*(?:(?P<weeks>\\d+)\\s*w(?:eeks?)?)?\\s*(?:(?P<days>\\d+)\\s*d(?:ays?)?)?\\s*(?:(?P<hours>\\d+)\\s*h(?:ours?)?)?\\s*(?:(?P<minutes>\\d+)\\s*m(?:inutes?)?)?\\s*(?:(?P<seconds>\\d+)\\s*s(?:econds?)?)?'#
- convert(value: str | None, param, ctx) timedelta | None[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
paramandctxarguments may beNonein 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.