Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bobthebuidler/checksum_dict
checksum_dict's objects handle the simple but repetitive task of checksumming addresses before setting/getting dictionary values. Useful when your daily life involves combining data from different sources.
https://github.com/bobthebuidler/checksum_dict
data-science ethereum evm web3 web3py
Last synced: 6 days ago
JSON representation
checksum_dict's objects handle the simple but repetitive task of checksumming addresses before setting/getting dictionary values. Useful when your daily life involves combining data from different sources.
- Host: GitHub
- URL: https://github.com/bobthebuidler/checksum_dict
- Owner: BobTheBuidler
- License: mit
- Created: 2022-08-06T23:05:11.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-04T07:54:01.000Z (23 days ago)
- Last Synced: 2024-12-14T09:10:53.695Z (12 days ago)
- Topics: data-science, ethereum, evm, web3, web3py
- Language: Python
- Homepage: https://bobthebuidler.github.io/checksum_dict/
- Size: 5.19 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## checksum_dict
checksum_dict's objects handle the simple but repetitive task of checksumming addresses before setting/getting dictionary values.### Installation
`pip install checksum_dict`---
### Usage
There are only two things you must know...##### ChecksumAddressDict
```
from checksum_dict import ChecksumAddressDictd = ChecksumAddressDict()
lower = "0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb"
d[lower] = True
print(d)
>>> ChecksumAddressDict({'0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB': True})
print(d[lower])
>>> True
```
As you can see, the lowercase key `lower` was checksummed and both the key and value were added to the dict as you would expect.##### DefaultChecksumDict
We also have a checksummed version of a defaultdict:
```
from checksum_dict import DefaultChecksumDictdefault = int
d = DefaultChecksumDict(default)
print(d[lower])
>>> 0
```
Although the key was not found in the dictionary, the `default`, in this case `int`, was called and returned a 0, just like with a traditional defaultdict!---
### Summary
Okay, now that's about it. I hope you all get immense value from this simple yet powerful tool. Now get out there and let's do some buidling!