From 970e68bc201f7b55bf8ce04025521e014c21c0e5 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Thu, 5 Dec 2024 13:57:39 -0700 Subject: [PATCH] Add docstring for bind method --- python/lsst/daf/butler/_labeled_butler_factory.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/python/lsst/daf/butler/_labeled_butler_factory.py b/python/lsst/daf/butler/_labeled_butler_factory.py index 3941722527..141ddc0eee 100644 --- a/python/lsst/daf/butler/_labeled_butler_factory.py +++ b/python/lsst/daf/butler/_labeled_butler_factory.py @@ -91,6 +91,21 @@ def __init__(self, repositories: Mapping[str, str] | None = None) -> None: self._preload_direct_butler_cache = True def bind(self, access_token: str | None) -> LabeledButlerFactoryProtocol: + """Create a callable factory function for generating Butler instances + with out needing to specify access tokans again. + + Parameters + ---------- + access_token : `str` or `None` + An optional access token to use for authentication with the Butler. + + Returns + ------- + bound : `LabeledButlerFactoryProtocol` + A callable that takes a label as input and returns a Butler + instance. + """ + def create(label: str) -> Butler: return self.create_butler(label=label, access_token=access_token)