python3 only, stop using six

This commit is contained in:
j 2016-10-13 15:19:15 +02:00
parent 2f5f0dc864
commit d5902e2437
6 changed files with 13 additions and 16 deletions

View file

@ -4,8 +4,8 @@ from __future__ import division, print_function, absolute_import
import os.path
import hashlib
import urllib
from six.moves import urllib
from django.db import models
from django.core.files.base import ContentFile

View file

@ -3,7 +3,7 @@
from __future__ import division, print_function, absolute_import
import os
from six.moves.urllib.parse import quote
from urllib.parse import quote
from django.db import models

View file

@ -5,14 +5,12 @@ from __future__ import division, print_function, absolute_import
import re
import os
import unicodedata
from six.moves.urllib.parse import quote
from six import string_types
from urllib.parse import quote
import hashlib
import base64
import binascii
import json
from six import string_types
from django.db import models
from django.conf import settings
import ox
@ -24,7 +22,7 @@ from poster.models import getPosters
def normalize_value(value):
if isinstance(value, bytes):
value = value.decode('utf-8')
if isinstance(value, string_types):
if isinstance(value, str):
value = unicodedata.normalize('NFD', value)
return value
@ -39,7 +37,7 @@ def find(info, guess=True):
else:
for key in Imdb.keys:
if key in info and info[key]:
if isinstance(info[key], string_types):
if isinstance(info[key], str):
fkey = '%s__iexact' % key
else:
fkey = key
@ -121,7 +119,7 @@ class Imdb(models.Model):
value = info[key]
if isinstance(value, list):
value = '\n'.join(value) + '\n'
if isinstance(value, string_types):
if isinstance(value, str):
value = normalize_value(value)
setattr(self, key, value)
if self.season and self.season < 0:
@ -230,7 +228,7 @@ class Imdb(models.Model):
for key in list(j):
if not j[key]:
del j[key]
if 'year' in j and isinstance(j['year'], string_types) and j['year'].isdigit():
if 'year' in j and isinstance(j['year'], str) and j['year'].isdigit():
j['year'] = int(j['year'])
return j

View file

@ -6,7 +6,6 @@ import copy
from django.db import models
from django.utils import datetime_safe
from six import string_types
from ox.utils import json
@ -73,7 +72,7 @@ class DictField(models.TextField):
if isinstance(value, self._type):
value = self.dumps(value)
if value is not None:
assert isinstance(value, string_types)
assert isinstance(value, str)
value = models.TextField.get_prep_value(self, value)
return value

View file

@ -3,7 +3,7 @@
import os
import mimetypes
from datetime import datetime, timedelta
from six.moves.urllib.parse import quote
from urllib.parse import quote
from django.http import HttpResponse, Http404
from django.conf import settings

View file

@ -2,11 +2,11 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, print_function, absolute_import
import os.path
import hashlib
import os.path
import socket
import urllib
from six.moves import urllib
from django.db import models
import ox