chore: precise typing
This commit is contained in:
parent
125e206047
commit
e9e6856467
1 changed files with 3 additions and 4 deletions
|
|
@ -14,7 +14,7 @@ import tempfile
|
||||||
import traceback
|
import traceback
|
||||||
import zipfile
|
import zipfile
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union, IO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import parse_qs, quote, unquote, urlparse, urlunparse
|
from urllib.parse import parse_qs, quote, unquote, urlparse, urlunparse
|
||||||
from warnings import warn, resetwarnings, catch_warnings
|
from warnings import warn, resetwarnings, catch_warnings
|
||||||
|
|
@ -525,7 +525,7 @@ class YouTubeConverter(DocumentConverter):
|
||||||
return metadata[k]
|
return metadata[k]
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def _findKey(self, json: Any, key: str) -> Union[str, None]: # TODO: Fix json type
|
def _findKey(self, json: Union[dict, list, Any], key: str) -> Union[str, None]:
|
||||||
if isinstance(json, list):
|
if isinstance(json, list):
|
||||||
for elm in json:
|
for elm in json:
|
||||||
ret = self._findKey(elm, key)
|
ret = self._findKey(elm, key)
|
||||||
|
|
@ -1330,9 +1330,8 @@ class MarkItDown:
|
||||||
# Convert
|
# Convert
|
||||||
return self._convert(path, extensions, **kwargs)
|
return self._convert(path, extensions, **kwargs)
|
||||||
|
|
||||||
# TODO what should stream's type be?
|
|
||||||
def convert_stream(
|
def convert_stream(
|
||||||
self, stream: Any, **kwargs: Any
|
self, stream: IO[Any], **kwargs: Any
|
||||||
) -> DocumentConverterResult: # TODO: deal with kwargs
|
) -> DocumentConverterResult: # TODO: deal with kwargs
|
||||||
# Prepare a list of extensions to try (in order of priority)
|
# Prepare a list of extensions to try (in order of priority)
|
||||||
ext = kwargs.get("file_extension")
|
ext = kwargs.get("file_extension")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue