From 51ebed617f7e1655acc4ccc349cca98ee78394b9 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Wed, 14 Mar 2018 16:58:14 -0700 Subject: [PATCH] Trim white space throughout the project Many editors clean up trailing white space on save. By removing it all in one go, it helps keep future diffs cleaner by avoiding spurious white space changes on unrelated lines. --- .gitignore | 1 - Build/build-openbsd/Makefile | 2 +- Build/build-openbsd/pkg/DESCR | 2 +- Build/setup.cfg.mingw | 4 ++-- Build/setup.cfg.suse-linux | 2 +- Demo/Lib/ldap/async/deltree.py | 2 +- Demo/Lib/ldif/ldifcopy.py | 1 - Demo/matchedvalues.py | 1 - Demo/options.py | 4 ---- Demo/pyasn1/sessiontrack.py | 1 - Demo/pyasn1/syncrepl.py | 4 ++-- Demo/schema.py | 2 +- Demo/schema_tree.py | 1 - Demo/simple.py | 5 ++--- Demo/simplebrowse.py | 5 ++--- Doc/installing.rst | 1 - Doc/reference/ldap-async.rst | 1 - Doc/reference/ldap-dn.rst | 1 - Doc/reference/ldap-extop.rst | 1 - Doc/reference/ldap-filter.rst | 1 - Doc/reference/ldap-sasl.rst | 3 +-- Doc/reference/ldap-syncrepl.rst | 1 - Doc/reference/ldap.rst | 5 ++--- Doc/reference/ldapurl.rst | 1 - Doc/reference/ldif.rst | 1 - Doc/sample_workflow.rst | 1 - Lib/ldap/constants.py | 2 +- Lib/ldap/controls/deref.py | 2 +- Lib/ldapurl.py | 1 - Modules/LDAPObject.c | 20 ++++++++++---------- Tests/t_ldap_asyncsearch.py | 1 - Tests/t_ldap_sasl.py | 1 - Tests/t_ldif.py | 4 ++-- setup.cfg | 4 ++-- setup.py | 2 +- tox.ini | 2 +- 36 files changed, 34 insertions(+), 59 deletions(-) diff --git a/.gitignore b/.gitignore index 962248fe..0034b3a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - # Auto-generated .*.swp *.pyc diff --git a/Build/build-openbsd/Makefile b/Build/build-openbsd/Makefile index ce91fafe..40ad81cb 100644 --- a/Build/build-openbsd/Makefile +++ b/Build/build-openbsd/Makefile @@ -10,7 +10,7 @@ HOMEPAGE= https://www.python-ldap.org/ FAKE= Yes CONFIGURE_STYLE= gnu SEPARATE_BUILD= Yes -EXTRACT_ONLY= +EXTRACT_ONLY= CONFIGURE_ARGS+= --with-ldap=${LOCALBASE} diff --git a/Build/build-openbsd/pkg/DESCR b/Build/build-openbsd/pkg/DESCR index d3cf0ccf..9e58e627 100644 --- a/Build/build-openbsd/pkg/DESCR +++ b/Build/build-openbsd/pkg/DESCR @@ -1,2 +1,2 @@ -This Python library provides access to the LDAP (Lightweight Directory Access +This Python library provides access to the LDAP (Lightweight Directory Access Protocol) RFC1823 C interface. diff --git a/Build/setup.cfg.mingw b/Build/setup.cfg.mingw index 16ab57fc..ffbd0d8a 100644 --- a/Build/setup.cfg.mingw +++ b/Build/setup.cfg.mingw @@ -15,8 +15,8 @@ defines = WIN32 library_dirs = C:/msys/1.0/home/mcicogni/openldap-mingw-build-4/openldap-2.2.18/libraries/libldap_r/.libs C:/msys/1.0/home/mcicogni/openldap-mingw-build-4/openldap-2.2.18/libraries/liblber/.libs C:\msys\1.0\home\mcicogni\openldap-mingw-build-4\openssl-0.9.7e include_dirs = C:/msys/1.0/home/mcicogni/openldap-mingw-build-4/openldap-2.2.18/include -extra_compile_args = -extra_objects = +extra_compile_args = +extra_objects = libs = ldap_r lber ssl crypto ws2_32 gdi32 diff --git a/Build/setup.cfg.suse-linux b/Build/setup.cfg.suse-linux index 3ea064d2..0a48ef2d 100644 --- a/Build/setup.cfg.suse-linux +++ b/Build/setup.cfg.suse-linux @@ -8,7 +8,7 @@ library_dirs = /usr/lib/sasl2 include_dirs = /usr/include/sasl -extra_compile_args = +extra_compile_args = extra_objects = # Example for full-featured SuSE build: diff --git a/Demo/Lib/ldap/async/deltree.py b/Demo/Lib/ldap/async/deltree.py index 68d3643e..d3fc6203 100644 --- a/Demo/Lib/ldap/async/deltree.py +++ b/Demo/Lib/ldap/async/deltree.py @@ -5,7 +5,7 @@ class DeleteLeafs(ldap.async.AsyncSearchHandler): """ Class for deleting entries which are results of a search. - + DNs of Non-leaf entries are collected in DeleteLeafs.nonLeafEntries. """ _entryResultTypes = ldap.async._entryResultTypes diff --git a/Demo/Lib/ldif/ldifcopy.py b/Demo/Lib/ldif/ldifcopy.py index 62cb3919..3bbe3f30 100644 --- a/Demo/Lib/ldif/ldifcopy.py +++ b/Demo/Lib/ldif/ldifcopy.py @@ -20,4 +20,3 @@ process_url_schemes=['file','ftp','http'] ) ldif_collector.parse() - diff --git a/Demo/matchedvalues.py b/Demo/matchedvalues.py index 59c594ff..7a6e7b6b 100644 --- a/Demo/matchedvalues.py +++ b/Demo/matchedvalues.py @@ -61,4 +61,3 @@ def print_result(search_result): res = ld.search_ext_s(base, scope, filter, attrlist = ['mail'], serverctrls = [mv]) print("Matched values control: %s" % control_filter) print_result(res) - diff --git a/Demo/options.py b/Demo/options.py index 8b4e2159..28a04374 100644 --- a/Demo/options.py +++ b/Demo/options.py @@ -24,7 +24,3 @@ #print("time limit:",l.get_option(ldap.OPT_TIMELIMIT)) print("Binding...") l.simple_bind_s("","") - - - - diff --git a/Demo/pyasn1/sessiontrack.py b/Demo/pyasn1/sessiontrack.py index 33ddddab..58a34e82 100644 --- a/Demo/pyasn1/sessiontrack.py +++ b/Demo/pyasn1/sessiontrack.py @@ -58,4 +58,3 @@ ldap_url.attrs or ['*'], serverctrls=[st_ctrl] ) - diff --git a/Demo/pyasn1/syncrepl.py b/Demo/pyasn1/syncrepl.py index 61d63ad9..7103bc64 100644 --- a/Demo/pyasn1/syncrepl.py +++ b/Demo/pyasn1/syncrepl.py @@ -93,8 +93,8 @@ def syncrepl_present(self,uuids,refreshDeletes=False): # If we have not been given any UUID values, # then we have recieved all the present controls... if uuids is None: - # We only do things if refreshDeletes is false as the syncrepl - # extension will call syncrepl_delete instead when it detects a + # We only do things if refreshDeletes is false as the syncrepl + # extension will call syncrepl_delete instead when it detects a # delete notice if refreshDeletes is False: deletedEntries = [ diff --git a/Demo/schema.py b/Demo/schema.py index 4d350f02..03f90a83 100644 --- a/Demo/schema.py +++ b/Demo/schema.py @@ -47,7 +47,7 @@ attr_type_filter = [ ('no_user_mod',[0]), ('usage',range(2)), - ] + ] ) except KeyError as e: print('***KeyError',str(e)) diff --git a/Demo/schema_tree.py b/Demo/schema_tree.py index 79c8a837..648bb86f 100644 --- a/Demo/schema_tree.py +++ b/Demo/schema_tree.py @@ -98,4 +98,3 @@ def HTMLSchemaTree(schema,se_class,se_tree,se_oid,level): print('\n*** Attribute types tree ***\n') PrintSchemaTree(schema,ldap.schema.AttributeType,at_tree,'_',0) - diff --git a/Demo/simple.py b/Demo/simple.py index 6004c9ef..5fa04250 100644 --- a/Demo/simple.py +++ b/Demo/simple.py @@ -97,11 +97,10 @@ # res = l.search_s( - "ou=CSEE, o=UQ, c=AU", - _ldap.SCOPE_SUBTREE, + "ou=CSEE, o=UQ, c=AU", + _ldap.SCOPE_SUBTREE, "objectclass=*", ) print(res) l.unbind() - diff --git a/Demo/simplebrowse.py b/Demo/simplebrowse.py index d13c3680..9d138003 100644 --- a/Demo/simplebrowse.py +++ b/Demo/simplebrowse.py @@ -50,7 +50,7 @@ # We're not interested in attributes at this stage, so # we specify [] as the list of attribute names to retreive. # - for name,attrs in l.search_s(dn, ldap.SCOPE_ONELEVEL, + for name,attrs in l.search_s(dn, ldap.SCOPE_ONELEVEL, "objectclass=*", []): #-- shorten resulting dns for output brevity if name.startswith(dn+", "): @@ -100,7 +100,7 @@ print(" %-24s" % name) for k,vals in attrs.items(): for v in vals: - if len(v) > 200: + if len(v) > 200: v = `v[:200]` + \ ("... (%d bytes)" % len(v)) else: @@ -125,4 +125,3 @@ except: print_exc() - diff --git a/Doc/installing.rst b/Doc/installing.rst index 6df062f0..dc4f5b95 100644 --- a/Doc/installing.rst +++ b/Doc/installing.rst @@ -246,4 +246,3 @@ Debugging symbols are preserved with compile option ``-g``. extra_objects = libs = ldap_r lber sasl2 ssl crypto - diff --git a/Doc/reference/ldap-async.rst b/Doc/reference/ldap-async.rst index 76245f60..d7a18405 100644 --- a/Doc/reference/ldap-async.rst +++ b/Doc/reference/ldap-async.rst @@ -112,4 +112,3 @@ for writing search results as LDIF to stdout. :: s.endResultBreak-s.beginResultsDropped ) ) - diff --git a/Doc/reference/ldap-dn.rst b/Doc/reference/ldap-dn.rst index c22a64c4..3e0bbb5f 100644 --- a/Doc/reference/ldap-dn.rst +++ b/Doc/reference/ldap-dn.rst @@ -107,4 +107,3 @@ Splitting a LDAPv3 DN with a multi-valued RDN into its AVA parts: >>> ldap.dn.str2dn('cn=John Doe+mail=john.doe@example.com,dc=example,dc=com') [[('cn', 'John Doe', 1), ('mail', 'john.doe@example.com', 1)], [('dc', 'example', 1)], [('dc', 'com', 1)]] - diff --git a/Doc/reference/ldap-extop.rst b/Doc/reference/ldap-extop.rst index 607f3f00..8fe49f42 100644 --- a/Doc/reference/ldap-extop.rst +++ b/Doc/reference/ldap-extop.rst @@ -38,4 +38,3 @@ This requires :py:mod:`pyasn1` and :py:mod:`pyasn1_modules` to be installed. .. autoclass:: ldap.extop.dds.RefreshResponse :members: - diff --git a/Doc/reference/ldap-filter.rst b/Doc/reference/ldap-filter.rst index 577befbc..b08d5e9b 100644 --- a/Doc/reference/ldap-filter.rst +++ b/Doc/reference/ldap-filter.rst @@ -35,4 +35,3 @@ The :mod:`ldap.filter` module defines the following functions: whole filter string. .. % -> string - diff --git a/Doc/reference/ldap-sasl.rst b/Doc/reference/ldap-sasl.rst index 96f13aa5..9a8c96aa 100644 --- a/Doc/reference/ldap-sasl.rst +++ b/Doc/reference/ldap-sasl.rst @@ -35,7 +35,7 @@ Classes .. autoclass:: ldap.sasl.sasl :members: - + This class is used with :py:meth:`ldap.LDAPObject.sasl_interactive_bind_s()`. @@ -82,4 +82,3 @@ and sends a SASL external bind request. ldap_conn.sasl_non_interactive_bind_s('EXTERNAL') # Find out the SASL Authorization Identity print ldap_conn.whoami_s() - diff --git a/Doc/reference/ldap-syncrepl.rst b/Doc/reference/ldap-syncrepl.rst index d3717dfb..b3b2cf9a 100644 --- a/Doc/reference/ldap-syncrepl.rst +++ b/Doc/reference/ldap-syncrepl.rst @@ -20,4 +20,3 @@ This module defines the following classes: .. autoclass:: ldap.syncrepl.SyncreplConsumer :members: - diff --git a/Doc/reference/ldap.rst b/Doc/reference/ldap.rst index 6203a2d9..a3ee63cc 100644 --- a/Doc/reference/ldap.rst +++ b/Doc/reference/ldap.rst @@ -968,7 +968,7 @@ and wait for and return with the server's result, or with .. py:method:: LDAPObject.sasl_interactive_bind_s(who, auth[, serverctrls=None [, clientctrls=None [, sasl_flags=ldap.SASL_QUIET]]]) -> None This call is used to bind to the directory with a SASL bind request. - + *auth* is an :py:class:`ldap.sasl.sasl()` instance. *serverctrls* and *clientctrls* like described in section :ref:`ldap-controls`. @@ -1079,7 +1079,7 @@ and wait for and return with the server's result, or with .. versionchanged:: 3.0 ``filterstr=None`` is equivalent to ``filterstr='(objectClass=*)'``. - + .. py:method:: LDAPObject.start_tls_s() -> None @@ -1220,4 +1220,3 @@ subtree search. >>> for dn,entry in r: >>> print('Processing',repr(dn)) >>> handle_ldap_entry(entry) - diff --git a/Doc/reference/ldapurl.rst b/Doc/reference/ldapurl.rst index 86d0817b..96b5ed24 100644 --- a/Doc/reference/ldapurl.rst +++ b/Doc/reference/ldapurl.rst @@ -124,4 +124,3 @@ with \module{ldapurl} module. >>> ldap_url = ldapurl.LDAPUrl(hostport='localhost:1389',dn='dc=stroeder,dc=com',attrs=['cn','mail'],who='cn=Michael,dc=stroeder,dc=com',cred='secret') >>> ldap_url.unparse() 'ldap://localhost:1389/dc=stroeder,dc=com?cn,mail?base?(objectclass=*)?bindname=cn=Michael%2Cdc=stroeder%2Cdc=com,X-BINDPW=secret' - diff --git a/Doc/reference/ldif.rst b/Doc/reference/ldif.rst index 64afbb02..c508f7dc 100644 --- a/Doc/reference/ldif.rst +++ b/Doc/reference/ldif.rst @@ -94,4 +94,3 @@ with :mod:`ldif` module, skip some entries and write the result to stdout. :: parser = MyLDIF(open("input.ldif", 'rb'), sys.stdout) parser.parse() - diff --git a/Doc/sample_workflow.rst b/Doc/sample_workflow.rst index 97e51c67..c2010c1a 100644 --- a/Doc/sample_workflow.rst +++ b/Doc/sample_workflow.rst @@ -1,4 +1,3 @@ - .. _sample workflow: Sample workflow for python-ldap development diff --git a/Lib/ldap/constants.py b/Lib/ldap/constants.py index 9eb5ceb9..7a7982bb 100644 --- a/Lib/ldap/constants.py +++ b/Lib/ldap/constants.py @@ -16,7 +16,7 @@ from __future__ import print_function class Constant(object): - """Base class for a definition of an OpenLDAP constant + """Base class for a definition of an OpenLDAP constant """ def __init__(self, name, optional=False, requirements=(), doc=None): diff --git a/Lib/ldap/controls/deref.py b/Lib/ldap/controls/deref.py index 0d43ab1f..b9994eb6 100644 --- a/Lib/ldap/controls/deref.py +++ b/Lib/ldap/controls/deref.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -ldap.controls.deref - classes for +ldap.controls.deref - classes for (see https://tools.ietf.org/html/draft-masarati-ldap-deref) See https://www.python-ldap.org/ for project details. diff --git a/Lib/ldapurl.py b/Lib/ldapurl.py index 5159d895..12eafdcf 100644 --- a/Lib/ldapurl.py +++ b/Lib/ldapurl.py @@ -429,4 +429,3 @@ def __delattr__(self,name): pass else: del self.__dict__[name] - diff --git a/Modules/LDAPObject.c b/Modules/LDAPObject.c index 2bd6209c..bc26727e 100644 --- a/Modules/LDAPObject.c +++ b/Modules/LDAPObject.c @@ -54,8 +54,8 @@ dealloc(LDAPObject *self) * utility functions */ -/* - * check to see if the LDAPObject is valid, +/* + * check to see if the LDAPObject is valid, * ie has been opened, and not closed. An exception is set if not valid. */ @@ -89,8 +89,8 @@ LDAPMod_DEL(LDAPMod *lm) PyMem_DEL(lm); } -/* - * convert a tuple of the form (int,str,[str,...]) +/* + * convert a tuple of the form (int,str,[str,...]) * or (str, [str,...]) if no_op is true, into an LDAPMod structure. * See ldap_modify(3) for details. * @@ -208,8 +208,8 @@ LDAPMods_DEL(LDAPMod **lms) PyMem_DEL(lms); } -/* - * convert a list of tuples into a LDAPMod*[] array structure +/* + * convert a list of tuples into a LDAPMod*[] array structure * NOTE: list of tuples must live longer than the LDAPMods */ @@ -589,7 +589,7 @@ l_ldap_simple_bind(LDAPObject *self, PyObject *args) auth modules ("mechanisms"), or try ldapsearch -b "" -s base -LLL -x supportedSASLMechanisms - + (perhaps with an additional -h and -p argument for ldap host and port). The latter will show you which SASL mechanisms are known to the LDAP server. If you do not want to set up Kerberos, you @@ -645,7 +645,7 @@ interaction(unsigned flags, sasl_interact_t *interact, PyObject *SASLObject) return LDAP_SUCCESS; } -/* +/* This function will be called by ldap_sasl_interactive_bind(). The "*in" is an array of sasl_interact_t's (see sasl.h for a reference). The last interact in the array has an interact->id of @@ -748,12 +748,12 @@ l_ldap_sasl_interactive_bind_s(LDAPObject *self, PyObject *args) static unsigned sasl_flags = LDAP_SASL_QUIET; - /* + /* * In Python 2.3+, a "I" format argument indicates that we're either converting * the Python object into a long or an unsigned int. In versions prior to that, * it will always convert to a long. Since the sasl_flags variable is an * unsigned int, we need to use the "I" flag if we're running Python 2.3+ and a - * "i" otherwise. + * "i" otherwise. */ #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION < 3) if (!PyArg_ParseTuple diff --git a/Tests/t_ldap_asyncsearch.py b/Tests/t_ldap_asyncsearch.py index 8b469669..1b89050d 100644 --- a/Tests/t_ldap_asyncsearch.py +++ b/Tests/t_ldap_asyncsearch.py @@ -22,4 +22,3 @@ def test_deprecated(self): if __name__ == '__main__': unittest.main() - diff --git a/Tests/t_ldap_sasl.py b/Tests/t_ldap_sasl.py index e60ac12b..9cf675af 100644 --- a/Tests/t_ldap_sasl.py +++ b/Tests/t_ldap_sasl.py @@ -94,4 +94,3 @@ def test_external_tlscert(self): if __name__ == '__main__': unittest.main() - diff --git a/Tests/t_ldif.py b/Tests/t_ldif.py index 4f181df1..048b3f40 100644 --- a/Tests/t_ldif.py +++ b/Tests/t_ldif.py @@ -467,7 +467,7 @@ def test_weird_empty_lines(self): """ # comment before version - + version: 1 @@ -586,7 +586,7 @@ def test_weird_empty_lines(self): """ # comment before version - + version: 1 diff --git a/setup.cfg b/setup.cfg index 87cdfd7e..c6546068 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,8 +14,8 @@ # ./configure --with-cyrus-sasl --with-tls defines = HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R -extra_compile_args = -extra_objects = +extra_compile_args = +extra_objects = # Example for full-featured build: # Support for StartTLS/LDAPS, SASL bind and reentrant libldap_r. diff --git a/setup.py b/setup.py index 034c4dd3..1b3dcdee 100644 --- a/setup.py +++ b/setup.py @@ -71,7 +71,7 @@ class OpenLDAP2: from Python programs. Mainly it wraps the OpenLDAP 2.x libs for that purpose. Additionally the package contains modules for other LDAP-related stuff (e.g. processing LDIF, LDAPURLs, LDAPv3 schema, LDAPv3 extended operations - and controls, etc.). + and controls, etc.). """, author = 'python-ldap project', author_email = 'python-ldap@python.org', diff --git a/tox.ini b/tox.ini index bb9adac3..992a699e 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ minver = 1.8 [testenv] deps = coverage passenv = WITH_GCOV -# - Enable BytesWarning +# - Enable BytesWarning # - Turn all warnings into exceptions. # - 'ignore:the imp module is deprecated' is required to ignore import of 'imp' # in distutils. Python < 3.6 use PendingDeprecationWarning; Python >= 3.6 use