Skip to content

Commit

Permalink
Drop Jinja2 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Sep 17, 2023
1 parent 5de813b commit 12d042c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RUN zypper addrepo https://download.opensuse.org/repositories/SUSE:/CA/openSUSE_
python3-dulwich \
python3-python-dateutil \
python3-pytz \
python3-Jinja2 \
python3-bugzilla \
python3-PyGithub \
python3-python-gitlab \
Expand Down
15 changes: 5 additions & 10 deletions bugme.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from concurrent.futures import ThreadPoolExecutor
from typing import Any, Generator

from jinja2 import Template

from scantags import scan_tags
from services import get_item, Item, MyBugzilla, MyGithub, MyGitlab, MyRedmine
from utils import dateit
Expand Down Expand Up @@ -124,19 +122,16 @@ def print_items(
"created": "<15" if time_format == "timeago" else "<30",
"updated": "<15" if time_format == "timeago" else "<30",
}

keys = {key: keys.get(key, "") for key in output_format.split(",")}

# Print header
if output_type == "html":
header = "".join(f"<th>{key.upper()}</th>" for key in keys)
print(f"<table><thead><tr>{header}</tr></thead><tbody>")
elif "{{" not in output_format:
output_format = " ".join(
f'{{{{"{{:{align}}}".format({key})}}}}' for key, align in keys.items()
)
if "json" not in output_format:
print(Template(output_format).render({key: key.upper() for key in keys}))
else:
output_format = " ".join(f"{{{key}:{align}}}" for key, align in keys.items())
if "json" not in keys:
print(output_format.format(**{key: key.upper() for key in keys}))

xtags = {}
if not urltags:
Expand All @@ -156,7 +151,7 @@ def print_items(
href = f'<a href="{info["url"]}">{info["file"]} {info["lineno"]}</a>'
print(f"<tr>{tds}<td>{href}</td></tr>")
else:
print(Template(output_format).render(item.__dict__))
print(output_format.format(**item.__dict__))
for info in xtags.get(item.tag, []):
print("\t".join([info["file"], info["url"]]))

Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dulwich
Jinja2
PyGithub
python-bugzilla
python-gitlab
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ cryptography==41.0.3
Deprecated==1.2.14
dulwich==0.21.6
idna==3.4
Jinja2==3.1.2
MarkupSafe==2.1.3
pycparser==2.21
PyGithub==1.59.1
PyJWT==2.8.0
Expand Down

0 comments on commit 12d042c

Please sign in to comment.