Skip to content

Commit

Permalink
fix html output
Browse files Browse the repository at this point in the history
  • Loading branch information
carderne committed Mar 25, 2024
1 parent b8aad4f commit 5dd8c3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 5 additions & 3 deletions sigexport/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def main(
paginate = int(1e20)

if html_output:
html_.prep_html(dest)
html.prep_html(dest)

This comment has been minimized.

Copy link
@huyz

huyz Mar 29, 2024

Oh yeah, my bad. Accidentally committed my local change.

Speaking of which, when I try to debug the repo in IntelliJ, I get conflicts because html and logging are well known Python libraries. For example, when beautifulsoup imports html, my Python executable pulls sigexport/html for some reason.

I don't know how to avoid the conflicts, but you seem to have no problem with those. Maybe you have an idea off the top of your head?

Perhaps, I need to try this in VS Code.

This comment has been minimized.

Copy link
@carderne

carderne Apr 1, 2024

Author Owner

Interesting. I use Neovim + LSP, auto-import does occassionally try to import the wrong thing... Would probably be better to namespace sigexport.html or rename them but never used IntelliJ so not sure what would make it happiest :P

This comment has been minimized.

Copy link
@carderne

carderne Apr 2, 2024

Author Owner

@huyz
Possibly relevant (saw this while reading about something unrelated):
https://davidvujic.github.io/python-polylith-docs/ide/#breaking-nuance-references-corrections

for key, messages in chat_dict.items():
name = contacts[key].name
# some contact names are None
Expand All @@ -233,12 +233,14 @@ def main(
print(msg.to_md(), file=md_f)
print(msg.dict_str(), file=js_f)
if html_output:
ht = html_.create_html(name=name, messages=messages, msgs_per_page=paginate)
ht = html.create_html(
name=name, messages=messages, msgs_per_page=paginate
)
print(ht, file=ht_f)
finally:
md_f.close()
js_f.close()
if html_output:
if ht_f:
ht_f.close()

secho("Done!", fg=colors.GREEN)
Expand Down
12 changes: 9 additions & 3 deletions sigexport/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ def dt_from_ts(ts: float) -> datetime:

def parse_datetime(input_str: str) -> datetime:
last_exception = None
for format in ["%Y-%m-%d %H:%M", "%Y-%m-%d, %H:%M", "%Y-%m-%d %H:%M:%S", "%Y-%m-%d, %H:%M:%S"]:
for fmt in [
"%Y-%m-%d %H:%M",
"%Y-%m-%d, %H:%M",
"%Y-%m-%d %H:%M:%S",
"%Y-%m-%d, %H:%M:%S",
]:
try:
return datetime.strptime(input_str, format)
return datetime.strptime(input_str, fmt)
except ValueError as e:
last_exception = e
raise(last_exception)
raise (last_exception)


def version_callback(value: bool) -> None:
"""Get sigexport version."""
Expand Down

0 comments on commit 5dd8c3b

Please sign in to comment.