hfutils.entry.base

CONTEXT_SETTINGS

hfutils.entry.base.CONTEXT_SETTINGS = {'help_option_names': ['-h', '--help']}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

ClickWarningException

class hfutils.entry.base.ClickWarningException(message: str)[source]

Custom exception class for displaying warnings in yellow color.

Parameters:

message (str) – The error message.

exit_code = 1

The exit code for this exception.

show(file: IO | None = None) None[source]

Display the warning message in yellow.

Parameters:

file (Optional[IO]) – File to write the output to.

ClickErrorException

class hfutils.entry.base.ClickErrorException(message: str)[source]

Custom exception class for displaying errors in red color.

Parameters:

message (str) – The error message.

exit_code = 1

The exit code for this exception.

show(file: IO | None = None) None[source]

Display the error message in red.

Parameters:

file (Optional[IO]) – File to write the output to.

KeyboardInterrupted

class hfutils.entry.base.KeyboardInterrupted(msg=None)[source]

Exception class for handling keyboard interruptions.

Parameters:

msg (Optional[str]) – Custom message to display.

__init__(msg=None)[source]

Initialize the exception.

Parameters:

msg (Optional[str]) – Custom message to display.

exit_code = 7

The exit code for this exception.

show(file: IO | None = None) None

Display the warning message in yellow.

Parameters:

file (Optional[IO]) – File to write the output to.

command_wrap

hfutils.entry.base.command_wrap()[source]

Decorator for wrapping Click commands.

This decorator catches exceptions and provides consistent error handling.

Returns:

Decorator function.

Return type:

Callable