Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/mdio/commands/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def copy( # noqa: PLR0913
flags. The function supports custom storage options for both input and output, enabling
compatibility with various filesystems via FSSpec.
"""
from mdio.api.convenience import copy_mdio
# Lazy import to reduce CLI startup time
from mdio.api.convenience import copy_mdio # noqa: PLC0415

copy_mdio(
source_mdio_path,
Expand Down
13 changes: 8 additions & 5 deletions src/mdio/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def info(mdio_path: str, output_format: str, access_pattern: str) -> None:
By default, this returns human-readable information about the grid and stats for the dataset.
If output-format is set to 'json' then a JSON is returned to facilitate parsing.
"""
from mdio import MDIOReader
# Lazy import to reduce CLI startup time
from mdio import MDIOReader # noqa: PLC0415

reader = MDIOReader(mdio_path, access_pattern=access_pattern, return_metadata=True)

Expand Down Expand Up @@ -101,17 +102,19 @@ def parse_access_patterns(reader: MDIOReader) -> dict[str, Any]:

def json_print(mdio_info: dict[str, Any]) -> None:
"""Convert MDIO Info to JSON and pretty print."""
from json import dumps as json_dumps
# Lazy import to reduce CLI startup time
from json import dumps as json_dumps # noqa: PLC0415

from rich import print # noqa: A004
from rich import print # noqa: A004, PLC0415

print(json_dumps(mdio_info, indent=2))


def pretty_print(mdio_info: dict[str, Any]) -> None:
"""Print pretty MDIO Info table to console."""
from rich.console import Console
from rich.table import Table
# Lazy import to reduce CLI startup time
from rich.console import Console # noqa: PLC0415
from rich.table import Table # noqa: PLC0415

console = Console()

Expand Down
6 changes: 4 additions & 2 deletions src/mdio/commands/segy.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ def segy_import( # noqa: PLR0913
--chunk-size 8,2,256,512
--grid-overrides '{"HasDuplicates": True}'
"""
from mdio import segy_to_mdio
# Lazy import to reduce CLI startup time
from mdio import segy_to_mdio # noqa: PLC0415

segy_to_mdio(
segy_path=segy_path,
Expand Down Expand Up @@ -386,7 +387,8 @@ def segy_export(

The input MDIO can be local or cloud based. However, the output SEG-Y will be generated locally.
"""
from mdio import mdio_to_segy
# Lazy import to reduce CLI startup time
from mdio import mdio_to_segy # noqa: PLC0415

mdio_to_segy(
mdio_path_or_buffer=mdio_file,
Expand Down
Loading