instruction
stringclasses
100 values
code
stringlengths
78
193k
response
stringlengths
259
170k
file
stringlengths
59
203
Fully document this Python code with docstrings
# -*- test-case-name: twisted.names.test.test_names,twisted.names.test.test_server -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import time from twisted.internet import protocol from twisted.names import dns, resolve from twisted.python ...
--- +++ @@ -2,6 +2,20 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Async DNS server + +Future plans: + - Better config file format maybe + - Make sure to differentiate between different classes + - notice truncation bit + +Important: No additional processing is done on so...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/server.py
Write docstrings for this repository
# -*- test-case-name: twisted.names.test.test_srvconnect -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import random from zope.interface import implementer from twisted.internet import error, interfaces from twisted.names import client, ...
--- +++ @@ -35,6 +35,21 @@ @implementer(interfaces.IConnector) class SRVConnector: + """ + A connector that looks up DNS SRV records. + + RFC 2782 details how SRV records should be interpreted and selected + for subsequent connection attempts. The algorithm for using the records' + priority and weight...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/srvconnect.py
Document classes and their methods
# -*- test-case-name: twisted.names.test.test_tap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os, traceback from twisted.python import usage from twisted.names import dns from twisted.application import internet, service from twisted.names import server from twisted.names impo...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Domain Name Server +""" import os, traceback @@ -44,17 +47,22 @@ def opt_pyzone(self, filename): + """Specify the filename of a Python syntax zone definition""" if not os.path.exists(fil...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/tap.py
Write clean docstrings for readability
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import Interface class IReadHandle(Interface): def readFromHandle(bufflist, evt): class IWriteHandle(Interface): def writeToHandle(buff, evt): class IReadWriteHandle(IReadHandle, IWriteHandle): pass
--- +++ @@ -2,6 +2,9 @@ # See LICENSE for details. +""" +Interfaces for iocpreactor +""" from zope.interface import Interface @@ -10,14 +13,35 @@ class IReadHandle(Interface): def readFromHandle(bufflist, evt): + """ + Read into the given buffers from this handle. + + @param buff: t...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/iocpreactor/interfaces.py
Write beginner-friendly docstrings
# -*- test-case-name: twisted.test.test_kqueuereactor -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import errno import select from select import KQ_FILTER_READ, KQ_FILTER_WRITE from select import KQ_EV_DELETE, KQ_EV_ADD, KQ_EV_EOF from...
--- +++ @@ -2,6 +2,19 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A kqueue()/kevent() based implementation of the Twisted main loop. + +To use this reactor, start your application specifying the kqueue reactor:: + + twistd --reactor kqueue ... + +To install the event loop from ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/kqreactor.py
Add missing documentation to my Python functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System imports import pyui def _guiUpdate(reactor, delay): pyui.draw() if pyui.update() == 0: pyui.quit() reactor.stop() else: reactor.callLater(delay, _guiUpdate, reactor, delay) def install(ms=10, react...
--- +++ @@ -2,6 +2,13 @@ # See LICENSE for details. +""" +This module integrates PyUI with twisted.internet's mainloop. + +Maintainer: Jp Calderone + +See doc/examples/pyuidemo.py for example usage. +""" # System imports import pyui @@ -16,6 +23,10 @@ def install(ms=10, reactor=None, args=(), kw={}): + "...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/pyuisupport.py
Document functions with clear intent
# -*- test-case-name: twisted.test.test_udp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # System Imports import socket import operator import struct import warnings from zope.interface import implementer from twisted.python.runtime im...
--- +++ @@ -2,6 +2,18 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Various asynchronous UDP classes. + +Please do not use this module directly. + +@var _sockErrReadIgnore: list of symbolic error constants (from the C{errno} + module) representing socket errors where the error i...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/udp.py
Write docstrings for this repository
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.internet import task from twisted.python.compat import _PY3 if _PY3: import tkinter.simpledialog as tkSimpleDialog import tkinter.messagebox as tkMessageBox else: import tkSimpleDialog, tkMessageBox _task = None def...
--- +++ @@ -2,6 +2,32 @@ # See LICENSE for details. +""" +This module integrates Tkinter with twisted.internet's mainloop. + +Maintainer: Itamar Shtull-Trauring + +To use, do:: + + | tksupport.install(rootWidget) + +and then run your reactor as usual - do *not* call Tk's mainloop(), +use Twisted's regular mechan...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/tksupport.py
Add docstrings including usage examples
# -*- test-case-name: twisted.test.test_tcp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # System Imports import socket import sys import operator import os import struct import attr from zope.interface import Interface, implementer fr...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Various asynchronous TCP/IP classes. + +End users shouldn't use this module directly - use the reactor APIs instead. +""" from __future__ import division, absolute_import # System Imports @@ -96,6 +101,15 @@ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/tcp.py
Help me comply with documentation standards
# -*- test-case-name: twisted.logger.test.test_file -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from twisted.python.compat import ioType, unicode from ._observer import ILogObserver from ._format import formatTime from ._format import timeFormatR...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +File log observer. +""" from zope.interface import implementer @@ -15,7 +18,19 @@ @implementer(ILogObserver) class FileLogObserver(object): + """ + Log observer that writes to a file-like object. + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_file.py
Add docstrings to improve readability
# -*- test-case-name: twisted.mail.test.test_smtp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # # pylint: disable=I0011,C0103,C9302 from __future__ import absolute_import, division import time import re import base64 import socket import os import random import binascii import warning...
--- +++ @@ -4,6 +4,9 @@ # # pylint: disable=I0011,C0103,C9302 +""" +Simple Mail Transfer Protocol implementation. +""" from __future__ import absolute_import, division @@ -92,6 +95,17 @@ def rfc822date(timeinfo=None, local=1): + """ + Format an RFC-2822 compliant date string. + + @param timeinfo: (...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/smtp.py
Replace inline comments with docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import Interface class IRawDatagramProtocol(Interface): def addProto(): def datagramReceived(): class IRawPacketProtocol(Interface): def addProto(): def datagramReceived():
--- +++ @@ -1,19 +1,40 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Interface definitions for working with raw packets +""" from zope.interface import Interface class IRawDatagramProtocol(Interface): + """ + An interface for protocols such as UDP, ICMP and TCP. + ""...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/pair/raw.py
Generate docstrings with examples
# -*- test-case-name: twisted.logger.test.test_filter -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from functools import partial from zope.interface import Interface, implementer from constantly import NamedConstant, Names from ._levels import InvalidLogLevelError, LogLevel from ._ob...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Filtering log observer. +""" from functools import partial @@ -15,6 +18,24 @@ class PredicateResult(Names): + """ + Predicate results. + + @see: L{LogLevelFilterPredicate} + + @cvar yes: Log the...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_filter.py
Add return value explanations in docstrings
# -*- test-case-name: twisted.pair.test.test_ethernet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # import struct from twisted.internet import protocol from twisted.pair import raw from zope.interface import implementer, Interface class IEthernetProtocol(Interface): def addPr...
--- +++ @@ -5,6 +5,7 @@ # +"""Support for working directly with ethernet frames""" import struct @@ -15,9 +16,12 @@ class IEthernetProtocol(Interface): + """An interface for protocols that handle Ethernet frames""" def addProto(): + """Add an IRawPacketProtocol protocol""" def datagra...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/pair/ethernet.py
Create docstrings for all classes and functions
# -*- test-case-name: twisted.pair.test.test_tuntap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os import fcntl import errno import struct import warnings from collections import namedtuple from constantly import Flags, FlagConstant from zope.interface import Attribute, Interfa...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support for Linux ethernet and IP tunnel devices. + +@see: U{https://en.wikipedia.org/wiki/TUN/TAP} +""" import os import fcntl @@ -33,6 +38,21 @@ class TunnelFlags(Flags): + """ + L{TunnelFlags} defi...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/pair/tuntap.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.test.test_internet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from time import sleep import sys, select, socket from errno import EINTR, EBADF from zope.interface import implementer from twisted.internet...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Select reactor +""" from __future__ import division, absolute_import @@ -18,6 +21,7 @@ def win32select(r, w, e, timeout=None): + """Win32 select wrapper.""" if not (r or w): # windows selec...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/selectreactor.py
Generate consistent documentation across files
# -*- test-case-name: twisted.names.test.test_names -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os import errno import warnings from zope.interface import moduleProvides # Twisted imports from twisted.python.compat import nativeString from twisted.python.runtime import platfor...
--- +++ @@ -2,6 +2,19 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Asynchronous client DNS + +The functions exposed in this module can be used for asynchronous name +resolution and dns queries. + +If you need to create a resolver with specific requirements, such as needing to +do ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/client.py
Write docstrings for data processing functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import Attribute, Interface class IPositioningReceiver(Interface): def positionReceived(latitude, longitude): def positionErrorReceived(positionError): def time...
--- +++ @@ -1,5 +1,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Positioning interfaces. + +@since: 14.0 +""" from __future__ import absolute_import, division @@ -7,30 +12,87 @@ class IPositioningReceiver(Interface): + """ + An interface for positioning providers. +...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/positioning/ipositioning.py
Add inline docstrings for readability
# -*- test-case-name: twisted.test.test_strcred -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import implementer from twisted import plugin from twisted.cred.strcred import ICheckerFactory from twisted.cred.checkers...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cred plugin for UNIX user accounts. +""" from __future__ import absolute_import, division @@ -19,6 +22,17 @@ def verifyCryptedPassword(crypted, pw): + """ + Use L{crypt.crypt} to Verify that an unencr...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/plugins/cred_unix.py
Add docstrings to existing functions
# -*- test-case-name: twisted.test.test_strcred -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import sys from zope.interface import implementer from twisted import plugin from twisted.cred.checkers import FilePasswordDB from twisted.c...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cred plugin for a file of the format 'username:password'. +""" from __future__ import absolute_import, division @@ -28,6 +31,9 @@ @implementer(ICheckerFactory, plugin.IPlugin) class FileCheckerFactory(object...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/plugins/cred_file.py
Write Python docstrings for this snippet
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division class _BaseSentence(object): ALLOWED_ATTRIBUTES = set() def __init__(self, sentenceData): self._sentenceData = sentenceData @property def presentAttributes(self): ...
--- +++ @@ -1,23 +1,69 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Generic sentence handling tools: hopefully reusable. +""" from __future__ import absolute_import, division class _BaseSentence(object): + """ + A base sentence class for a particular protocol. + + U...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/positioning/_sentence.py
Generate NumPy-style docstrings
# -*- test-case-name: twisted.test.test_strcred -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import implementer from twisted import plugin from twisted.cred.checkers import AllowAnonymousAccess from twisted.cred.st...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cred plugin for anonymous logins. +""" from __future__ import absolute_import, division @@ -21,6 +24,9 @@ @implementer(ICheckerFactory, plugin.IPlugin) class AnonymousCheckerFactory(object): + """ + Ge...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/plugins/cred_anonymous.py
Generate missing documentation strings
# -*- test-case-name: twisted.names.test.test_names -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import os import time from twisted.names import dns, error, common from twisted.internet import defer from twisted.python import failure fr...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Authoritative resolvers. +""" from __future__ import absolute_import, division @@ -17,6 +20,19 @@ def getSerial(filename='/tmp/twisted-names.serial'): + """ + Return a monotonically increasing (across...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/authority.py
Add minimal docstrings for each function
# -*- test-case-name: twisted.test.test_persisted -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import types, re try: from tokenize import generate_tokens as tokenize except ImportError: from tokenize import tokenize try: ...
--- +++ @@ -3,6 +3,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +AOT: Abstract Object Trees +The source-code-marshallin'est abstract-object-serializin'est persister +this side of Marmalade! +""" from __future__ import division, absolute_import @@ -155,10 +160,13 @@ def ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/aot.py
Fully document this Python code with docstrings
# -*- test-case-name: twisted.names.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import socket from zope.interface import implementer from twisted.names import dns from twisted.names.error import DNSFormatError, DNSServerError, DN...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Base functionality useful to various parts of Twisted Names. +""" from __future__ import division, absolute_import @@ -28,6 +31,14 @@ @implementer(interfaces.IResolver) class ResolverBase: + """ + L{Re...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/common.py
Write clean docstrings for readability
# -*- test-case-name: twisted.test.test_strcred -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import implementer from twisted import plugin from twisted.cred.strcred import ICheckerFactory sshKeyCheckerFactoryHelp...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cred plugin for ssh key login. +""" from __future__ import absolute_import, division @@ -24,6 +27,9 @@ @implementer(ICheckerFactory, plugin.IPlugin) class SSHKeyCheckerFactory(object): + """ +...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/plugins/cred_sshkeys.py
Include argument descriptions in docstrings
# -*- test-case-name: twisted.names.test.test_dns -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __all__ = [ 'IEncodable', 'IRecord', 'A', 'A6', 'AAAA', 'AFSDB', 'CNAME', 'DNAME', 'HINFO', 'MAILA', 'MAILB', 'MB', 'MD', 'MF', '...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +DNS protocol implementation. + +Future Plans: + - Get rid of some toplevels, maybe. +""" from __future__ import division, absolute_import @@ -62,14 +68,35 @@ if _PY3: def _ord2bytes(ordinal): + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/dns.py
Create documentation for each function signature
# -*- test-case-name: twisted.positioning.test.test_base,twisted.positioning.test.test_sentence -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from functools import partial from operator import attrgetter from zope.interface import implemen...
--- +++ @@ -1,6 +1,11 @@ # -*- test-case-name: twisted.positioning.test.test_base,twisted.positioning.test.test_sentence -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Generic positioning base classes. + +@since: 14.0 +""" from __future__ import absolute_import, division @@ -20...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/positioning/base.py
Write docstrings for backend logic
# -*- test-case-name: twisted.names.test.test_rfc1982 -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import calendar from datetime import datetime, timedelta from twisted.python.compat import nativeString from twisted.python.util import F...
--- +++ @@ -2,6 +2,17 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Utilities for handling RFC1982 Serial Number Arithmetic. + +@see: U{http://tools.ietf.org/html/rfc1982} + +@var RFC4034_TIME_FORMAT: RRSIG Time field presentation format. The Signature + Expiration Time and Incep...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/_rfc1982.py
Create documentation for each function signature
# -*- test-case-name: twisted.test.test_dirdbm -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os import base64 import glob try: import cPickle as pickle except ImportError: import pickle from twisted.python.filepath import FilePath try: _open except NameError: ...
--- +++ @@ -5,6 +5,20 @@ +""" +DBM-style interface to a directory. + +Each key is stored as a single file. This is not expected to be very fast or +efficient, but it's good for easy debugging. + +DirDBMs are *not* thread-safe, they should only be accessed by one thread at +a time. + +No files should be placed in ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/dirdbm.py
Document my Python code with docstrings
# -*- test-case-name: twisted.positioning.test.test_nmea -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import operator import datetime from zope.interface import implementer from constantly import Values, ValueConstant from twisted.posit...
--- +++ @@ -1,6 +1,23 @@ # -*- test-case-name: twisted.positioning.test.test_nmea -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Classes for working with NMEA 0183 sentence producing devices. +This standard is generally just called "NMEA", which is actually the +name of the body tha...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/positioning/nmea.py
Help me document legacy Python code
# -*- test-case-name: twisted.test.test_sob -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # from __future__ import division, absolute_import import os import sys try: import cPickle as pickle except ImportError: import pickle from twisted.python import log, runtime from twisted...
--- +++ @@ -3,6 +3,11 @@ # See LICENSE for details. # +""" +Save and load Small OBjects to and from files, using various formats. + +Maintainer: Moshe Zadka +""" from __future__ import division, absolute_import @@ -21,10 +26,21 @@ class IPersistable(Interface): + """An object which can be saved in severa...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/sob.py
Create documentation strings for testing functions
# -*- test-case-name: twisted.test.test_plugin -*- # Copyright (c) 2005 Divmod, Inc. # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import os import sys from zope.interface import Interface, providedBy def _determinePickleModule(): try: ...
--- +++ @@ -3,6 +3,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Plugin system for Twisted. + +@author: Jp Calderone +@author: Glyph Lefkowitz +""" from __future__ import absolute_import, division @@ -12,6 +18,9 @@ from zope.interface import Interface, providedBy def _de...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/plugin.py
Generate NumPy-style docstrings
# -*- test-case-name: twisted.names.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.names import dns, common from twisted.python import failure, log from twisted.internet import defer class CacheResolver(common.Resolver...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An in-memory caching resolver. +""" from __future__ import division, absolute_import @@ -12,6 +15,11 @@ class CacheResolver(common.ResolverBase): + """ + A resolver that serves records from a local, m...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/cache.py
Generate NumPy-style docstrings
# -*- test-case-name: twisted.test.test_persisted -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # System Imports import types import pickle try: import copy_reg except ImportError: import copyreg as copy_reg import copy import ins...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Different styles of persisted objects. +""" from __future__ import division, absolute_import @@ -34,12 +37,17 @@ else: class _UniversalPicklingError(pickle.PicklingError, ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/styles.py
Write docstrings describing functionality
# -*- test-case-name: twisted.test.test_strcred -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import implementer from twisted import plugin from twisted.cred.strcred import ICheckerFactory from twisted.cred.checkers...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cred plugin for an in-memory user database. +""" from __future__ import absolute_import, division @@ -27,6 +30,16 @@ @implementer(ICheckerFactory, plugin.IPlugin) class InMemoryCheckerFactory(object): + "...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/plugins/cred_memory.py
Add docstrings to improve code quality
# -*- test-case-name: twisted.test.test_persisted -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python import log, reflect from twisted.python.compat import range, _constructMethod class NotKnown: def __init__(self): ...
--- +++ @@ -4,6 +4,9 @@ # See LICENSE for details. +""" +Utility classes for dealing with circular references. +""" from __future__ import division, absolute_import @@ -35,8 +38,18 @@ class _Container(NotKnown): + """ + Helper class to resolve circular references on container objects. + """ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/crefutil.py
Replace inline comments with docstrings
# -*- test-case-name: twisted.test.test_socks -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # python imports import struct import string import socket import time # twisted imports from twisted.internet import reactor, protocol, defer from twisted.python import log class SOCKSv4Outgoi...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation of the SOCKSv4 protocol. +""" # python imports import struct @@ -60,6 +63,24 @@ class SOCKSv4(protocol.Protocol): + """ + An implementation of the SOCKSv4 protocol. + + @type logging:...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/socks.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.protocols.haproxy.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import zope.interface class IProxyInfo(zope.interface.Interface): header = zope.interface.Attribute( "The raw byestring that represents the PROXY protocol header.", ) ...
--- +++ @@ -2,11 +2,17 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Interfaces used by the PROXY protocol modules. +""" import zope.interface class IProxyInfo(zope.interface.Interface): + """ + Data container for PROXY protocol header data. + """ header = z...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/haproxy/_interfaces.py
Write docstrings describing each step
# -*- test-case-name: twisted.test.test_memcache -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from collections import deque from twisted.protocols.basic import LineReceiver from twisted.protocols.policies import TimeoutMixin from twiste...
--- +++ @@ -2,6 +2,28 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Memcache client protocol. Memcached is a caching server, storing data in the +form of pairs key/value, and memcache is the protocol to talk with it. + +To connect to a server, create a factory for L{MemCacheProtoco...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/memcache.py
Create structured documentation for my script
# -*- test-case-name: twisted.python.test.test_shellcomp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import itertools, getopt, inspect from twisted.python import reflect, util, usage from twisted.python.compat import ioType, unicode def shellComplete(config, cmdName, words, shellCom...
--- +++ @@ -2,6 +2,29 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +No public APIs are provided by this module. Internal use only. + +This module implements dynamic tab-completion for any command that uses +twisted.python.usage. Currently, only zsh is supported. Bash support may +b...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_shellcomp.py
Add docstrings to improve readability
# -*- test-case-name: twisted.python.test.test_tzhelper -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from datetime import datetime, timedelta, tzinfo __all__ = [ "FixedOffsetTimeZone", "UTC", ] class FixedOffsetTimeZone(tzinfo): def __init__(self, offset, name=None): ...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Time zone utilities. +""" from datetime import datetime, timedelta, tzinfo @@ -13,14 +16,51 @@ class FixedOffsetTimeZone(tzinfo): + """ + Represents a fixed timezone offset (without daylight saving ti...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_tzhelper.py
Insert docstrings into my code
# -*- test-case-name: twisted.protocols.haproxy.test.test_parser -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from twisted.plugin import IPlugin from twisted.internet.endpoints import ( quoteStringArgument, serverFromString, IStreamServerEndpo...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Parser for 'haproxy:' string endpoint. +""" from zope.interface import implementer from twisted.plugin import IPlugin @@ -15,6 +18,20 @@ def unparseEndpoint(args, kwargs): + """ + Un-parse the already-...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/haproxy/_parser.py
Document this script properly
# -*- test-case-name: twisted.test.test_ftp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System Imports import os import time import re import stat import errno import fnmatch try: import pwd, grp except ImportError: pwd = grp = None from zope.interface import Interface, imp...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An FTP protocol implementation +""" # System Imports import os @@ -169,10 +172,17 @@ class InvalidPath(Exception): + """ + Internal exception used to signify an error during parsing a path. + """ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/ftp.py
Add docstrings for internal functions
# -*- test-case-name: twisted.python.test.test_release -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os import sys from zope.interface import Interface, implementer from subprocess import check_output, STDOUT, CalledProcessError from twisted.python.compat import execfile from t...
--- +++ @@ -2,6 +2,15 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Twisted's automated release system. + +This module is only for use within Twisted's release system. If you are anyone +else, do not use it. The interface and behaviour will change without notice. + +Only Linux is s...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_release.py
Add standardized docstrings across the file
# -*- test-case-name: twisted.test.test_policies -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # system imports import sys from zope.interface import directlyProvides, providedBy # twisted imports from twisted.internet.protocol import S...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Resource limiting policies. + +@seealso: See also L{twisted.protocols.htb} for rate limiting. +""" from __future__ import division, absolute_import @@ -18,6 +23,11 @@ def _wrappedLogPrefix(wrapper, wrapped...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/policies.py
Generate descriptive docstrings automatically
# -*- test-case-name: twisted.test.test_amp -*- # Copyright (c) 2005 Divmod, Inc. # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division __metaclass__ = type import types, warnings from io import BytesIO from struct import pack import decimal, datet...
--- +++ @@ -3,6 +3,195 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module implements AMP, the Asynchronous Messaging Protocol. + +AMP is a protocol for sending multiple asynchronous request/response pairs over +the same connection. Requests and responses are both collection...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/amp.py
Add docstrings to meet PEP guidelines
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.protocols import basic from twisted.internet import defer, protocol from twisted.python import log from io import BytesIO def parseParam(line): if line == b'': return (None, b'') elif line[0:1] != b'"': # atom ...
--- +++ @@ -2,6 +2,11 @@ # See LICENSE for details. +""" +Dict client protocol implementation. + +@author: Pavel Pergamenshchik +""" from twisted.protocols import basic from twisted.internet import defer, protocol @@ -9,6 +14,7 @@ from io import BytesIO def parseParam(line): + """Chew one dqstring or atom...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/dict.py
Write docstrings for utility functions
# -*- test-case-name: twisted.test.test_sip -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import socket import time import warnings from zope.interface import implementer, Interface from collections import OrderedDict from twisted import cred from twisted.internet import protocol, defe...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Session Initialization Protocol. + +Documented in RFC 2543. +[Superseded by 3261] +""" import socket import time @@ -104,6 +110,9 @@ def dashCapitalize(s): + """ + Capitalize a string, making sure to ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/sip.py
Generate descriptive docstrings automatically
# -*- test-case-name: twisted.test.test_ident -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import struct from twisted.internet import defer from twisted.protocols import basic from twisted.python import log, failure _MIN_PORT = 1 _MAX_PORT = 2 ** 16 - 1 class IdentError(Exception): ...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Ident protocol implementation. +""" import struct @@ -13,6 +16,9 @@ _MAX_PORT = 2 ** 16 - 1 class IdentError(Exception): + """ + Can't determine connection owner; reason unknown. + """ identD...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/ident.py
Help me write clear docstrings
# -*- test-case-name: twisted.test.test_postfix -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import sys try: # Python 2 from UserDict import UserDict except ImportError: # Python 3 from collections import UserDict try: # Python 2 from urllib import quote as _quo...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Postfix mail transport agent related protocols. +""" import sys try: @@ -43,6 +46,18 @@ class PostfixTCPMapServer(basic.LineReceiver, policies.TimeoutMixin): + """ + Postfix mail transport agent TCP ma...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/postfix.py
Add docstrings to existing functions
# -*- test-case-name: twisted.protocols.test.test_basic -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division # System imports import re from struct import pack, unpack, calcsize from io import BytesIO import math from zope.interface import imp...
--- +++ @@ -3,6 +3,9 @@ # See LICENSE for details. +""" +Basic protocols, such as line-oriented, netstring, and int prefixed strings. +""" from __future__ import absolute_import, division @@ -39,13 +42,81 @@ DEBUG = 0 class NetstringParseError(ValueError): + """ + The incoming data is not in valid Net...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/basic.py
Generate docstrings for exported functions
# -*- test-case-name: twisted.test.test_htb -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # TODO: Investigate whether we should be using os.times()[-1] instead of # time.time. time.time, it has been pointed out, can go backwards. Is # the same true of os.times? from time import time ...
--- +++ @@ -3,6 +3,17 @@ # See LICENSE for details. +""" +Hierarchical Token Bucket traffic shaping. + +Patterned after U{Martin Devera's Hierarchical Token Bucket traffic +shaper for the Linux kernel<http://luxik.cdi.cz/~devik/qos/htb/>}. + +@seealso: U{HTB Linux queuing discipline manual - user guide + <http://l...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/htb.py
Add docstrings that explain logic
# -*- test-case-name: twisted.python.test.test_setup -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # pylint: disable=I0011,C0103,C9302,W9401,W9402 import io import os import platform import re import sys from distutils.command import build_ext from distutils.errors import CompileError ...
--- +++ @@ -4,6 +4,34 @@ # pylint: disable=I0011,C0103,C9302,W9401,W9402 +""" +Setuptools convenience functionality. + +This file must not import anything from Twisted, as it is loaded by C{exec} in +C{setup.py}. If you need compatibility functions for this code, duplicate them +here. + +@var _EXTRA_OPTIONS: These ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_setup.py
Add docstrings to improve code quality
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import time import struct from zope.interface import implementer from twisted.internet import protocol, interfaces class Echo(protocol.Protocol): def dataReceived(self, data): se...
--- +++ @@ -1,6 +1,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +"""Implement standard (and unused) TCP protocols. + +These protocols are either provided by inetd, or are not provided at all. +""" from __future__ import absolute_import, division @@ -14,6 +18,9 @@ class Echo(...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/wire.py
Document this code for team use
# -*- test-case-name: twisted.protocols.haproxy.test.test_v1parser -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from twisted.internet import address from ._exceptions import ( convertError, InvalidProxyHeader, InvalidNetworkProtocol, Miss...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +IProxyParser implementation for version one of the PROXY protocol. +""" from zope.interface import implementer from twisted.internet import address @@ -18,6 +21,13 @@ @implementer(_interfaces.IProxyParser) cl...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/haproxy/_v1parser.py
Add docstrings following best practices
# -*- test-case-name: twisted.test.test_nooldstyle -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import types from functools import wraps from twisted.python.compat import _shouldEnableNewStyle, _PY3 def _replaceIf(condition, alternat...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Utilities to assist in the "flag day" new-style object transition. +""" from __future__ import absolute_import, division @@ -13,6 +16,16 @@ def _replaceIf(condition, alternative): + """ + If C{conditi...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_oldstyle.py
Generate descriptive docstrings automatically
# -*- test-case-name: twisted.python.test.test_deprecate -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __all__ = [ 'deprecated', 'deprecatedProperty', 'getDeprecationWarningString', 'getWarningMethod', 'setWarningMetho...
--- +++ @@ -2,6 +2,74 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Deprecation framework for Twisted. + +To mark a method, function, or class as being deprecated do this:: + + from incremental import Version + from twisted.python.deprecate import deprecated + + @deprecate...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/deprecate.py
Add standardized docstrings across the file
# -*- test-case-name: twisted.python.test.test_appdirs -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import appdirs import inspect from twisted.python.compat import currentframe def getDataDirectory(moduleName=None): if not moduleN...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Application data directory support. +""" from __future__ import division, absolute_import @@ -12,8 +15,18 @@ def getDataDirectory(moduleName=None): + """ + Get a data directory for the caller function...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_appdirs.py
Add docstrings to clarify complex logic
# -*- test-case-name: twisted.test.test_compat -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import inspect import os import platform import socket import struct import sys import tokenize from types import MethodType as _MethodType im...
--- +++ @@ -4,6 +4,22 @@ # See LICENSE for details. +""" +Compatibility module to provide backwards compatibility for useful Python +features. + +This is mainly for use of internal Twisted code. We encourage you to use +the latest version of Python directly from your code, if possible. + +@var unicode: The type of ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/compat.py
Write beginner-friendly docstrings
# -*- test-case-name: twisted.protocols.haproxy.test.test_v2parser -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import binascii import struct from constantly import Values, ValueConstant from zope.interface import implementer from twisted.internet import address from twisted.python i...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +IProxyParser implementation for version two of the PROXY protocol. +""" import binascii import struct @@ -21,6 +24,9 @@ from . import _interfaces class NetFamily(Values): + """ + Values for the 'family'...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/haproxy/_v2parser.py
Write Python docstrings for this snippet
# -*- test-case-name: twisted.internet.test.test_inotify -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import ctypes import ctypes.util class INotifyError(Exception): def init(): fd = libc.inotify_init() if fd < 0: raise INotifyError("INotify initialization error.")...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Very low-level ctypes-based interface to Linux inotify(7). + +ctypes and a version of libc which supports inotify system calls are +required. +""" import ctypes import ctypes.util @@ -9,10 +15,16 @@ class I...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_inotify.py
Add docstrings explaining edge cases
# -*- test-case-name: twisted.protocols.test.test_tls,twisted.internet.test.test_tls,twisted.test.test_sslverify -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from OpenSSL.SSL import Error, ZeroReturnError, WantReadError from OpenSSL.SSL ...
--- +++ @@ -2,6 +2,39 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation of a TLS transport (L{ISSLTransport}) as an +L{IProtocol<twisted.internet.interfaces.IProtocol>} layered on top of any +L{ITransport<twisted.internet.interfaces.ITransport>} implementation, based on ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/tls.py
Add docstrings to incomplete code
# -*- test-case-name: twisted.test.test_pcp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from twisted.internet import interfaces @implementer(interfaces.IProducer, interfaces.IConsumer) class BasicProducerConsumerProxy: consumer = None p...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Producer-Consumer Proxy. +""" from zope.interface import implementer @@ -10,6 +13,16 @@ @implementer(interfaces.IProducer, interfaces.IConsumer) class BasicProducerConsumerProxy: + """ + I can act as a...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/pcp.py
Add missing documentation to my Python functions
# -*- test-case-name: twisted.test.test_loopback -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # system imports import tempfile from zope.interface import implementer # Twisted Imports from twisted.protocols import policies from twisted...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Testing support for protocols -- loopback between client and server. +""" from __future__ import division, absolute_import @@ -19,6 +22,11 @@ class _LoopbackQueue(object): + """ + Trivial wrapper arou...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/loopback.py
Document this module using docstrings
# -*- test-case-name: twisted.python.test.test_components -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import, print_function # zope3 imports from zope.interface import interface, declarations from zope.interface.adapter import AdapterRegistry...
--- +++ @@ -3,6 +3,30 @@ # See LICENSE for details. +""" +Component architecture for Twisted, based on Zope3 components. + +Using the Zope3 API directly is strongly recommended. Everything +you need is in the top-level of the zope.interface package, e.g.:: + + from zope.interface import Interface, implementer + +...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/components.py
Generate consistent documentation across files
# -*- test-case-name: twisted.python.test.test_textattributes -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function from twisted.python.util import FancyEqMixin class _Attribute(FancyEqMixin, object): compareAttributes = ('children',) def __ini...
--- +++ @@ -2,6 +2,23 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module provides some common functionality for the manipulation of +formatting states. + +Defining the mechanism by which text containing character attributes is +constructed begins by subclassing L{CharacterAt...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_textattributes.py
Help me document legacy Python code
# -*- test-case-name: twisted.protocols.haproxy.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import contextlib import sys from twisted.python import compat class InvalidProxyHeader(Exception): class InvalidNetworkProtocol(InvalidProxyHeader): class MissingAddressData(Inval...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +HAProxy specific exceptions. +""" import contextlib import sys @@ -10,20 +13,40 @@ class InvalidProxyHeader(Exception): + """ + The provided PROXY protocol header is invalid. + """ class Inva...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/haproxy/_exceptions.py
Improve my code by adding docstrings
# -*- test-case-name: twisted.test.test_context -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from threading import local from twisted.python._oldstyle import _oldStyle defaultContextDict = {} setDefault = defaultContextDict.__setitem...
--- +++ @@ -2,6 +2,15 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Dynamic pseudo-scoping for Python. + +Call functions with context.call({key: value}, func); func and +functions that it calls will be able to use 'context.get(key)' to +retrieve 'value'. + +This is thread-safe. +""...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/context.py
Write docstrings for data processing functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os def which(name, flags=os.X_OK): result = [] exts = list(filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))) path = os.environ.get('PATH', None) if path is N...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Utilities for dealing with processes. +""" from __future__ import division, absolute_import @@ -8,6 +11,27 @@ def which(name, flags=os.X_OK): + """ + Search PATH for executable files with the given na...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/procutils.py
Write docstrings describing each step
# -*- test-case-name: twisted.test.test_modules -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import, print_function __metaclass__ = type # let's try to keep path imports to a minimum... from os.path import dirname, split as splitpath import s...
--- +++ @@ -2,6 +2,59 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module aims to provide a unified, object-oriented view of Python's +runtime hierarchy. + +Python is a very dynamic language with wide variety of introspection utilities. +However, these utilities can be hard t...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/modules.py
Add docstrings that explain inputs and outputs
# -*- test-case-name: twisted.protocols.haproxy.test.test_wrapper -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.protocols import policies from twisted.internet import interfaces from twisted.internet.endpoints import _WrapperServerEndpoint from ._exceptions import InvalidP...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Protocol wrapper that provides HAProxy PROXY protocol support. +""" from twisted.protocols import policies from twisted.internet import interfaces @@ -15,6 +18,13 @@ class HAProxyProtocolWrapper(policies.Pro...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/haproxy/_wrapper.py
Document this code for team use
# -*- test-case-name: twisted.test.test_log -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import sys import time import warnings from datetime import datetime from zope.interface import Interface from twisted.python.compat import unico...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Logging and metrics infrastructure. +""" from __future__ import division, absolute_import @@ -35,11 +38,41 @@ @_oldStyle class ILogContext: + """ + Actually, this interface is just a synonym for the di...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/log.py
Add well-formatted docstrings
# -*- test-case-name: twisted.python.test.test_fakepwd -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division __all__ = ['UserDatabase', 'ShadowDatabase'] class _UserRecord(object): def __init__(self, name, password, uid, gid, gecos, home, s...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +L{twisted.python.fakepwd} provides a fake implementation of the L{pwd} API. +""" from __future__ import absolute_import, division @@ -9,6 +12,11 @@ class _UserRecord(object): + """ + L{_UserRecord} ho...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/fakepwd.py
Document classes and their methods
# -*- test-case-name: twisted.python.test.test_htmlizer -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python.compat import _tokenize, escape import tokenize, keyword from . import reflect from twisted.python._oldstyle import _oldStyle @_oldStyle class TokenPrinter: c...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +HTML rendering of Python source. +""" from twisted.python.compat import _tokenize, escape @@ -12,12 +15,18 @@ @_oldStyle class TokenPrinter: + """ + Format a stream of tokens and intermediate whitespac...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/htmlizer.py
Annotate my code with docstrings
# -*- test-case-name: twisted.test.test_text -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. def stringyString(object, indentation=''): braces = '' sl = [] if type(object) is dict: braces = '{}' for key, value in object.items(): value = stringySt...
--- +++ @@ -3,9 +3,22 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Miscellany of text-munging functions. +""" def stringyString(object, indentation=''): + """ + Expansive string formatting for sequence types. + + C{list.__str__} and C{dict.__str__} use C{repr()} to d...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/text.py
Document this code for team use
# -*- test-case-name: twisted.test.test_logfile -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # System Imports import os, glob, time, stat from twisted.python import threadable from twisted.python._oldstyle import _oldStyle from twisted...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A rotating, browsable log file. +""" from __future__ import division, absolute_import @@ -17,10 +20,21 @@ @_oldStyle class BaseLogFile: + """ + The base class for a log file that can be rotated. + "...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/logfile.py
Add verbose docstrings with examples
# -*- test-case-name: twisted.test.test_paths -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os import sys import errno import base64 from os.path import isabs, exists, normpath, abspath, splitext from os.path import basename, dirn...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Object-oriented filesystem path representation. +""" from __future__ import division, absolute_import @@ -44,6 +47,15 @@ def _stub_islink(path): + """ + Always return C{False} if the operating system ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/filepath.py
Create docstrings for each class method
# -*- test-case-name: twisted.test.test_formmethod -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import calendar from twisted.python._oldstyle import _oldStyle class FormException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args) sel...
--- +++ @@ -3,6 +3,12 @@ # See LICENSE for details. +""" +Form-based method objects. + +This module contains support for descriptive method signatures that can be used +to format methods. +""" import calendar @@ -10,17 +16,23 @@ class FormException(Exception): + """An error occurred calling the form met...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/formmethod.py
Create docstrings for all classes and functions
# -*- test-case-name: twisted.test.test_rebuild -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System Imports import sys import types import time import linecache from imp import reload try: # Python 2 from types import InstanceType except ImportError: # Python 3 pass...
--- +++ @@ -3,6 +3,9 @@ # See LICENSE for details. +""" +*Real* reloading support for Python. +""" # System Imports import sys @@ -26,6 +29,18 @@ lastRebuild = time.time() def _isClassType(t): + """ + Compare to types.ClassType in a py2/3-compatible way + + Python 2 used comparison to types.ClassTyp...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/rebuild.py
Create documentation strings for testing functions
# -*- test-case-name: twisted.test.test_reflect -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import, print_function import sys import types import os import pickle import weakref import re import traceback from collections import deque RegexTy...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Standardized versions of various cool and/or strange things that you can do +with Python's reflection capabilities. +""" from __future__ import division, absolute_import, print_function @@ -25,6 +29,20 @@ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/reflect.py
Generate consistent docstrings
# -*- test-case-name: twisted.test.test_failure -*- # See also test suite twisted.test.test_pbfailure # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import, print_function # System Imports import copy import sys import linecache import inspect impo...
--- +++ @@ -5,6 +5,11 @@ # See LICENSE for details. +""" +Asynchronous-friendly error mechanism. + +See L{Failure}. +""" from __future__ import division, absolute_import, print_function @@ -28,6 +33,22 @@ def format_frames(frames, write, detail="default"): + """ + Format and write frames. + + @par...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/failure.py
Write docstrings describing functionality
# -*- test-case-name: twisted.python.test.test_systemd -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __all__ = ['ListenFDs'] from os import getpid class ListenFDs(object): _START = 3 def __init__(self, descriptors): se...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Integration with systemd. + +Currently only the minimum APIs necessary for using systemd's socket activation +feature are supported. +""" from __future__ import division, absolute_import @@ -11,14 +17,47 @@ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/systemd.py
Generate docstrings with examples
# -*- test-case-name: twisted.test.test_monkey -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import class MonkeyPatcher(object): def __init__(self, *patches): # List of patches to apply in (obj, name, value). self._patchesT...
--- +++ @@ -7,6 +7,10 @@ class MonkeyPatcher(object): + """ + Cover up attributes with new objects. Neat for monkey-patching things for + unit-testing purposes. + """ def __init__(self, *patches): # List of patches to apply in (obj, name, value). @@ -19,10 +23,20 @@ def addPatch(...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/monkey.py
Create documentation strings for testing functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function import os from twisted.python.compat import raw_input # errors class DirectoryExists(OSError): pass class DirectoryDoesntExist(OSError): pass class CommandFailed(OSError): pass # uti...
--- +++ @@ -1,6 +1,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A release-automation toolkit. + +Don't use this outside of Twisted. + +Maintainer: Christopher Armstrong +""" from __future__ import print_function @@ -12,11 +19,17 @@ # errors class DirectoryExists(OSError...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/release.py
Fully document this Python code with docstrings
# -*- test-case-name: twisted.python.test.test_util -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import, print_function import os, sys, errno, warnings try: import pwd, grp except ImportError: pwd = grp = None try: from os import set...
--- +++ @@ -33,12 +33,22 @@ @_oldStyle class InsensitiveDict: """ + Dictionary, that has case-insensitive keys. + + Normally keys are retained in their original form when queried with + .keys() or .items(). If initialized with preserveCase=0, keys are both + looked up in lowercase and returned in low...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/util.py
Generate documentation strings for clarity
# -*- test-case-name: twisted.test.test_lockfile -*- # Copyright (c) 2005 Divmod, Inc. # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import errno import os from time import time as _uniquefloat from twisted.python.runtime import platform fr...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Filesystem-based interprocess mutex. +""" from __future__ import absolute_import, division @@ -64,6 +67,10 @@ def symlink(value, filename): + """ + Write a file at C{filename} with the con...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/lockfile.py
Generate consistent documentation across files
# -*- test-case-name: twisted.test.test_randbytes -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import warnings, os, random, string from twisted.python.compat import _PY3 getrandbits = getattr(random, 'getrandbits', None) if _PY3: ...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cryptographically secure random implementation, with fallback on normal random. +""" from __future__ import division, absolute_import @@ -19,14 +22,27 @@ class SecureRandomNotAvailable(RuntimeError): + "...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/randbytes.py
Generate docstrings for script automation
# -*- test-case-name: twisted.python.test_threadable -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from functools import wraps class DummyLock(object): def __reduce__(self): return (unpickle_lock, ()) def unpickle_lock():...
--- +++ @@ -2,12 +2,19 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A module to provide some very basic threading primitives, such as +synchronization. +""" from __future__ import division, absolute_import from functools import wraps class DummyLock(object): + """ + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/threadable.py
Generate helpful docstrings for debugging
# -*- test-case-name: twisted.trial.test.test_script -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division, print_function import gc import inspect import os import pdb import random import sys import time import warnings from twisted.internet im...
--- +++ @@ -36,6 +36,13 @@ def _parseLocalVariables(line): + """ + Accepts a single line in Emacs local variable declaration format and + returns a dict of all the variables {name: value}. + Raises ValueError if 'line' is in the wrong format. + + See http://www.gnu.org/software/emacs/manual/html_node...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/scripts/trial.py
Document all public functions with docstrings
# -*- test-case-name: twisted.test.test_twistd -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function from twisted.python import log from twisted.application import app, service, internet from twisted import copyright import sys, os class ServerOptions(app...
--- +++ @@ -18,6 +18,9 @@ ] def opt_version(self): + """ + Print version information and exit. + """ print('twistd (the Twisted Windows runner) {}'.format(copyright.version), file=self.stdout) print(copyright.copyright, file=self.stdout) @@ -2...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/scripts/_twistw.py
Help me write clear docstrings
# -*- test-case-name: twisted.test.test_roots -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.python import reflect from twisted.python._oldstyle import _oldStyle class NotSupportedError(NotImplementedError): @_oldStyle c...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Twisted Python Roots: an abstract hierarchy representation for Twisted. + +Maintainer: Glyph Lefkowitz +""" from __future__ import absolute_import, division @@ -11,44 +16,94 @@ class NotSupportedError(NotI...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/roots.py
Document this module using docstrings
# -*- test-case-name: twisted.spread.test.test_jelly -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System Imports import types import warnings import decimal from functools import reduce import copy import datetime try: from types import (ClassType as _OldStyleClass, ...
--- +++ @@ -2,6 +2,64 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +S-expression-based persistence of python objects. + +It does something very much like L{Pickle<pickle>}; however, pickle's main goal +seems to be efficiency (both in space and time); jelly's main goals are +securit...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/jelly.py
Create Google-style docstrings for my code
# -*- test-case-name: twisted.python.test.test_runtime -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os import sys import time import warnings from twisted.python._oldstyle import _oldStyle def shortPythonVersion(): return "...
--- +++ @@ -14,6 +14,9 @@ def shortPythonVersion(): + """ + Returns the Python version as a dot-separated string. + """ return "%s.%s.%s" % sys.version_info[:3] @@ -37,6 +40,9 @@ @_oldStyle class Platform: + """ + Gives us information about the platform we're running on. + """ t...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/runtime.py
Write reusable docstrings
# -*- test-case-name: twisted.spread.test.test_pb -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import random from hashlib import md5 from zope.interface import implementer, Interface # Twisted Imports from twisted.python import log, fa...
--- +++ @@ -2,6 +2,30 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Perspective Broker + +\"This isn\'t a professional opinion, but it's probably got enough +internet to kill you.\" --glyph + +Introduction +============ + +This is a broker for proxies for and copies of objects. It...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/pb.py
Add docstrings to incomplete code
# -*- test-case-name: twisted.test.test_threadpool -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import threading from twisted._threads import pool as _pool from twisted.python import log, context from twisted.python.failure import Failu...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +twisted.python.threadpool: a pool of threads to which we dispatch tasks. + +In most cases you can just use C{reactor.callInThread} and friends +instead of creating a thread pool directly. +""" from __future__ im...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/threadpool.py
Create docstrings for all classes and functions
# -*- test-case-name: twisted.spread.test.test_pb -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import time from twisted.internet import defer from twisted.spread import banana, jelly, flavors class Publishable(flavors.Cacheable): ...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Persistently cached objects for PB. + +Maintainer: Glyph Lefkowitz + +Future Plans: None known. +""" from __future__ import absolute_import, division @@ -12,23 +19,34 @@ class Publishable(flavors.Cacheable...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/publish.py
Document all endpoints with docstrings
# -*- test-case-name: twisted.test.test_sendmsg -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from collections import namedtuple from twisted.python.compat import _PY3 __all__ = ["sendmsg", "recvmsg", "getSocketFamily", "SCM_RIGHTS"] if...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +sendmsg(2) and recvmsg(2) support for Python. +""" from __future__ import absolute_import, division @@ -22,6 +25,25 @@ def sendmsg(socket, data, ancillary=[], flags=0): + """ + Send a message on a soc...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/sendmsg.py
Write Python docstrings for this snippet
# -*- test-case-name: twisted.test.test_pb -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.internet import defer from twisted.python.failure import Failure from twisted.spread import pb from twisted.protocols import basic from twisted.internet import interfaces from zope.in...
--- +++ @@ -4,6 +4,9 @@ # See LICENSE for details. +""" +Utility classes for spread. +""" from twisted.internet import defer from twisted.python.failure import Failure @@ -24,9 +27,21 @@ class LocalAsRemote: + """ + A class useful for emulating the effects of remote behavior locally. + """ rep...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/util.py
Add docstrings with type hints explained
# -*- test-case-name: twisted.python.test.test_urlpath -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python.compat import ( nativeString, unicode, urllib_parse as urlparse, urlunquote, urlquote ) from hyperlink import UR...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +L{URLPath}, a representation of a URL. +""" from __future__ import division, absolute_import @@ -14,6 +17,15 @@ _allascii = b"".join([chr(x).encode('ascii') for x in range(1, 128)]) def _rereconstituter(name...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/urlpath.py