fuzzyattr

fuzzyattr matches the closest attribute name in python so you can make unlimited free typos.


Keywords
fuzzy, match, attribute, function, method
License
MIT
Install
pip install fuzzyattr==0.1.1

Documentation

fuzzyattr

fuzzyattr matches the closest attribute name in python so you can make unlimited free typos.

usage

Decorate any class.

from fuzzyattr import fuzzyattr

@fuzzyattr
class Human:
    def __init__(self, name):
        self.name = name

    def eat(self, food):
        return f'{self.name} ate {food}'

Or wrap the class.

Human = fuzzyattr(Human)

Now you can make typos.

someone = Human('Someone')
someone.ate('poop')

ate doesn't exist. fuzzyattr matches eat. It logs a warning when this happens.

how is this useful?

Fix non-PEP8 code written by other morons. Make python standard library more pythonic.

BetterTestCase = fuzzyattr(unittest.TestCase)
    
class PythonicTest(BetterTestCase):
    def test_thing(self):
        self.assert_equal(True, False)
        # much better than assertEqual

install

pip install fuzzyattr