mirror of
				https://github.com/magic-wormhole/magic-wormhole.git
				synced 2024-08-18 02:24:35 +03:00 
			
		
		
		
	use incorporated attrs zope-interface support
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| from __future__ import absolute_import, print_function, unicode_literals | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import provides | ||||
| from wormhole.util import provides | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import implementer | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import re | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import instance_of, optional, provides | ||||
| from attr.validators import instance_of, optional | ||||
| from automat import MethodicalMachine | ||||
| from twisted.python import log | ||||
| from zope.interface import implementer | ||||
| @@ -23,7 +23,7 @@ from ._terminator import Terminator | ||||
| from ._wordlist import PGPWordList | ||||
| from .errors import (LonelyError, OnlyOneCodeError, ServerError, WelcomeError, | ||||
|                      WrongPasswordError, _UnknownPhaseError) | ||||
| from .util import bytes_to_dict | ||||
| from .util import bytes_to_dict, provides | ||||
|  | ||||
|  | ||||
| @attrs | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| from __future__ import print_function, absolute_import, unicode_literals | ||||
| from zope.interface import implementer | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import provides | ||||
| from automat import MethodicalMachine | ||||
| from . import _interfaces | ||||
| from ._nameplate import validate_nameplate | ||||
| from .errors import KeyFormatError | ||||
| from .util import provides | ||||
|  | ||||
|  | ||||
| def validate_code(code): | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| from collections import namedtuple | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import instance_of, provides | ||||
| from attr.validators import instance_of | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import Interface, implementer | ||||
| from twisted.python import log | ||||
| @@ -8,6 +8,7 @@ from twisted.internet.protocol import Protocol | ||||
| from twisted.internet.interfaces import ITransport | ||||
| from .._interfaces import IDilationConnector | ||||
| from ..observer import OneShotObserver | ||||
| from ..util import provides | ||||
| from .encode import to_be4, from_be4 | ||||
| from .roles import LEADER, FOLLOWER | ||||
| from ._noise import NoiseInvalidMessage, NoiseHandshakeError, NOISE_MAX_PAYLOAD, NOISE_MAX_CIPHERTEXT | ||||
|   | ||||
| @@ -2,7 +2,7 @@ from __future__ import print_function, unicode_literals | ||||
| from collections import defaultdict | ||||
| from binascii import hexlify | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import instance_of, provides, optional | ||||
| from attr.validators import instance_of, optional | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import implementer | ||||
| from twisted.internet.task import deferLater | ||||
| @@ -16,7 +16,7 @@ from .. import ipaddrs  # TODO: move into _dilation/ | ||||
| from .._interfaces import IDilationConnector, IDilationManager | ||||
| from ..timing import DebugTiming | ||||
| from ..observer import EmptyableSet | ||||
| from ..util import HKDF, to_unicode | ||||
| from ..util import HKDF, to_unicode, provides | ||||
| from .connection import DilatedConnectionProtocol, KCM | ||||
| from .roles import LEADER | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| from __future__ import print_function, unicode_literals | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import provides | ||||
| from zope.interface import implementer | ||||
| from twisted.python import log | ||||
| from .._interfaces import IDilationManager, IInbound, ISubChannel | ||||
| from ..util import provides | ||||
| from .subchannel import (SubChannel, _SubchannelAddress) | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import os | ||||
| from collections import deque | ||||
| from collections.abc import Sequence | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import provides, instance_of, optional | ||||
| from attr.validators import instance_of, optional | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import implementer | ||||
| from twisted.internet.defer import Deferred | ||||
| @@ -10,7 +10,7 @@ from twisted.internet.interfaces import (IStreamClientEndpoint, | ||||
|                                          IStreamServerEndpoint) | ||||
| from twisted.python import log, failure | ||||
| from .._interfaces import IDilator, IDilationManager, ISend, ITerminator | ||||
| from ..util import dict_to_bytes, bytes_to_dict, bytes_to_hexstr | ||||
| from ..util import dict_to_bytes, bytes_to_dict, bytes_to_hexstr, provides | ||||
| from ..observer import OneShotObserver | ||||
| from .._key import derive_key | ||||
| from .subchannel import (SubChannel, _SubchannelAddress, _WormholeAddress, | ||||
|   | ||||
| @@ -1,12 +1,12 @@ | ||||
| from __future__ import print_function, unicode_literals | ||||
| from collections import deque | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import provides | ||||
| from zope.interface import implementer | ||||
| from twisted.internet.interfaces import IPushProducer, IPullProducer | ||||
| from twisted.python import log | ||||
| from twisted.python.reflect import safe_str | ||||
| from .._interfaces import IDilationManager, IOutbound | ||||
| from ..util import provides | ||||
| from .connection import KCM, Ping, Pong, Ack | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| from collections import deque | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import instance_of, provides | ||||
| from attr.validators import instance_of | ||||
| from zope.interface import implementer | ||||
| from twisted.internet.defer import inlineCallbacks, returnValue | ||||
| from twisted.internet.interfaces import (ITransport, IProducer, IConsumer, | ||||
| @@ -12,6 +12,7 @@ from twisted.internet.error import ConnectionDone | ||||
| from automat import MethodicalMachine | ||||
| from .._interfaces import ISubChannel, IDilationManager | ||||
| from ..observer import OneShotObserver | ||||
| from ..util import provides | ||||
|  | ||||
| # each subchannel frame (the data passed into transport.write(data)) gets a | ||||
| # 9-byte header prefix (type, subchannel id, and sequence number), then gets | ||||
|   | ||||
| @@ -6,14 +6,13 @@ from __future__ import absolute_import, print_function, unicode_literals | ||||
| import threading | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import provides | ||||
| from automat import MethodicalMachine | ||||
| from twisted.internet import defer | ||||
| from zope.interface import implementer | ||||
|  | ||||
| from . import _interfaces, errors | ||||
| from ._nameplate import validate_nameplate | ||||
|  | ||||
| from .util import provides | ||||
|  | ||||
| def first(outputs): | ||||
|     return list(outputs)[0] | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| from hashlib import sha256 | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import instance_of, provides | ||||
| from attr.validators import instance_of | ||||
| from automat import MethodicalMachine | ||||
| from nacl import utils | ||||
| from nacl.exceptions import CryptoError | ||||
| @@ -11,7 +11,7 @@ from zope.interface import implementer | ||||
|  | ||||
| from . import _interfaces | ||||
| from .util import (bytes_to_dict, bytes_to_hexstr, dict_to_bytes, | ||||
|                    hexstr_to_bytes, to_bytes, HKDF) | ||||
|                    hexstr_to_bytes, to_bytes, HKDF, provides) | ||||
|  | ||||
| CryptoError | ||||
| __all__ = ["derive_key", "derive_phase_key", "CryptoError", "Key"] | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| from __future__ import absolute_import, print_function, unicode_literals | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import provides | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import implementer | ||||
|  | ||||
| from . import _interfaces | ||||
| from .util import provides | ||||
|  | ||||
|  | ||||
| @attrs | ||||
|   | ||||
| @@ -1,11 +1,12 @@ | ||||
| from __future__ import absolute_import, print_function, unicode_literals | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import instance_of, provides | ||||
| from attr.validators import instance_of | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import implementer | ||||
|  | ||||
| from . import _interfaces | ||||
| from .util import provides | ||||
|  | ||||
|  | ||||
| @attrs | ||||
|   | ||||
| @@ -1,12 +1,13 @@ | ||||
| from __future__ import absolute_import, print_function, unicode_literals | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import instance_of, provides | ||||
| from attr.validators import instance_of | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import implementer | ||||
|  | ||||
| from . import _interfaces | ||||
| from ._key import CryptoError, decrypt_data, derive_key, derive_phase_key | ||||
| from .util import provides | ||||
|  | ||||
|  | ||||
| @attrs | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import os | ||||
| from urllib.parse import urlparse | ||||
| from attr import attrs, attrib | ||||
| from attr.validators import provides, instance_of, optional | ||||
| from attr.validators import instance_of, optional | ||||
| from zope.interface import implementer | ||||
| from twisted.python import log | ||||
| from twisted.internet import defer, endpoints, task | ||||
| @@ -9,7 +9,7 @@ from twisted.application import internet | ||||
| from autobahn.twisted import websocket | ||||
| from . import _interfaces, errors | ||||
| from .util import (bytes_to_hexstr, hexstr_to_bytes, bytes_to_dict, | ||||
|                    dict_to_bytes) | ||||
|                    dict_to_bytes, provides) | ||||
|  | ||||
|  | ||||
| class WSClient(websocket.WebSocketClientProtocol): | ||||
|   | ||||
| @@ -1,12 +1,13 @@ | ||||
| from __future__ import absolute_import, print_function, unicode_literals | ||||
|  | ||||
| from attr import attrib, attrs | ||||
| from attr.validators import instance_of, provides | ||||
| from attr.validators import instance_of | ||||
| from automat import MethodicalMachine | ||||
| from zope.interface import implementer | ||||
|  | ||||
| from . import _interfaces | ||||
| from ._key import derive_phase_key, encrypt_data | ||||
| from .util import provides | ||||
|  | ||||
|  | ||||
| @attrs | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 meejah
					meejah