Skip to content

Commit

Permalink
Fix 57, 61, 68 (#78)
Browse files Browse the repository at this point in the history
Fix #61 
Fix #68 
Close #57
  • Loading branch information
pavel-kirienko authored Feb 25, 2023
1 parent d7fed71 commit 77d364f
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion yakut/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.2
0.13.0
8 changes: 5 additions & 3 deletions yakut/cmd/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ def _validate_request_fields(ctx: click.Context, param: click.Parameter, value:
@click.option(
"--with-metadata/--no-metadata",
"+M/-M",
default=False,
show_default=True,
help="When enabled, the response object is prepended with an extra field named `_meta_`.",
default=not sys.stdout.isatty(),
help="""
When enabled, the response object is prepended with an extra field named `_meta_`.
Enabled by default unless stdout is a tty.
""",
)
@yakut.pass_purser
@yakut.asynchronous()
Expand Down
5 changes: 4 additions & 1 deletion yakut/cmd/orchestrate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
import signal
import logging
from pathlib import Path
from typing import Any
import click
import yakut
Expand Down Expand Up @@ -288,7 +289,9 @@ def on_signal(s: int, _: Any) -> None:
if not sys.platform.startswith("win"):
signal.signal(signal.SIGHUP, on_signal)

ctx = Context(lookup_paths=purser.paths)
ctx = Context(
lookup_paths=(Path.cwd(), *purser.paths), # Current directory takes precedence.
)
res = exec_file(ctx, file, {}, gate=lambda: sig_num == 0)

return res if res != 0 else -sig_num
8 changes: 5 additions & 3 deletions yakut/cmd/subscribe/_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ def _handle_option_synchronizer_transfer_id(ctx: click.Context, _param: click.Pa
@click.option(
"--with-metadata/--no-metadata",
"+M/-M",
default=False,
show_default=True,
help="When enabled, each message object is prepended with an extra field named `_meta_`.",
default=not sys.stdout.isatty(),
help="""
When enabled, each message object is prepended with an extra field named `_meta_`.
Enabled by default unless stdout is a tty.
""",
)
@click.option(
"--count",
Expand Down
3 changes: 0 additions & 3 deletions yakut/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Author: Pavel Kirienko <[email protected]>

from __future__ import annotations
import os
import sys
import asyncio
import functools
Expand Down Expand Up @@ -199,7 +198,6 @@ def _mk_aliases(item: Any) -> set[str]:
help=f"""
In order to use compiled DSDL namespaces,
the directories that contain compilation outputs need to be specified using this option.
The current working directory does not need to be specified explicitly.
Examples:
Expand Down Expand Up @@ -242,7 +240,6 @@ def _click_main(
"""
_configure_logging(verbose) # This should be done in the first order to ensure that we log things correctly.

path = (os.getcwd(), *path)
_logger.debug("Path: %r", path)
for p in path:
sys.path.append(str(p))
Expand Down
15 changes: 14 additions & 1 deletion yakut/param/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,20 @@ def _make_json_formatter(_hints: FormatterHints) -> Formatter:
# - simplejson supports Decimal.
import simplejson as json # type: ignore

return lambda data: cast(str, json.dumps(data, ensure_ascii=False, separators=(",", ":"))) + _NEWLINE
# Remove ignore_nan=True when this change makes its way into PlotJuggler:
# https://github.com/nlohmann/json/issues/3799#issuecomment-1444268644
return (
lambda data: cast(
str,
json.dumps(
data,
ensure_ascii=False,
separators=(",", ":"),
ignore_nan=True,
),
)
+ _NEWLINE
)


def _insert_format_specifier(
Expand Down

0 comments on commit 77d364f

Please sign in to comment.