getting ready for python 3

This commit is contained in:
Jon Haddad
2014-08-13 15:09:53 -07:00
parent 9411dc7ceb
commit 733025e5e9
3 changed files with 30 additions and 27 deletions

View File

@@ -423,16 +423,16 @@ class TimeUUID(UUID):
clock_seq = None
nanoseconds = int(timestamp * 1e9)
timestamp = int(nanoseconds // 100) + 0x01b21dd213814000L
timestamp = int(nanoseconds // 100) + 0x01b21dd213814000
if clock_seq is None:
import random
clock_seq = random.randrange(1 << 14L) # instead of stable storage
time_low = timestamp & 0xffffffffL
time_mid = (timestamp >> 32L) & 0xffffL
time_hi_version = (timestamp >> 48L) & 0x0fffL
clock_seq_low = clock_seq & 0xffL
clock_seq_hi_variant = (clock_seq >> 8L) & 0x3fL
clock_seq = random.randrange(1 << 14) # instead of stable storage
time_low = timestamp & 0xffffffff
time_mid = (timestamp >> 32) & 0xffff
time_hi_version = (timestamp >> 48) & 0x0fff
clock_seq_low = clock_seq & 0xff
clock_seq_hi_variant = (clock_seq >> 8) & 0x3f
if node is None:
node = getnode()
return pyUUID(fields=(time_low, time_mid, time_hi_version,

View File

@@ -158,7 +158,7 @@ class TablePropertiesTests(BaseCassEngTestCase):
}
if CASSANDRA_VERSION >= 20:
expected['default_time_to_live'] = 4756,
expected['default_time_to_live'] = 4756
expected['index_interval'] = 98706
expected['memtable_flush_period_in_ms'] = 43681
@@ -168,34 +168,37 @@ class TablePropertiesTests(BaseCassEngTestCase):
ModelWithTableProperties.__bloom_filter_fp_chance__ = 0.66778
ModelWithTableProperties.__caching__ = CACHING_NONE
ModelWithTableProperties.__comment__ = 'xirAkRWZVVvsmzRvXamiEcQkshkUIDINVJZgLYSdnGHweiBrAiJdLJkVohdRy'
ModelWithTableProperties.__default_time_to_live__ = 65178
ModelWithTableProperties.__gc_grace_seconds__ = 96362
ModelWithTableProperties.__index_interval__ = 94207
ModelWithTableProperties.__memtable_flush_period_in_ms__ = 60210
ModelWithTableProperties.__populate_io_cache_on_flush__ = False
ModelWithTableProperties.__read_repair_chance__ = 0.2989
ModelWithTableProperties.__replicate_on_write__ = True
ModelWithTableProperties.__dclocal_read_repair_chance__ = 0.12732
if CASSANDRA_VERSION >= 20:
ModelWithTableProperties.__default_time_to_live__ = 65178
ModelWithTableProperties.__memtable_flush_period_in_ms__ = 60210
ModelWithTableProperties.__index_interval__ = 94207
sync_table(ModelWithTableProperties)
table_settings = management.get_table_settings(ModelWithTableProperties).options
self.assertDictContainsSubset({
'bloom_filter_fp_chance': 0.66778,
'caching': CACHING_NONE,
'comment': 'xirAkRWZVVvsmzRvXamiEcQkshkUIDINVJZgLYSdnGHweiBrAiJdLJkVohdRy',
'default_time_to_live': 65178,
'gc_grace_seconds': 96362,
'index_interval': 94207,
'memtable_flush_period_in_ms': 60210,
'populate_io_cache_on_flush': False,
'read_repair_chance': 0.2989,
'replicate_on_write': True,
expected = {'bloom_filter_fp_chance': 0.66778,
'caching': CACHING_NONE,
'comment': 'xirAkRWZVVvsmzRvXamiEcQkshkUIDINVJZgLYSdnGHweiBrAiJdLJkVohdRy',
'gc_grace_seconds': 96362,
'populate_io_cache_on_flush': False,
'read_repair_chance': 0.2989,
'replicate_on_write': True # TODO see above comment re: native driver missing local read repair chance
# 'local_read_repair_chance': 0.12732,
}
if CASSANDRA_VERSION >= 20:
expected['memtable_flush_period_in_ms'] = 60210
expected['default_time_to_live'] = 65178
expected['index_interval'] = 94207
# TODO see above comment re: native driver missing local read repair chance
# 'local_read_repair_chance': 0.12732,
}, table_settings)
self.assertDictContainsSubset(expected, table_settings)
class SyncTableTests(BaseCassEngTestCase):

View File

@@ -31,9 +31,9 @@ setup(
"Topic :: Software Development :: Libraries :: Python Modules",
],
keywords='cassandra,cql,orm',
install_requires = ['cassandra-driver >= 2.1.0'],
install_requires = ['cassandra-driver >= 2.1.0', 'six >= 1.7.2'],
author='Blake Eggleston, Jon Haddad',
author_email='bdeggleston@gmail.com',
author_email='bdeggleston@gmail.com, jon@jonhaddad.com',
url='https://github.com/cqlengine/cqlengine',
license='BSD',
packages=find_packages(),