diff options
Diffstat (limited to 'python-eth-bloom.spec')
-rw-r--r-- | python-eth-bloom.spec | 558 |
1 files changed, 558 insertions, 0 deletions
diff --git a/python-eth-bloom.spec b/python-eth-bloom.spec new file mode 100644 index 0000000..d5ed107 --- /dev/null +++ b/python-eth-bloom.spec @@ -0,0 +1,558 @@ +%global _empty_manifest_terminate_build 0 +Name: python-eth-bloom +Version: 2.0.0 +Release: 1 +Summary: Python implementation of the Ethereum Trie structure +License: MIT +URL: https://github.com/ethereum/eth-bloom +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f7/6d/1d3abc3a1476cc04f2f96f21042312b7527c33fb60ee9da03806e99f180e/eth-bloom-2.0.0.tar.gz +BuildArch: noarch + +Requires: python3-eth-hash[pycryptodome] +Requires: python3-bumpversion +Requires: python3-wheel +Requires: python3-bumpversion +Requires: python3-wheel +Requires: python3-twine +Requires: python3-build +Requires: python3-pytest +Requires: python3-hypothesis +Requires: python3-tox +Requires: python3-flake8 +Requires: python3-mypy +Requires: python3-isort +Requires: python3-black +Requires: python3-flake8 +Requires: python3-mypy +Requires: python3-isort +Requires: python3-black +Requires: python3-pytest +Requires: python3-hypothesis +Requires: python3-tox + +%description +# Ethereum Bloom Filter + +[](https://circleci.com/gh/ethereum/eth-bloom) +[](https://badge.fury.io/py/eth-bloom) +[](https://pypi.python.org/pypi/eth-bloom) + +A python implementation of the bloom filter used by Ethereum. + +> This library and repository was previously located at https://github.com/pipermerriam/ethereum-bloom. It was transferred to the Ethereum foundation github in November 2017 and renamed to `eth-bloom`. The PyPi package was also renamed from `ethereum-bloom` to `eth-bloom. + +For more information on what Ethereum Bloom Filters are see [here](what_is_eth-bloom.txt). + +## Installation + +```shell +$ pip install eth-bloom +``` + + +## Development + +```sh +pip install -e ".[dev]" +``` + + +### Running the tests + +You can run the tests with: + +```sh +pytest tests +``` + +Or you can install `tox` to run the full test suite. + + +### Releasing + +To release a new version: + +```sh +make release bump={bumpversion} +``` + + +#### How to bumpversion + +The version format for this repo is `{major}.{minor}.{patch}` for stable, and +`{major}.{minor}.{patch}-{stage}.{devnum}` for unstable (`stage` can be alpha or beta). + +To issue the next version in line, use bumpversion and specify which part to bump, +like `bumpversion minor` or `bumpversion devnum`. + +If you are in a beta version, `bumpversion stage` will switch to a stable. + +To issue an unstable version when the current version is stable, specify the +new version explicitly, like `bumpversion --new-version 4.0.0-alpha.1 devnum` + + +## Usage + +The `BloomFilter` object + +```python +>>> from eth_bloom import BloomFilter +>>> b = BloomFilter() +>>> b'a value' in b # check whether a value is present +False +>>> b.add(b'a value') # add a single value +>>> b'a value' in b +True +>>> int(b) # cast to an integer +3458628712844765018311492773359360516229024449585949240367644166080576879632652362184119765613545163153674691520749911733485693171622325900647078772681584616740134230153806267998022370194756399579977294154062696916779055028045657302214591620589415314367270329881298073237757853875497241510733954508399863880080986777555986663988492288946856978031023631618215522505971170427986911575695114157059398791122395379400594948096 +>>> bin(b) # cast to a binary string +'0b100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' +``` + +You can also add an iterable of items to a bloom filter. + +```python +>>> b = BloomFilter() +>>> b'value-a' in b +False +>>> b'value-b' in b +False +>>> b.extend([b'value-a', b'value-b']) +>>> b'value-a' in b +True +>>> b'value-b' in b +True +``` + +You can initialize a bloom filter from an iterable of byte strings. + +```python +>>> b = BloomFilter.from_iterable([b'value-a', b'value-b']) # initialize from an iterable of values. +>>> b'value-a' in b +True +>>> b'value-b' in b +True +``` + +You can initialize a bloom filter from the integer representation of the bloom bits. + +```python +>>> b = BloomFilter(3458628712844765018311492773359360516229024449585949240367644166080576879632652362184119765613545163153674691520749911733485693171622325900647078772681584616740134230153806267998022370194756399579977294154062696916779055028045657302214591620589415314367270329881298073237757853875497241510733954508399863880080986777555986663988492288946856978031023631618215522505971170427986911575695114157059398791122395379400594948096) +>>> b'a value' in b +True +``` + +You can also merge bloom filters + +```python +>>> from eth_bloom import BloomFilter +>>> b1 = BloomFilter() +>>> b2 = BloomFilter() +>>> b1.add(b'a') +>>> b1.add(b'common') +>>> b2.add(b'b') +>>> b2.add(b'common') +>>> b'a' in b1 +True +>>> b'b' in b1 +False +>>> b'common' in b1 +True +>>> b'a' in b2 +False +>>> b'b' in b2 +True +>>> b'common' in b2 +True +>>> b3 = b1 + b2 # using addition +>>> b'a' in b3 +True +>>> b'b' in b3 +True +>>> b'common' in b3 +True +>>> b4 = b1 | b2 # or using bitwise or +>>> b'a' in b4 +True +>>> b'b' in b4 +True +>>> b'common' in b4 +True +>>> b1 |= b2 # or using in-place operations (works with += too) +>>> b'a' in b1 +True +>>> b'b' in b1 +True +>>> b'common' in b1 +True +``` + + +%package -n python3-eth-bloom +Summary: Python implementation of the Ethereum Trie structure +Provides: python-eth-bloom +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-eth-bloom +# Ethereum Bloom Filter + +[](https://circleci.com/gh/ethereum/eth-bloom) +[](https://badge.fury.io/py/eth-bloom) +[](https://pypi.python.org/pypi/eth-bloom) + +A python implementation of the bloom filter used by Ethereum. + +> This library and repository was previously located at https://github.com/pipermerriam/ethereum-bloom. It was transferred to the Ethereum foundation github in November 2017 and renamed to `eth-bloom`. The PyPi package was also renamed from `ethereum-bloom` to `eth-bloom. + +For more information on what Ethereum Bloom Filters are see [here](what_is_eth-bloom.txt). + +## Installation + +```shell +$ pip install eth-bloom +``` + + +## Development + +```sh +pip install -e ".[dev]" +``` + + +### Running the tests + +You can run the tests with: + +```sh +pytest tests +``` + +Or you can install `tox` to run the full test suite. + + +### Releasing + +To release a new version: + +```sh +make release bump={bumpversion} +``` + + +#### How to bumpversion + +The version format for this repo is `{major}.{minor}.{patch}` for stable, and +`{major}.{minor}.{patch}-{stage}.{devnum}` for unstable (`stage` can be alpha or beta). + +To issue the next version in line, use bumpversion and specify which part to bump, +like `bumpversion minor` or `bumpversion devnum`. + +If you are in a beta version, `bumpversion stage` will switch to a stable. + +To issue an unstable version when the current version is stable, specify the +new version explicitly, like `bumpversion --new-version 4.0.0-alpha.1 devnum` + + +## Usage + +The `BloomFilter` object + +```python +>>> from eth_bloom import BloomFilter +>>> b = BloomFilter() +>>> b'a value' in b # check whether a value is present +False +>>> b.add(b'a value') # add a single value +>>> b'a value' in b +True +>>> int(b) # cast to an integer +3458628712844765018311492773359360516229024449585949240367644166080576879632652362184119765613545163153674691520749911733485693171622325900647078772681584616740134230153806267998022370194756399579977294154062696916779055028045657302214591620589415314367270329881298073237757853875497241510733954508399863880080986777555986663988492288946856978031023631618215522505971170427986911575695114157059398791122395379400594948096 +>>> bin(b) # cast to a binary string +'0b100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' +``` + +You can also add an iterable of items to a bloom filter. + +```python +>>> b = BloomFilter() +>>> b'value-a' in b +False +>>> b'value-b' in b +False +>>> b.extend([b'value-a', b'value-b']) +>>> b'value-a' in b +True +>>> b'value-b' in b +True +``` + +You can initialize a bloom filter from an iterable of byte strings. + +```python +>>> b = BloomFilter.from_iterable([b'value-a', b'value-b']) # initialize from an iterable of values. +>>> b'value-a' in b +True +>>> b'value-b' in b +True +``` + +You can initialize a bloom filter from the integer representation of the bloom bits. + +```python +>>> b = BloomFilter(3458628712844765018311492773359360516229024449585949240367644166080576879632652362184119765613545163153674691520749911733485693171622325900647078772681584616740134230153806267998022370194756399579977294154062696916779055028045657302214591620589415314367270329881298073237757853875497241510733954508399863880080986777555986663988492288946856978031023631618215522505971170427986911575695114157059398791122395379400594948096) +>>> b'a value' in b +True +``` + +You can also merge bloom filters + +```python +>>> from eth_bloom import BloomFilter +>>> b1 = BloomFilter() +>>> b2 = BloomFilter() +>>> b1.add(b'a') +>>> b1.add(b'common') +>>> b2.add(b'b') +>>> b2.add(b'common') +>>> b'a' in b1 +True +>>> b'b' in b1 +False +>>> b'common' in b1 +True +>>> b'a' in b2 +False +>>> b'b' in b2 +True +>>> b'common' in b2 +True +>>> b3 = b1 + b2 # using addition +>>> b'a' in b3 +True +>>> b'b' in b3 +True +>>> b'common' in b3 +True +>>> b4 = b1 | b2 # or using bitwise or +>>> b'a' in b4 +True +>>> b'b' in b4 +True +>>> b'common' in b4 +True +>>> b1 |= b2 # or using in-place operations (works with += too) +>>> b'a' in b1 +True +>>> b'b' in b1 +True +>>> b'common' in b1 +True +``` + + +%package help +Summary: Development documents and examples for eth-bloom +Provides: python3-eth-bloom-doc +%description help +# Ethereum Bloom Filter + +[](https://circleci.com/gh/ethereum/eth-bloom) +[](https://badge.fury.io/py/eth-bloom) +[](https://pypi.python.org/pypi/eth-bloom) + +A python implementation of the bloom filter used by Ethereum. + +> This library and repository was previously located at https://github.com/pipermerriam/ethereum-bloom. It was transferred to the Ethereum foundation github in November 2017 and renamed to `eth-bloom`. The PyPi package was also renamed from `ethereum-bloom` to `eth-bloom. + +For more information on what Ethereum Bloom Filters are see [here](what_is_eth-bloom.txt). + +## Installation + +```shell +$ pip install eth-bloom +``` + + +## Development + +```sh +pip install -e ".[dev]" +``` + + +### Running the tests + +You can run the tests with: + +```sh +pytest tests +``` + +Or you can install `tox` to run the full test suite. + + +### Releasing + +To release a new version: + +```sh +make release bump={bumpversion} +``` + + +#### How to bumpversion + +The version format for this repo is `{major}.{minor}.{patch}` for stable, and +`{major}.{minor}.{patch}-{stage}.{devnum}` for unstable (`stage` can be alpha or beta). + +To issue the next version in line, use bumpversion and specify which part to bump, +like `bumpversion minor` or `bumpversion devnum`. + +If you are in a beta version, `bumpversion stage` will switch to a stable. + +To issue an unstable version when the current version is stable, specify the +new version explicitly, like `bumpversion --new-version 4.0.0-alpha.1 devnum` + + +## Usage + +The `BloomFilter` object + +```python +>>> from eth_bloom import BloomFilter +>>> b = BloomFilter() +>>> b'a value' in b # check whether a value is present +False +>>> b.add(b'a value') # add a single value +>>> b'a value' in b +True +>>> int(b) # cast to an integer +3458628712844765018311492773359360516229024449585949240367644166080576879632652362184119765613545163153674691520749911733485693171622325900647078772681584616740134230153806267998022370194756399579977294154062696916779055028045657302214591620589415314367270329881298073237757853875497241510733954508399863880080986777555986663988492288946856978031023631618215522505971170427986911575695114157059398791122395379400594948096 +>>> bin(b) # cast to a binary string +'0b100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' +``` + +You can also add an iterable of items to a bloom filter. + +```python +>>> b = BloomFilter() +>>> b'value-a' in b +False +>>> b'value-b' in b +False +>>> b.extend([b'value-a', b'value-b']) +>>> b'value-a' in b +True +>>> b'value-b' in b +True +``` + +You can initialize a bloom filter from an iterable of byte strings. + +```python +>>> b = BloomFilter.from_iterable([b'value-a', b'value-b']) # initialize from an iterable of values. +>>> b'value-a' in b +True +>>> b'value-b' in b +True +``` + +You can initialize a bloom filter from the integer representation of the bloom bits. + +```python +>>> b = BloomFilter(3458628712844765018311492773359360516229024449585949240367644166080576879632652362184119765613545163153674691520749911733485693171622325900647078772681584616740134230153806267998022370194756399579977294154062696916779055028045657302214591620589415314367270329881298073237757853875497241510733954508399863880080986777555986663988492288946856978031023631618215522505971170427986911575695114157059398791122395379400594948096) +>>> b'a value' in b +True +``` + +You can also merge bloom filters + +```python +>>> from eth_bloom import BloomFilter +>>> b1 = BloomFilter() +>>> b2 = BloomFilter() +>>> b1.add(b'a') +>>> b1.add(b'common') +>>> b2.add(b'b') +>>> b2.add(b'common') +>>> b'a' in b1 +True +>>> b'b' in b1 +False +>>> b'common' in b1 +True +>>> b'a' in b2 +False +>>> b'b' in b2 +True +>>> b'common' in b2 +True +>>> b3 = b1 + b2 # using addition +>>> b'a' in b3 +True +>>> b'b' in b3 +True +>>> b'common' in b3 +True +>>> b4 = b1 | b2 # or using bitwise or +>>> b'a' in b4 +True +>>> b'b' in b4 +True +>>> b'common' in b4 +True +>>> b1 |= b2 # or using in-place operations (works with += too) +>>> b'a' in b1 +True +>>> b'b' in b1 +True +>>> b'common' in b1 +True +``` + + +%prep +%autosetup -n eth-bloom-2.0.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-eth-bloom -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.0-1 +- Package Spec generated |