chore: add ast-grep rule to convert Optional[T] to T | None (#25560)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
2e44ebe98d
commit
bab4975809
394 changed files with 2555 additions and 2792 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import base64
|
||||
import contextlib
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
|
@ -17,7 +16,7 @@ class UnstructuredEmailExtractor(BaseExtractor):
|
|||
file_path: Path to the file to load.
|
||||
"""
|
||||
|
||||
def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""):
|
||||
def __init__(self, file_path: str, api_url: str | None = None, api_key: str = ""):
|
||||
"""Initialize with file path."""
|
||||
self._file_path = file_path
|
||||
self._api_url = api_url
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
import pypandoc # type: ignore
|
||||
|
||||
|
|
@ -20,7 +19,7 @@ class UnstructuredEpubExtractor(BaseExtractor):
|
|||
def __init__(
|
||||
self,
|
||||
file_path: str,
|
||||
api_url: Optional[str] = None,
|
||||
api_url: str | None = None,
|
||||
api_key: str = "",
|
||||
):
|
||||
"""Initialize with file path."""
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from core.rag.extractor.extractor_base import BaseExtractor
|
||||
from core.rag.models.document import Document
|
||||
|
|
@ -16,7 +15,7 @@ class UnstructuredMarkdownExtractor(BaseExtractor):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""):
|
||||
def __init__(self, file_path: str, api_url: str | None = None, api_key: str = ""):
|
||||
"""Initialize with file path."""
|
||||
self._file_path = file_path
|
||||
self._api_url = api_url
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from core.rag.extractor.extractor_base import BaseExtractor
|
||||
from core.rag.models.document import Document
|
||||
|
|
@ -15,7 +14,7 @@ class UnstructuredMsgExtractor(BaseExtractor):
|
|||
file_path: Path to the file to load.
|
||||
"""
|
||||
|
||||
def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""):
|
||||
def __init__(self, file_path: str, api_url: str | None = None, api_key: str = ""):
|
||||
"""Initialize with file path."""
|
||||
self._file_path = file_path
|
||||
self._api_url = api_url
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from core.rag.extractor.extractor_base import BaseExtractor
|
||||
from core.rag.models.document import Document
|
||||
|
|
@ -15,7 +14,7 @@ class UnstructuredPPTExtractor(BaseExtractor):
|
|||
file_path: Path to the file to load.
|
||||
"""
|
||||
|
||||
def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""):
|
||||
def __init__(self, file_path: str, api_url: str | None = None, api_key: str = ""):
|
||||
"""Initialize with file path."""
|
||||
self._file_path = file_path
|
||||
self._api_url = api_url
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from core.rag.extractor.extractor_base import BaseExtractor
|
||||
from core.rag.models.document import Document
|
||||
|
|
@ -15,7 +14,7 @@ class UnstructuredPPTXExtractor(BaseExtractor):
|
|||
file_path: Path to the file to load.
|
||||
"""
|
||||
|
||||
def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""):
|
||||
def __init__(self, file_path: str, api_url: str | None = None, api_key: str = ""):
|
||||
"""Initialize with file path."""
|
||||
self._file_path = file_path
|
||||
self._api_url = api_url
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from core.rag.extractor.extractor_base import BaseExtractor
|
||||
from core.rag.models.document import Document
|
||||
|
|
@ -15,7 +14,7 @@ class UnstructuredXmlExtractor(BaseExtractor):
|
|||
file_path: Path to the file to load.
|
||||
"""
|
||||
|
||||
def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""):
|
||||
def __init__(self, file_path: str, api_url: str | None = None, api_key: str = ""):
|
||||
"""Initialize with file path."""
|
||||
self._file_path = file_path
|
||||
self._api_url = api_url
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue