instruction
stringclasses
100 values
code
stringlengths
78
193k
response
stringlengths
259
170k
file
stringlengths
59
203
Generate helpful docstrings for debugging
# -*- test-case-name: twisted.python.test.test_syslog -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. syslog = __import__('syslog') from twisted.python import log from twisted.python._oldstyle import _oldStyle # These defaults come from the Python syslog docs. DEFAULT_OPTIONS = 0 DEFAULT...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Classes and utility functions for integrating Twisted and syslog. + +You probably want to call L{startLogging}. +""" syslog = __import__('syslog') @@ -16,15 +21,50 @@ @_oldStyle class SyslogObserver: + "...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/syslog.py
Document classes and their methods
# -*- test-case-name: twisted.python.test.test_zippath -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import os import time import errno from zipfile import ZipFile from twisted.python.compat import comparable, cmp from twisted.python.fi...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module contains implementations of L{IFilePath} for zip files. + +See the constructor of L{ZipArchive} for use. +""" from __future__ import absolute_import, division @@ -25,8 +30,18 @@ @comparable @imple...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/zippath.py
Generate helpful docstrings for debugging
# -*- test-case-name: twisted.test.test_usage -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function from __future__ import division, absolute_import # System Imports import inspect import os import sys import getopt from os import path import textwrap # S...
--- +++ @@ -3,6 +3,14 @@ # See LICENSE for details. +""" +twisted.python.usage is a module for parsing/handling the +command line of your program. + +For information on how to use it, see +U{http://twistedmatrix.com/projects/core/documentation/howto/options.html}, +or doc/core/howto/options.xhtml in your Twisted di...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/usage.py
Generate docstrings for exported functions
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from win32com.shell import shell import pythoncom import os def open(filename): sc = Shortcut() sc.load(filename) return sc class Shortcut: def __init__(self, path=None, arguments=None, ...
--- +++ @@ -2,6 +2,11 @@ # See LICENSE for details. +""" +Creation of Windows shortcuts. + +Requires win32all. +""" from win32com.shell import shell import pythoncom @@ -9,6 +14,12 @@ def open(filename): + """ + Open an existing shortcut for reading. + + @return: The shortcut object + @rtype: S...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/shortcut.py
Add concise docstrings to each method
# -*- test-case-name: twisted.python.test.test_win32 -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import re import os # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp ERROR_FILE_NOT_F...
--- +++ @@ -2,6 +2,14 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Win32 utilities. + +See also twisted.python.shortcut. + +@var O_BINARY: the 'binary' mode flag on Windows, or 0 on other platforms, so it + may safely be OR'ed into a mask for os.open. +""" from __future__ im...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/win32.py
Create simple docstrings for beginners
# -*- test-case-name: twisted.python.test.test_zipstream -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import zipfile import os.path import zlib import struct _fileHeaderSize = struct.calcsize(zipfile.structFileHeader) class ChunkingZipFile(zipfile.ZipFile): def readfile(self, na...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An incremental approach to unzipping files. This allows you to unzip a little +bit of a file at a time, which means you can report progress as a file unzips. +""" import zipfile import os.path @@ -12,8 +16,15 ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/zipstream.py
Generate descriptive docstrings automatically
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # import os from twisted.internet import process, reactor, fdesc from twisted.internet.protocol import Protocol, ServerFactory from twisted.protocols import wire # A dict of known 'internal' services (i.e. those that don't involve spawning # ...
--- +++ @@ -3,6 +3,14 @@ # +""" +Twisted inetd. + +Maintainer: Andrew Bennetts + +Future Plans: Bugfixes. Specifically for UDP and Sun-RPC, which don't work +correctly yet. +""" import os @@ -22,6 +30,7 @@ class InetdProtocol(Protocol): + """Forks a child process on connectionMade, passing...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/runner/inetd.py
Write clean docstrings for readability
# -*- test-case-name: twisted.test.test_ftp_options -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.application import internet from twisted.cred import portal, checkers, strcred from twisted.protocols import ftp from twisted.python import usage, deprecate, versions import ...
--- +++ @@ -3,6 +3,9 @@ # See LICENSE for details. +""" +I am the support module for making a ftp server with twistd. +""" from twisted.application import internet from twisted.cred import portal, checkers, strcred @@ -36,6 +39,10 @@ def opt_password_file(self, filename): + """ + Specify a...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/tap/ftp.py
Annotate my code with docstrings
# -*- test-case-name: twisted.runner.test.test_procmon -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import attr import incremental from twisted.python import log, deprecate from twisted.internet import error, protocol, reactor as _reactor from twisted.application import service from twi...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support for starting, monitoring, and restarting child process. +""" import attr import incremental @@ -12,6 +15,25 @@ @attr.s(frozen=True) class _Process(object): + """ + The parameters of a process to...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/runner/procmon.py
Add docstrings with type hints explained
# -*- test-case-name: twisted.spread.test.test_banana -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import copy, struct from io import BytesIO from twisted.internet import protocol from twisted.persisted import styles from twisted.python...
--- +++ @@ -2,6 +2,15 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Banana -- s-exp based protocol. + +Future Plans: This module is almost entirely stable. The same caveat applies +to it as applies to L{twisted.spread.jelly}, however. Read its future plans +for more details. + +@...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/banana.py
Document functions with detailed explanations
# -*- test-case-name: twisted.web.test.test_http2 -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import io import warnings import sys from collections import deque from zope.interface import implementer import priority import h2.config ...
--- +++ @@ -2,6 +2,17 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +HTTP2 Implementation + +This is the basic server-side protocol implementation used by the Twisted +Web server for HTTP2. This functionality is intended to be combined with the +HTTP/1.1 and HTTP/1.0 functionality ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_http2.py
Document my Python code with docstrings
# -*- test-case-name: twisted.runner.test.test_inetdconf -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # Various exceptions class InvalidConfError(Exception): class InvalidInetdConfError(InvalidConfError): class InvalidServicesConfError(InvalidConfError): class UnknownService(Ex...
--- +++ @@ -2,30 +2,59 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Parser for inetd.conf files +""" # Various exceptions class InvalidConfError(Exception): + """ + Invalid configuration file + """ class InvalidInetdConfError(InvalidConfError): + """ + In...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/runner/inetdconf.py
Write clean docstrings for readability
# -*- test-case-name: twisted.test.test_twistd -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division, print_function import errno import os import pwd import sys import traceback from twisted.python import log, logfile, usage from twisted.python....
--- +++ @@ -71,6 +71,9 @@ def opt_version(self): + """ + Print version information and exit. + """ print('twistd (the Twisted daemon) {}'.format(copyright.version), file=self.stdout) print(copyright.copyright, file=self.stdout) @@ -114,6 +117,20 @@ class...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/scripts/_twistd_unix.py
Generate documentation strings for clarity
# -*- test-case-name: twisted.web.test.test_newclient -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __metaclass__ = type import re from zope.interface import implementer from twisted.python.compat import networkString from twisted.pytho...
--- +++ @@ -2,6 +2,29 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An U{HTTP 1.1<http://www.w3.org/Protocols/rfc2616/rfc2616.html>} client. + +The way to use the functionality provided by this module is to: + + - Connect a L{HTTP11ClientProtocol} to an HTTP server + - Create a L...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_newclient.py
Document my Python code with docstrings
# -*- test-case-name: twisted.runner.test.test_procmontap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python import usage from twisted.runner.procmon import ProcessMonitor class Options(usage.Options): synopsis = "[procmon options] commandline" optParameters = ...
--- +++ @@ -2,12 +2,18 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support for creating a service which runs a process monitor. +""" from twisted.python import usage from twisted.runner.procmon import ProcessMonitor class Options(usage.Options): + """ + Define the ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/runner/procmontap.py
Generate NumPy-style docstrings
# -*- test-case-name: twisted.runner.test.test_inetdtap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import pwd, grp, socket from twisted.runner import inetd, inetdconf from twisted.python import log, usage from twisted.internet.protocol import ServerFactory from twisted.application im...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Twisted inetd TAP support + +The purpose of inetdtap is to provide an inetd-like server, to allow Twisted to +invoke other programs to handle incoming sockets. +This is a useful thing as a "networking swiss army kn...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/runner/inetdtap.py
Add docstrings that explain inputs and outputs
# -*- test-case-name: twisted.web.test.test_stan -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.python.compat import iteritems class slot(object): def __init__(self, name, default=None, filename=None, lineNumber=None, ...
--- +++ @@ -2,6 +2,24 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An s-expression-like syntax for expressing xml in pure python. + +Stan tags allow you to build XML documents using Python. + +Stan is a DOM, or Document Object Model, implemented using basic Python types +and funct...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_stan.py
Add docstrings to incomplete code
# -*- test-case-name: twisted.web.test.test_flatten -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from io import BytesIO from sys import exc_info from types import GeneratorType from traceback import extract_tb try: from inspect imp...
--- +++ @@ -2,6 +2,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Context-free flattener/serializer for rendering Python objects, possibly +complex or arbitrarily nested, as strings. +""" from __future__ import division, absolute_import @@ -26,6 +30,20 @@ def escapeForCo...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_flatten.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 # NOTE: this module should NOT import pb; it is supposed to be a module which # abstractly defines remotely accessible types. Many of these t...
--- +++ @@ -2,6 +2,19 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module represents flavors of remotely accessible objects. + +Currently this is only objects accessible through Perspective Broker, but will +hopefully encompass all forms of remote access which can emulate sub...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/flavors.py
Document functions with clear intent
# -*- test-case-name: twisted.trial._dist.test.test_disttrial -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os import sys from twisted.python.filepath import FilePath from twisted.python.modules import theSystemPath from twisted.internet.defer import DeferredList from twisted.int...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module contains the trial distributed runner, the management class +responsible for coordinating all of trial's behavior at the highest level. + +@since: 12.3 +""" import os import sys @@ -21,9 +27,23 @@ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/disttrial.py
Replace inline comments with docstrings
# -*- test-case-name: twisted.web.test.test_html -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python import log from twisted.python.compat import NativeStringIO as StringIO, escape from twisted.python.deprecate import deprecated from incremental import Version @deprecat...
--- +++ @@ -3,6 +3,8 @@ # See LICENSE for details. +"""I hold HTML generation helpers. +""" from twisted.python import log from twisted.python.compat import NativeStringIO as StringIO, escape @@ -13,6 +15,7 @@ @deprecated(Version('Twisted', 15, 3, 0), replacement='twisted.web.template') def PRE(text): + "...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/html.py
Add detailed docstrings explaining each function
# -*- test-case-name: twisted.web.test.test_webclient,twisted.web.test.test_agent -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os import collections import warnings try: from urlparse import urlunparse, urljoin, urldefrag exc...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +HTTP client. +""" from __future__ import division, absolute_import @@ -49,9 +52,28 @@ class PartialDownloadError(error.Error): + """ + Page was only partially downloaded, we got disconnected in middle...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/client.py
Fully document this Python code with docstrings
# -*- test-case-name: twisted.web.test.test_domhelpers -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from io import StringIO from twisted.web import microdom from twisted.web.microdom import getElementsByTagName, escape, unescape # These modules are imported here as a shortcut. escape g...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A library for performing interesting tasks with DOM objects. +""" from io import StringIO @@ -18,12 +21,20 @@ def substitute(request, node, subs): + """ + Look through the given node's children for st...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/domhelpers.py
Write docstrings for algorithm functions
# -*- test-case-name: twisted.web.test.test_error -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import try: from future_builtins import ascii except ImportError: pass __all__ = [ 'Error', 'PageRedirect', 'InfiniteRedirection', 'Rende...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Exception definitions for L{twisted.web}. +""" from __future__ import division, absolute_import try: @@ -23,6 +26,16 @@ def _codeToMessage(code): + """ + Returns the response message corresponding to a...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/error.py
Add docstrings to improve collaboration
# -*- test-case-name: twisted.trial.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import doctest import gc from twisted.python import components from twisted.trial import itrial, reporter from twisted.trial._synctest import _logObs...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Infrastructure for test running and suites. +""" from __future__ import division, absolute_import @@ -20,8 +23,15 @@ class TestSuite(pyunit.TestSuite): + """ + Extend the standard library's C{TestSuit...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_asyncrunner.py
Add docstrings to improve readability
# -*- test-case-name: twisted.trial._dist.test.test_distreporter -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from twisted.trial.itrial import IReporter from twisted.python.components import proxyForInterface @implementer(IReporter) class Dist...
--- +++ @@ -3,6 +3,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +The reporter is not made to support concurrent test running, so we will +hold test results in here and only send them to the reporter once the +test is over. + +@since: 12.3 +""" from zope.interface import imple...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/distreporter.py
Write beginner-friendly docstrings
# -*- test-case-name: twisted.web.test.test_distrib -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System Imports import os, copy try: import pwd except ImportError: pwd = None from io import BytesIO from xml.dom.minidom import getDOMImplementation # Twisted Imports from twist...
--- +++ @@ -2,6 +2,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Distributed web servers. + +This is going to have to be refactored so that argument parsing is done +by each subprocess and not by the main web server (i.e. GET, POST etc.). +""" # System Imports import os, cop...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/distrib.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.web.test.test_static -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import errno import itertools import mimetypes import os import time import warnings from zope.interface import implementer from twisted.we...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Static resources for L{twisted.web}. +""" from __future__ import division, absolute_import @@ -43,8 +46,19 @@ class Data(resource.Resource): + """ + This is a static, in-memory resource. + """ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/static.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.web.test.test_proxy -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.python.compat import urllib_parse, urlquote from twisted.internet import reactor from twisted.internet.protocol import ClientFacto...
--- +++ @@ -2,6 +2,22 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Simplistic HTTP proxy support. + +This comes in two main variants - the Proxy and the ReverseProxy. + +When a Proxy is in use, a browser trying to connect to a server (say, +www.yahoo.com) will be intercepted by th...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/proxy.py
Add structured docstrings to improve clarity
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.protocols.amp import Command, String, Boolean, Unicode from twisted.python.compat import _PY3 NativeString = Unicode if _PY3 else String class Run(Command): arguments = [(b'testCase', NativeString())] response = [(b'succe...
--- +++ @@ -1,6 +1,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Commands for telling a worker to load tests or run tests. + +@since: 12.3 +""" from twisted.protocols.amp import Command, String, Boolean, Unicode from twisted.python.compat import _PY3 @@ -10,11 +15,17 @@ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/workercommands.py
Auto-generate documentation strings for this file
# -*- test-case-name: twisted.web.test.test_xml -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function from twisted.internet.protocol import Protocol from twisted.python.compat import unicode from twisted.python.reflect import prefixedMethodNames # Ele...
--- +++ @@ -4,6 +4,21 @@ # See LICENSE for details. +""" +*S*mall, *U*ncomplicated *X*ML. + +This is a very simple implementation of XML/HTML as a network +protocol. It is not at all clever. Its main features are that it +does not: + + - support namespaces + - mung mnemonic entity references + - validate + - ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/sux.py
Add docstrings including usage examples
# -*- test-case-name: twisted.web.test.test_tap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import os import warnings import incremental from twisted.application import service, strports from twisted.internet import interfaces, reacto...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Support for creating a service which runs a web server. +""" from __future__ import absolute_import, division @@ -19,6 +22,9 @@ from twisted.web import twcgi class Options(usage.Options): + """ + Defin...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/tap.py
Create Google-style docstrings for my code
# -*- test-case-name: twisted.web.test.test_web -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __all__ = [ 'IResource', 'getChildForRequest', 'Resource', 'ErrorPage', 'NoResource', 'ForbiddenResource', 'EncodingResourceWrapper'...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation of the lowest-level Resource class. +""" from __future__ import division, absolute_import @@ -24,6 +27,9 @@ class IResource(Interface): + """ + A web resource. + """ isLeaf = ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/resource.py
Add docstrings for utility scripts
# -*- test-case-name: twisted.trial._dist.test.test_workertrial -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import sys import os import errno def _setupPath(environ): if 'TRIAL_PYTHONPATH' in environ: sys.path[:] = environ['TRIAL_PYTHONPATH'].split(os.pathsep) _setup...
--- +++ @@ -3,6 +3,12 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation of C{AMP} worker commands, and main executable entry point for +the workers. + +@since: 12.3 +""" import sys import os @@ -11,6 +17,11 @@ def _setupPath(environ): + """ + Override C{sys...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/workertrial.py
Write Python docstrings for this snippet
# -*- test-case-name: twisted.trial._dist.test.test_workerreporter -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python.failure import Failure from twisted.python.reflect import qual from twisted.trial.reporter import TestResult from twisted.trial._dist import managercomma...
--- +++ @@ -3,6 +3,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Test reporter forwarding test results over trial distributed AMP commands. + +@since: 12.3 +""" from twisted.python.failure import Failure from twisted.python.reflect import qual @@ -12,21 +17,39 @@ class W...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/workerreporter.py
Write documentation strings for class attributes
# -*- test-case-name: twisted.trial._dist.test.test_options -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python.filepath import FilePath from twisted.python.usage import Options from twisted.scripts.trial import _BasicOptions from twisted.application.app import ReactorSel...
--- +++ @@ -3,6 +3,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Options handling specific to trial's workers. + +@since: 12.3 +""" from twisted.python.filepath import FilePath from twisted.python.usage import Options @@ -12,7 +17,14 @@ class WorkerOptions(_BasicOptions,...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/options.py
Add documentation for all methods
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import zope.interface as zi from zope.interface import Attribute class ITestCase(zi.Interface): failureException = zi.Attribute( "The exception class that is raised by failed assert...
--- +++ @@ -1,6 +1,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Interfaces for Trial. + +Maintainer: Jonathan Lange +""" from __future__ import division, absolute_import @@ -9,28 +14,52 @@ class ITestCase(zi.Interface): + """ + The interface that a test case must...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/itrial.py
Improve my code by adding docstrings
# -*- test-case-name: twisted.trial._dist.test.test_worker -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os from zope.interface import implementer from twisted.internet.protocol import ProcessProtocol from twisted.internet.interfaces import ITransport, IAddress from twisted.in...
--- +++ @@ -3,6 +3,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This module implements the worker classes. + +@since: 12.3 +""" import os @@ -23,6 +28,9 @@ class WorkerProtocol(AMP): + """ + The worker-side trial distributed protocol. + """ def __init__...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/worker.py
Generate helpful docstrings for debugging
# -*- test-case-name: twisted.web.test.test_script -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os, traceback from twisted import copyright from twisted.python.filepath import _coerceToFilesystemEncoding from twisted.python.compa...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +I contain PythonScript, which is a very simple python script resource. +""" from __future__ import division, absolute_import @@ -24,6 +27,9 @@ """ class AlreadyCached(Exception): + """ + This exception...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/script.py
Help me document legacy Python code
# -*- test-case-name: twisted.web.test.test_web -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import copy import os import re try: from urllib import quote except ImportError: from urllib.parse import quote as _quote def quot...
--- +++ @@ -2,6 +2,16 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +This is a web server which integrates with the twisted.internet infrastructure. + +@var NOT_DONE_YET: A token value which L{twisted.web.resource.IResource.render} + implementations can return to indicate that th...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/server.py
Create docstrings for API functions
# -*- test-case-name: twisted.web.test.test_httpauth -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer from twisted.cred import credentials from twisted.web.iweb import ICredentialFactory @implementer(I...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Implementation of RFC2617: HTTP Digest Authentication + +@see: U{http://www.faqs.org/rfcs/rfc2617.html} +""" from __future__ import division, absolute_import @@ -11,19 +16,41 @@ @implementer(ICredentialFacto...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_auth/digest.py
Expand my code with proper documentation strings
# -*- test-case-name: twisted.web.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import Interface, Attribute from twisted.internet.interfaces import IPushProducer from twisted.cred.credentials import IUsernameDigestHash class IRequest(Interface): method = ...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Interface definitions for L{twisted.web}. + +@var UNKNOWN_LENGTH: An opaque object which may be used as the value of + L{IBodyProducer.length} to indicate that the length of the entity + body is not known in ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/iweb.py
Generate docstrings for script automation
# -*- test-case-name: twisted.web.test.test_httpauth -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.cred import error from twisted.cred.credentials import Anonymous from twisted.python.compat import unicode from twisted.python...
--- +++ @@ -2,6 +2,16 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A guard implementation which supports HTTP header-based authentication +schemes. + +If no I{Authorization} header is supplied, an anonymous login will be +attempted by using a L{Anonymous} credentials object. If s...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_auth/wrapper.py
Create docstrings for API functions
# -*- test-case-name: twisted.trial.test.test_reporter -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # # Maintainer: Jonathan Lange from __future__ import division, absolute_import import sys import os import time import warnings import unittest as pyunit from collections import Ordere...
--- +++ @@ -4,6 +4,9 @@ # # Maintainer: Jonathan Lange +""" +Defines classes that handle the results of tests. +""" from __future__ import division, absolute_import @@ -33,10 +36,17 @@ class BrokenTestCaseWarning(Warning): + """ + Emitted as a warning when an exception occurs in one of setUp or tearDo...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/reporter.py
Add inline docstrings for readability
# -*- test-case-name: twisted.web.test.test_xmlrpc -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python.compat import _PY3, intToBytes, nativeString, urllib_parse from twisted.python.compat import unicode # System Imports im...
--- +++ @@ -2,6 +2,14 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A generic resource for publishing objects via XML-RPC. + +Maintainer: Itamar Shtull-Trauring + +@var Fault: See L{xmlrpclib.Fault} +@type Fault: L{xmlrpclib.Fault} +""" from __future__ import division, absolute_...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/xmlrpc.py
Write reusable docstrings
# -*- test-case-name: twisted.web.test.test_http -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __all__ = [ 'SWITCHING', 'OK', 'CREATED', 'ACCEPTED', 'NON_AUTHORITATIVE_INFORMATION', 'NO_CONTENT', 'RESET_CONTENT', 'PARTIAL_CONTENT'...
--- +++ @@ -2,6 +2,30 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +HyperText Transfer Protocol implementation. + +This is the basic server-side protocol implementation used by the Twisted +Web server. It can parse HTTP 1.0 requests and supports many HTTP 1.1 +features as well. A...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/http.py
Create docstrings for all classes and functions
# -*- test-case-name: twisted.web.test.test_http_headers -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from twisted.python.compat import comparable, cmp, unicode def _dashCapitalize(name): return b'-'.join([word.capitalize() for wor...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An API for storing HTTP header names and values. +""" from __future__ import division, absolute_import @@ -9,17 +12,57 @@ def _dashCapitalize(name): + """ + Return a byte string which is capitalized u...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/http_headers.py
Add docstrings to clarify complex logic
# -*- test-case-name: twisted.web.test.test_template -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import from zope.interface import implementer from twisted.web.iweb import IRenderable from twisted.web.error import MissingRenderMethod, Unexpose...
--- +++ @@ -12,11 +12,49 @@ class Expose(object): + """ + Helper for exposing methods for various uses using a simple decorator-style + callable. + + Instances of this class can be called with one or more functions as + positional arguments. The names of these functions will be added to a list + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_element.py
Add docstrings including usage examples
# -*- test-case-name: twisted.web.test.test_cgi -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System Imports import os import urllib # Twisted Imports from twisted.internet import protocol from twisted.logger import Logger from twisted.python import filepath from twisted.spread impor...
--- +++ @@ -3,6 +3,9 @@ # See LICENSE for details. +""" +I hold resource classes and helper classes that deal with CGI scripts. +""" # System Imports import os @@ -41,8 +44,18 @@ class CGIScript(resource.Resource): + """ + L{CGIScript} is a resource which runs child processes according to the CGI + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/twcgi.py
Write docstrings that follow conventions
# -*- test-case-name: twisted.web.test.test_httpauth -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import binascii from zope.interface import implementer from twisted.cred import credentials, error from twisted.web.iweb import ICredenti...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +HTTP BASIC authentication. + +@see: U{http://tools.ietf.org/html/rfc1945} +@see: U{http://tools.ietf.org/html/rfc2616} +@see: U{http://tools.ietf.org/html/rfc2617} +""" from __future__ import division, absolute_...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_auth/basic.py
Add docstrings for better understanding
# -*- test-case-name: twisted.trial.test.test_runner -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division __all__ = [ 'TestSuite', 'DestructiveTestSuite', 'ErrorHolder', 'LoggedSuite', 'TestHolder', 'TestLoader', 'TrialRunner', 'Tri...
--- +++ @@ -2,6 +2,11 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A miscellany of code used to run Trial tests. + +Maintainer: Jonathan Lange +""" from __future__ import absolute_import, division @@ -43,6 +48,7 @@ def isPackage(module): + """Given an object return Tru...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/runner.py
Add docstrings including usage examples
# -*- test-case-name: twisted.web.test.test_template -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import __all__ = [ 'TEMPLATE_NAMESPACE', 'VALID_HTML_TAG_NAMES', 'Element', 'TagLoader', 'XMLString', 'XMLFile', 'renderer', 'flatten', 'f...
--- +++ @@ -2,6 +2,21 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +HTML rendering for twisted.web. + +@var VALID_HTML_TAG_NAMES: A list of recognized HTML tag names, used by the + L{tag} object. + +@var TEMPLATE_NAMESPACE: The XML namespace used to identify attributes and + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/template.py
Write docstrings for backend logic
# -*- test-case-name: twisted.web.test.test_xml -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # System Imports import re from io import BytesIO, StringIO # Twisted Imports from twisted.python.compat import ioType, iteritems, range, unicode from twisted.python.util import InsensitiveDic...
--- +++ @@ -2,6 +2,21 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Micro Document Object Model: a partial DOM implementation with SUX. + +This is an implementation of what we consider to be the useful subset of the +DOM. The chief advantage of this library is that, not being burd...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/microdom.py
Document classes and their methods
# -*- test-case-name: twisted.web. # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import # Twisted Imports from twisted.python import roots from twisted.web import resource class VirtualHostCollection(roots.Homogenous): entityType = resource.Re...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +I am a virtual hosts implementation. +""" from __future__ import division, absolute_import @@ -11,6 +14,10 @@ class VirtualHostCollection(roots.Homogenous): + """Wrapper for virtual hosts collection. + +...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/vhost.py
Add docstrings that explain purpose and usage
# -*- test-case-name: twisted.words.test.test_basechat -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.words.im.locals import OFFLINE, ONLINE, AWAY class ContactsList: def __init__(self, chatui): self.chatui = chatui self.contacts = {} self.online...
--- +++ @@ -2,12 +2,37 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Base classes for Instance Messenger clients. +""" from twisted.words.im.locals import OFFLINE, ONLINE, AWAY class ContactsList: + """ + A GUI object that displays a contacts list. + + @ivar chatui...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/im/basechat.py
Generate helpful docstrings for debugging
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. __metaclass__ = type from sys import exc_info from warnings import warn from zope.interface import implementer from twisted.internet.threads import blockingCallFromThread from twisted.python.compat import reraise, Sequence from twisted.python....
--- +++ @@ -1,6 +1,10 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An implementation of +U{Python Web Server Gateway Interface v1.0.1<http://www.python.org/dev/peps/pep-3333/>}. +""" __metaclass__ = type @@ -39,30 +43,85 @@ # are used to make Twisted's WSGI support compliant ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/wsgi.py
Add docstrings to incomplete code
# -*- Python -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import Interface, Attribute # (Random musings, may not reflect on current state of code:) # # Accounts have Protocol components (clients) # Persons have Conversation components # Groups have GroupConversation...
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Pan-protocol chat client. +""" from zope.interface import Interface, Attribute @@ -16,21 +19,54 @@ class IAccount(Interface): + """ + I represent a user's account with a chat service. + """ ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/im/interfaces.py
Add docstrings for utility scripts
# -*- test-case-name: twisted.web.test.test_util -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import linecache from twisted.python import urlpath from twisted.python.compat import _PY3, unicode, nativeString, escape from twisted.python....
--- +++ @@ -2,6 +2,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +An assortment of web server-related utilities. +""" from __future__ import division, absolute_import @@ -19,11 +22,41 @@ def _PRE(text): + """ + Wraps <pre> tags around some text and HTML-escape it. +...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/util.py
Add docstrings to make code maintainable
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # # Abstract representation of chat "model" classes from twisted.words.im.locals import OFFLINE, OfflineError from twisted.internet.protocol import Protocol from twisted.python.reflect import prefixedMethods from twisted.persisted import styl...
--- +++ @@ -3,6 +3,10 @@ # +"""Instance Messenger base classes for protocol support. + +You will find these useful if you're adding a new protocol to IM. +""" # Abstract representation of chat "model" classes @@ -21,9 +25,22 @@ self.account = account def getGroupCommands(self): + """finds...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/im/basesupport.py
Add docstrings following best practices
# -*- Python -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # class AccountManager: def __init__(self): self.accounts = {} def getSnapShot(self): data = [] for account in self.accounts.values(): data.append((account.accountName, account.isOn...
--- +++ @@ -7,10 +7,24 @@ class AccountManager: + """I am responsible for managing a user's accounts. + + That is, remembering what accounts are available, their settings, + adding and removal of accounts, etc. + + @ivar accounts: A collection of available accounts. + @type accounts: mapping of strin...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/im/baseaccount.py
Create documentation strings for testing functions
# -*- test-case-name: twisted.trial.test.test_util -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # from __future__ import division, absolute_import, print_function from random import randrange from twisted.internet import defer, utils, interfaces from twisted.python.failure import Fail...
--- +++ @@ -3,6 +3,20 @@ # See LICENSE for details. # +""" +A collection of utility functions and classes, used internally by Trial. + +This code is for Trial's internal use. Do NOT use this code if you are writing +tests. It is subject to change at the Trial maintainer's whim. There is +nothing here in this modu...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/util.py
Generate missing documentation strings
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from base64 import b64decode, b64encode import re from twisted.internet import defer from twisted.python.compat import unicode from twisted.words.protocols.jabber import sasl_mechanisms, xmlstream...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +XMPP-specific SASL profile. +""" from __future__ import absolute_import, division @@ -14,6 +17,9 @@ NS_XMPP_SASL = 'urn:ietf:params:xml:ns:xmpp-sasl' def get_mechanisms(xs): + """ + Parse the SASL feat...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/sasl.py
Add docstrings to my Python code
# -*- test-case-name: twisted.words.test.test_irc -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import errno, os, random, re, stat, struct, sys, time, traceback import operator import string, socket import textwrap import shlex from functools import reduce from os import path from twist...
--- +++ @@ -2,6 +2,37 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Internet Relay Chat protocol for client and server. + +Future Plans +============ + +The way the IRCClient class works here encourages people to implement +IRC clients by subclassing the ephemeral protocol class, a...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/irc.py
Please document this code using docstrings
# -*- test-case-name: twisted.words.test.test_domish -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from zope.interface import implementer, Interface, Attribute from twisted.python.compat import (_PY3, StringType, _coercedUnicode, ...
--- +++ @@ -2,6 +2,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +DOM-like XML processing support. + +This module provides support for parsing XML into DOM-like object structures +and serializing such structures to an XML string representation, optimized +for use in streaming XML...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/xish/domish.py
Write reusable docstrings
# -*- test-case-name: twisted.words.test.test_jabberxmlstream -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from binascii import hexlify from hashlib import sha1 from zope.interface import directlyProvides, implementer from twisted.int...
--- +++ @@ -3,6 +3,24 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +XMPP XML Streams + +Building blocks for setting up XML Streams, including helping classes for +doing authentication on either client or server side, and working with XML +Stanzas. + +@var STREAM_AUTHD_EVENT: Token ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/xmlstream.py
Add detailed docstrings explaining each function
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import print_function from twisted.internet import defer from twisted.internet import error from twisted.python import log from twisted.python.failure import Failure from twisted.spread import pb from twisted.words.im.locals im...
--- +++ @@ -2,6 +2,9 @@ # See LICENSE for details. +""" +L{twisted.words} support for Instance Messenger. +""" from __future__ import print_function @@ -18,6 +21,8 @@ class TwistedWordsPerson(basesupport.AbstractPerson): + """I a facade for a person you can talk to through a twisted.words service. + ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/im/pbsupport.py
Add docstrings to improve readability
# -*- test-case-name: twisted.words.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.internet.endpoints import _parse def _parseTCPSSL(factory, domain, port): return (domain, int(port), factory), {} def _parseUNIX(fa...
--- +++ @@ -3,12 +3,15 @@ # See LICENSE for details. +""" A temporary placeholder for client-capable strports, until we +sufficient use cases get identified """ from __future__ import absolute_import, division from twisted.internet.endpoints import _parse def _parseTCPSSL(factory, domain, port): + """ F...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/jstrports.py
Create docstrings for all classes and functions
# -*- test-case-name: twisted.words.test.test_xishutil -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.python import log from twisted.python.compat import iteritems from twisted.words.xish import xpath class _MethodWrapper(o...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Event Dispatching and Callback utilities. +""" from __future__ import absolute_import, division @@ -11,6 +14,9 @@ from twisted.words.xish import xpath class _MethodWrapper(object): + """ + Internal cla...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/xish/utility.py
Document this script properly
# -*- test-case-name: twisted.words.test.test_jabberxmppstringprep -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from encodings import idna from itertools import chain import stringprep # We require Unicode version 3.2. from unicodedata import ucd_3_2_0 as unicodedata from twisted.pyt...
--- +++ @@ -27,14 +27,26 @@ class ILookupTable(Interface): + """ + Interface for character lookup classes. + """ def lookup(c): + """ + Return whether character is in this table. + """ class IMappingTable(Interface): + """ + Interface for character mapping classes. ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/xmpp_stringprep.py
Add return value explanations in docstrings
# -*- test-case-name: twisted.words.test.test_jabbererror -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import copy from twisted.python.compat import unicode from twisted.words.xish import domish NS_XML = "http://www.w3.org/XML/1998/n...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +XMPP Error support. +""" from __future__ import absolute_import, division @@ -61,6 +64,25 @@ } class BaseError(Exception): + """ + Base class for XMPP error exceptions. + + @cvar namespace: The name...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/error.py
Add docstrings explaining edge cases
# -*- test-case-name: twisted.words.test.test_jabbercomponent -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import implementer from twisted.application import service from twisted.internet import defer from twisted.python import log from twisted.python.compat impor...
--- +++ @@ -3,6 +3,20 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +External server-side components. + +Most Jabber server implementations allow for add-on components that act as a +separate entity on the Jabber network, but use the server-to-server +functionality of a regular Jabb...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/component.py
Add docstrings to make code maintainable
# -*- test-case-name: twisted.words.test.test_jabbersaslmechanisms -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division import binascii, random, time, os from hashlib import md5 from zope.interface import Interface, Attribute, implementer fr...
--- +++ @@ -3,6 +3,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Protocol agnostic implementations of SASL authentication mechanisms. +""" from __future__ import absolute_import, division @@ -18,14 +21,33 @@ name = Attribute("""Common name for the SASL Mechanism.""") ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/sasl_mechanisms.py
Help me comply with documentation standards
# -*- test-case-name: twisted.words.test.test_tap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import sys, socket from twisted.application import strports from twisted.application.service import MultiService from twisted.python import usage from twisted import plugin from twisted.words...
--- +++ @@ -1,6 +1,9 @@ # -*- test-case-name: twisted.words.test.test_tap -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Shiny new words service maker +""" import sys, socket @@ -36,9 +39,16 @@ self['groups'] = [] def opt_group(self, name): + """Specify a ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/tap.py
Document functions with detailed explanations
# -*- test-case-name: twisted.words.test.test_jabberjid -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.python.compat import _PY3, unicode from twisted.words.protocols.jabber.xmpp_stringprep import nodeprep, resourceprep, nameprep class InvalidFormat(Exception): def parse(...
--- +++ @@ -3,13 +3,34 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Jabber Identifier support. + +This module provides an object to represent Jabber Identifiers (JIDs) and +parse string representations into them with proper checking for illegal +characters, case folding and canoni...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/jid.py
Generate consistent documentation across files
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import Attribute, Interface class IInitializer(Interface): class IInitiatingInitializer(IInitializer): xmlstream = Attribute("""The associated XML stream""") def initialize(): class IIQResponseTracker(Interfac...
--- +++ @@ -1,69 +1,201 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +Public Jabber Interfaces. +""" from zope.interface import Attribute, Interface class IInitializer(Interface): + """ + Interface for XML stream initializers. + + Initializers perform a step in getti...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/ijabber.py
Generate docstrings for exported functions
# -*- test-case-name: twisted.words.test.test_xmlstream -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.python import failure from twisted.python.compat import intern, unicode from twisted.internet import protocol from twiste...
--- +++ @@ -3,6 +3,33 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +XML Stream processing. + +An XML Stream is defined as a connection over which two XML documents are +exchanged during the lifetime of the connection, one for each direction. The +unit of interaction is a direct chi...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/xish/xmlstream.py
Generate docstrings for this script
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.words.protocols import irc from twisted.words.im.locals import ONLINE from twisted.internet import defer, reactor, protocol from twisted.internet.defer import succeed from twisted.words.im import basesupport, interfaces, locals from ...
--- +++ @@ -1,6 +1,9 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +IRC support for Instance Messenger. +""" from twisted.words.protocols import irc from twisted.words.im.locals import ONLINE @@ -133,6 +136,9 @@ def kickedFrom(self, channel, kicker, message): + ""...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/im/ircsupport.py
Add docstrings to incomplete code
# -*- test-case-name: twisted.words.test.test_jabberclient -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.python.compat import _coercedUnicode, unicode from twisted.words.protocols.jabber import xmlstream, sasl, error from tw...
--- +++ @@ -23,7 +23,25 @@ return xmlstream.XmlStreamFactory(a) class IQ(domish.Element): + """ + Wrapper for a Info/Query packet. + + This provides the necessary functionality to send IQs and get notified when + a result comes back. It's a subclass from L{domish.Element}, so you can use + the sta...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/client.py
Improve documentation using docstrings
# -*- test-case-name: twisted.words.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from zope.interface import Interface, Attribute class IProtocolPlugin(Interface): name = Attribute("A single word describing what kind of interface this is (eg, irc or web)") def getFactory(...
--- +++ @@ -6,42 +6,143 @@ class IProtocolPlugin(Interface): + """Interface for plugins providing an interface to a Words service + """ name = Attribute("A single word describing what kind of interface this is (eg, irc or web)") def getFactory(realm, portal): + """Retrieve a C{twisted.int...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/iwords.py
Help me add docstrings to my project
# -*- test-case-name: twisted.words.test.test_service -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from time import time, ctime from zope.interface import implementer from twisted import copyright from twisted.cred import portal, credentials, error as ecred from twisted.internet impor...
--- +++ @@ -2,6 +2,30 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +A module that needs a better name. + +Implements new cred things for words. + +How does this thing work? + + - Network connection on some port expecting to speak some protocol + + - Protocol-specific authenticati...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/service.py
Add return value explanations in docstrings
# -*- test-case-name: twisted.words.test.test_xpath -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from io import StringIO from twisted.python.compat import StringType, unicode class LiteralValue(unicode): def value(self, elem): ...
--- +++ @@ -3,6 +3,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. +""" +XPath query support. + +This module provides L{XPathQuery} to match +L{domish.Element<twisted.words.xish.domish.Element>} instances against +XPath-like expressions. +""" from __future__ import absolute_import, d...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/xish/xpath.py
Document this script properly
############################################################################## # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTW...
--- +++ @@ -9,6 +9,11 @@ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. ############################################################################## +"""Datetime interfaces. + +This module is called idatetime because if it were called datetime the import +of th...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/common/idatetime.py
Create docstrings for all classes and functions
############################################################################## # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTW...
--- +++ @@ -9,6 +9,21 @@ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. ############################################################################## +"""Implementation of interface declarations + +There are three flavors of declarations: + + - Declarations are...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/declarations.py
Provide clean and structured docstrings
from base64 import urlsafe_b64encode def headers_raw_to_dict(headers_raw): if headers_raw is None: return None headers = headers_raw.splitlines() headers_tuples = [header.split(b':', 1) for header in headers] result_dict = {} for header_item in headers_tuples: if not len(header_i...
--- +++ @@ -2,6 +2,28 @@ def headers_raw_to_dict(headers_raw): + r""" + Convert raw headers (single multi-line bytestring) + to a dictionary. + + For example: + + >>> import w3lib.http + >>> w3lib.http.headers_raw_to_dict(b"Content-type: text/html\n\rAccept: gzip\n\n") # doctest: +SKIP + {'Co...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/w3lib/http.py
Add docstrings for utility scripts
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
--- +++ @@ -11,6 +11,19 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Class advice. + +This module was adapted from 'protocols.advice', part of the Python +Enterprise Application Kit (PEAK). Please notify the PEAK authors +(pje@telecommunity.com a...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/advice.py
Document my Python code with docstrings
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
--- +++ @@ -11,69 +11,140 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Mapping Interfaces. + +Importing this module does *not* mark any standard classes +as implementing any of these interfaces. +""" from zope.interface import Interface class ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/common/mapping.py
Document this code for team use
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
--- +++ @@ -11,10 +11,21 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +""" Pretty-Print an Interface object as structured text (Yum) + +This module provides a function, asStructuredText, for rendering an +interface as structured text. +""" import zop...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/document.py
Write docstrings for data processing functions
# -*- coding: utf-8 -*- import warnings import re import six from six import moves from w3lib.util import to_bytes, to_unicode from w3lib.url import safe_url_string _ent_re = re.compile(r'&((?P<named>[a-z\d]+)|#(?P<dec>\d+)|#x(?P<hex>[a-f\d]+))(?P<semicolon>;?)', re.IGNORECASE) _tag_re = re.compile(r'<[a-zA-Z\/!].*?...
--- +++ @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +""" +Functions for dealing with markup text +""" import warnings import re @@ -18,6 +21,13 @@ def remove_entities(text, keep=(), remove_illegal=True, encoding='utf-8'): + r""" + + .. warning:: + + This function is deprecated and will be removed in fu...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/w3lib/html.py
Create docstrings for each class method
# -*- coding: utf-8 -*- import re, codecs, encodings from sys import version_info _HEADER_ENCODING_RE = re.compile(r'charset=([\w-]+)', re.I) def http_content_type_encoding(content_type): if content_type: match = _HEADER_ENCODING_RE.search(content_type) if match: return resolve_encodi...
--- +++ @@ -1,10 +1,20 @@ # -*- coding: utf-8 -*- +""" +Functions for handling encoding of web pages +""" import re, codecs, encodings from sys import version_info _HEADER_ENCODING_RE = re.compile(r'charset=([\w-]+)', re.I) def http_content_type_encoding(content_type): + """Extract the encoding in the conten...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/w3lib/encoding.py
Generate descriptive docstrings automatically
import sys from math import ceil from typing import Dict, Optional import logging from rich.logging import RichHandler from ciphey.iface import Checker, Config, ParamSpec, T, registry sys.path.append("..") try: import mathsHelper as mh except ModuleNotFoundError: import ciphey.mathsHelper as mh @registry.r...
--- +++ @@ -1,189 +1,297 @@-import sys -from math import ceil -from typing import Dict, Optional - -import logging -from rich.logging import RichHandler - -from ciphey.iface import Checker, Config, ParamSpec, T, registry - -sys.path.append("..") -try: - import mathsHelper as mh -except ModuleNotFoundError: - impo...
https://raw.githubusercontent.com/bee-san/Ciphey/HEAD/ciphey/basemods/Checkers/brandon.py
Replace inline comments with docstrings
import base64 import codecs import os import re import posixpath import warnings import string from collections import namedtuple, OrderedDict import six from six.moves.urllib.parse import (urljoin, urlsplit, urlunsplit, urldefrag, urlencode, urlparse, ...
--- +++ @@ -1,3 +1,7 @@+""" +This module contains general purpose URL functions not found in the standard +library. +""" import base64 import codecs import os @@ -33,6 +37,22 @@ _ascii_tab_newline_re = re.compile(r'[\t\n\r]') # see https://infra.spec.whatwg.org/#ascii-tab-or-newline def safe_url_string(url, enco...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/w3lib/url.py
Generate missing documentation strings
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
--- +++ @@ -11,14 +11,18 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Interfaces for standard python exceptions +""" from zope.interface import Interface from zope.interface import classImplements class IException(Interface): + "Interface ...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/common/interfaces.py
Add docstrings explaining edge cases
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
--- +++ @@ -11,75 +11,155 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Sequence Interfaces + +Importing this module does *not* mark any standard classes +as implementing any of these interfaces. +""" __docformat__ = 'restructuredtext' from zop...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/common/sequence.py
Include argument descriptions in docstrings
import six def str_to_unicode(text, encoding=None, errors='strict'): if encoding is None: encoding = 'utf-8' if isinstance(text, bytes): return text.decode(encoding, errors) return text def unicode_to_str(text, encoding=None, errors='strict'): if encoding is None: encoding = 'u...
--- +++ @@ -15,6 +15,8 @@ return text def to_unicode(text, encoding=None, errors='strict'): + """Return the unicode representation of a bytes object `text`. If `text` + is already an unicode object, return it as-is.""" if isinstance(text, six.text_type): return text if not isinstance(tex...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/w3lib/util.py
Add detailed documentation for each class
import re from typing import Dict, List, Optional import logging from rich.logging import RichHandler from ciphey.iface import ( Config, Cracker, CrackInfo, CrackResult, ParamSpec, Translation, registry, ) @registry.register class Soundex(Cracker[str]): def getInfo(self, ctext: str) ...
--- +++ @@ -29,6 +29,9 @@ return "soundex" def attemptCrack(self, ctext: str) -> List[CrackResult]: + """ + Attempts to crack Soundex by generating all possible combinations. + """ logging.debug("Attempting Soundex cracker") word_list = [] sentences = [] @@...
https://raw.githubusercontent.com/bee-san/Ciphey/HEAD/ciphey/basemods/Crackers/soundex.py
Generate descriptive docstrings automatically
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
--- +++ @@ -11,6 +11,8 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Verify interface implementations +""" from zope.interface.exceptions import BrokenImplementation, DoesNotImplement from zope.interface.exceptions import BrokenMethodImplementati...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/verify.py
Generate docstrings for exported functions
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
--- +++ @@ -11,9 +11,28 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Compute a resolution order for an object and its bases +""" __docformat__ = 'restructuredtext' def _mergeOrderings(orderings): + """Merge multiple orderings so that within...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/ro.py
Generate docstrings for script automation
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
--- +++ @@ -11,6 +11,8 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Interface Package Interfaces +""" __docformat__ = 'restructuredtext' from zope.interface.interface import Attribute @@ -21,20 +23,33 @@ _BLANK = u'' class IElement(Interfac...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/interfaces.py
Generate NumPy-style docstrings
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
--- +++ @@ -11,10 +11,15 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Interface-specific exceptions +""" class Invalid(Exception): + """A specification is violated + """ class DoesNotImplement(Invalid): + """ This object does not im...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/exceptions.py
Add documentation for all methods
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
--- +++ @@ -11,6 +11,8 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +"""Interface object implementation +""" from __future__ import generators import sys @@ -38,6 +40,7 @@ def taggedValue(key, value): + """Attaches a tagged value to an inte...
https://raw.githubusercontent.com/wistbean/learn_python3_spider/HEAD/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/interface.py