Skip to content

Commit

Permalink
Add StorageClassFactory stringification
Browse files Browse the repository at this point in the history
Mostly expected to be useful for people trying to determine
what storage classes have been registered for debugging purposes.
  • Loading branch information
timj committed Sep 25, 2018
1 parent aeb333c commit d5959e5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions python/lsst/daf/butler/core/storageClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,22 @@ def __init__(self, config=None):
if config is not None:
self.addFromConfig(config)

def __str__(self):
"""Return summary of factory.
Returns
-------
summary : `str`
Summary of the factory status.
"""
sep = "\n"
return f"""Number of registered StorageClasses: {len(self._storageClasses)}
StorageClasses
--------------
{sep.join(f"{s}: {self._storageClasses[s]}" for s in self._storageClasses)}
"""

def __contains__(self, storageClassOrName):
"""Indicates whether the storage class exists in the factory.
Expand Down

0 comments on commit d5959e5

Please sign in to comment.