instruction
stringclasses
100 values
code
stringlengths
78
193k
response
stringlengths
259
170k
file
stringlengths
59
203
Add detailed docstrings explaining each function
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.cred.error import UnauthorizedLogin class ConchError(Exception): def __init__(self, value, data = None): Exception.__init__(self, value, data) self.value = value...
--- +++ @@ -1,6 +1,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An error to represent bad things happening in Conch. + +Maintainer: Paul Swartz +""" from __future__ import absolute_import, division @@ -16,32 +21,83 @@ class NotEnoughAuthentication(Exception): + """ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/error.py
Write docstrings for this repository
# -*- test-case-name: twisted.conch.test.test_connection -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import string import struct import twisted.internet.error from twisted.conch.ssh import service, common from twisted.conch import error...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module contains the implementation of the ssh-connection service, which +allows access to the shell and port-forwarding. + +Maintainer: Paul Swartz +""" from __future__ import division, absolute_import imp...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/connection.py
Help me document legacy Python code
# -*- test-case-name: twisted.conch.test.test_openssh_compat -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os, errno from twisted.python import log from twisted.python.util import runAsEffectiveUser from twisted.conch.ssh import keys, factory, common from twisted.conch.openssh_c...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Factory for reading openssh configuration files: public keys, private keys, and +moduli file. +""" import os, errno @@ -20,6 +24,9 @@ def getPublicKeys(self): + """ + Return the server pu...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/openssh_compat/factory.py
Create Google-style docstrings for my code
# -*- test-case-name: twisted.conch.test.test_ckeygen -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function import sys, os, getpass, socket from functools import wraps from imp import reload if getpass.getpass == getpass.unix_getpass: try: impo...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation module for the `ckeygen` command. +""" from __future__ import print_function @@ -246,6 +249,15 @@ def _saveKey(key, options): + """ + Persist a SSH key on local filesystem. + + @para...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/scripts/ckeygen.py
Write docstrings for backend logic
# -*- test-case-name: twisted.conch.test.test_transport -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from hashlib import sha1, sha256, sha384, sha512 from zope.interface import Attribute, implementer, Interface from twisted.conch impor...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +SSH key exchange handling. +""" from __future__ import absolute_import, division @@ -14,6 +17,9 @@ class _IKexAlgorithm(Interface): + """ + An L{_IKexAlgorithm} describes a key exchange algorithm. + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/_kex.py
Create documentation strings for testing functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from twisted.internet import protocol from twisted.application import service, strports from twisted.cred import portal, checkers from twisted.python import usage, filepath from twisted.conch import manhol...
--- +++ @@ -1,6 +1,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +TAP plugin for creating telnet- and ssh-accessible manhole servers. + +@author: Jp Calderone +""" from zope.interface import implementer @@ -82,6 +87,36 @@ def makeService(options): + """ + Create a ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/manhole_tap.py
Write clean docstrings for readability
# -*- test-case-name: twisted.conch.test.test_address -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer from twisted.internet.interfaces import IAddress from twisted.python import util @implementer(I...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Address object for SSH network connections. + +Maintainer: Paul Swartz + +@since: 12.1 +""" from __future__ import division, absolute_import @@ -14,6 +21,17 @@ @implementer(IAddress) class SSHTransportAddre...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/address.py
Create docstrings for all classes and functions
# -*- test-case-name: twisted.conch.test.test_manhole -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import code, sys, tokenize from io import BytesIO from twisted.conch import recvline from twisted.internet import defer from twisted.python.compat import _tokenize, _get_async_param from...
--- +++ @@ -2,6 +2,16 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Line-input oriented interactive interpreter loop. + +Provides classes for handling Python source input and arbitrary output +interactively from a Twisted application. Also included is syntax coloring +code with su...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/manhole.py
Add concise docstrings to each method
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import class Unauthorized(Exception): class LoginFailed(Exception): class UnauthorizedLogin(LoginFailed, Unauthorized): class UnhandledCredentials(LoginFailed): class LoginDenied(LoginFailed...
--- +++ @@ -1,24 +1,45 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cred errors. +""" from __future__ import division, absolute_import class Unauthorized(Exception): + """Standard unauthorized error.""" class LoginFailed(Exception): + """ + The user's reque...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/cred/error.py
Write documentation strings for class attributes
# -*- test-case-name: twisted.conch.test.test_channel -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer from twisted.python import log from twisted.python.compat import nativeString, intToBytes from twi...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +The parent class for all the SSH Channels. Currently implemented channels +are session, direct-tcp, and forwarded-tcp. + +Maintainer: Paul Swartz +""" from __future__ import division, absolute_import @@ -15,6...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/channel.py
Add docstrings that explain inputs and outputs
# -*- test-case-name: twisted.cred.test.test_cred -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.internet import defer from twisted.internet.defer import maybeDeferred from twisted.python import failure, reflect from twisted....
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +The point of integration of application and authentication. +""" from __future__ import division, absolute_import @@ -14,11 +17,48 @@ class IRealm(Interface): + """ + The realm connects application-sp...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/cred/portal.py
Add well-formatted docstrings
# -*- test-case-name: twisted.test.test_process -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python.reflect import qual from twisted.python.deprecate import getWarningMethod from twisted.python.failure import Failure from twisted.python.log import err _missingProcessExited...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Cross-platform process-related functionality used by different +L{IReactorProcess} implementations. +""" from twisted.python.reflect import qual from twisted.python.deprecate import getWarningMethod @@ -38,6 +4...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_baseprocess.py
Document functions with detailed explanations
# -*- test-case-name: twisted.test.test_process -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division, print_function import os import sys # Win32 imports import win32api import win32con import win32event import win32file import win32pipe import...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +http://isometri.cc/strips/gates_in_the_head +""" from __future__ import absolute_import, division, print_function @@ -38,6 +41,15 @@ @_replaceIf(_PY3, getattr(os, 'fsdecode', None)) def _fsdecode(x): + ""...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_dumbwin32proc.py
Write proper docstrings for these functions
# -*- test-case-name: twisted.cred.test.test_strcred -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # from __future__ import absolute_import, division import sys from zope.interface import Interface, Attribute from twisted.plugin import getPlugins from twisted.python import usage ...
--- +++ @@ -4,6 +4,15 @@ # See LICENSE for details. # +""" +Support for resolving command-line strings that represent different +checkers available to cred. + +Examples: + - passwd:/etc/passwd + - memory:admin:asdf:user:lkj + - unix +""" from __future__ import absolute_import, division @@ -17,6 +26,12 @@ cl...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/cred/strcred.py
Can you add docstrings to this Python file?
# -*- test-case-name: twisted.test.test_sslverify -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. def _idnaBytes(text): try: import idna except ImportError: return text.encode("idna") else: return idna.encode(text) def _idnaText(octets): try: ...
--- +++ @@ -2,8 +2,26 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Shared interface to IDNA encoding and decoding, using the C{idna} PyPI package +if available, otherwise the stdlib implementation. +""" def _idnaBytes(text): + """ + Convert some text typed by a human into...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_idna.py
Add documentation for all methods
# -*- test-case-name: twisted.conch.test.test_filetransfer -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import errno import struct import warnings from zope.interface import implementer from twisted.conch.interfaces import ISFTPServer...
--- +++ @@ -485,6 +485,9 @@ def _sendStatus(self, requestId, code, message, lang=b''): + """ + Helper method to send a FXP_STATUS message. + """ data = requestId + struct.pack('!L', code) data += NS(message) data += NS(lang) @@ -492,6 +495,9 @@ def connect...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/filetransfer.py
Generate helpful docstrings for debugging
# -*- test-case-name: twisted.test.test_producer_helpers -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer from twisted.internet.interfaces import IPushProducer from twisted.internet.task import cooperat...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Helpers for working with producers. +""" from __future__ import division, absolute_import from zope.interface import implementer @@ -18,6 +21,29 @@ @implementer(IPushProducer) class _PullToPush(object): + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_producer_helpers.py
Document helper functions with docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # dependent on pyserial ( http://pyserial.sf.net/ ) # only tested w/ 1.18 (5 Dec 2002) from serial import PARITY_NONE from serial import STOPBITS_ONE from serial import EIGHTBITS from twisted.in...
--- +++ @@ -2,6 +2,9 @@ # See LICENSE for details. +""" +Serial Port Protocol +""" from __future__ import division, absolute_import @@ -18,6 +21,9 @@ class SerialPort(BaseSerialPort, abstract.FileDescriptor): + """ + A select()able serial device, acting as a transport. + """ connected = 1 ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_posixserialport.py
Write docstrings including parameters and return values
# -*- test-case-name: twisted.internet.test.test_pollingfile -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import implementer from twisted.internet.interfaces import IConsumer, IPushProducer from twisted.python.compat ...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implements a simple polling interface for file descriptors that don't work with +select() - this is pretty much only useful on Windows. +""" from __future__ import absolute_import, division @@ -195,6 +199,15 @...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_pollingfile.py
Generate docstrings for script automation
# -*- test-case-name: twisted.internet.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import sys from zope.interface import implementer from twisted.internet import base, posixbase, selectreactor from twisted.internet.interfaces imp...
--- +++ @@ -2,6 +2,14 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module provides base support for Twisted to interact with the glib/gtk +mainloops. + +The classes in this module should not be used directly, but rather you should +import gireactor or gtk3reactor for GObject ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_glibbase.py
Generate helpful docstrings for debugging
# -*- test-case-name: twisted.test.test_stdio -*- from zope.interface import implementer from twisted.internet import process, error, interfaces from twisted.python import log, failure @implementer(interfaces.IAddress) class PipeAddress(object): pass @implementer(interfaces.ITransport, interfaces.IProducer, ...
--- +++ @@ -1,5 +1,15 @@ # -*- test-case-name: twisted.test.test_stdio -*- +"""Standard input/out/err support. + +Future Plans:: + + support for stderr, perhaps + Rewrite to use the reactor instead of an ad-hoc mechanism for connecting + protocols to transport. + +Maintainer: James Y Knight +""" from ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_posixstdio.py
Write beginner-friendly docstrings
# -*- test-case-name: twisted.test.test_ssl -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer from zope.interface import directlyProvides from twisted.internet.interfaces import ITLSTransport, ISSLTrans...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module implements memory BIO based TLS support. It is the preferred +implementation and will be used whenever pyOpenSSL 0.10 or newer is installed +(whenever L{twisted.protocols.tls} is importable). + +@since...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_newtls.py
Create Google-style docstrings for my code
# -*- test-case-name: twisted.internet.test.test_sigchld -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import signal def installHandler(fd): if fd == -1: signal.signal(signal.SIGCHLD, signal.SIG_DFL) else: def no...
--- +++ @@ -2,6 +2,35 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module is used to integrate child process termination into a +reactor event loop. This is a challenging feature to provide because +most platforms indicate process termination via SIGCHLD and do not +provide ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_signals.py
Write Python docstrings for this snippet
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python import log class SSHService(log.Logger): name = None # this is the ssh name for the service protocolMessages = {} # these map #'s -> protocol names transport = Non...
--- +++ @@ -1,6 +1,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +The parent class for all the SSH services. Currently implemented services +are ssh-userauth and ssh-connection. + +Maintainer: Paul Swartz +""" from __future__ import division, absolute_import @@ -12,14 +18,2...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/service.py
Document my Python code with docstrings
# -*- test-case-name: twisted.internet.test.test_win32serialport -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # system imports from serial import PARITY_NONE from serial import STOPBITS_ONE from serial import EIGHTBITS from serial.seria...
--- +++ @@ -3,6 +3,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Serial port support for Windows. + +Requires PySerial and pywin32. +""" from __future__ import division, absolute_import @@ -21,6 +26,7 @@ class SerialPort(BaseSerialPort, abstract.FileDescriptor): + ""...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_win32serialport.py
Document this script properly
# -*- test-case-name: twisted.test.test_defer -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import, print_function import attr import traceback import types import warnings from sys import exc_info, version_info from functools import wraps from ...
--- +++ @@ -2,6 +2,19 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support for results that aren't immediately available. + +Maintainer: Glyph Lefkowitz + +@var _NO_RESULT: The result used to represent the fact that there is no + result. B{Never ever ever use this as an actual ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/defer.py
Write docstrings describing functionality
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import struct from twisted.internet import protocol, reactor from twisted.internet.endpoints import HostnameEndpoint, connectProtocol from twisted.python import log from twisted.python.compat imp...
--- +++ @@ -1,6 +1,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module contains the implementation of the TCP forwarding, which allows +clients and servers to forward arbitrary TCP data across the connection. + +Maintainer: Paul Swartz +""" from __future__ import divisi...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/forwarding.py
Write docstrings for algorithm functions
# -*- test-case-name: twisted.test.test_internet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import errno from zope.interface import implementer from twisted.logger import Logger from twisted.internet.base import DelayedCall from twis...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +asyncio-based reactor implementation. +""" from __future__ import absolute_import, division @@ -27,17 +30,29 @@ class _DCHandle(object): + """ + Wraps ephemeral L{asyncio.Handle} instances. Callbacks...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/asyncioreactor.py
Help me add docstrings to my project
# -*- test-case-name: twisted.test.test_sslverify -*- # Copyright (c) 2005 Divmod, Inc. # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import warnings from constantly import Names, NamedConstant from hashlib import md5 from OpenSSL import SSL...
--- +++ @@ -41,6 +41,9 @@ class TLSVersion(Names): + """ + TLS versions that we can negotiate with the client/server. + """ SSLv3 = NamedConstant() TLSv1_0 = NamedConstant() TLSv1_1 = NamedConstant() @@ -64,6 +67,20 @@ def _getExcludedTLSProtocols(oldest, newest): + """ + Given a p...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_sslverify.py
Add docstrings to improve code quality
# -*- test-case-name: twisted.test.test_stdio -*- from __future__ import absolute_import, division import win32api import os import msvcrt from zope.interface import implementer from twisted.internet.interfaces import (IHalfCloseableProtocol, ITransport, IConsumer, IPushPro...
--- +++ @@ -1,5 +1,8 @@ # -*- test-case-name: twisted.test.test_stdio -*- +""" +Windows-specific implementation of the L{twisted.internet.stdio} interface. +""" from __future__ import absolute_import, division @@ -27,6 +30,11 @@ disconnected = False def __init__(self, proto, reactor=None): + ""...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_win32stdio.py
Add well-formatted docstrings
# -*- test-case-name: twisted.test.test_internet,twisted.internet.test.test_core -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import socket # needed only for sync-dns from zope.interface import implementer, classImplements import sys im...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Very basic functionality for a Reactor implementation. +""" from __future__ import division, absolute_import @@ -48,6 +51,22 @@ def __init__(self, time, func, args, kw, cancel, reset, se...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/base.py
Add missing documentation to my Python functions
# -*- test-case-name: twisted.conch.test.test_session -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import struct import signal import sys import os from zope.interface import implementer from twisted.internet import interfaces, protoco...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module contains the implementation of SSHSession, which (by default) +allows access to a shell and a python interpreter over SSH. + +Maintainer: Paul Swartz +""" from __future__ import division, absolute_im...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/session.py
Add docstrings to existing functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.internet import main, error, interfaces from twisted.internet.abstract import _ConsumerMixin, _LogOwner from twisted.python import failure from twisted.python.compat import unicode from zope.interface import implementer import errno...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Abstract file handle class +""" from twisted.internet import main, error, interfaces from twisted.internet.abstract import _ConsumerMixin, _LogOwner @@ -18,6 +21,9 @@ @implementer(interfaces.IPushProducer, inter...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/iocpreactor/abstract.py
Add docstrings to make code maintainable
# -*- test-case-name: twisted.internet.test.test_core -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. __all__ = [ 'install', 'CFReactor' ] import sys from zope.interface import implementer from twisted.internet.interfaces import IReactorFDSet from twisted.internet.posixbase impo...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A reactor for integrating with U{CFRunLoop<http://bit.ly/cfrunloop>}, the +CoreFoundation main loop used by macOS. + +This is useful for integrating Twisted with U{PyObjC<http://pyobjc.sf.net/>} +applications. +"""...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/cfreactor.py
Create docstrings for reusable components
# -*- test-case-name: twisted.internet.test.test_resolver -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __metaclass__ = type from socket import (getaddrinfo, AF_INET, AF_INET6, AF_UNSPEC, SOCK_STREAM, SOCK_DGRAM, gaie...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +IPv6-aware hostname resolution. + +@see: L{IHostnameResolver} +""" from __future__ import division, absolute_import @@ -25,8 +30,14 @@ @implementer(IHostResolution) class HostResolution(object): + """ + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_resolver.py
Write docstrings describing each step
# -*- test-case-name: twisted.test.test_fdesc -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os import errno try: import fcntl except ImportError: fcntl = None # twisted imports from twisted.internet.main import CONNECTION_LOST, CONNECTION_DONE def setNonBlocking(fd): ...
--- +++ @@ -3,6 +3,9 @@ # See LICENSE for details. +""" +Utility functions for dealing with POSIX file descriptors. +""" import os import errno @@ -16,12 +19,18 @@ def setNonBlocking(fd): + """ + Set the file description of the given file descriptor to non-blocking. + """ flags = fcntl.fcntl(f...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/fdesc.py
Add return value explanations in docstrings
# -*- test-case-name: twisted.test.test_internet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from functools import partial from threading import Thread try: from queue import Queue, Empty except ImportError: from Queue import Queue, Empty import sys from zope.interface import...
--- +++ @@ -2,6 +2,53 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Threaded select reactor + +The threadedselectreactor is a specialized reactor for integrating with +arbitrary foreign event loop, such as those you find in GUI toolkits. + +There are three things you'll need to do ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_threadedselect.py
Add inline docstrings for readability
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import socket from twisted.python import deprecate from incremental import Version class BindError(Exception): def __str__(self): s = self.__doc__ if self.args: ...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Exceptions and errors for use in twisted.internet modules. +""" from __future__ import division, absolute_import @@ -12,6 +15,7 @@ class BindError(Exception): + """An error occurred binding to an interfa...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/error.py
Add structured docstrings to improve clarity
# -*- test-case-name: twisted.internet.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System Imports import sys # Twisted Imports from twisted.internet import _glibbase from twisted.python import runtime # Certain old versions of pygtk and gi crash if imported at the same # time...
--- +++ @@ -3,6 +3,18 @@ # See LICENSE for details. +""" +This module provides support for Twisted to interact with the glib/gtk2 +mainloop. + +In order to use this support, simply do the following:: + + from twisted.internet import gtk2reactor + gtk2reactor.install() + +Then use twisted.internet APIs as usua...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/gtk2reactor.py
Write reusable docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.internet import gtk2reactor class Glib2Reactor(gtk2reactor.Gtk2Reactor): def __init__(self): gtk2reactor.Gtk2Reactor.__init__(self, useGtk=False) def install(): reactor = Glib2Reactor() from twisted.internet...
--- +++ @@ -1,21 +1,44 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module provides support for Twisted to interact with the glib mainloop. +This is like gtk2, but slightly faster and does not require a working +$DISPLAY. However, you cannot run GUIs under this reactor: for t...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/glib2reactor.py
Improve my code by adding docstrings
# -*- test-case-name: twisted.test.test_internet,twisted.internet.test.test_posixbase -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import socket import errno import os import sys from zope.interface import implementer, classImplements ...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Posix reactor base class +""" from __future__ import division, absolute_import @@ -55,9 +58,17 @@ class _SocketWaker(log.Logger): + """ + The I{self-pipe trick<http://cr.yp.to/docs/selfpipe.html>}, im...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/posixbase.py
Generate documentation strings for clarity
# -*- test-case-name: twisted.conch.test.test_transport -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import binascii import hmac import struct import zlib from hashlib import md5, sha1, sha256, sha384, sha512 from cryptography.exceptio...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +The lowest level SSH protocol. This handles the key negotiation, the +encryption and the compression. The transport layer is described in +RFC 4253. + +Maintainer: Paul Swartz +""" from __future__ import absol...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/transport.py
Document helper functions with docstrings
# -*- test-case-name: twisted.internet.test.test_main -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.internet import error CONNECTION_DONE = error.ConnectionDone('Connection done') CONNECTION_LOST = error.ConnectionLost('Con...
--- +++ @@ -3,6 +3,12 @@ # See LICENSE for details. +""" +Backwards compatibility, and utility functions. + +In general, this module should not be used, other than by reactor authors +who need to use the 'installReactor' method. +""" from __future__ import division, absolute_import @@ -14,6 +20,11 @@ def i...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/main.py
Add docstrings to improve collaboration
# -*- test-case-name: twisted.conch.test.test_keys -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import binascii import itertools from hashlib import md5, sha256 import base64 import struct import bcrypt from cryptography.exceptions imp...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Handling of RSA, DSA, and EC keys. +""" from __future__ import absolute_import, division @@ -62,33 +65,100 @@ class BadKeyError(Exception): + """ + Raised when a key isn't what we expected from it. + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/keys.py
Add docstrings that explain inputs and outputs
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import socket, operator, struct, warnings, errno from zope.interface import implementer from twisted.internet import defer, address, error, interfaces from twisted.internet.abstract import isIPAddress, isIPv6Address from twisted.python import l...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +UDP support for IOCP reactor +""" import socket, operator, struct, warnings, errno @@ -21,6 +24,12 @@ @implementer(IReadWriteHandle, interfaces.IListeningPort, interfaces.IUDPTransport, interfaces...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/iocpreactor/udp.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.conch.test.test_manhole -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os, tty, sys, termios from twisted.internet import reactor, stdio, protocol, defer from twisted.python import failure, reflect, log from twisted.conch.insults.insults import Serve...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Asynchronous local terminal input handling + +@author: Jp Calderone +""" import os, tty, sys, termios @@ -29,14 +34,32 @@ def write(self, data): + """ + Write to the terminal. + + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/stdio.py
Auto-generate documentation strings for this file
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python.compat import _PY3 from twisted.internet.error import ReactorAlreadyRunning from twisted.internet import _glibbase from twisted.python import runtime if _PY3: # We require...
--- +++ @@ -1,6 +1,24 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module provides support for Twisted to interact with the glib +mainloop via GObject Introspection. + +In order to use this support, simply do the following:: + + from twisted.internet import gireactor + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/gireactor.py
Add detailed documentation for each class
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import Interface, Attribute class IAddress(Interface): ### Reactor Interfaces class IConnector(Interface): def stopConnecting(): def disconnect(): def connec...
--- +++ @@ -1,6 +1,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Interface documentation. + +Maintainer: Itamar Shtull-Trauring +""" from __future__ import division, absolute_import @@ -8,27 +13,84 @@ class IAddress(Interface): + """ + An address, e.g. a TCP C{(ho...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/interfaces.py
Add detailed docstrings explaining each function
# -*- test-case-name: twisted.test.test_task,twisted.test.test_cooperator -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __metaclass__ = type import sys import time import warnings from zope.interface import implementer from twisted.pyt...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Scheduling utility methods and classes. +""" from __future__ import division, absolute_import @@ -25,6 +28,35 @@ class LoopingCall: + """Call a function repeatedly. + + If C{f} returns a deferred, res...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/task.py
Help me write clear docstrings
# -*- test-case-name: twisted.conch.test.test_telnet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import struct from zope.interface import implementer from twisted.internet import protocol, interfaces as iinternet, defer from twisted.p...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Telnet protocol implementation. + +@author: Jean-Paul Calderone +""" from __future__ import absolute_import, division @@ -152,38 +157,155 @@ class ITelnetProtocol(iinternet.IProtocol): def unhandledComm...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/telnet.py
Document all endpoints with docstrings
# -*- test-case-name: twisted.conch.test.test_userauth -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import struct from twisted.conch import error, interfaces from twisted.conch.ssh import keys, transport, service from twisted.conch.ssh....
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation of the ssh-userauth service. +Currently implemented authentication types are public-key and password. + +Maintainer: Paul Swartz +""" from __future__ import absolute_import, division @@ -19,6 +2...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/userauth.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.test.test_factories,twisted.internet.test.test_protocol -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import random from zope.interface import implementer from twisted.python import log, failure, components ...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Standard implementations of Twisted protocol-related interfaces. + +Start here if you are looking to write a new protocol implementation for +Twisted. The Protocol class contains some introductory material. +""" ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/protocol.py
Create simple docstrings for beginners
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # System imports import errno from select import error as SelectError, poll from select import POLLIN, POLLOUT, POLLHUP, POLLERR, POLLNVAL from zope.interface import implementer # Twisted import...
--- +++ @@ -1,6 +1,15 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A poll() based implementation of the twisted main loop. + +To install the event loop (and you should do this before any connections, +listeners or connectors are added):: + + from twisted.internet import pollrea...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/pollreactor.py
Generate missing documentation strings
# -*- test-case-name: twisted.internet.test.test_iocp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import warnings, socket, sys from zope.interface import implementer from twisted.internet import base, interfaces, main, error from twisted.python import log, failure from twisted.intern...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Reactor that uses IO completion ports +""" import warnings, socket, sys @@ -66,6 +69,9 @@ def doIteration(self, timeout): + """ + Poll the IO completion port for new events. + """ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/iocpreactor/reactor.py
Help me write clear docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # import string # Twisted imports from twisted.python import log class ColorText: # The colors to use COLORS = ('b', 'r', 'g', 'y', 'l', 'm', 'c', 'w') BOLD_COLORS = tuple([x.upper() for x in COLORS]) BLACK, RED, GREEN, YELLOW,...
--- +++ @@ -2,6 +2,10 @@ # See LICENSE for details. # +"""Module to parse ANSI escape sequences + +Maintainer: Jean-Paul Calderone +""" import string @@ -9,6 +13,10 @@ from twisted.python import log class ColorText: + """ + Represents an element of text along with the texts colors and + additional a...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ui/ansi.py
Help me document legacy Python code
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import socket, operator, errno, struct from zope.interface import implementer, classImplements from twisted.internet import interfaces, error, address, main, defer from twisted.internet.protocol import Protocol from twisted.internet.abstract im...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +TCP support for IOCP reactor +""" import socket, operator, errno, struct @@ -37,6 +40,11 @@ @implementer(IReadWriteHandle, interfaces.ITCPTransport, interfaces.ISystemHandle) class Connection(abs...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/iocpreactor/tcp.py
Add detailed docstrings explaining each function
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python.compat import _PY3 if not _PY3: import Queue else: import queue as Queue from twisted.python import failure from twisted.internet import defer def deferToThreadPool(...
--- +++ @@ -1,6 +1,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Extended thread dispatching support. + +For basic support see reactor threading API docs. +""" from __future__ import division, absolute_import @@ -15,6 +20,28 @@ def deferToThreadPool(reactor, threadpool,...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/threads.py
Add well-formatted docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. try: from queue import Empty, Queue except ImportError: from Queue import Empty, Queue try: from wx import PySimpleApp as wxPySimpleApp, CallAfter as wxCallAfter, \ Timer as wxTimer except ImportError: # older version of...
--- +++ @@ -1,6 +1,27 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module provides wxPython event loop support for Twisted. + +In order to use this support, simply do the following:: + + | from twisted.internet import wxreactor + | wxreactor.install() + +Then, when yo...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/wxreactor.py
Add standardized docstrings across the file
# -*- test-case-name: twisted.test.test_ssl -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # System imports from OpenSSL import SSL supported = True from zope.interface import implementer, implementer_only, implementedBy # Twisted import...
--- +++ @@ -2,6 +2,56 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module implements Transport Layer Security (TLS) support for Twisted. It +requires U{PyOpenSSL <https://pypi.python.org/pypi/pyOpenSSL>}. + +If you wish to establish a TLS connection, please use one of the fo...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/ssl.py
Generate docstrings for this script
# -*- test-case-name: twisted.test.test_iutils -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import sys, warnings from functools import wraps from twisted.internet import protocol, defer from twisted.python import failure from twisted.py...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Utility methods. +""" from __future__ import division, absolute_import @@ -29,6 +32,15 @@ class _UnexpectedErrorOutput(IOError): + """ + Standard error data was received where it was not expected. Th...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/utils.py
Provide docstrings following PEP 257
# -*- test-case-name: twisted.test.test_unix,twisted.internet.test.test_unix,twisted.internet.test.test_posixbase -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os import stat import socket import struct from errno import EINTR, EMS...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +UNIX socket support for Twisted. + +End users shouldn't use this module directly - use the reactor APIs instead. + +Maintainer: Itamar Shtull-Trauring +""" from __future__ import division, absolute_import @@ -...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/unix.py
Add docstrings to make code maintainable
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System imports import time import sys from threading import Thread from weakref import WeakKeyDictionary from zope.interface import implementer # Win32 imports from win32file import FD_READ, FD_CLOSE, FD_ACCEPT, FD_CONNECT, WSAEventSelect tr...
--- +++ @@ -2,6 +2,47 @@ # See LICENSE for details. +""" +A win32event based implementation of the Twisted main loop. + +This requires pywin32 (formerly win32all) or ActivePython to be installed. + +To install the event loop (and you should do this before any connections, +listeners or connectors are added):: + + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/win32eventreactor.py
Write proper docstrings for these functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import fcntl import grp import os import pty import pwd import socket import struct import time import tty from zope.interface import implementer from twisted.conch import ttymodes from twisted.conch.avatar import ConchUser from twisted.conch.e...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A UNIX SSH server. +""" import fcntl import grp @@ -153,6 +156,13 @@ @implementer(ISession) class SSHSessionForUnixConchUser: def __init__(self, avatar, reactor=None): + """ + Construct an C{...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/unix.py
Annotate my code with docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # import warnings warnings.warn("wxsupport is not fully functional on Windows, wxreactor is better.") from twisted.python._oldstyle import _oldStyle from twisted.internet import reactor @_oldStyle class wxRunner: def __init__(self, app):...
--- +++ @@ -2,6 +2,24 @@ # See LICENSE for details. # +"""Old method of wxPython support for Twisted. + +twisted.internet.wxreactor is probably a better choice. + +To use:: + + | # given a wxApp instance called myWxAppInstance: + | from twisted.internet import wxsupport + | wxsupport.install(myWxAppInstance...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/wxsupport.py
Add docstrings with type hints explained
# -*- test-case-name: twisted.cred.test.test_digestauth -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from binascii import hexlify from hashlib import md5, sha1 # The digest math algorithms = { b'md5': md5, # md5-sess is more...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Calculations for HTTP Digest authentication. + +@see: U{http://www.faqs.org/rfcs/rfc2617.html} +""" from __future__ import division, absolute_import @@ -30,6 +35,21 @@ # DigestCalcHA1 def calcHA1(pszAlg, pszU...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/cred/_digest.py
Generate missing documentation strings
# -*- test-case-name: twisted.logger.test.test_buffer -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from collections import deque from zope.interface import implementer from ._observer import ILogObserver _DEFAULT_BUFFER_MAXIMUM = 64 * 1024 @implementer(ILogObserver) class Limited...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Log observer that maintains a buffer. +""" from collections import deque @@ -16,8 +19,28 @@ @implementer(ILogObserver) class LimitedHistoryLogObserver(object): + """ + L{ILogObserver} that stores event...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_buffer.py
Document all public functions with docstrings
# -*- test-case-name: twisted.cred.test.test_cred -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os from zope.interface import implementer, Interface, Attribute from twisted.logger import Logger from twisted.internet import defer f...
--- +++ @@ -15,12 +15,26 @@ class ICredentialsChecker(Interface): + """ + An object that can check sub-interfaces of ICredentials. + """ credentialInterfaces = Attribute( 'A list of sub-interfaces of ICredentials which specifies which I may check.') def requestAvatarId(credentials)...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/cred/checkers.py
Add professional docstrings to my codebase
# -*- test-case-name: twisted.internet.test.test_endpoints -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os import re import socket from unicodedata import normalize import warnings from constantly import NamedConstant, Names from...
--- +++ @@ -2,6 +2,15 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementations of L{IStreamServerEndpoint} and L{IStreamClientEndpoint} that +wrap the L{IReactorTCP}, L{IReactorSSL}, and L{IReactorUNIX} interfaces. + +This also implements an extensible mini-language for descri...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/endpoints.py
Fully document this Python code with docstrings
# -*- test-case-name: twisted.test.test_abstract -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from socket import AF_INET, AF_INET6, inet_pton, error from zope.interface import implementer # Twisted Imports from twisted.python.compat im...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support for generic select()able objects. +""" from __future__ import division, absolute_import @@ -30,15 +33,73 @@ class _ConsumerMixin(object): + """ + L{IConsumer} implementations can mix this in t...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/abstract.py
Generate docstrings for script automation
# -*- test-case-name: twisted.logger.test.test_logger -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from time import time from twisted.python.compat import currentframe from twisted.python.failure import Failure from ._levels import InvalidLogLevelError, LogLevel class Logger(object)...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Logger class. +""" from time import time @@ -12,9 +15,29 @@ class Logger(object): + """ + A L{Logger} emits log messages to an observer. You should instantiate it + as a class or module attribute,...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_logger.py
Write reusable docstrings
# -*- test-case-name: twisted.test.test_process -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import, print_function from twisted.python.runtime import platform if platform.isWindows(): raise ImportError(("twisted.internet.process does not ...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +UNIX Process management. + +Do NOT use this module directly - use reactor.spawnProcess() instead. + +Maintainer: Itamar Shtull-Trauring +""" from __future__ import division, absolute_import, print_function @@ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/process.py
Add docstrings including usage examples
# -*- test-case-name: twisted.logger.test.test_global -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import sys import warnings from twisted.python.compat import currentframe from twisted.python.reflect import qual from ._buffer import LimitedHistoryLogObserver from ._observer import Lo...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module includes process-global state associated with the logging system, +and implementation of logic for managing that global state. +""" import sys import warnings @@ -29,6 +33,49 @@ class LogBeginne...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_global.py
Help me document legacy Python code
# -*- test-case-name: twisted.logger.test.test_flatten -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from string import Formatter from collections import defaultdict from twisted.python.compat import unicode aFormatter = Formatter() class KeyFlattener(object): def __init__(self...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Code related to "flattening" events; that is, extracting a description of all +relevant fields from the format string and persisting them for later +examination. +""" from string import Formatter from collectio...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_flatten.py
Add docstrings for utility scripts
# -*- test-case-name: twisted.internet.test.test_default -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __all__ = ["install"] from twisted.python.runtime import platform def _getInstallFunction(platform): # Linux: epoll(7) is the de...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +The most suitable default reactor for the current platform. + +Depending on a specific application's needs, some other reactor may in +fact be better. +""" from __future__ import division, absolute_import @@ -...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/default.py
Help me add docstrings to my project
# -*- test-case-name: twisted.logger.test.test_stdlib -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import logging as stdlibLogging from zope.interface import implementer from twisted.python.compat import _PY3, currentframe, unicode from ._levels import LogLevel from ._format import fo...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Integration with Python standard library logging. +""" import logging as stdlibLogging @@ -24,6 +27,11 @@ } def _reverseLogLevelMapping(): + """ + Reverse the above mapping, adding both the numerical k...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_stdlib.py
Generate docstrings for this script
# -*- test-case-name: twisted.cred.test.test_cred-*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer, Interface import base64 import hmac import random import re import time from binascii import hexlify ...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module defines L{ICredentials}, an interface for objects that represent +authentication credentials to provide, and also includes a number of useful +implementations of that interface. +""" from __future__ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/cred/credentials.py
Add docstrings explaining edge cases
# -*- test-case-name: twisted.logger.test.test_observer -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import Interface, implementer from twisted.python.failure import Failure from ._logger import Logger OBSERVER_DISABLED = ( "Temporarily disabling observer {ob...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Basic log observers. +""" from zope.interface import Interface, implementer @@ -17,13 +20,61 @@ class ILogObserver(Interface): + """ + An observer which can handle log events. + + Unlike most inter...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_observer.py
Generate documentation strings for clarity
# -*- test-case-name: twisted.logger.test.test_levels -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from constantly import NamedConstant, Names class InvalidLogLevelError(Exception): def __init__(self, level): super(InvalidLogLevelError, self).__init__(str(level)) ...
--- +++ @@ -2,19 +2,62 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Log levels. +""" from constantly import NamedConstant, Names class InvalidLogLevelError(Exception): + """ + Someone tried to use a L{LogLevel} that is unknown to the logging system. + """ d...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_levels.py
Write reusable docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os from twisted.internet import gireactor from twisted.python import runtime # Newer versions of gtk3/pygoject raise a RuntimeError, or just break in a # confusing manner, if the program ...
--- +++ @@ -1,6 +1,23 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module provides support for Twisted to interact with the gtk3 mainloop +via Gobject introspection. This is like gi, but slightly slower and requires a +working $DISPLAY. + +In order to use this support, simply...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/gtk3reactor.py
Replace inline comments with docstrings
# -*- test-case-name: twisted.logger.test.test_format -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from datetime import datetime as DateTime from twisted.python.compat import unicode from twisted.python.failure import Failure from twisted.python.reflect import safe_repr from twisted.py...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Tools for formatting logging events. +""" from datetime import datetime as DateTime @@ -17,6 +20,20 @@ def formatEvent(event): + """ + Formats an event as a L{unicode}, using the format in + C{even...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_format.py
Insert docstrings into my code
# -*- test-case-name: twisted.logger.test.test_io -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import sys from ._levels import LogLevel class LoggingFile(object): softspace = 0 def __init__(self, logger, level=LogLevel.info, encoding=None): self.level = level ...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +File-like object that logs. +""" import sys @@ -10,11 +13,34 @@ class LoggingFile(object): + """ + File-like object that turns C{write()} calls into logging events. + + Note that because event form...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_io.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.names.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.internet.defer import TimeoutError class DomainError(ValueError): class AuthoritativeDomainError(ValueError): class DNSQueryTimeou...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Exception class definitions for Twisted Names. +""" from __future__ import division, absolute_import @@ -9,14 +12,28 @@ class DomainError(ValueError): + """ + Indicates a lookup failed because there w...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/error.py
Add docstrings to my Python code
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import attr import warnings, os from zope.interface import implementer from twisted.internet.interfaces import IAddress from twisted.python.filepath import _asFilesystemBytes from twisted.python....
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Address objects for network connections. +""" from __future__ import division, absolute_import @@ -18,6 +21,19 @@ @implementer(IAddress) @attr.s(hash=True) class IPv4Address(object): + """ + An L{IPv4Ad...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/address.py
Expand my code with proper documentation strings
# -*- test-case-name: twisted.logger.test.test_legacy -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from ._levels import LogLevel from ._format import formatEvent from ._observer import ILogObserver from ._stdlib import fromStdlibLogLevelMapping, S...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Integration with L{twisted.python.log}. +""" from zope.interface import implementer @@ -14,8 +17,20 @@ @implementer(ILogObserver) class LegacyLogObserverWrapper(object): + """ + L{ILogObserver} that wr...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_legacy.py
Help me write clear docstrings
# -*- test-case-name: twisted.conch.test.test_tap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.conch import unix from twisted.conch import checkers as conch_checkers from twisted.conch.openssh_compat import factory from twisted.cred import portal, strcred from twisted.pytho...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support module for making SSH servers with twistd. +""" from twisted.conch import unix from twisted.conch import checkers as conch_checkers @@ -45,6 +48,11 @@ def addChecker(self, checker): + """ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/tap.py
Add docstrings to incomplete code
# -*- test-case-name: twisted.logger.test.test_json -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import types from constantly import NamedConstant from json import dumps, loads from uuid import UUID from ._flatten import flattenEvent from ._file import FileLogObserver from ._levels im...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Tools for saving and loading log events in a structured format. +""" import types @@ -22,6 +25,16 @@ def failureAsJSON(failure): + """ + Convert a failure to a JSON-serializable data structure. + + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/_json.py
Add docstrings to improve collaboration
# -*- test-case-name: twisted.mail.test.test_pop3 -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import base64 import binascii import warnings from hashlib import md5 from zope.interface import implementer from twisted import cred from twisted.internet import task from twisted.intern...
--- +++ @@ -4,6 +4,12 @@ # See LICENSE for details. +""" +Post-office Protocol version 3. + +@author: Glyph Lefkowitz +@author: Jp Calderone +""" import base64 import binascii @@ -32,13 +38,42 @@ # Authentication @implementer(cred.credentials.IUsernamePassword) class APOPCredentials: + """ + Credentials...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/pop3.py
Write docstrings for utility functions
# -*- test-case-name: twisted.internet.test.test_inotify -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function import os import struct from twisted.internet import fdesc from twisted.internet.abstract import FileDescriptor from twisted.python import log, _...
--- +++ @@ -2,6 +2,40 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module provides support for Twisted to linux inotify API. + +In order to use this support, simply do the following (and start a reactor +at some point):: + + from twisted.internet import inotify + from t...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/inotify.py
Help me document legacy Python code
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from select import epoll, EPOLLHUP, EPOLLERR, EPOLLIN, EPOLLOUT import errno from zope.interface import implementer from twisted.internet.interfaces import IReactorFDSet from twisted.python imp...
--- +++ @@ -1,6 +1,15 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An epoll() based implementation of the twisted main loop. + +To install the event loop (and you should do this before any connections, +listeners or connectors are added):: + + from twisted.internet import epoll...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/epollreactor.py
Create structured documentation for my script
# -*- test-case-name: twisted.mail.test.test_pop3client -*- # Copyright (c) 2001-2004 Divmod Inc. # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import re from hashlib import md5 from twisted.python import log from twisted.python.compat import intToBytes from twisted.internet import defer fr...
--- +++ @@ -3,6 +3,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A POP3 client protocol implementation. + +Don't use this module directly. Use twisted.mail.pop3 instead. + +@author: Jp Calderone +""" import re from hashlib import md5 @@ -24,11 +31,37 @@ class _ListSette...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/pop3client.py
Write docstrings for backend logic
# -*- test-case-name: twisted.test.test_adbapi -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import sys from twisted.internet import threads from twisted.python import reflect, log, compat class ConnectionLost(Exception): class Connection(object): def __init__(self, pool): ...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An asynchronous mapping to U{DB-API +2.0<http://www.python.org/topics/database/DatabaseAPI-2.0.html>}. +""" import sys @@ -10,10 +14,21 @@ class ConnectionLost(Exception): + """ + This exception mean...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/enterprise/adbapi.py
Generate docstrings for each module
# -*- test-case-name: twisted.mail.test.test_mail -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.mail import smtp from twisted.python import log from twisted.internet.address import UNIXAddress import os try: import cPickle as pickle except ImportError: import pickl...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support for relaying mail. +""" from twisted.mail import smtp from twisted.python import log @@ -17,6 +20,9 @@ class DomainQueuer: + """ + An SMTP domain which add messages to a queue intended for rela...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/relay.py
Write docstrings for utility functions
# -*- test-case-name: twisted.mail.test.test_mail -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.mail import pop3 from twisted.mail import smtp from twisted.internet import protocol from twisted.internet import defer from twis...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Mail protocol support. +""" from __future__ import absolute_import, division @@ -23,16 +26,53 @@ @implementer(smtp.IMessageDelivery) class DomainDeliveryBase: + """ + A base class for message delivery ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/protocols.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.names.test.test_hosts -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python.compat import nativeString from twisted.names import dns from twisted.python import failure from twisted.python.filepath...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +hosts(5) support. +""" from __future__ import division, absolute_import @@ -15,6 +18,19 @@ from twisted.names import common def searchFileForAll(hostsFile, name): + """ + Search the given file, which i...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/hosts.py
Add documentation for all methods
# -*- test-case-name: twisted.names.test.test_resolve -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer from twisted.internet import defer, interfaces from twisted.names import dns, common, error clas...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Lookup a name using multiple resolvers. + +Future Plans: This needs someway to specify which resolver answered +the query, or someway to specify (authority|ttl|cache behavior|more?) +""" from __future__ import d...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/resolve.py
Add docstrings with type hints explained
# -*- test-case-name: twisted.mail.test.test_mailmail -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function import email.utils import os import sys import getpass try: # Python 3 from configparser import ConfigParser except ImportError: # Python...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation module for the I{mailmail} command. +""" from __future__ import print_function @@ -42,6 +45,19 @@ class Options: + """ + Store the values of the parsed command-line options to the I{mai...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/scripts/mailmail.py
Create docstrings for reusable components
# -*- test-case-name: twisted.names.test.test_rootresolve -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python.failure import Failure from twisted.internet import defer from twisted.names import dns, common, error class _DummyController: def messageReceived(self, *arg...
--- +++ @@ -2,6 +2,16 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Resolver implementation for querying successive authoritative servers to +lookup a record, starting from the root nameservers. + +@author: Jp Calderone + +todo:: + robustify it + documentation +""" from tw...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/root.py
Add verbose docstrings with examples
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import Interface class IChallengeResponse(Interface): def getChallenge(): def setResponse(response): def moreChallenges(): class IClientAuthentication(Int...
--- +++ @@ -1,6 +1,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Interfaces for L{twisted.mail}. + +@since: 16.5 +""" from __future__ import absolute_import, division @@ -8,270 +13,1079 @@ class IChallengeResponse(Interface): + """ + An C{IMAPrev4} authorization c...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/interfaces.py
Document this module using docstrings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.python.compat import _PY3, unicode class IMAP4Exception(Exception): pass class IllegalClientResponse(IMAP4Exception): pass class IllegalOperation(IMAP4Exception): ...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Exceptions in L{twisted.mail}. +""" from __future__ import absolute_import, division @@ -104,8 +107,28 @@ class SMTPClientError(SMTPError): + """ + Base class for SMTP client errors. + """ def...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/_except.py
Document all public functions with docstrings
# -*- test-case-name: twisted.names.test.test_names -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division __all__ = ['SecondaryAuthority', 'SecondaryAuthorityService'] from twisted.internet import task, defer from twisted.names import dns from tw...
--- +++ @@ -22,12 +22,35 @@ _port = 53 def __init__(self, primary, domains): + """ + @param primary: The IP address of the server from which to perform + zone transfers. + @type primary: L{str} + + @param domains: A sequence of domain names for which to perform + zon...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/names/secondary.py