All Projects → youknowone → methodtools

youknowone / methodtools

Licence: other
Expand functools features(lru_cache) to class - methods, classmethods, staticmethods and even for (unofficial) hybrid methods.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to methodtools

dexdeps
查看dex中class, field, method内部与外部依赖
Stars: ✭ 23 (-59.65%)
Mutual labels:  class, method
DTE
Generate C# class from database table
Stars: ✭ 26 (-54.39%)
Mutual labels:  class
Dumpclass
Dump classes from running JVM process.
Stars: ✭ 156 (+173.68%)
Mutual labels:  class
http-method
🍇 Provides constants for HTTP request methods.
Stars: ✭ 83 (+45.61%)
Mutual labels:  method
Bigint
Arbitrary-sized integer class for C++
Stars: ✭ 189 (+231.58%)
Mutual labels:  class
GoCache
A simplest Cache Server based on LRU implementation written in Go
Stars: ✭ 15 (-73.68%)
Mutual labels:  lru-cache
React Universal Hooks
🎉 React Universal Hooks : just use****** everywhere (Functional or Class Component). Support React DevTools!
Stars: ✭ 148 (+159.65%)
Mutual labels:  class
flutter-stylizer
Flutter Stylizer is a VSCode extension that organizes your Flutter classes and mixins in an opinionated and consistent manner.
Stars: ✭ 23 (-59.65%)
Mutual labels:  class
go-interfaces
This repos has lots of Go interface usage and best practice examples
Stars: ✭ 112 (+96.49%)
Mutual labels:  method
Algorithm-Implementation
This is our effort to collect the best implementations to tough algorithms. All codes are written in c++.
Stars: ✭ 16 (-71.93%)
Mutual labels:  lru-cache
liu
💫 Boshiamy Input Method in macOS 嘸蝦米輸入法
Stars: ✭ 39 (-31.58%)
Mutual labels:  method
Ring.js
Ring.js - JavaScript Class System with Multiple Inheritance
Stars: ✭ 223 (+291.23%)
Mutual labels:  class
object-visit
Call the given method on each value in the given object.
Stars: ✭ 19 (-66.67%)
Mutual labels:  method
Object Oriented Programming Using Python
Python is a multi-paradigm programming language. Meaning, it supports different programming approach. One of the popular approach to solve a programming problem is by creating objects. This is known as Object-Oriented Programming (OOP).
Stars: ✭ 183 (+221.05%)
Mutual labels:  class
collaboration
Spring '20 IoT - systems and security class. This is the collaborative half of the class.
Stars: ✭ 14 (-75.44%)
Mutual labels:  class
Classanalyzer
A Java Class File Disassembler
Stars: ✭ 148 (+159.65%)
Mutual labels:  class
FoxBarcode
A 100% Visual FoxPro class that provides a tool for generating images with different bar code symbologies to be used in VFP forms and reports, or exported to other applications
Stars: ✭ 31 (-45.61%)
Mutual labels:  class
WormHole
WormHole allows to share classes between Flutter and Native Platform (android / ios)
Stars: ✭ 36 (-36.84%)
Mutual labels:  method
LruClockCache
A low-latency LRU approximation cache in C++ using CLOCK second-chance algorithm. Multi level cache too. Up to 2.5 billion lookups per second.
Stars: ✭ 35 (-38.6%)
Mutual labels:  lru-cache
php-libtgvoip
PHP extension that wraps the telegram VoIP library.
Stars: ✭ 22 (-61.4%)
Mutual labels:  class

methodtools

Expand functools features to methods, classmethods, staticmethods and even for (unofficial) hybrid methods.

For now, methodtools only provides methodtools.lru_cache.

Use methodtools module instead of functools module. Than it will work as you expected.

from methodtools import lru_cache

class A(object):

    # cached method. the storage lifetime follows `self` object
    @lru_cache()
    def cached_method(self, args):
        ...

    # cached classmethod. the storage lifetime follows `A` class
    @lru_cache()  # the order is important!
    @classmethod  # always lru_cache on top of classmethod
    def cached_classmethod(self, args):
        ...

    # cached staticmethod. the storage lifetime follows `A` class
    @lru_cache()  # the order is important!
    @staticmethod  # always lru_cache on top of staticmethod
    def cached_staticmethod(self, args):
        ...

@lru_cache()  # just same as functools.lru_cache
def cached_function():
    ...

Installation

PyPI is the recommended way.

$ pip install methodtools
To browse versions and tarballs, visit:
https://pypi.python.org/pypi/methodtools/

Note

If you are working on Python 2, install also functools32.

See also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].