Fix Python 2 compatibility import

This commit is contained in:
JonnyWong16 2020-04-20 21:00:34 -07:00
parent d6b619934a
commit e527a88a2e
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -33,10 +33,10 @@ import traceback
import plexpy import plexpy
if plexpy.PYTHON2: if plexpy.PYTHON2:
from helpers import is_public_ip import helpers
from config import _BLACKLIST_KEYS, _WHITELIST_KEYS from config import _BLACKLIST_KEYS, _WHITELIST_KEYS
else: else:
from plexpy.helpers import is_public_ip from plexpy import helpers
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
@ -153,7 +153,7 @@ class PublicIPFilter(RegexFilter):
self.regex = re.compile(r'[0-9]+(?:[.-][0-9]+){3}(?!\d*-[a-z0-9]{6})') self.regex = re.compile(r'[0-9]+(?:[.-][0-9]+){3}(?!\d*-[a-z0-9]{6})')
def replace(self, text, ip): def replace(self, text, ip):
if is_public_ip(ip.replace('-', '.')): if helpers.is_public_ip(ip.replace('-', '.')):
partition = '-' if '-' in ip else '.' partition = '-' if '-' in ip else '.'
return text.replace(ip, ip.partition(partition)[0] + (partition + '***') * 3) return text.replace(ip, ip.partition(partition)[0] + (partition + '***') * 3)
return text return text