From d5902e24376fedb3e0c21220b257cb91314b5b07 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 13 Oct 2016 15:19:15 +0200 Subject: [PATCH] python3 only, stop using six --- oxdata/cover/models.py | 2 +- oxdata/lookup/models.py | 2 +- oxdata/movie/models.py | 16 +++++++--------- oxdata/oxdjango/fields.py | 3 +-- oxdata/oxdjango/http.py | 2 +- oxdata/poster/models.py | 4 ++-- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/oxdata/cover/models.py b/oxdata/cover/models.py index 1c8cad5..8cec1ee 100644 --- a/oxdata/cover/models.py +++ b/oxdata/cover/models.py @@ -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 diff --git a/oxdata/lookup/models.py b/oxdata/lookup/models.py index eac406c..a980c3b 100644 --- a/oxdata/lookup/models.py +++ b/oxdata/lookup/models.py @@ -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 diff --git a/oxdata/movie/models.py b/oxdata/movie/models.py index df6b50a..2a084be 100644 --- a/oxdata/movie/models.py +++ b/oxdata/movie/models.py @@ -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,12 +37,12 @@ def find(info, guess=True): else: for key in Imdb.keys: if key in info and info[key]: - if isinstance(info[key], string_types): - fkey = '%s__iexact'%key + if isinstance(info[key], str): + fkey = '%s__iexact' % key else: fkey = key if isinstance(info[key], list): - fkey = '%s__iexact'%key + fkey = '%s__iexact' % key value = normalize_value('\n'.join(info[key]) + '\n') else: value = normalize_value(info[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 diff --git a/oxdata/oxdjango/fields.py b/oxdata/oxdjango/fields.py index fdb5722..275b068 100644 --- a/oxdata/oxdjango/fields.py +++ b/oxdata/oxdjango/fields.py @@ -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 diff --git a/oxdata/oxdjango/http.py b/oxdata/oxdjango/http.py index aa76a65..d687ce0 100644 --- a/oxdata/oxdjango/http.py +++ b/oxdata/oxdjango/http.py @@ -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 diff --git a/oxdata/poster/models.py b/oxdata/poster/models.py index accda1f..fd75c9e 100644 --- a/oxdata/poster/models.py +++ b/oxdata/poster/models.py @@ -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