Skip to content

Commit cb421cf

Browse files
t3tra-devafourney
andauthored
Chore: Make linter happy (#1256)
* refactor: remove unused imports * fix: replace NotImplemented with NotImplementedError * refactor: resolve E722 (do not use bare 'except') * refactor: remove unused variable * refactor: remove unused imports * refactor: ignore unused imports that will be used in the future * refactor: resolve W293 (blank line contains whitespace) * refactor: resolve F541 (f-string is missing placeholders) --------- Co-authored-by: afourney <[email protected]>
1 parent 39e7252 commit cb421cf

26 files changed

+25
-69
lines changed

packages/markitdown-mcp/src/markitdown_mcp/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import sys
2-
from typing import Any
32
from mcp.server.fastmcp import FastMCP
43
from starlette.applications import Starlette
54
from mcp.server.sse import SseServerTransport

packages/markitdown-sample-plugin/tests/test_sample_plugin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python3 -m pytest
22
import os
3-
import pytest
43

54
from markitdown import MarkItDown, StreamInfo
65
from markitdown_sample_plugin import RtfConverter

packages/markitdown/src/markitdown/__main__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import argparse
55
import sys
66
import codecs
7-
import locale
87
from textwrap import dedent
98
from importlib.metadata import entry_points
109
from .__about__ import __version__
@@ -34,13 +33,13 @@ def main():
3433
OR
3534
3635
markitdown < example.pdf
37-
36+
3837
OR to save to a file use
39-
38+
4039
markitdown example.pdf -o example.md
41-
40+
4241
OR
43-
42+
4443
markitdown example.pdf > example.md
4544
"""
4645
).strip(),

packages/markitdown/src/markitdown/_base_converter.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import os
2-
import tempfile
3-
from warnings import warn
4-
from typing import Any, Union, BinaryIO, Optional, List
1+
from typing import Any, BinaryIO, Optional
52
from ._stream_info import StreamInfo
63

74

packages/markitdown/src/markitdown/_markitdown.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import copy
21
import mimetypes
32
import os
43
import re
54
import sys
65
import shutil
7-
import tempfile
8-
import warnings
96
import traceback
107
import io
118
from dataclasses import dataclass
@@ -547,7 +544,7 @@ def _convert(
547544
# Sanity check -- make sure the cur_pos is still the same
548545
assert (
549546
cur_pos == file_stream.tell()
550-
), f"File stream position should NOT change between guess iterations"
547+
), "File stream position should NOT change between guess iterations"
551548

552549
_kwargs = {k: v for k, v in kwargs.items()}
553550

@@ -614,7 +611,7 @@ def _convert(
614611

615612
# Nothing can handle it!
616613
raise UnsupportedFormatException(
617-
f"Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported."
614+
"Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported."
618615
)
619616

620617
def register_page_converter(self, converter: DocumentConverter) -> None:

packages/markitdown/src/markitdown/converter_utils/docx/math/omml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def do_fname(self, elm):
272272
if FUNC.get(t):
273273
latex_chars.append(FUNC[t])
274274
else:
275-
raise NotImplemented("Not support func %s" % t)
275+
raise NotImplementedError("Not support func %s" % t)
276276
else:
277277
latex_chars.append(t)
278278
t = BLANK.join(latex_chars)
@@ -316,7 +316,7 @@ def do_limlow(self, elm):
316316
t_dict = self.process_children_dict(elm, include=("e", "lim"))
317317
latex_s = LIM_FUNC.get(t_dict["e"])
318318
if not latex_s:
319-
raise NotImplemented("Not support lim %s" % t_dict["e"])
319+
raise NotImplementedError("Not support lim %s" % t_dict["e"])
320320
else:
321321
return latex_s.format(lim=t_dict.get("lim"))
322322

packages/markitdown/src/markitdown/converter_utils/docx/pre_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def pre_process_docx(input_docx: BinaryIO) -> BinaryIO:
147147
updated_content = _pre_process_math(content)
148148
# In the future, if there are more pre-processing steps, they can be added here
149149
zip_output.writestr(name, updated_content)
150-
except:
150+
except Exception:
151151
# If there is an error in processing the content, write the original content
152152
zip_output.writestr(name, content)
153153
else:

packages/markitdown/src/markitdown/converters/_audio_converter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import io
2-
from typing import Any, BinaryIO, Optional
1+
from typing import Any, BinaryIO
32

43
from ._exiftool import exiftool_metadata
54
from ._transcribe_audio import transcribe_audio

packages/markitdown/src/markitdown/converters/_bing_serp_converter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import io
21
import re
32
import base64
43
import binascii
54
from urllib.parse import parse_qs, urlparse
6-
from typing import Any, BinaryIO, Optional
5+
from typing import Any, BinaryIO
76
from bs4 import BeautifulSoup
87

98
from .._base_converter import DocumentConverter, DocumentConverterResult

packages/markitdown/src/markitdown/converters/_csv_converter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import sys
21
import csv
32
import io
43
from typing import BinaryIO, Any
54
from charset_normalizer import from_bytes
6-
from ._html_converter import HtmlConverter
75
from .._base_converter import DocumentConverter, DocumentConverterResult
86
from .._stream_info import StreamInfo
97

0 commit comments

Comments
 (0)