Commit d260409d authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

flake8 and all

* update some copyright
* drop most __docformat__ declaration
* fix some flake8 warnings / errors
parent d8de1ac21f36
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"""CubicWeb is a generic framework to quickly build applications which describes """CubicWeb is a generic framework to quickly build applications which describes
relations between entitites. relations between entitites.
""" """
__docformat__ = "restructuredtext en"
import imp import imp
import logging import logging
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Exceptions shared by different cubicweb packages.""" """Exceptions shared by different cubicweb packages."""
__docformat__ = "restructuredtext en"
from warnings import warn from warnings import warn
......
...@@ -27,7 +27,7 @@ We can find a certain number of attributes and methods defined in this class and ...@@ -27,7 +27,7 @@ We can find a certain number of attributes and methods defined in this class and
common to all the application objects. common to all the application objects.
""" """
__docformat__ = "restructuredtext en"
from logging import getLogger from logging import getLogger
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License along # You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Simple cryptographic routines, based on python-crypto.""" """Simple cryptographic routines, based on python-crypto."""
__docformat__ = "restructuredtext en"
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
......
...@@ -179,7 +179,7 @@ Here are all environment variables that may be used to configure *CubicWeb*: ...@@ -179,7 +179,7 @@ Here are all environment variables that may be used to configure *CubicWeb*:
""" """
from __future__ import print_function from __future__ import print_function
__docformat__ = "restructuredtext en"
import importlib import importlib
import logging import logging
......
...@@ -20,7 +20,7 @@ provide a pluggable commands system. ...@@ -20,7 +20,7 @@ provide a pluggable commands system.
""" """
from __future__ import print_function from __future__ import print_function
__docformat__ = "restructuredtext en"
# *ctl module should limit the number of import to be imported as quickly as # *ctl module should limit the number of import to be imported as quickly as
# possible (for cubicweb-ctl reactivity, necessary for instance for usable bash # possible (for cubicweb-ctl reactivity, necessary for instance for usable bash
......
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# #
# This file is part of CubicWeb. # This file is part of CubicWeb.
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
Cubicweb registries Cubicweb registries
""" """
__docformat__ = "restructuredtext en"
from cubicweb import _
import sys import sys
from os.path import join, dirname, realpath from os.path import join, dirname, realpath
from warnings import warn from warnings import warn
...@@ -38,6 +35,7 @@ from logilab.common.registry import RegistryStore, Registry, ObjectNotFound, Reg ...@@ -38,6 +35,7 @@ from logilab.common.registry import RegistryStore, Registry, ObjectNotFound, Reg
from rql import RQLHelper from rql import RQLHelper
from yams.constraints import BASE_CONVERTERS from yams.constraints import BASE_CONVERTERS
from cubicweb import _
from cubicweb import (CW_SOFTWARE_ROOT, ETYPE_NAME_MAP, CW_EVENT_MANAGER, from cubicweb import (CW_SOFTWARE_ROOT, ETYPE_NAME_MAP, CW_EVENT_MANAGER,
onevent, Binary, UnknownProperty, UnknownEid) onevent, Binary, UnknownProperty, UnknownEid)
from cubicweb.predicates import appobject_selectable, _reset_is_instance_cache from cubicweb.predicates import appobject_selectable, _reset_is_instance_cache
......
# copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# #
# This file is part of CubicWeb. # This file is part of CubicWeb.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License along # You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Postgres specific store""" """Postgres specific store"""
from __future__ import print_function from __future__ import print_function
import warnings import warnings
...@@ -24,10 +25,8 @@ from io import StringIO ...@@ -24,10 +25,8 @@ from io import StringIO
from time import asctime from time import asctime
from datetime import date, datetime, time from datetime import date, datetime, time
from collections import defaultdict from collections import defaultdict
from base64 import b64encode
from six import (string_types, integer_types, text_type, binary_type, from six import string_types, integer_types, text_type, add_metaclass
add_metaclass)
from six.moves import cPickle as pickle, range from six.moves import cPickle as pickle, range
from logilab.common.deprecation import class_deprecated from logilab.common.deprecation import class_deprecated
......
...@@ -16,9 +16,8 @@ ...@@ -16,9 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License along # You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Test tools for cubicweb""" """Test tools for cubicweb"""
from __future__ import print_function
__docformat__ = "restructuredtext en" from __future__ import print_function
import os import os
import sys import sys
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
"""Fake objects to ease testing of cubicweb without a fully working environment """Fake objects to ease testing of cubicweb without a fully working environment
""" """
__docformat__ = "restructuredtext en"
from contextlib import contextmanager from contextlib import contextmanager
from six import string_types from six import string_types
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"""This modules defines func / methods for creating test repositories""" """This modules defines func / methods for creating test repositories"""
from __future__ import print_function from __future__ import print_function
__docformat__ = "restructuredtext en"
import logging import logging
from random import randint, choice from random import randint, choice
......
...@@ -20,7 +20,7 @@ http server ...@@ -20,7 +20,7 @@ http server
""" """
from __future__ import print_function from __future__ import print_function
__docformat__ = "restructuredtext en"
import random import random
import threading import threading
......
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# #
# This file is part of CubicWeb. # This file is part of CubicWeb.
...@@ -21,8 +21,6 @@ This module contains functions to initialize a new repository. ...@@ -21,8 +21,6 @@ This module contains functions to initialize a new repository.
""" """
from __future__ import print_function from __future__ import print_function
__docformat__ = "restructuredtext en"
from pprint import pprint from pprint import pprint
from logilab.common.decorators import cachedproperty from logilab.common.decorators import cachedproperty
...@@ -30,20 +28,23 @@ from logilab.common.testlib import SkipTest ...@@ -30,20 +28,23 @@ from logilab.common.testlib import SkipTest
from cubicweb.devtools.testlib import RepoAccess from cubicweb.devtools.testlib import RepoAccess
def tuplify(mylist): def tuplify(mylist):
return [tuple(item) for item in mylist] return [tuple(item) for item in mylist]
def snippet_key(a): def snippet_key(a):
# a[0] may be a dict or a key/value tuple # a[0] may be a dict or a key/value tuple
return (sorted(dict(a[0]).items()), [e.expression for e in a[1]]) return (sorted(dict(a[0]).items()), [e.expression for e in a[1]])
def check_plan(self, rql, expected, kwargs=None): def check_plan(self, rql, expected, kwargs=None):
with self.session.new_cnx() as cnx: with self.session.new_cnx() as cnx:
plan = self._prepare_plan(cnx, rql, kwargs) plan = self._prepare_plan(cnx, rql, kwargs)
self.planner.build_plan(plan) self.planner.build_plan(plan)
try: try:
self.assertEqual(len(plan.steps), len(expected), self.assertEqual(len(plan.steps), len(expected),
'expected %s steps, got %s' % (len(expected), len(plan.steps))) 'expected %s steps, got %s' % (len(expected), len(plan.steps)))
# step order is important # step order is important
for i, step in enumerate(plan.steps): for i, step in enumerate(plan.steps):
compare_steps(self, step.test_repr(), expected[i]) compare_steps(self, step.test_repr(), expected[i])
...@@ -51,6 +52,7 @@ def check_plan(self, rql, expected, kwargs=None): ...@@ -51,6 +52,7 @@ def check_plan(self, rql, expected, kwargs=None):
pprint([step.test_repr() for step in plan.steps]) pprint([step.test_repr() for step in plan.steps])
raise raise
def compare_steps(self, step, expected): def compare_steps(self, step, expected):
try: try:
self.assertEqual(step[0], expected[0], 'expected step type %s, got %s' % (expected[0], step[0])) self.assertEqual(step[0], expected[0], 'expected step type %s, got %s' % (expected[0], step[0]))
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
# #
# You should have received a copy of the GNU Lesser General Public License along # You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""this module contains base classes and utilities for cubicweb tests""" """Base classes and utilities for cubicweb tests"""
from __future__ import print_function from __future__ import print_function
import sys import sys
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""base application's entities class implementation: `AnyEntity`""" """base application's entities class implementation: `AnyEntity`"""
__docformat__ = "restructuredtext en"
from warnings import warn from warnings import warn
......
# copyright 2010-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # copyright 2010-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# #
# This file is part of CubicWeb. # This file is part of CubicWeb.
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""entity classes user and group entities""" """entity classes user and group entities"""
__docformat__ = "restructuredtext en"
from six import string_types, text_type from six import string_types, text_type
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""entity classes for optional library entities""" """entity classes for optional library entities"""
__docformat__ = "restructuredtext en"
from warnings import warn from warnings import warn
from datetime import datetime from datetime import datetime
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""schema definition related entities""" """schema definition related entities"""
__docformat__ = "restructuredtext en"
from logilab.common.decorators import cached from logilab.common.decorators import cached
......
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# #
# This file is part of CubicWeb. # This file is part of CubicWeb.
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""data source related entities""" """data source related entities"""
__docformat__ = "restructuredtext en"
import re import re
from socket import gethostname from socket import gethostname
import logging import logging
...@@ -29,6 +27,7 @@ from logilab.mtconverter import xml_escape ...@@ -29,6 +27,7 @@ from logilab.mtconverter import xml_escape
from cubicweb.entities import AnyEntity, fetch_config from cubicweb.entities import AnyEntity, fetch_config
class _CWSourceCfgMixIn(object): class _CWSourceCfgMixIn(object):
@property @property
def dictconfig(self): def dictconfig(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment