From: Oleg Broytman Date: Sun, 29 May 2016 15:54:52 +0000 (+0300) Subject: Fix new flake8 E402: module level import not at top of file X-Git-Tag: 0.0.8~7 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=d6ef04787834ffeded257d96af4c965ca7055a51;p=m_librarian.git Fix new flake8 E402: module level import not at top of file --- diff --git a/m_librarian/config.py b/m_librarian/config.py index 3609d34..04e64e0 100755 --- a/m_librarian/config.py +++ b/m_librarian/config.py @@ -1,10 +1,10 @@ #! /usr/bin/env python -__all__ = ['get_config'] - import os from ConfigParser import SafeConfigParser +__all__ = ['get_config'] + def _find_config_dirs_posix(): config_dirs = [] diff --git a/m_librarian/db.py b/m_librarian/db.py index 7e5744f..b3ddd52 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -1,16 +1,16 @@ #! /usr/bin/env python -__all__ = ['Author', 'Book', 'Extension', 'Genre', 'Language', - 'AuthorBook', 'BookGenre', 'open_db', 'init_db', - 'insert_name', 'insert_author', 'update_counters', - ] - import os from sqlobject import SQLObject, StringCol, UnicodeCol, IntCol, BoolCol, \ ForeignKey, DateCol, DatabaseIndex, RelatedJoin, \ connectionForURI, sqlhub, SQLObjectNotFound, dberrors from .config import get_config +__all__ = ['Author', 'Book', 'Extension', 'Genre', 'Language', + 'AuthorBook', 'BookGenre', 'open_db', 'init_db', + 'insert_name', 'insert_author', 'update_counters', + ] + class Author(SQLObject): surname = UnicodeCol(notNull=True) diff --git a/m_librarian/glst.py b/m_librarian/glst.py index 2de36c3..a4ac27d 100755 --- a/m_librarian/glst.py +++ b/m_librarian/glst.py @@ -1,12 +1,12 @@ #! /usr/bin/env python -__all__ = ['import_glst'] - import codecs import os from sqlobject import sqlhub, SQLObjectNotFound from .db import Genre +__all__ = ['import_glst'] + def parse_glst_file(glst_filename): glst_file = codecs.open(glst_filename, 'r', 'utf-8') diff --git a/m_librarian/inp.py b/m_librarian/inp.py index dd32c08..a030ebc 100644 --- a/m_librarian/inp.py +++ b/m_librarian/inp.py @@ -1,6 +1,4 @@ -__all__ = ['import_inpx'] - import os from zipfile import ZipFile from sqlobject import sqlhub @@ -8,6 +6,8 @@ from sqlobject.sqlbuilder import Select from .db import Author, Book, Extension, Genre, Language, \ insert_name, insert_author +__all__ = ['import_inpx'] + EOT = chr(4) # INP field separator diff --git a/m_librarian/search.py b/m_librarian/search.py index 2fbde60..635f194 100644 --- a/m_librarian/search.py +++ b/m_librarian/search.py @@ -1,13 +1,13 @@ +from sqlobject.sqlbuilder import AND, func +from .db import Author, Book, Extension, Genre, Language + __all__ = [ 'mk_search_conditions', 'search_authors', 'search_books', 'search_extensions', 'search_genres', 'search_languages', ] -from sqlobject.sqlbuilder import AND, func -from .db import Author, Book, Extension, Genre, Language - def _mk_search_conditions_with_operator(table, case_sensitive, comparison_op, values, expressions): diff --git a/setup.py b/setup.py index a946250..9f6ded7 100755 --- a/setup.py +++ b/setup.py @@ -21,7 +21,8 @@ if is_setuptools: versionpath = join(abspath(dirname(__file__)), 'm_librarian', '__version__.py') load_source('m_librarian_version', versionpath) -from m_librarian_version import __version__ +# Ignore: E402 module level import not at top of file +from m_librarian_version import __version__ # noqa setup(name='m_librarian', version=__version__, diff --git a/tests/__init__.py b/tests/__init__.py index da9e6a5..e40219a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,12 +1,11 @@ -__all__ = ['TestCase', 'main'] - - import os import unittest from m_librarian.db import open_db, init_db from m_librarian.inp import import_inpx +__all__ = ['TestCase', 'main'] + class TestCase(unittest.TestCase): def setUp(self):