mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
fix(hide-secrets): drop the plugin docstrings and pin the block-scalar shapes
This commit is contained in:
parent
3b9742a34a
commit
0521663378
2 changed files with 6 additions and 8 deletions
|
|
@ -1,7 +1,3 @@
|
|||
"""
|
||||
This plugin searches for credential-shaped values assigned to a credential-named key.
|
||||
"""
|
||||
|
||||
import re
|
||||
from collections.abc import Generator, Mapping
|
||||
from typing import Final
|
||||
|
|
@ -15,10 +11,6 @@ _LOWERCASE_WORD_SEQUENCE: Final = re.compile(r"[a-z]+(?:[-._/][a-z]+)+")
|
|||
|
||||
|
||||
class CredentialKeywordDetector(KeywordDetector): # pyright: ignore[reportUntypedBaseClass] # detect_secrets ships no type information
|
||||
"""Yields the values ``KeywordDetector`` matches that are one credential-shaped token of
|
||||
at least ``minimum_length`` characters, dropping the ones that name a credential rather
|
||||
than holding one."""
|
||||
|
||||
secret_type = "Credential Keyword"
|
||||
|
||||
def __init__(
|
||||
|
|
|
|||
|
|
@ -329,6 +329,9 @@ def test_scan_message_keeps_every_value_when_a_config_repeats_a_key():
|
|||
" api_key: aB3dE6gH9jK2mN5p\n",
|
||||
"aB3dE6gH9jK2mN5p",
|
||||
),
|
||||
("api_key: >\n aB3dE6gH9jK2mN5p", "aB3dE6gH9jK2mN5p"),
|
||||
("api_key: |-\n aB3dE6gH9jK2mN5p", "aB3dE6gH9jK2mN5p"),
|
||||
("secret= \\\n aB3dE6gH9jK2mN5p", "aB3dE6gH9jK2mN5p"),
|
||||
],
|
||||
ids=[
|
||||
"flat-assignment",
|
||||
|
|
@ -338,6 +341,9 @@ def test_scan_message_keeps_every_value_when_a_config_repeats_a_key():
|
|||
"prose-after",
|
||||
"prose-both-sides",
|
||||
"indented-config",
|
||||
"yaml-folded-block",
|
||||
"yaml-literal-block",
|
||||
"backslash-continuation",
|
||||
],
|
||||
)
|
||||
def test_scan_message_still_sees_assignments_sharing_a_message_with_a_vendor_key(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue