Breaking all twitter classes out into their own package. · pythonforysrc/python-twitter@66a3564 · GitHub
Skip to content

Commit 66a3564

Browse files
committed
Breaking all twitter classes out into their own package.
This is done without breaking exsiting functionality or imports by doing imports in the twitter/__init__.py file. user.py imports Status and status.py import User In order to prevent cyclic import errors, they are imported only if they are actually used. Also, sys was not imported in the setup.py file, causing setup.py to fail if setuptools can't be imported.
1 parent e716410 commit 66a3564

13 files changed

Lines changed: 2471 additions & 2362 deletions

File tree

setup.py

Lines changed: 1 addition & 0 deletions

twitter/__init__.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python
2+
#
3+
# vim: sw=2 ts=2 sts=2
4+
#
5+
# Copyright 2007 The Python-Twitter Developers
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
'''A library that provides a Python interface to the Twitter API'''
20+
21+
__author__ = 'python-twitter@googlegroups.com'
22+
__version__ = '1.2'
23+
24+
try:
25+
# Python >= 2.6
26+
import json as simplejson
27+
except ImportError:
28+
try:
29+
# Python < 2.6
30+
import simplejson
31+
except ImportError:
32+
try:
33+
# Google App Engine
34+
from django.utils import simplejson
35+
except ImportError:
36+
raise ImportError, "Unable to load a json library"
37+
# parse_qsl moved to urlparse module in v2.6
38+
try:
39+
from urlparse import parse_qsl, parse_qs
40+
except ImportError:
41+
from cgi import parse_qsl, parse_qs
42+
43+
try:
44+
from hashlib import md5
45+
except ImportError:
46+
from md5 import md5
47+
48+
from _file_cache import _FileCache
49+
from error import TwitterError
50+
from direct_message import DirectMessage
51+
from hashtag import Hashtag
52+
from parse_tweet import ParseTweet
53+
from trend import Trend
54+
from url import Url
55+
from status import Status
56+
from user import User
57+
from list import List
58+
from api import Api

twitter/_file_cache.py

Lines changed: 150 additions & 0 deletions

0 commit comments

Comments
 (0)