MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / get

Method get

tensorboard/auth.py:75–102  ·  view source on GitHub ↗

Get an auth token from the auth provider with the given key. If successful, the result will be cached on this auth context. If unsuccessful, nothing will be cached, so a future call will invoke the underlying `AuthProvider.authenticate` method again. This method is

(self, provider_key)

Source from the content-addressed store, hash-verified

73 return cls({}, {})
74
75 def get(self, provider_key):
76 """Get an auth token from the auth provider with the given key.
77
78 If successful, the result will be cached on this auth context.
79 If unsuccessful, nothing will be cached, so a future call will
80 invoke the underlying `AuthProvider.authenticate` method again.
81
82 This method is not thread-safe. If multiple threads share an
83 auth context for a single request, then they must synchronize
84 externally when calling this method.
85
86 Returns:
87 The result of `provider.authenticate(...)` for the auth
88 provider specified by `provider_key`.
89
90 Raises:
91 KeyError: If the given `provider_key` does not correspond to
92 any registered `AuthProvider`.
93 Exception: As raised by the underlying `AuthProvider`.
94 """
95 provider = self._providers[provider_key]
96 sentinel = object()
97 value = self._cache.get(provider_key, sentinel)
98 if value is not sentinel:
99 return value
100 value = provider.authenticate(self._environ)
101 self._cache[provider_key] = value
102 return value

Callers 2

test_cache_successMethod · 0.95
test_cache_failureMethod · 0.95

Calls 2

getMethod · 0.65
authenticateMethod · 0.45

Tested by 2

test_cache_successMethod · 0.76
test_cache_failureMethod · 0.76