mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-18 14:06:07 -04:00
Initial Python 3 compatible code
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import str
|
||||
from builtins import chr
|
||||
from builtins import range
|
||||
import platform
|
||||
system = platform.system()
|
||||
from . import utils
|
||||
import re
|
||||
import htmlentitydefs
|
||||
import html.entities
|
||||
import time
|
||||
import output
|
||||
import languageHandler
|
||||
@@ -22,10 +28,10 @@ def StripChars(s):
|
||||
If we match &blah; and it's not found, &blah; will be returned.
|
||||
if we match #\d+, unichr(digits) will be returned.
|
||||
Else, a unicode string will be returned."""
|
||||
if match.group(1).startswith('#'): return unichr(int(match.group(1)[1:]))
|
||||
replacement = htmlentitydefs.entitydefs.get(match.group(1), "&%s;" % match.group(1))
|
||||
return replacement.decode('iso-8859-1')
|
||||
return unicode(entity_re.sub(matchFunc, s))
|
||||
if match.group(1).startswith('#'): return chr(int(match.group(1)[1:]))
|
||||
replacement = html.entities.entitydefs.get(match.group(1), "&%s;" % match.group(1))
|
||||
return replacement
|
||||
return str(entity_re.sub(matchFunc, s))
|
||||
|
||||
chars = "abcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
|
@@ -1,2 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" this package holds different modules to extract information regarding long tweets. A long tweet contains more than one tweet (such a quoted tweet), or is made via services like twishort."""
|
||||
""" this package holds different modules to extract information regarding long tweets. A long tweet contains more than one tweet (such a quoted tweet), or is made via services like twishort."""
|
||||
from __future__ import unicode_literals
|
@@ -16,6 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
############################################################
|
||||
from __future__ import unicode_literals
|
||||
from sessions.twitter import utils
|
||||
|
||||
def is_long(tweet):
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#
|
||||
############################################################
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import range
|
||||
import logging
|
||||
import requests
|
||||
import keys
|
||||
|
@@ -1,6 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" This is the main session needed to access all Twitter Features."""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
from builtins import range
|
||||
import os
|
||||
import time
|
||||
import logging
|
||||
@@ -368,6 +370,7 @@ class Session(base.baseSession):
|
||||
else:
|
||||
return quoted_tweet
|
||||
original_tweet = self.check_long_tweet(original_tweet)
|
||||
|
||||
if "full_text" in original_tweet:
|
||||
value = "full_text"
|
||||
elif "message" in original_tweet:
|
||||
@@ -430,7 +433,7 @@ class Session(base.baseSession):
|
||||
self.db["users"][user["id_str"]] = user
|
||||
return user["id_str"]
|
||||
else:
|
||||
for i in self.db["users"].keys():
|
||||
for i in list(self.db["users"].keys()):
|
||||
if self.db["users"][i]["screen_name"] == screen_name:
|
||||
return self.db["users"][i]["id_str"]
|
||||
user = utils.if_user_exists(self.twitter, screen_name)
|
||||
|
@@ -1,5 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import str
|
||||
from builtins import range
|
||||
import url_shortener, re
|
||||
import output
|
||||
from twython import TwythonError
|
||||
|
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
import wx
|
||||
|
||||
class authorisationDialog(wx.Dialog):
|
||||
|
Reference in New Issue
Block a user