Skip to content

Commit d46f377

Browse files
fix: remove trailing whitespace for editorconfig compliance
Co-Authored-By: Jake Cosme <[email protected]>
1 parent db06c3c commit d46f377

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

examples/pydantic_models_to_grammar_examples.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,38 @@
2222

2323
def validate_host(host):
2424
"""Validate host parameter to prevent SSRF attacks.
25-
25+
2626
Args:
2727
host: Host string in format 'hostname:port' or 'hostname'
28-
28+
2929
Returns:
3030
bool: True if host is valid, False otherwise
31-
31+
3232
Raises:
3333
ValueError: If host format is invalid or contains suspicious patterns
3434
"""
3535
if not host or not isinstance(host, str):
3636
raise ValueError("Host must be a non-empty string")
37-
37+
3838
if any(char in host for char in ['@', ' ', '\n', '\r', '\t', '\x00']):
3939
raise ValueError("Host contains invalid characters")
40-
40+
4141
try:
4242
if not host.startswith(('http://', 'https://')):
4343
test_url = f"http://{host}"
4444
else:
4545
test_url = host
46-
46+
4747
parsed = urlparse(test_url)
48-
48+
4949
if not parsed.hostname:
5050
raise ValueError("Invalid hostname")
51-
51+
5252
hostname = parsed.hostname.lower()
53-
53+
5454
if parsed.scheme and parsed.scheme not in ('http', 'https'):
5555
raise ValueError("Only HTTP and HTTPS schemes are allowed")
56-
56+
5757
return True
5858
except ValueError:
5959
raise

tools/tts/tts-outetts.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,38 @@
1111

1212
def validate_host(host):
1313
"""Validate host parameter to prevent SSRF attacks.
14-
14+
1515
Args:
1616
host: Host string in format 'hostname:port' or 'hostname'
17-
17+
1818
Returns:
1919
bool: True if host is valid, False otherwise
20-
20+
2121
Raises:
2222
ValueError: If host format is invalid or contains suspicious patterns
2323
"""
2424
if not host or not isinstance(host, str):
2525
raise ValueError("Host must be a non-empty string")
26-
26+
2727
if any(char in host for char in ['@', ' ', '\n', '\r', '\t', '\x00']):
2828
raise ValueError("Host contains invalid characters")
29-
29+
3030
try:
3131
if not host.startswith(('http://', 'https://')):
3232
test_url = f"http://{host}"
3333
else:
3434
test_url = host
35-
35+
3636
parsed = urlparse(test_url)
37-
37+
3838
if not parsed.hostname:
3939
raise ValueError("Invalid hostname")
40-
40+
4141
hostname = parsed.hostname.lower()
42-
42+
4343
if parsed.scheme and parsed.scheme not in ('http', 'https'):
4444
raise ValueError("Only HTTP and HTTPS schemes are allowed")
45-
45+
4646
return True
4747
except ValueError:
4848
raise

0 commit comments

Comments
 (0)