allows for @interface class partail behavoiur decorator
Project description
Interface Decorator
allows the use of the @Interface class decorator, which allows for partai linterface behavoiur curretly only preventing direct instantaion. future feeatures hope to include method detection and force children implementations, however can be acompished with ABC pacakge.
this pacakge is desinged to be light waieghts and extremely simply to use. one @ to rule them all. in this case enforcing typical interface behavoiurs with good readability.
install
pip install InterfaceTools
Instructions:
above any clases you wish to become a interface and restrict instantaition to only children:
from Leviathan.interface import Interface
@interface
class MyClass():
def Method():pass
that all thier is to it. this decorator then restrict this class ever to instanaite on its own meaning that the following:
foo = MyClass()
which givesthe follwing error:
InterfaceInstancingError: The class MyClass is an interface. Interfaces cannot be instantiated.
addiaitonally unlike inerfaces in C# or java you are not required to implent thier methods. however if you desire that functionality you can use this with the ABC pacakge to enforce children overriding methods
example:
from abc import ABCMeta, abstractmethod
@Interface
class myClass(metaclass=ABCMeta):
@abstractmethod
def method():pass
the example above will give you full C# or Java Like interface.
other things you can do with this module are interface inheritance:
example:
@Interface
class myClass():
pass
@Interface
class class2(myClass):
pass
which you can also inherit from regular classes as well.
class myClass():
pass
@Interface
class class2(myClass):
pass
the interface wrapper is fully compatable with all the default python functions, and abc package for further control over your interface.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file interfacetools-1.0.6.tar.gz.
File metadata
- Download URL: interfacetools-1.0.6.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e3828e568db5d03c1f742d159982951f4758d98040daa6f6efa46a42dc06b64
|
|
| MD5 |
f055b993fa81509d68594ca19b04545a
|
|
| BLAKE2b-256 |
02ebfb018ffe072bdd91bf6c437aa1578cd7a2e884dcb8fb1ccfdfba16abac02
|
File details
Details for the file InterfaceTools-1.0.6-py3-none-any.whl.
File metadata
- Download URL: InterfaceTools-1.0.6-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bed1ed57d6c35405ebbe59343bff8c9b3afedfc61c52390a28de34efcf6c0e96
|
|
| MD5 |
baced843d6c82f549923d8d538b28b7b
|
|
| BLAKE2b-256 |
ad57d46c0018dd50ddb108c042c89544b1b430bb0c3e77607e8b146a082fc941
|