Merging upstream version 1.3.0.

This commit is contained in:
Mathias Behrle 2016-01-08 13:24:53 +01:00
parent 1694def23e
commit b497a04e5d
7 changed files with 65 additions and 64 deletions

View File

@ -5,7 +5,8 @@ Credits
Development Lead
----------------
* Daniel Greenfeld <pydanny@gmail.com>
* Daniel Roy Greenfeld <pydanny@gmail.com>
* Audrey Roy Greenfeld (@audreyr)
Contributors
------------
@ -13,3 +14,6 @@ Contributors
* Tin Tvrtković <tinchester@gmail.com>
* @bcho <bcho@vtmer.com>
* George Sakkis (@gsakkis)
* Adam Williamson <awilliam AT redhat DOT com>
* Ionel Cristian Mărieș (@ionelmc)
* Malyshev Artem (@proofit404)

View File

@ -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, weve broken out the time to expire feature to its 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)

View File

@ -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, weve broken out the time to expire feature to its 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

View File

@ -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:

View File

@ -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, weve broken out the time to expire feature to its 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

View File

@ -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

View File

@ -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',
],
)