diff --git a/utils/__init__.py b/utils/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..80dce5bfc818b089358bcdaf5e169ec8ff80eb3d --- /dev/null +++ b/utils/__init__.py @@ -0,0 +1 @@ +"""Utilities that can be used alongside :term:`GSO`.""" diff --git a/utils/netboxcli.py b/utils/netboxcli.py index 17e496bd275a6586110a6d2f3b44d44b63e67f54..a4d42500fdbb4544059753efd905c92e60eb6e3b 100644 --- a/utils/netboxcli.py +++ b/utils/netboxcli.py @@ -22,12 +22,12 @@ def convert_to_table(data: list[dict[str, Any]], fields: list[str]) -> pd.DataFr @click.group() def cli() -> None: - pass + """Instantiate a new :term:`CLI`.""" @cli.group() def create() -> None: - pass + """Start defining creation commands below.""" @create.command() @@ -45,7 +45,7 @@ def device(fqdn: str, model: str) -> None: @click.option("--type", default="10gbase-t", help="Interface type, default is 10GBASE-T") @click.option("--speed", default="1000", help="Interface speed , default is 1000") @click.option("--fqdn", help="Device where to create interface") -def interface(name: str, type: str, speed: str, fqdn: str) -> None: +def interface(name: str, type: str, speed: str, fqdn: str) -> None: # noqa: A002 """Create a new interface in Netbox.""" click.echo(f"Creating interface: name={name}, speed={speed}, fqdn={fqdn}") new_interface = NetboxClient().create_interface(name, type, speed, fqdn) @@ -103,7 +103,7 @@ create.add_command(device_site) # Define list commands here @cli.group() -def list() -> None: +def list() -> None: # noqa: A001 """Definitions of all listing commands.""" @@ -126,9 +126,7 @@ def interfaces(fqdn: str, speed: str) -> None: "lag", "speed", ] - iface_list = [] - for iface in interface_list: - iface_list.append(dict(iface)) + iface_list = [dict(iface) for iface in interface_list] table = convert_to_table(iface_list, display_fields) click.echo(table)