Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions all_examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In process 0:
>>> distbuffer.keys()
['__version__', 'buffer', 'dim_data']
>>> distbuffer['__version__']
'0.9.0'
'0.10.0'
>>> distbuffer['buffer']
array([ 0.2, 0.6, 0.9, 0.6, 0.8, 0.4, 0.2, 0.2, 0.3, 0.5])
>>> distbuffer['dim_data']
Expand All @@ -44,7 +44,7 @@ In process 1:
>>> distbuffer.keys()
['__version__', 'buffer', 'dim_data']
>>> distbuffer['__version__']
'0.9.0'
'0.10.0'
>>> distbuffer['buffer']
array([ 0.9, 0.2, 1. , 0.4, 0.5, 0. , 0.6, 0.8, 0.6, 1. ])
>>> distbuffer['dim_data']
Expand Down Expand Up @@ -101,7 +101,7 @@ In process 0:
>>> distbuffer.keys()
['__version__', 'buffer', 'dim_data']
>>> distbuffer['__version__']
'0.9.0'
'0.10.0'
>>> distbuffer['buffer']
array([ 0.2, 0.6, 0.9, 0.6, 0.8, 0.4, 0.2, 0.2, 0.3, 0.9])
>>> distbuffer['dim_data']
Expand All @@ -121,7 +121,7 @@ In process 1:
>>> distbuffer.keys()
['__version__', 'buffer', 'dim_data']
>>> distbuffer['__version__']
'0.9.0'
'0.10.0'
>>> distbuffer['buffer']
array([ 0.3, 0.9, 0.2, 1. , 0.4, 0.5, 0. , 0.6, 0.8, 0.6])
>>> distbuffer['dim_data']
Expand Down Expand Up @@ -149,7 +149,7 @@ On all processes:
>>> distbuffer.keys()
['__version__', 'buffer', 'dim_data']
>>> distbuffer['__version__']
'0.9.0'
'0.10.10'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

>>> len(distbuffer['dim_data']) == 1 # one dimension only
True

Expand Down
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
# built documents.
#
# The short X.Y version.
version = '0.9.0'
version = '0.10.0'
# The full version, including alpha/beta/rc tags.
release = '0.9.0'
release = '0.10.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
6 changes: 3 additions & 3 deletions index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
================================
Distributed Array Protocol 0.9.0
================================
====================================
Distributed Array Protocol |version|
====================================

.. toctree::
:numbered:
Expand Down
39 changes: 21 additions & 18 deletions tests/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import validator


VERSION = '0.10.0'


class TestValidDimData(unittest.TestCase):

def test_block(self):
Expand All @@ -13,7 +16,7 @@ def test_block(self):
'proc_grid_rank': 0,
'start': 0,
'stop': 10},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(10),
'dim_data': dim_data}

Expand All @@ -26,7 +29,7 @@ def test_cyclic(self):
'proc_grid_size': 2,
'proc_grid_rank': 0,
'start': 0},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(50),
'dim_data': dim_data}

Expand All @@ -40,7 +43,7 @@ def test_block_cyclic(self):
'proc_grid_rank': 1,
'start': 5,
'block_size': 5},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(50),
'dim_data': dim_data}

Expand All @@ -54,7 +57,7 @@ def test_unstructured(self):
'proc_grid_rank': 1,
'indices': np.array([1, 22, 44, 49, 9, 33, 21], dtype=np.uint32)
},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(len(dim_data[0]['indices'])),
'dim_data': dim_data}

Expand All @@ -69,7 +72,7 @@ def test_extra_process(self):
'proc_grid_rank':0,
'start' : 0,
}
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer' : b'a',
'dim_data' : (dimdata,)}
is_valid, msg = validator.validate(distbuffer)
Expand All @@ -83,15 +86,15 @@ def test_empty_process(self):
'proc_grid_rank':3,
'start' : 3,
}
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer' : b'',
'dim_data' : (dimdata,)}
is_valid, msg = validator.validate(distbuffer)
self.assertTrue(is_valid, msg)

def test_empty_dict_alias(self):
dimdata = {}
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer' : b'',
'dim_data' : (dimdata,)}
is_valid, msg = validator.validate(distbuffer)
Expand All @@ -108,7 +111,7 @@ def test_missing_buffer(self):
'proc_grid_rank':3,
'start' : 3,
}
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'dim_data' : (dimdata,)}
is_valid, msg = validator.validate(distbuffer)
self.assertTrue(not is_valid, msg)
Expand All @@ -127,7 +130,7 @@ def test_missing_version(self):
self.assertTrue(not is_valid, msg)

def test_missing_dim_data(self):
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer' : b'',}
is_valid, msg = validator.validate(distbuffer)
self.assertTrue(not is_valid, msg)
Expand All @@ -143,7 +146,7 @@ def test_bad_buffer(self):
'proc_grid_rank':3,
'start' : 3,
}
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'dim_data' : (dimdata,),
'buffer' : [1,2,3,4],}
is_valid, msg = validator.validate(distbuffer)
Expand Down Expand Up @@ -174,7 +177,7 @@ def test_bad_dist_type(self):
'proc_grid_rank': 0,
'start': 0,
'stop': 51},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(51),
'dim_data': dim_data}

Expand All @@ -189,7 +192,7 @@ def test_bad_block_stop_0(self):
'proc_grid_rank': 0,
'start': 0,
'stop': 51},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(51),
'dim_data': dim_data}

Expand All @@ -204,7 +207,7 @@ def test_bad_block_stop_1(self):
'proc_grid_rank': 0,
'start': 10,
'stop': 9},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones((0,)),
'dim_data': dim_data}

Expand All @@ -219,7 +222,7 @@ def test_bad_block_start(self):
'proc_grid_rank': 0,
'start': -1,
'stop': 10},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(11),
'dim_data': dim_data}

Expand All @@ -235,7 +238,7 @@ def test_bad_block_padding(self):
'start': 0,
'stop': 10,
'padding': ('a','b')},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(10),
'dim_data': dim_data}

Expand All @@ -250,7 +253,7 @@ def test_bad_cyclic_block_size(self):
'proc_grid_rank': 0,
'start': 0,
'block_size': -10},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(10),
'dim_data': dim_data}

Expand All @@ -264,7 +267,7 @@ def test_bad_unstructured_indices(self):
'proc_grid_size': 2,
'proc_grid_rank': 0,
'indices': [1, 2, 3, 4]},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(4),
'dim_data': dim_data}

Expand All @@ -283,7 +286,7 @@ def test_undistributed_padded_periodic(self):
'stop': 10,
'padding': (2,2),
'periodic': True,},)
distbuffer = {'__version__': '1.0.0',
distbuffer = {'__version__': VERSION,
'buffer': np.ones(10),
'dim_data': dim_data}

Expand Down
14 changes: 6 additions & 8 deletions validator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Functions to validate Distributed Array Protocol data structures.
Functions to validate Distributed Array Protocol data structures for protocol
version 0.10.0.

Functions
---------
Expand All @@ -12,6 +13,9 @@
from distutils.version import StrictVersion


VERSIONS = ((0, 10, 0),)


def _verify_exact_keys(dd, keys):
dkeys = set(dd)
keys = set(keys)
Expand Down Expand Up @@ -211,8 +215,6 @@ def validate_dim_dict(idx, dim_dict):
Returns a 2-tuple of a boolean and string; boolean indicates validity, the
string indicates the reason for invalidity, empty otherwise.

Currently supports Protocol versions 0.9.x and 1.0.x.

"""
# Check for the empty dim_dict alias
if not dim_dict: # the dim_dict is empty
Expand All @@ -238,8 +240,6 @@ def validate_dim_data(dim_data):
Returns a 2-tuple of a boolean and string; boolean indicates validity, the
string indicates the reason for invalidity, empty otherwise.

Currently supports Protocol versions 0.9.x and 1.0.x.

"""
# First, check that it's a tuple...
if not isinstance(dim_data, tuple):
Expand Down Expand Up @@ -268,8 +268,6 @@ def validate(distbuffer):
Returns a 2-tuple of a boolean and string; boolean indicates validity, the
string indicates the reason for invalidity, empty otherwise.

Currently supports Protocol versions 0.9.x and 1.0.x.

"""
# Verify distbuffer is a dictionary.
if not isinstance(distbuffer, dict):
Expand All @@ -295,7 +293,7 @@ def validate(distbuffer):
return (False, msg % version)

# Verify the version number.
if strict_version.version not in ((0,9,0), (1,0,0)):
if strict_version.version not in VERSIONS:
msg = '__version__ "%s" not supported by this checker.'
return (False, msg % version)

Expand Down