nadzoring.utils package

Submodules

nadzoring.utils.decorators module

Common decorators for CLI commands.

nadzoring.utils.decorators._extract_cli_options(kwargs: dict[str, Any]) SimpleNamespace[source]

Extract CLI options from kwargs.

nadzoring.utils.decorators._filter_func_kwargs(kwargs: dict[str, Any], cli_options: SimpleNamespace, *, include_verbose: bool, include_quiet: bool, include_no_color: bool, include_output: bool, include_save: bool) dict[str, Any][source]

Filter which CLI options get passed to the wrapped function.

nadzoring.utils.decorators._handle_output(result: Any, output_format: str, *, no_color: bool) None[source]

Handle different output formats.

nadzoring.utils.decorators._handle_save(result: Any, save_path: str | None, output_format: str) None[source]

Handle saving results to file if requested.

nadzoring.utils.decorators._setup_logging(cli_options: SimpleNamespace) None[source]

Setup logging based on CLI options.

nadzoring.utils.decorators._show_completion_time(elapsed: float, *, verbose: bool) None[source]

Show completion time if verbose mode is enabled.

nadzoring.utils.decorators.common_cli_options(*, include_verbose: bool = False, include_quiet: bool = False, include_no_color: bool = False, include_output: bool = False, include_save: bool = False) Callable[source]

Common CLI options for all commands with selective inclusion.

nadzoring.utils.formatters module

Output formatting utilities.

nadzoring.utils.formatters.colorize_value(value: Any, *, no_color: bool = False) str[source]

Add color to values based on content.

nadzoring.utils.formatters.format_dns_comparison(comparison_result: dict) list[dict][source]

Format DNS comparison results.

nadzoring.utils.formatters.format_dns_health(health_result: dict) list[dict][source]

Format DNS health check results.

nadzoring.utils.formatters.format_dns_record(results: list[dict], style: str = 'standard', *, show_ttl: bool = False) list[dict][source]

Format DNS records in different styles.

nadzoring.utils.formatters.format_dns_trace(trace_result: dict) list[dict[str, Any]][source]

Format DNS trace results.

nadzoring.utils.formatters.get_terminal_width() int[source]

Get terminal width for table formatting.

nadzoring.utils.formatters.print_csv_table(data: list[dict]) None[source]

Print data as CSV to console.

nadzoring.utils.formatters.print_html_table(data: list[dict], *, full_page: bool = False) None[source]

Print results as HTML.

nadzoring.utils.formatters.print_results_table(data: list[dict], tablefmt: str = 'simple_grid', *, no_color: bool = False) None[source]

Print results as a formatted table with terminal width limiting.

nadzoring.utils.formatters.save_results(data: Any, filename: str, fileformat: str) None[source]

Save results to file in specified format.

nadzoring.utils.formatters.truncate_string(s: str, max_width: int, placeholder: str = '...') str[source]

Truncate string to fit in terminal.

nadzoring.utils.validators module

Input validation utilities.

nadzoring.utils.validators.resolve_hostname(hostname: str) str | None[source]

Resolve hostname to IP address.

nadzoring.utils.validators.validate_domain(domain: str) bool[source]

Validate domain name format.

nadzoring.utils.validators.validate_ip(ip: str) bool[source]

Validate IP address format.

Module contents