simplesuper


Namesimplesuper JSON
Version 1.0.10 PyPI version JSON
download
home_pagehttps://github.com/dwt/simplesuper
SummarySimpler way to call super methods without all the repetition
upload_time2023-01-10 19:45:10
maintainer
docs_urlNone
authorMartin Häcker, Robert Buchholz, Felix Schwarz
requires_python
licenseISC
keywords python 2 super convenience api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # SimpleSuper [![Build Status](https://app.travis-ci.com/dwt/simplesuper.svg?branch=master)](https://app.travis-ci.com/github/dwt/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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dwt/simplesuper",
    "name": "simplesuper",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python 2,super,convenience,api",
    "author": "Martin H\u00e4cker, Robert Buchholz, Felix Schwarz",
    "author_email": "mhaecker@mac.com, rbu@rbu.sh, felix@schwarz-online.org",
    "download_url": "https://files.pythonhosted.org/packages/65/ff/ca44da7ce5662d94af8c2bbc5ba84a15f85eadff9dbe319af31e1ca52bf1/simplesuper-1.0.10.tar.gz",
    "platform": null,
    "description": "# SimpleSuper [![Build Status](https://app.travis-ci.com/dwt/simplesuper.svg?branch=master)](https://app.travis-ci.com/github/dwt/simplesuper)\n\nLicense: ISC - See LICENSE.txt file\n\nThis is a simple piece of code born out of our frustration with the \nrepetitiveness of calling overridden methods in python.\nhaving to write\n\n    super(TheCurrentClassThatImIn, self).the_method_that_im_currently_in(all, the, arguments, again)\n\nevery time you want to do that is just not DRY and makes refactoring\nthat much more tedious.\n\nWouldn't it be much cooler if you could just write self.super() instead? \nYeah, we thought so, too.\n\nIn the class where you want to use this (or any superclass),\nyou need to make the SuperProxy available like this:\n\n    class SuperClass(object):\n        super = SuperProxy()\n\nAfterwards you can just use it in three forms in any method:\n  - Auto-pick-up all available arguments and call the super method of the current method\n    \n    self.super()\n    \n  - Call super method of current method but with explicit arguments\n    \n    self.super(some_arguments)\n    \n  - Get a proxy for the superclass and call a specific method with specific arguments\n    \n    self.super.whatever_method(whatever, arguments)\n    \n    (self.super is the same as super(CurrentClass, self) but more DRY)\n\n## Known Bugs:\n\n  - Works only for object subclasses (new style classes)\n  - Doesn't find super-methods of decorated methods as the code \n    of the current method can't be found in the class object under \n    the name of the method.\n\n## TODO:\n\n  - Find a way so you can do something like from simple_super import \n    use_in_object to get every object enhanced by its niceness.\n\n## Changelog:\n\n1.0.10 (2023-01-10)\n\n  - Drop support for python 3 versions below 3.6 that are not supported by \n    the python team anymore.\n  - Add support for all modern python versions up to 3.11\n\n1.0.5 and 1.0.6, 1.0.7, 1.0.8, 1.0.9 (2016-09-07)\n\n  - package for pypi to have an easy dependency\n  - small cleanups to make it easier to step over this code in the debugger\n\n1.0.4 (2010-06-06)\n\n  - Add heuristic to move arguments to kwargs if lower method has more named\n    arguments than the upper method\n\n1.0.3 (2010-05-31)\n\n  - Added compatibility for Python 3\n  - Moved stand-alone functions into nice classes\n\n1.0.2 (2010-03-27)\n\n  - Simplistic heuristic detection if self.super() or \n    self.super(*args, **kwargs) was called so we can pass the right parameters\n  - Made simple_super compatible with Python 2.3 and old-style classes\n\n1.0.1\n\n  - do not add arguments if subclass uses self.super() and super class does \n    not get any arguments besides self.\n\n1.0\n\n  - initial release\n",
    "bugtrack_url": null,
    "license": "ISC",
    "summary": "Simpler way to call super methods without all the repetition",
    "version": "1.0.10",
    "split_keywords": [
        "python 2",
        "super",
        "convenience",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5bc5785f7b6e4bff1f32a8f2479b3ed3a3b1d72408bc6645908ebd63af7e9cc5",
                "md5": "cf6601406224acd353bb1dc77e04036c",
                "sha256": "5e3d723ba07d627e9446d028eb950fa08d29a178705780286f79b5fa280ede11"
            },
            "downloads": -1,
            "filename": "simplesuper-1.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cf6601406224acd353bb1dc77e04036c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6148,
            "upload_time": "2023-01-10T19:45:07",
            "upload_time_iso_8601": "2023-01-10T19:45:07.375293Z",
            "url": "https://files.pythonhosted.org/packages/5b/c5/785f7b6e4bff1f32a8f2479b3ed3a3b1d72408bc6645908ebd63af7e9cc5/simplesuper-1.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65ffca44da7ce5662d94af8c2bbc5ba84a15f85eadff9dbe319af31e1ca52bf1",
                "md5": "851238043d3efbf12b629495cc358bc8",
                "sha256": "07923e8a0d0d4428cffed6ce4fd855a15134d3ed02a018915cff57aa4b1879b1"
            },
            "downloads": -1,
            "filename": "simplesuper-1.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "851238043d3efbf12b629495cc358bc8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5985,
            "upload_time": "2023-01-10T19:45:10",
            "upload_time_iso_8601": "2023-01-10T19:45:10.771716Z",
            "url": "https://files.pythonhosted.org/packages/65/ff/ca44da7ce5662d94af8c2bbc5ba84a15f85eadff9dbe319af31e1ca52bf1/simplesuper-1.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-10 19:45:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dwt",
    "github_project": "simplesuper",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "simplesuper"
}
        
Elapsed time: 0.02738s