Skip to content

Commit

Permalink
Fix DeprecationWarnings: MARKDOWN and SINGLE_BORDER are deprecated, u…
Browse files Browse the repository at this point in the history
…se TableStyle instead
  • Loading branch information
hugovk committed Nov 2, 2024
1 parent 62d581a commit 76d132d
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 76d132d

Please sign in to comment.