mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-21 14:12:42 +02:00
Fix ruff
This commit is contained in:
@@ -2,11 +2,13 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
|
from datetime import datetime
|
||||||
|
from datetime import timezone
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
from typing import Dict
|
||||||
from typing import List
|
from typing import List
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
from typing import Dict, Union
|
from typing import Union
|
||||||
from datetime import datetime, timezone
|
|
||||||
|
|
||||||
from zulip import Client
|
from zulip import Client
|
||||||
|
|
||||||
@@ -44,17 +46,17 @@ class ZulipConnector(LoadConnector, PollConnector):
|
|||||||
realm_url = realm_url.strip().lower()
|
realm_url = realm_url.strip().lower()
|
||||||
|
|
||||||
# Remove any trailing slashes
|
# Remove any trailing slashes
|
||||||
realm_url = realm_url.rstrip('/')
|
realm_url = realm_url.rstrip("/")
|
||||||
|
|
||||||
# Ensure the URL has a scheme
|
# Ensure the URL has a scheme
|
||||||
if not realm_url.startswith(('http://', 'https://')):
|
if not realm_url.startswith(("http://", "https://")):
|
||||||
realm_url = f'https://{realm_url}'
|
realm_url = f"https://{realm_url}"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parsed = urllib.parse.urlparse(realm_url)
|
parsed = urllib.parse.urlparse(realm_url)
|
||||||
|
|
||||||
# Extract the base domain without any paths or ports
|
# Extract the base domain without any paths or ports
|
||||||
netloc = parsed.netloc.split(':')[0] # Remove port if present
|
netloc = parsed.netloc.split(":")[0] # Remove port if present
|
||||||
|
|
||||||
if not netloc:
|
if not netloc:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
Reference in New Issue
Block a user