diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-05-09 20:46:58 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-05-09 20:46:58 -0400 |
commit | 293fcba134b982d124bbbac4dbfea7dcb35be977 (patch) | |
tree | f74c16ddc7a5239c854f36de7535e33239331899 /coverage/__init__.py | |
parent | e97dea8f96fcbbf60649560ad22011d02a239790 (diff) | |
download | python-coveragepy-293fcba134b982d124bbbac4dbfea7dcb35be977.tar.gz |
More docstrings all around.
Diffstat (limited to 'coverage/__init__.py')
-rw-r--r-- | coverage/__init__.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/coverage/__init__.py b/coverage/__init__.py index c1b9587..c787b34 100644 --- a/coverage/__init__.py +++ b/coverage/__init__.py @@ -23,12 +23,20 @@ from coverage.misc import CoverageException _the_coverage = None def _singleton_method(name): - def func(*args, **kwargs): + """Return a function to the `name` method on a singleton `coverage` object. + + The singleton object is created the first time one of these functions is + called. + + """ + def wrapper(*args, **kwargs): + """Singleton wrapper around a coverage method.""" global _the_coverage if not _the_coverage: _the_coverage = coverage() return getattr(_the_coverage, name)(*args, **kwargs) - return func + return wrapper + # Define the module-level functions. use_cache = _singleton_method('use_cache') |