Remove models.py

This commit is contained in:
Mads Marquart
2019-08-28 22:59:22 +02:00
parent 62c9512734
commit da4ed73ec6
13 changed files with 51 additions and 48 deletions

View File

@@ -9,8 +9,27 @@ import logging as _logging
# Set default logging handler to avoid "No handler found" warnings.
_logging.getLogger(__name__).addHandler(_logging.NullHandler())
# These imports are far too general, but they're needed for backwards compatbility.
from .models import *
# The order of these is somewhat significant, e.g. User has to be imported after Thread!
from . import _core, _util
from ._exception import FBchatException, FBchatFacebookError, FBchatUserError
from ._thread import ThreadType, ThreadLocation, ThreadColor, Thread
from ._user import TypingStatus, User, ActiveStatus
from ._group import Group, Room
from ._page import Page
from ._message import EmojiSize, MessageReaction, Mention, Message
from ._attachment import Attachment, UnsentMessage, ShareAttachment
from ._sticker import Sticker
from ._location import LocationAttachment, LiveLocationAttachment
from ._file import FileAttachment, AudioAttachment, ImageAttachment, VideoAttachment
from ._quick_reply import (
QuickReply,
QuickReplyText,
QuickReplyLocation,
QuickReplyPhoneNumber,
QuickReplyEmail,
)
from ._poll import Poll, PollOption
from ._plan import GuestStatus, Plan
from ._client import Client

View File

@@ -5,7 +5,26 @@ from collections import OrderedDict
from ._core import log
from . import _util, _graphql, _state
from .models import *
from ._exception import FBchatException, FBchatFacebookError, FBchatUserError
from ._thread import ThreadType, ThreadLocation, ThreadColor
from ._user import TypingStatus, User, ActiveStatus
from ._group import Group
from ._page import Page
from ._message import EmojiSize, MessageReaction, Mention, Message
from ._attachment import Attachment
from ._sticker import Sticker
from ._location import LocationAttachment, LiveLocationAttachment
from ._file import ImageAttachment, VideoAttachment
from ._quick_reply import (
QuickReply,
QuickReplyText,
QuickReplyLocation,
QuickReplyPhoneNumber,
QuickReplyEmail,
)
from ._poll import Poll, PollOption
from ._plan import Plan
ACONTEXT = {

View File

@@ -1,27 +0,0 @@
"""This file is here to maintain backwards compatability, and to re-export our models
into the global module (see `__init__.py`).
A common pattern was to use `from fbchat.models import *`, hence we need this while
transitioning to a better code structure.
"""
from ._core import Enum
from ._exception import FBchatException, FBchatFacebookError, FBchatUserError
from ._thread import ThreadType, ThreadLocation, ThreadColor, Thread
from ._user import TypingStatus, User, ActiveStatus
from ._group import Group, Room
from ._page import Page
from ._message import EmojiSize, MessageReaction, Mention, Message
from ._attachment import Attachment, UnsentMessage, ShareAttachment
from ._sticker import Sticker
from ._location import LocationAttachment, LiveLocationAttachment
from ._file import FileAttachment, AudioAttachment, ImageAttachment, VideoAttachment
from ._quick_reply import (
QuickReply,
QuickReplyText,
QuickReplyLocation,
QuickReplyPhoneNumber,
QuickReplyEmail,
)
from ._poll import Poll, PollOption
from ._plan import GuestStatus, Plan

View File

@@ -3,7 +3,7 @@ import json
from utils import *
from contextlib import contextmanager
from fbchat.models import ThreadType, Message, Mention
from fbchat import ThreadType, Message, Mention
@pytest.fixture(scope="session")

View File

@@ -3,8 +3,7 @@ import py_compile
from glob import glob
from os import path, environ
from fbchat import Client
from fbchat.models import FBchatUserError, Message
from fbchat import FBchatUserError, Message, Client
@pytest.mark.offline

View File

@@ -1,7 +1,7 @@
import pytest
from os import path
from fbchat.models import ThreadType, Message, Mention, EmojiSize, Sticker
from fbchat import ThreadType, Message, Mention, EmojiSize, Sticker
from utils import subset, STICKER_LIST, EMOJI_LIST

View File

@@ -1,6 +1,6 @@
import pytest
from fbchat.models import Message, MessageReaction
from fbchat import Message, MessageReaction
from utils import subset

View File

@@ -1,6 +1,6 @@
import pytest
from fbchat.models import Plan, FBchatFacebookError, ThreadType
from fbchat import Plan, FBchatFacebookError, ThreadType
from utils import random_hex, subset
from time import time

View File

@@ -1,6 +1,6 @@
import pytest
from fbchat.models import Poll, PollOption, ThreadType
from fbchat import Poll, PollOption, ThreadType
from utils import random_hex, subset

View File

@@ -1,4 +1,4 @@
from fbchat.models import ThreadType
from fbchat import ThreadType
def test_search_for(client1):

View File

@@ -1,7 +1,7 @@
import pytest
from os import path
from fbchat.models import FBchatFacebookError, Message, Mention
from fbchat import FBchatFacebookError, Message, Mention
from utils import subset, STICKER_LIST, EMOJI_LIST, TEXT_LIST

View File

@@ -1,12 +1,6 @@
import pytest
from fbchat.models import (
Message,
ThreadType,
FBchatFacebookError,
TypingStatus,
ThreadColor,
)
from fbchat import Message, ThreadType, FBchatFacebookError, TypingStatus, ThreadColor
from utils import random_hex, subset
from os import path

View File

@@ -5,8 +5,7 @@ import pytest
from os import environ
from random import randrange
from contextlib import contextmanager
from fbchat import Client
from fbchat.models import ThreadType, EmojiSize, FBchatFacebookError, Sticker
from fbchat import ThreadType, EmojiSize, FBchatFacebookError, Sticker, Client
log = logging.getLogger("fbchat.tests").addHandler(logging.NullHandler())