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 @@
"""CubicWeb is a generic framework to quickly build applications which describes
relations between entitites.
"""
__docformat__ = "restructuredtext en"
import imp
import logging
......
......@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Exceptions shared by different cubicweb packages."""
__docformat__ = "restructuredtext en"
from warnings import warn
......
......@@ -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.
"""
__docformat__ = "restructuredtext en"
from logging import getLogger
......
......@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Simple cryptographic routines, based on python-crypto."""
__docformat__ = "restructuredtext en"
from base64 import b64encode, b64decode
......
......@@ -179,7 +179,7 @@ Here are all environment variables that may be used to configure *CubicWeb*:
"""
from __future__ import print_function
__docformat__ = "restructuredtext en"
import importlib
import logging
......
......@@ -20,7 +20,7 @@ provide a pluggable commands system.
"""
from __future__ import print_function
__docformat__ = "restructuredtext en"
# *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
......
# 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
#
# This file is part of CubicWeb.
......@@ -19,9 +19,6 @@
Cubicweb registries
"""
__docformat__ = "restructuredtext en"
from cubicweb import _
import sys
from os.path import join, dirname, realpath
from warnings import warn
......@@ -38,6 +35,7 @@ from logilab.common.registry import RegistryStore, Registry, ObjectNotFound, Reg
from rql import RQLHelper
from yams.constraints import BASE_CONVERTERS
from cubicweb import _
from cubicweb import (CW_SOFTWARE_ROOT, ETYPE_NAME_MAP, CW_EVENT_MANAGER,
onevent, Binary, UnknownProperty, UnknownEid)
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
#
# This file is part of CubicWeb.
......@@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Postgres specific store"""
from __future__ import print_function
import warnings
......@@ -24,10 +25,8 @@ from io import StringIO
from time import asctime
from datetime import date, datetime, time
from collections import defaultdict
from base64 import b64encode
from six import (string_types, integer_types, text_type, binary_type,
add_metaclass)
from six import string_types, integer_types, text_type, add_metaclass
from six.moves import cPickle as pickle, range
from logilab.common.deprecation import class_deprecated
......
......@@ -16,9 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Test tools for cubicweb"""
from __future__ import print_function
__docformat__ = "restructuredtext en"
from __future__ import print_function
import os
import sys
......
......@@ -18,8 +18,6 @@
"""Fake objects to ease testing of cubicweb without a fully working environment
"""
__docformat__ = "restructuredtext en"
from contextlib import contextmanager
from six import string_types
......
......@@ -19,7 +19,7 @@
"""This modules defines func / methods for creating test repositories"""
from __future__ import print_function
__docformat__ = "restructuredtext en"
import logging
from random import randint, choice
......
......@@ -20,7 +20,7 @@ http server
"""
from __future__ import print_function
__docformat__ = "restructuredtext en"
import random
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
#
# This file is part of CubicWeb.
......@@ -21,8 +21,6 @@ This module contains functions to initialize a new repository.
"""
from __future__ import print_function
__docformat__ = "restructuredtext en"
from pprint import pprint
from logilab.common.decorators import cachedproperty
......@@ -30,20 +28,23 @@ from logilab.common.testlib import SkipTest
from cubicweb.devtools.testlib import RepoAccess
def tuplify(mylist):
return [tuple(item) for item in mylist]
def snippet_key(a):
# a[0] may be a dict or a key/value tuple
return (sorted(dict(a[0]).items()), [e.expression for e in a[1]])
def check_plan(self, rql, expected, kwargs=None):
with self.session.new_cnx() as cnx:
plan = self._prepare_plan(cnx, rql, kwargs)
self.planner.build_plan(plan)
try:
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
for i, step in enumerate(plan.steps):
compare_steps(self, step.test_repr(), expected[i])
......@@ -51,6 +52,7 @@ def check_plan(self, rql, expected, kwargs=None):
pprint([step.test_repr() for step in plan.steps])
raise
def compare_steps(self, step, expected):
try:
self.assertEqual(step[0], expected[0], 'expected step type %s, got %s' % (expected[0], step[0]))
......
......@@ -15,7 +15,8 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# 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
import sys
......
......@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""base application's entities class implementation: `AnyEntity`"""
__docformat__ = "restructuredtext en"
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
#
# This file is part of CubicWeb.
......
......@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""entity classes user and group entities"""
__docformat__ = "restructuredtext en"
from six import string_types, text_type
......
......@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""entity classes for optional library entities"""
__docformat__ = "restructuredtext en"
from warnings import warn
from datetime import datetime
......
......@@ -17,7 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""schema definition related entities"""
__docformat__ = "restructuredtext en"
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
#
# This file is part of CubicWeb.
......@@ -17,8 +17,6 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""data source related entities"""
__docformat__ = "restructuredtext en"
import re
from socket import gethostname
import logging
......@@ -29,6 +27,7 @@ from logilab.mtconverter import xml_escape
from cubicweb.entities import AnyEntity, fetch_config
class _CWSourceCfgMixIn(object):
@property
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