Skip to content

Commit d7ae099

Browse files
committed
i blue it
1 parent 712cc18 commit d7ae099

File tree

9 files changed

+85
-93
lines changed

9 files changed

+85
-93
lines changed

diskcache/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ def __repr__(self):
4949
'statistics': 0, # False
5050
'tag_index': 0, # False
5151
'eviction_policy': 'least-recently-stored',
52-
'size_limit': 2 ** 30, # 1gb
52+
'size_limit': 2**30, # 1gb
5353
'cull_limit': 10,
5454
'sqlite_auto_vacuum': 1, # FULL
55-
'sqlite_cache_size': 2 ** 13, # 8,192 pages
55+
'sqlite_cache_size': 2**13, # 8,192 pages
5656
'sqlite_journal_mode': 'wal',
57-
'sqlite_mmap_size': 2 ** 26, # 64mb
57+
'sqlite_mmap_size': 2**26, # 64mb
5858
'sqlite_synchronous': 1, # NORMAL
59-
'disk_min_file_size': 2 ** 15, # 32kb
59+
'disk_min_file_size': 2**15, # 32kb
6060
'disk_pickle_protocol': pickle.HIGHEST_PROTOCOL,
6161
}
6262

@@ -212,7 +212,7 @@ def store(self, value, read, key=UNKNOWN):
212212
size = op.getsize(full_path)
213213
return size, MODE_TEXT, filename, None
214214
elif read:
215-
reader = ft.partial(value.read, 2 ** 22)
215+
reader = ft.partial(value.read, 2**22)
216216
filename, full_path = self.filename(key, value)
217217
iterator = iter(reader, b'')
218218
size = self._write(full_path, iterator, 'xb')

diskcache/fanout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(
4545
timeout=timeout,
4646
disk=disk,
4747
size_limit=size_limit,
48-
**settings
48+
**settings,
4949
)
5050
for num in range(shards)
5151
)

tests/benchmark_glob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
print(template % ('Count', 'Time'))
2323
print(' '.join(['=' * size] * len(cols)))
2424

25-
for count in [10 ** exp for exp in range(6)]:
25+
for count in [10**exp for exp in range(6)]:
2626
for value in range(count):
2727
with open(op.join('tmp', '%s.tmp' % value), 'wb') as writer:
2828
pass

tests/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
DEBUG = True
2727

28-
ALLOWED_HOSTS = [u'testserver']
28+
ALLOWED_HOSTS = ['testserver']
2929

3030

3131
# Application definition

tests/stress_test_core.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@ def make_long():
3333

3434
def make_unicode():
3535
word_size = random.randint(1, 26)
36-
word = u''.join(
37-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
38-
)
36+
word = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz', word_size))
3937
size = random.randint(1, int(200 / 13))
4038
return word * size
4139

4240
def make_bytes():
4341
word_size = random.randint(1, 26)
44-
word = u''.join(
45-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
42+
word = ''.join(
43+
random.sample('abcdefghijklmnopqrstuvwxyz', word_size)
4644
).encode('utf-8')
4745
size = random.randint(1, int(200 / 13))
4846
return word * size
@@ -77,18 +75,16 @@ def make_long():
7775

7876
def make_unicode():
7977
word_size = random.randint(1, 26)
80-
word = u''.join(
81-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
82-
)
83-
size = random.randint(1, int(2 ** 16 / 13))
78+
word = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz', word_size))
79+
size = random.randint(1, int(2**16 / 13))
8480
return word * size
8581

8682
def make_bytes():
8783
word_size = random.randint(1, 26)
88-
word = u''.join(
89-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
84+
word = ''.join(
85+
random.sample('abcdefghijklmnopqrstuvwxyz', word_size)
9086
).encode('utf-8')
91-
size = random.randint(1, int(2 ** 16 / 13))
87+
size = random.randint(1, int(2**16 / 13))
9288
return word * size
9389

9490
def make_float():
@@ -233,7 +229,7 @@ def percentile(sequence, percent):
233229
def stress_test(
234230
create=True,
235231
delete=True,
236-
eviction_policy=u'least-recently-stored',
232+
eviction_policy='least-recently-stored',
237233
processes=1,
238234
threads=1,
239235
):
@@ -293,17 +289,17 @@ def stress_test(
293289

294290
def stress_test_lru():
295291
"""Stress test least-recently-used eviction policy."""
296-
stress_test(eviction_policy=u'least-recently-used')
292+
stress_test(eviction_policy='least-recently-used')
297293

298294

299295
def stress_test_lfu():
300296
"""Stress test least-frequently-used eviction policy."""
301-
stress_test(eviction_policy=u'least-frequently-used')
297+
stress_test(eviction_policy='least-frequently-used')
302298

303299

304300
def stress_test_none():
305301
"""Stress test 'none' eviction policy."""
306-
stress_test(eviction_policy=u'none')
302+
stress_test(eviction_policy='none')
307303

308304

309305
def stress_test_mp():
@@ -396,7 +392,7 @@ def stress_test_mp():
396392
'-v',
397393
'--eviction-policy',
398394
type=str,
399-
default=u'least-recently-stored',
395+
default='least-recently-stored',
400396
)
401397

402398
args = parser.parse_args()

tests/stress_test_fanout.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ def make_long():
3232

3333
def make_unicode():
3434
word_size = random.randint(1, 26)
35-
word = u''.join(
36-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
37-
)
35+
word = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz', word_size))
3836
size = random.randint(1, int(200 / 13))
3937
return word * size
4038

4139
def make_bytes():
4240
word_size = random.randint(1, 26)
43-
word = u''.join(
44-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
41+
word = ''.join(
42+
random.sample('abcdefghijklmnopqrstuvwxyz', word_size)
4543
).encode('utf-8')
4644
size = random.randint(1, int(200 / 13))
4745
return word * size
@@ -76,18 +74,16 @@ def make_long():
7674

7775
def make_unicode():
7876
word_size = random.randint(1, 26)
79-
word = u''.join(
80-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
81-
)
82-
size = random.randint(1, int(2 ** 16 / 13))
77+
word = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz', word_size))
78+
size = random.randint(1, int(2**16 / 13))
8379
return word * size
8480

8581
def make_bytes():
8682
word_size = random.randint(1, 26)
87-
word = u''.join(
88-
random.sample(u'abcdefghijklmnopqrstuvwxyz', word_size)
83+
word = ''.join(
84+
random.sample('abcdefghijklmnopqrstuvwxyz', word_size)
8985
).encode('utf-8')
90-
size = random.randint(1, int(2 ** 16 / 13))
86+
size = random.randint(1, int(2**16 / 13))
9187
return word * size
9288

9389
def make_float():
@@ -224,7 +220,7 @@ def percentile(sequence, percent):
224220
def stress_test(
225221
create=True,
226222
delete=True,
227-
eviction_policy=u'least-recently-stored',
223+
eviction_policy='least-recently-stored',
228224
processes=1,
229225
threads=1,
230226
):
@@ -284,17 +280,17 @@ def stress_test(
284280

285281
def stress_test_lru():
286282
"""Stress test least-recently-used eviction policy."""
287-
stress_test(eviction_policy=u'least-recently-used')
283+
stress_test(eviction_policy='least-recently-used')
288284

289285

290286
def stress_test_lfu():
291287
"""Stress test least-frequently-used eviction policy."""
292-
stress_test(eviction_policy=u'least-frequently-used')
288+
stress_test(eviction_policy='least-frequently-used')
293289

294290

295291
def stress_test_none():
296292
"""Stress test 'none' eviction policy."""
297-
stress_test(eviction_policy=u'none')
293+
stress_test(eviction_policy='none')
298294

299295

300296
def stress_test_mp():
@@ -387,7 +383,7 @@ def stress_test_mp():
387383
'-v',
388384
'--eviction-policy',
389385
type=str,
390-
default=u'least-recently-stored',
386+
default='least-recently-stored',
391387
)
392388

393389
args = parser.parse_args()

0 commit comments

Comments
 (0)