Skip to content

Commit c8f1195

Browse files
committed
Merge branch 'release/0.2.0'
2 parents 07605ce + 0cd9816 commit c8f1195

File tree

13 files changed

+1090
-205
lines changed

13 files changed

+1090
-205
lines changed

Pipfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
ipython = "*"
8+
pytest = "*"
9+
hypothesis = "*"
10+
pylint = "*"
11+
sphinx = "*"
12+
sphinx-rtd-theme = "*"
13+
twine = "*"
14+
15+
[packages]
16+
logalpha = "<2"
17+
numpy = "*"
18+
scipy = "*"
19+
matplotlib = "*"
20+
seaborn = "*"
21+
pandas = "*"
22+
astropy = "*"
23+
tqdm = "*"
24+
h5py = "*"
25+
dataphile = {editable = true,path = "."}
26+
27+
[requires]
28+
python_version = "3.7"

Pipfile.lock

Lines changed: 790 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dataphile/__init__.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,3 @@
1111
# If not, see <https://www.apache.org/licenses/LICENSE-2.0>.
1212

1313
"""Package initialization for Dataphile package."""
14-
15-
# standard libs
16-
import platform
17-
import sys
18-
19-
# internal libs
20-
from .core.logging import log
21-
22-
from .__meta__ import __version__
23-
24-
if sys.version_info < (3, 5):
25-
print('dataphile requires at least Python 3.5 to run.')
26-
sys.exit(1)
27-
28-
29-
def main():
30-
"""Main entry point for dataphile."""
31-
32-
try:
33-
log.info("Starting Dataphile {}".format(__version__))
34-
log.info("{} {} detected".format(platform.python_implementation(),
35-
platform.python_version()))
36-
37-
except KeyboardInterrupt:
38-
log.error("Stopping dataphile with KeyboardInterrupt")
39-
return 0
40-
41-
except SystemExit:
42-
log.info("Stopping dataphile with SystemExit")
43-
return 0

dataphile/__main__.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

dataphile/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
__appname__ = 'dataphile'
17-
__version__ = '0.1.8'
17+
__version__ = '0.2.0'
1818
__authors__ = 'Geoffrey Lentner'
1919
__contact__ = '<glentner@gmail.com>'
2020
__license__ = 'Apache License'

dataphile/bin/compress.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# This file is part of the Dataphile package.
2+
#
3+
# This program is free software: you can redistribute it and/or modify it under the
4+
# terms of the Apache License (v2.0) as published by the Apache Software Foundation.
5+
#
6+
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
7+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8+
# PARTICULAR PURPOSE. See the Apache License for more details.
9+
#
10+
# You should have received a copy of the Apache License along with this program.
11+
# If not, see <https://www.apache.org/licenses/LICENSE-2.0>.
12+
13+
"""Apply compression/decompression to data."""
14+
15+
# standard libs
16+
import sys
17+
import argparse
18+
import platform
19+
20+
# internal libs
21+
from ..io.stream import BinaryStream
22+
from ..io.compression import compress, decompress
23+
24+
if platform.system() == 'Windows':
25+
# FIXME: how do we ignore broken pipes on windows?
26+
pass
27+
else:
28+
from signal import signal, SIGPIPE, SIG_DFL # ignore broken pipes
29+
signal(SIGPIPE, SIG_DFL)
30+
31+
32+
parser = argparse.ArgumentParser(description=__doc__.split('\n')[0].strip())
33+
34+
parser.add_argument('sources', metavar='FILE', default=[], nargs='?',
35+
help='path to file')
36+
37+
parser.add_argument('-b', '--buffersize', type=float, default=1.0,
38+
help='buffer size (in MB)')
39+
parser.add_argument('--encoding', type=str, default=None,
40+
help='specification (e.g., "utf-8")')
41+
parser.add_argument('-l', '--level', type=int, default=6,
42+
help='compression level to use')
43+
44+
action_group = parser.add_mutually_exclusive_group()
45+
action_group.add_argument('-z', '--compress', action='store_true',
46+
help='compress data')
47+
action_group.add_argument('-d', '--decompress', action='store_true',
48+
help='decompress data')
49+
50+
SCHEMES = 'gzip', 'bzip', 'lzma'
51+
spec_group = parser.add_mutually_exclusive_group()
52+
spec_group.add_argument('--gzip', action='store_true',
53+
help='use gzip/zlib compression algorithm')
54+
spec_group.add_argument('--bzip', action='store_true',
55+
help='use bzip2 compression algorithm')
56+
spec_group.add_argument('--lzma', action='store_true',
57+
help='use lzma compression algorithm')
58+
59+
60+
def main() -> int:
61+
"""Entry point for 'compress'."""
62+
63+
try:
64+
argv = parser.parse_args()
65+
buffersize = int(argv.buffersize * 1024**2)
66+
67+
action = compress if argv.decompress is False else decompress
68+
schemes = {getattr(argv, scheme): scheme for scheme in SCHEMES}
69+
if True not in schemes:
70+
kind = 'gzip'
71+
else:
72+
kind = schemes[True]
73+
74+
options = {'kind': kind, 'encoding': argv.encoding}
75+
if argv.compress:
76+
options['level'] = argv.level
77+
78+
writer = sys.stdout if argv.encoding is not None else sys.stdout.buffer
79+
with BinaryStream(*argv.sources) as stream:
80+
for buff in action(stream.iterbuffers(buffersize), **options):
81+
writer.write(buff)
82+
83+
except KeyboardInterrupt:
84+
pass
85+
86+
finally:
87+
sys.stdout.buffer.flush()
88+
89+
return 0

dataphile/bin/gunzip.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

dataphile/demos/auto_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from ..graphics.widgets import Slider
2929
from ..statistics.regression.modeling import Parameter, Model, CompositeModel, AutoGUI
30-
from ..statistics.distributions import linear1D, polynomial1D, sinusoid1D, gaussian1D
30+
from ..statistics.distributions import uniform, linear1D, polynomial1D, sinusoid1D, gaussian1D
3131
from ..datasets import SyntheticDataset
3232

3333

0 commit comments

Comments
 (0)