Ticket #6342: ticket6342.2.patch

File ticket6342.2.patch, 19.0 KB (added by rodney757, 6 years ago)

lastest patch

  • twisted/conch/client/knownhosts.py

    diff --git twisted/conch/client/knownhosts.py twisted/conch/client/knownhosts.py
    index 614cdaa..edb222b 100644
    An implementation of the OpenSSH known_hosts database. 
    1111from binascii import Error as DecodeError, b2a_base64
    1212import hmac
    1313import sys
     14from hashlib import sha1
    1415
    1516from zope.interface import implements
    1617
    1718from twisted.python.randbytes import secureRandom
    18 from twisted.python.hashlib import sha1
    1919from twisted.internet import defer
    2020from twisted.python import log
    2121from twisted.python.util import FancyEqMixin
  • twisted/conch/ssh/keys.py

    diff --git twisted/conch/ssh/keys.py twisted/conch/ssh/keys.py
    index 1ddb6cf..6a288fa 100644
    Maintainer: U{Paul Swartz} 
    1111# base library imports
    1212import base64
    1313import itertools
     14from hashlib import md5, sha1
    1415
    1516# external library imports
    1617from Crypto.Cipher import DES3, AES
    from pyasn1.codec.ber import encoder as berEncoder 
    2223
    2324# twisted
    2425from twisted.python import randbytes
    25 from twisted.python.hashlib import md5, sha1
    2626
    2727# sibling imports
    2828from twisted.conch.ssh import common, sexpy
  • twisted/conch/ssh/transport.py

    diff --git twisted/conch/ssh/transport.py twisted/conch/ssh/transport.py
    index 9e0c753..11ce003 100644
    Maintainer: Paul Swartz 
    1414import struct
    1515import zlib
    1616import array
     17from hashlib import md5, sha1
    1718
    1819# external library imports
    1920from Crypto import Util
    from twisted.internet import protocol, defer 
    2425
    2526from twisted.conch import error
    2627from twisted.python import log, randbytes
    27 from twisted.python.hashlib import md5, sha1
    2828
    2929
    3030# sibling imports
  • twisted/conch/test/test_keys.py

    diff --git twisted/conch/test/test_keys.py twisted/conch/test/test_keys.py
    index 8403e1e..6d5cba3 100644
    if Crypto and pyasn1: 
    2020    from twisted.conch.ssh import keys, common, sexpy
    2121
    2222import os, base64
     23from hashlib import sha1
    2324from twisted.conch.test import keydata
    2425from twisted.python import randbytes
    25 from twisted.python.hashlib import sha1
    2626from twisted.trial import unittest
    2727
    2828
  • twisted/conch/test/test_transport.py

    diff --git twisted/conch/test/test_transport.py twisted/conch/test/test_transport.py
    index 8b801b0..88baa97 100644
    else: 
    3333        class SSHFactory:
    3434            pass
    3535
     36from hashlib import md5, sha1
     37
    3638from twisted.trial import unittest
    3739from twisted.internet import defer
    3840from twisted.protocols import loopback
    3941from twisted.python import randbytes
    4042from twisted.python.reflect import qual, getClass
    41 from twisted.python.hashlib import md5, sha1
    4243from twisted.conch.ssh import address, service, common
    4344from twisted.test import proto_helpers
    4445
  • twisted/cred/_digest.py

    diff --git twisted/cred/_digest.py twisted/cred/_digest.py
    index 4640a1d..8257234 100644
    Calculations for HTTP Digest authentication. 
    88@see: U{http://www.faqs.org/rfcs/rfc2617.html}
    99"""
    1010
    11 from twisted.python.hashlib import md5, sha1
     11from hashlib import md5, sha1
    1212
    1313
    1414
  • twisted/cred/credentials.py

    diff --git twisted/cred/credentials.py twisted/cred/credentials.py
    index 63fb44e..b87cc4d 100644
     
    77from zope.interface import implements, Interface
    88
    99import hmac, time, random
    10 from twisted.python.hashlib import md5
     10from hashlib import md5
    1111from twisted.python.randbytes import secureRandom
    1212from twisted.cred._digest import calcResponse, calcHA1, calcHA2
    1313from twisted.cred import error
  • twisted/internet/test/test_unix.py

    diff --git twisted/internet/test/test_unix.py twisted/internet/test/test_unix.py
    index ecfad0b..ff4dd78 100644
    from os import stat, close 
    1010from tempfile import mktemp
    1111from socket import AF_INET, SOCK_STREAM, socket
    1212from pprint import pformat
     13from hashlib import md5
    1314
    1415try:
    1516    from socket import AF_UNIX
    from zope.interface import implements 
    2021
    2122from twisted.python.log import addObserver, removeObserver, err
    2223from twisted.python.failure import Failure
    23 from twisted.python.hashlib import md5
    2424from twisted.python.runtime import platform
    2525from twisted.internet.interfaces import IFileDescriptorReceiver, IReactorUNIX
    2626from twisted.internet.error import ConnectionClosed, FileDescriptorOverrun
  • twisted/mail/maildir.py

    diff --git twisted/mail/maildir.py twisted/mail/maildir.py
    index 31e9e0d..fa72125 100644
    Maildir-style mailbox support 
    1010import os
    1111import stat
    1212import socket
     13from hashlib import md5
    1314
    1415from zope.interface import implementer
    1516
    from twisted.mail import smtp 
    2324from twisted.protocols import basic
    2425from twisted.persisted import dirdbm
    2526from twisted.python import log, failure
    26 from twisted.python.hashlib import md5
    2727from twisted.mail import mail
    2828from twisted.internet import interfaces, defer, reactor
    2929from twisted.cred import portal, credentials, checkers
  • twisted/mail/pop3.py

    diff --git twisted/mail/pop3.py twisted/mail/pop3.py
    index 3b65242..54b9ee6 100644
    Post-office Protocol version 3 
    1414import base64
    1515import binascii
    1616import warnings
     17from hashlib import md5
    1718
    1819from zope.interface import implements, Interface
    1920
    from twisted.internet import task 
    2425from twisted.internet import defer
    2526from twisted.internet import interfaces
    2627from twisted.python import log
    27 from twisted.python.hashlib import md5
    2828
    2929from twisted import cred
    3030import twisted.cred.error
  • twisted/mail/pop3client.py

    diff --git twisted/mail/pop3client.py twisted/mail/pop3client.py
    index fe8f497..d650532 100644
    Don't use this module directly. Use twisted.mail.pop3 instead. 
    1212"""
    1313
    1414import re
     15from hashlib import md5
    1516
    1617from twisted.python import log
    17 from twisted.python.hashlib import md5
    1818from twisted.internet import defer
    1919from twisted.protocols import basic
    2020from twisted.protocols import policies
  • twisted/mail/test/test_mail.py

    diff --git twisted/mail/test/test_mail.py twisted/mail/test/test_mail.py
    index 72ed2d2..87b1e79 100644
    import StringIO 
    1313import rfc822
    1414import tempfile
    1515import signal
     16from hashlib import md5
    1617
    1718from zope.interface.verify import verifyClass
    1819from zope.interface import Interface, implements
    from twisted.internet.error import ProcessDone, ProcessTerminated 
    3233from twisted.internet import address
    3334from twisted.python import failure
    3435from twisted.python.filepath import FilePath
    35 from twisted.python.hashlib import md5
    3636
    3737from twisted import mail
    3838import twisted.mail.mail
  • twisted/news/database.py

    diff --git twisted/news/database.py twisted/news/database.py
    index 137736a..dda5fbe 100644
    News server backend implementations. 
    99import getpass, pickle, time, socket
    1010import os
    1111import StringIO
     12from hashlib import md5
    1213from email.Message import Message
    1314from email.Generator import Generator
    1415from zope.interface import implements, Interface
    from twisted.mail import smtp 
    1819from twisted.internet import defer
    1920from twisted.enterprise import adbapi
    2021from twisted.persisted import dirdbm
    21 from twisted.python.hashlib import md5
    2222
    2323
    2424
  • twisted/persisted/sob.py

    diff --git twisted/persisted/sob.py twisted/persisted/sob.py
    index 2ba2e49..89d9caa 100644
    try: 
    1818    import cStringIO as StringIO
    1919except ImportError:
    2020    import StringIO
     21from hashlib import md5
    2122from twisted.python import log, runtime
    22 from twisted.python.hashlib import md5
    2323from twisted.persisted import styles
    2424from zope.interface import implements, Interface
    2525
  • twisted/protocols/sip.py

    diff --git twisted/protocols/sip.py twisted/protocols/sip.py
    index 8a3f05c..8b71721 100644
    See L{twisted.cred.credentials} and L{twisted.cred._digest} for its new home. 
    1616
    1717# system imports
    1818import socket, time, sys, random, warnings
     19from hashlib import md5
    1920from zope.interface import implements, Interface
    2021
    2122# twisted imports
    2223from twisted.python import log, util
    2324from twisted.python.deprecate import deprecated
    2425from twisted.python.versions import Version
    25 from twisted.python.hashlib import md5
    2626from twisted.internet import protocol, defer, reactor
    2727
    2828from twisted import cred
  • twisted/python/__init__.py

    diff --git twisted/python/__init__.py twisted/python/__init__.py
    index ae78c7b..199e496 100644
    Twisted Python: Utilities and Enhancements for Python. 
    99
    1010"""
    1111
    12    
    13 
  • twisted/python/hashlib.py

    diff --git twisted/python/hashlib.py twisted/python/hashlib.py
    index f3ee0fe..74e1893 100644
     
    33# See LICENSE for details.
    44
    55"""
     6
     7Deprecated in Twisted 12.3.0; please use hashlib from stdlib instead.
     8
    69L{twisted.python.hashlib} presents a subset of the interface provided by
    710U{hashlib<http://docs.python.org/library/hashlib.html>}.  The subset is the
    811interface required by various parts of Twisted.  This allows application code
    912to transparently use APIs which existed before C{hashlib} was introduced or to
    1013use C{hashlib} if it is available.
    1114"""
     15import warnings
     16
     17warnings.warn(
     18    "twisted.python.hashlib was deprecated in "
     19    "Twisted 12.3.0: Please use hashlib from stdlib.",
     20    DeprecationWarning,
     21    stacklevel=2)
    1222
     23_hashlib = __import__("hashlib")
    1324
    14 try:
    15     _hashlib = __import__("hashlib")
    16 except ImportError:
    17     from md5 import md5
    18     from sha import sha as sha1
    19 else:
    20     md5  = _hashlib.md5
    21     sha1 = _hashlib.sha1
     25md5  = _hashlib.md5
     26sha1 = _hashlib.sha1
    2227
    2328
    2429__all__ = ["md5", "sha1"]
  • twisted/python/test/test_hashlib.py

    diff --git twisted/python/test/test_hashlib.py twisted/python/test/test_hashlib.py
    index b50997c..abf7403 100644
    Tests for L{twisted.python.hashlib} 
    66"""
    77
    88from twisted.trial.unittest import TestCase
    9 
    10 from twisted.python.hashlib import md5, sha1
     9from twisted.trial import util
    1110
    1211
    1312class HashObjectTests(TestCase):
    1413    """
    1514    Tests for the hash object APIs presented by L{hashlib}, C{md5} and C{sha1}.
    1615    """
     16    def test_deprecation(self):
     17        """
     18        Test to ensure deprecation of L{twisted.python.hashlib}
     19        """
     20        from twisted.python import hashlib
     21        warnings = self.flushWarnings()
     22        self.assertIdentical(warnings[0]['category'], DeprecationWarning)
     23        self.assertEqual(len(warnings), 1)
     24        self.assertEqual(warnings[0]['message'],
     25                "twisted.python.hashlib was deprecated in "
     26                "Twisted 12.3.0: Please use hashlib from stdlib.")
     27
    1728    def test_md5(self):
    1829        """
    1930        L{hashlib.md5} returns an object which can be used to compute an MD5
    2031        hash as defined by U{RFC 1321<http://www.ietf.org/rfc/rfc1321.txt>}.
    2132        """
     33        from twisted.python.hashlib import md5
     34
    2235        # Test the result using values from section A.5 of the RFC.
    2336        self.assertEqual(
    2437            md5().hexdigest(), "d41d8cd98f00b204e9800998ecf8427e")
    class HashObjectTests(TestCase): 
    5366
    5467        # Instances of it should have a digest_size attribute
    5568        self.assertEqual(md5().digest_size, 16)
    56 
     69    test_md5.suppress = [util.suppress(message="twisted.python.hashlib"
     70          "was deprecated in Twisted 12.3.0: Please use hashlib from stdlib.")]
    5771
    5872    def test_sha1(self):
    5973        """
    6074        L{hashlib.sha1} returns an object which can be used to compute a SHA1
    6175        hash as defined by U{RFC 3174<http://tools.ietf.org/rfc/rfc3174.txt>}.
    6276        """
     77
     78        from twisted.python.hashlib import sha1
     79
    6380        def format(s):
    6481            return ''.join(s.split()).lower()
    6582        # Test the result using values from section 7.3 of the RFC.
    class HashObjectTests(TestCase): 
    88105        # Instances of it should have a digest_size attribute.
    89106        self.assertEqual(
    90107            sha1().digest_size, 20)
     108    test_sha1.suppress = [util.suppress(message="twisted.python.hashlib"
     109          "was deprecated in Twisted 12.3.0: Please use hashlib from stdlib.")]
  • twisted/python/test/test_zipstream.py

    diff --git twisted/python/test/test_zipstream.py twisted/python/test/test_zipstream.py
    index 8871563..ff8ca88 100644
    Tests for L{twisted.python.zipstream} 
    88import sys
    99import random
    1010import zipfile
     11from hashlib import md5
    1112
    1213from twisted.python import zipstream, filepath
    13 from twisted.python.hashlib import md5
    1414from twisted.trial import unittest
    1515
    1616
  • twisted/spread/pb.py

    diff --git twisted/spread/pb.py twisted/spread/pb.py
    index 7e9a5b6..99b5316 100644
    To get started, begin with L{PBClientFactory} and L{PBServerFactory}. 
    2929
    3030import random
    3131import types
     32from hashlib import md5
    3233
    3334from zope.interface import implements, Interface
    3435
    3536# Twisted Imports
    3637from twisted.python import log, failure, reflect
    37 from twisted.python.hashlib import md5
    3838from twisted.internet import defer, protocol
    3939from twisted.cred.portal import Portal
    4040from twisted.cred.credentials import IAnonymous, ICredentials
  • twisted/test/test_digestauth.py

    diff --git twisted/test/test_digestauth.py twisted/test/test_digestauth.py
    index 41368a0..363927d 100644
     
    55Tests for L{twisted.cred._digest} and the associated bits in
    66L{twisted.cred.credentials}.
    77"""
     8from hashlib import md5, sha1
    89
    910from zope.interface.verify import verifyObject
    1011from twisted.trial.unittest import TestCase
    11 from twisted.python.hashlib import md5, sha1
    1212from twisted.internet.address import IPv4Address
    1313from twisted.cred.error import LoginFailed
    1414from twisted.cred.credentials import calcHA1, calcHA2, IUsernameDigestHash
  • new file twisted/topfiles/6342.removal

    diff --git twisted/topfiles/6342.removal twisted/topfiles/6342.removal
    new file mode 100644
    index 0000000..057d71f
    - +  
     1twisted.python.hashlib is now deprecated in favor of hashlib from stdlib.
  • twisted/trial/test/test_loader.py

    diff --git twisted/trial/test/test_loader.py twisted/trial/test/test_loader.py
    index a49fa6e..937fea2 100644
    import os 
    99import sys
    1010
    1111import unittest as pyunit
     12from hashlib import md5
    1213
    1314from twisted.python import util, filepath
    14 from twisted.python.hashlib import md5
    1515from twisted.trial.test import packages
    1616from twisted.trial import runner, reporter, unittest
    1717from twisted.trial.itrial import ITestCase
  • twisted/web/server.py

    diff --git twisted/web/server.py twisted/web/server.py
    index bc3f07c..7a5f59d 100644
    class Site(http.HTTPFactory): 
    660660        """
    661661        (internal) Generate an opaque, unique ID for a user's session.
    662662        """
    663         from twisted.python.hashlib import md5
     663        from hashlib import md5
    664664        import random
    665665        self.counter = self.counter + 1
    666666        return md5(networkString(
  • twisted/words/protocols/jabber/sasl_mechanisms.py

    diff --git twisted/words/protocols/jabber/sasl_mechanisms.py twisted/words/protocols/jabber/sasl_mechanisms.py
    index 5d51be2..186eca5 100644
    Protocol agnostic implementations of SASL authentication mechanisms. 
    88"""
    99
    1010import binascii, random, time, os
     11from hashlib import md5
    1112
    1213from zope.interface import Interface, Attribute, implements
    1314
    14 from twisted.python.hashlib import md5
    1515
    1616class ISASLMechanism(Interface):
    1717    name = Attribute("""Common name for the SASL Mechanism.""")
  • twisted/words/protocols/jabber/xmlstream.py

    diff --git twisted/words/protocols/jabber/xmlstream.py twisted/words/protocols/jabber/xmlstream.py
    index cc2745b..e30508b 100644
    doing authentication on either client or server side, and working with XML 
    1111Stanzas.
    1212"""
    1313
     14from hashlib import sha1
    1415from zope.interface import directlyProvides, implements
    1516
    1617from twisted.internet import defer, protocol
    1718from twisted.internet.error import ConnectionLost
    1819from twisted.python import failure, log, randbytes
    19 from twisted.python.hashlib import sha1
    2020from twisted.words.protocols.jabber import error, ijabber, jid
    2121from twisted.words.xish import domish, xmlstream
    2222from twisted.words.xish.xmlstream import STREAM_CONNECTED_EVENT
  • twisted/words/protocols/msn.py

    diff --git twisted/words/protocols/msn.py twisted/words/protocols/msn.py
    index 79c0fa1..f9dc854 100644
    TODO 
    7474import types, operator, os
    7575from random import randint
    7676from urllib import quote, unquote
     77from hashlib import md5
    7778
    7879from twisted.python import failure, log
    79 from twisted.python.hashlib import md5
    8080from twisted.internet import reactor
    8181from twisted.internet.defer import Deferred, execute
    8282from twisted.internet.protocol import ClientFactory
  • twisted/words/protocols/oscar.py

    diff --git twisted/words/protocols/oscar.py twisted/words/protocols/oscar.py
    index 81571d4..14908c6 100644
    import socket 
    1515import random
    1616import types
    1717import re
     18from hashlib import md5
    1819
    1920from twisted.internet import reactor, defer, protocol
    2021from twisted.python import log
    21 from twisted.python.hashlib import md5
    2222
    2323def logPacketData(data):
    2424    lines = len(data)/16
  • twisted/words/test/test_jabberclient.py

    diff --git twisted/words/test/test_jabberclient.py twisted/words/test/test_jabberclient.py
    index 87af883..dd536ef 100644
     
    44"""
    55Tests for L{twisted.words.protocols.jabber.client}
    66"""
     7from hashlib import sha1
    78
    89from twisted.internet import defer
    9 from twisted.python.hashlib import sha1
    1010from twisted.trial import unittest
    1111from twisted.words.protocols.jabber import client, error, jid, xmlstream
    1212from twisted.words.protocols.jabber.sasl import SASLInitiatingInitializer
  • twisted/words/test/test_jabbercomponent.py

    diff --git twisted/words/test/test_jabbercomponent.py twisted/words/test/test_jabbercomponent.py
    index d8bb108..91e107b 100644
     
    44"""
    55Tests for L{twisted.words.protocols.jabber.component}
    66"""
     7from hashlib import sha1
    78
    89from twisted.python import failure
    9 from twisted.python.hashlib import sha1
    1010from twisted.trial import unittest
    1111from twisted.words.protocols.jabber import component, xmlstream
    1212from twisted.words.protocols.jabber.jid import JID
  • twisted/words/test/test_msn.py

    diff --git twisted/words/test/test_msn.py twisted/words/test/test_msn.py
    index ece580f..669c9aa 100644
    Test cases for L{twisted.words.protocols.msn}. 
    77
    88# System imports
    99import StringIO
     10from hashlib import md5
    1011
    1112# Twisted imports
    1213
    else: 
    2425    from twisted.words.protocols import msn
    2526
    2627
    27 from twisted.python.hashlib import md5
    2828from twisted.protocols import loopback
    2929from twisted.internet.defer import Deferred
    3030from twisted.trial import unittest