-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
787163e
commit 48d5383
Showing
14 changed files
with
399 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ dependencies = [ | |
"pytest", | ||
"Sphinx", | ||
"sphinx_rtd_theme", | ||
"docopt", | ||
] | ||
|
||
[project.urls] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .ls import Ls | ||
from .run import Run | ||
from .inp import * | ||
|
||
__all__ = [ | ||
"Ls", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
``inp`` provides utilities for aliasing PyMCNP INP objects. | ||
``inp`` contains the procedures for executing the ``pymcnp inp`` command. This | ||
module underpins the CLI by simplifying commands. | ||
""" | ||
|
||
|
||
import sys | ||
|
||
import docopt | ||
|
||
from .. import files | ||
from . import _io | ||
from . import _save | ||
|
||
|
||
PYMCNP_INP_DOC = f""" | ||
Usage: | ||
pymcnp inp ((--read <alias> <file>)|(--delete <alias>)) | ||
Options: | ||
-r --read Read INP file and create alias. | ||
-d --delete Delete alias. | ||
""" | ||
|
||
|
||
def main(argv: list[str] = sys.argv[1:]) -> None: | ||
""" | ||
``main`` executes the ``pymcnp inp`` command. | ||
``main`` processes the given command line arguments, and creates or deletes | ||
PyMCNP aliased INP objects. | ||
Parameters: | ||
argv: Tokenized list of CLI arguments. | ||
""" | ||
|
||
args = docopt.docopt(PYMCNP_INP_DOC, argv=argv) | ||
aliases = _save.Save.get_save() | ||
|
||
if args["--read"]: | ||
# Adding alias to save. | ||
aliases[args["<alias>"]] = (args["<file>"], files.inp.Inp.from_mcnp_file(args["<file>"])) | ||
elif args["--delete"]: | ||
# Removing alias from save. | ||
aliases.pop(args["<alias>"]) | ||
|
||
_save.Save.set_save(aliases) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.