From 55513f24739c9878b55dbbc1ee0e31e70113828a Mon Sep 17 00:00:00 2001 From: Nautobot-Bot <79372327+nautobot-bot@users.noreply.github.com> Date: Mon, 19 Aug 2024 14:14:25 -0400 Subject: [PATCH] Cookie updated by NetworkToCode Cookie Drift Manager Tool (#264) * Cookie updated by NetworkToCode Cookie Drift Manager Tool Template: ``` { "template": "https://github.com/nautobot/cookiecutter-nautobot-app.git", "dir": "nautobot-app", "ref": "refs/tags/nautobot-app-v2.3.0", "path": null } ``` Cookie: ``` { "remote": "https://github.com/nautobot/nautobot-app-firewall-models.git", "path": "/tmp/tmpjesvwnzl/nautobot-app-firewall-models", "repository_path": "/tmp/tmpjesvwnzl/nautobot-app-firewall-models", "dir": "", "branch_prefix": "drift-manager", "context": { "codeowner_github_usernames": "@whitej6 @itdependsnetworks @jdrew82", "full_name": "Network to Code, LLC", "email": "opensource@networktocode.com", "github_org": "nautobot", "app_name": "nautobot_firewall_models", "verbose_name": "Nautobot Firewall Models", "app_slug": "nautobot-firewall-models", "project_slug": "nautobot-app-firewall-models", "repo_url": "https://github.com/nautobot/nautobot-app-firewall-models", "base_url": "firewall-models", "min_nautobot_version": "2.0.0", "max_nautobot_version": "2.9999", "camel_name": "NautobotFirewallModels", "project_short_description": "Nautobot App to model firewall and security objects. Allows users to model policies in a vendor-neutral manner and use that data to drive network security automation", "model_class_name": "None", "open_source_license": "Apache-2.0", "docs_base_url": "https://docs.nautobot.com", "docs_app_url": "https://docs.nautobot.com/projects/firewall-models/en/latest", "_template": "https://github.com/nautobot/cookiecutter-nautobot-app.git", "_output_dir": "/tmp/tmpjesvwnzl", "_repo_dir": "/github/home/.cookiecutters/cookiecutter-nautobot-app/nautobot-app", "_checkout": "refs/tags/nautobot-app-v2.3.0" }, "base_branch": "develop", "remote_name": "origin", "pull_request_strategy": "PullRequestStrategy.CREATE", "post_actions": [ "PostAction.BLACK" ], "baked_commit_ref": "1724c1ae2e9ba5efe0dc010cb84291b6269b5fa5", "draft": true } ``` CLI Arguments: ``` { "cookie_dir": "", "input": false, "json_filename": "", "output_dir": "", "push": true, "template": "", "template_dir": "", "template_ref": "refs/tags/nautobot-app-v2.3.0", "pull_request": null, "post_action": [], "disable_post_actions": false, "draft": null } ``` * Remove Bandit * Ruff Fixes * Update 264.housekeeping Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com> * Update test_capirca.py Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com> --------- Co-authored-by: bakebot Co-authored-by: Stephen Kiely Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com> --- .bandit.yml | 6 - .cookiecutter.json | 4 +- .dockerignore | 1 - .flake8 | 10 - .github/workflows/ci.yml | 36 +-- README.md | 2 +- changes/264.housekeeping | 1 + development/app_config_schema.py | 1 + development/docker-compose.base.yml | 1 - development/docker-compose.dev.yml | 1 - development/docker-compose.mysql.yml | 3 - development/docker-compose.postgres.yml | 2 - development/docker-compose.redis.yml | 1 - development/nautobot_config.py | 8 +- docs/assets/extra.css | 2 +- docs/dev/contributing.md | 2 +- docs/dev/dev_environment.md | 10 +- docs/requirements.txt | 2 +- mkdocs.yml | 3 +- nautobot_firewall_models/__init__.py | 1 + nautobot_firewall_models/api/serializers.py | 2 +- nautobot_firewall_models/api/urls.py | 1 - nautobot_firewall_models/choices.py | 1 - nautobot_firewall_models/constants.py | 1 + nautobot_firewall_models/fields.py | 1 - nautobot_firewall_models/filters.py | 7 +- nautobot_firewall_models/forms.py | 12 +- nautobot_firewall_models/homepage.py | 3 +- nautobot_firewall_models/jobs.py | 7 +- .../migrations/0001_initial.py | 8 +- .../migrations/0002_custom_status.py | 4 +- .../migrations/0003_default_status.py | 3 +- .../migrations/0005_capircapolicy.py | 5 +- .../migrations/0006_renaming_part1.py | 5 +- .../migrations/0007_renaming_part2.py | 1 + .../migrations/0010_nat_policy.py | 8 +- .../migrations/0013_applications.py | 8 +- .../0015_alter_capircapolicy_device.py | 2 +- .../migrations/0016_nautobot_v2_migrations.py | 3 +- ...018_resolve_issues_through_tables_part2.py | 1 - .../migrations/0020_field_cleanups.py | 1 + ...021_alter_addressobject_status_and_more.py | 3 +- nautobot_firewall_models/models/__init__.py | 4 +- nautobot_firewall_models/models/address.py | 1 - .../models/capirca_policy.py | 1 + nautobot_firewall_models/models/nat_policy.py | 1 - .../models/security_policy.py | 1 - nautobot_firewall_models/models/service.py | 1 - nautobot_firewall_models/models/user.py | 1 - nautobot_firewall_models/models/zone.py | 1 - nautobot_firewall_models/signals.py | 6 +- nautobot_firewall_models/tables.py | 2 +- nautobot_firewall_models/template_content.py | 1 + .../templatetags/fw_tags.py | 1 + nautobot_firewall_models/tests/fixtures.py | 7 +- nautobot_firewall_models/tests/test_api.py | 13 +- nautobot_firewall_models/tests/test_basic.py | 11 +- .../tests/test_capirca.py | 6 +- .../tests/test_filters.py | 2 +- nautobot_firewall_models/tests/test_models.py | 3 +- .../tests/test_ui_views.py | 5 +- nautobot_firewall_models/utils/__init__.py | 6 +- nautobot_firewall_models/utils/capirca.py | 10 +- nautobot_firewall_models/validators.py | 1 + nautobot_firewall_models/viewsets/__init__.py | 14 +- nautobot_firewall_models/viewsets/address.py | 2 +- .../viewsets/capirca_policy.py | 6 +- .../viewsets/nat_policy.py | 11 +- .../viewsets/security_policy.py | 11 +- nautobot_firewall_models/viewsets/service.py | 2 +- nautobot_firewall_models/viewsets/user.py | 2 +- nautobot_firewall_models/viewsets/zone.py | 2 +- poetry.lock | 273 ++++-------------- pyproject.toml | 45 +-- tasks.py | 117 ++++---- 75 files changed, 261 insertions(+), 493 deletions(-) delete mode 100644 .bandit.yml delete mode 100644 .flake8 create mode 100644 changes/264.housekeeping diff --git a/.bandit.yml b/.bandit.yml deleted file mode 100644 index 56f7a83b..00000000 --- a/.bandit.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -skips: [] -# No need to check for security issues in the test scripts! -exclude_dirs: - - "./tests/" - - "./.venv/" diff --git a/.cookiecutter.json b/.cookiecutter.json index f70650bc..e47427a6 100644 --- a/.cookiecutter.json +++ b/.cookiecutter.json @@ -21,7 +21,7 @@ "_drift_manager": { "template": "https://github.com/nautobot/cookiecutter-nautobot-app.git", "template_dir": "nautobot-app", - "template_ref": "refs/tags/nautobot-app-v2.2.1", + "template_ref": "refs/tags/nautobot-app-v2.3.0", "cookie_dir": "", "branch_prefix": "drift-manager", "pull_request_strategy": "create", @@ -29,7 +29,7 @@ "black" ], "draft": true, - "baked_commit_ref": "1724c1ae2e9ba5efe0dc010cb84291b6269b5fa5" + "baked_commit_ref": "fcb62757ef4e78dd327cacb192ea19f1ac5344f8" } } } diff --git a/.dockerignore b/.dockerignore index 2270f496..a0bf06f4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -19,7 +19,6 @@ FAQ.md .git/ .gitignore .github -tasks.py LICENSE **/*.log **/.vscode/ diff --git a/.flake8 b/.flake8 deleted file mode 100644 index c9f5e84d..00000000 --- a/.flake8 +++ /dev/null @@ -1,10 +0,0 @@ -[flake8] -ignore = - E501, # Line length is enforced by Black, so flake8 doesn't need to check it - W503 # Black disagrees with this rule, as does PEP 8; Black wins -exclude = - migrations, - __pycache__, - manage.py, - settings.py, - .venv diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34fe4aae..9ddb57c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ env: APP_NAME: "nautobot-app-firewall-models" jobs: - black: + ruff-format: runs-on: "ubuntu-22.04" env: INVOKE_NAUTOBOT_FIREWALL_MODELS_LOCAL: "True" @@ -25,20 +25,9 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" - - name: "Linting: black" - run: "poetry run invoke black" - bandit: - runs-on: "ubuntu-22.04" - env: - INVOKE_NAUTOBOT_FIREWALL_MODELS_LOCAL: "True" - steps: - - name: "Check out repository code" - uses: "actions/checkout@v4" - - name: "Setup environment" - uses: "networktocode/gh-action-setup-poetry-environment@v6" - - name: "Linting: bandit" - run: "poetry run invoke bandit" - ruff: + - name: "Linting: ruff format" + run: "poetry run invoke ruff --action format" + ruff-lint: runs-on: "ubuntu-22.04" env: INVOKE_NAUTOBOT_FIREWALL_MODELS_LOCAL: "True" @@ -60,17 +49,6 @@ jobs: uses: "networktocode/gh-action-setup-poetry-environment@v6" - name: "Check Docs Build" run: "poetry run invoke build-and-check-docs" - flake8: - runs-on: "ubuntu-22.04" - env: - INVOKE_NAUTOBOT_FIREWALL_MODELS_LOCAL: "True" - steps: - - name: "Check out repository code" - uses: "actions/checkout@v4" - - name: "Setup environment" - uses: "networktocode/gh-action-setup-poetry-environment@v6" - - name: "Linting: flake8" - run: "poetry run invoke flake8" poetry: runs-on: "ubuntu-22.04" env: @@ -95,12 +73,10 @@ jobs: run: "poetry run invoke yamllint" check-in-docker: needs: - - "bandit" - - "ruff" - - "flake8" + - "ruff-format" + - "ruff-lint" - "poetry" - "yamllint" - - "black" runs-on: "ubuntu-22.04" strategy: fail-fast: true diff --git a/README.md b/README.md index 2614705f..749b6bfc 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
- An App for Nautobot. + An App for Nautobot.

## Overview diff --git a/changes/264.housekeeping b/changes/264.housekeeping new file mode 100644 index 00000000..f61c7c07 --- /dev/null +++ b/changes/264.housekeeping @@ -0,0 +1 @@ +Rebaked from the cookie `nautobot-app-v2.3.0`. \ No newline at end of file diff --git a/development/app_config_schema.py b/development/app_config_schema.py index 47009954..a779b14e 100644 --- a/development/app_config_schema.py +++ b/development/app_config_schema.py @@ -1,4 +1,5 @@ """App Config Schema Generator and Validator.""" + import json from importlib import import_module from os import getenv diff --git a/development/docker-compose.base.yml b/development/docker-compose.base.yml index 708feb2b..17ffe067 100644 --- a/development/docker-compose.base.yml +++ b/development/docker-compose.base.yml @@ -13,7 +13,6 @@ x-nautobot-base: &nautobot-base - "creds.env" tty: true -version: "3.8" services: nautobot: depends_on: diff --git a/development/docker-compose.dev.yml b/development/docker-compose.dev.yml index 3cae8785..9752abb1 100644 --- a/development/docker-compose.dev.yml +++ b/development/docker-compose.dev.yml @@ -3,7 +3,6 @@ # any override will need to include these volumes to use them. # see: https://github.com/docker/compose/issues/3729 --- -version: "3.8" services: nautobot: command: "nautobot-server runserver 0.0.0.0:8080" diff --git a/development/docker-compose.mysql.yml b/development/docker-compose.mysql.yml index 062ada94..dbe31cba 100644 --- a/development/docker-compose.mysql.yml +++ b/development/docker-compose.mysql.yml @@ -1,6 +1,4 @@ --- -version: "3.8" - services: nautobot: environment: @@ -19,7 +17,6 @@ services: db: image: "mysql:8" command: - - "--default-authentication-plugin=mysql_native_password" - "--max_connections=1000" env_file: - "development.env" diff --git a/development/docker-compose.postgres.yml b/development/docker-compose.postgres.yml index 12d1de31..8d96fdba 100644 --- a/development/docker-compose.postgres.yml +++ b/development/docker-compose.postgres.yml @@ -1,6 +1,4 @@ --- -version: "3.8" - services: nautobot: environment: diff --git a/development/docker-compose.redis.yml b/development/docker-compose.redis.yml index 6da9fa01..b5e266a3 100644 --- a/development/docker-compose.redis.yml +++ b/development/docker-compose.redis.yml @@ -1,5 +1,4 @@ --- -version: "3.8" services: redis: image: "redis:6-alpine" diff --git a/development/nautobot_config.py b/development/nautobot_config.py index f83c96c8..a9fdd3cd 100644 --- a/development/nautobot_config.py +++ b/development/nautobot_config.py @@ -1,4 +1,5 @@ """Nautobot development configuration file.""" + import os import sys @@ -9,7 +10,7 @@ # Debug # -DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", False)) +DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", "false")) _TESTING = len(sys.argv) > 1 and sys.argv[1] == "test" if DEBUG and not _TESTING: @@ -47,9 +48,10 @@ "PASSWORD": os.getenv("NAUTOBOT_DB_PASSWORD", ""), # Database password "HOST": os.getenv("NAUTOBOT_DB_HOST", "localhost"), # Database server "PORT": os.getenv( - "NAUTOBOT_DB_PORT", default_db_settings[nautobot_db_engine]["NAUTOBOT_DB_PORT"] + "NAUTOBOT_DB_PORT", + default_db_settings[nautobot_db_engine]["NAUTOBOT_DB_PORT"], ), # Database port, default to postgres - "CONN_MAX_AGE": int(os.getenv("NAUTOBOT_DB_TIMEOUT", 300)), # Database timeout + "CONN_MAX_AGE": int(os.getenv("NAUTOBOT_DB_TIMEOUT", "300")), # Database timeout "ENGINE": nautobot_db_engine, } } diff --git a/docs/assets/extra.css b/docs/assets/extra.css index 1eff1192..3f3931a0 100644 --- a/docs/assets/extra.css +++ b/docs/assets/extra.css @@ -96,7 +96,7 @@ a.autorefs-external:hover::after { } -/* Customization for mkdocs-version-annotations */ +/* Customization for markdown-version-annotations */ :root { /* Icon for "version-added" admonition: Material Design Icons "plus-box-outline" */ --md-admonition-icon--version-added: url('data:image/svg+xml;charset=utf-8,'); diff --git a/docs/dev/contributing.md b/docs/dev/contributing.md index 02086dc8..e23e6365 100644 --- a/docs/dev/contributing.md +++ b/docs/dev/contributing.md @@ -4,7 +4,7 @@ The project is packaged with a light [development environment](dev_environment.m The project is following Network to Code software development guidelines and is leveraging the following: -- Python linting and formatting: `black`, `pylint`, `bandit`, `flake8`, and `ruff`. +- Python linting and formatting: `pylint` and `ruff`. - YAML linting is done with `yamllint`. - Django unit test to ensure the app is working properly. diff --git a/docs/dev/dev_environment.md b/docs/dev/dev_environment.md index e1aef018..0fd1133f 100644 --- a/docs/dev/dev_environment.md +++ b/docs/dev/dev_environment.md @@ -123,10 +123,7 @@ Each command can be executed with `invoke `. All commands support the a #### Testing ``` - bandit Run bandit to validate basic static code security analysis. - black Run black to check that Python files adhere to its style standards. - flake8 Run flake8 to check that Python files adhere to its style standards. - ruff Run ruff to validate docstring formatting adheres to NTC defined standards. + ruff Run ruff to perform code formatting and/or linting. pylint Run pylint code analysis. tests Run all tests for this app. unittest Run Django unit tests for the app. @@ -454,7 +451,7 @@ This is the same as running: ### Tests -To run tests against your code, you can run all of the tests that TravisCI runs against any new PR with: +To run tests against your code, you can run all of the tests that the CI runs against any new PR with: ```bash ➜ invoke tests @@ -464,9 +461,6 @@ To run an individual test, you can run any or all of the following: ```bash ➜ invoke unittest -➜ invoke bandit -➜ invoke black -➜ invoke flake8 ➜ invoke ruff ➜ invoke pylint ``` diff --git a/docs/requirements.txt b/docs/requirements.txt index d168c88f..1d89ad0d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ mkdocs==1.5.2 mkdocs-material==9.1.15 -mkdocs-version-annotations==1.0.0 +markdown-version-annotations==1.0.1 mkdocstrings-python==1.5.2 mkdocstrings==0.22.0 diff --git a/mkdocs.yml b/mkdocs.yml index 24b5f5a2..fbdd9a12 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -72,6 +72,8 @@ extra: link: "https://twitter.com/networktocode" name: "Network to Code Twitter" markdown_extensions: + - "markdown_version_annotations": + admonition_tag: "???" - "admonition" - "toc": permalink: true @@ -89,7 +91,6 @@ markdown_extensions: - "footnotes" plugins: - "search" - - "mkdocs-version-annotations" - "mkdocstrings": default_handler: "python" handlers: diff --git a/nautobot_firewall_models/__init__.py b/nautobot_firewall_models/__init__.py index e5676e33..c8874e78 100644 --- a/nautobot_firewall_models/__init__.py +++ b/nautobot_firewall_models/__init__.py @@ -1,4 +1,5 @@ """App declaration for nautobot_firewall_models.""" + # Metadata is inherited from Nautobot. If not including Nautobot in the environment, this should be added from importlib import metadata diff --git a/nautobot_firewall_models/api/serializers.py b/nautobot_firewall_models/api/serializers.py index bb932076..f250c273 100644 --- a/nautobot_firewall_models/api/serializers.py +++ b/nautobot_firewall_models/api/serializers.py @@ -1,7 +1,7 @@ """API serializers for firewall models.""" -from rest_framework import serializers from nautobot.apps.api import NautobotModelSerializer, ValidatedModelSerializer +from rest_framework import serializers from nautobot_firewall_models import models diff --git a/nautobot_firewall_models/api/urls.py b/nautobot_firewall_models/api/urls.py index e3eeb56e..8c18b15d 100644 --- a/nautobot_firewall_models/api/urls.py +++ b/nautobot_firewall_models/api/urls.py @@ -4,7 +4,6 @@ from nautobot_firewall_models.api import views - router = OrderedDefaultRouter() router.register("address-object", views.AddressObjectViewSet) router.register("address-object-group", views.AddressObjectGroupViewSet) diff --git a/nautobot_firewall_models/choices.py b/nautobot_firewall_models/choices.py index d78062d1..207898a8 100644 --- a/nautobot_firewall_models/choices.py +++ b/nautobot_firewall_models/choices.py @@ -2,7 +2,6 @@ from netutils.protocol_mapper import PROTO_NAME_TO_NUM - IP_PROTOCOL_CHOICES = tuple((i, i) for i in PROTO_NAME_TO_NUM.keys()) # pylint: disable=consider-iterating-dictionary ACTION_CHOICES = (("allow", "allow"), ("deny", "deny"), ("drop", "drop"), ("remark", "remark")) diff --git a/nautobot_firewall_models/constants.py b/nautobot_firewall_models/constants.py index d642c106..526462c3 100644 --- a/nautobot_firewall_models/constants.py +++ b/nautobot_firewall_models/constants.py @@ -1,4 +1,5 @@ """Constants file.""" + from django.conf import settings # This is used to map the slug of the platform in the customers environment to the expected name that Capirca is looking for diff --git a/nautobot_firewall_models/fields.py b/nautobot_firewall_models/fields.py index 74f1ddc5..c8c7a4a5 100644 --- a/nautobot_firewall_models/fields.py +++ b/nautobot_firewall_models/fields.py @@ -1,7 +1,6 @@ """Creating fields for IPRange models.""" from django import forms - from nautobot.ipam.formfields import IPAddressFormField diff --git a/nautobot_firewall_models/filters.py b/nautobot_firewall_models/filters.py index d1f4a873..990c41f9 100644 --- a/nautobot_firewall_models/filters.py +++ b/nautobot_firewall_models/filters.py @@ -1,13 +1,14 @@ """Filtering for Firewall Model App.""" + +import django_filters from django.contrib.contenttypes.fields import GenericRelation from django.core.exceptions import ValidationError from django.db.models import Q -import django_filters from nautobot.apps.filters import ( - NautobotFilterSet, - StatusModelFilterSetMixin, MultiValueCharFilter, NaturalKeyOrPKMultipleChoiceFilter, + NautobotFilterSet, + StatusModelFilterSetMixin, ) from nautobot.dcim.models import Device diff --git a/nautobot_firewall_models/forms.py b/nautobot_firewall_models/forms.py index dd4c8104..e0d9768f 100644 --- a/nautobot_firewall_models/forms.py +++ b/nautobot_firewall_models/forms.py @@ -1,6 +1,12 @@ """Forms for the Firewall app.""" from django import forms +from nautobot.apps.forms import ( + DynamicModelChoiceField, + DynamicModelMultipleChoiceField, + TagFilterField, + add_blank_choice, +) from nautobot.dcim.models import Device, Interface from nautobot.extras.forms import ( CustomFieldModelCSVForm, @@ -15,12 +21,6 @@ from nautobot.ipam.models import VRF, IPAddress, Prefix from nautobot.tenancy.forms import TenancyFilterForm, TenancyForm from nautobot.tenancy.models import Tenant -from nautobot.apps.forms import ( - DynamicModelChoiceField, - DynamicModelMultipleChoiceField, - TagFilterField, - add_blank_choice, -) from nautobot_firewall_models import choices, fields, models diff --git a/nautobot_firewall_models/homepage.py b/nautobot_firewall_models/homepage.py index 43fd948f..a3d4a08c 100644 --- a/nautobot_firewall_models/homepage.py +++ b/nautobot_firewall_models/homepage.py @@ -1,7 +1,8 @@ """Adds App items to homepage.""" + from nautobot.core.apps import HomePageItem, HomePagePanel -from nautobot_firewall_models.models import Policy, PolicyRule, CapircaPolicy, NATPolicy, NATPolicyRule +from nautobot_firewall_models.models import CapircaPolicy, NATPolicy, NATPolicyRule, Policy, PolicyRule layout = ( HomePagePanel( diff --git a/nautobot_firewall_models/jobs.py b/nautobot_firewall_models/jobs.py index caeccb18..47603ad9 100644 --- a/nautobot_firewall_models/jobs.py +++ b/nautobot_firewall_models/jobs.py @@ -1,11 +1,10 @@ """Jobs to run backups, intended config, and compliance.""" -from nautobot.extras.jobs import Job, MultiObjectVar, get_task_logger from nautobot.core.celery import register_jobs - from nautobot.dcim.models import Device -from nautobot_firewall_models.models import CapircaPolicy -from nautobot_firewall_models.models import Policy +from nautobot.extras.jobs import Job, MultiObjectVar, get_task_logger + +from nautobot_firewall_models.models import CapircaPolicy, Policy logger = get_task_logger(__name__) diff --git a/nautobot_firewall_models/migrations/0001_initial.py b/nautobot_firewall_models/migrations/0001_initial.py index 92af72e0..a168286c 100644 --- a/nautobot_firewall_models/migrations/0001_initial.py +++ b/nautobot_firewall_models/migrations/0001_initial.py @@ -1,14 +1,16 @@ # Generated by Django 3.2.13 on 2022-05-16 23:53 +import uuid + import django.core.serializers.json -from django.db import migrations, models import django.db.models.deletion import nautobot.extras.models.mixins import nautobot.extras.models.statuses import nautobot.ipam.fields -import nautobot_firewall_models.validators import taggit.managers -import uuid +from django.db import migrations, models + +import nautobot_firewall_models.validators class Migration(migrations.Migration): diff --git a/nautobot_firewall_models/migrations/0002_custom_status.py b/nautobot_firewall_models/migrations/0002_custom_status.py index 170c48f5..d9d473bd 100644 --- a/nautobot_firewall_models/migrations/0002_custom_status.py +++ b/nautobot_firewall_models/migrations/0002_custom_status.py @@ -1,9 +1,9 @@ # Generated by Django 3.2.13 on 2022-04-23 23:14 import os -from django.db import migrations -from django.core.exceptions import ObjectDoesNotExist import yaml +from django.core.exceptions import ObjectDoesNotExist +from django.db import migrations def create_status(apps, schema_editor): diff --git a/nautobot_firewall_models/migrations/0003_default_status.py b/nautobot_firewall_models/migrations/0003_default_status.py index 815aa0f4..d983b60c 100644 --- a/nautobot_firewall_models/migrations/0003_default_status.py +++ b/nautobot_firewall_models/migrations/0003_default_status.py @@ -1,8 +1,9 @@ # Generated by Django 3.2.13 on 2022-05-16 23:54 -from django.db import migrations import django.db.models.deletion import nautobot.extras.models.statuses +from django.db import migrations + import nautobot_firewall_models.utils diff --git a/nautobot_firewall_models/migrations/0005_capircapolicy.py b/nautobot_firewall_models/migrations/0005_capircapolicy.py index 5a13a1e5..97c594e7 100644 --- a/nautobot_firewall_models/migrations/0005_capircapolicy.py +++ b/nautobot_firewall_models/migrations/0005_capircapolicy.py @@ -1,11 +1,12 @@ # Generated by Django 3.2.14 on 2022-07-09 22:10 +import uuid + import django.core.serializers.json -from django.db import migrations, models import django.db.models.deletion import nautobot.extras.models.mixins import taggit.managers -import uuid +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/nautobot_firewall_models/migrations/0006_renaming_part1.py b/nautobot_firewall_models/migrations/0006_renaming_part1.py index ca6e87a6..3fbed127 100644 --- a/nautobot_firewall_models/migrations/0006_renaming_part1.py +++ b/nautobot_firewall_models/migrations/0006_renaming_part1.py @@ -1,9 +1,10 @@ # Generated by Django 3.2.15 on 2022-08-26 18:03 -from django.db import migrations, models -import django.db.models.deletion import uuid +import django.db.models.deletion +from django.db import migrations, models + class Migration(migrations.Migration): dependencies = [ diff --git a/nautobot_firewall_models/migrations/0007_renaming_part2.py b/nautobot_firewall_models/migrations/0007_renaming_part2.py index 60699e50..2d9fcebe 100644 --- a/nautobot_firewall_models/migrations/0007_renaming_part2.py +++ b/nautobot_firewall_models/migrations/0007_renaming_part2.py @@ -1,4 +1,5 @@ """Custom migration for moving index to the PolicyRule.""" + from django.db import migrations from django.db.models import Count diff --git a/nautobot_firewall_models/migrations/0010_nat_policy.py b/nautobot_firewall_models/migrations/0010_nat_policy.py index 5717b655..65e9e861 100644 --- a/nautobot_firewall_models/migrations/0010_nat_policy.py +++ b/nautobot_firewall_models/migrations/0010_nat_policy.py @@ -1,13 +1,15 @@ # Generated by Django 3.2.15 on 2022-09-28 11:31 +import uuid + import django.core.serializers.json -from django.db import migrations, models import django.db.models.deletion import nautobot.extras.models.mixins import nautobot.extras.models.statuses -import nautobot_firewall_models.utils import taggit.managers -import uuid +from django.db import migrations, models + +import nautobot_firewall_models.utils class Migration(migrations.Migration): diff --git a/nautobot_firewall_models/migrations/0013_applications.py b/nautobot_firewall_models/migrations/0013_applications.py index dcd7ed4e..4157ee69 100644 --- a/nautobot_firewall_models/migrations/0013_applications.py +++ b/nautobot_firewall_models/migrations/0013_applications.py @@ -1,13 +1,15 @@ # Generated by Django 3.2.15 on 2022-11-22 21:23 +import uuid + import django.core.serializers.json -from django.db import migrations, models import django.db.models.deletion import nautobot.extras.models.mixins import nautobot.extras.models.statuses -import nautobot_firewall_models.utils import taggit.managers -import uuid +from django.db import migrations, models + +import nautobot_firewall_models.utils class Migration(migrations.Migration): diff --git a/nautobot_firewall_models/migrations/0015_alter_capircapolicy_device.py b/nautobot_firewall_models/migrations/0015_alter_capircapolicy_device.py index e49e4c5e..f9dd82b2 100644 --- a/nautobot_firewall_models/migrations/0015_alter_capircapolicy_device.py +++ b/nautobot_firewall_models/migrations/0015_alter_capircapolicy_device.py @@ -1,7 +1,7 @@ # Generated by Django 3.2.15 on 2023-05-03 22:37 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/nautobot_firewall_models/migrations/0016_nautobot_v2_migrations.py b/nautobot_firewall_models/migrations/0016_nautobot_v2_migrations.py index db9fb927..977f9fcc 100644 --- a/nautobot_firewall_models/migrations/0016_nautobot_v2_migrations.py +++ b/nautobot_firewall_models/migrations/0016_nautobot_v2_migrations.py @@ -1,9 +1,10 @@ # Generated by Django 3.2.20 on 2023-09-12 20:51 -from django.db import migrations, models import django.db.models.deletion import nautobot.core.models.fields import nautobot.extras.models.statuses +from django.db import migrations, models + import nautobot_firewall_models.utils diff --git a/nautobot_firewall_models/migrations/0018_resolve_issues_through_tables_part2.py b/nautobot_firewall_models/migrations/0018_resolve_issues_through_tables_part2.py index fed205b9..ebfdbd2e 100644 --- a/nautobot_firewall_models/migrations/0018_resolve_issues_through_tables_part2.py +++ b/nautobot_firewall_models/migrations/0018_resolve_issues_through_tables_part2.py @@ -2,7 +2,6 @@ from django.db import migrations - affected_models = [ {"model": "nautobot_firewall_models.AddressObjectGroup", "old": "address_objects", "new": "new_address_objects"}, {"model": "nautobot_firewall_models.FQDN", "old": "ip_addresses", "new": "new_ip_addresses"}, diff --git a/nautobot_firewall_models/migrations/0020_field_cleanups.py b/nautobot_firewall_models/migrations/0020_field_cleanups.py index 1e88ed73..62bdf6c3 100644 --- a/nautobot_firewall_models/migrations/0020_field_cleanups.py +++ b/nautobot_firewall_models/migrations/0020_field_cleanups.py @@ -1,6 +1,7 @@ # Generated by Django 3.2.21 on 2023-09-28 17:07 from django.db import migrations, models + import nautobot_firewall_models.validators diff --git a/nautobot_firewall_models/migrations/0021_alter_addressobject_status_and_more.py b/nautobot_firewall_models/migrations/0021_alter_addressobject_status_and_more.py index a60af5f5..8c9828fe 100644 --- a/nautobot_firewall_models/migrations/0021_alter_addressobject_status_and_more.py +++ b/nautobot_firewall_models/migrations/0021_alter_addressobject_status_and_more.py @@ -1,8 +1,9 @@ # Generated by Django 4.2.14 on 2024-08-06 00:36 -from django.db import migrations import django.db.models.deletion import nautobot.extras.models.statuses +from django.db import migrations + import nautobot_firewall_models.utils diff --git a/nautobot_firewall_models/models/__init__.py b/nautobot_firewall_models/models/__init__.py index c68d476c..6d4e0bde 100644 --- a/nautobot_firewall_models/models/__init__.py +++ b/nautobot_firewall_models/models/__init__.py @@ -1,9 +1,9 @@ """Load models.""" from .address import ( + FQDN, AddressObject, AddressObjectGroup, - FQDN, IPRange, ) from .capirca_policy import ( @@ -11,9 +11,9 @@ ) from .nat_policy import ( NATPolicy, - NATPolicyRule, NATPolicyDeviceM2M, NATPolicyDynamicGroupM2M, + NATPolicyRule, ) from .security_policy import ( Policy, diff --git a/nautobot_firewall_models/models/address.py b/nautobot_firewall_models/models/address.py index fe008bfc..149c5ecf 100644 --- a/nautobot_firewall_models/models/address.py +++ b/nautobot_firewall_models/models/address.py @@ -13,7 +13,6 @@ from nautobot_firewall_models.utils import get_default_status - ########################### # Core Models ########################### diff --git a/nautobot_firewall_models/models/capirca_policy.py b/nautobot_firewall_models/models/capirca_policy.py index c48ac661..8d223590 100644 --- a/nautobot_firewall_models/models/capirca_policy.py +++ b/nautobot_firewall_models/models/capirca_policy.py @@ -1,4 +1,5 @@ """Models for the Capirca Configurations.""" + # pylint: disable=duplicate-code import logging diff --git a/nautobot_firewall_models/models/nat_policy.py b/nautobot_firewall_models/models/nat_policy.py index 146a6d4e..da4c5285 100644 --- a/nautobot_firewall_models/models/nat_policy.py +++ b/nautobot_firewall_models/models/nat_policy.py @@ -8,7 +8,6 @@ from nautobot_firewall_models.utils import get_default_status, model_to_json - ########################### # Core Models ########################### diff --git a/nautobot_firewall_models/models/security_policy.py b/nautobot_firewall_models/models/security_policy.py index 19deeeb6..356d6a29 100644 --- a/nautobot_firewall_models/models/security_policy.py +++ b/nautobot_firewall_models/models/security_policy.py @@ -9,7 +9,6 @@ from nautobot_firewall_models import choices from nautobot_firewall_models.utils import get_default_status, model_to_json - ########################### # Core Models ########################### diff --git a/nautobot_firewall_models/models/service.py b/nautobot_firewall_models/models/service.py index c49a82f5..e9949d6c 100644 --- a/nautobot_firewall_models/models/service.py +++ b/nautobot_firewall_models/models/service.py @@ -9,7 +9,6 @@ from nautobot_firewall_models import choices, validators from nautobot_firewall_models.utils import get_default_status - ########################### # Core Models ########################### diff --git a/nautobot_firewall_models/models/user.py b/nautobot_firewall_models/models/user.py index 7041f625..12486b72 100644 --- a/nautobot_firewall_models/models/user.py +++ b/nautobot_firewall_models/models/user.py @@ -8,7 +8,6 @@ from nautobot_firewall_models.utils import get_default_status - ########################### # Core Models ########################### diff --git a/nautobot_firewall_models/models/zone.py b/nautobot_firewall_models/models/zone.py index 0b7cf598..84887ff1 100644 --- a/nautobot_firewall_models/models/zone.py +++ b/nautobot_firewall_models/models/zone.py @@ -8,7 +8,6 @@ from nautobot_firewall_models.utils import get_default_status - ########################### # Core Models ########################### diff --git a/nautobot_firewall_models/signals.py b/nautobot_firewall_models/signals.py index a9917564..8540fb11 100644 --- a/nautobot_firewall_models/signals.py +++ b/nautobot_firewall_models/signals.py @@ -1,14 +1,14 @@ """Configurable signals.""" + from django.core.exceptions import ValidationError -from django.dispatch import receiver from django.db.models.signals import pre_delete +from django.dispatch import receiver from nautobot.dcim.models import Interface -from nautobot.ipam.models import IPAddress, Prefix, VRF +from nautobot.ipam.models import VRF, IPAddress, Prefix from nautobot_firewall_models import models from nautobot_firewall_models.constants import PLUGIN_CFG - ON_DELETE = { IPAddress: ["fqdns", "address_objects"], Prefix: ["address_objects"], diff --git a/nautobot_firewall_models/tables.py b/nautobot_firewall_models/tables.py index 048b9f27..17bc0cb3 100644 --- a/nautobot_firewall_models/tables.py +++ b/nautobot_firewall_models/tables.py @@ -1,8 +1,8 @@ """Table Views for Firewall Models.""" import django_tables2 as tables -from nautobot.extras.tables import StatusTableMixin from nautobot.apps.tables import BaseTable, ButtonsColumn, ToggleColumn +from nautobot.extras.tables import StatusTableMixin from nautobot_firewall_models import models diff --git a/nautobot_firewall_models/template_content.py b/nautobot_firewall_models/template_content.py index f6dd2231..da3a4466 100644 --- a/nautobot_firewall_models/template_content.py +++ b/nautobot_firewall_models/template_content.py @@ -1,4 +1,5 @@ """Extensions of baseline Nautobot views.""" + from nautobot.apps.ui import TemplateExtension from nautobot_firewall_models.models import CapircaPolicy diff --git a/nautobot_firewall_models/templatetags/fw_tags.py b/nautobot_firewall_models/templatetags/fw_tags.py index 199469af..e8ec767d 100644 --- a/nautobot_firewall_models/templatetags/fw_tags.py +++ b/nautobot_firewall_models/templatetags/fw_tags.py @@ -1,4 +1,5 @@ """Add custom templatetags.""" + from django import template register = template.Library() diff --git a/nautobot_firewall_models/tests/fixtures.py b/nautobot_firewall_models/tests/fixtures.py index 9fc157e7..b9aadf1b 100644 --- a/nautobot_firewall_models/tests/fixtures.py +++ b/nautobot_firewall_models/tests/fixtures.py @@ -1,10 +1,11 @@ """Create basic objects for use in test class setup.""" -# flake8: noqa: F403,405 + +# noqa: F403, F405 from django.contrib.contenttypes.models import ContentType -from nautobot.dcim.models import Device, DeviceType, Manufacturer, Platform, Location, LocationType +from nautobot.dcim.models import Device, DeviceType, Location, LocationType, Manufacturer, Platform from nautobot.extras.models import DynamicGroup, Job, Role from nautobot.extras.models.statuses import Status -from nautobot.ipam.models import Prefix, VRF, Namespace +from nautobot.ipam.models import VRF, Namespace, Prefix from nautobot.ipam.models import IPAddress as IPAddr from nautobot.tenancy.models import Tenant, TenantGroup diff --git a/nautobot_firewall_models/tests/test_api.py b/nautobot_firewall_models/tests/test_api.py index 484cf356..17b0730e 100644 --- a/nautobot_firewall_models/tests/test_api.py +++ b/nautobot_firewall_models/tests/test_api.py @@ -1,17 +1,16 @@ -"""Unit tests for API views.""" +"""Unit tests for nautobot_firewall_models.""" -# flake8: noqa: F403,405 -# pylint: disable=invalid-name -# pylint: disable=duplicate-code +# pylint: disable=invalid-name, duplicate-code from django.contrib.contenttypes.models import ContentType from nautobot.apps.testing import APIViewTestCases, disable_warnings -from nautobot.dcim.models import Location, Platform, DeviceType, Device -from nautobot.extras.models import Status, Role -from nautobot.ipam.models import Prefix, VRF +from nautobot.dcim.models import Device, DeviceType, Location, Platform +from nautobot.extras.models import Role, Status +from nautobot.ipam.models import VRF, Prefix from nautobot.users.models import ObjectPermission from rest_framework import status as drf_status from nautobot_firewall_models import models + from . import fixtures diff --git a/nautobot_firewall_models/tests/test_basic.py b/nautobot_firewall_models/tests/test_basic.py index bcf7d12d..d72f2d02 100644 --- a/nautobot_firewall_models/tests/test_basic.py +++ b/nautobot_firewall_models/tests/test_basic.py @@ -1,6 +1,8 @@ """Basic tests that do not require Django.""" -import unittest + import os +import unittest + import toml @@ -15,8 +17,9 @@ def test_version(self): with open(f"{parent_path}/docs/requirements.txt", "r", encoding="utf-8") as file: requirements = [line for line in file.read().splitlines() if (len(line) > 0 and not line.startswith("#"))] for pkg in requirements: - if len(pkg.split("==")) == 2: - pkg, version = pkg.split("==") + package_name = pkg + if len(pkg.split("==")) == 2: # noqa: PLR2004 + package_name, version = pkg.split("==") else: version = "*" - self.assertEqual(poetry_details[pkg], version) + self.assertEqual(poetry_details[package_name], version) diff --git a/nautobot_firewall_models/tests/test_capirca.py b/nautobot_firewall_models/tests/test_capirca.py index a0e9356e..7373e06d 100644 --- a/nautobot_firewall_models/tests/test_capirca.py +++ b/nautobot_firewall_models/tests/test_capirca.py @@ -1,8 +1,10 @@ """Test Capirca Utils.""" -# flake8: noqa: F403,405 + +# noqa: F403, F405 # pylint: disable=protected-access from unittest import skip from unittest.mock import patch + from django.core.exceptions import ValidationError from django.test import TestCase from nautobot.dcim.models import Device, Platform @@ -10,7 +12,7 @@ from nautobot.ipam.models import IPAddress, Namespace from nautobot_firewall_models.models import * # pylint: disable=unused-wildcard-import, wildcard-import -from nautobot_firewall_models.utils.capirca import generate_capirca_config, PolicyToCapirca, DevicePolicyToCapirca +from nautobot_firewall_models.utils.capirca import DevicePolicyToCapirca, PolicyToCapirca, generate_capirca_config from .fixtures import create_capirca_env diff --git a/nautobot_firewall_models/tests/test_filters.py b/nautobot_firewall_models/tests/test_filters.py index b69b96ef..372fa735 100644 --- a/nautobot_firewall_models/tests/test_filters.py +++ b/nautobot_firewall_models/tests/test_filters.py @@ -2,8 +2,8 @@ # pylint: disable=invalid-name from django.test import TestCase - from nautobot.dcim.models import Device + from nautobot_firewall_models import filters, models from .fixtures import create_capirca_env diff --git a/nautobot_firewall_models/tests/test_models.py b/nautobot_firewall_models/tests/test_models.py index b77f29a4..0f58a1c8 100644 --- a/nautobot_firewall_models/tests/test_models.py +++ b/nautobot_firewall_models/tests/test_models.py @@ -1,5 +1,6 @@ """Test Firewall models.""" -# flake8: noqa: F403,405 + +# noqa: F403, F405 # pylint: disable=invalid-name from django.core.exceptions import ValidationError from django.test import TestCase diff --git a/nautobot_firewall_models/tests/test_ui_views.py b/nautobot_firewall_models/tests/test_ui_views.py index 9e966515..bb70519a 100644 --- a/nautobot_firewall_models/tests/test_ui_views.py +++ b/nautobot_firewall_models/tests/test_ui_views.py @@ -1,13 +1,14 @@ """Unit tests for views.""" -# flake8: noqa: F403,405 +# noqa: F403, F405 # pylint: disable=invalid-name # pylint: disable=duplicate-code +from nautobot.apps.testing import ViewTestCases from nautobot.dcim.models import Device from nautobot.extras.models.statuses import Status -from nautobot.apps.testing import ViewTestCases from nautobot_firewall_models.models import * # pylint: disable=unused-wildcard-import, wildcard-import + from . import fixtures diff --git a/nautobot_firewall_models/utils/__init__.py b/nautobot_firewall_models/utils/__init__.py index 218a0213..937a53df 100644 --- a/nautobot_firewall_models/utils/__init__.py +++ b/nautobot_firewall_models/utils/__init__.py @@ -1,10 +1,12 @@ """Help funcs for firewall models app.""" + import json + from django.conf import settings from django.utils.module_loading import import_string -from rest_framework.renderers import JSONRenderer -from nautobot.extras.models import Status from nautobot.core.models.utils import serialize_object_v2 +from nautobot.extras.models import Status +from rest_framework.renderers import JSONRenderer def get_default_status(): diff --git a/nautobot_firewall_models/utils/capirca.py b/nautobot_firewall_models/utils/capirca.py index 712c01b5..0673978c 100644 --- a/nautobot_firewall_models/utils/capirca.py +++ b/nautobot_firewall_models/utils/capirca.py @@ -1,23 +1,23 @@ """Management command to bootstrap dummy data for firewall model app.""" + # pylint: disable=too-many-instance-attributes,too-many-locals import logging import re import unicodedata -from capirca.lib.naming import Naming -from capirca.lib import policy +from capirca.lib import policy +from capirca.lib.naming import Naming from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError from django.utils.module_loading import import_string - from nautobot.dcim.models import Platform from nautobot_firewall_models.constants import ( + ACTION_MAP, ALLOW_STATUS, + CAPIRCA_MAPPER, CAPIRCA_OS_MAPPER, - ACTION_MAP, LOGGING_MAP, - CAPIRCA_MAPPER, PLUGIN_CFG, ) from nautobot_firewall_models.utils import model_to_json diff --git a/nautobot_firewall_models/validators.py b/nautobot_firewall_models/validators.py index ae3890a4..bcca5e0c 100644 --- a/nautobot_firewall_models/validators.py +++ b/nautobot_firewall_models/validators.py @@ -1,4 +1,5 @@ """Validators for app.""" + import re from django.core.exceptions import ValidationError diff --git a/nautobot_firewall_models/viewsets/__init__.py b/nautobot_firewall_models/viewsets/__init__.py index 9b9a4c5e..8c4ac4ef 100644 --- a/nautobot_firewall_models/viewsets/__init__.py +++ b/nautobot_firewall_models/viewsets/__init__.py @@ -1,23 +1,23 @@ """UI Viewsets.""" + from nautobot_firewall_models.viewsets.address import ( - AddressObjectUIViewSet, AddressObjectGroupUIViewSet, + AddressObjectUIViewSet, FQDNUIViewSet, IPRangeUIViewSet, ) -from nautobot_firewall_models.viewsets.capirca_policy import CapircaPolicyUIViewSet, CapircaPolicyDeviceUIViewSet +from nautobot_firewall_models.viewsets.capirca_policy import CapircaPolicyDeviceUIViewSet, CapircaPolicyUIViewSet from nautobot_firewall_models.viewsets.nat_policy import NATPolicyRuleUIViewSet, NATPolicyUIViewSet -from nautobot_firewall_models.viewsets.security_policy import PolicyUIViewSet, PolicyRuleUIViewSet +from nautobot_firewall_models.viewsets.security_policy import PolicyRuleUIViewSet, PolicyUIViewSet from nautobot_firewall_models.viewsets.service import ( - ApplicationObjectUIViewSet, ApplicationObjectGroupUIViewSet, - ServiceObjectUIViewSet, + ApplicationObjectUIViewSet, ServiceObjectGroupUIViewSet, + ServiceObjectUIViewSet, ) -from nautobot_firewall_models.viewsets.user import UserObjectUIViewSet, UserObjectGroupUIViewSet +from nautobot_firewall_models.viewsets.user import UserObjectGroupUIViewSet, UserObjectUIViewSet from nautobot_firewall_models.viewsets.zone import ZoneUIViewSet - __all__ = ( "AddressObjectUIViewSet", "AddressObjectGroupUIViewSet", diff --git a/nautobot_firewall_models/viewsets/address.py b/nautobot_firewall_models/viewsets/address.py index a4f85fae..744808d6 100644 --- a/nautobot_firewall_models/viewsets/address.py +++ b/nautobot_firewall_models/viewsets/address.py @@ -2,8 +2,8 @@ from nautobot.apps.views import NautobotUIViewSet +from nautobot_firewall_models import filters, forms, models, tables from nautobot_firewall_models.api import serializers -from nautobot_firewall_models import forms, models, tables, filters class AddressObjectUIViewSet(NautobotUIViewSet): diff --git a/nautobot_firewall_models/viewsets/capirca_policy.py b/nautobot_firewall_models/viewsets/capirca_policy.py index ff0c4151..4985f593 100644 --- a/nautobot_firewall_models/viewsets/capirca_policy.py +++ b/nautobot_firewall_models/viewsets/capirca_policy.py @@ -1,17 +1,17 @@ """Capirca Policy Object Viewsets.""" from nautobot.apps.views import ( - ObjectListViewMixin, ObjectBulkDestroyViewMixin, - ObjectDetailViewMixin, ObjectChangeLogViewMixin, ObjectDestroyViewMixin, + ObjectDetailViewMixin, + ObjectListViewMixin, ) from nautobot.dcim.models import Device from rest_framework.response import Response +from nautobot_firewall_models import filters, forms, models, tables from nautobot_firewall_models.api import serializers -from nautobot_firewall_models import forms, models, tables, filters class CapircaPolicyUIViewSet( diff --git a/nautobot_firewall_models/viewsets/nat_policy.py b/nautobot_firewall_models/viewsets/nat_policy.py index 1afee163..1d437aa2 100644 --- a/nautobot_firewall_models/viewsets/nat_policy.py +++ b/nautobot_firewall_models/viewsets/nat_policy.py @@ -1,4 +1,5 @@ """NAT Rule Object Viewsets.""" + from django.shortcuts import redirect from django.urls import reverse from nautobot.apps.views import NautobotUIViewSet @@ -6,16 +7,16 @@ from rest_framework.decorators import action from nautobot_firewall_models.api.serializers import NATPolicyRuleSerializer, NATPolicySerializer -from nautobot_firewall_models.filters import NATPolicyRuleFilterSet, NATPolicyFilterSet +from nautobot_firewall_models.filters import NATPolicyFilterSet, NATPolicyRuleFilterSet from nautobot_firewall_models.forms import ( - NATPolicyRuleBulkEditForm, - NATPolicyRuleFilterForm, - NATPolicyRuleForm, NATPolicyBulkEditForm, NATPolicyFilterForm, NATPolicyForm, + NATPolicyRuleBulkEditForm, + NATPolicyRuleFilterForm, + NATPolicyRuleForm, ) -from nautobot_firewall_models.models import NATPolicyRule, NATPolicy, NATPolicyDeviceM2M, NATPolicyDynamicGroupM2M +from nautobot_firewall_models.models import NATPolicy, NATPolicyDeviceM2M, NATPolicyDynamicGroupM2M, NATPolicyRule from nautobot_firewall_models.tables import NATPolicyRuleTable, NATPolicyTable diff --git a/nautobot_firewall_models/viewsets/security_policy.py b/nautobot_firewall_models/viewsets/security_policy.py index c805d6b4..a75342a1 100644 --- a/nautobot_firewall_models/viewsets/security_policy.py +++ b/nautobot_firewall_models/viewsets/security_policy.py @@ -1,4 +1,5 @@ """Rule Object Viewsets.""" + from django.shortcuts import redirect from django.urls import reverse from nautobot.apps.views import NautobotUIViewSet @@ -6,16 +7,16 @@ from rest_framework.decorators import action from nautobot_firewall_models.api.serializers import PolicyRuleSerializer, PolicySerializer -from nautobot_firewall_models.filters import PolicyRuleFilterSet, PolicyFilterSet +from nautobot_firewall_models.filters import PolicyFilterSet, PolicyRuleFilterSet from nautobot_firewall_models.forms import ( - PolicyRuleBulkEditForm, - PolicyRuleFilterForm, - PolicyRuleForm, PolicyBulkEditForm, PolicyFilterForm, PolicyForm, + PolicyRuleBulkEditForm, + PolicyRuleFilterForm, + PolicyRuleForm, ) -from nautobot_firewall_models.models import PolicyRule, Policy, PolicyDeviceM2M, PolicyDynamicGroupM2M +from nautobot_firewall_models.models import Policy, PolicyDeviceM2M, PolicyDynamicGroupM2M, PolicyRule from nautobot_firewall_models.tables import PolicyRuleTable, PolicyTable diff --git a/nautobot_firewall_models/viewsets/service.py b/nautobot_firewall_models/viewsets/service.py index 943ea919..4b779cc2 100644 --- a/nautobot_firewall_models/viewsets/service.py +++ b/nautobot_firewall_models/viewsets/service.py @@ -2,8 +2,8 @@ from nautobot.apps.views import NautobotUIViewSet +from nautobot_firewall_models import filters, forms, models, tables from nautobot_firewall_models.api import serializers -from nautobot_firewall_models import forms, models, tables, filters class ApplicationObjectUIViewSet(NautobotUIViewSet): diff --git a/nautobot_firewall_models/viewsets/user.py b/nautobot_firewall_models/viewsets/user.py index b10e5a68..94034263 100644 --- a/nautobot_firewall_models/viewsets/user.py +++ b/nautobot_firewall_models/viewsets/user.py @@ -2,8 +2,8 @@ from nautobot.apps.views import NautobotUIViewSet +from nautobot_firewall_models import filters, forms, models, tables from nautobot_firewall_models.api import serializers -from nautobot_firewall_models import forms, models, tables, filters class UserObjectUIViewSet(NautobotUIViewSet): diff --git a/nautobot_firewall_models/viewsets/zone.py b/nautobot_firewall_models/viewsets/zone.py index b8c7e73f..9e02a5e8 100644 --- a/nautobot_firewall_models/viewsets/zone.py +++ b/nautobot_firewall_models/viewsets/zone.py @@ -2,8 +2,8 @@ from nautobot.apps.views import NautobotUIViewSet +from nautobot_firewall_models import filters, forms, models, tables from nautobot_firewall_models.api import serializers -from nautobot_firewall_models import forms, models, tables, filters class ZoneUIViewSet(NautobotUIViewSet): diff --git a/poetry.lock b/poetry.lock index 73d09ec0..366ae1b4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "absl-py" @@ -173,29 +173,6 @@ tzdata = {version = "*", optional = true, markers = "extra == \"tzdata\""} [package.extras] tzdata = ["tzdata"] -[[package]] -name = "bandit" -version = "1.7.6" -description = "Security oriented static analyser for python code." -optional = false -python-versions = ">=3.8" -files = [ - {file = "bandit-1.7.6-py3-none-any.whl", hash = "sha256:36da17c67fc87579a5d20c323c8d0b1643a890a2b93f00b3d1229966624694ff"}, - {file = "bandit-1.7.6.tar.gz", hash = "sha256:72ce7bc9741374d96fb2f1c9a8960829885f1243ffde743de70a19cee353e8f3"}, -] - -[package.dependencies] -colorama = {version = ">=0.3.9", markers = "platform_system == \"Windows\""} -GitPython = ">=3.1.30" -PyYAML = ">=5.3.1" -rich = "*" -stevedore = ">=1.20.0" - -[package.extras] -test = ["beautifulsoup4 (>=4.8.0)", "coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "pylint (==1.9.4)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "tomli (>=1.1.0)"] -toml = ["tomli (>=1.1.0)"] -yaml = ["PyYAML"] - [[package]] name = "billiard" version = "4.2.0" @@ -207,52 +184,6 @@ files = [ {file = "billiard-4.2.0.tar.gz", hash = "sha256:9a3c3184cb275aa17a732f93f65b20c525d3d9f253722d26a82194803ade5a2c"}, ] -[[package]] -name = "black" -version = "23.12.1" -description = "The uncompromising code formatter." -optional = false -python-versions = ">=3.8" -files = [ - {file = "black-23.12.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e0aaf6041986767a5e0ce663c7a2f0e9eaf21e6ff87a5f95cbf3675bfd4c41d2"}, - {file = "black-23.12.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c88b3711d12905b74206227109272673edce0cb29f27e1385f33b0163c414bba"}, - {file = "black-23.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a920b569dc6b3472513ba6ddea21f440d4b4c699494d2e972a1753cdc25df7b0"}, - {file = "black-23.12.1-cp310-cp310-win_amd64.whl", hash = "sha256:3fa4be75ef2a6b96ea8d92b1587dd8cb3a35c7e3d51f0738ced0781c3aa3a5a3"}, - {file = "black-23.12.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8d4df77958a622f9b5a4c96edb4b8c0034f8434032ab11077ec6c56ae9f384ba"}, - {file = "black-23.12.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:602cfb1196dc692424c70b6507593a2b29aac0547c1be9a1d1365f0d964c353b"}, - {file = "black-23.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c4352800f14be5b4864016882cdba10755bd50805c95f728011bcb47a4afd59"}, - {file = "black-23.12.1-cp311-cp311-win_amd64.whl", hash = "sha256:0808494f2b2df923ffc5723ed3c7b096bd76341f6213989759287611e9837d50"}, - {file = "black-23.12.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:25e57fd232a6d6ff3f4478a6fd0580838e47c93c83eaf1ccc92d4faf27112c4e"}, - {file = "black-23.12.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2d9e13db441c509a3763a7a3d9a49ccc1b4e974a47be4e08ade2a228876500ec"}, - {file = "black-23.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d1bd9c210f8b109b1762ec9fd36592fdd528485aadb3f5849b2740ef17e674e"}, - {file = "black-23.12.1-cp312-cp312-win_amd64.whl", hash = "sha256:ae76c22bde5cbb6bfd211ec343ded2163bba7883c7bc77f6b756a1049436fbb9"}, - {file = "black-23.12.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1fa88a0f74e50e4487477bc0bb900c6781dbddfdfa32691e780bf854c3b4a47f"}, - {file = "black-23.12.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a4d6a9668e45ad99d2f8ec70d5c8c04ef4f32f648ef39048d010b0689832ec6d"}, - {file = "black-23.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b18fb2ae6c4bb63eebe5be6bd869ba2f14fd0259bda7d18a46b764d8fb86298a"}, - {file = "black-23.12.1-cp38-cp38-win_amd64.whl", hash = "sha256:c04b6d9d20e9c13f43eee8ea87d44156b8505ca8a3c878773f68b4e4812a421e"}, - {file = "black-23.12.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3e1b38b3135fd4c025c28c55ddfc236b05af657828a8a6abe5deec419a0b7055"}, - {file = "black-23.12.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4f0031eaa7b921db76decd73636ef3a12c942ed367d8c3841a0739412b260a54"}, - {file = "black-23.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97e56155c6b737854e60a9ab1c598ff2533d57e7506d97af5481141671abf3ea"}, - {file = "black-23.12.1-cp39-cp39-win_amd64.whl", hash = "sha256:dd15245c8b68fe2b6bd0f32c1556509d11bb33aec9b5d0866dd8e2ed3dba09c2"}, - {file = "black-23.12.1-py3-none-any.whl", hash = "sha256:78baad24af0f033958cad29731e27363183e140962595def56423e626f4bee3e"}, - {file = "black-23.12.1.tar.gz", hash = "sha256:4ce3ef14ebe8d9509188014d96af1c456a910d5b5cbf434a09fef7e024b3d0d5"}, -] - -[package.dependencies] -click = ">=8.0.0" -mypy-extensions = ">=0.4.3" -packaging = ">=22.0" -pathspec = ">=0.9.0" -platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} - -[package.extras] -colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] -jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -uvloop = ["uvloop (>=0.15.2)"] - [[package]] name = "capirca" version = "2.0.9" @@ -1162,22 +1093,6 @@ files = [ [package.extras] tests = ["asttokens (>=2.1.0)", "coverage", "coverage-enable-subprocess", "ipython", "littleutils", "pytest", "rich"] -[[package]] -name = "flake8" -version = "5.0.4" -description = "the modular source code checker: pep8 pyflakes and co" -optional = false -python-versions = ">=3.6.1" -files = [ - {file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"}, - {file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"}, -] - -[package.dependencies] -mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.9.0,<2.10.0" -pyflakes = ">=2.5.0,<2.6.0" - [[package]] name = "ghp-import" version = "2.1.0" @@ -1642,28 +1557,18 @@ importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""} testing = ["coverage", "pyyaml"] [[package]] -name = "markdown-it-py" -version = "3.0.0" -description = "Python port of markdown-it. Markdown parsing, done right!" +name = "markdown-version-annotations" +version = "1.0.1" +description = "Markdown plugin to add custom admonitions for documenting version differences" optional = false -python-versions = ">=3.8" +python-versions = "<4.0,>=3.7" files = [ - {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, - {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, + {file = "markdown_version_annotations-1.0.1-py3-none-any.whl", hash = "sha256:6df0b2ac08bab906c8baa425f59fc0fe342fbe8b3917c144fb75914266b33200"}, + {file = "markdown_version_annotations-1.0.1.tar.gz", hash = "sha256:620aade507ef175ccfb2059db152a34c6a1d2add28c2be16ea4de38d742e6132"}, ] [package.dependencies] -mdurl = ">=0.1,<1.0" - -[package.extras] -benchmarking = ["psutil", "pytest", "pytest-benchmark"] -code-style = ["pre-commit (>=3.0,<4.0)"] -compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] -linkify = ["linkify-it-py (>=1,<3)"] -plugins = ["mdit-py-plugins"] -profiling = ["gprof2dot"] -rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] -testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] +markdown = ">=3.3.7,<4.0.0" [[package]] name = "markupsafe" @@ -1692,6 +1597,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -1749,17 +1664,6 @@ files = [ {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, ] -[[package]] -name = "mdurl" -version = "0.1.2" -description = "Markdown URL utilities" -optional = false -python-versions = ">=3.7" -files = [ - {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, - {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, -] - [[package]] name = "mergedeep" version = "1.3.4" @@ -1850,17 +1754,6 @@ files = [ {file = "mkdocs_material_extensions-1.3.1.tar.gz", hash = "sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443"}, ] -[[package]] -name = "mkdocs-version-annotations" -version = "1.0.0" -description = "MkDocs plugin to add custom admonitions for documenting version differences" -optional = false -python-versions = ">=3.7,<4.0" -files = [ - {file = "mkdocs-version-annotations-1.0.0.tar.gz", hash = "sha256:6786024b37d27b330fda240b76ebec8e7ce48bd5a9d7a66e99804559d088dffa"}, - {file = "mkdocs_version_annotations-1.0.0-py3-none-any.whl", hash = "sha256:385004eb4a7530dd87a227e08cd907ce7a8fe21fdf297720a4149c511bcf05f5"}, -] - [[package]] name = "mkdocstrings" version = "0.22.0" @@ -1918,17 +1811,6 @@ build = ["blurb", "twine", "wheel"] docs = ["sphinx"] test = ["pytest", "pytest-cov"] -[[package]] -name = "mypy-extensions" -version = "1.0.0" -description = "Type system extensions for programs checked with the mypy type checker." -optional = false -python-versions = ">=3.5" -files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, -] - [[package]] name = "nautobot" version = "2.1.0" @@ -2069,17 +1951,6 @@ files = [ {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, ] -[[package]] -name = "pbr" -version = "6.0.0" -description = "Python Build Reasonableness" -optional = false -python-versions = ">=2.6" -files = [ - {file = "pbr-6.0.0-py2.py3-none-any.whl", hash = "sha256:4a7317d5e3b17a3dccb6a8cfe67dab65b20551404c52c8ed41279fa4f0cb4cda"}, - {file = "pbr-6.0.0.tar.gz", hash = "sha256:d1377122a5a00e2f940ee482999518efe16d745d423a670c27773dfbc3c9a7d9"}, -] - [[package]] name = "pexpect" version = "4.9.0" @@ -2286,6 +2157,7 @@ files = [ {file = "psycopg2_binary-2.9.9-cp311-cp311-win32.whl", hash = "sha256:dc4926288b2a3e9fd7b50dc6a1909a13bbdadfc67d93f3374d984e56f885579d"}, {file = "psycopg2_binary-2.9.9-cp311-cp311-win_amd64.whl", hash = "sha256:b76bedd166805480ab069612119ea636f5ab8f8771e640ae103e05a4aae3e417"}, {file = "psycopg2_binary-2.9.9-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:8532fd6e6e2dc57bcb3bc90b079c60de896d2128c5d9d6f24a63875a95a088cf"}, + {file = "psycopg2_binary-2.9.9-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b0605eaed3eb239e87df0d5e3c6489daae3f7388d455d0c0b4df899519c6a38d"}, {file = "psycopg2_binary-2.9.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f8544b092a29a6ddd72f3556a9fcf249ec412e10ad28be6a0c0d948924f2212"}, {file = "psycopg2_binary-2.9.9-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2d423c8d8a3c82d08fe8af900ad5b613ce3632a1249fd6a223941d0735fce493"}, {file = "psycopg2_binary-2.9.9-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e5afae772c00980525f6d6ecf7cbca55676296b580c0e6abb407f15f3706996"}, @@ -2294,6 +2166,8 @@ files = [ {file = "psycopg2_binary-2.9.9-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:cb16c65dcb648d0a43a2521f2f0a2300f40639f6f8c1ecbc662141e4e3e1ee07"}, {file = "psycopg2_binary-2.9.9-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:911dda9c487075abd54e644ccdf5e5c16773470a6a5d3826fda76699410066fb"}, {file = "psycopg2_binary-2.9.9-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:57fede879f08d23c85140a360c6a77709113efd1c993923c59fde17aa27599fe"}, + {file = "psycopg2_binary-2.9.9-cp312-cp312-win32.whl", hash = "sha256:64cf30263844fa208851ebb13b0732ce674d8ec6a0c86a4e160495d299ba3c93"}, + {file = "psycopg2_binary-2.9.9-cp312-cp312-win_amd64.whl", hash = "sha256:81ff62668af011f9a48787564ab7eded4e9fb17a4a6a74af5ffa6a457400d2ab"}, {file = "psycopg2_binary-2.9.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2293b001e319ab0d869d660a704942c9e2cce19745262a8aba2115ef41a0a42a"}, {file = "psycopg2_binary-2.9.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:03ef7df18daf2c4c07e2695e8cfd5ee7f748a1d54d802330985a78d2a5a6dca9"}, {file = "psycopg2_binary-2.9.9-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a602ea5aff39bb9fac6308e9c9d82b9a35c2bf288e184a816002c9fae930b77"}, @@ -2356,17 +2230,6 @@ files = [ [package.extras] tests = ["pytest"] -[[package]] -name = "pycodestyle" -version = "2.9.1" -description = "Python style guide checker" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, - {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, -] - [[package]] name = "pycparser" version = "2.21" @@ -2378,17 +2241,6 @@ files = [ {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, ] -[[package]] -name = "pyflakes" -version = "2.5.0" -description = "passive checker of Python programs" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"}, - {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, -] - [[package]] name = "pygments" version = "2.17.2" @@ -2659,6 +2511,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -2666,8 +2519,16 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -2684,6 +2545,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -2691,6 +2553,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -2884,25 +2747,6 @@ requests = ">=2.0.0" [package.extras] rsa = ["oauthlib[signedtoken] (>=3.0.0)"] -[[package]] -name = "rich" -version = "13.7.0" -description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -optional = false -python-versions = ">=3.7.0" -files = [ - {file = "rich-13.7.0-py3-none-any.whl", hash = "sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235"}, - {file = "rich-13.7.0.tar.gz", hash = "sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa"}, -] - -[package.dependencies] -markdown-it-py = ">=2.2.0" -pygments = ">=2.13.0,<3.0.0" -typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9\""} - -[package.extras] -jupyter = ["ipywidgets (>=7.5.1,<9)"] - [[package]] name = "rpds-py" version = "0.16.2" @@ -3013,28 +2857,29 @@ files = [ [[package]] name = "ruff" -version = "0.1.11" +version = "0.5.5" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.11-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:a7f772696b4cdc0a3b2e527fc3c7ccc41cdcb98f5c80fdd4f2b8c50eb1458196"}, - {file = "ruff-0.1.11-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:934832f6ed9b34a7d5feea58972635c2039c7a3b434fe5ba2ce015064cb6e955"}, - {file = "ruff-0.1.11-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ea0d3e950e394c4b332bcdd112aa566010a9f9c95814844a7468325290aabfd9"}, - {file = "ruff-0.1.11-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9bd4025b9c5b429a48280785a2b71d479798a69f5c2919e7d274c5f4b32c3607"}, - {file = "ruff-0.1.11-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e1ad00662305dcb1e987f5ec214d31f7d6a062cae3e74c1cbccef15afd96611d"}, - {file = "ruff-0.1.11-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:4b077ce83f47dd6bea1991af08b140e8b8339f0ba8cb9b7a484c30ebab18a23f"}, - {file = "ruff-0.1.11-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c4a88efecec23c37b11076fe676e15c6cdb1271a38f2b415e381e87fe4517f18"}, - {file = "ruff-0.1.11-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5b25093dad3b055667730a9b491129c42d45e11cdb7043b702e97125bcec48a1"}, - {file = "ruff-0.1.11-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:231d8fb11b2cc7c0366a326a66dafc6ad449d7fcdbc268497ee47e1334f66f77"}, - {file = "ruff-0.1.11-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:09c415716884950080921dd6237767e52e227e397e2008e2bed410117679975b"}, - {file = "ruff-0.1.11-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0f58948c6d212a6b8d41cd59e349751018797ce1727f961c2fa755ad6208ba45"}, - {file = "ruff-0.1.11-py3-none-musllinux_1_2_i686.whl", hash = "sha256:190a566c8f766c37074d99640cd9ca3da11d8deae2deae7c9505e68a4a30f740"}, - {file = "ruff-0.1.11-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:6464289bd67b2344d2a5d9158d5eb81025258f169e69a46b741b396ffb0cda95"}, - {file = "ruff-0.1.11-py3-none-win32.whl", hash = "sha256:9b8f397902f92bc2e70fb6bebfa2139008dc72ae5177e66c383fa5426cb0bf2c"}, - {file = "ruff-0.1.11-py3-none-win_amd64.whl", hash = "sha256:eb85ee287b11f901037a6683b2374bb0ec82928c5cbc984f575d0437979c521a"}, - {file = "ruff-0.1.11-py3-none-win_arm64.whl", hash = "sha256:97ce4d752f964ba559c7023a86e5f8e97f026d511e48013987623915431c7ea9"}, - {file = "ruff-0.1.11.tar.gz", hash = "sha256:f9d4d88cb6eeb4dfe20f9f0519bd2eaba8119bde87c3d5065c541dbae2b5a2cb"}, + {file = "ruff-0.5.5-py3-none-linux_armv6l.whl", hash = "sha256:605d589ec35d1da9213a9d4d7e7a9c761d90bba78fc8790d1c5e65026c1b9eaf"}, + {file = "ruff-0.5.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00817603822a3e42b80f7c3298c8269e09f889ee94640cd1fc7f9329788d7bf8"}, + {file = "ruff-0.5.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:187a60f555e9f865a2ff2c6984b9afeffa7158ba6e1eab56cb830404c942b0f3"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe26fc46fa8c6e0ae3f47ddccfbb136253c831c3289bba044befe68f467bfb16"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4ad25dd9c5faac95c8e9efb13e15803cd8bbf7f4600645a60ffe17c73f60779b"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f70737c157d7edf749bcb952d13854e8f745cec695a01bdc6e29c29c288fc36e"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:cfd7de17cef6ab559e9f5ab859f0d3296393bc78f69030967ca4d87a541b97a0"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a09b43e02f76ac0145f86a08e045e2ea452066f7ba064fd6b0cdccb486f7c3e7"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d0b856cb19c60cd40198be5d8d4b556228e3dcd545b4f423d1ad812bfdca5884"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3687d002f911e8a5faf977e619a034d159a8373514a587249cc00f211c67a091"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ac9dc814e510436e30d0ba535f435a7f3dc97f895f844f5b3f347ec8c228a523"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:af9bdf6c389b5add40d89b201425b531e0a5cceb3cfdcc69f04d3d531c6be74f"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d40a8533ed545390ef8315b8e25c4bb85739b90bd0f3fe1280a29ae364cc55d8"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cab904683bf9e2ecbbe9ff235bfe056f0eba754d0168ad5407832928d579e7ab"}, + {file = "ruff-0.5.5-py3-none-win32.whl", hash = "sha256:696f18463b47a94575db635ebb4c178188645636f05e934fdf361b74edf1bb2d"}, + {file = "ruff-0.5.5-py3-none-win_amd64.whl", hash = "sha256:50f36d77f52d4c9c2f1361ccbfbd09099a1b2ea5d2b2222c586ab08885cf3445"}, + {file = "ruff-0.5.5-py3-none-win_arm64.whl", hash = "sha256:3191317d967af701f1b73a31ed5788795936e423b7acce82a2b63e26eb3e89d6"}, + {file = "ruff-0.5.5.tar.gz", hash = "sha256:cc5516bdb4858d972fbc31d246bdb390eab8df1a26e2353be2dbc0c2d7f5421a"}, ] [[package]] @@ -3160,20 +3005,6 @@ pure-eval = "*" [package.extras] tests = ["cython", "littleutils", "pygments", "pytest", "typeguard"] -[[package]] -name = "stevedore" -version = "5.1.0" -description = "Manage dynamic plugins for Python applications" -optional = false -python-versions = ">=3.8" -files = [ - {file = "stevedore-5.1.0-py3-none-any.whl", hash = "sha256:8cc040628f3cea5d7128f2e76cf486b2251a4e543c7b938f58d9a377f6694a2d"}, - {file = "stevedore-5.1.0.tar.gz", hash = "sha256:a54534acf9b89bc7ed264807013b505bf07f74dbe4bcfa37d32bd063870b087c"}, -] - -[package.dependencies] -pbr = ">=2.0.0,<2.1.0 || >2.1.0" - [[package]] name = "svgwrite" version = "1.4.3" @@ -3508,4 +3339,4 @@ all = [] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12" -content-hash = "2556ccc74ba2190be8368061393473586299f54e8594ff6993d48d5896e6d1e2" +content-hash = "1efd6ec1954ae465d6749859020797b91b2d177a2a37cc2bc089511382e1df8e" diff --git a/pyproject.toml b/pyproject.toml index 35113233..d8ed4921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,26 +34,23 @@ netutils = "^1.0.0" capirca = "^2.0.6" [tool.poetry.group.dev.dependencies] -bandit = "*" -black = "*" coverage = "*" django-debug-toolbar = "*" -flake8 = "*" invoke = "*" ipython = "*" pylint = "*" pylint-django = "*" pylint-nautobot = "*" -ruff = "*" +ruff = "0.5.5" yamllint = "*" toml = "*" Markdown = "*" +# Render custom markdown for version added/changed/remove notes +markdown-version-annotations = "1.0.1" # Rendering docs to HTML mkdocs = "1.5.2" # Material for MkDocs theme mkdocs-material = "9.1.15" -# Render custom markdown for version added/changed/remove notes -mkdocs-version-annotations = "1.0.0" # Automatic documentation from sources, for MkDocs mkdocstrings = "0.22.0" mkdocstrings-python = "1.5.2" @@ -65,29 +62,6 @@ jsonschema = "*" all = [ ] -[tool.black] -line-length = 120 -target-version = ['py38', 'py39', 'py310', 'py311'] -include = '\.pyi?$' -exclude = ''' -( - /( - \.eggs # exclude a few common directories in the - | \.git # root of the project - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - )/ - | settings.py # This is where you define files that should not be stylized by black - # the root of the project -) -''' - [tool.pylint.master] # Include the pylint_django plugin to avoid spurious warnings about Django patterns load-plugins="pylint_django, pylint_nautobot" @@ -98,8 +72,6 @@ ignore=".venv" no-docstring-rgx="^(_|test_|Meta$)" [tool.pylint.messages_control] -# Line length is enforced by Black, so pylint doesn't need to check it. -# Pylint and Black disagree about how to format multi-line arrays; Black wins. disable = """, line-too-long, too-few-public-methods, @@ -125,6 +97,9 @@ target-version = "py38" [tool.ruff.lint] select = [ "D", # pydocstyle + "F", "E", "W", # flake8 + "S", # bandit + "I", # isort ] ignore = [ # warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. @@ -142,17 +117,19 @@ ignore = [ "D401", # First line of docstring should be in imperative mood "D407", # Missing dashed underline after section "D416", # Section name ends in colon + "E501", # Line too long ] [tool.ruff.lint.pydocstyle] convention = "google" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "nautobot_firewall_models/migrations/*" = [ - "D", # pydocstyle + "D", ] "nautobot_firewall_models/tests/*" = [ - "D", # pydocstyle + "D", + "S" ] [build-system] diff --git a/tasks.py b/tasks.py index 1dfcae87..d909dee4 100644 --- a/tasks.py +++ b/tasks.py @@ -159,17 +159,17 @@ def run_command(context, command, **kwargs): # Check if nautobot is running, no need to start another nautobot container to run a command docker_compose_status = "ps --services --filter status=running" results = docker_compose(context, docker_compose_status, hide="out") - if "nautobot" in results.stdout: - compose_command = "exec" - else: - compose_command = "run --rm --entrypoint=''" + command_env_args = "" if "command_env" in kwargs: command_env = kwargs.pop("command_env") for key, value in command_env.items(): - compose_command += f' --env="{key}={value}"' + command_env_args += f' --env="{key}={value}"' - compose_command += f" -- nautobot {command}" + if "nautobot" in results.stdout: + compose_command = f"exec{command_env_args} nautobot {command}" + else: + compose_command = f"run{command_env_args} --rm --entrypoint='{command}' nautobot" pty = kwargs.pop("pty", True) @@ -494,7 +494,12 @@ def dbshell(context, db_name="", input_file="", output_file="", query=""): f"> '{output_file}'" if output_file else "", ] - docker_compose(context, " ".join(command), env=env, pty=not (input_file or output_file or query)) + docker_compose( + context, + " ".join(command), + env=env, + pty=not (input_file or output_file or query), + ) @task( @@ -519,9 +524,11 @@ def import_db(context, db_name="", input_file="dump.sql"): '--execute="', f"DROP DATABASE IF EXISTS {db_name};", f"CREATE DATABASE {db_name};", - "" - if db_name == "$MYSQL_DATABASE" - else f"GRANT ALL PRIVILEGES ON {db_name}.* TO $MYSQL_USER; FLUSH PRIVILEGES;", + ( + "" + if db_name == "$MYSQL_DATABASE" + else f"GRANT ALL PRIVILEGES ON {db_name}.* TO $MYSQL_USER; FLUSH PRIVILEGES;" + ), '"', "&&", "mysql", @@ -647,28 +654,6 @@ def generate_release_notes(context, version=""): # ------------------------------------------------------------------------------ # TESTS # ------------------------------------------------------------------------------ -@task( - help={ - "autoformat": "Apply formatting recommendations automatically, rather than failing if formatting is incorrect.", - } -) -def black(context, autoformat=False): - """Check Python code style with Black.""" - if autoformat: - black_command = "black" - else: - black_command = "black --check --diff" - - command = f"{black_command} ." - - run_command(context, command) - - -@task -def flake8(context): - """Check for PEP8 compliance and other style issues.""" - command = "flake8 . --config .flake8" - run_command(context, command) @task @@ -688,38 +673,39 @@ def pylint(context): @task(aliases=("a",)) def autoformat(context): """Run code autoformatting.""" - black(context, autoformat=True) - ruff(context, fix=True) + ruff(context, action=["format"], fix=True) @task( help={ - "action": "One of 'lint', 'format', or 'both'", - "fix": "Automatically fix selected action. May not be able to fix all.", - "output_format": "see https://docs.astral.sh/ruff/settings/#output-format", + "action": "Available values are `['lint', 'format']`. Can be used multiple times. (default: `['lint', 'format']`)", + "target": "File or directory to inspect, repeatable (default: all files in the project will be inspected)", + "fix": "Automatically fix selected actions. May not be able to fix all issues found. (default: False)", + "output_format": "See https://docs.astral.sh/ruff/settings/#output-format for details. (default: `concise`)", }, + iterable=["action", "target"], ) -def ruff(context, action="lint", fix=False, output_format="text"): +def ruff(context, action=None, target=None, fix=False, output_format="concise"): """Run ruff to perform code formatting and/or linting.""" - if action != "lint": - command = "ruff format" - if not fix: - command += " --check" - command += " ." - run_command(context, command) - if action != "format": - command = "ruff check" - if fix: - command += " --fix" - command += f" --output-format {output_format} ." - run_command(context, command) + if not action: + action = ["lint", "format"] + if not target: + target = ["."] + if "format" in action: + command = "ruff format " + if not fix: + command += "--check " + command += " ".join(target) + run_command(context, command, warn=True) -@task -def bandit(context): - """Run bandit to validate basic static code security analysis.""" - command = "bandit --recursive . --configfile .bandit.yml" - run_command(context, command) + if "lint" in action: + command = "ruff check " + if fix: + command += "--fix " + command += f"--output-format {output_format} " + command += " ".join(target) + run_command(context, command, warn=True) @task @@ -751,7 +737,7 @@ def check_migrations(context): "verbose": "Enable verbose test output.", } ) -def unittest( +def unittest( # noqa: PLR0913 context, keepdb=False, label="nautobot_firewall_models", @@ -799,14 +785,8 @@ def tests(context, failfast=False, keepdb=False, lint_only=False): print("Starting Docker Containers...") start(context) # Sorted loosely from fastest to slowest - print("Running black...") - black(context) print("Running ruff...") ruff(context) - print("Running flake8...") - flake8(context) - print("Running bandit...") - bandit(context) print("Running yamllint...") yamllint(context) print("Running poetry check...") @@ -839,11 +819,20 @@ def generate_app_config_schema(context): - `NautobotAppConfig.required_settings` """ start(context, service="nautobot") - nbshell(context, file="development/app_config_schema.py", env={"APP_CONFIG_SCHEMA_COMMAND": "generate"}) + nbshell( + context, + file="development/app_config_schema.py", + env={"APP_CONFIG_SCHEMA_COMMAND": "generate"}, + ) @task def validate_app_config(context): """Validate the app config based on the app config schema.""" start(context, service="nautobot") - nbshell(context, plain=True, file="development/app_config_schema.py", env={"APP_CONFIG_SCHEMA_COMMAND": "validate"}) + nbshell( + context, + plain=True, + file="development/app_config_schema.py", + env={"APP_CONFIG_SCHEMA_COMMAND": "validate"}, + )