diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..40ed900 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2016, Richard Hartmann +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the + following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/examples/example.py b/examples/example.py new file mode 100644 index 0000000..eb7d330 --- /dev/null +++ b/examples/example.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from __future__ import division, print_function + +import sys +from os.path import abspath, dirname, split +# Add parent directory to beginning of path variable +sys.path = [split(dirname(abspath(__file__)))[0]] + sys.path + +import binfootprint as bf + +atoms = [12345678, # int32 + 3.141, # float + 'hallo Welt', # ascii string + 'öäüß', # utf8 string + True, False, None, # special Value + 2**65, -3**65, # integer + b'\xff\fe\03'] # bytes + +binkey = bf.dump(atoms) # generate a unique byte sequence +atoms_prime = bf.load(binkey) # restore the original object diff --git a/setup.py b/setup.py index 529d0d4..5a42868 100644 --- a/setup.py +++ b/setup.py @@ -5,12 +5,11 @@ from setuptools import setup - author = u"Richard Hartmann" authors = [author] description = 'binary representation for simple data structured' name = 'binfootprint' -version = '0.1' +version = '0.1.0' if __name__ == "__main__": setup( diff --git a/tests/test_binfootprint.py b/tests/test_binfootprint.py index 11e7489..d1f33b3 100644 --- a/tests/test_binfootprint.py +++ b/tests/test_binfootprint.py @@ -1,22 +1,11 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- - from __future__ import division, print_function import sys - -if sys.version_info.major > 2: - import pathlib - path = pathlib.PosixPath(__file__).absolute() - bf_package = path.parent.parent - print(bf_package) - sys.path.insert(0, str(bf_package)) -else: - from os.path import abspath, dirname, split - # Add parent directory to beginning of path variable - sys.path = [split(dirname(abspath(__file__)))[0]] + sys.path - -print(sys.path[0]) +from os.path import abspath, dirname, split +# Add parent directory to beginning of path variable +sys.path = [split(dirname(abspath(__file__)))[0]] + sys.path import binfootprint as bfp