Skip to content

Commit

Permalink
maintain: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkin committed Nov 28, 2024
1 parent bce1e99 commit 784b696
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
7 changes: 0 additions & 7 deletions src/mdformat/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import argparse
from collections.abc import Generator, Iterable, Mapping, Sequence
import contextlib
import inspect
import logging
import os.path
from pathlib import Path
Expand Down Expand Up @@ -426,12 +425,6 @@ def log_handler_applied(
logger.removeHandler(handler)


def get_package_name(obj: object) -> str | None:
"""Return top level module name, or None if not found."""
module = inspect.getmodule(obj)
return module.__name__.split(".", maxsplit=1)[0] if module else None


def get_plugin_info_str(
parser_extension_dists: Mapping[str, tuple[str, list[str]]],
codeformatter_dists: Mapping[str, tuple[str, list[str]]],
Expand Down
9 changes: 1 addition & 8 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest

import mdformat
from mdformat._cli import get_package_name, get_plugin_info_str, run, wrap_paragraphs
from mdformat._cli import get_plugin_info_str, run, wrap_paragraphs
from mdformat.plugins import CODEFORMATTERS, PARSER_EXTENSIONS
from tests.utils import (
FORMATTED_MARKDOWN,
Expand Down Expand Up @@ -345,13 +345,6 @@ def test_eol__check_keep_crlf(tmp_path):
assert run((str(file_path), "--check", "--end-of-line=keep")) == 1


def test_get_package_name():
# Test a function/class
assert get_package_name(patch) == "unittest"
# Test a package/module
assert get_package_name(mdformat) == "mdformat"


def test_get_plugin_info_str():
info = get_plugin_info_str(
{"mdformat-tables": ("0.1.0", ["tables"])},
Expand Down

0 comments on commit 784b696

Please sign in to comment.