Skip to content

Commit 8e7ac7e

Browse files
committed
Using gzip to store pickle data
1 parent 333fb98 commit 8e7ac7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+42
-9407975
lines changed

net/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
__author__ = 'nathanwoods'

src/data/__main__.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from sys import argv
2+
import pickle
3+
import gzip
4+
from os import path
5+
6+
7+
if __name__ == '__main__':
8+
if not argv or len(argv) < 2:
9+
print 'No name given'
10+
exit(1)
11+
12+
name = argv[1]
13+
14+
file_path = path.abspath(path.join(
15+
path.dirname(__file__), name, '{}.score.p'.format(name)
16+
))
17+
18+
new_file = path.abspath(path.join(
19+
path.dirname(__file__), name, 'score.pklz'
20+
))
21+
22+
print name, file_path
23+
24+
if not path.isfile(file_path):
25+
print 'Input file does not exist:', file_path
26+
exit(1)
27+
28+
if path.isfile(new_file):
29+
print 'Compressed file already exists:', new_file
30+
exit(1)
31+
32+
with open(file_path, 'rb') as f:
33+
data = pickle.load(f)
34+
35+
with gzip.open(new_file, 'wb') as f:
36+
pickle.dump(data, f)

0 commit comments

Comments
 (0)