From b497a04e5d5ad8377fcc7fd5001eaec268d46bed Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Fri, 8 Jan 2016 13:24:53 +0100 Subject: [PATCH] Merging upstream version 1.3.0. --- AUTHORS.rst | 6 ++++- HISTORY.rst | 10 ++++++++- PKG-INFO | 37 ++++++++++++++++--------------- README.rst | 22 ++++++------------ cached_property.egg-info/PKG-INFO | 37 ++++++++++++++++--------------- cached_property.py | 2 +- setup.py | 15 +++++-------- 7 files changed, 65 insertions(+), 64 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 232002e..51d714e 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -5,7 +5,8 @@ Credits Development Lead ---------------- -* Daniel Greenfeld +* Daniel Roy Greenfeld +* Audrey Roy Greenfeld (@audreyr) Contributors ------------ @@ -13,3 +14,6 @@ Contributors * Tin Tvrtković * @bcho * George Sakkis (@gsakkis) +* Adam Williamson +* Ionel Cristian Mărieș (@ionelmc) +* Malyshev Artem (@proofit404) diff --git a/HISTORY.rst b/HISTORY.rst index 9a610a1..d754400 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,14 @@ History ------- +1.3.0 (2015-11-24) +++++++++++++++++++ + +* Added official support for Python 3.5, thanks to @pydanny and @audreyr +* Removed confusingly placed lock from example, thanks to @ionelmc +* Corrected invalidation cache documentation, thanks to @proofit404 +* Updated to latest Travis-CI environment, thanks to @audreyr + 1.2.0 (2015-04-28) ++++++++++++++++++ @@ -14,7 +22,7 @@ History 1.1.0 (2015-04-04) ++++++++++++++++++ -* Regression: As the cache was not always clearing, we’ve broken out the time to expire feature to it’s own set of specific tools, thanks to @pydanny +* Regression: As the cache was not always clearing, we've broken out the time to expire feature to its own set of specific tools, thanks to @pydanny * Fixed typo in README, thanks to @zoidbergwill 1.0.0 (2015-02-13) diff --git a/PKG-INFO b/PKG-INFO index 4f8ea55..d42a23f 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cached-property -Version: 1.2.0 +Version: 1.3.0 Summary: A decorator for caching properties in classes. Home-page: https://github.com/pydanny/cached-property Author: Daniel Greenfeld @@ -10,15 +10,12 @@ Description: =============================== cached-property =============================== - .. image:: https://badge.fury.io/py/cached-property.png - :target: http://badge.fury.io/py/cached-property + .. image:: https://img.shields.io/pypi/v/cached-property.svg + :target: https://pypi.python.org/pypi/cached-property - .. image:: https://travis-ci.org/pydanny/cached-property.png?branch=master + .. image:: https://img.shields.io/travis/pydanny/cached-property/master.svg :target: https://travis-ci.org/pydanny/cached-property - .. image:: https://pypip.in/d/cached-property/badge.png - :target: https://pypi.python.org/pypi/cached-property - A decorator for caching properties in classes. @@ -32,7 +29,7 @@ Description: =============================== How to use it -------------- - Let's define a class with an expensive property. Every time you stay there the + Let's define a class with an expensive property. Every time you stay there the price goes up by $50! .. code-block:: python @@ -44,7 +41,7 @@ Description: =============================== @property def boardwalk(self): - # In reality, this might represent a database call or time + # In reality, this might represent a database call or time # intensive task like calling a third-party API. self.boardwalk_price += 50 return self.boardwalk_price @@ -104,7 +101,7 @@ Description: =============================== >>> monopoly.boardwalk 550 >>> # invalidate the cache - >>> del monopoly['boardwalk'] + >>> del monopoly.__dict__['boardwalk'] >>> # request the boardwalk property again >>> monopoly.boardwalk 600 @@ -120,15 +117,12 @@ Description: =============================== .. code-block:: python - import threading - from cached_property import threaded_cached_property class Monopoly(object): def __init__(self): self.boardwalk_price = 500 - self.lock = threading.Lock() @threaded_cached_property def boardwalk(self): @@ -137,9 +131,7 @@ Description: =============================== dice and moving their pieces.""" sleep(1) - # Need to guard this since += isn't atomic. - with self.lock: - self.boardwalk_price += 50 + self.boardwalk_price += 50 return self.boardwalk_price Now use it: @@ -216,6 +208,14 @@ Description: =============================== History ------- + 1.3.0 (2015-11-24) + ++++++++++++++++++ + + * Added official support for Python 3.5, thanks to @pydanny and @audreyr + * Removed confusingly placed lock from example, thanks to @ionelmc + * Corrected invalidation cache documentation, thanks to @proofit404 + * Updated to latest Travis-CI environment, thanks to @audreyr + 1.2.0 (2015-04-28) ++++++++++++++++++ @@ -227,7 +227,7 @@ Description: =============================== 1.1.0 (2015-04-04) ++++++++++++++++++ - * Regression: As the cache was not always clearing, we’ve broken out the time to expire feature to it’s own set of specific tools, thanks to @pydanny + * Regression: As the cache was not always clearing, we've broken out the time to expire feature to its own set of specific tools, thanks to @pydanny * Fixed typo in README, thanks to @zoidbergwill 1.0.0 (2015-02-13) @@ -271,7 +271,7 @@ Description: =============================== Keywords: cached-property Platform: UNKNOWN -Classifier: Development Status :: 4 - Beta +Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Natural Language :: English @@ -281,3 +281,4 @@ Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 diff --git a/README.rst b/README.rst index d9a893b..cebe4a2 100644 --- a/README.rst +++ b/README.rst @@ -2,15 +2,12 @@ cached-property =============================== -.. image:: https://badge.fury.io/py/cached-property.png - :target: http://badge.fury.io/py/cached-property +.. image:: https://img.shields.io/pypi/v/cached-property.svg + :target: https://pypi.python.org/pypi/cached-property -.. image:: https://travis-ci.org/pydanny/cached-property.png?branch=master +.. image:: https://img.shields.io/travis/pydanny/cached-property/master.svg :target: https://travis-ci.org/pydanny/cached-property -.. image:: https://pypip.in/d/cached-property/badge.png - :target: https://pypi.python.org/pypi/cached-property - A decorator for caching properties in classes. @@ -24,7 +21,7 @@ Why? How to use it -------------- -Let's define a class with an expensive property. Every time you stay there the +Let's define a class with an expensive property. Every time you stay there the price goes up by $50! .. code-block:: python @@ -36,7 +33,7 @@ price goes up by $50! @property def boardwalk(self): - # In reality, this might represent a database call or time + # In reality, this might represent a database call or time # intensive task like calling a third-party API. self.boardwalk_price += 50 return self.boardwalk_price @@ -96,7 +93,7 @@ Results of cached functions can be invalidated by outside forces. Let's demonstr >>> monopoly.boardwalk 550 >>> # invalidate the cache - >>> del monopoly['boardwalk'] + >>> del monopoly.__dict__['boardwalk'] >>> # request the boardwalk property again >>> monopoly.boardwalk 600 @@ -112,15 +109,12 @@ unfortunately causes problems with the standard ``cached_property``. In this cas .. code-block:: python - import threading - from cached_property import threaded_cached_property class Monopoly(object): def __init__(self): self.boardwalk_price = 500 - self.lock = threading.Lock() @threaded_cached_property def boardwalk(self): @@ -129,9 +123,7 @@ unfortunately causes problems with the standard ``cached_property``. In this cas dice and moving their pieces.""" sleep(1) - # Need to guard this since += isn't atomic. - with self.lock: - self.boardwalk_price += 50 + self.boardwalk_price += 50 return self.boardwalk_price Now use it: diff --git a/cached_property.egg-info/PKG-INFO b/cached_property.egg-info/PKG-INFO index 4f8ea55..d42a23f 100644 --- a/cached_property.egg-info/PKG-INFO +++ b/cached_property.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cached-property -Version: 1.2.0 +Version: 1.3.0 Summary: A decorator for caching properties in classes. Home-page: https://github.com/pydanny/cached-property Author: Daniel Greenfeld @@ -10,15 +10,12 @@ Description: =============================== cached-property =============================== - .. image:: https://badge.fury.io/py/cached-property.png - :target: http://badge.fury.io/py/cached-property + .. image:: https://img.shields.io/pypi/v/cached-property.svg + :target: https://pypi.python.org/pypi/cached-property - .. image:: https://travis-ci.org/pydanny/cached-property.png?branch=master + .. image:: https://img.shields.io/travis/pydanny/cached-property/master.svg :target: https://travis-ci.org/pydanny/cached-property - .. image:: https://pypip.in/d/cached-property/badge.png - :target: https://pypi.python.org/pypi/cached-property - A decorator for caching properties in classes. @@ -32,7 +29,7 @@ Description: =============================== How to use it -------------- - Let's define a class with an expensive property. Every time you stay there the + Let's define a class with an expensive property. Every time you stay there the price goes up by $50! .. code-block:: python @@ -44,7 +41,7 @@ Description: =============================== @property def boardwalk(self): - # In reality, this might represent a database call or time + # In reality, this might represent a database call or time # intensive task like calling a third-party API. self.boardwalk_price += 50 return self.boardwalk_price @@ -104,7 +101,7 @@ Description: =============================== >>> monopoly.boardwalk 550 >>> # invalidate the cache - >>> del monopoly['boardwalk'] + >>> del monopoly.__dict__['boardwalk'] >>> # request the boardwalk property again >>> monopoly.boardwalk 600 @@ -120,15 +117,12 @@ Description: =============================== .. code-block:: python - import threading - from cached_property import threaded_cached_property class Monopoly(object): def __init__(self): self.boardwalk_price = 500 - self.lock = threading.Lock() @threaded_cached_property def boardwalk(self): @@ -137,9 +131,7 @@ Description: =============================== dice and moving their pieces.""" sleep(1) - # Need to guard this since += isn't atomic. - with self.lock: - self.boardwalk_price += 50 + self.boardwalk_price += 50 return self.boardwalk_price Now use it: @@ -216,6 +208,14 @@ Description: =============================== History ------- + 1.3.0 (2015-11-24) + ++++++++++++++++++ + + * Added official support for Python 3.5, thanks to @pydanny and @audreyr + * Removed confusingly placed lock from example, thanks to @ionelmc + * Corrected invalidation cache documentation, thanks to @proofit404 + * Updated to latest Travis-CI environment, thanks to @audreyr + 1.2.0 (2015-04-28) ++++++++++++++++++ @@ -227,7 +227,7 @@ Description: =============================== 1.1.0 (2015-04-04) ++++++++++++++++++ - * Regression: As the cache was not always clearing, we’ve broken out the time to expire feature to it’s own set of specific tools, thanks to @pydanny + * Regression: As the cache was not always clearing, we've broken out the time to expire feature to its own set of specific tools, thanks to @pydanny * Fixed typo in README, thanks to @zoidbergwill 1.0.0 (2015-02-13) @@ -271,7 +271,7 @@ Description: =============================== Keywords: cached-property Platform: UNKNOWN -Classifier: Development Status :: 4 - Beta +Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Natural Language :: English @@ -281,3 +281,4 @@ Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 diff --git a/cached_property.py b/cached_property.py index 339a6b7..6a342d5 100644 --- a/cached_property.py +++ b/cached_property.py @@ -2,7 +2,7 @@ __author__ = 'Daniel Greenfeld' __email__ = 'pydanny@gmail.com' -__version__ = '1.2.0' +__version__ = '1.3.0' __license__ = 'BSD' from time import time diff --git a/setup.py b/setup.py index c26ef9b..c86b5c9 100755 --- a/setup.py +++ b/setup.py @@ -3,22 +3,16 @@ import os import sys -import codecs try: from setuptools import setup except ImportError: from distutils.core import setup -__version__ = '1.2.0' +__version__ = '1.3.0' - -def read(fname): - return codecs.open( - os.path.join(os.path.dirname(__file__), fname), 'r', 'utf-8').read() - -readme = read('README.rst') -history = read('HISTORY.rst').replace('.. :changelog:', '') +readme = open('README.rst').read() +history = open('HISTORY.rst').read().replace('.. :changelog:', '') if sys.argv[-1] == 'publish': os.system('python setup.py sdist bdist_wheel upload') @@ -40,7 +34,7 @@ setup( zip_safe=False, keywords='cached-property', classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Natural Language :: English', @@ -50,5 +44,6 @@ setup( 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', ], )