Skip to content

Commit

Permalink
Cleaning for flake8-import-order
Browse files Browse the repository at this point in the history
  • Loading branch information
half-duplex committed May 19, 2020
1 parent 5c8ba3f commit 049d517
Show file tree
Hide file tree
Showing 110 changed files with 193 additions and 174 deletions.
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ flake8<3.6.0; python_version == '3.3'
flake8>=3.7.0,<3.8.0; python_version != '3.3'
flake8-coding
flake8-future-import<0.4.6
flake8-import-order; python_version > '3.3'
flake8-import-order<=1.18.1; python_version <= '3.3'
setuptools<40.0; python_version == '3.3'
sphinx
sphinxcontrib-autoprogram
2 changes: 1 addition & 1 deletion pytest_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
https://sopel.chat
"""
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

if __name__ == "__main__":
import sys
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pytest11 =

[flake8]
max-line-length = 79
application-import-names = sopel
import-order-style = google
ignore =
# Line length limit. Acceptable (for now).
E501,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import sys
import time
Expand Down
5 changes: 4 additions & 1 deletion sopel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env python3
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import sys

# Different from setuptools script, because we want the one in this dir.
from sopel.cli import run

sys.exit(run.main())
5 changes: 3 additions & 2 deletions sopel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
#
# Licensed under the Eiffel Forum License 2.

from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

from collections import namedtuple
import locale
import pkg_resources
import re
import sys

import pkg_resources

__all__ = [
'bot',
'config',
Expand Down
8 changes: 4 additions & 4 deletions sopel/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Licensed under the Eiffel Forum License 2.

from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

from ast import literal_eval
import collections
Expand All @@ -20,11 +20,11 @@

from sopel import irc, logger, plugins, tools
from sopel.db import SopelDB
from sopel.tools import Identifier, deprecated
import sopel.loader
from sopel.module import NOLIMIT
from sopel.tools import deprecated, Identifier
import sopel.tools.jobs
from sopel.trigger import Trigger
from sopel.module import NOLIMIT
import sopel.loader


__all__ = ['Sopel', 'SopelWrapper']
Expand Down
2 changes: 1 addition & 1 deletion sopel/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

# Shortcut imports
from .utils import ( # noqa
Expand Down
2 changes: 1 addition & 1 deletion sopel/cli/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
"""Sopel Config Command Line Interface (CLI): ``sopel-config``"""
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import argparse
import os
Expand Down
3 changes: 1 addition & 2 deletions sopel/cli/plugins.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# coding=utf-8
"""Sopel Plugins Command Line Interface (CLI): ``sopel-plugins``"""
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import argparse
import inspect
import operator

from sopel import plugins, tools

from . import utils


Expand Down
4 changes: 2 additions & 2 deletions sopel/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
https://sopel.chat
"""
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import argparse
import logging
Expand All @@ -18,7 +18,7 @@
import sys
import time

from sopel import bot, config, logger, tools, __version__
from sopel import __version__, bot, config, logger, tools
from . import utils

# This is in case someone somehow manages to install Sopel on an old version
Expand Down
2 changes: 1 addition & 1 deletion sopel/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import inspect
import logging
Expand Down
2 changes: 1 addition & 1 deletion sopel/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SpamSection(config.types.StaticSection):
# Copyright © 2012, Elad Alfassa <[email protected]>
# Licensed under the Eiffel Forum License 2.

from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import os
import sys
Expand Down
10 changes: 7 additions & 3 deletions sopel/config/core_section.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# coding=utf-8

from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import os.path

from sopel.config.types import (
StaticSection, ValidatedAttribute, ListAttribute, ChoiceAttribute,
FilenameAttribute, NO_DEFAULT
ChoiceAttribute,
FilenameAttribute,
ListAttribute,
NO_DEFAULT,
StaticSection,
ValidatedAttribute,
)
from sopel.tools import Identifier

Expand Down
3 changes: 2 additions & 1 deletion sopel/config/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
ValueError: ListAttribute value must be a list.
"""

from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import os.path
import re
import sys

from sopel.tools import get_input

if sys.version_info.major >= 3:
Expand Down
6 changes: 3 additions & 3 deletions sopel/coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
# Copyright 2019, Florian Strzelecki <[email protected]>
#
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import base64
import collections
import datetime
import functools
import logging
from random import randint
import re
import sys
import time
from random import randint

from sopel import loader, module
from sopel.irc import isupport
from sopel.irc.utils import CapReq, MyInfo
from sopel.tools import Identifier, events, iteritems, jobs, target, web
from sopel.tools import events, Identifier, iteritems, jobs, target, web


if sys.version_info.major >= 3:
Expand Down
8 changes: 4 additions & 4 deletions sopel/db.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import errno
import json
Expand All @@ -8,14 +8,14 @@
import sys
import traceback

from sopel.tools import Identifier

from sqlalchemy import create_engine, Column, ForeignKey, Integer, String
from sqlalchemy import Column, create_engine, ForeignKey, Integer, String
from sqlalchemy.engine.url import URL
from sqlalchemy.exc import OperationalError, SQLAlchemyError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker

from sopel.tools import Identifier

if sys.version_info.major >= 3:
unicode = str
basestring = str
Expand Down
2 changes: 1 addition & 1 deletion sopel/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Copyright 2014, Elsie Powell, embolalia.com
# Copyright 2019, dgw, technobabbl.es
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import string
import sys
Expand Down
14 changes: 6 additions & 8 deletions sopel/irc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
# Copyright 2019, Florian Strzelecki <[email protected]>
#
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

from datetime import datetime
import logging
import os
import sys
import threading
import time
import os
import logging

try:
import ssl
Expand All @@ -43,15 +45,11 @@
# no SSL support
has_ssl = False

import threading
from datetime import datetime

from sopel import tools
from sopel.trigger import PreTrigger

from .backends import AsynchatBackend, SSLAsynchatBackend
from .isupport import ISupport
from .utils import safe, CapReq
from .utils import CapReq, safe

if sys.version_info.major >= 3:
unicode = str
Expand Down
2 changes: 1 addition & 1 deletion sopel/irc/abstract_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2019, Florian Strzelecki <[email protected]>
#
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import threading

Expand Down
4 changes: 2 additions & 2 deletions sopel/irc/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the Eiffel Forum License 2.
# When working on core IRC protocol related features, consult protocol
# documentation at http://www.irchelp.org/irchelp/rfc/
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import asynchat
import asyncore
Expand All @@ -16,7 +16,7 @@
import sys
from threading import current_thread

from sopel.tools.jobs import JobScheduler, Job
from sopel.tools.jobs import Job, JobScheduler
from .abstract_backends import AbstractIRCBackend
from .utils import get_cnames

Expand Down
2 changes: 1 addition & 1 deletion sopel/irc/isupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Copyright 2019, Florian Strzelecki <[email protected]>
#
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import functools
import itertools
Expand Down
5 changes: 3 additions & 2 deletions sopel/irc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# Copyright 2019, Florian Strzelecki <[email protected]>
#
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import collections
import sys
from dns import resolver, rdtypes

from dns import rdtypes, resolver

if sys.version_info.major >= 3:
unicode = str
Expand Down
11 changes: 8 additions & 3 deletions sopel/loader.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import re
import sys

from sopel.tools import (compile_rule, itervalues, get_command_regexp,
get_nickname_command_regexp, get_action_command_regexp)
from sopel.config import core_section
from sopel.tools import (
compile_rule,
get_action_command_regexp,
get_command_regexp,
get_nickname_command_regexp,
itervalues,
)

default_prefix = core_section.CoreSection.help_prefix.default
del core_section
Expand Down
4 changes: 2 additions & 2 deletions sopel/logger.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
import os
from logging.config import dictConfig
import os

from sopel import tools

Expand Down
2 changes: 1 addition & 1 deletion sopel/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Copyright 2019, Florian Strzelecki <[email protected]>
# Licensed under the Eiffel Forum License 2.

from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

import functools
import re
Expand Down
2 changes: 1 addition & 1 deletion sopel/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals
4 changes: 2 additions & 2 deletions sopel/modules/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
https://sopel.chat
"""
from __future__ import unicode_literals, absolute_import, print_function, division
from __future__ import absolute_import, division, print_function, unicode_literals

from sopel.config.types import (
StaticSection, ValidatedAttribute, FilenameAttribute
FilenameAttribute, StaticSection, ValidatedAttribute
)
import sopel.module

Expand Down
Loading

0 comments on commit 049d517

Please sign in to comment.