Opened 16 years ago

Closed 14 years ago

#1853 defect closed fixed (fixed)

Fix/eliminate @cvar in Interfaces.

Reported by: jknight Owned by:
Priority: lowest Milestone:
Component: core Keywords: documentation
Cc: Thijs Triemstra Branch: branches/cvar-interfaces-1853-2
branch-diff, diff-cov, branch-cov, buildbot
Author: thijs

Description

In particular, twisted/names/dns.py IRecord. Others if they exist.

Change History (16)

comment:1 Changed 16 years ago by Glyph

Priority: normallowest

comment:2 Changed 14 years ago by Thijs Triemstra

Cc: Thijs Triemstra added
Keywords: documentation added
Owner: changed from Jean-Paul Calderone to Thijs Triemstra
Status: newassigned

Should I just delete those lines I find with grep, or is there a substitute I should apply?

comment:3 Changed 14 years ago by Jean-Paul Calderone

Most of these can probably be turned into z.i.Attributes. It's case-by-case, depending on usage. The examples I can find without much effort seem to make sense with this change, though.

comment:4 Changed 14 years ago by Thijs Triemstra

author: thijs
Branch: branches/cvar-interfaces-1853

(In [24838]) Branching to 'cvar-interfaces-1853'

comment:5 in reply to:  3 Changed 14 years ago by Thijs Triemstra

Keywords: review added
Owner: Thijs Triemstra deleted
Status: assignednew

Replying to exarkun:

Most of these can probably be turned into z.i.Attributes. It's case-by-case, depending on usage. The examples I can find without much effort seem to make sense with this change, though.

There's a lot of them though, see the list below. Can you let me know which ones? I fixed the one reported in the ticket description in r24839.

./application/internet.py:    @cvar volatile: list of attribute to remove from pickling.
./application/internet.py:    @cvar volatile: list of attribute to remove from pickling.
./conch/ssh/transport.py:    @cvar cipherMap: A dictionary mapping SSH encryption names to 3-tuples of
./conch/ssh/transport.py:    @cvar macMap: A dictionary mapping SSH MAC names to hash modules.
./conch/test/test_ssh.py:    @cvar getMP: a method providing a MP parser.
./cred/strcred.py:    @cvar supportedInterfaces: An iterable object that returns
./cred/strcred.py:    @cvar authOutput: A writeable object to which this options class
./names/dns.py:    @cvar fmt: C{str} specifying the byte format of an RR.
./protocols/amp.py:    @cvar arguments: A list of 2-tuples of (name, Argument-subclass-instance),
./protocols/amp.py:    @cvar response: A list like L{arguments}, but instead used for the return
./protocols/amp.py:    @cvar errors: A mapping of subclasses of L{Exception} to wire-protocol tags
./protocols/amp.py:    @cvar fatalErrors: like 'errors', but errors in this list will always
./protocols/amp.py:    @cvar commandType: The type of Box used to issue commands; useful only for
./protocols/amp.py:    @cvar responseType: The type of Box used to respond to this command; only
./protocols/basic.py:    @cvar delimiter: The line-ending delimiter to use. By default this is
./protocols/basic.py:    @cvar MAX_LENGTH: The maximum length of a line to allow (If a
./protocols/basic.py:    @cvar delimiter: The line-ending delimiter to use. By default this is
./protocols/basic.py:    @cvar MAX_LENGTH: The maximum length of a line to allow (If a
./protocols/htb.py:    @cvar maxburst: Size of the bucket, in bytes.  If None, the bucket is
./protocols/htb.py:    @cvar rate: Rate the bucket drains, in bytes per second.  If None,
./protocols/htb.py:    @cvar bucketFactory: Class of buckets to make.
./protocols/htb.py:    @cvar sweepInterval: Seconds between sweeping out the bucket cache.
./protocols/policies.py:    @cvar connectionLimit: maximum number of connections.
./protocols/policies.py:    @cvar overflowProtocol: Protocol to use for new connections when
./protocols/policies.py:    @cvar timeOut: The number of seconds after which to timeout the connection.
./python/components.py:    @cvar temporaryAdapter: If this is True, the adapter will not be
./python/components.py:    @cvar multiComponent: If this adapter is persistent, should it be
./python/randbytes.py:    @cvar randomSources: list of file sources used when os.urandom is not
./python/test/test_release.py:    @cvar template: The lore template that will be used to prepare sample
./spread/ui/gtk2util.py:    @cvar gladefile: The file in which the glade GUI definition is kept.
./spread/ui/gtk2util.py:    @cvar _widgets: Widgets that should be attached to me as attributes.
./test/test_jelly.py:    @cvar decimalData: serialized version of decimal data, to be used in tests.
./test/test_pb.py:    @cvar allIDs: hold every created instances of this class.
./test/test_ssl.py:    @cvar pretext: text sent before TLS is set up.
./test/test_ssl.py:    @cvar posttext: text sent after TLS is set up.
./web/_auth/digest.py:    @cvar CHALLENGE_LIFETIME_SECS: The number of seconds for which an
./web/http_headers.py:    @cvar _caseMappings: A C{dict} that maps lowercase header names
./web/static.py:    @cvar childNotFound: L{Resource} used to render 404 Not Found error pages.
./web/woven/page.py:    @cvar appRoot: Set this to True if you want me to call
./web/woven/widgets.py:    @cvar tagName: The tag name of the element that this widget creates. If this
./web/woven/widgets.py:    @cvar wantsAllNotifications: Indicate that this widget wants to recieve every
./web2/auth/digest.py:    @cvar CHALLENGE_LIFETIME_SECS: The number of seconds for which an
./web2/resource.py:    @cvar maxMem: maximum memory used during the parsing of the data.
./web2/resource.py:    @cvar maxFields: maximum number of form fields allowed.
./web2/resource.py:    @cvar maxSize: maximum size of the whole post allowed.
./words/im/basesupport.py:    @cvar _groupFactory: A Callable that will return a L{IGroup} appropriate
./words/im/basesupport.py:    @cvar _personFactory: A Callable that will return a L{IPerson} appropriate
./words/im/interfaces.py:    @cvar gatewayType: Identifies the protocol used by this account.
./words/protocols/jabber/client.py:    @cvar callbacks: Callback list to be notified when response comes back
./words/protocols/jabber/error.py:    @cvar namespace: The namespace of the C{error} element generated by
./words/protocols/jabber/xmlstream.py:    @cvar feature: tuple of (uri, name) of the stream feature root element.
./words/protocols/jabber/xmlstream.py:    @cvar wanted: indicates if TLS negotiation is wanted.

comment:6 Changed 14 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Thijs Triemstra

Only the ones in Interface docstrings need to change for this ticket.

So,

./words/im/interfaces.py:    @cvar gatewayType: Identifies the protocol used by this account.

seems to be the only other thing to fix. I wrote this to check:

import sys
from zope.interface.interfaces import IInterface
from twisted.python.modules import getModule

def main():
    p = getModule('twisted')
    for m in p.walkModules():
        if 'test' in m.name.split('.'):
            continue
        try:
            m.load()
        except Exception, e:
            sys.stderr.write('%s %s\n' % (m.name, e))
        else:
            for a in m.iterAttributes():
                if a.name.split('.')[-1].startswith('I'):
                    iface = a.load()
                    if IInterface.providedBy(iface) and '@cvar' in iface.__doc__:
                        print a.name

if __name__ == '__main__':
    main()

(it was altogether too difficult)

comment:7 in reply to:  6 Changed 14 years ago by Thijs Triemstra

Keywords: review added
Owner: Thijs Triemstra deleted

Thanks for the review exarkun. Made the change in r24870.

comment:8 Changed 14 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Thijs Triemstra

conflicts with trunk; please merge forward and resolve.

comment:9 Changed 14 years ago by Thijs Triemstra

Branch: branches/cvar-interfaces-1853branches/cvar-interfaces-1853-2

(In [24920]) Branching to 'cvar-interfaces-1853-2'

comment:10 Changed 14 years ago by Thijs Triemstra

Keywords: review added
Owner: changed from Thijs Triemstra to Jean-Paul Calderone

See r24921

comment:11 Changed 14 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Thijs Triemstra
  • twisted/words/im/interfaces.py
    • string isn't code, but str is. Please change the C{} in the gatewayType docstring.
    • there's some trailing whitespace in this file. M-x whitespace-cleanup will take care of it.
  • twisted/names/dns.py
    • some new trailing whitespace is added, please remove it.

comment:12 Changed 14 years ago by Thijs Triemstra

Status: newassigned

comment:13 Changed 14 years ago by Thijs Triemstra

Keywords: review added
Owner: Thijs Triemstra deleted
Status: assignednew

Fixed the points in r25025

comment:14 Changed 14 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Thijs Triemstra

Looks good, please merge.

comment:15 Changed 14 years ago by Thijs Triemstra

Resolution: fixed
Status: newclosed

(In [25057]) Merge cvar-interfaces-1853-2: Replace @cvar in interfaces with z.i.Attribute.

Author: thijs Reviewer: exarkun Fixes: #1853

comment:16 Changed 11 years ago by <automation>

Owner: Thijs Triemstra deleted
Note: See TracTickets for help on using tickets.