mirror of
https://github.com/vale981/binfootprint
synced 2025-03-04 08:41:41 -05:00
added Licence, example, minor cleanup
This commit is contained in:
parent
fe3b1754bf
commit
b1abdf1419
4 changed files with 47 additions and 16 deletions
22
LICENSE
Normal file
22
LICENSE
Normal file
|
@ -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.
|
21
examples/example.py
Normal file
21
examples/example.py
Normal file
|
@ -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
|
3
setup.py
3
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(
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue