Browse Source

[lint] Fix import order

Reorder imports to be consistenly grouped by standard library, third
party library, and local modules in that order thoughout the library.
pull/1739/head
Hornwitser 7 years ago
committed by Rapptz
parent
commit
efb4ff850e
  1. 6
      discord/__init__.py
  2. 3
      discord/__main__.py
  3. 1
      discord/abc.py
  4. 3
      discord/activity.py
  5. 9
      discord/channel.py
  6. 20
      discord/client.py
  7. 3
      discord/ext/commands/bot.py
  8. 3
      discord/ext/commands/converter.py
  9. 5
      discord/ext/commands/core.py
  10. 14
      discord/gateway.py
  11. 1
      discord/guild.py
  12. 9
      discord/http.py
  13. 7
      discord/opus.py
  14. 11
      discord/shard.py
  15. 18
      discord/state.py
  16. 7
      discord/user.py
  17. 17
      discord/utils.py
  18. 13
      discord/voice_client.py
  19. 3
      discord/webhook.py

6
discord/__init__.py

@ -17,6 +17,9 @@ __license__ = 'MIT'
__copyright__ = 'Copyright 2015-2017 Rapptz'
__version__ = '1.0.0a'
from collections import namedtuple
import logging
from .client import Client, AppInfo
from .user import User, ClientUser, Profile
from .emoji import Emoji, PartialEmoji
@ -37,7 +40,6 @@ from .object import Object
from .reaction import Reaction
from . import utils, opus, abc
from .enums import *
from collections import namedtuple
from .embeds import Embed
from .shard import AutoShardedClient
from .player import *
@ -46,8 +48,6 @@ from .voice_client import VoiceClient
from .audit_logs import AuditLogChanges, AuditLogEntry, AuditLogDiff
from .raw_models import *
import logging
VersionInfo = namedtuple('VersionInfo', 'major minor micro releaselevel serial')
version_info = VersionInfo(major=1, minor=0, micro=0, releaselevel='alpha', serial=0)

3
discord/__main__.py

@ -24,11 +24,12 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import discord
import argparse
import sys
from pathlib import Path
import discord
def core(parser, args):
pass

1
discord/abc.py

@ -27,7 +27,6 @@ DEALINGS IN THE SOFTWARE.
import abc
import copy
import asyncio
from collections import namedtuple
from .iterators import HistoryIterator

3
discord/activity.py

@ -24,9 +24,10 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import datetime
from .enums import ActivityType, try_enum
from .colour import Colour
import datetime
__all__ = ['Activity', 'Streaming', 'Game', 'Spotify']

9
discord/channel.py

@ -24,6 +24,10 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import time
import asyncio
import discord.abc
from .permissions import Permissions
from .enums import ChannelType, try_enum
from .mixins import Hashable
@ -31,11 +35,6 @@ from . import utils
from .errors import ClientException, NoMoreItems
from .webhook import Webhook
import discord.abc
import time
import asyncio
__all__ = ['TextChannel', 'VoiceChannel', 'DMChannel', 'CategoryChannel', 'GroupChannel', '_channel_factory']
async def _single_delete_strategy(messages):

20
discord/client.py

@ -24,6 +24,17 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import asyncio
from collections import namedtuple
import logging
import re
import signal
import sys
import traceback
import aiohttp
import websockets
from .user import User, Profile
from .invite import Invite
from .object import Object
@ -39,15 +50,6 @@ from . import utils
from .backoff import ExponentialBackoff
from .webhook import Webhook
import asyncio
import aiohttp
import websockets
import logging, traceback
import sys, re
import signal
from collections import namedtuple
log = logging.getLogger(__name__)
AppInfo = namedtuple('AppInfo',

3
discord/ext/commands/bot.py

@ -26,13 +26,14 @@ DEALINGS IN THE SOFTWARE.
import asyncio
import collections
import discord
import inspect
import importlib
import sys
import traceback
import re
import discord
from .core import GroupMixin, Command
from .view import StringView
from .context import Context

3
discord/ext/commands/converter.py

@ -24,10 +24,11 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import discord
import re
import inspect
import discord
from .errors import BadArgument, NoPrivateMessage
__all__ = ['Converter', 'MemberConverter', 'UserConverter',

5
discord/ext/commands/core.py

@ -25,11 +25,12 @@ DEALINGS IN THE SOFTWARE.
"""
import asyncio
import inspect
import discord
import functools
import inspect
import typing
import discord
from .errors import *
from .cooldowns import Cooldown, BucketType, CooldownMapping
from .view import quoted_word

14
discord/gateway.py

@ -24,19 +24,21 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import asyncio
from collections import namedtuple
import json
import logging
import struct
import sys
import time
import threading
import zlib
import websockets
import asyncio
from . import utils
from .activity import _ActivityTag
from .errors import ConnectionClosed, InvalidArgument
import logging
import zlib, json
from collections import namedtuple
import threading
import struct
log = logging.getLogger(__name__)

1
discord/guild.py

@ -25,7 +25,6 @@ DEALINGS IN THE SOFTWARE.
"""
import copy
from collections import namedtuple, defaultdict
from . import utils

9
discord/http.py

@ -24,19 +24,20 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import aiohttp
import asyncio
import json
import sys
import logging
import weakref
import sys
from urllib.parse import quote as _uriquote
import weakref
log = logging.getLogger(__name__)
import aiohttp
from .errors import HTTPException, Forbidden, NotFound, LoginFailure, GatewayNotFound
from . import __version__, utils
log = logging.getLogger(__name__)
async def json_or_text(response):
text = await response.text(encoding='utf-8')
if response.headers['content-type'] == 'application/json':

7
discord/opus.py

@ -24,13 +24,14 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import array
import ctypes
import ctypes.util
import array
from .errors import DiscordException
import logging
import sys
import os.path
import sys
from .errors import DiscordException
log = logging.getLogger(__name__)
c_int_ptr = ctypes.POINTER(ctypes.c_int)

11
discord/shard.py

@ -24,6 +24,12 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import asyncio
import itertools
import logging
import websockets
from .state import AutoShardedConnectionState
from .client import Client
from .gateway import *
@ -31,11 +37,6 @@ from .errors import ClientException, InvalidArgument
from . import utils
from .enums import Status
import asyncio
import logging
import websockets
import itertools
log = logging.getLogger(__name__)
class Shard:

18
discord/state.py

@ -24,6 +24,16 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import asyncio
from collections import deque, namedtuple, OrderedDict
import copy
import datetime
import enum
import itertools
import logging
import math
import weakref
from .guild import Guild
from .activity import _ActivityTag
from .user import User, ClientUser
@ -38,14 +48,6 @@ from .enums import ChannelType, try_enum, Status
from . import utils
from .embeds import Embed
from collections import deque, namedtuple, OrderedDict
import copy, enum, math
import datetime
import asyncio
import logging
import weakref
import itertools
class ListenerType(enum.Enum):
chunk = 0

7
discord/user.py

@ -24,15 +24,14 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
from collections import namedtuple
import discord.abc
from .utils import snowflake_time, _bytes_to_base64_data, parse_time, valid_icon_size
from .enums import DefaultAvatar, RelationshipType, UserFlags, HypeSquadHouse
from .errors import ClientException, InvalidArgument
from .colour import Colour
from collections import namedtuple
import discord.abc
VALID_STATIC_FORMATS = {"jpeg", "jpg", "webp", "png"}
VALID_AVATAR_FORMATS = VALID_STATIC_FORMATS | {"gif"}

17
discord/utils.py

@ -24,18 +24,19 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
from re import split as re_split
from .errors import InvalidArgument
import array
import asyncio
from base64 import b64encode
from email.utils import parsedate_to_datetime
from inspect import isawaitable as _isawaitable
from bisect import bisect_left
import datetime
import asyncio
from email.utils import parsedate_to_datetime
import functools
from inspect import isawaitable as _isawaitable
import json
import warnings, functools
import array
from re import split as re_split
import warnings
from .errors import InvalidArgument
DISCORD_EPOCH = 1420070400000

13
discord/voice_client.py

@ -45,7 +45,11 @@ import logging
import struct
import threading
log = logging.getLogger(__name__)
from . import opus
from .backoff import ExponentialBackoff
from .gateway import *
from .errors import ClientException, ConnectionClosed
from .player import AudioPlayer, AudioSource
try:
import nacl.secret
@ -53,11 +57,8 @@ try:
except ImportError:
has_nacl = False
from . import opus
from .backoff import ExponentialBackoff
from .gateway import *
from .errors import ClientException, ConnectionClosed
from .player import AudioPlayer, AudioSource
log = logging.getLogger(__name__)
class VoiceClient:
"""Represents a Discord voice connection.

3
discord/webhook.py

@ -24,12 +24,13 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""
import aiohttp
import asyncio
import json
import time
import re
import aiohttp
from . import utils
from .errors import InvalidArgument, HTTPException, Forbidden, NotFound
from .user import BaseUser, User

Loading…
Cancel
Save