From 1f7fcec9352691a6e7a90c20e13dc59b65865030 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 9 May 2009 20:46:58 -0400 Subject: More docstrings all around. --- coverage/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'coverage/__init__.py') diff --git a/coverage/__init__.py b/coverage/__init__.py index c1b95874..c787b341 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') -- cgit v1.2.1