mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-10 13:15:18 +02:00
Fix mypy
This commit is contained in:
@@ -44,29 +44,38 @@ def extract_jira_project(url: str) -> tuple[str, str]:
|
|||||||
|
|
||||||
return jira_base, jira_project
|
return jira_base, jira_project
|
||||||
|
|
||||||
def extract_text_from_content(content):
|
|
||||||
|
def extract_text_from_content(content: dict) -> str:
|
||||||
texts = []
|
texts = []
|
||||||
if 'content' in content:
|
if "content" in content:
|
||||||
for block in content['content']:
|
for block in content["content"]:
|
||||||
if 'content' in block:
|
if "content" in block:
|
||||||
for item in block['content']:
|
for item in block["content"]:
|
||||||
if item['type'] == 'text':
|
if item["type"] == "text":
|
||||||
texts.append(item['text'])
|
texts.append(item["text"])
|
||||||
return " ".join(texts)
|
return " ".join(texts)
|
||||||
|
|
||||||
def _get_comment_strs(jira: Issue, comment_email_blacklist: tuple[str, ...] = ()) -> list[str]:
|
|
||||||
|
def _get_comment_strs(
|
||||||
|
jira: Issue, comment_email_blacklist: tuple[str, ...] = ()
|
||||||
|
) -> list[str]:
|
||||||
comment_strs = []
|
comment_strs = []
|
||||||
for comment in jira.fields.comment.comments:
|
for comment in jira.fields.comment.comments:
|
||||||
try:
|
try:
|
||||||
if hasattr(comment, 'body'):
|
if hasattr(comment, "body"):
|
||||||
body_text = extract_text_from_content(comment.raw['body'])
|
body_text = extract_text_from_content(comment.raw["body"])
|
||||||
elif hasattr(comment, 'raw'):
|
elif hasattr(comment, "raw"):
|
||||||
body = comment.raw.get('body', 'No body content available')
|
body = comment.raw.get("body", "No body content available")
|
||||||
body_text = extract_text_from_content(body) if isinstance(body, dict) else body
|
body_text = (
|
||||||
|
extract_text_from_content(body) if isinstance(body, dict) else body
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
body_text = "No body attribute found"
|
body_text = "No body attribute found"
|
||||||
|
|
||||||
if hasattr(comment, 'author') and comment.author.emailAddress in comment_email_blacklist:
|
if (
|
||||||
|
hasattr(comment, "author")
|
||||||
|
and comment.author.emailAddress in comment_email_blacklist
|
||||||
|
):
|
||||||
continue # Skip adding comment if author's email is in blacklist
|
continue # Skip adding comment if author's email is in blacklist
|
||||||
|
|
||||||
comment_strs.append(body_text)
|
comment_strs.append(body_text)
|
||||||
@@ -76,6 +85,7 @@ def _get_comment_strs(jira: Issue, comment_email_blacklist: tuple[str, ...] = ()
|
|||||||
|
|
||||||
return comment_strs
|
return comment_strs
|
||||||
|
|
||||||
|
|
||||||
def fetch_jira_issues_batch(
|
def fetch_jira_issues_batch(
|
||||||
jql: str,
|
jql: str,
|
||||||
start_index: int,
|
start_index: int,
|
||||||
|
@@ -231,7 +231,8 @@ class NotionConnector(LoadConnector, PollConnector):
|
|||||||
|
|
||||||
if result_type == "unsupported":
|
if result_type == "unsupported":
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Skipping unsupported block type '{result_type}' ('{result_block_id}') for page '{page_block_id}': "
|
f"Skipping unsupported block type '{result_type}' "
|
||||||
|
f"('{result_block_id}') for base block '{base_block_id}': "
|
||||||
f"(discussion: https://github.com/danswer-ai/danswer/issues/1230)"
|
f"(discussion: https://github.com/danswer-ai/danswer/issues/1230)"
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
Reference in New Issue
Block a user