Skip to main content

A collection of MetaClasses for Python.

Project description

Sourcecode on GitHub Sourcecode License GitHub tag (latest SemVer incl. pre-release) GitHub release (latest SemVer incl. including pre-releases) GitHub release date Dependents (via libraries.io)
GitHub Workflow - Build and Test Status Codacy - Quality Codacy - Coverage Codecov - Branch Coverage Libraries.io SourceRank
PyPI PyPI - Python Version PyPI - Status Libraries.io status for latest release Requires.io
Documentation License Documentation - Read Now!

pyTooling

A collection of classes, meta-classes and decorators for Python.

Classes

Exceptions

  • An exception base-class to derive more powerful exceptions.
    • ExceptionBase
  • Common exception classes:
    • EnvironmentException
    • PlatformNotSupportedException
    • NotConfiguredException

Decorators

  • export
    Add a class defined in a module to the __all__ array of a module.

    Example

    @export
    class MyClass:
      pass
    

Metaclasses

  • Singleton
    Allow only a single instance of a class.
    ⇒ See documentation of pyTooling.Singleton
  • Overloading Allow method overloading in Python classes. Dispatch method calls based on method signatures (type annotations).
    ⇒ See documentation of pyTooling.Overloading

Common Classes

CallBy

Auxilary classes to implement call by reference.

Python does not allow a user to distinguish between call-by-value and call-by-reference parameter passing. Python's standard types are passed by-value to a function or method. Instances of a class are passed by-reference (pointer) to a function or method.

By implementing a wrapper-class CallByRefParam, any type's value can be passed by-reference. In addition, derived classes can offer additional methods and operators for standard types like int or bool.

Example

# define a call-by-reference parameter for integer values
myInt = CallByRefIntParam()

# a function using a call-by-reference parameter
def func(param : CallByRefIntParam):
  param <<= 3

# call the function and pass the wrapper object
func(myInt)

print(myInt.value)

Versioning

  • Version
    Representation of a version number.

Contributors

License

This Python package (source code) licensed under Apache License 2.0.
The accompanying documentation is licensed under Creative Commons - Attribution 4.0 (CC-BY 4.0).


SPDX-License-Identifier: Apache-2.0

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

pyTooling-1.4.0.tar.gz (14.2 kB view hashes)

Uploaded Source

Built Distribution

pyTooling-1.4.0-py3-none-any.whl (16.2 kB view hashes)

Uploaded Python 3

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