Skip to main content

Finds a python-thing, like a class, a function or a variable by string and loads it

Project description

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'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

find_class-0.0.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

find_class-0.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file find_class-0.0.1.tar.gz.

File metadata

  • Download URL: find_class-0.0.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for find_class-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bf8e8d750d1783e9e2d4e267619c2b63d668891dda29c332bce395423a8a6112
MD5 fecdcaa71b56df76296375502876f08d
BLAKE2b-256 d52d7a7aa975498f4d875b0d3123b0a0f013d01e6d7985a85fee55cf93f54924

See more details on using hashes here.

File details

Details for the file find_class-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: find_class-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for find_class-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0581c85c549237f6455036fa99c4b2fa5c8000f0163adc0256f2aa707ff0994b
MD5 d4a8fea28979461194adb41957587900
BLAKE2b-256 21a522a71c01b064519af4c1ff77217a573db38b514ea7bf32657cd15cd72b7d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page