Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions run_tests.py

This file was deleted.

5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,13 @@
author_email="yurtaev.egor+versionfield@gmail.com",
packages=["versionfield"],
include_package_data=True,
install_requires=[
"future>=0.16.0",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
Expand Down
13 changes: 4 additions & 9 deletions versionfield/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from builtins import str
from past.builtins import basestring
from future.utils import python_2_unicode_compatible

import django
from django.db import models
from django.core.exceptions import ValidationError
Expand All @@ -20,7 +16,7 @@ def to_python(self, value):
if isinstance(value, Version):
return int(value)

if isinstance(value, basestring):
if isinstance(value, str):
return Version(value, self.number_bits)

if value is None:
Expand All @@ -33,7 +29,7 @@ def from_db_value(self, value, *args, **kwargs):
if isinstance(value, Version):
return int(value)

if isinstance(value, basestring):
if isinstance(value, str):
return Version(value, self.number_bits)

if value is None:
Expand All @@ -45,7 +41,7 @@ def to_python(self, value):
if isinstance(value, Version):
return int(value)

if isinstance(value, basestring):
if isinstance(value, str):
return Version(value, self.number_bits)

if value is None:
Expand All @@ -66,7 +62,7 @@ def __init__(self, number_bits=DEFAULT_NUMBER_BITS, *args, **kwargs):
super(VersionField, self).__init__(*args, **kwargs)

def get_prep_value(self, value):
if isinstance(value, basestring):
if isinstance(value, str):
try:
return int(Version(value, self.number_bits))
except ValueError:
Expand All @@ -86,7 +82,6 @@ def formfield(self, **kwargs):
defaults.update(kwargs)
return super(VersionField, self).formfield(**defaults)

@python_2_unicode_compatible
def __str__(self, value):
return str(value)

Expand Down
7 changes: 1 addition & 6 deletions versionfield/version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# coding: utf8
from builtins import str
from past.builtins import basestring
from future.utils import python_2_unicode_compatible

from .utils import convert_version_string_to_int, convert_version_int_to_string


Expand All @@ -15,7 +11,6 @@ def __init__(self, string, number_bits):
self.number_bits = number_bits
self.internal_integer = convert_version_string_to_int(string, number_bits)

@python_2_unicode_compatible
def __str__(self):
return str(convert_version_int_to_string(self.internal_integer, self.number_bits))

Expand All @@ -28,7 +23,7 @@ def __int__(self):
def __eq__(self, other):
if not other:
return False # we are obviously a valid Version, but 'other' isn't
if isinstance(other, basestring):
if isinstance(other, str):
return self == Version(other, self.number_bits)
else:
return int(self) == int(other)