Compare commits
No commits in common. "master" and "1.1.0" have entirely different histories.
14
README.md
14
README.md
|
@ -8,20 +8,6 @@ Intended to be compatible with Python 3.6+. Written and tested against Python
|
|||
If something doesn't work in Python 3.6, it's a bug. Please report any such
|
||||
bugs if they are encountered.
|
||||
|
||||
# PyPI
|
||||
|
||||
View on PyPI at [https://pypi.org/project/binary-bits/](https://pypi.org/project/binary-bits/)
|
||||
|
||||
Install from PyPI:
|
||||
python3 -m pip install binary-bits --upgrade
|
||||
|
||||
Use in your project:
|
||||
```python
|
||||
import bits
|
||||
|
||||
my_bytes = bits.Bytes(bytes.fromhex('deadbeef'))
|
||||
```
|
||||
|
||||
# Similar projects
|
||||
## [py-flags](https://pypi.org/project/py-flags/)
|
||||
|
||||
|
|
15
dev.md
15
dev.md
|
@ -1,15 +0,0 @@
|
|||
Steps to publish to PyPI:
|
||||
|
||||
1) run `make test`
|
||||
2) update version in setup.py
|
||||
3) Tag the current release in git to match the version in setup.py
|
||||
git tag -a 1.2.0 -m 'Release 1.2.0'
|
||||
4) commit any pending changes to git
|
||||
git add .
|
||||
git commit -m 'commit changes'
|
||||
git push origin 1.2.0
|
||||
5) test publish
|
||||
./publish.sh test
|
||||
6) publish to PyPI
|
||||
./publish.sh pypi
|
||||
|
4
setup.py
4
setup.py
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||
|
||||
setuptools.setup(
|
||||
name="binary-bits",
|
||||
version="1.1.1",
|
||||
version="1.1.0",
|
||||
author="S Groesz",
|
||||
description="Provide additional methods for working with binary data",
|
||||
long_description=long_description,
|
||||
|
@ -28,6 +28,6 @@ setuptools.setup(
|
|||
'test': ['coverage'],
|
||||
},
|
||||
project_urls={
|
||||
'Source': 'http://git.groesz.org/Groesz.org/bits/',
|
||||
'Source': 'http://git.groesz.org/wp/bits/',
|
||||
},
|
||||
)
|
||||
|
|
12
src/bits.py
12
src/bits.py
|
@ -930,12 +930,12 @@ class Bits:
|
|||
|
||||
class Bytes:
|
||||
"""
|
||||
A collection of Bits with convenience methods for working with binary data
|
||||
A colletion of Bits with convenient properties for working with binary data
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
def __init__(self, var=None, byteorder="big", bits=None):
|
||||
def __init__(self, var=None, byteorder="big"):
|
||||
"""
|
||||
var: a supported variant (object)
|
||||
byteorder: notimplemented, mostly ignored
|
||||
|
@ -943,17 +943,11 @@ class Bytes:
|
|||
self.__raw = bytearray(b'')
|
||||
self.__small = False
|
||||
self.__iter = None
|
||||
self.__bit_len = None
|
||||
self.__list_len = None
|
||||
if byteorder.lower() in ["small", "little"]:
|
||||
self.__small = True
|
||||
if var is not None:
|
||||
self.__raw = self.__to_bytearray(var)
|
||||
if bits is None:
|
||||
self.__bit_len = len(self.__raw)
|
||||
else:
|
||||
if not isinstance(bits, (int, Bytes, Bit)):
|
||||
raise TypeError(f"bits argument must be int, not {type(bits)}")
|
||||
self.__bit_len = int(bits)
|
||||
|
||||
def __bytes__(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue