Skip to content

Commit 132ac2f

Browse files
committed
chore: Update comments and convert required_authz_tokens to read-only
This enhances readability and clarity.
1 parent 78ee8d4 commit 132ac2f

File tree

1 file changed

+6
-7
lines changed
  • packages/toolbox-core/src/toolbox_core

1 file changed

+6
-7
lines changed

packages/toolbox-core/src/toolbox_core/tool.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,9 @@ def add_auth_token_getters(
307307
f"Cannot register client the same headers in the client as well as tool."
308308
)
309309

310-
# create a read-only updated value for new_getters
311-
new_getters = MappingProxyType(
312-
dict(self.__auth_service_token_getters, **auth_token_getters)
313-
)
314-
# create a read-only updated for params that are still required
310+
new_getters = dict(self.__auth_service_token_getters, **auth_token_getters)
311+
312+
# find the updated required authn params and the auth token getters used
315313
new_req_authn_params, new_req_authz_tokens, used_auth_token_getters = (
316314
identify_required_authn_params(
317315
self.__required_authn_params,
@@ -323,9 +321,10 @@ def add_auth_token_getters(
323321
# TODO: Add validation for used_auth_token_getters
324322

325323
return self.__copy(
326-
auth_service_token_getters=new_getters,
324+
# create a read-only map for updated getters, params and tokens that are still required
325+
auth_service_token_getters=MappingProxyType(new_getters),
327326
required_authn_params=MappingProxyType(new_req_authn_params),
328-
required_authz_tokens=new_req_authz_tokens,
327+
required_authz_tokens=tuple(new_req_authz_tokens),
329328
)
330329

331330
def bind_params(

0 commit comments

Comments
 (0)