find_class
This little package finds and loads a class by fully qualified string.
Let's assume there is a file in package/sub/animal.py with
class Animal:
def say_somthing(self):
return 'wau'
def a_little_function():
return 'wuff'
a_tone = 'wiiiiii'
Then, you can use find_class to get from a string to the python-thing:
a = find_class('package.sub.animal.Animal')().say_something()
b = find_class('package.sub.animal.a_little_function')()
c = find_class('package.sub.animal.a_tone')
assert a == 'wau'
assert b == 'wuff'
assert c == 'wiiiiii'
Metadata
Release files for find-class 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| find_class-0.0.1.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| find_class-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / find_class-0.0.1.tar.gz
| Download URL | find_class-0.0.1.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf8e8d750d1783e9e2d4e267619c2b63d668891dda29c332bce395423a8a6112
|
|
BLAKE2b-256 checksum How to use checksums |
d52d7a7aa975498f4d875b0d3123b0a0f013d01e6d7985a85fee55cf93f54924
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
|
Release files / find_class-0.0.1-py3-none-any.whl
| Download URL | find_class-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0581c85c549237f6455036fa99c4b2fa5c8000f0163adc0256f2aa707ff0994b
|
|
BLAKE2b-256 checksum How to use checksums |
21a522a71c01b064519af4c1ff77217a573db38b514ea7bf32657cd15cd72b7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
|