Add isort config, run isort across project

This commit is contained in:
rlaphoenix 2023-09-19 12:05:41 +01:00
parent db7bf977a1
commit dad32e728b
8 changed files with 26 additions and 22 deletions

View File

@ -43,3 +43,7 @@ serve = ["aiohttp", "PyYAML"]
[tool.poetry.scripts]
pywidevine = "pywidevine.main:main"
[tool.isort]
line_length = 118
extend_skip_glob = ["*_pb2.py", "*_pb2.pyi"]

View File

@ -5,5 +5,4 @@ from .pssh import *
from .remotecdm import *
from .session import *
__version__ = "1.5.3"

View File

@ -7,11 +7,11 @@ import subprocess
import sys
import time
from pathlib import Path
from typing import Union, Optional
from typing import Optional, Union
from uuid import UUID
from Crypto.Cipher import AES, PKCS1_OAEP
from Crypto.Hash import SHA1, HMAC, SHA256, CMAC
from Crypto.Hash import CMAC, HMAC, SHA1, SHA256
from Crypto.PublicKey import RSA
from Crypto.Random import get_random_bytes
from Crypto.Signature import pss
@ -19,11 +19,12 @@ from Crypto.Util import Padding
from google.protobuf.message import DecodeError
from pywidevine.device import Device
from pywidevine.exceptions import TooManySessions, InvalidSession, InvalidLicenseType, SignatureMismatch, \
InvalidInitData, InvalidLicenseMessage, NoKeysLoaded, InvalidContext
from pywidevine.exceptions import (InvalidContext, InvalidInitData, InvalidLicenseMessage, InvalidLicenseType,
InvalidSession, NoKeysLoaded, SignatureMismatch, TooManySessions)
from pywidevine.key import Key
from pywidevine.license_protocol_pb2 import DrmCertificate, SignedMessage, SignedDrmCertificate, LicenseType, \
LicenseRequest, ProtocolVersion, ClientIdentification, EncryptedClientIdentification, License
from pywidevine.license_protocol_pb2 import (ClientIdentification, DrmCertificate, EncryptedClientIdentification,
License, LicenseRequest, LicenseType, ProtocolVersion,
SignedDrmCertificate, SignedMessage)
from pywidevine.pssh import PSSH
from pywidevine.session import Session
from pywidevine.utils import get_binary_path

View File

@ -14,7 +14,7 @@ from construct import Padded, Padding, Struct, this
from Crypto.PublicKey import RSA
from google.protobuf.message import DecodeError
from pywidevine.license_protocol_pb2 import ClientIdentification, FileHashes, SignedDrmCertificate, DrmCertificate
from pywidevine.license_protocol_pb2 import ClientIdentification, DrmCertificate, FileHashes, SignedDrmCertificate
class _Types(Enum):

View File

@ -6,15 +6,15 @@ from zlib import crc32
import click
import requests
from construct import ConstructError
from unidecode import unidecode, UnidecodeError
import yaml
from construct import ConstructError
from google.protobuf.json_format import MessageToDict
from unidecode import UnidecodeError, unidecode
from pywidevine import __version__
from pywidevine.cdm import Cdm
from pywidevine.device import Device
from pywidevine.license_protocol_pb2 import LicenseType, FileHashes
from pywidevine.license_protocol_pb2 import FileHashes, LicenseType
from pywidevine.pssh import PSSH
@ -397,8 +397,8 @@ def serve_(config: Path, host: str, port: int):
Host as 127.0.0.1 may block remote access even if port-forwarded.
Instead, use 0.0.0.0 and ensure the TCP port you choose is forwarded.
"""
from pywidevine import serve
import yaml
from pywidevine import serve # isort:skip
import yaml # isort:skip
config = yaml.safe_load(config.read_text(encoding="utf8"))
serve.run(config, host, port)

View File

@ -4,7 +4,7 @@ import base64
import binascii
import string
from io import BytesIO
from typing import Union, Optional
from typing import Optional, Union
from uuid import UUID
import construct

View File

@ -3,21 +3,21 @@ from __future__ import annotations
import base64
import binascii
import re
from typing import Union, Optional
from typing import Optional, Union
import requests
from Crypto.Hash import SHA1
from Crypto.PublicKey import RSA
from Crypto.Signature import pss
from google.protobuf.message import DecodeError
from pywidevine.cdm import Cdm
from pywidevine.device import Device
from pywidevine.exceptions import InvalidInitData, InvalidLicenseType, InvalidLicenseMessage, DeviceMismatch, \
SignatureMismatch
from pywidevine.exceptions import (DeviceMismatch, InvalidInitData, InvalidLicenseMessage, InvalidLicenseType,
SignatureMismatch)
from pywidevine.key import Key
from pywidevine.license_protocol_pb2 import LicenseType, SignedMessage, License, ClientIdentification, \
SignedDrmCertificate
from pywidevine.license_protocol_pb2 import (ClientIdentification, License, LicenseType, SignedDrmCertificate,
SignedMessage)
from pywidevine.pssh import PSSH

View File

@ -20,8 +20,8 @@ except ImportError:
from pywidevine import __version__
from pywidevine.cdm import Cdm
from pywidevine.device import Device
from pywidevine.exceptions import TooManySessions, InvalidSession, SignatureMismatch, InvalidInitData, \
InvalidLicenseType, InvalidLicenseMessage, InvalidContext
from pywidevine.exceptions import (InvalidContext, InvalidInitData, InvalidLicenseMessage, InvalidLicenseType,
InvalidSession, SignatureMismatch, TooManySessions)
routes = web.RouteTableDef()