memoized-property-1.0.3/0000755000076500000240000000000012773130703015640 5ustar stevenstaff00000000000000memoized-property-1.0.3/AUTHORS.rst0000644000076500000240000000024012773127367017527 0ustar stevenstaff00000000000000======= Credits ======= Development Lead ---------------- * Steven Cummings Contributors ------------ None yet. Why not be the first?memoized-property-1.0.3/CONTRIBUTING.rst0000644000076500000240000000646512773127367020330 0ustar stevenstaff00000000000000============ Contributing ============ Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: Types of Contributions ---------------------- Report Bugs ~~~~~~~~~~~ Report bugs at https://github.com/estebistec/python-memoized-property/issues. If you are reporting a bug, please include: * Your operating system name and version. * Any details about your local setup that might be helpful in troubleshooting. * Detailed steps to reproduce the bug. Fix Bugs ~~~~~~~~ Look through the GitHub issues for bugs. Anything tagged with "bug" is open to whoever wants to implement it. Implement Features ~~~~~~~~~~~~~~~~~~ Look through the GitHub issues for features. Anything tagged with "feature" is open to whoever wants to implement it. Write Documentation ~~~~~~~~~~~~~~~~~~~ memoized_property could always use more documentation, whether as part of the official memoized_property docs, in docstrings, or even on the web in blog posts, articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ The best way to send feedback is to file an issue at https://github.com/estebistec/python-memoized-property/issues. If you are proposing a feature: * Explain in detail how it would work. * Keep the scope as narrow as possible, to make it easier to implement. * Remember that this is a volunteer-driven project, and that contributions are welcome :) Get Started! ------------ Ready to contribute? Here's how to set up `python-memoized-property` for local development. 1. Fork the `python-memoized-property` repo on GitHub. 2. Clone your fork locally:: $ git clone git@github.com:your_name_here/python-memoized-property.git 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: $ mkvirtualenv python-memoized-property $ cd python-memoized-property/ $ pip install -r dev-requirements.txt $ python setup.py develop 4. Create a branch for local development:: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. 5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: $ flake8 memoized_property.py tests $ python setup.py test $ tox To get flake8 and tox, just pip install them into your virtualenv. 6. Commit your changes and push your branch to GitHub:: $ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature 7. Submit a pull request through the GitHub website. Pull Request Guidelines ----------------------- Before you submit a pull request, check that it meets these guidelines: 1. The pull request should include tests. 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. 3. The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check https://travis-ci.org/estebistec/python-memoized-property/pull_requests and make sure that the tests pass for all supported Python versions. Tips ---- To run a subset of tests:: $ python -m unittest tests.test_memoized_propertymemoized-property-1.0.3/HISTORY.rst0000644000076500000240000000051012773130120017520 0ustar stevenstaff00000000000000.. :changelog: History ------- 1.0.3 (2016-09-28) ++++++++++++++++++ * Build universal wheels * Support Python 3.4, 3.5 1.0.2 (2014-05-02) ++++++++++++++++++ * Remove dependency on six 1.0.1 (2014-01-01) ++++++++++++++++++ * Added python 3.2 compatability 1.0.0 (2013-12-26) ++++++++++++++++++ * First release on PyPI. memoized-property-1.0.3/LICENSE0000644000076500000240000000270712773127367016667 0ustar stevenstaff00000000000000Copyright (c) 2013, Steven Cummings All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of memoized_property nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.memoized-property-1.0.3/MANIFEST.in0000644000076500000240000000014312773127367017410 0ustar stevenstaff00000000000000include AUTHORS.rst include CONTRIBUTING.rst include HISTORY.rst include LICENSE include README.rstmemoized-property-1.0.3/memoized_property.egg-info/0000755000076500000240000000000012773130703023107 5ustar stevenstaff00000000000000memoized-property-1.0.3/memoized_property.egg-info/dependency_links.txt0000644000076500000240000000000112773130700027152 0ustar stevenstaff00000000000000 memoized-property-1.0.3/memoized_property.egg-info/not-zip-safe0000644000076500000240000000000112773130700025332 0ustar stevenstaff00000000000000 memoized-property-1.0.3/memoized_property.egg-info/pbr.json0000644000076500000240000000005712773130700024564 0ustar stevenstaff00000000000000{"is_release": false, "git_version": "17424f0"}memoized-property-1.0.3/memoized_property.egg-info/PKG-INFO0000644000076500000240000000643212773130700024206 0ustar stevenstaff00000000000000Metadata-Version: 1.1 Name: memoized-property Version: 1.0.3 Summary: A simple python decorator for defining properties that only run their fget function once Home-page: https://github.com/estebistec/python-memoized-property Author: Steven Cummings Author-email: cummingscs@gmail.com License: BSD Description: ================= memoized_property ================= .. image:: https://badge.fury.io/py/memoized-property.png :target: http://badge.fury.io/py/memoized-property .. image:: https://travis-ci.org/estebistec/python-memoized-property.png?branch=master :target: https://travis-ci.org/estebistec/python-memoized-property .. image:: https://pypip.in/d/memoized-property/badge.png :target: https://crate.io/packages/memoized-property?version=latest A simple python decorator for defining properties that only run their fget function once. * Free software: BSD license What? ----- A Python property that only calls its ``fget`` function one time. How many times have you written this code (or similar)? :: def class C(object): @property def name(self): if not hasattr(self, '_name'): self._name = some_expensive_load() return self._name I've written it just enough times to be annoyed enough to capture this module. The result is this:: from memoized_property import memoized_property def class C(object): @memoized_property def name(self): # Boilerplate guard conditional avoided, but this is still only called once return some_expensive_load() Why? ---- I couldn't find a pre-existing version of this on PyPI. I found one other on GitHub, https://github.com/ytyng/python-memoized-property, but it was not published to PyPI. History ------- 1.0.3 (2016-09-28) ++++++++++++++++++ * Build universal wheels * Support Python 3.4, 3.5 1.0.2 (2014-05-02) ++++++++++++++++++ * Remove dependency on six 1.0.1 (2014-01-01) ++++++++++++++++++ * Added python 3.2 compatability 1.0.0 (2013-12-26) ++++++++++++++++++ * First release on PyPI. Keywords: memoized property decorator Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Natural Language :: English Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 memoized-property-1.0.3/memoized_property.egg-info/SOURCES.txt0000644000076500000240000000053712773130700024775 0ustar stevenstaff00000000000000AUTHORS.rst CONTRIBUTING.rst HISTORY.rst LICENSE MANIFEST.in README.rst memoized_property.py setup.cfg setup.py memoized_property.egg-info/PKG-INFO memoized_property.egg-info/SOURCES.txt memoized_property.egg-info/dependency_links.txt memoized_property.egg-info/not-zip-safe memoized_property.egg-info/pbr.json memoized_property.egg-info/top_level.txtmemoized-property-1.0.3/memoized_property.egg-info/top_level.txt0000644000076500000240000000002212773130700025630 0ustar stevenstaff00000000000000memoized_property memoized-property-1.0.3/memoized_property.py0000755000076500000240000000205312773127367022006 0ustar stevenstaff00000000000000# -*- coding: utf-8 -*- from functools import wraps def memoized_property(fget): """ Return a property attribute for new-style classes that only calls its getter on the first access. The result is stored and on subsequent accesses is returned, preventing the need to call the getter any more. Example:: >>> class C(object): ... load_name_count = 0 ... @memoized_property ... def name(self): ... "name's docstring" ... self.load_name_count += 1 ... return "the name" >>> c = C() >>> c.load_name_count 0 >>> c.name "the name" >>> c.load_name_count 1 >>> c.name "the name" >>> c.load_name_count 1 """ attr_name = '_{0}'.format(fget.__name__) @wraps(fget) def fget_memoized(self): if not hasattr(self, attr_name): setattr(self, attr_name, fget(self)) return getattr(self, attr_name) return property(fget_memoized) memoized-property-1.0.3/PKG-INFO0000644000076500000240000000643212773130703016742 0ustar stevenstaff00000000000000Metadata-Version: 1.1 Name: memoized-property Version: 1.0.3 Summary: A simple python decorator for defining properties that only run their fget function once Home-page: https://github.com/estebistec/python-memoized-property Author: Steven Cummings Author-email: cummingscs@gmail.com License: BSD Description: ================= memoized_property ================= .. image:: https://badge.fury.io/py/memoized-property.png :target: http://badge.fury.io/py/memoized-property .. image:: https://travis-ci.org/estebistec/python-memoized-property.png?branch=master :target: https://travis-ci.org/estebistec/python-memoized-property .. image:: https://pypip.in/d/memoized-property/badge.png :target: https://crate.io/packages/memoized-property?version=latest A simple python decorator for defining properties that only run their fget function once. * Free software: BSD license What? ----- A Python property that only calls its ``fget`` function one time. How many times have you written this code (or similar)? :: def class C(object): @property def name(self): if not hasattr(self, '_name'): self._name = some_expensive_load() return self._name I've written it just enough times to be annoyed enough to capture this module. The result is this:: from memoized_property import memoized_property def class C(object): @memoized_property def name(self): # Boilerplate guard conditional avoided, but this is still only called once return some_expensive_load() Why? ---- I couldn't find a pre-existing version of this on PyPI. I found one other on GitHub, https://github.com/ytyng/python-memoized-property, but it was not published to PyPI. History ------- 1.0.3 (2016-09-28) ++++++++++++++++++ * Build universal wheels * Support Python 3.4, 3.5 1.0.2 (2014-05-02) ++++++++++++++++++ * Remove dependency on six 1.0.1 (2014-01-01) ++++++++++++++++++ * Added python 3.2 compatability 1.0.0 (2013-12-26) ++++++++++++++++++ * First release on PyPI. Keywords: memoized property decorator Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Natural Language :: English Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 memoized-property-1.0.3/README.rst0000644000076500000240000000267412773127367017354 0ustar stevenstaff00000000000000================= memoized_property ================= .. image:: https://badge.fury.io/py/memoized-property.png :target: http://badge.fury.io/py/memoized-property .. image:: https://travis-ci.org/estebistec/python-memoized-property.png?branch=master :target: https://travis-ci.org/estebistec/python-memoized-property .. image:: https://pypip.in/d/memoized-property/badge.png :target: https://crate.io/packages/memoized-property?version=latest A simple python decorator for defining properties that only run their fget function once. * Free software: BSD license What? ----- A Python property that only calls its ``fget`` function one time. How many times have you written this code (or similar)? :: def class C(object): @property def name(self): if not hasattr(self, '_name'): self._name = some_expensive_load() return self._name I've written it just enough times to be annoyed enough to capture this module. The result is this:: from memoized_property import memoized_property def class C(object): @memoized_property def name(self): # Boilerplate guard conditional avoided, but this is still only called once return some_expensive_load() Why? ---- I couldn't find a pre-existing version of this on PyPI. I found one other on GitHub, https://github.com/ytyng/python-memoized-property, but it was not published to PyPI. memoized-property-1.0.3/setup.cfg0000644000076500000240000000012212773130703017454 0ustar stevenstaff00000000000000[wheel] universal = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 memoized-property-1.0.3/setup.py0000755000076500000240000000266712773127702017375 0ustar stevenstaff00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys try: from setuptools import setup except ImportError: from distutils.core import setup if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') sys.exit() readme = open('README.rst').read() history = open('HISTORY.rst').read().replace('.. :changelog:', '') setup( name='memoized-property', version='1.0.3', description='A simple python decorator for defining properties that only run their fget function once', long_description=readme + '\n\n' + history, author='Steven Cummings', author_email='cummingscs@gmail.com', url='https://github.com/estebistec/python-memoized-property', py_modules=['memoized_property'], license="BSD", zip_safe=False, keywords='memoized property decorator', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Natural Language :: English', "Programming Language :: Python :: 2", 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', ], test_suite='tests', )