Skip to content

Commit

Permalink
Merge pull request #44 from esc/document_exceptions
Browse files Browse the repository at this point in the history
Fixes: #40 document exceptions raised from toplevel.py
  • Loading branch information
FrancescAlted committed Apr 21, 2013
2 parents 0452b6d + d34675d commit 4108452
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions blosc/toplevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def set_nthreads(nthreads):
out : int
The previous number of used threads.
Raises
------
ValueError
If nthreads is larger that the maximum number of threads blosc can use.
Notes
-----
The number of threads for Blosc is the maximum number of cores
Expand Down Expand Up @@ -166,6 +171,15 @@ def compress(bytesobj, typesize, clevel=9, shuffle=True):
out : str / bytes
The compressed data in form of a Python str / bytes object.
Raises
------
TypeError
If bytesobj is not of type bytes or string.
ValueError
If bytesobj is too long.
If typesize is not within the allowed range.
if clevel is not not within the allowed range.
Examples
--------
Expand Down Expand Up @@ -211,6 +225,15 @@ def compress_ptr(address, items, typesize, clevel=9, shuffle=True):
out : str / bytes
The compressed data in form of a Python str / bytes object.
Raises
------
TypeError
If address is not of type int or long.
ValueError
If items * typesize is larger than the maximum allowed buffer size.
If typesize is not within the allowed range.
if clevel is not not within the allowed range.
Notes
-----
This function can be used anywhere that a memory address is available in
Expand Down Expand Up @@ -275,6 +298,11 @@ def decompress(bytesobj):
out : str / bytes
The decompressed data in form of a Python str / bytes object.
Raises
------
TypeError
If bytesobj is not of type bytes or string.
Examples
--------
Expand Down Expand Up @@ -314,6 +342,12 @@ def decompress_ptr(bytesobj, address):
nbytes : int
the number of bytes written to the buffer
Raises
------
TypeError
If bytesobj is not of type bytes or string.
If address is not of type int or long.
Notes
-----
This function can be used anywhere that a memory address is available in
Expand Down Expand Up @@ -385,6 +419,16 @@ def pack_array(array, clevel=9, shuffle=True):
out : str / bytes
The packed array in form of a Python str / bytes object.
Raises
------
TypeError
If array does not quack like a numpy ndarray.
ValueError
If array.itemsize * array.size is larger than the maximum allowed
buffer size.
If typesize is not within the allowed range.
if clevel is not not within the allowed range.
Examples
--------
Expand Down Expand Up @@ -428,6 +472,11 @@ def unpack_array(packed_array):
out : ndarray
The decompressed data in form of a NumPy array.
Raises
------
TypeError
If packed_array is not of type bytes or string.
Examples
--------
Expand Down

0 comments on commit 4108452

Please sign in to comment.