Skip to content

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

Notifications You must be signed in to change notification settings

keshuaixu/fuzzyattr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages