Skip to content Skip to sidebar Skip to footer
Showing posts with the label Decorator

Python Lru Cache Decorator Per Instance

Using the LRU Cache decorator found here: http://code.activestate.com/recipes/578078-py26-and-py30-… Read more Python Lru Cache Decorator Per Instance

Python: Regular Method And Static Method With Same Name

Introduction I have a Python class, which contains a number of methods. I want one of those methods… Read more Python: Regular Method And Static Method With Same Name

How To Inherit A Flask Methodview Class Without Its Decorators?

For the reason of not rewriting the same API. I want to inherit a get method from an already create… Read more How To Inherit A Flask Methodview Class Without Its Decorators?

Class Decorator Compatible For Mypy

Say I have the following simple example without any typehints: def wrapper(cls): class Subclass… Read more Class Decorator Compatible For Mypy

Wrapping Class Method In Try / Except Using Decorator

I have a general purpose function that sends info about exceptions to an application log. I use the… Read more Wrapping Class Method In Try / Except Using Decorator

Conditionally Apply Login_required Decorator In Django

I have a set of function in views.py which are currently only user-accessible. I'm asked to mak… Read more Conditionally Apply Login_required Decorator In Django

Python Resettable Instance Method Memoization Decorator

I'm attempting to build a decorator for an instance method of a class that will memoize the res… Read more Python Resettable Instance Method Memoization Decorator

Writing A Cherrypy Decorator For Authorization

I have a cherrypy application and on some of the views I want to start only allowing certain users … Read more Writing A Cherrypy Decorator For Authorization