From 92bd2e74804bdddb6600940886782e7e7c6b4ead Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 26 Nov 2017 17:44:37 +0100 Subject: [PATCH 1/3] Add doc tests and spelling tests Signed-off-by: Christian Heimes --- .travis.yml | 36 ++++++--- Doc/conf.py | 7 ++ Doc/spelling_wordlist.txt | 151 ++++++++++++++++++++++++++++++++++++++ tox.ini | 17 ++++- 4 files changed, 200 insertions(+), 11 deletions(-) create mode 100644 Doc/spelling_wordlist.txt diff --git a/.travis.yml b/.travis.yml index 14c0965..581013c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,5 @@ language: python -python: -- '2.7' -- '3.3' -- '3.4' -- '3.5' -- '3.6' -# Note: when updating Python versions, also change setup.py and tox.ini - sudo: false cache: pip @@ -17,9 +9,33 @@ addons: packages: - ldap-utils - slapd + - enchant -env: - - WITH_GCOV=1 +# Note: when updating Python versions, also change setup.py and tox.ini +matrix: + include: + - python: 2.7 + env: + - TOXENV=py27 + - WITH_GCOV=1 + - python: 3.3 + env: + - TOXENV=py33 + - WITH_GCOV=1 + - python: 3.4 + env: + - TOXENV=py34 + - WITH_GCOV=1 + - python: 3.5 + env: + - TOXENV=py35 + - WITH_GCOV=1 + - python: 3.6 + env: + - TOXENV=py36 + - WITH_GCOV=1 + - python: 3.6 + env: TOXENV=doc install: - pip install "pip>=7.1.0" diff --git a/Doc/conf.py b/Doc/conf.py index 9314231..eb9f5a0 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -33,6 +33,13 @@ # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc'] +try: + import sphinxcontrib.spelling +except ImportError: + pass +else: + extensions.append('sphinxcontrib.spelling') + # Add any paths that contain templates here, relative to this directory. templates_path = ['.templates'] diff --git a/Doc/spelling_wordlist.txt b/Doc/spelling_wordlist.txt new file mode 100644 index 0000000..fcc227f --- /dev/null +++ b/Doc/spelling_wordlist.txt @@ -0,0 +1,151 @@ +args +async +attr +attrlist +attrList +attrs +attrsonly +attrsOnly +attrtype +authzId +automagically +backend +behaviour +BER +bindname +boolean +booleanValue +Bytestrings +cancelled +canonicalization +cb +cfg +changeNumber +changesOnly +changeType +changeTypes +cidict +clientctrls +conf +Continously +controlType +controlValue +criticality +cryptographic +cyrus +defresult +dereferenced +dereferencing +desc +directoryOperation +distinguished +distributedOperation +dit +dn +DN +dSAOperation +encodedControlValue +encodedResponseValue +extype +exvalue +favour +filterstr +filterStr +formatOID +func +heimdal +hostport +hrefTarget +hrefText +ignoreResultsNumber +integerValue +Interoperability +isn +Keepalive +Kerberos +keyerror +knownLDAPControls +kwarg +ldap +ldapadd +ldapControls +ldapControlTuples +ldapdelete +ldapi +LDAPObject +ldaps +ldapurl +ldapwhoami +ldif +LDIFWriter +libldap +libs +Libs +modlist +modrdn +msgid +multi +nameoroid +nots +Novell +objectClass +oc +oid +oids +openldap +postalAddress +pre +previousDN +processResultsCount +Proxied +py +rdn +reentrant +refmodule +refreshAndPersist +refreshDeletes +refreshOnly +requestName +requestValue +resiter +respvalue +ResultProcessor +returnECs +ruleid +rundir +sasl +searchRoot +searchScope +sed +serverctrls +sessionSourceIp +sessionSourceName +sessionTrackingIdentifier +sizelimit +slapd +stderr +stdout +str +Subclasses +subentry +subschema +substr +subtree +syncrepl +syntaxes +timelimit +tracebacks +tuple +tuples +UDP +Umich +unparsing +unsigend +uri +urlPrefix +urlscheme +userApplications +userPassword +usr +uuids +whitespace diff --git a/tox.ini b/tox.ini index 22ca4a8..51f8981 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ [tox] # Note: when updating Python versions, also change setup.py and .travis.yml -envlist = py27,py33,py34,py35,py36,coverage-report +envlist = py27,py33,py34,py35,py36,doc,coverage-report [testenv] deps = coverage @@ -31,3 +31,18 @@ commands = {envpython} -m coverage combine {envpython} -m coverage report --show-missing {envpython} -m coverage html + +[testenv:doc] +basepython = python3 +deps = + docutils + markdown + sphinx + sphinxcontrib-spelling +commands = + {envpython} setup.py check --restructuredtext --metadata --strict + {envpython} -m markdown README -f {envtmpdir}/README.html + {envpython} -m sphinx -v -W -b html -d {envtmpdir}/doctrees \ + {toxinidir}/Doc {envtmpdir}/html + {envpython} -m sphinx -v -W -b spelling -d {envtmpdir}/doctrees \ + {toxinidir}/Doc {envtmpdir}/spelling From 16e8529a5cb50417ed41a89311c48b891c9e78d8 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 28 Nov 2017 15:23:15 +0100 Subject: [PATCH 2/3] Fix spelling errors Signed-off-by: Christian Heimes --- Doc/faq.rst | 2 +- Doc/index.rst | 2 +- Doc/installing.rst | 2 +- Doc/reference/ldap.rst | 10 +++++----- Doc/reference/ldapurl.rst | 4 ++-- Lib/ldap/__init__.py | 2 +- Lib/ldap/async.py | 2 +- Lib/ldap/constants.py | 2 +- Lib/ldap/controls/__init__.py | 2 +- Lib/ldap/controls/deref.py | 2 +- Lib/ldap/controls/psearch.py | 4 ++-- Lib/ldap/controls/sss.py | 2 +- Lib/ldap/controls/vlv.py | 2 +- Lib/ldap/filter.py | 2 +- Lib/ldap/ldapobject.py | 2 +- Lib/ldap/sasl.py | 2 +- Lib/ldap/syncrepl.py | 2 +- Lib/ldif.py | 6 +++--- Lib/slapdtest.py | 2 +- README | 2 +- 20 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Doc/faq.rst b/Doc/faq.rst index 511735a..58bb81e 100644 --- a/Doc/faq.rst +++ b/Doc/faq.rst @@ -24,7 +24,7 @@ Usage **A0**: Yes, from 3.0 on. **A1**. For earlier versions, there's `pyldap`_, an independent fork - now merged into pyhon-ldap. + now merged into python-ldap. .. _pyldap: https://pypi.python.org/pypi/pyldap diff --git a/Doc/index.rst b/Doc/index.rst index aa93092..f478d10 100644 --- a/Doc/index.rst +++ b/Doc/index.rst @@ -63,7 +63,7 @@ Contents Bytes/text management --------------------- -The LDAP protocol states that some fields (distinguised names, relative distinguished names, +The LDAP protocol states that some fields (distinguished names, relative distinguished names, attribute names, queries) be encoded in UTF-8; some other (mostly attribute *values*) **MAY** contain any type of data, and thus be treated as bytes. diff --git a/Doc/installing.rst b/Doc/installing.rst index cc0ee01..c78bd7f 100644 --- a/Doc/installing.rst +++ b/Doc/installing.rst @@ -60,7 +60,7 @@ to get up to date information which versions are available. Windows ------- -Unoficial packages for Windows are available on +Unofficial packages for Windows are available on `Christoph Gohlke's page `_. diff --git a/Doc/reference/ldap.rst b/Doc/reference/ldap.rst index c80e386..8844e59 100644 --- a/Doc/reference/ldap.rst +++ b/Doc/reference/ldap.rst @@ -40,7 +40,7 @@ This module defines the following functions: when using multiple URIs you cannot determine to which URI your client gets connected. - Note that internally the OpenLDAP funtion + Note that internally the OpenLDAP function `ldap_initialize(3) `_ is called which just initializes the LDAP connection struct in the C API - nothing else. Therefore the first call to an operation method (bind, @@ -141,7 +141,7 @@ following option identifiers are defined as constants: .. py:data:: OPT_DEREF - Specifies how alias derefencing is done within the underlying LDAP C lib. + Specifies how alias dereferencing is done within the underlying LDAP C lib. .. py:data:: OPT_ERROR_STRING @@ -296,7 +296,7 @@ The module defines the following exceptions: .. py:exception:: LDAPError - This is the base class of all execeptions raised by the module :py:mod:`ldap`. + This is the base class of all exceptions raised by the module :py:mod:`ldap`. Unlike the C interface, errors are not returned as result codes, but are instead turned into exceptions, raised as soon an the error condition is detected. @@ -413,7 +413,7 @@ The module defines the following exceptions: .. py:exception:: IS_LEAF - The object specified is a leaf of the diretcory tree. + The object specified is a leaf of the directory tree. Sets the :py:const:`matched` field of the exception dictionary value. .. py:exception:: LOCAL_ERROR @@ -836,7 +836,7 @@ and wait for and return with the server's result, or with This method is used to wait for and return the result of an operation previously initiated by one of the LDAP *asynchronous* operations - (eg :py:meth:`search()`, :py:meth:`modify()`, etc.) + (e.g. :py:meth:`search()`, :py:meth:`modify()`, etc.) The *msgid* parameter is the integer identifier returned by that method. The identifier is guaranteed to be unique across an LDAP session, diff --git a/Doc/reference/ldapurl.rst b/Doc/reference/ldapurl.rst index c13061c..86d0817 100644 --- a/Doc/reference/ldapurl.rst +++ b/Doc/reference/ldapurl.rst @@ -9,7 +9,7 @@ This module parses and generates LDAP URLs. It is implemented in pure Python and does not rely on any non-standard modules. Therefore it can be used stand- -alone without the rest of the python-ldap package. Compability note: This +alone without the rest of the python-ldap package. Compatibility note: This module has been solely tested on Python 2.x and above. .. seealso:: @@ -91,7 +91,7 @@ Example ^^^^^^^ Important security advice: -For security reasons you shouldn't specify passwords in LDAP URLs +For security reasons you should not specify passwords in LDAP URLs unless you really know what you are doing. The following example demonstrates how to parse a LDAP URL diff --git a/Lib/ldap/__init__.py b/Lib/ldap/__init__.py index b22a6f4..7cb16b0 100644 --- a/Lib/ldap/__init__.py +++ b/Lib/ldap/__init__.py @@ -94,5 +94,5 @@ def release(self): # More constants -# For compability of 2.3 and 2.4 OpenLDAP API +# For compatibility of 2.3 and 2.4 OpenLDAP API OPT_DIAGNOSTIC_MESSAGE = OPT_ERROR_STRING diff --git a/Lib/ldap/async.py b/Lib/ldap/async.py index 0dd4940..23c5660 100644 --- a/Lib/ldap/async.py +++ b/Lib/ldap/async.py @@ -36,7 +36,7 @@ def __str__(self): class AsyncSearchHandler: """ - Class for stream-processsing LDAP search results + Class for stream-processing LDAP search results Arguments: diff --git a/Lib/ldap/constants.py b/Lib/ldap/constants.py index c5ac6c1..4c109ac 100644 --- a/Lib/ldap/constants.py +++ b/Lib/ldap/constants.py @@ -288,7 +288,7 @@ class Str(Constant): TLSInt('OPT_X_TLS_PEERCERT', optional=True), # only available if OpenSSL supports it => might cause - # backward compability problems + # backward compatibility problems TLSInt('OPT_X_TLS_CRLCHECK', optional=True), TLSInt('OPT_X_TLS_CRLFILE', optional=True), diff --git a/Lib/ldap/controls/__init__.py b/Lib/ldap/controls/__init__.py index 932fa53..43b938d 100644 --- a/Lib/ldap/controls/__init__.py +++ b/Lib/ldap/controls/__init__.py @@ -96,7 +96,7 @@ class attributes class LDAPControl(RequestControl,ResponseControl): """ Base class for combined request/response controls mainly - for backward-compability to python-ldap 2.3.x + for backward-compatibility to python-ldap 2.3.x """ def __init__(self,controlType=None,criticality=False,controlValue=None,encodedControlValue=None): diff --git a/Lib/ldap/controls/deref.py b/Lib/ldap/controls/deref.py index d1b5ce9..762ab85 100644 --- a/Lib/ldap/controls/deref.py +++ b/Lib/ldap/controls/deref.py @@ -26,7 +26,7 @@ # Request types #--------------------------------------------------------------------------- -# For compability with ASN.1 declaration in I-D +# For compatibility with ASN.1 declaration in I-D AttributeList = AttributeDescriptionList class DerefSpec(univ.Sequence): diff --git a/Lib/ldap/controls/psearch.py b/Lib/ldap/controls/psearch.py index 91a5c24..74e40a3 100644 --- a/Lib/ldap/controls/psearch.py +++ b/Lib/ldap/controls/psearch.py @@ -40,13 +40,13 @@ class PersistentSearchControl(RequestControl): Implements the request control for persistent search. changeTypes - List of strings specifiying the types of changes returned by the server. + List of strings specifying the types of changes returned by the server. Setting to None requests all changes. changesOnly Boolean which indicates whether only changes are returned by the server. returnECs Boolean which indicates whether the server should return an - Entry Change Notication response control + Entry Change Notification response control """ class PersistentSearchControlValue(univ.Sequence): diff --git a/Lib/ldap/controls/sss.py b/Lib/ldap/controls/sss.py index 5d4955d..a5312d2 100644 --- a/Lib/ldap/controls/sss.py +++ b/Lib/ldap/controls/sss.py @@ -126,7 +126,7 @@ def decodeControlValue(self, encoded): self.attributeType = attribute_type else: self.attributeType = None - # backward compability class attributes + # backward compatibility class attributes self.result = self.sortResult self.attribute_type_error = self.attributeType diff --git a/Lib/ldap/controls/vlv.py b/Lib/ldap/controls/vlv.py index 74d107b..9fea2f0 100644 --- a/Lib/ldap/controls/vlv.py +++ b/Lib/ldap/controls/vlv.py @@ -134,7 +134,7 @@ def decodeControlValue(self,encoded): self.contextID = str(context_id) else: self.contextID = None - # backward compability class attributes + # backward compatibility class attributes self.target_position = self.targetPosition self.content_count = self.contentCount self.result = self.virtualListViewResult diff --git a/Lib/ldap/filter.py b/Lib/ldap/filter.py index f5d9278..56665dc 100644 --- a/Lib/ldap/filter.py +++ b/Lib/ldap/filter.py @@ -3,7 +3,7 @@ See https://www.python-ldap.org/ for details. -Compability: +Compatibility: - Tested with Python 2.0+ """ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index 36f98cf..c5e62bd 100644 --- a/Lib/ldap/ldapobject.py +++ b/Lib/ldap/ldapobject.py @@ -647,7 +647,7 @@ def result(self,msgid=ldap.RES_ANY,all=1,timeout=None): This method is used to wait for and return the result of an operation previously initiated by one of the LDAP asynchronous - operation routines (eg search(), modify(), etc.) They all + operation routines (e.g. search(), modify(), etc.) They all returned an invocation identifier (a message id) upon successful initiation of their operation. This id is guaranteed to be unique across an LDAP session, and can be used to request the diff --git a/Lib/ldap/sasl.py b/Lib/ldap/sasl.py index b54bf2a..cc0a2ea 100644 --- a/Lib/ldap/sasl.py +++ b/Lib/ldap/sasl.py @@ -55,7 +55,7 @@ def callback(self, cb_id, challenge, prompt, defresult): The callback method will be called by the sasl_bind_s() method several times. Each time it will provide the id, which tells us what kind of information is requested (the CB_* - constants above). The challenge might be a short (english) text + constants above). The challenge might be a short (English) text or some binary string, from which the return value is calculated. The prompt argument is always a human-readable description string; The defresult is a default value provided by the sasl library diff --git a/Lib/ldap/syncrepl.py b/Lib/ldap/syncrepl.py index 8442726..35d4c45 100644 --- a/Lib/ldap/syncrepl.py +++ b/Lib/ldap/syncrepl.py @@ -484,7 +484,7 @@ def syncrepl_set_cookie(self, cookie): def syncrepl_get_cookie(self): """ - Called by syncrepl_search() to retreive the cookie stored by syncrepl_set_cookie() + Called by syncrepl_search() to retrieve the cookie stored by syncrepl_set_cookie() """ pass diff --git a/Lib/ldif.py b/Lib/ldif.py index 82c4e3f..aead2ef 100644 --- a/Lib/ldif.py +++ b/Lib/ldif.py @@ -209,7 +209,7 @@ def unparse(self,dn,record): def CreateLDIF(dn,record,base64_attrs=None,cols=76): """ Create LDIF single formatted record including trailing empty line. - This is a compability function. Use is deprecated! + This is a compatibility function. Use is deprecated! dn string-representation of distinguished name @@ -449,7 +449,7 @@ def parse_entry_records(self): def parse(self): """ - Invokes LDIFParser.parse_entry_records() for backward compability + Invokes LDIFParser.parse_entry_records() for backward compatibility """ return self.parse_entry_records() # parse() @@ -633,7 +633,7 @@ def handle(self,dn,entry): def ParseLDIF(f,ignore_attrs=None,maxentries=0): """ Parse LDIF records read from file. - This is a compability function. Use is deprecated! + This is a compatibility function. Use is deprecated! """ ldif_parser = LDIFRecordList( f,ignored_attr_types=ignore_attrs,max_entries=maxentries,process_url_schemes=0 diff --git a/Lib/slapdtest.py b/Lib/slapdtest.py index 182097a..948ec09 100644 --- a/Lib/slapdtest.py +++ b/Lib/slapdtest.py @@ -83,7 +83,7 @@ class SlapdObject(object): This class creates a temporary data store for slapd, runs it listening on a private Unix domain socket and TCP port, - and initialises it with a top-level entry and the root user. + and initializes it with a top-level entry and the root user. When a reference to an instance of this class is lost, the slapd server is shut down. diff --git a/README b/README index 2a88bf2..81db9bb 100644 --- a/README +++ b/README @@ -14,7 +14,7 @@ stuff (e.g. processing LDIF, LDAPURLs, LDAPv3 sub-schema, etc.). Not included: Direct BER support -See INSTALL for version compability +See INSTALL for version compatibility See TODO for planned features. Contributors welcome. From 7405d120c6d7f6e3b5720e6b58cd02901fc75bd2 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 28 Nov 2017 15:49:57 +0100 Subject: [PATCH 3/3] Doc: Fixes for the spelling wordlist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - continously → continUously - correct capitalization for Heimdal Kerberos --- Doc/installing.rst | 2 +- Doc/spelling_wordlist.txt | 3 +-- Lib/ldif.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/installing.rst b/Doc/installing.rst index c78bd7f..2ea5594 100644 --- a/Doc/installing.rst +++ b/Doc/installing.rst @@ -113,7 +113,7 @@ on the local system when building python-ldap: It is not possible and not supported to build with prior versions. - `OpenSSL`_ (optional) - `cyrus-sasl`_ (optional) -- Kerberos libraries, MIT or heimdal (optional) +- Kerberos libraries, MIT or Heimdal (optional) .. _Python: https://www.python.org/ .. _OpenLDAP: https://www.openldap.org/ diff --git a/Doc/spelling_wordlist.txt b/Doc/spelling_wordlist.txt index fcc227f..39df00f 100644 --- a/Doc/spelling_wordlist.txt +++ b/Doc/spelling_wordlist.txt @@ -27,7 +27,6 @@ changeTypes cidict clientctrls conf -Continously controlType controlValue criticality @@ -53,7 +52,7 @@ filterstr filterStr formatOID func -heimdal +Heimdal hostport hrefTarget hrefText diff --git a/Lib/ldif.py b/Lib/ldif.py index aead2ef..4735bfb 100644 --- a/Lib/ldif.py +++ b/Lib/ldif.py @@ -395,7 +395,7 @@ def _consume_empty_lines(self): def parse_entry_records(self): """ - Continously read and parse LDIF entry records + Continuously read and parse LDIF entry records """ # Local symbol for better performance next_key_and_value = self._next_key_and_value