RussBaz / enforce

Python 3.5+ runtime type checking for integration testing and data validation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enforce on static methods

bannsec opened this issue · comments

I'm attempting to use enforce over a class. However, one of the methods in this class is static, and marked so by:

@staticmethod

When attempting to run, i get the following:

In [7]: Keyboard._parse_modifier(2)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-2977a0e8d3a6> in <module>()
----> 1 Keyboard._parse_modifier(2)

~/.virtualenvs/usb_pcap/lib/python3.5/site-packages/enforce/decorators.py in universal(wrapped, instance, args, kwargs)
     83         """
     84         with RunLock:
---> 85             enforcer = wrapped.__enforcer__
     86             skip = False
     87

AttributeError: 'functools.partial' object has no attribute '__enforcer__'

Same error occurs if i remove my type hints.

@RussBaz, please publish new version on pypi.