Skip to content

Commit

Permalink
Black and Flake8 the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Dec 31, 2018
1 parent af09215 commit 162a8a3
Show file tree
Hide file tree
Showing 12 changed files with 469 additions and 356 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,12 @@ python:
- 3.4
- 3.5
- 3.6
matrix:
include:
- python: 3.6
name: "Flake8"
install: pip install -U flake8
script: flake8 --doctests src setup.py
install:
- pip install -U pip setuptools
- pip install -U coverage coveralls
Expand Down
218 changes: 108 additions & 110 deletions setup.py
Expand Up @@ -17,121 +17,119 @@
import os
from setuptools import setup, find_packages


def read(*rnames):
with open(os.path.join(os.path.dirname('.'), *rnames)) as f:
with open(os.path.join(os.path.dirname("."), *rnames)) as f:
return f.read()

stemmer_requires = [
'zopyx.txng3.ext >= 2.0.0',
]

stemmer_requires = ["zopyx.txng3.ext >= 2.0.0"]

tests_require = [
'ZODB',
'zope.annotation',
'zope.app.appsetup',
'zope.app.basicskin',
'zope.app.catalog',
'zope.app.catalog',
'zope.app.component',
'zope.app.container',
'zope.app.form',
'zope.app.publisher >= 4.0',
'zope.app.rotterdam',
'zope.app.schema >= 4.0',
'zope.app.wsgi',
'zope.browsermenu',
'zope.browserpage',
'zope.browserresource',
'zope.dottedname',
'zope.keyreference',
'zope.login',
'zope.password',
'zope.principalannotation',
'zope.principalregistry',
'zope.securitypolicy',
'zope.testbrowser >= 5.2',
'zope.testing',
'zope.testrunner',
"ZODB",
"zope.annotation",
"zope.app.appsetup",
"zope.app.basicskin",
"zope.app.catalog",
"zope.app.catalog",
"zope.app.component",
"zope.app.container",
"zope.app.form",
"zope.app.publisher >= 4.0",
"zope.app.rotterdam",
"zope.app.schema >= 4.0",
"zope.app.wsgi",
"zope.browsermenu",
"zope.browserpage",
"zope.browserresource",
"zope.dottedname",
"zope.keyreference",
"zope.login",
"zope.password",
"zope.principalannotation",
"zope.principalregistry",
"zope.securitypolicy",
"zope.testbrowser >= 5.2",
"zope.testing",
"zope.testrunner",
] + stemmer_requires

setup(name='zc.catalog',
version='2.0.2.dev0',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
description="Extensions to the Zope 3 Catalog",
long_description=(
read('README.rst')
+ '\n\n.. contents::\n\n' +
read('CHANGES.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'valueindex.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'setindex.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'normalizedindex.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'extentcatalog.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'stemmer.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'legacy.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'globber.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'callablewrapper.rst')
+ '\n\n' +
read('src', 'zc', 'catalog', 'browser', 'README.rst')
),
keywords="zope3 i18n date time duration catalog index",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope :: 3',
],
url='http://github.com/zopefoundation/zc.catalog',
license='ZPL 2.1',
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zc'],
extras_require={
'test': tests_require,
'browser': [
'zope.app.form',
'zope.browsermenu',
],
'stemmer': stemmer_requires,
},
tests_require=tests_require,
install_requires=[
'BTrees >= 4.4.1',
'persistent',
'pytz',
'setuptools',
'zope.catalog >= 4.2.1',
'zope.component >= 4.3.0',
'zope.container >= 4.1.0',
'zope.i18nmessageid >= 4.1.0',
'zope.index >= 4.3.0',
'zope.interface >= 4.4.0',
'zope.intid >= 4.2.0',
'zope.publisher >= 3.12',
'zope.schema >= 4.4.2',
'zope.security >= 4.1.0',
],
include_package_data=True,
zip_safe=False,
setup(
name="zc.catalog",
version="2.0.2.dev0",
author="Zope Corporation and Contributors",
author_email="zope-dev@zope.org",
description="Extensions to the Zope 3 Catalog",
long_description=(
read("README.rst")
+ "\n\n.. contents::\n\n"
+ read("CHANGES.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "valueindex.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "setindex.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "normalizedindex.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "extentcatalog.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "stemmer.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "legacy.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "globber.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "callablewrapper.rst")
+ "\n\n"
+ read("src", "zc", "catalog", "browser", "README.rst")
),
keywords="zope3 i18n date time duration catalog index",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Zope Public License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Internet :: WWW/HTTP",
"Framework :: Zope :: 3",
],
url="http://github.com/zopefoundation/zc.catalog",
license="ZPL 2.1",
packages=find_packages("src"),
package_dir={"": "src"},
namespace_packages=["zc"],
extras_require={
"test": tests_require,
"browser": ["zope.app.form", "zope.browsermenu"],
"stemmer": stemmer_requires,
},
tests_require=tests_require,
install_requires=[
"BTrees >= 4.4.1",
"persistent",
"pytz",
"setuptools",
"zope.catalog >= 4.2.1",
"zope.component >= 4.3.0",
"zope.container >= 4.1.0",
"zope.i18nmessageid >= 4.1.0",
"zope.index >= 4.3.0",
"zope.interface >= 4.4.0",
"zope.intid >= 4.2.0",
"zope.publisher >= 3.12",
"zope.schema >= 4.4.2",
"zope.security >= 4.1.0",
],
include_package_data=True,
zip_safe=False,
)
2 changes: 1 addition & 1 deletion src/zc/__init__.py
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
__import__("pkg_resources").declare_namespace(__name__) # pragma: no cover
36 changes: 17 additions & 19 deletions src/zc/catalog/browser/tests.py
Expand Up @@ -15,7 +15,6 @@
"""
import doctest
import unittest
import transaction
import zope.intid
import zope.intid.interfaces
Expand All @@ -29,39 +28,38 @@

import zc.catalog.browser

class _ZcCatalogLayer(TestBrowserLayer,
BrowserLayer):

class _ZcCatalogLayer(TestBrowserLayer, BrowserLayer):
pass


ZcCatalogLayer = _ZcCatalogLayer(zc.catalog.browser)


@zope.component.adapter(IDatabaseOpenedWithRoot)
def initializeIntIds(event):
_db, connection, _root, root_folder = (
zope.app.appsetup.bootstrap.getInformationFromEvent(event))
sm = root_folder.getSiteManager()
if 'test-int-ids' not in sm['default']:
intids = zope.intid.IntIds()

sm["default"]["test-int-ids"] = intids
sm.registerUtility(
intids,
zope.intid.interfaces.IIntIds)
transaction.commit()
connection.close()
_db, connection, _root, root_folder = (
zope.app.appsetup.bootstrap.getInformationFromEvent(event))
sm = root_folder.getSiteManager()
if "test-int-ids" not in sm["default"]:
intids = zope.intid.IntIds()

sm["default"]["test-int-ids"] = intids
sm.registerUtility(intids, zope.intid.interfaces.IIntIds)
transaction.commit()
connection.close()


def test_suite():
suite = doctest.DocFileSuite(
"README.rst",
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE)
optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE,
)
suite.layer = ZcCatalogLayer
return suite


class LoginLogout(object):
# dummy to avoid dep on zope.app.security
def __call__(self):
return

if __name__ == '__main__':
unittest.main(defaultTest="test_suite")

0 comments on commit 162a8a3

Please sign in to comment.