Ticket #1636: interface_1636.diff

File interface_1636.diff, 113.8 KB (added by therve, 16 years ago)

Replace components.Interface with zope.interface.Interface

  • manhole/service.py

     
    99# twisted imports
    1010from twisted import copyright
    1111from twisted.spread import pb
    12 from twisted.python import log, components, failure
     12from twisted.python import log, failure
    1313from twisted.cred import portal
    1414from twisted.application import service
    15 from zope.interface import implements
     15from zope.interface import implements, Interface
    1616
    1717# sibling imports
    1818import explorer
     
    6767                block_begin = i
    6868
    6969
    70 class IManholeClient(components.Interface):
    71     def console(self, list_of_messages):
     70class IManholeClient(Interface):
     71    def console(list_of_messages):
    7272        """Takes a list of (type, message) pairs to display.
    7373
    7474        Types include:
     
    8282            - \"exception\" -- a L{failure.Failure}
    8383        """
    8484
    85     def receiveExplorer(self, xplorer):
     85    def receiveExplorer(xplorer):
    8686        """Receives an explorer.Explorer
    8787        """
    8888
    89     def listCapabilities(self):
     89    def listCapabilities():
    9090        """List what manholey things I am capable of doing.
    9191
    9292        i.e. C{\"Explorer\"}, C{\"Failure\"}
  • manhole/_inspectro.py

     
    1313from twisted.python import reflect
    1414
    1515from twisted.manhole.ui import gtk2manhole
    16 from twisted.python.components import Adapter, Interface, registerAdapter
     16from twisted.python.components import Adapter, registerAdapter
    1717from twisted.python import log, components
    1818from twisted.protocols import policies
    19 from zope.interface import implements
     19from zope.interface import implements, Interface
    2020
    2121# the glade file uses stock icons, which requires gnome to be installed
    2222import gnome
  • protocols/sip.py

     
    1616import time
    1717import md5
    1818import sys
    19 from zope.interface import implements
     19from zope.interface import implements, Interface
    2020
    2121# twisted imports
    2222from twisted.python import log, util, components
    2323from twisted.internet import protocol, defer, reactor
    24 from twisted.python.components import Interface
    2524
    2625from twisted import cred
    2726import twisted.cred.credentials
     
    729728class IRegistry(Interface):
    730729    """Allows registration of logical->physical URL mapping."""
    731730
    732     def registerAddress(self, domainURL, logicalURL, physicalURL):
     731    def registerAddress(domainURL, logicalURL, physicalURL):
    733732        """Register the physical address of a logical URL.
    734733
    735734        @return: Deferred of C{Registration} or failure with RegistrationError.
    736735        """
    737736
    738     def unregisterAddress(self, domainURL, logicalURL, physicalURL):
     737    def unregisterAddress(domainURL, logicalURL, physicalURL):
    739738        """Unregister the physical address of a logical URL.
    740739
    741740        @return: Deferred of C{Registration} or failure with RegistrationError.
    742741        """
    743742
    744     def getRegistrationInfo(self, logicalURL):
     743    def getRegistrationInfo(logicalURL):
    745744        """Get registration info for logical URL.
    746745
    747746        @return: Deferred of C{Registration} object or failure of LookupError.
     
    751750class ILocator(Interface):
    752751    """Allow looking up physical address for logical URL."""
    753752
    754     def getAddress(self, logicalURL):
     753    def getAddress(logicalURL):
    755754        """Return physical URL of server for logical URL of user.
    756755
    757756        @param logicalURL: a logical C{URL}.
     
    871870        pass
    872871
    873872class IAuthorizer(Interface):
    874     def getChallenge(self, peer):
     873    def getChallenge(peer):
    875874        """Generate a challenge the client may respond to.
    876875       
    877876        @type peer: C{tuple}
     
    881880        @return: The challenge string
    882881        """
    883882   
    884     def decode(self, response):
     883    def decode(response):
    885884        """Create a credentials object from the given response.
    886885       
    887886        @type response: C{str}
  • protocols/htb.py

     
    2020
    2121__version__ = '$Revision: 1.5 $'[11:-2]
    2222
    23 from twisted.python.components import Interface
    2423
    2524# TODO: Investigate whether we should be using os.times()[-1] instead of
    2625# time.time.  time.time, it has been pointed out, can go backwards.  Is
    2726# the same true of os.times?
    2827from time import time
    29 from zope.interface import implements
     28from zope.interface import implements, Interface
    3029
    3130from twisted.protocols import pcp
    3231
     
    9897
    9998
    10099class IBucketFilter(Interface):
    101     def getBucketFor(self, *somethings, **some_kw):
     100    def getBucketFor(*somethings, **some_kw):
    102101        """I'll give you a bucket for something.
    103102
    104103        @returntype: L{Bucket}
  • protocols/ftp.py

     
    3333from twisted.internet import reactor, interfaces, protocol, error, defer
    3434from twisted.protocols import basic, policies
    3535
    36 from twisted.python import log, components, failure, filepath
     36from twisted.python import log, failure, filepath
    3737
    3838from twisted.cred import error as cred_error, portal, credentials, checkers
    3939
     
    317317
    318318# -- DTP Protocol --
    319319
    320 class IDTPFactory(components.Interface):
     320class IDTPFactory(Interface):
    321321    """An interface for protocol.Factories
    322322
    323323    @ivar peerCheck: perform checks to make sure the ftp-pi's peer is the same
    324324        as the dtp's
    325325    @ivar pi: a reference to this factory's protocol interpreter
    326326    """
    327     def __init__(self, pi, peerHost=None):
     327    def __init__(pi, peerHost=None):
    328328        """Constructor
    329329        @param pi: this factory's protocol interpreter
    330330        @param peerHost: if peerCheck is True, this is the tuple that the
  • conch/insults/insults.py

     
    1111
    1212import string
    1313
    14 from zope.interface import implements
     14from zope.interface import implements, Interface
    1515
    1616from twisted.internet import protocol, defer, interfaces as iinternet
    17 from twisted.python import components
    1817
    19 class ITerminalProtocol(components.Interface):
    20     def makeConnection(self, transport):
     18class ITerminalProtocol(Interface):
     19    def makeConnection(transport):
    2120        """Called with an ITerminalTransport when a connection is established.
    2221        """
    2322
    24     def keystrokeReceived(self, keyID, modifier):
     23    def keystrokeReceived(keyID, modifier):
    2524        """A keystroke was received.
    2625
    2726        Each keystroke corresponds to one invocation of this method.
     
    3130        C{ServerProtocol}.
    3231        """
    3332
    34     def terminalSize(self, width, height):
     33    def terminalSize(width, height):
    3534        """Called to indicate the size of the terminal.
    3635
    3736        A terminal of 80x24 should be assumed if this method is not
    3837        called.  This method might not be called for real terminals.
    3938        """
    4039
    41     def unhandledControlSequence(self, seq):
     40    def unhandledControlSequence(seq):
    4241        """Called when an unsupported control sequence is received.
    4342
    4443        @type seq: C{str}
    4544        @param seq: The whole control sequence which could not be interpreted.
    4645        """
    4746
    48     def connectionLost(self, reason):
     47    def connectionLost(reason):
    4948        """Called when the connection has been lost.
    5049
    5150        reason is a Failure describing why.
  • pair/raw.py

     
    66"""Interface definitions for working with raw packets"""
    77
    88from twisted.internet import protocol
    9 from twisted.python import components
     9from zope.interface import Interface
    1010
    11 class IRawDatagramProtocol(components.Interface):
     11class IRawDatagramProtocol(Interface):
    1212    """An interface for protocols such as UDP, ICMP and TCP."""
    1313
    1414    def addProto():
     
    2121        An IP datagram has been received. Parse and process it.
    2222        """
    2323
    24 class IRawPacketProtocol(components.Interface):
     24class IRawPacketProtocol(Interface):
    2525    """An interface for low-level protocols such as IP and ARP."""
    2626
    2727    def addProto():
  • pair/ethernet.py

     
    1212
    1313from twisted.internet import protocol
    1414from twisted.pair import raw
    15 from twisted.python import components
    16 from zope.interface import implements
     15from zope.interface import implements, Interface
    1716
    1817
    19 class IEthernetProtocol(components.Interface):
     18class IEthernetProtocol(Interface):
    2019    """An interface for protocols that handle Ethernet frames"""
    2120    def addProto():
    2221        """Add an IRawPacketProtocol protocol"""
  • words/protocols/jabber/component.py

     
    44# See LICENSE for details.
    55
    66
    7 from zope.interface import implements
     7from zope.interface import implements, Interface
    88
    99from twisted.words.xish import domish, xpath, utility
    1010from twisted.words.protocols.jabber import jstrports, xmlstream
     
    6262
    6363
    6464from twisted.application import service
    65 from twisted.python import components
    6665
    67 class IService(components.Interface):
    68     def componentConnected(self, xmlstream):
     66class IService(Interface):
     67    def componentConnected(xmlstream):
    6968        """ Parent component has established a connection
    7069        """
    7170
    72     def componentDisconnected(self):
     71    def componentDisconnected():
    7372        """ Parent component has lost a connection to the Jabber system
    7473        """
    7574
    76     def transportConnected(self, xmlstream):
     75    def transportConnected(xmlstream):
    7776        """ Parent component has established a connection over the underlying transport
    7877        """
    7978
  • words/im/interfaces.py

     
    33
    44Stability: incendiary, work in progress.
    55"""
    6 from twisted.python.components import Interface
     6from zope.interface import Interface
    77
    88from twisted.words.im import locals
    99
     
    2727    @type client: L{IClient}
    2828    """
    2929
    30     def __init__(self, accountName, autoLogin, username, password, host, port):
     30    def __init__(accountName, autoLogin, username, password, host, port):
    3131        """
    3232        @type accountName: string
    3333        @param accountName: A name to refer to the account by locally.
     
    3838        @type port: integer
    3939        """
    4040
    41     def isOnline(self):
     41    def isOnline():
    4242        """Am I online?
    4343
    4444        @returntype: boolean
    4545        """
    4646
    47     def logOn(self, chatui):
     47    def logOn(chatui):
    4848        """Go on-line.
    4949
    5050        @type chatui: Implementor of C{IChatUI}
     
    5252        @returntype: Deferred L{Client}
    5353        """
    5454
    55     def logOff(self):
     55    def logOff():
    5656        """Sign off.
    5757        """
    5858
    59     def getGroup(self, groupName):
     59    def getGroup(groupName):
    6060        """
    6161        @returntype: L{Group<IGroup>}
    6262        """
    6363
    64     def getPerson(self, personName):
     64    def getPerson(personName):
    6565        """
    6666        @returntype: L{Person<IPerson>}
    6767        """
     
    7171    @ivar account: The Account I am a Client for.
    7272    @type account: L{IAccount}
    7373    """
    74     def __init__(self, account, chatui, logonDeferred):
     74    def __init__(account, chatui, logonDeferred):
    7575        """
    7676        @type account: L{IAccount}
    7777        @type chatui: L{IChatUI}
     
    7979        @type logonDeferred: L{Deferred<twisted.internet.defer.Deferred>}
    8080        """
    8181
    82     def joinGroup(self, groupName):
     82    def joinGroup(groupName):
    8383        """
    8484        @param groupName: The name of the group to join.
    8585        @type groupName: string
    8686        """
    8787
    88     def leaveGroup(self, groupName):
     88    def leaveGroup(groupName):
    8989        """
    9090        @param groupName: The name of the group to leave.
    9191        @type groupName: string
    9292        """
    9393
    94     def getGroupConversation(self, name,hide=0):
     94    def getGroupConversation(name,hide=0):
    9595        pass
    9696
    97     def getPerson(self,name):
     97    def getPerson(name):
    9898        pass
    9999
    100100
    101101class IPerson(Interface):
    102     def __init__(self, name, account):
     102    def __init__(name, account):
    103103        """Initialize me.
    104104
    105105        @param name: My name, as the server knows me.
     
    108108        @type account: I{Account}
    109109        """
    110110
    111     def isOnline(self):
     111    def isOnline():
    112112        """Am I online right now?
    113113
    114114        @returntype: boolean
    115115        """
    116116
    117     def getStatus(self):
     117    def getStatus():
    118118        """What is my on-line status?
    119119
    120120        @returns: L{locals.StatusEnum}
    121121        """
    122122
    123     def getIdleTime(self):
     123    def getIdleTime():
    124124        """
    125125        @returntype: string (XXX: How about a scalar?)
    126126        """
    127127
    128     def sendMessage(self, text, metadata=None):
     128    def sendMessage(text, metadata=None):
    129129        """Send a message to this person.
    130130
    131131        @type text: string
     
    145145    @type account: I{Account<IAccount>}
    146146    """
    147147
    148     def __init__(self, name, account):
     148    def __init__(name, account):
    149149        """Initialize me.
    150150
    151151        @param name: My name, as the server knows me.
     
    154154        @type account: I{Account<IAccount>}
    155155        """
    156156
    157     def setTopic(self, text):
     157    def setTopic(text):
    158158        """Set this Groups topic on the server.
    159159
    160160        @type text: string
    161161        """
    162162
    163     def sendGroupMessage(self, text, metadata=None):
     163    def sendGroupMessage(text, metadata=None):
    164164        """Send a message to this group.
    165165
    166166        @type text: string
     
    172172                - C{'emote'}: indicates this is an action
    173173        """
    174174
    175     def join(self):
     175    def join():
    176176        pass
    177177
    178     def leave(self):
     178    def leave():
    179179        """Depart this group"""
    180180
    181181
    182182class IConversation(Interface):
    183183    """A conversation with a specific person."""
    184     def __init__(self, person, chatui):
     184    def __init__(person, chatui):
    185185        """
    186186        @type person: L{IPerson}
    187187        """
    188188
    189     def show(self):
     189    def show():
    190190        """doesn't seem like it belongs in this interface."""
    191191
    192     def hide(self):
     192    def hide():
    193193        """nor this neither."""
    194194
    195     def sendText(self, text, metadata):
     195    def sendText(text, metadata):
    196196        pass
    197197
    198     def showMessage(self, text, metadata):
     198    def showMessage(text, metadata):
    199199        pass
    200200
    201     def changedNick(self, person, newnick):
     201    def changedNick(person, newnick):
    202202        """
    203203        @param person: XXX Shouldn't this always be Conversation.person?
    204204        """
    205205
    206206class IGroupConversation(Interface):
    207     def show(self):
     207    def show():
    208208        """doesn't seem like it belongs in this interface."""
    209209
    210     def hide(self):
     210    def hide():
    211211        """nor this neither."""
    212212
    213     def sendText(self, text, metadata):
     213    def sendText(text, metadata):
    214214        pass
    215215
    216     def showGroupMessage(self, sender, text, metadata):
     216    def showGroupMessage(sender, text, metadata):
    217217        pass
    218218
    219     def setGroupMembers(self, members):
     219    def setGroupMembers(members):
    220220        """Sets the list of members in the group and displays it to the user
    221221        """
    222222
    223     def setTopic(self, topic, author):
     223    def setTopic(topic, author):
    224224        """Displays the topic (from the server) for the group conversation window
    225225
    226226        @type topic: string
    227227        @type author: string (XXX: Not Person?)
    228228        """
    229229
    230     def memberJoined(self, member):
     230    def memberJoined(member):
    231231        """Adds the given member to the list of members in the group conversation
    232232        and displays this to the user
    233233
    234234        @type member: string (XXX: Not Person?)
    235235        """
    236236
    237     def memberChangedNick(self, oldnick, newnick):
     237    def memberChangedNick(oldnick, newnick):
    238238        """Changes the oldnick in the list of members to newnick and displays this
    239239        change to the user
    240240
     
    242242        @type newnick: string
    243243        """
    244244
    245     def memberLeft(self, member):
     245    def memberLeft(member):
    246246        """Deletes the given member from the list of members in the group
    247247        conversation and displays the change to the user
    248248
     
    251251
    252252
    253253class IChatUI(Interface):
    254     def registerAccountClient(self, client):
     254    def registerAccountClient(client):
    255255        """Notifies user that an account has been signed on to.
    256256
    257257        @type client: L{Client<IClient>}
    258258        """
    259259
    260     def unregisterAccountClient(self, client):
     260    def unregisterAccountClient(client):
    261261        """Notifies user that an account has been signed off or disconnected
    262262
    263263        @type client: L{Client<IClient>}
    264264        """
    265265
    266     def getContactsList(self):
     266    def getContactsList():
    267267        """
    268268        @returntype: L{ContactsList}
    269269        """
     
    271271    # WARNING: You'll want to be polymorphed into something with
    272272    # intrinsic stoning resistance before continuing.
    273273
    274     def getConversation(self, person, Class, stayHidden=0):
     274    def getConversation(person, Class, stayHidden=0):
    275275        """For the given person object, returns the conversation window
    276276        or creates and returns a new conversation window if one does not exist.
    277277
     
    282282        @returntype: L{Conversation<IConversation>}
    283283        """
    284284
    285     def getGroupConversation(self,group,Class,stayHidden=0):
     285    def getGroupConversation(group,Class,stayHidden=0):
    286286        """For the given group object, returns the group conversation window or
    287287        creates and returns a new group conversation window if it doesn't exist.
    288288
     
    293293        @returntype: L{GroupConversation<interfaces.IGroupConversation>}
    294294        """
    295295
    296     def getPerson(self, name, client):
     296    def getPerson(name, client):
    297297        """Get a Person for a client.
    298298
    299299        Duplicates L{IAccount.getPerson}.
     
    304304        @returntype: L{Person<IPerson>}
    305305        """
    306306
    307     def getGroup(self, name, client):
     307    def getGroup(name, client):
    308308        """Get a Group for a client.
    309309
    310310        Duplicates L{IAccount.getGroup}.
     
    315315        @returntype: L{Group<IGroup>}
    316316        """
    317317
    318     def contactChangedNick(self, oldnick, newnick):
     318    def contactChangedNick(oldnick, newnick):
    319319        """For the given person, changes the person's name to newnick, and
    320320        tells the contact list and any conversation windows with that person
    321321        to change as well.
  • web2/proxy.py

     
    2424from twisted.web2 import http
    2525from twisted.internet import reactor, protocol
    2626from twisted.web2 import resource, server
    27 from twisted.python import components
    28 from zope.interface import implements
     27from zope.interface import implements, Interface
    2928
    3029# system imports
    3130import urlparse
     
    157156
    158157    requestFactory = ReverseProxyRequest
    159158
    160 class IConnector(components.Interface):
     159class IConnector(Interface):
    161160    """attribute name"""
    162     def connect(self, factory):
     161    def connect(factory):
    163162        """connect ClientFactory"""
    164163
    165164class TCPConnector:
  • web2/iweb.py

     
    55    and IResource.  I am based heavily on ideas from nevow.inevow
    66"""
    77
    8 from twisted.python import components
    98from zope.interface import Attribute, Interface, interface
    109
    1110# server.py interfaces
     
    5554            return IResource(result)
    5655IResource.__class__ = SpecialAdaptInterfaceClass
    5756
    58 class IOldNevowResource(components.Interface):
     57class IOldNevowResource(Interface):
    5958    # Shared interface with inevow.IResource
    6059    """
    6160        I am a web resource.
    6261    """
    6362
    64     def locateChild(self, ctx, segments):
     63    def locateChild(ctx, segments):
    6564        """Locate another object which can be adapted to IResource
    6665        Return a tuple of resource, path segments
    6766        """
    6867
    69     def renderHTTP(self, ctx):
     68    def renderHTTP(ctx):
    7069        """Return a string or a deferred which will fire a string. This string
    7170        will be written to the web browser which initiated this request.
    7271
     
    7574        string instead of a response object.
    7675        """
    7776
    78 class ICanHandleException(components.Interface):
     77class ICanHandleException(Interface):
    7978    # Shared interface with inevow.ICanHandleException
    80     def renderHTTP_exception(self, request, failure):
     79    def renderHTTP_exception(request, failure):
    8180        """Render an exception to the given request object.
    8281        """
    8382
    84     def renderInlineException(self, request, reason):
     83    def renderInlineException(request, reason):
    8584        """Return stan representing the exception, to be printed in the page,
    8685        not replacing the page."""
    8786
     
    109108       
    110109    chanRequest = Attribute("The ChannelRequest. I wonder if this is public really?")
    111110
    112 class IOldRequest(components.Interface):
     111class IOldRequest(Interface):
    113112    # Shared interface with inevow.ICurrentSegments
    114113    """An old HTTP request.
    115114
     
    126125    @ivar received_headers: All received headers
    127126    """
    128127    # Methods for received request
    129     def getHeader(self, key):
     128    def getHeader(key):
    130129        """Get a header that was sent from the network.
    131130        """
    132131       
    133     def getCookie(self, key):
     132    def getCookie(key):
    134133        """Get a cookie that was sent from the network.
    135134        """   
    136135
    137136
    138     def getAllHeaders(self):
     137    def getAllHeaders():
    139138        """Return dictionary of all headers the request received."""
    140139
    141     def getRequestHostname(self):
     140    def getRequestHostname():
    142141        """Get the hostname that the user passed in to the request.
    143142
    144143        This will either use the Host: header (if it is available) or the
    145144        host we are listening on if the header is unavailable.
    146145        """
    147146
    148     def getHost(self):
     147    def getHost():
    149148        """Get my originally requesting transport's host.
    150149
    151150        Don't rely on the 'transport' attribute, since Request objects may be
     
    153152        twisted.internet.tcp.Port.
    154153        """
    155154       
    156     def getClientIP(self):
     155    def getClientIP():
    157156        pass
    158     def getClient(self):
     157    def getClient():
    159158        pass
    160     def getUser(self):
     159    def getUser():
    161160        pass
    162     def getPassword(self):
     161    def getPassword():
    163162        pass
    164     def isSecure(self):
     163    def isSecure():
    165164        pass
    166165
    167     def getSession(self, sessionInterface = None):
     166    def getSession(sessionInterface = None):
    168167        pass
    169168   
    170     def URLPath(self):
     169    def URLPath():
    171170        pass
    172171
    173     def prePathURL(self):
     172    def prePathURL():
    174173        pass
    175174
    176     def rememberRootURL(self):
     175    def rememberRootURL():
    177176        """
    178177        Remember the currently-processed part of the URL for later
    179178        recalling.
    180179        """
    181180       
    182     def getRootURL(self):
     181    def getRootURL():
    183182        """
    184183        Get a previously-remembered URL.
    185184        """
    186185       
    187186    # Methods for outgoing request
    188     def finish(self):
     187    def finish():
    189188        """We are finished writing data."""
    190189
    191     def write(self, data):
     190    def write(data):
    192191        """
    193192        Write some data as a result of an HTTP request.  The first
    194193        time this is called, it writes out response data.
    195194        """
    196195
    197     def addCookie(self, k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None):
     196    def addCookie(k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None):
    198197        """Set an outgoing HTTP cookie.
    199198
    200199        In general, you should consider using sessions instead of cookies, see
     
    202201        twisted.web.server.Session class for details.
    203202        """
    204203
    205     def setResponseCode(self, code, message=None):
     204    def setResponseCode(code, message=None):
    206205        """Set the HTTP response code.
    207206        """
    208207
    209     def setHeader(self, k, v):
     208    def setHeader(k, v):
    210209        """Set an outgoing HTTP header.
    211210        """
    212211
    213     def redirect(self, url):
     212    def redirect(url):
    214213        """Utility function that does a redirect.
    215214
    216215        The request should have finish() called after this.
    217216        """
    218217
    219     def setLastModified(self, when):
     218    def setLastModified(when):
    220219        """Set the X{Last-Modified} time for the response to this request.
    221220
    222221        If I am called more than once, I ignore attempts to set
     
    235234            body.  Otherwise, I return a false value.
    236235        """
    237236
    238     def setETag(self, etag):
     237    def setETag(etag):
    239238        """Set an X{entity tag} for the outgoing response.
    240239
    241240        That's \"entity tag\" as in the HTTP/1.1 X{ETag} header, \"used
     
    254253            no body.  Otherwise, I return a false value.
    255254        """
    256255
    257     def setHost(self, host, port, ssl=0):
     256    def setHost(host, port, ssl=0):
    258257        """Change the host and port the request thinks it's using.
    259258
    260259        This method is useful for working with reverse HTTP proxies (e.g.
  • web2/requtil.py

     
    1010
    1111# System Imports
    1212import time
    13 import urllib 
     13import urllib
    1414
    1515# Twisted Imports
    1616from twisted.internet import reactor, defer
    1717from twisted.python import log, components
    18 from zope.interface import implements
     18from zope.interface import implements, Interface
    1919
    2020from twisted.web2 import iweb
    2121
     
    3838    else:
    3939        return name
    4040
    41 class IAppRoot(components.Interface):
     41class IAppRoot(Interface):
    4242    """attribute: root"""
    4343
    4444class AppRoot:
     
    4949
    5050components.registerAdapter(AppRoot, iweb.IRequest, IAppRoot)
    5151
    52 class ISession(components.Interface):
     52class ISession(Interface):
    5353    pass
    5454
    5555def getSession(request):
  • pb/test/test_pb.py

     
    55from twisted.python import log
    66#log.startLogging(sys.stderr)
    77
    8 from zope.interface import implements, implementsOnly, implementedBy
    9 from twisted.python import components, failure, reflect
     8from zope.interface import implements, implementsOnly, implementedBy, Interface
     9from twisted.python import failure, reflect
    1010from twisted.internet import reactor, defer
    1111from twisted.trial import unittest
    1212from twisted.internet.main import CONNECTION_LOST
     
    222222    def remote_add(self, a, b):
    223223        return "error"
    224224
    225 class IFoo(components.Interface):
     225class IFoo(Interface):
    226226    # non-remote Interface
    227227    pass
    228228
  • persisted/journal/base.py

     
    1919    import pickle
    2020
    2121# twisted imports
    22 from twisted.python.components import Interface
    23 from twisted.python import components
    24 from zope.interface import implements
     22from zope.interface import implements, Interface
    2523
    2624
    2725class Journal:
     
    103101class ICommand(Interface):
    104102    """A serializable command which interacts with a journaled service."""
    105103
    106     def execute(self, journaledService, runTime):
     104    def execute(journaledService, runTime):
    107105        """Run the command and return result."""
    108106
    109107
    110108class ICommandLog(Interface):
    111109    """Interface for command log."""
    112110
    113     def logCommand(self, command, runTime):
     111    def logCommand(command, runTime):
    114112        """Add a command and its run time to the log.
    115113
    116114        @return: Deferred of command index.
    117115        """
    118116
    119     def getCurrentIndex(self):
     117    def getCurrentIndex():
    120118        """Return index of last command that was logged."""
    121119
    122     def getCommandsSince(self, index):
     120    def getCommandsSince(index):
    123121        """Return commands who's index >= the given one.
    124122
    125123        @return: list of (time, command) tuples, sorted with ascending times.
  • persisted/sob.py

     
    1919    import cStringIO as StringIO
    2020except ImportError:
    2121    import StringIO
    22 from twisted.python import components, log, runtime
     22from twisted.python import log, runtime
    2323from twisted.persisted import styles
    24 from zope.interface import implements
     24from zope.interface import implements, Interface
    2525
    2626# Note:
    2727# These encrypt/decrypt functions only work for data formats
     
    3939    return AES.new(md5.new(passphrase).digest()[:16]).decrypt(data)
    4040
    4141
    42 class IPersistable(components.Interface):
     42class IPersistable(Interface):
    4343
    4444    """An object which can be saved in several formats to a file"""
    4545
  • application/service.py

     
    1515Maintainer: U{Moshe Zadka<mailto:moshez@twistedmatrix.com>}
    1616"""
    1717
    18 from zope.interface import implements
     18from zope.interface import implements, Interface
    1919
    2020from twisted.python import components
    2121from twisted.internet import defer
    2222from twisted.persisted import sob
    2323
    24 class IService(components.Interface):
     24class IService(Interface):
    2525
    2626    """
    2727    A service.
     
    3434    @ivar running:         Whether the service is running.
    3535    """
    3636
    37     def setName(self, name):
     37    def setName(name):
    3838        """Set the name of the service.
    3939
    4040        @type name: C{str}
    4141        @raise L{RuntimeError}: Raised if the service already has a parent.
    4242        """
    4343
    44     def setServiceParent(self, parent):
     44    def setServiceParent(parent):
    4545        """Set the parent of the service.
    4646
    4747        @type name: C{IServiceCollection}
     
    5050        by that name.
    5151        """
    5252
    53     def disownServiceParent(self):
     53    def disownServiceParent():
    5454        """Remove the parent of the service.
    5555
    5656        @rtype: C{Deferred}
     
    5959        a value can be returned (usually, None).
    6060        """
    6161
    62     def startService(self):
     62    def startService():
    6363        """Start the service."""
    6464
    65     def stopService(self):
     65    def stopService():
    6666        """Stop the service.
    6767
    6868        @rtype: C{Deferred}
     
    7171        a value can be returned (usually, None).
    7272        """
    7373
    74     def privilegedStartService(self):
     74    def privilegedStartService():
    7575        """Do preparation work for starting the service.
    7676
    7777        Here things which should be done before changing directory,
     
    127127        self.running = 0
    128128
    129129
    130 class IServiceCollection(components.Interface):
     130class IServiceCollection(Interface):
    131131
    132132    """Collection of services.
    133133
     
    136136    is always possible to iterate over them.
    137137    """
    138138
    139     def getServiceNamed(self, name):
     139    def getServiceNamed(name):
    140140        """Get the child service with a given name.
    141141
    142142        @type name: C{str}
     
    145145        given name.
    146146        """
    147147
    148     def __iter__(self):
     148    def __iter__():
    149149        """Get an iterator over all child services"""
    150150
    151     def addService(self, service):
     151    def addService(service):
    152152         """Add a child service.
    153153
    154154        @type service: C{IService}
     
    156156        the given name.
    157157        """
    158158
    159     def removeService(self, service):
     159    def removeService(service):
    160160        """Remove a child service.
    161161
    162162        @type service: C{IService}
     
    234234            return None
    235235
    236236
    237 class IProcess(components.Interface):
     237class IProcess(Interface):
    238238
    239239    """Process running parameters
    240240
  • application/compat.py

     
    1616
    1717import warnings, sys
    1818
    19 from zope.interface import implements
     19from zope.interface import implements, Interface
    2020
    2121from twisted.python import components
    2222from twisted.application import internet, service
    2323
    24 class IOldApplication(components.Interface):
     24class IOldApplication(Interface):
    2525
    2626    """A subset of the interface old Application objects had implicitly
    2727
     
    2929    objects had, so that new objects can support it for compatibility
    3030    with old code
    3131    """
    32     def listenWith(self, portType, *args, **kw):
     32    def listenWith(portType, *args, **kw):
    3333        """Add a service that starts an instance of C{portType} listening.
    3434
    3535        @type portType: type which implements C{IListeningPort}
     
    3737        will be started listening.
    3838        """
    3939
    40     def listenTCP(self, port, factory, backlog=50, interface=''):
     40    def listenTCP(port, factory, backlog=50, interface=''):
    4141        """Add a service that connects a given protocol factory to the port.
    4242
    4343        @param port: a port number on which to listen
     
    4949        @param interface: the hostname to bind to, defaults to '' (all)
    5050        """
    5151
    52     def listenUNIX(self, filename, factory, backlog=50, mode=0666):
     52    def listenUNIX(filename, factory, backlog=50, mode=0666):
    5353        """Add a service that listens on a UNIX socket.
    5454
    5555        @param address: a path to a unix socket on the filesystem.
     
    6161        @param mode: mode to set on the unix socket.
    6262        """
    6363
    64     def listenUDP(self, port, proto, interface='', maxPacketSize=8192):
     64    def listenUDP(port, proto, interface='', maxPacketSize=8192):
    6565        """Add a service that connects a given DatagramProtocol to the port.
    6666        """
    6767
    68     def listenSSL(self, port, factory, ctxFactory, backlog=50, interface=''):
     68    def listenSSL(port, factory, ctxFactory, backlog=50, interface=''):
    6969        """Add a service that connects a given protocol factory to the port.
    7070
    7171        The connection is a SSL one, using contexts created by the context
     
    8282        @param interface: the hostname to bind to, defaults to '' (all)
    8383        """
    8484
    85     def connectWith(self, connectorType, *args, **kw):
     85    def connectWith(connectorType, *args, **kw):
    8686        """Add a service that starts an instance of C{connectorType} connecting.
    8787
    8888        @type connectorType: type which implements C{IConnector}
     
    9090        will be started connecting.
    9191        """
    9292
    93     def connectUDP(self, remotehost, remoteport, protocol, localport=0,
     93    def connectUDP(remotehost, remoteport, protocol, localport=0,
    9494                  interface='', maxPacketSize=8192):
    9595        """Add a service that connects a L{ConnectedDatagramProtocol} to a port.
    9696        """
    9797
    98     def connectTCP(self, host, port, factory, timeout=30, bindAddress=None):
     98    def connectTCP(host, port, factory, timeout=30, bindAddress=None):
    9999        """Add a service that connects a TCP client.
    100100
    101101        @param host: a host name
     
    111111                            to, or None.
    112112        """
    113113
    114     def connectSSL(self, host, port, factory, ctxFactory, timeout=30,
     114    def connectSSL(host, port, factory, ctxFactory, timeout=30,
    115115                   bindAddress=None):
    116116        """Add a service that connects a client Protocol to a remote SSL socket.
    117117
     
    130130            C{None}
    131131        """
    132132
    133     def connectUNIX(self, address, factory, timeout=30):
     133    def connectUNIX(address, factory, timeout=30):
    134134        """Add a service that connects a client protocol to a UNIX socket.
    135135
    136136        @param address: a path to a unix socket on the filesystem.
     
    141141            has failed.
    142142        """
    143143
    144     def addService(self, service):
     144    def addService(service):
    145145        """Add a service to this collection.
    146146        """
    147147
    148     def getServiceNamed(self, name):
     148    def getServiceNamed(name):
    149149        """Retrieve the named service from this application.
    150150
    151151        Raise a KeyError if there is no such service name.
    152152        """
    153153
    154     def removeService(self, service):
     154    def removeService(service):
    155155        """Remove a service from this collection."""
    156156
    157     def unlistenWith(self, portType, *args, **kw):
     157    def unlistenWith(portType, *args, **kw):
    158158        """Maybe remove a listener
    159159
    160160        This function is inherently unreliable, and may or may
    161161        not remove a service.
    162162        """
    163163
    164     def unlistenTCP(self, port, interface=''):
     164    def unlistenTCP(port, interface=''):
    165165        """Maybe remove a listener
    166166
    167167        This function is inherently unreliable, and may or may
    168168        not remove a service.
    169169        """
    170170
    171     def unlistenUNIX(self, filename):
     171    def unlistenUNIX(filename):
    172172        """Maybe remove a listener
    173173
    174174        This function is inherently unreliable, and may or may
    175175        not remove a service.
    176176        """
    177177
    178     def unlistenUDP(self, port, interface=''):
     178    def unlistenUDP(port, interface=''):
    179179        """Maybe remove a listener
    180180
    181181        This function is inherently unreliable, and may or may
    182182        not remove a service.
    183183        """
    184184
    185     def unlistenSSL(self, port, interface=''):
     185    def unlistenSSL(port, interface=''):
    186186        """Maybe remove a listener
    187187
    188188        This function is inherently unreliable, and may or may
  • names/dns.py

     
    5656else:
    5757    def randomSource(r = randpool.RandomPool().get_bytes):
    5858        return struct.unpack('H', r(2))[0]
    59 from zope.interface import implements
     59from zope.interface import implements, Interface
    6060
    6161
    6262# Twisted imports
    6363from twisted.internet import protocol, defer
    6464from twisted.python import log, failure
    6565from twisted.python import util as tputil
    66 from twisted.python import components
    6766
    6867PORT = 53
    6968
     
    113112# Response Codes
    114113OK, EFORMAT, ESERVER, ENAME, ENOTIMP, EREFUSED = range(6)
    115114
    116 class IRecord(components.Interface):
     115class IRecord(Interface):
    117116    """An single entry in a zone of authority.
    118117
    119118    @cvar TYPE: An indicator of what kind of record this is.
     
    154153    return buff
    155154
    156155
    157 class IEncodable(components.Interface):
     156class IEncodable(Interface):
    158157    """
    159158    Interface for something which can be encoded to and decoded
    160159    from a file object.
  • news/database.py

     
    2222from twisted.internet import defer
    2323from twisted.enterprise import adbapi
    2424from twisted.persisted import dirdbm
    25 from twisted.python import components
    2625
    2726import getpass, pickle, time, socket, md5
    2827import os
    2928import StringIO
    30 from zope.interface import implements
     29from zope.interface import implements, Interface
    3130
    3231
    3332ERR_NOGROUP, ERR_NOARTICLE = range(2, 4)  # XXX - put NNTP values here (I guess?)
     
    9897    pass
    9998
    10099   
    101 class INewsStorage(components.Interface):
     100class INewsStorage(Interface):
    102101    """
    103102    An interface for storing and requesting news articles
    104103    """
    105104   
    106     def listRequest(self):
     105    def listRequest():
    107106        """
    108107        Returns a deferred whose callback will be passed a list of 4-tuples
    109108        containing (name, max index, min index, flags) for each news group
    110109        """
    111110
    112111
    113     def subscriptionRequest(self):
     112    def subscriptionRequest():
    114113        """
    115114        Returns a deferred whose callback will be passed the list of
    116115        recommended subscription groups for new server users
    117116        """
    118117   
    119118   
    120     def postRequest(self, message):
     119    def postRequest(message):
    121120        """
    122121        Returns a deferred whose callback will be invoked if 'message'
    123122        is successfully posted to one or more specified groups and
     
    125124        """
    126125   
    127126   
    128     def overviewRequest(self):
     127    def overviewRequest():
    129128        """
    130129        Returns a deferred whose callback will be passed the a list of
    131130        headers describing this server's overview format.
    132131        """
    133132
    134133
    135     def xoverRequest(self, group, low, high):
     134    def xoverRequest(group, low, high):
    136135        """
    137136        Returns a deferred whose callback will be passed a list of xover
    138137        headers for the given group over the given range.  If low is None,
     
    141140        """
    142141
    143142
    144     def xhdrRequest(self, group, low, high, header):
     143    def xhdrRequest(group, low, high, header):
    145144        """
    146145        Returns a deferred whose callback will be passed a list of XHDR data
    147146        for the given group over the given range.  If low is None,
     
    150149        """
    151150
    152151   
    153     def listGroupRequest(self, group):
     152    def listGroupRequest(group):
    154153        """
    155154        Returns a deferred whose callback will be passed a two-tuple of
    156155        (group name, [article indices])
    157156        """
    158157   
    159158   
    160     def groupRequest(self, group):
     159    def groupRequest(group):
    161160        """
    162161        Returns a deferred whose callback will be passed a five-tuple of
    163162        (group name, article count, highest index, lowest index, group flags)
    164163        """
    165164
    166165   
    167     def articleExistsRequest(self, id):
     166    def articleExistsRequest(id):
    168167        """
    169168        Returns a deferred whose callback will be passed with a true value
    170169        if a message with the specified Message-ID exists in the database
     
    172171        """
    173172
    174173
    175     def articleRequest(self, group, index, id = None):
     174    def articleRequest(group, index, id = None):
    176175        """
    177176        Returns a deferred whose callback will be passed a file-like object
    178177        containing the full article text (headers and body) for the article
     
    184183        """
    185184
    186185   
    187     def headRequest(self, group, index):
     186    def headRequest(group, index):
    188187        """
    189188        Returns a deferred whose callback will be passed the header for
    190189        the article of the specified index in the specified group, and
     
    193192        """
    194193
    195194   
    196     def bodyRequest(self, group, index):
     195    def bodyRequest(group, index):
    197196        """
    198197        Returns a deferred whose callback will be passed the body for
    199198        the article of the specified index in the specified group, and
  • web/resource.py

     
    99
    1010# System Imports
    1111from twisted.internet import defer
    12 from twisted.python import roots, components, reflect
    13 from zope.interface import Attribute, implements
     12from twisted.python import roots, reflect
     13from zope.interface import Attribute, implements, Interface
    1414
    15 class IResource(components.Interface):
     15class IResource(Interface):
    1616    """A web resource."""
    1717
    1818    isLeaf = Attribute(\
    1919"""Signal if this IResource implementor is a "leaf node" or not. If True,
    2020getChildWithDefault will not be called on this Resource.""")
    2121
    22     def getChildWithDefault(self, name, request):
     22    def getChildWithDefault(name, request):
    2323        """Return a child with the given name for the given request.
    2424        This is the external interface used by the Resource publishing
    2525        machinery. If implementing IResource without subclassing
     
    2727        getChild overridden instead.
    2828        """
    2929
    30     def putChild(self, path, child):
     30    def putChild(path, child):
    3131        """Put a child IResource implementor at the given path.
    3232        """
    3333
    34     def render(self, request):
     34    def render(request):
    3535        """Render a request. This is called on the leaf resource for
    3636        a request. Render must return either a string, which will
    3737        be sent to the browser as the HTML for the request, or
  • web/woven/template.py

     
    7373from twisted.python import failure
    7474from twisted.internet import reactor, defer
    7575from twisted.python import log
    76 from zope.interface import implements
     76from zope.interface import implements, Interface
    7777
    7878from twisted.web.server import NOT_DONE_YET
    7979STOP_RENDERING = 1
     
    8181
    8282
    8383
    84 class INodeMutator(components.Interface):
     84class INodeMutator(Interface):
    8585    """A component that implements NodeMutator knows how to mutate
    8686    DOM based on the instructions in the object it wraps.
    8787    """
    88     def generate(self, request, node):
     88    def generate(request, node):
    8989        """The generate method should do the work of mutating the DOM
    9090        based on the object this adapter wraps.
    9191        """
  • web/woven/interfaces.py

     
    22
    33__version__ = "$Revision: 1.13 $"[11:-2]
    44
    5 from twisted.python import components
     5from zope.interface import Interface
    66
    7 class IModel(components.Interface):
     7class IModel(Interface):
    88    """A MVC Model."""
    99    def addView(view):
    1010        """Add a view for the model to keep track of.
     
    2323        in.
    2424        """
    2525
    26     def getData(self):
     26    def getData():
    2727        """Return the raw data contained by this Model object, if it is a
    2828        wrapper. If not, return self.
    2929        """
    3030
    31     def setData(self, request, data):
     31    def setData(request, data):
    3232        """Set the raw data referenced by this Model object, if it is a
    3333        wrapper. This is done by telling our Parent model to setSubmodel
    3434        the new data. If this object is not a wrapper, keep the data
    3535        around and return it for subsequent getData calls.
    3636        """
    3737
    38     def lookupSubmodel(self, request, submodelPath):
     38    def lookupSubmodel(request, submodelPath):
    3939        """Return an IModel implementor for the given submodel path
    4040        string. This path may be any number of elements separated
    4141        by /. The default implementation splits on "/" and calls
     
    4343        need to override this behavior.
    4444        """
    4545
    46     def getSubmodel(self, request, submodelName):
     46    def getSubmodel(request, submodelName):
    4747        """Return an IModel implementor for the submodel named
    4848        "submodelName". If this object contains simple data types,
    4949        they can be adapted to IModel using
    5050        model.adaptToIModel(m, parent, name) before returning.
    5151        """
    5252
    53     def setSubmodel(self, request, submodelName, data):
     53    def setSubmodel(request, submodelName, data):
    5454        """Set the given data as a submodel of this model. The data
    5555        need not implement IModel, since getSubmodel should adapt
    5656        the data to IModel before returning it.
    5757        """
    5858
    5959
    60 class IView(components.Interface):
     60class IView(Interface):
    6161    """A MVC View"""
    6262    def __init__(model, controller=None):
    6363        """A view must be told what its model is, and may be told what its
     
    9898        the given name.
    9999        """
    100100
    101     def setSubviewFactory(self, name, factory, setup=None):
     101    def setSubviewFactory(name, factory, setup=None):
    102102        """Set the callable "factory", which takes a model and should
    103103        return a Widget, to be called by the default implementation of
    104104        getSubview when the viewName "name" is present in the template.
     
    132132        return default
    133133
    134134
    135 class IController(components.Interface):
     135class IController(Interface):
    136136    """A MVC Controller"""
    137137    def setView(view):
    138138        """Set the view that this controller is related to.
     
    156156        for the given name.
    157157        """
    158158
    159     def setSubcontrollerFactory(self, name, factory):
     159    def setSubcontrollerFactory(name, factory):
    160160        """Set the callable "factory", which takes a model and should
    161161        return an InputHandler, to be called by the default implementation of
    162162        getSubview when the controllerName "name" is present in the template.
     
    181181        return default
    182182
    183183
    184 class IWovenLivePage(components.Interface):
     184class IWovenLivePage(Interface):
    185185    def getCurrentPage():
    186186        """Return the current page object contained in this session.
    187187        """
  • cred/perspective.py

     
    1212
    1313"""
    1414
    15 from twisted.python import log, reflect, components
     15from twisted.python import log, reflect
    1616from twisted.cred import identity
    17 from zope import interface
     17from zope.interface import implements, Interface
    1818import types
    1919
    20 class IPerspective(components.Interface):
    21     def setIdentityName(self, name):
     20class IPerspective(Interface):
     21    def setIdentityName(name):
    2222        """"""
    2323   
    24     def setIdentity(self, identity):
     24    def setIdentity(identity):
    2525        """"""
    2626   
    27     def makeIdentity(self, password):
     27    def makeIdentity(password):
    2828        """"""
    2929   
    30     def getPerspectiveName(self):
     30    def getPerspectiveName():
    3131        """"""
    3232   
    33     def getService(self):
     33    def getService():
    3434        """"""
    3535   
    36     def setService(self, service):
     36    def setService(service):
    3737        """"""
    3838   
    39     def getIdentityRequest(self):
     39    def getIdentityRequest():
    4040        """"""
    4141   
    42     def attached(self, reference, identity):
     42    def attached(reference, identity):
    4343        """"""
    4444   
    45     def detached(self, reference, identity):
     45    def detached(reference, identity):
    4646        """"""
    4747   
    48     def setCached(self):
     48    def setCached():
    4949        """"""
    5050   
    51     def isCached(self):
     51    def isCached():
    5252        """"""
    5353
    5454class Perspective:
     
    6060    user for that service.
    6161    """
    6262   
    63     interface.implements(IPerspective)
     63    implements(IPerspective)
    6464
    6565    _service_cached = 0 # Has my service cached me from a loaded store, or do I live in memory usually?
    6666
  • cred/credentials.py

     
    44# See LICENSE for details.
    55
    66
    7 from twisted.python import components
    8 from zope import interface
     7from zope.interface import implements, Interface
    98
    109import hmac
    1110import time
    1211import random
    1312
    14 class ICredentials(components.Interface):
     13class ICredentials(Interface):
    1514    """I check credentials.
    1615
    1716    Implementors _must_ specify which sub-interfaces of ICredentials
     
    3231    @ivar username: The username associated with these credentials.
    3332    """
    3433
    35     def checkPassword(self, password):
     34    def checkPassword(password):
    3635        """Validate these credentials against the correct password.
    3736
    3837        @param password: The correct, plaintext password against which to
     
    5958    @ivar password: The password associated with these credentials.
    6059    """
    6160
    62     def checkPassword(self, password):
     61    def checkPassword(password):
    6362        """Validate these credentials against the correct password.
    6463
    6564        @param password: The correct, plaintext password against which to
     
    7675
    7776
    7877class CramMD5Credentials:
    79     interface.implements(IUsernameHashedPassword)
     78    implements(IUsernameHashedPassword)
    8079
    8180    challenge = ''
    8281    response = ''
     
    110109
    111110
    112111class UsernameHashedPassword:
    113     interface.implements(IUsernameHashedPassword)
     112    implements(IUsernameHashedPassword)
    114113
    115114    def __init__(self, username, hashed):
    116115        self.username = username
     
    121120
    122121
    123122class UsernamePassword:
    124     interface.implements(IUsernamePassword)
     123    implements(IUsernamePassword)
    125124
    126125    def __init__(self, username, password):
    127126        self.username = username
     
    132131
    133132
    134133class Anonymous:
    135     interface.implements(IAnonymous)
     134    implements(IAnonymous)
    136135
    137136
    138137class ISSHPrivateKey(ICredentials):
     
    152151
    153152    """
    154153class SSHPrivateKey:
    155     interface.implements(ISSHPrivateKey)
     154    implements(ISSHPrivateKey)
    156155    def __init__(self, username, algName, blob, sigData, signature):
    157156        self.username = username
    158157        self.algName = algName
     
    177176    """
    178177
    179178class PluggableAuthenticationModules:
    180     interface.implements(IPluggableAuthenticationModules)
     179    implements(IPluggableAuthenticationModules)
    181180   
    182181    def __init__(self, username, pamConversion):
    183182        self.username = username
  • cred/service.py

     
    1818"""
    1919
    2020# Twisted Imports
    21 from twisted.python import log, components, reflect
     21from twisted.python import log, reflect
    2222from twisted.internet import defer, app
    2323
    2424# Sibling Imports
    2525from perspective import IPerspective, Perspective
    2626
    2727# Zope interface Imports
    28 from zope import interface
     28from zope.interface import implements, Interface
    2929
    3030# System Imports
    3131import types
    3232import warnings
    3333
    34 class IService(components.Interface):
     34class IService(Interface):
    3535    """An authorized service for internet applications.
    3636    """
    3737
     
    4545    @see: L{twisted.spread.pb.Service}
    4646    """
    4747
    48     interface.implements(IService)
     48    implements(IService)
    4949
    5050    # ugh, load order
    5151    perspectiveClass = Perspective
  • cred/portal.py

     
    1010
    1111from twisted.internet import defer
    1212from twisted.internet.defer import maybeDeferred
    13 from twisted.python import failure, reflect, components
     13from twisted.python import failure, reflect
    1414from twisted.cred import error
    15 from zope import interface
     15from zope.interface import providedBy, Interface
    1616
    1717
    18 class IRealm(components.Interface):
     18class IRealm(Interface):
    1919    """
    2020    The realm connects application-specific objects to the
    2121    authentication system.
    2222    """
    23     def requestAvatar(self, avatarId, mind, *interfaces):
     23    def requestAvatar(avatarId, mind, *interfaces):
    2424        """Return avatar implementing one of the given interfaces.
    2525
    2626        @param avatarId: a string that identifies an avatar, as returned by
     
    102102        this will not be in connectionLost (such as in a web-based session), it
    103103        will always be at the end of a user's interactive session.
    104104        """
    105         ifac = interface.providedBy(credentials)
     105        ifac = providedBy(credentials)
    106106        for i in ifac:
    107107            c = self.checkers.get(i)
    108108            if c is not None:
  • cred/checkers.py

     
    66
    77import os
    88
    9 from zope import interface
     9from zope.interface import implements, Interface
    1010
    1111from twisted.internet import defer
    12 from twisted.python import components, failure, log
     12from twisted.python import failure, log
    1313from twisted.cred import error, credentials
    1414
    1515try:
     
    1717except ImportError: # PyPAM is missing
    1818    pamauth = None
    1919
    20 class ICredentialsChecker(components.Interface):
     20class ICredentialsChecker(Interface):
    2121    """I check sub-interfaces of ICredentials.
    2222
    2323    @cvar credentialInterfaces: A list of sub-interfaces of ICredentials which
    2424    specifies which I may check.
    2525    """
    2626
    27     def requestAvatarId(self, credentials):
     27    def requestAvatarId(credentials):
    2828        """
    2929        @param credentials: something which implements one of the interfaces in
    3030        self.credentialInterfaces.
     
    4949
    5050
    5151class AllowAnonymousAccess:
    52     interface.implements(ICredentialsChecker)
     52    implements(ICredentialsChecker)
    5353    credentialInterfaces = credentials.IAnonymous,
    5454
    5555    def requestAvatarId(self, credentials):
     
    6767    see L{FilePasswordDB}.
    6868    """
    6969
    70     interface.implements(ICredentialsChecker)
     70    implements(ICredentialsChecker)
    7171
    7272    credentialInterfaces = (credentials.IUsernamePassword,
    7373        credentials.IUsernameHashedPassword)
     
    107107    IUsernameHashedPassword credentials will be checkable as well.
    108108    """
    109109
    110     interface.implements(ICredentialsChecker)
     110    implements(ICredentialsChecker)
    111111
    112112    cache = False
    113113    _credCache = None
     
    242242                    ).addCallback(self._cbPasswordMatch, u)
    243243
    244244class PluggableAuthenticationModulesChecker:
    245     interface.implements(ICredentialsChecker)
     245    implements(ICredentialsChecker)
    246246    credentialInterfaces = credentials.IPluggableAuthenticationModules,
    247247    service = 'Twisted'
    248248   
  • test/crash_test_dummy.py

     
    44
    55
    66from twisted.python import components
    7 from zope import interface
     7from zope.interface import implements, Interface
    88
    99def foo():
    1010    return 2
     
    2121class XComponent(components.Componentized):
    2222    pass
    2323
    24 class IX(components.Interface):
     24class IX(Interface):
    2525    pass
    2626
    2727class XA(components.Adapter):
    28     interface.implements(IX)
     28    implements(IX)
    2929
    3030    def method(self):
    3131        # Kick start :(
  • test/test_components.py

     
    281281        o = object()
    282282        a = Adept(o)
    283283        self.assertRaises(components.CannotAdapt, IAdder, a)
    284         self.assertEquals(IAdder(a, default=None), None)
     284        self.assertEquals(IAdder(a, None), None)
    285285
    286286    def testMultipleInterfaceRegistration(self):
    287287        class IMIFoo(components.Interface):
  • test/test_spread.py

     
    77Test cases for twisted.spread package
    88"""
    99
    10 from zope.interface import implements
     10from zope.interface import implements, Interface
    1111from twisted.trial import unittest
    1212
    1313from twisted.spread.util import LocalAsyncForwarder
    1414from twisted.internet import defer
    15 from twisted.python.components import Interface
    1615
    1716class IForwarded(Interface):
    18     def forwardMe(self):
     17    def forwardMe():
    1918        pass
    20     def forwardDeferred(self):
     19    def forwardDeferred():
    2120        pass
    2221
    2322class Forwarded:
     
    4342        assert f.forwarded
    4443        lf.callRemote("dontForwardMe")
    4544        assert not f.unforwarded
    46         rr = lf.callRemote("forwardDeferred")       
     45        rr = lf.callRemote("forwardDeferred")
    4746        l = []
    4847        rr.addCallback(l.append)
    4948        self.assertEqual(l[0], 1)
  • test/test_newcred.py

     
    88from __future__ import generators
    99
    1010import hmac
    11 from zope import interface
     11from zope.interface import implements, Interface
    1212
    1313from twisted.trial import unittest
    1414from twisted.cred import portal, checkers, credentials, error
     
    2929else:
    3030    from twisted.cred import pamauth
    3131
    32 class ITestable(components.Interface):
     32class ITestable(Interface):
    3333    pass
    3434
    3535class TestAvatar:
     
    4646        self.loggedOut = True
    4747
    4848class Testable(components.Adapter):
    49     interface.implements(ITestable)
     49    implements(ITestable)
    5050
    5151# components.Interface(TestAvatar).adaptWith(Testable, ITestable)
    5252
    5353components.registerAdapter(Testable, TestAvatar, ITestable)
    5454
    5555class TestRealm:
    56     interface.implements(portal.IRealm)
     56    implements(portal.IRealm)
    5757    def __init__(self):
    5858        self.avatars = {}
    5959
  • mail/test/test_mail.py

     
    1515from twisted.trial import unittest
    1616import tempfile
    1717
    18 from zope.interface import providedBy
     18from zope.interface import providedBy, Interface
    1919
    2020from twisted.trial import unittest
    2121from twisted.mail import smtp
     
    2828from twisted.internet import interfaces
    2929from twisted.internet.error import DNSLookupError, CannotListenError
    3030from twisted.internet import address
    31 from twisted.python import components
    3231from twisted.python import failure
    3332from twisted.python import util
    3433
     
    380379        self.failUnless(cred.credentials.IUsernamePassword in creds[0].credentialInterfaces)
    381380
    382381    def testRequestAvatar(self):
    383         class ISomething(components.Interface):
     382        class ISomething(Interface):
    384383            pass
    385384
    386385        self.D.addUser('user', 'password')
  • mail/alias.py

     
    2323from twisted.internet import protocol
    2424from twisted.internet import defer
    2525from twisted.internet import error
    26 from twisted.python import components
    2726from twisted.python import failure
    2827from twisted.python import log
    29 from zope.interface import implements
     28from zope.interface import implements, Interface
    3029
    3130
    3231def handle(result, line, filename, lineNo):
     
    9291        result[u] = AliasGroup(a, domains, u)
    9392    return result
    9493
    95 class IAlias(components.Interface):
    96     def createMessageReceiver(self):
     94class IAlias(Interface):
     95    def createMessageReceiver():
    9796        pass
    9897
    9998class AliasBase:
  • mail/imap4.py

     
    2626from twisted.internet import defer
    2727from twisted.internet import error
    2828from twisted.internet.defer import maybeDeferred
    29 from twisted.python import log, components, util, failure, text
     29from twisted.python import log, util, failure, text
    3030from twisted.internet import interfaces
    3131
    3232from twisted import cred
     
    4545import random
    4646import types
    4747import sys
    48 from zope.interface import implements
     48from zope.interface import implements, Interface
    4949
    5050import email.Utils
    5151
     
    421421
    422422class IllegalMailboxEncoding(IMAP4Exception): pass
    423423
    424 class IMailboxListener(components.Interface):
     424class IMailboxListener(Interface):
    425425    """Interface for objects interested in mailbox events"""
    426426
    427     def modeChanged(self, writeable):
     427    def modeChanged(writeable):
    428428        """Indicates that the write status of a mailbox has changed.
    429429
    430430        @type writeable: C{bool}
     
    432432        otherwise.
    433433        """
    434434
    435     def flagsChanged(self, newFlags):
     435    def flagsChanged(newFlags):
    436436        """Indicates that the flags of one or more messages have changed.
    437437
    438438        @type newFlags: C{dict}
     
    440440        now set on that message.
    441441        """
    442442
    443     def newMessages(self, exists, recent):
     443    def newMessages(exists, recent):
    444444        """Indicates that the number of messages in a mailbox has changed.
    445445
    446446        @type exists: C{int} or C{None}
     
    39843984    return ''.join(pieces[1:])
    39853985
    39863986
    3987 class IClientAuthentication(components.Interface):
    3988     def getName(self):
     3987class IClientAuthentication(Interface):
     3988    def getName():
    39893989        """Return an identifier associated with this authentication scheme.
    39903990
    39913991        @rtype: C{str}
    39923992        """
    39933993
    3994     def challengeResponse(self, secret, challenge):
     3994    def challengeResponse(secret, challenge):
    39953995        """Generate a challenge response string"""
    39963996
    39973997class CramMD5ClientAuthenticator:
     
    40544054        return 'Mailbox open in read-only state'
    40554055
    40564056
    4057 class IAccount(components.Interface):
     4057class IAccount(Interface):
    40584058    """Interface for Account classes
    40594059
    40604060    Implementors of this interface should consider implementing
    40614061    C{INamespacePresenter}.
    40624062    """
    40634063
    4064     def addMailbox(self, name, mbox = None):
     4064    def addMailbox(name, mbox = None):
    40654065        """Add a new mailbox to this account
    40664066
    40674067        @type name: C{str}
     
    40814081        is returned.
    40824082        """
    40834083
    4084     def create(self, pathspec):
     4084    def create(pathspec):
    40854085        """Create a new mailbox from the given hierarchical name.
    40864086
    40874087        @type pathspec: C{str}
     
    40984098        returned.
    40994099        """
    41004100
    4101     def select(self, name, rw=True):
     4101    def select(name, rw=True):
    41024102        """Acquire a mailbox, given its name.
    41034103
    41044104        @type name: C{str}
     
    41144114        specified mailbox may not be selected for any reason.
    41154115        """
    41164116
    4117     def delete(self, name):
     4117    def delete(name):
    41184118        """Delete the mailbox with the specified name.
    41194119
    41204120        @type name: C{str}
     
    41294129        This may also be raised asynchronously, if a C{Deferred} is returned.
    41304130        """
    41314131
    4132     def rename(self, oldname, newname):
     4132    def rename(oldname, newname):
    41334133        """Rename a mailbox
    41344134
    41354135        @type oldname: C{str}
     
    41484148        is returned.
    41494149        """
    41504150
    4151     def isSubscribed(self, name):
     4151    def isSubscribed(name):
    41524152        """Check the subscription status of a mailbox
    41534153
    41544154        @type name: C{str}
     
    41604160        whose callback will be invoked with one of these values.
    41614161        """
    41624162
    4163     def subscribe(self, name):
     4163    def subscribe(name):
    41644164        """Subscribe to a mailbox
    41654165
    41664166        @type name: C{str}
     
    41764176        C{Deferred} is returned.
    41774177        """
    41784178
    4179     def unsubscribe(self, name):
     4179    def unsubscribe(name):
    41804180        """Unsubscribe from a mailbox
    41814181
    41824182        @type name: C{str}
     
    41924192        C{Deferred} is returned.
    41934193        """
    41944194
    4195     def listMailboxes(self, ref, wildcard):
     4195    def listMailboxes(ref, wildcard):
    41964196        """List all the mailboxes that meet a certain criteria
    41974197
    41984198        @type ref: C{str}
     
    42094209        C{IMailboxInfo} or C{IMailbox}.  A Deferred may also be returned.
    42104210        """
    42114211
    4212 class INamespacePresenter(components.Interface):
    4213     def getPersonalNamespaces(self):
     4212class INamespacePresenter(Interface):
     4213    def getPersonalNamespaces():
    42144214        """Report the available personal namespaces.
    42154215
    42164216        Typically there should be only one personal namespace.  A common
     
    42224222        If no namespaces of this type exist, None should be returned.
    42234223        """
    42244224
    4225     def getSharedNamespaces(self):
     4225    def getSharedNamespaces():
    42264226        """Report the available shared namespaces.
    42274227
    42284228        Shared namespaces do not belong to any individual user but are
     
    42344234        If no namespaces of this type exist, None should be returned.
    42354235        """
    42364236
    4237     def getUserNamespaces(self):
     4237    def getUserNamespaces():
    42384238        """Report the available user namespaces.
    42394239
    42404240        These are namespaces that contain folders belonging to other users
     
    45134513
    45144514    return result
    45154515
    4516 class IMessagePart(components.Interface):
    4517     def getHeaders(self, negate, *names):
     4516class IMessagePart(Interface):
     4517    def getHeaders(negate, *names):
    45184518        """Retrieve a group of message headers.
    45194519
    45204520        @type names: C{tuple} of C{str}
     
    45284528        @return: A mapping of header field names to header field values
    45294529        """
    45304530
    4531     def getBodyFile(self):
     4531    def getBodyFile():
    45324532        """Retrieve a file object containing only the body of this message.
    45334533        """
    45344534
    4535     def getSize(self):
     4535    def getSize():
    45364536        """Retrieve the total size, in octets, of this message.
    45374537
    45384538        @rtype: C{int}
    45394539        """
    45404540
    4541     def isMultipart(self):
     4541    def isMultipart():
    45424542        """Indicate whether this message has subparts.
    45434543
    45444544        @rtype: C{bool}
    45454545        """
    45464546
    4547     def getSubPart(self, part):
     4547    def getSubPart(part):
    45484548        """Retrieve a MIME sub-message
    45494549
    45504550        @type part: C{int}
     
    45584558        """
    45594559
    45604560class IMessage(IMessagePart):
    4561     def getUID(self):
     4561    def getUID():
    45624562        """Retrieve the unique identifier associated with this message.
    45634563        """
    45644564
    4565     def getFlags(self):
     4565    def getFlags():
    45664566        """Retrieve the flags associated with this message.
    45674567
    45684568        @rtype: C{iterable}
    45694569        @return: The flags, represented as strings.
    45704570        """
    45714571
    4572     def getInternalDate(self):
     4572    def getInternalDate():
    45734573        """Retrieve the date internally associated with this message.
    45744574
    45754575        @rtype: C{str}
    45764576        @return: An RFC822-formatted date string.
    45774577        """
    45784578
    4579 class IMessageFile(components.Interface):
     4579class IMessageFile(Interface):
    45804580    """Optional message interface for representing messages as files.
    45814581   
    45824582    If provided by message objects, this interface will be used instead
    45834583    the more complex MIME-based interface.
    45844584    """
    4585     def open(self):
     4585    def open():
    45864586        """Return an file-like object opened for reading.
    45874587
    45884588        Reading from the returned file will return all the bytes
    45894589        of which this message consists.
    45904590        """
    45914591
    4592 class ISearchableMailbox(components.Interface):
    4593     def search(self, query, uid):
     4592class ISearchableMailbox(Interface):
     4593    def search(query, uid):
    45944594        """Search for messages that meet the given query criteria.
    45954595
    45964596        If this interface is not implemented by the mailbox, L{IMailbox.fetch}
     
    46124612        invoked with such a list.
    46134613        """
    46144614
    4615 class IMessageCopier(components.Interface):
    4616     def copy(self, messageObject):
     4615class IMessageCopier(Interface):
     4616    def copy(messageObject):
    46174617        """Copy the given message object into this mailbox.
    46184618
    46194619        The message object will be one which was previously returned by
     
    46304630        with the UID when the copy finishes.
    46314631        """
    46324632
    4633 class IMailboxInfo(components.Interface):
     4633class IMailboxInfo(Interface):
    46344634    """Interface specifying only the methods required for C{listMailboxes}.
    46354635
    46364636    Implementations can return objects implementing only these methods for
     
    46384638    efficiently.
    46394639    """
    46404640
    4641     def getFlags(self):
     4641    def getFlags():
    46424642        """Return the flags defined in this mailbox
    46434643
    46444644        Flags with the \\ prefix are reserved for use as system flags.
     
    46474647        @return: A list of the flags that can be set on messages in this mailbox.
    46484648        """
    46494649
    4650     def getHierarchicalDelimiter(self):
     4650    def getHierarchicalDelimiter():
    46514651        """Get the character which delimits namespaces for in this mailbox.
    46524652
    46534653        @rtype: C{str}
    46544654        """
    46554655
    46564656class IMailbox(IMailboxInfo):
    4657     def getUIDValidity(self):
     4657    def getUIDValidity():
    46584658        """Return the unique validity identifier for this mailbox.
    46594659
    46604660        @rtype: C{int}
    46614661        """
    46624662
    4663     def getUIDNext(self):
     4663    def getUIDNext():
    46644664        """Return the likely UID for the next message added to this mailbox.
    46654665
    46664666        @rtype: C{int}
    46674667        """
    46684668
    4669     def getUID(self, message):
     4669    def getUID(message):
    46704670        """Return the UID of a message in the mailbox
    46714671
    46724672        @type message: C{int}
     
    46764676        @return: The UID of the message.
    46774677        """
    46784678
    4679     def getMessageCount(self):
     4679    def getMessageCount():
    46804680        """Return the number of messages in this mailbox.
    46814681
    46824682        @rtype: C{int}
    46834683        """
    46844684
    4685     def getRecentCount(self):
     4685    def getRecentCount():
    46864686        """Return the number of messages with the 'Recent' flag.
    46874687
    46884688        @rtype: C{int}
    46894689        """
    46904690
    4691     def getUnseenCount(self):
     4691    def getUnseenCount():
    46924692        """Return the number of messages with the 'Unseen' flag.
    46934693
    46944694        @rtype: C{int}
    46954695        """
    46964696
    4697     def isWriteable(self):
     4697    def isWriteable():
    46984698        """Get the read/write status of the mailbox.
    46994699
    47004700        @rtype: C{int}
    47014701        @return: A true value if write permission is allowed, a false value otherwise.
    47024702        """
    47034703
    4704     def destroy(self):
     4704    def destroy():
    47054705        """Called before this mailbox is deleted, permanently.
    47064706
    47074707        If necessary, all resources held by this mailbox should be cleaned
     
    47094709        mailbox.
    47104710        """
    47114711
    4712     def requestStatus(self, names):
     4712    def requestStatus(names):
    47134713        """Return status information about this mailbox.
    47144714
    47154715        Mailboxes which do not intend to do any special processing to
     
    47294729        eventually be passed this dictionary is returned instead.
    47304730        """
    47314731
    4732     def addListener(self, listener):
     4732    def addListener(listener):
    47334733        """Add a mailbox change listener
    47344734
    47354735        @type listener: Any object which implements C{IMailboxListener}
     
    47374737        be notified when the contents of this mailbox change.
    47384738        """
    47394739
    4740     def removeListener(self, listener):
     4740    def removeListener(listener):
    47414741        """Remove a mailbox change listener
    47424742
    47434743        @type listener: Any object previously added to and not removed from
     
    47484748        this mailbox.
    47494749        """
    47504750
    4751     def addMessage(self, message, flags = (), date = None):
     4751    def addMessage(message, flags = (), date = None):
    47524752        """Add the given message to this mailbox.
    47534753
    47544754        @type message: A file-like object
     
    47704770        read-write.
    47714771        """
    47724772
    4773     def expunge(self):
     4773    def expunge():
    47744774        """Remove all messages flagged \\Deleted.
    47754775
    47764776        @rtype: C{list} or C{Deferred}
     
    47814781        read-write.
    47824782        """
    47834783
    4784     def fetch(self, messages, uid):
     4784    def fetch(messages, uid):
    47854785        """Retrieve one or more messages.
    47864786
    47874787        @type messages: C{MessageSet}
     
    47964796        implementors of C{IMessage}.
    47974797        """
    47984798
    4799     def store(self, messages, flags, mode, uid):
     4799    def store(messages, flags, mode, uid):
    48004800        """Set the flags of one or more messages.
    48014801
    48024802        @type messages: A MessageSet object with the list of messages requested
     
    48254825        read-write.
    48264826        """
    48274827
    4828 class ICloseableMailbox(components.Interface):
     4828class ICloseableMailbox(Interface):
    48294829    """A supplementary interface for mailboxes which require cleanup on close.
    48304830
    48314831    Implementing this interface is optional.  If it is implemented, the protocol
    48324832    code will call the close method defined whenever a mailbox is closed.
    48334833    """
    4834     def close(self):
     4834    def close():
    48354835        """Close this mailbox.
    48364836
    48374837        @return: A C{Deferred} which fires when this mailbox
  • mail/pop3.py

     
    1818import md5
    1919import warnings
    2020
    21 from zope.interface import implements
     21from zope.interface import implements, Interface
    2222
    2323from twisted.mail import smtp
    2424from twisted.protocols import basic
     
    2626from twisted.internet import task
    2727from twisted.internet import defer
    2828from twisted.internet import interfaces
    29 from twisted.python import components
    3029from twisted.python import log
    3130
    3231from twisted import cred
     
    831830        raise cred.error.UnauthorizedLogin()
    832831
    833832
    834 class IServerFactory(components.Interface):
     833class IServerFactory(Interface):
    835834    """Interface for querying additional parameters of this POP3 server.
    836835
    837836    Any cap_* method may raise NotImplementedError if the particular
     
    844843    implementing C{IUsernameHashedPassword}.
    845844    """
    846845
    847     def cap_IMPLEMENTATION(self):
     846    def cap_IMPLEMENTATION():
    848847        """Return a string describing this POP3 server implementation."""
    849848
    850     def cap_EXPIRE(self):
     849    def cap_EXPIRE():
    851850        """Return the minimum number of days messages are retained."""
    852851
    853     def perUserExpiration(self):
     852    def perUserExpiration():
    854853        """Indicate whether message expiration is per-user.
    855854
    856855        @return: True if it is, false otherwise.
    857856        """
    858857
    859     def cap_LOGIN_DELAY(self):
     858    def cap_LOGIN_DELAY():
    860859        """Return the minimum number of seconds between client logins."""
    861860
    862     def perUserLoginDelay(self):
     861    def perUserLoginDelay():
    863862        """Indicate whether the login delay period is per-user.
    864863
    865864        @return: True if it is, false otherwise.
    866865        """
    867866
    868 class IMailbox(components.Interface):
     867class IMailbox(Interface):
    869868    """
    870869    @type loginDelay: C{int}
    871870    @ivar loginDelay: The number of seconds between allowed logins for the
     
    876875    remain on the server before being deleted.
    877876    """
    878877
    879     def listMessages(self, index=None):
     878    def listMessages(index=None):
    880879        """Retrieve the size of one or more messages.
    881880
    882881        @type index: C{int} or C{None}
     
    895894        in the mailbox.
    896895        """
    897896
    898     def getMessage(self, index):
     897    def getMessage(index):
    899898        """Retrieve a file-like object for a particular message.
    900899
    901900        @type index: C{int}
     
    904903        @rtype: A file-like object
    905904        """
    906905
    907     def getUidl(self, index):
     906    def getUidl(index):
    908907        """Get a unique identifier for a particular message.
    909908
    910909        @type index: C{int}
     
    918917        in the mailbox.
    919918        """
    920919
    921     def deleteMessage(self, index):
     920    def deleteMessage(index):
    922921        """Delete a particular message.
    923922
    924923        This must not change the number of messages in this mailbox.  Further
     
    929928        @param index: The number of the message to delete.
    930929        """
    931930
    932     def undeleteMessages(self):
     931    def undeleteMessages():
    933932        """Undelete any messages possible.
    934933
    935934        If a message can be deleted it, it should return it its original
    936935        position in the message sequence and retain the same UIDL.
    937936        """
    938937
    939     def sync(self):
     938    def sync():
    940939        """Perform checkpointing.
    941940
    942941        This method will be called to indicate the mailbox should attempt to
  • mail/mail.py

     
    2121
    2222# System imports
    2323import os
    24 from zope.interface import implements
     24from zope.interface import implements, Interface
    2525
    2626
    2727class DomainWithDefaultDict:
     
    104104    def setdefault(self, key, default):
    105105        return self.domains.setdefault(key, default)
    106106
    107 class IDomain(components.Interface):
     107class IDomain(Interface):
    108108    """An email domain."""
    109109
    110     def exists(self, user):
     110    def exists(user):
    111111        """
    112112        Check whether or not the specified user exists in this domain.
    113113       
     
    124124        user does not exist in this domain.
    125125        """
    126126
    127     def addUser(self, user, password):
     127    def addUser(user, password):
    128128        """Add a username/password to this domain."""
    129129   
    130     def startMessage(self, user):
     130    def startMessage(user):
    131131        """Create and return a new message to be delivered to the given user.
    132132       
    133133        DEPRECATED.  Implement validateTo() correctly instead.
    134134        """
    135135
    136     def getCredentialsCheckers(self):
     136    def getCredentialsCheckers():
    137137        """Return a list of ICredentialsChecker implementors for this domain.
    138138        """
    139139
    140140class IAliasableDomain(IDomain):
    141     def setAliasGroup(self, aliases):
     141    def setAliasGroup(aliases):
    142142        """Set the group of defined aliases for this domain
    143143       
    144144        @type aliases: C{dict}
     
    146146        C{IAlias}
    147147        """
    148148   
    149     def exists(self, user, memo=None):
     149    def exists(user, memo=None):
    150150        """
    151151        Check whether or not the specified user exists in this domain.
    152152       
  • mail/smtp.py

     
    1919from twisted.internet import reactor
    2020from twisted.internet.interfaces import ITLSTransport
    2121from twisted.python import log
    22 from twisted.python import components
    2322from twisted.python import util
    2423from twisted.python import reflect
    2524from twisted.python import failure
     
    3534import warnings
    3635import binascii
    3736import sys
    38 from zope.interface import implements
     37from zope.interface import implements, Interface
    3938
    4039try:
    4140    from email.base64MIME import encode as encode_base64
     
    5958# Used for fast success code lookup
    6059SUCCESS = dict(map(None, range(200, 300), []))
    6160
    62 class IMessageDelivery(components.Interface):
    63     def receivedHeader(self, helo, origin, recipients):
     61class IMessageDelivery(Interface):
     62    def receivedHeader(helo, origin, recipients):
    6463        """
    6564        Generate the Received header for a message
    6665
     
    7978        @return: The full \"Received\" header string.
    8079        """
    8180
    82     def validateTo(self, user):
     81    def validateTo(user):
    8382        """
    8483        Validate the address for which the message is destined.
    8584
     
    9695        not to be accepted.
    9796        """
    9897
    99     def validateFrom(self, helo, origin):
     98    def validateFrom(helo, origin):
    10099        """
    101100        Validate the address from which the message originates.
    102101
     
    115114        not to be accepted.
    116115        """
    117116
    118 class IMessageDeliveryFactory(components.Interface):
     117class IMessageDeliveryFactory(Interface):
    119118    """An alternate interface to implement for handling message delivery.
    120119
    121120    It is useful to implement this interface instead of L{IMessageDelivery}
     
    125124    something which cannot be done by L{IMessageDelivery} implementors
    126125    due to their lack of information.
    127126    """
    128     def getMessageDelivery(self):
     127    def getMessageDelivery():
    129128        """Return an L{IMessageDelivery} object.
    130129
    131130        This will be called once per message.
     
    487486    def __str__(self):
    488487        return str(self.dest)
    489488
    490 class IMessage(components.Interface):
     489class IMessage(Interface):
    491490    """Interface definition for messages that can be sent via SMTP."""
    492491
    493     def lineReceived(self, line):
     492    def lineReceived(line):
    494493        """handle another line"""
    495494
    496     def eomReceived(self):
     495    def eomReceived():
    497496        """handle end of message
    498497
    499498        return a deferred. The deferred should be called with either:
    500499        callback(string) or errback(error)
    501500        """
    502501
    503     def connectionLost(self):
     502    def connectionLost():
    504503        """handle message truncated
    505504
    506505        semantics should be to discard the message
     
    16191618        return p
    16201619
    16211620
    1622 class IClientAuthentication(components.Interface):
    1623     def getName(self):
     1621class IClientAuthentication(Interface):
     1622    def getName():
    16241623        """Return an identifier associated with this authentication scheme.
    16251624
    16261625        @rtype: C{str}
    16271626        """
    16281627
    1629     def challengeResponse(self, secret, challenge):
     1628    def challengeResponse(secret, challenge):
    16301629        """Generate a challenge response string"""
    16311630
    16321631
  • internet/interfaces.py

     
    1010Maintainer: U{Itamar Shtull-Trauring<mailto:twisted@itamarst.org>}
    1111"""
    1212
    13 from twisted.python.components import Interface
     13from zope.interface import Interface
    1414
    1515
    1616class IAddress(Interface):
     
    2828    Each IConnector manages one connection.
    2929    """
    3030
    31     def stopConnecting(self):
     31    def stopConnecting():
    3232        """Stop attempting to connect."""
    3333
    34     def disconnect(self):
     34    def disconnect():
    3535        """Disconnect regardless of the connection state.
    3636
    3737        If we are connected, disconnect, if we are trying to connect,
    3838        stop trying.
    3939        """
    4040
    41     def connect(self):
     41    def connect():
    4242        """Try to connect to remote address."""
    4343
    44     def getDestination(self):
     44    def getDestination():
    4545        """Return destination this will try to connect to.
    4646
    4747        This will be an IAddress implementing object.
     
    4949
    5050
    5151class IResolverSimple(Interface):
    52     def getHostByName(self, name, timeout = (1, 3, 11, 45)):
     52    def getHostByName(name, timeout = (1, 3, 11, 45)):
    5353        """Resolve the domain name C{name} into an IP address.
    5454
    5555        @type name: C{str}
     
    6868        """
    6969
    7070class IResolver(IResolverSimple):
    71     def lookupRecord(self, name, cls, type, timeout = 10):
     71    def lookupRecord(name, cls, type, timeout = 10):
    7272        """Lookup the records associated with the given name
    7373           that are of the given type and in the given class.
    7474        """
    7575
    76     def query(self, query, timeout = 10):
     76    def query(query, timeout = 10):
    7777        """Interpret and dispatch a query object to the appropriate
    7878        lookup* method.
    7979        """
    8080
    81     def lookupAddress(self, name, timeout = 10):
     81    def lookupAddress(name, timeout = 10):
    8282        """Lookup the A records associated with C{name}."""
    8383
    84     def lookupAddress6(self, name, timeout = 10):
     84    def lookupAddress6(name, timeout = 10):
    8585        """Lookup all the A6 records associated with C{name}."""
    8686
    87     def lookupIPV6Address(self, name, timeout = 10):
     87    def lookupIPV6Address(name, timeout = 10):
    8888        """Lookup all the AAAA records associated with C{name}."""
    8989
    90     def lookupMailExchange(self, name, timeout = 10):
     90    def lookupMailExchange(name, timeout = 10):
    9191        """Lookup the MX records associated with C{name}."""
    9292
    93     def lookupNameservers(self, name, timeout = 10):
     93    def lookupNameservers(name, timeout = 10):
    9494        """Lookup the the NS records associated with C{name}."""
    9595
    96     def lookupCanonicalName(self, name, timeout = 10):
     96    def lookupCanonicalName(name, timeout = 10):
    9797        """Lookup the CNAME records associated with C{name}."""
    9898
    99     def lookupMailBox(self, name, timeout = 10):
     99    def lookupMailBox(name, timeout = 10):
    100100        """Lookup the MB records associated with C{name}."""
    101101
    102     def lookupMailGroup(self, name, timeout = 10):
     102    def lookupMailGroup(name, timeout = 10):
    103103        """Lookup the MG records associated with C{name}."""
    104104
    105     def lookupMailRename(self, name, timeout = 10):
     105    def lookupMailRename(name, timeout = 10):
    106106        """Lookup the MR records associated with C{name}."""
    107107
    108     def lookupPointer(self, name, timeout = 10):
     108    def lookupPointer(name, timeout = 10):
    109109        """Lookup the PTR records associated with C{name}."""
    110110
    111     def lookupAuthority(self, name, timeout = 10):
     111    def lookupAuthority(name, timeout = 10):
    112112        """Lookup the SOA records associated with C{name}."""
    113113
    114     def lookupNull(self, name, timeout = 10):
     114    def lookupNull(name, timeout = 10):
    115115        """Lookup the NULL records associated with C{name}."""
    116116
    117     def lookupWellKnownServices(self, name, timeout = 10):
     117    def lookupWellKnownServices(name, timeout = 10):
    118118        """Lookup the WKS records associated with C{name}."""
    119119
    120     def lookupHostInfo(self, name, timeout = 10):
     120    def lookupHostInfo(name, timeout = 10):
    121121        """Lookup the HINFO records associated with C{name}."""
    122122
    123     def lookupMailboxInfo(self, name, timeout = 10):
     123    def lookupMailboxInfo(name, timeout = 10):
    124124        """Lookup the MINFO records associated with C{name}."""
    125125
    126     def lookupText(self, name, timeout = 10):
     126    def lookupText(name, timeout = 10):
    127127        """Lookup the TXT records associated with C{name}."""
    128128
    129     def lookupResponsibility(self, name, timeout = 10):
     129    def lookupResponsibility(name, timeout = 10):
    130130        """Lookup the RP records associated with C{name}."""
    131131
    132     def lookupAFSDatabase(self, name, timeout = 10):
     132    def lookupAFSDatabase(name, timeout = 10):
    133133        """Lookup the AFSDB records associated with C{name}."""
    134134
    135     def lookupService(self, name, timeout = 10):
     135    def lookupService(name, timeout = 10):
    136136        """Lookup the SRV records associated with C{name}."""
    137137
    138     def lookupAllRecords(self, name, timeout = 10):
     138    def lookupAllRecords(name, timeout = 10):
    139139        """Lookup all records associated with C{name}."""
    140140
    141     def lookupZone(self, name, timeout = 10):
     141    def lookupZone(name, timeout = 10):
    142142        """Perform a zone transfer for the given C{name}."""
    143143
    144144
    145145class IReactorArbitrary(Interface):
    146     def listenWith(self, portType, *args, **kw):
     146    def listenWith(portType, *args, **kw):
    147147        """Start an instance of the given C{portType} listening.
    148148
    149149        @type portType: type which implements L{IListeningPort}
     
    151151        will be started listening.
    152152        """
    153153
    154     def connectWith(self, connectorType, *args, **kw):
     154    def connectWith(connectorType, *args, **kw):
    155155        """
    156156        Start an instance of the given C{connectorType} connecting.
    157157
     
    162162
    163163class IReactorTCP(Interface):
    164164
    165     def listenTCP(self, port, factory, backlog=50, interface=''):
     165    def listenTCP(port, factory, backlog=50, interface=''):
    166166        """Connects a given protocol factory to the given numeric TCP/IP port.
    167167
    168168        @param port: a port number on which to listen
     
    180180           number)
    181181        """
    182182
    183     def connectTCP(self, host, port, factory, timeout=30, bindAddress=None):
     183    def connectTCP(host, port, factory, timeout=30, bindAddress=None):
    184184        """Connect a TCP client.
    185185
    186186        @param host: a host name
     
    202202
    203203class IReactorSSL(Interface):
    204204
    205     def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None):
     205    def connectSSL(host, port, factory, contextFactory, timeout=30, bindAddress=None):
    206206        """Connect a client Protocol to a remote SSL socket.
    207207
    208208        @param host: a host name
     
    222222        @returns: an L{IConnector}.
    223223        """
    224224
    225     def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''):
     225    def listenSSL(port, factory, contextFactory, backlog=50, interface=''):
    226226        """
    227227        Connects a given protocol factory to the given numeric TCP/IP port.
    228228        The connection is a SSL one, using contexts created by the context
     
    244244class IReactorUNIX(Interface):
    245245    """UNIX socket methods."""
    246246
    247     def connectUNIX(self, address, factory, timeout=30, checkPID=0):
     247    def connectUNIX(address, factory, timeout=30, checkPID=0):
    248248        """Connect a client protocol to a UNIX socket.
    249249
    250250        @param address: a path to a unix socket on the filesystem.
     
    260260        @returns: an L{IConnector}.
    261261        """
    262262
    263     def listenUNIX(self, address, factory, backlog=50, mode=0666, wantPID=0):
     263    def listenUNIX(address, factory, backlog=50, mode=0666, wantPID=0):
    264264        """Listen on a UNIX socket.
    265265
    266266        @param address: a path to a unix socket on the filesystem.
     
    278278class IReactorUNIXDatagram(Interface):
    279279    """datagram UNIX socket methods."""
    280280
    281     def connectUNIXDatagram(self, address, protocol, maxPacketSize=8192, mode=0666, bindAddress=None):
     281    def connectUNIXDatagram(address, protocol, maxPacketSize=8192, mode=0666, bindAddress=None):
    282282        """Connect a client protocol to a datagram UNIX socket.
    283283
    284284        @param address: a path to a unix socket on the filesystem.
     
    292292        @param bindAddress: address to bind to
    293293        """
    294294
    295     def listenUNIXDatagram(self, address, protocol, maxPacketSize=8192, mode=0666):
     295    def listenUNIXDatagram(address, protocol, maxPacketSize=8192, mode=0666):
    296296        """Listen on a datagram UNIX socket.
    297297
    298298        @param address: a path to a unix socket on the filesystem.
     
    314314    without backwards compatability. Suggestions are welcome.
    315315    """
    316316
    317     def listenUDP(self, port, protocol, interface='', maxPacketSize=8192):
     317    def listenUDP(port, protocol, interface='', maxPacketSize=8192):
    318318        """Connects a given DatagramProtocol to the given numeric UDP port.
    319319
    320320        @returns: object conforming to L{IListeningPort}.
    321321        """
    322322
    323     def connectUDP(self, remotehost, remoteport, protocol, localport=0,
     323    def connectUDP(remotehost, remoteport, protocol, localport=0,
    324324                  interface='', maxPacketSize=8192):
    325325        """DEPRECATED.
    326326
     
    335335    without backwards compatability. Suggestions are welcome.
    336336    """
    337337
    338     def listenMulticast(self, port, protocol, interface='', maxPacketSize=8192, listenMultiple=False):
     338    def listenMulticast(port, protocol, interface='', maxPacketSize=8192, listenMultiple=False):
    339339        """Connects a given L{DatagramProtocol<twisted.internet.protocol.DatagramProtocol>} to the given numeric UDP port.
    340340
    341341        @param listenMultiple: boolean indicating whether multiple sockets can bind to same UDP port.
     
    345345
    346346class IReactorProcess(Interface):
    347347
    348     def spawnProcess(self, processProtocol, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0):
     348    def spawnProcess(processProtocol, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0):
    349349        """Spawn a process, with a process protocol.
    350350
    351351        @param processProtocol: a L{twisted.internet.protocol.ProcessProtocol} instance
     
    386386    """Time methods that a Reactor should implement.
    387387    """
    388388
    389     def callLater(self, delay, callable, *args, **kw):
     389    def callLater(delay, callable, *args, **kw):
    390390        """Call a function later.
    391391
    392392        @type delay:  C{float}
     
    404404                  or C{reset()} methods.
    405405        """
    406406
    407     def cancelCallLater(self, callID):
     407    def cancelCallLater(callID):
    408408        """This method is deprecated.
    409409
    410410        Cancel a call that would happen later.
     
    415415            @raise ValueError: if the callID is not recognized.
    416416        """
    417417
    418     def getDelayedCalls(self):
     418    def getDelayedCalls():
    419419        """Retrieve a list of all delayed calls.
    420420
    421421        @returns: A tuple of all L{IDelayedCall} objects that are currently
     
    431431    suggestions are welcome.
    432432    """
    433433
    434     def getTime(self):
     434    def getTime():
    435435        """Get time when delayed call will happen.
    436436
    437437        @returns: time in seconds since epoch (a float).
    438438        """
    439439
    440     def cancel(self):
     440    def cancel():
    441441        """Cancel the scheduled call.
    442442
    443443        @raises twisted.internet.error.AlreadyCalled: if the call has already
     
    446446            been cancelled.
    447447        """
    448448
    449     def delay(self, secondsLater):
     449    def delay(secondsLater):
    450450        """Delay the scheduled call.
    451451        @param secondsLater: how many seconds from its current firing time to delay
    452452
     
    456456            been cancelled.
    457457        """
    458458
    459     def reset(self, secondsFromNow):
     459    def reset(secondsFromNow):
    460460        """Reset the scheduled call's timer.
    461461        @param secondsFromNow: how many seconds from now it should fire,
    462             equivalent to C{self.cancel()} and then doing another
     462            equivalent to C{.cancel()} and then doing another
    463463            C{reactor.callLater(secondsLater, ...)}
    464464
    465465        @raises twisted.internet.error.AlreadyCalled: if the call has already
     
    468468            been cancelled.
    469469        """
    470470
    471     def active(self):
     471    def active():
    472472        """
    473473        @returns: True if this call is still active, False if it has been
    474474            called or cancelled.
     
    480480    Internally, this should use a thread pool and dispatch methods to them.
    481481    """
    482482
    483     def callInThread(self, callable, *args, **kwargs):
     483    def callInThread(callable, *args, **kwargs):
    484484        """Run the callable object in a separate thread.
    485485        """
    486486
    487     def callFromThread(self, callable, *args, **kw):
     487    def callFromThread(callable, *args, **kw):
    488488        """Call a function from within another (i.e. non-reactor) thread.
    489489
    490490        Use this method when you want to run a function in the reactor's thread
     
    497497        use callLater with a delay of 0.)
    498498        """
    499499
    500     def suggestThreadPoolSize(self, size):
     500    def suggestThreadPoolSize(size):
    501501        """Suggest the size of the thread pool.
    502502        """
    503503
     
    506506    """Core methods that a Reactor must implement.
    507507    """
    508508
    509     def resolve(self, name, timeout=10):
     509    def resolve(name, timeout=10):
    510510        """Return a L{twisted.internet.defer.Deferred} that will resolve a hostname.
    511511        """
    512512
    513513
    514     def run(self):
     514    def run():
    515515        """Fire 'startup' System Events, move the reactor to the 'running'
    516516        state, then run the main loop until it is stopped with stop() or
    517517        crash().
    518518        """
    519519
    520     def stop(self):
     520    def stop():
    521521        """Fire 'shutdown' System Events, which will move the reactor to the
    522522        'stopped' state and cause reactor.run() to exit. """
    523523
    524     def crash(self):
     524    def crash():
    525525        """Stop the main loop *immediately*, without firing any system events.
    526526
    527527        This is named as it is because this is an extremely "rude" thing to do;
     
    530530        can become wedged in a pre-shutdown call.
    531531        """
    532532
    533     def iterate(self, delay=0):
     533    def iterate(delay=0):
    534534        """Run the main loop's I/O polling function for a period of time.
    535535
    536536        This is most useful in applications where the UI is being drawn "as
     
    544544        particular, you must not call it while the reactor is running.
    545545        """
    546546
    547     def fireSystemEvent(self, eventType):
     547    def fireSystemEvent(eventType):
    548548        """Fire a system-wide event.
    549549
    550550        System-wide events are things like 'startup', 'shutdown', and
    551551        'persist'.
    552552        """
    553553
    554     def addSystemEventTrigger(self, phase, eventType, callable, *args, **kw):
     554    def addSystemEventTrigger(phase, eventType, callable, *args, **kw):
    555555        """Add a function to be called when a system event occurs.
    556556
    557557        Each "system event" in Twisted, such as 'startup', 'shutdown', and
     
    585585                  removeSystemEventTrigger.
    586586        """
    587587
    588     def removeSystemEventTrigger(self, triggerID):
     588    def removeSystemEventTrigger(triggerID):
    589589        """Removes a trigger added with addSystemEventTrigger.
    590590
    591591        @param triggerID: a value returned from addSystemEventTrigger.
    592592        """
    593593
    594     def callWhenRunning(self, callable, *args, **kw):
     594    def callWhenRunning(callable, *args, **kw):
    595595        """Call a function when the reactor is running.
    596596
    597597        If the reactor has not started, the callable will be scheduled
     
    612612class IReactorPluggableResolver(Interface):
    613613    """A reactor with a pluggable name resolver interface.
    614614    """
    615     def installResolver(self, resolver):
     615    def installResolver(resolver):
    616616        """Set the internal resolver to use to for name lookups.
    617617
    618618        @type resolver: An object implementing the L{IResolverSimple} interface
     
    629629    (or at least similarly opaque IDs returned from a .fileno() method)
    630630    """
    631631
    632     def addReader(self, reader):
     632    def addReader(reader):
    633633        """I add reader to the set of file descriptors to get read events for.
    634634
    635635        @param reader: An L{IReadDescriptor} that will be checked for read events
     
    637637        @returns: C{None}.
    638638        """
    639639
    640     def addWriter(self, writer):
     640    def addWriter(writer):
    641641        """I add writer to the set of file descriptors to get write events for.
    642642
    643643        @param writer: An L{IWriteDescriptor} that will be checked for read events
     
    645645        @returns: C{None}.
    646646        """
    647647
    648     def removeReader(self, reader):
     648    def removeReader(reader):
    649649        """Removes an L{IReadDescriptor} added with L{addReader}.
    650650
    651651        @returns: C{None}.
    652652        """
    653653
    654     def removeWriter(self, writer):
     654    def removeWriter(writer):
    655655        """Removes an L{IWriteDescriptor} added with L{addWriter}.
    656656
    657657        @returns: C{None}.
    658658        """
    659659
    660     def removeAll(self):
     660    def removeAll():
    661661        """Remove all readers and writers, and return the list of
    662662        L{IReadDescriptor}s and L{IWriteDescriptor}s removed.
    663663       
     
    669669    """A listening port.
    670670    """
    671671
    672     def startListening(self):
     672    def startListening():
    673673        """Start listening on this port.
    674674
    675675        @raise CannotListenError: as defined here L{twisted.internet.error.CannotListenError},
     
    678678                                  the required port number)
    679679        """
    680680
    681     def stopListening(self):
     681    def stopListening():
    682682        """Stop listening on this port.
    683683
    684684        If it does not complete immediately, will return Deferred that fires
    685685        upon completion.
    686686        """
    687687
    688     def getHost(self):
     688    def getHost():
    689689        """Get the host that this port is listening for.
    690690
    691691        @returns: a IAddress.
     
    696696    """A file descriptor.
    697697    """
    698698
    699     def fileno(self):
     699    def fileno():
    700700        """fileno() -> int
    701701
    702702        Returns: the platform-specified representation of a file-descriptor
    703703        number.
    704704        """
    705705       
    706     def connectionLost(self, reason):
     706    def connectionLost(reason):
    707707        """Called when the connection was lost.
    708708
    709709        This is called when the connection on a selectable object has been
     
    722722   
    723723class IReadDescriptor(IFileDescriptor):
    724724
    725     def doRead(self):
     725    def doRead():
    726726        """Some data is available for reading on your descriptor.
    727727        """
    728728
    729729
    730730class IWriteDescriptor(IFileDescriptor):
    731731
    732     def doWrite(self):
     732    def doWrite():
    733733        """Some data is available for reading on your descriptor.
    734734        """
    735735
     
    752752class ISystemHandle(Interface):
    753753    """An object that wraps a networking OS-specific handle."""
    754754
    755     def getHandle(self):
     755    def getHandle():
    756756        """Return a system- and reactor-specific handle.
    757757
    758758        This might be a socket.socket() object, or some other type of
     
    767767class IConsumer(Interface):
    768768    """A consumer consumes data from a producer."""
    769769
    770     def registerProducer(self, producer, streaming):
     770    def registerProducer(producer, streaming):
    771771        """Register to receive data from a producer.
    772772
    773         This sets self to be a consumer for a producer.  When this object
     773        This sets to be a consumer for a producer.  When this object
    774774        runs out of data on a write() call, it will ask the producer
    775775        to resumeProducing(). A producer should implement the L{IProducer}
    776776        interface.   A push producer which is unable to pause or stop
    777777        need not register or unregister.
    778778        """
    779779
    780     def unregisterProducer(self):
     780    def unregisterProducer():
    781781        """Stop consuming data from a producer, without disconnecting.
    782782        """
    783783
    784     def write(self, data):
     784    def write(data):
    785785        """The producer will write data by calling this method."""
    786786
    787787class IFinishableConsumer(IConsumer):
     
    789789
    790790    This interface is semi-stable.
    791791    """
    792     def finish(self):
     792    def finish():
    793793        """The producer has finished producing."""
    794794
    795795class IProducer(Interface):
     
    799799    object implementing L{IConsumer}.
    800800    """
    801801
    802     def stopProducing(self):
     802    def stopProducing():
    803803        """Stop producing data.
    804804
    805805        This tells a producer that its consumer has died, so it must stop
     
    818818    This interface is semi-stable.
    819819    """
    820820
    821     def pauseProducing(self):
     821    def pauseProducing():
    822822        """Pause producing data.
    823823
    824824        Tells a producer that it has produced too much data to process for
    825825        the time being, and to stop until resumeProducing() is called.
    826826        """
    827     def resumeProducing(self):
     827    def resumeProducing():
    828828        """Resume producing data.
    829829
    830         This tells a producer to re-add itself to the main loop and produce
     830        This tells a producer to re-add it to the main loop and produce
    831831        more data for its consumer.
    832832        """
    833833
     
    839839    This interface is semi-stable.
    840840    """
    841841
    842     def resumeProducing(self):
     842    def resumeProducing():
    843843        """Produce data for the consumer a single time.
    844844
    845845        This tells a producer to produce data for the consumer once
     
    850850
    851851class IProtocol(Interface):
    852852
    853     def dataReceived(self, data):
     853    def dataReceived(data):
    854854        """Called whenever data is received.
    855855
    856856        Use this method to translate to a higher-level message.  Usually, some
     
    864864            differing chunk sizes, down to one byte at a time.
    865865        """
    866866
    867     def connectionLost(self, reason):
     867    def connectionLost(reason):
    868868        """Called when the connection is shut down.
    869869
    870870        Clear any circular references here, and any external references
     
    876876        @type reason: L{twisted.python.failure.Failure}
    877877        """
    878878
    879     def makeConnection(self, transport):
     879    def makeConnection(transport):
    880880        """Make a connection to a transport and a server.
    881881        """
    882882
    883     def connectionMade(self):
     883    def connectionMade():
    884884        """Called when a connection is made.
    885885
    886886        This may be considered the initializer of the protocol, because
     
    927927    """Interface for protocol factories.
    928928    """
    929929
    930     def buildProtocol(self, addr):
     930    def buildProtocol(addr):
    931931        """Called when a connection has been established to addr.
    932932
    933933        If None is returned, the connection is assumed to have been refused,
     
    940940        @rtype: None or L{IProtocol}.
    941941        """
    942942
    943     def doStart(self):
     943    def doStart():
    944944        """Called every time this is connected to a Port or Connector."""
    945945
    946     def doStop(self):
     946    def doStop():
    947947        """Called every time this is unconnected from a Port or Connector."""
    948948
    949949
     
    959959    indeterminate time.
    960960    """
    961961
    962     def write(self, data):
     962    def write(data):
    963963        """Write some data to the physical connection, in sequence, in a
    964964        non-blocking fashion.
    965965
     
    968968        before it all gets through.
    969969        """
    970970
    971     def writeSequence(self, data):
     971    def writeSequence(data):
    972972        """Write a list of strings to the physical connection.
    973973
    974974        If possible, make sure that all of the data is written to
     
    976976        single string.
    977977        """
    978978
    979     def loseConnection(self):
     979    def loseConnection():
    980980        """Close my connection, after writing all pending data.
    981981
    982982        Note that if there is a registered producer on a transport it
    983983        will not be closed until the producer has been unregistered.
    984984        """
    985985
    986     def getPeer(self):
     986    def getPeer():
    987987        '''Return an L{IAddress}.
    988988
    989989        Treat this method with caution.  It is the unfortunate
     
    993993        etcetera.
    994994        '''
    995995
    996     def getHost(self):
     996    def getHost():
    997997        """
    998998        Similar to getPeer, but returns an address describing this side of the
    999999        connection.
     
    10031003class ITCPTransport(ITransport):
    10041004    """A TCP based transport."""
    10051005
    1006     def loseWriteConnection(self):
     1006    def loseWriteConnection():
    10071007        """Half-close the write side of a TCP connection.
    10081008       
    10091009        If the protocol this is attached to implements
     
    10131013        and there is no registered producer.
    10141014        """
    10151015   
    1016     def getTcpNoDelay(self):
     1016    def getTcpNoDelay():
    10171017        """Return if TCP_NODELAY is enabled."""
    10181018
    1019     def setTcpNoDelay(self, enabled):
     1019    def setTcpNoDelay(enabled):
    10201020        """Enable/disable TCP_NODELAY.
    10211021
    10221022        Enabling TCP_NODELAY turns off Nagle's algorithm. Small packets are
    10231023        sent sooner, possibly at the expense of overall throughput."""
    10241024
    1025     def getTcpKeepAlive(self):
     1025    def getTcpKeepAlive():
    10261026        """Return if SO_KEEPALIVE enabled."""
    10271027
    1028     def setTcpKeepAlive(self, enabled):
     1028    def setTcpKeepAlive(enabled):
    10291029        """Enable/disable SO_KEEPALIVE.
    10301030
    10311031        Enabling SO_KEEPALIVE sends packets periodically when the connection
    10321032        is otherwise idle, usually once every two hours. They are intended
    10331033        to allow detection of lost peers in a non-infinite amount of time."""
    10341034
    1035     def getHost(self):
     1035    def getHost():
    10361036        """Returns IPv4Address."""
    10371037
    1038     def getPeer(self):
     1038    def getPeer():
    10391039        """Returns IPv4Address."""
    10401040
    10411041
     
    10451045    Once TLS mode is started the transport will implement L{ISSLTransport}.
    10461046    """
    10471047
    1048     def startTLS(self, contextFactory):
     1048    def startTLS(contextFactory):
    10491049        """Initiate TLS negotiation.
    10501050
    10511051        @param contextFactory: A context factory (see L{ssl.py<twisted.internet.ssl>})
     
    10541054class ISSLTransport(ITCPTransport):
    10551055    """A SSL/TLS based transport."""
    10561056
    1057     def getPeerCertificate(self):
     1057    def getPeerCertificate():
    10581058        """Return an object with the peer's certificate info."""
    10591059
    10601060
     
    10641064    @ivar pid: The Process-ID of this process.
    10651065    """
    10661066
    1067     def closeStdin(self):
     1067    def closeStdin():
    10681068        """Close stdin after all data has been written out."""
    10691069
    1070     def closeStdout(self):
     1070    def closeStdout():
    10711071        """Close stdout."""
    10721072
    1073     def closeStderr(self):
     1073    def closeStderr():
    10741074        """Close stderr."""
    10751075
    1076     def closeChildFD(self, descriptor):
     1076    def closeChildFD(descriptor):
    10771077        """
    10781078        Close a file descriptor which is connected to the child process, identified
    10791079        by its FD in the child process.
    10801080        """
    10811081
    1082     def loseConnection(self):
     1082    def loseConnection():
    10831083        """Close stdin, stderr and stdout."""
    10841084
    1085     def signalProcess(self, signalID):
     1085    def signalProcess(signalID):
    10861086        """Send a signal to the process.
    10871087
    10881088        @param signalID: can be
     
    11011101class IServiceCollection(Interface):
    11021102    """An object which provides access to a collection of services."""
    11031103
    1104     def getServiceNamed(self, serviceName):
     1104    def getServiceNamed(serviceName):
    11051105        """Retrieve the named service from this application.
    11061106
    11071107        Raise a KeyError if there is no such service name.
    11081108        """
    11091109
    1110     def addService(self, service):
     1110    def addService(service):
    11111111        """Add a service to this collection.
    11121112        """
    11131113
    1114     def removeService(self, service):
     1114    def removeService(service):
    11151115        """Remove a service from this collection."""
    11161116
    11171117
    11181118class IUDPTransport(Interface):
    11191119    """Transport for UDP DatagramProtocols."""
    11201120
    1121     def write(self, packet, addr=None):
     1121    def write(packet, addr=None):
    11221122        """Write packet to given address.
    11231123
    11241124        @param addr: a tuple of (ip, port). For connected transports must
     
    11291129        long.
    11301130        """
    11311131
    1132     def connect(self, host, port):
     1132    def connect(host, port):
    11331133        """Connect the transport to an address.
    11341134
    11351135        This changes it to connected mode. Datagrams can only be sent to
     
    11411141        @param port: port to connect to.
    11421142        """
    11431143   
    1144     def getHost(self):
     1144    def getHost():
    11451145        """Returns IPv4Address."""
    11461146
    1147     def stopListening(self):
     1147    def stopListening():
    11481148        """Stop listening on this port.
    11491149
    11501150        If it does not complete immediately, will return Deferred that fires
     
    11551155class IUDPConnectedTransport(Interface):
    11561156    """DEPRECATED. Transport for UDP ConnectedPacketProtocols."""
    11571157
    1158     def write(self, packet):
     1158    def write(packet):
    11591159        """Write packet to address we are connected to."""
    11601160
    1161     def getHost(self):
     1161    def getHost():
    11621162        """Returns UNIXAddress."""
    11631163
    11641164
    11651165class IUNIXDatagramTransport(Interface):
    11661166    """Transport for UDP PacketProtocols."""
    11671167
    1168     def write(self, packet, address):
     1168    def write(packet, address):
    11691169        """Write packet to given address."""
    11701170
    1171     def getHost(self):
     1171    def getHost():
    11721172        """Returns UNIXAddress."""
    11731173
    11741174
    11751175class IUNIXDatagramConnectedTransport(Interface):
    11761176    """Transport for UDP ConnectedPacketProtocols."""
    11771177
    1178     def write(self, packet):
     1178    def write(packet):
    11791179        """Write packet to address we are connected to."""
    11801180
    1181     def getHost(self):
     1181    def getHost():
    11821182        """Returns UNIXAddress."""
    11831183
    1184     def getPeer(self):
     1184    def getPeer():
    11851185        """Returns UNIXAddress."""
    11861186
    11871187
    11881188class IMulticastTransport(Interface):
    11891189    """Additional functionality for multicast UDP."""
    11901190
    1191     def getOutgoingInterface(self):
     1191    def getOutgoingInterface():
    11921192        """Return interface of outgoing multicast packets."""
    11931193
    1194     def setOutgoingInterface(self, addr):
     1194    def setOutgoingInterface(addr):
    11951195        """Set interface for outgoing multicast packets.
    11961196
    11971197        Returns Deferred of success.
    11981198        """
    11991199
    1200     def getLoopbackMode(self):
     1200    def getLoopbackMode():
    12011201        """Return if loopback mode is enabled."""
    12021202
    1203     def setLoopbackMode(self, mode):
     1203    def setLoopbackMode(mode):
    12041204        """Set if loopback mode is enabled."""
    12051205
    1206     def getTTL(self):
     1206    def getTTL():
    12071207        """Get time to live for multicast packets."""
    12081208
    1209     def setTTL(self, ttl):
     1209    def setTTL(ttl):
    12101210        """Set time to live on multicast packets."""
    12111211
    1212     def joinGroup(self, addr, interface=""):
     1212    def joinGroup(addr, interface=""):
    12131213        """Join a multicast group. Returns Deferred of success or failure.
    12141214
    12151215        If an error occurs, the returned Deferred will fail with
    12161216        L{error.MulticastJoinError}.
    12171217        """
    12181218
    1219     def leaveGroup(self, addr, interface=""):
     1219    def leaveGroup(addr, interface=""):
    12201220        """Leave multicast group, return Deferred of success."""
  • spread/flavors.py

     
    2828
    2929# system imports
    3030import types
    31 from zope.interface import implements
     31from zope.interface import implements, Interface
    3232
    3333# twisted imports
    34 from twisted.python import log, reflect, components
     34from twisted.python import log, reflect
    3535
    3636# sibling imports
    3737from jelly import setUnjellyableForClass, setUnjellyableForClassTree, setUnjellyableFactoryForClass, unjellyableRegistry
     
    5454    """Raised if there is no such remote method"""
    5555
    5656
    57 class IPBRoot(components.Interface):
     57class IPBRoot(Interface):
    5858    """Factory for root Referenceable objects for PB servers."""
    5959
    60     def rootObject(self, broker):
     60    def rootObject(broker):
    6161        """Return root Referenceable for broker."""
    6262
    6363
  • spread/pb.py

     
    7575from twisted.cred import authorizer, service, perspective, identity
    7676from twisted.cred.portal import Portal
    7777from twisted.persisted import styles
    78 from twisted.python.components import Interface, registerAdapter
     78from twisted.python.components import registerAdapter
    7979
    80 from zope.interface import implements
     80from zope.interface import implements, Interface
    8181
    8282# Sibling Imports
    8383from twisted.spread.interfaces import IJellyable, IUnjellyable
     
    179179    needed.
    180180    """
    181181
    182     def perspectiveMessageReceived(self, broker, message, args, kwargs):
     182    def perspectiveMessageReceived(broker, message, args, kwargs):
    183183        """
    184184        This method is called when a network message is received.
    185185
  • spread/interfaces.py

     
    55will remain monolithic.
    66"""
    77
    8 from twisted.python.components import Interface
     8from zope.interface import Interface
    99
    1010class IJellyable(Interface):
    11     def jellyFor(self, jellier):
     11    def jellyFor(jellier):
    1212        """
    1313        Jelly myself for jellier.
    1414        """
    1515
    1616class IUnjellyable(Interface):
    17     def unjellyFor(self, jellier):
     17    def unjellyFor(jellier):
    1818        """
    1919        Unjelly myself for the jellier.
    2020        """