Skip to content

Commit

Permalink
Fix DeprecationWarnings: use TableStyle instead of MARKDOWN and SINGL…
Browse files Browse the repository at this point in the history
…E_BORDER (#456)
  • Loading branch information
hugovk authored Nov 2, 2024
2 parents 62d581a + 76d132d commit 1eaefde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dynamic = [ "version" ]
dependencies = [
"httpx>=0.19",
"platformdirs",
"prettytable>=2.4",
"prettytable>=3.12",
"pytablewriter[html]>=0.63",
"python-dateutil",
"python-slugify",
Expand Down
6 changes: 4 additions & 2 deletions src/pypistats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,12 @@ def _tabulate(data: dict | list, format_: str = "markdown", color: str = "yes")
def _prettytable(
headers: list[str], data: dict | list, format_: str, color: str = "yes"
) -> str:
from prettytable import MARKDOWN, SINGLE_BORDER, PrettyTable
from prettytable import PrettyTable, TableStyle

x = PrettyTable()
x.set_style(MARKDOWN if format_ == "markdown" else SINGLE_BORDER)
x.set_style(
TableStyle.MARKDOWN if format_ == "markdown" else TableStyle.SINGLE_BORDER
)

if isinstance(data, dict):
data = [data]
Expand Down

0 comments on commit 1eaefde

Please sign in to comment.