You are here: Home / LBN / Up2date / Plone and Zope / BastionLinux 25 / python2-forbiddenfruit-0.1.2-1.lbn25.x86_64

python2-forbiddenfruit-0.1.2-1.lbn25.x86_64

Package Attributes
RPM  python2-forbiddenfruit-0.1.2-1.lbn25.x86_64.rpm Architecture  x86_64 Size  27612 Created  2021/11/29 02:43:15 UTC
Package Specification
Summary Patch python built-in objects
Group Unspecified
License None
Home Page https://github.com/clarete/forbiddenfruit
Description

This project aims to help you reach heaven while writing tests, but it may lead you to hell if used on production code.

It basically allows you to patch built-in objects, declared in C through python. Just like this:

`python >>> from forbiddenfruit import curse >>> def words_of_wisdom(self): ... return self * "blah " >>> curse(int, "words_of_wisdom", words_of_wisdom) >>> assert (2).words_of_wisdom() == "blah blah " `

Boom! That’s it, your int class now has the words_of_wisdom method. Do you want to add a classmethod to a built-in class? No problem, just do this:

`python >>> from forbiddenfruit import curse >>> def hello(self): ... return "blah" >>> curse(str, "hello", classmethod(hello)) >>> assert str.hello() == "blah" `

Requires
rpmlib(PayloadFilesHavePrefix)  
rpmlib(FileDigests)  
rpmlib(CompressedFileNames)  
rpmlib(PartialHardlinkSets)  
rpmlib(PayloadIsXz)  
Provides
python2-forbiddenfruit
python2-forbiddenfruit(x86-64)
python2.7dist(forbiddenfruit)
python2dist(forbiddenfruit)

Document Actions