Add isort config, run isort across project
This commit is contained in:
parent
db7bf977a1
commit
dad32e728b
|
@ -43,3 +43,7 @@ serve = ["aiohttp", "PyYAML"]
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
pywidevine = "pywidevine.main:main"
|
pywidevine = "pywidevine.main:main"
|
||||||
|
|
||||||
|
[tool.isort]
|
||||||
|
line_length = 118
|
||||||
|
extend_skip_glob = ["*_pb2.py", "*_pb2.pyi"]
|
||||||
|
|
|
@ -5,5 +5,4 @@ from .pssh import *
|
||||||
from .remotecdm import *
|
from .remotecdm import *
|
||||||
from .session import *
|
from .session import *
|
||||||
|
|
||||||
|
|
||||||
__version__ = "1.5.3"
|
__version__ = "1.5.3"
|
||||||
|
|
|
@ -7,11 +7,11 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Union, Optional
|
from typing import Optional, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from Crypto.Cipher import AES, PKCS1_OAEP
|
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.PublicKey import RSA
|
||||||
from Crypto.Random import get_random_bytes
|
from Crypto.Random import get_random_bytes
|
||||||
from Crypto.Signature import pss
|
from Crypto.Signature import pss
|
||||||
|
@ -19,11 +19,12 @@ from Crypto.Util import Padding
|
||||||
from google.protobuf.message import DecodeError
|
from google.protobuf.message import DecodeError
|
||||||
|
|
||||||
from pywidevine.device import Device
|
from pywidevine.device import Device
|
||||||
from pywidevine.exceptions import TooManySessions, InvalidSession, InvalidLicenseType, SignatureMismatch, \
|
from pywidevine.exceptions import (InvalidContext, InvalidInitData, InvalidLicenseMessage, InvalidLicenseType,
|
||||||
InvalidInitData, InvalidLicenseMessage, NoKeysLoaded, InvalidContext
|
InvalidSession, NoKeysLoaded, SignatureMismatch, TooManySessions)
|
||||||
from pywidevine.key import Key
|
from pywidevine.key import Key
|
||||||
from pywidevine.license_protocol_pb2 import DrmCertificate, SignedMessage, SignedDrmCertificate, LicenseType, \
|
from pywidevine.license_protocol_pb2 import (ClientIdentification, DrmCertificate, EncryptedClientIdentification,
|
||||||
LicenseRequest, ProtocolVersion, ClientIdentification, EncryptedClientIdentification, License
|
License, LicenseRequest, LicenseType, ProtocolVersion,
|
||||||
|
SignedDrmCertificate, SignedMessage)
|
||||||
from pywidevine.pssh import PSSH
|
from pywidevine.pssh import PSSH
|
||||||
from pywidevine.session import Session
|
from pywidevine.session import Session
|
||||||
from pywidevine.utils import get_binary_path
|
from pywidevine.utils import get_binary_path
|
||||||
|
|
|
@ -14,7 +14,7 @@ from construct import Padded, Padding, Struct, this
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
from google.protobuf.message import DecodeError
|
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):
|
class _Types(Enum):
|
||||||
|
|
|
@ -6,15 +6,15 @@ from zlib import crc32
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import requests
|
import requests
|
||||||
from construct import ConstructError
|
|
||||||
from unidecode import unidecode, UnidecodeError
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from construct import ConstructError
|
||||||
from google.protobuf.json_format import MessageToDict
|
from google.protobuf.json_format import MessageToDict
|
||||||
|
from unidecode import UnidecodeError, unidecode
|
||||||
|
|
||||||
from pywidevine import __version__
|
from pywidevine import __version__
|
||||||
from pywidevine.cdm import Cdm
|
from pywidevine.cdm import Cdm
|
||||||
from pywidevine.device import Device
|
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
|
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.
|
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.
|
Instead, use 0.0.0.0 and ensure the TCP port you choose is forwarded.
|
||||||
"""
|
"""
|
||||||
from pywidevine import serve
|
from pywidevine import serve # isort:skip
|
||||||
import yaml
|
import yaml # isort:skip
|
||||||
|
|
||||||
config = yaml.safe_load(config.read_text(encoding="utf8"))
|
config = yaml.safe_load(config.read_text(encoding="utf8"))
|
||||||
serve.run(config, host, port)
|
serve.run(config, host, port)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import base64
|
||||||
import binascii
|
import binascii
|
||||||
import string
|
import string
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Union, Optional
|
from typing import Optional, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
import construct
|
import construct
|
||||||
|
|
|
@ -3,21 +3,21 @@ from __future__ import annotations
|
||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
import re
|
import re
|
||||||
from typing import Union, Optional
|
from typing import Optional, Union
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from Crypto.Hash import SHA1
|
from Crypto.Hash import SHA1
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
from Crypto.Signature import pss
|
from Crypto.Signature import pss
|
||||||
from google.protobuf.message import DecodeError
|
from google.protobuf.message import DecodeError
|
||||||
|
|
||||||
from pywidevine.cdm import Cdm
|
from pywidevine.cdm import Cdm
|
||||||
from pywidevine.device import Device
|
from pywidevine.device import Device
|
||||||
from pywidevine.exceptions import InvalidInitData, InvalidLicenseType, InvalidLicenseMessage, DeviceMismatch, \
|
from pywidevine.exceptions import (DeviceMismatch, InvalidInitData, InvalidLicenseMessage, InvalidLicenseType,
|
||||||
SignatureMismatch
|
SignatureMismatch)
|
||||||
from pywidevine.key import Key
|
from pywidevine.key import Key
|
||||||
|
from pywidevine.license_protocol_pb2 import (ClientIdentification, License, LicenseType, SignedDrmCertificate,
|
||||||
from pywidevine.license_protocol_pb2 import LicenseType, SignedMessage, License, ClientIdentification, \
|
SignedMessage)
|
||||||
SignedDrmCertificate
|
|
||||||
from pywidevine.pssh import PSSH
|
from pywidevine.pssh import PSSH
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ except ImportError:
|
||||||
from pywidevine import __version__
|
from pywidevine import __version__
|
||||||
from pywidevine.cdm import Cdm
|
from pywidevine.cdm import Cdm
|
||||||
from pywidevine.device import Device
|
from pywidevine.device import Device
|
||||||
from pywidevine.exceptions import TooManySessions, InvalidSession, SignatureMismatch, InvalidInitData, \
|
from pywidevine.exceptions import (InvalidContext, InvalidInitData, InvalidLicenseMessage, InvalidLicenseType,
|
||||||
InvalidLicenseType, InvalidLicenseMessage, InvalidContext
|
InvalidSession, SignatureMismatch, TooManySessions)
|
||||||
|
|
||||||
routes = web.RouteTableDef()
|
routes = web.RouteTableDef()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue