Resistors
A Python library for decoding resistor color codes and encoding resistance values.
- Converts colors to value
- Converts value to colors
- Supports four and five-band resistors
- Zero dependencies
The library strictly follows the following chart:
Using colors not listed in this chart will result in a KeyError or ValueError.
Installation
pip3 install resistors
Usage
from resistors import Resistor
r1 = Resistor("red", "red", "black", "black", "brown")
print(r1.get_resistance()) # {'value': 220.0, 'tolerance': 1.0}
r2 = Resistor.with_resistance(1230, 2, 5) # create resistor object with value of 1230Ω, tolerance of +-2%, and 5 bands
print(r2.get_colors()) # ['brown', 'red', 'orange', 'brown', 'red']
Release files for resistors 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| resistors-1.0.3.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| resistors-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / resistors-1.0.3.tar.gz
| Download URL | resistors-1.0.3.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b54b4f907888d9171274291922d2bd959f2efc61361c32b727928167b6c240a
|
|
BLAKE2b-256 checksum How to use checksums |
7191ad0cf242f7c9ccbf3af924f1e16f7ef3793d928c82d4e7caa4781ead7bb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.7
|
Release files / resistors-1.0.3-py3-none-any.whl
| Download URL | resistors-1.0.3-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
815fcd7c66f40a5e620390f873a92ab8af1716c215d87afa2e53d718a841f44f
|
|
BLAKE2b-256 checksum How to use checksums |
45615e3576a05f171c57f6d73bbcf0b8b2f7de785de03387afcc51f98f5d3707
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.7
|