Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create dxtbx.any2nexus dispatcher through setuptools #739

Merged
merged 2 commits into from
Jun 23, 2024
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
5 changes: 4 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def get_entry_point(filename: Path, prefix: str, import_path: str) -> List[str]:
tree = ast.parse(contents)
# Find root functions named "run"
has_run = any(
x for x in tree.body if isinstance(x, ast.FunctionDef) and x.name == "run"
x
for x in tree.body
if (isinstance(x, ast.FunctionDef) and x.name == "run")
or (isinstance(x, ast.ImportFrom) and "run" in [a.name for a in x.names])
)
if not has_run:
return []
Expand Down
1 change: 1 addition & 0 deletions newsfragments/739.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add any2nexus to formal dispatcher mechanisms.
2 changes: 1 addition & 1 deletion src/dxtbx/format/nxmx_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@
)


def run(args):
def run(args: list[str] | None = None):

Check warning on line 823 in src/dxtbx/format/nxmx_writer.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/format/nxmx_writer.py#L823

Added line #L823 was not covered by tests
usage = "dials.python nxmx_writer.py <experiments OR image files>"
parser = ArgumentParser(
usage=usage,
Expand Down
Loading