From 4931061da0c959061a662232709f0d3c79255460 Mon Sep 17 00:00:00 2001 From: John Andersen Date: Fri, 17 Nov 2023 01:31:56 +0100 Subject: [PATCH] Remove unused imports $ git ls-files '*.py' | xargs autoflake --in-place --remove-all-unused-imports --ignore-init-module-imports Signed-off-by: John Andersen --- docs/registration_policies.md | 12 ----------- scitt_emulator/client.py | 1 - scitt_emulator/did_helpers.py | 2 -- scitt_emulator/key_loader_format_did_key.py | 20 +++---------------- ...ader_format_url_referencing_oidc_issuer.py | 13 +----------- ...mat_url_referencing_ssh_authorized_keys.py | 13 +----------- scitt_emulator/oidc.py | 2 -- scitt_emulator/rkvst.py | 3 +-- scitt_emulator/scitt.py | 3 +-- scitt_emulator/verify_statement.py | 7 ------- tests/test_docs.py | 3 --- 11 files changed, 7 insertions(+), 72 deletions(-) diff --git a/docs/registration_policies.md b/docs/registration_policies.md index a77fdfbf..ad199bcb 100644 --- a/docs/registration_policies.md +++ b/docs/registration_policies.md @@ -85,23 +85,11 @@ import sys import json import pathlib import unittest -import traceback -import contextlib -import urllib.parse -import urllib.request -import jwt -import cbor2 import cwt -import cwt.algs.ec2 import pycose -import pycose.keys.ec2 from pycose.messages import Sign1Message from jsonschema import validate, ValidationError -import cryptography.hazmat.primitives.serialization - -# TODO Remove this once we have a example flow for proper key verification -import jwcrypto.jwk from scitt_emulator.scitt import ClaimInvalidError, CWTClaims from scitt_emulator.verify_statement import verify_statement diff --git a/scitt_emulator/client.py b/scitt_emulator/client.py index 2658d74f..2511f9fb 100644 --- a/scitt_emulator/client.py +++ b/scitt_emulator/client.py @@ -8,7 +8,6 @@ import httpx -import scitt_emulator.scitt as scitt from scitt_emulator import create_statement from scitt_emulator.tree_algs import TREE_ALGS diff --git a/scitt_emulator/did_helpers.py b/scitt_emulator/did_helpers.py index 5ef90a9f..07a4e927 100644 --- a/scitt_emulator/did_helpers.py +++ b/scitt_emulator/did_helpers.py @@ -1,7 +1,5 @@ import os -import ast import sys -import base64 import inspect import urllib.parse from typing import Optional, Callable, Dict, Tuple, Union diff --git a/scitt_emulator/key_loader_format_did_key.py b/scitt_emulator/key_loader_format_did_key.py index dfede92f..152965b5 100644 --- a/scitt_emulator/key_loader_format_did_key.py +++ b/scitt_emulator/key_loader_format_did_key.py @@ -1,29 +1,15 @@ -import os -import sys -import json -import pathlib -import unittest -import traceback -import contextlib -import urllib.parse -import urllib.request -import importlib.metadata -from typing import Optional, Callable, List, Tuple - -import jwt -import cbor2 +from typing import List, Tuple + import cwt import cwt.algs.ec2 import pycose import pycose.keys.ec2 -from pycose.messages import Sign1Message from cryptography.hazmat.primitives import serialization # TODO Remove this once we have a example flow for proper key verification import jwcrypto.jwk -from scitt_emulator.scitt import ClaimInvalidError, CWTClaims -from scitt_emulator.did_helpers import DID_KEY_METHOD, did_web_to_url, did_key_to_cryptography_key +from scitt_emulator.did_helpers import DID_KEY_METHOD, did_key_to_cryptography_key def key_loader_format_did_key( diff --git a/scitt_emulator/key_loader_format_url_referencing_oidc_issuer.py b/scitt_emulator/key_loader_format_url_referencing_oidc_issuer.py index b39f7062..76a4547c 100644 --- a/scitt_emulator/key_loader_format_url_referencing_oidc_issuer.py +++ b/scitt_emulator/key_loader_format_url_referencing_oidc_issuer.py @@ -1,28 +1,17 @@ -import os -import sys import json -import pathlib -import unittest -import traceback import contextlib import urllib.parse import urllib.request -import importlib.metadata -from typing import Optional, Callable, List, Tuple +from typing import List, Tuple -import jwt -import cbor2 import cwt import cwt.algs.ec2 import pycose import pycose.keys.ec2 -from pycose.messages import Sign1Message -from cryptography.hazmat.primitives import serialization # TODO Remove this once we have a example flow for proper key verification import jwcrypto.jwk -from scitt_emulator.scitt import ClaimInvalidError, CWTClaims from scitt_emulator.did_helpers import did_web_to_url diff --git a/scitt_emulator/key_loader_format_url_referencing_ssh_authorized_keys.py b/scitt_emulator/key_loader_format_url_referencing_ssh_authorized_keys.py index fb7ee439..aea7e38b 100644 --- a/scitt_emulator/key_loader_format_url_referencing_ssh_authorized_keys.py +++ b/scitt_emulator/key_loader_format_url_referencing_ssh_authorized_keys.py @@ -1,29 +1,18 @@ -import os -import sys -import json -import pathlib -import unittest -import traceback import contextlib import urllib.parse import urllib.request -import importlib.metadata -from typing import Optional, Callable, List, Tuple +from typing import List, Tuple -import jwt -import cbor2 import cwt import cwt.algs.ec2 import pycose import pycose.keys.ec2 -from pycose.messages import Sign1Message import cryptography.exceptions from cryptography.hazmat.primitives import serialization # TODO Remove this once we have a example flow for proper key verification import jwcrypto.jwk -from scitt_emulator.scitt import ClaimInvalidError, CWTClaims from scitt_emulator.did_helpers import did_web_to_url diff --git a/scitt_emulator/oidc.py b/scitt_emulator/oidc.py index 4ca770d2..75d82d0b 100644 --- a/scitt_emulator/oidc.py +++ b/scitt_emulator/oidc.py @@ -2,9 +2,7 @@ # Licensed under the MIT License. import jwt import json -import jwcrypto.jwk import jsonschema -from flask import jsonify from werkzeug.wrappers import Request from scitt_emulator.client import HttpClient diff --git a/scitt_emulator/rkvst.py b/scitt_emulator/rkvst.py index 54f9f5ee..677222ad 100644 --- a/scitt_emulator/rkvst.py +++ b/scitt_emulator/rkvst.py @@ -5,8 +5,7 @@ from typing import Optional from pathlib import Path import json -import cbor2 -from pycose.messages import CoseMessage, Sign1Message +from pycose.messages import Sign1Message import pycose.headers import base64 from os import getenv diff --git a/scitt_emulator/scitt.py b/scitt_emulator/scitt.py index 23dcc179..c2b2c062 100644 --- a/scitt_emulator/scitt.py +++ b/scitt_emulator/scitt.py @@ -4,13 +4,12 @@ from typing import Optional from abc import ABC, abstractmethod from pathlib import Path -import contextlib import time import json import uuid import cbor2 -from pycose.messages import CoseMessage, Sign1Message +from pycose.messages import Sign1Message import pycose.headers from scitt_emulator.create_statement import CWTClaims diff --git a/scitt_emulator/verify_statement.py b/scitt_emulator/verify_statement.py index 7ce701e1..d606d115 100644 --- a/scitt_emulator/verify_statement.py +++ b/scitt_emulator/verify_statement.py @@ -1,18 +1,11 @@ import os -import sys -import json -import pathlib -import unittest import itertools -import traceback import contextlib import urllib.parse import urllib.request import importlib.metadata from typing import Optional, Callable, List, Tuple -import jwt -import cbor2 import cwt import cwt.algs.ec2 import pycose diff --git a/tests/test_docs.py b/tests/test_docs.py index d53e91fc..78398e3e 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -12,11 +12,8 @@ import threading import itertools import subprocess -import contextlib import urllib.parse -import unittest.mock -import pytest import myst_parser.parsers.docutils_ import docutils.nodes import docutils.utils