SimpleSuper 
License: ISC - See LICENSE.txt file
This is a simple piece of code born out of our frustration with the repetitiveness of calling overridden methods in python. having to write
super(TheCurrentClassThatImIn, self).the_method_that_im_currently_in(all, the, arguments, again)
every time you want to do that is just not DRY and makes refactoring that much more tedious.
Wouldn't it be much cooler if you could just write self.super() instead? Yeah, we thought so, too.
In the class where you want to use this (or any superclass), you need to make the SuperProxy available like this:
class SuperClass(object):
super = SuperProxy()
Afterwards you can just use it in three forms in any method:
-
Auto-pick-up all available arguments and call the super method of the current method
self.super()
-
Call super method of current method but with explicit arguments
self.super(some_arguments)
-
Get a proxy for the superclass and call a specific method with specific arguments
self.super.whatever_method(whatever, arguments)
(self.super is the same as super(CurrentClass, self) but more DRY)
Known Bugs:
- Works only for object subclasses (new style classes)
- Doesn't find super-methods of decorated methods as the code of the current method can't be found in the class object under the name of the method.
TODO:
- Find a way so you can do something like from simple_super import use_in_object to get every object enhanced by its niceness.
Changelog:
1.0.10 (2023-01-10)
- Drop support for python 3 versions below 3.6 that are not supported by the python team anymore.
- Add support for all modern python versions up to 3.11
1.0.5 and 1.0.6, 1.0.7, 1.0.8, 1.0.9 (2016-09-07)
- package for pypi to have an easy dependency
- small cleanups to make it easier to step over this code in the debugger
1.0.4 (2010-06-06)
- Add heuristic to move arguments to kwargs if lower method has more named arguments than the upper method
1.0.3 (2010-05-31)
- Added compatibility for Python 3
- Moved stand-alone functions into nice classes
1.0.2 (2010-03-27)
- Simplistic heuristic detection if self.super() or self.super(*args, **kwargs) was called so we can pass the right parameters
- Made simple_super compatible with Python 2.3 and old-style classes
1.0.1
- do not add arguments if subclass uses self.super() and super class does not get any arguments besides self.
1.0
- initial release
Metadata
Release files for simplesuper 1.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| simplesuper-1.0.10.tar.gz | 6.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simplesuper-1.0.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / simplesuper-1.0.10.tar.gz
| Download URL | simplesuper-1.0.10.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07923e8a0d0d4428cffed6ce4fd855a15134d3ed02a018915cff57aa4b1879b1
|
|
BLAKE2b-256 checksum How to use checksums |
65ffca44da7ce5662d94af8c2bbc5ba84a15f85eadff9dbe319af31e1ca52bf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / simplesuper-1.0.10-py3-none-any.whl
| Download URL | simplesuper-1.0.10-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e3d723ba07d627e9446d028eb950fa08d29a178705780286f79b5fa280ede11
|
|
BLAKE2b-256 checksum How to use checksums |
5bc5785f7b6e4bff1f32a8f2479b3ed3a3b1d72408bc6645908ebd63af7e9cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for simplesuper 1.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.