METADATA 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Metadata-Version: 2.1
  2. Name: methodtools
  3. Version: 0.4.7
  4. Summary: Expand standard functools to methods
  5. Home-page: https://github.com/youknowone/methodtools
  6. Author: Jeong YunWon
  7. Author-email: methodtools@youknowone.org
  8. License: BSD 2-Clause License
  9. Keywords: ring,functools,lru_cache,method
  10. Classifier: License :: OSI Approved :: BSD License
  11. Classifier: Programming Language :: Python :: 2
  12. Classifier: Programming Language :: Python :: 2.7
  13. Classifier: Programming Language :: Python :: 3
  14. Classifier: Programming Language :: Python :: 3.6
  15. Classifier: Programming Language :: Python :: 3.7
  16. Classifier: Programming Language :: Python :: 3.8
  17. Classifier: Programming Language :: Python :: 3.9
  18. Classifier: Programming Language :: Python :: 3.10
  19. Classifier: Programming Language :: Python :: 3.11
  20. License-File: LICENSE
  21. Requires-Dist: wirerope >=0.4.7
  22. Provides-Extra: doc
  23. Requires-Dist: sphinx ; extra == 'doc'
  24. Provides-Extra: test
  25. Requires-Dist: pytest >=4.6.7 ; extra == 'test'
  26. Requires-Dist: pytest-cov >=2.6.1 ; extra == 'test'
  27. Requires-Dist: functools32 >=3.2.3-2 ; (python_version < "3") and extra == 'test'
  28. methodtools
  29. ===========
  30. .. image:: https://github.com/youknowone/methodtools/actions/workflows/python-package.yml/badge.svg
  31. .. image:: https://codecov.io/gh/youknowone/methodtools/graph/badge.svg
  32. :target: https://codecov.io/gh/youknowone/methodtools
  33. Expand functools features to methods, classmethods, staticmethods and even for
  34. (unofficial) hybrid methods.
  35. For now, methodtools only provides `methodtools.lru_cache`.
  36. Use `methodtools` module instead of `functools` module. Than it will work as
  37. you expected.
  38. .. code:: python
  39. from methodtools import lru_cache
  40. class A(object):
  41. # cached method. the storage lifetime follows `self` object
  42. @lru_cache()
  43. def cached_method(self, args):
  44. ...
  45. # cached classmethod. the storage lifetime follows `A` class
  46. @lru_cache() # the order is important!
  47. @classmethod # always lru_cache on top of classmethod
  48. def cached_classmethod(self, args):
  49. ...
  50. # cached staticmethod. the storage lifetime follows `A` class
  51. @lru_cache() # the order is important!
  52. @staticmethod # always lru_cache on top of staticmethod
  53. def cached_staticmethod(self, args):
  54. ...
  55. @lru_cache() # just same as functools.lru_cache
  56. def cached_function():
  57. ...
  58. Installation
  59. ------------
  60. PyPI is the recommended way.
  61. .. sourcecode:: shell
  62. $ pip install methodtools
  63. To browse versions and tarballs, visit:
  64. `<https://pypi.python.org/pypi/methodtools/>`_
  65. .. note::
  66. If you are working on Python 2, install also `functools32`.
  67. See also
  68. --------
  69. - [Documentation](https://methodtools.readthedocs.io/en/latest/)
  70. - This project is derived from `Ring <https://github.com/youknowone/ring/>`_,
  71. a rich cache interface using the same method handling technique.
  72. - To learn more about bound method dispatching, see also
  73. [wirerope](https://github.com/youknowone/wirerope).