Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_info_parser():
parser = argparse.ArgumentParser(
description=("Print mesh info."), formatter_class=argparse.RawTextHelpFormatter
)
parser.add_argument("infile", type=str, help="mesh file to be read from")
parser.add_argument(
"--input-format",
"-i",
type=str,
choices=sorted(list(reader_map.keys())),
help="input file format",
default=None,
)
parser.add_argument(
"--version",
"-v",
action="version",
version=_get_version_text(),
help="display version information",
)
return parser
def _get_parser():
parser = argparse.ArgumentParser(
description=("Compress mesh file."),
formatter_class=argparse.RawTextHelpFormatter,
)
parser.add_argument("infile", type=str, help="mesh file to compress")
parser.add_argument(
"--input-format",
"-i",
type=str,
choices=sorted(list(reader_map.keys())),
help="input file format",
default=None,
)
parser.add_argument(
"--max", "-max", action="store_true", help="maximum compression", default=False,
)
parser.add_argument(
"--version",
"-v",
action="version",
version=_get_version_text(),
help="display version information",
)
return parser
def _get_parser():
parser = argparse.ArgumentParser(
description=("Covert mesh file to binary format."),
formatter_class=argparse.RawTextHelpFormatter,
)
parser.add_argument("infile", type=str, help="mesh file to convert")
parser.add_argument(
"--input-format",
"-i",
type=str,
choices=sorted(list(reader_map.keys())),
help="input file format",
default=None,
)
parser.add_argument(
"--version",
"-v",
action="version",
version=_get_version_text(),
help="display version information",
)
return parser
def _get_parser():
parser = argparse.ArgumentParser(
description=("Decompress mesh file."),
formatter_class=argparse.RawTextHelpFormatter,
)
parser.add_argument("infile", type=str, help="mesh file to decompress")
parser.add_argument(
"--input-format",
"-i",
type=str,
choices=sorted(list(reader_map.keys())),
help="input file format",
default=None,
)
parser.add_argument(
"--version",
"-v",
action="version",
version=_get_version_text(),
help="display version information",
)
return parser
args_string = self._format_args(action, default)
return ", ".join(action.option_strings) + " " + args_string
parser = argparse.ArgumentParser(
description=("Convert between mesh formats."),
# formatter_class=argparse.RawTextHelpFormatter,
formatter_class=CustomHelpFormatter,
)
parser.add_argument("infile", type=str, help="mesh file to be read from")
parser.add_argument(
"--input-format",
"-i",
type=str,
choices=sorted(list(reader_map.keys())),
help="input file format",
default=None,
)
parser.add_argument(
"--output-format",
"-o",
type=str,
choices=sorted(list(_writer_map.keys())),
help="output file format",
default=None,
)
parser.add_argument(
"--ascii",
"-a",
__email__ = "tianyikillua@gmail.com"
__copyright__ = "Copyright (c) 2019 {} <{}>".format(__author__, __email__)
__license__ = "License :: OSI Approved :: MIT License"
__version__ = "0.3.3"
__status__ = "Development Status :: 4 - Beta"
paraview_plugin_version = __version__
if float(meshio.__version__[:3]) < 3.3:
vtk_to_meshio_type = meshio._vtk.vtk_to_meshio_type
meshio_to_vtk_type = meshio._vtk.meshio_to_vtk_type
meshio_input_filetypes = meshio._helpers.input_filetypes
else:
vtk_to_meshio_type = meshio.vtk._vtk.vtk_to_meshio_type
meshio_to_vtk_type = meshio.vtk._vtk.meshio_to_vtk_type
meshio_input_filetypes = list(meshio._helpers.reader_map.keys())
meshio_extensions = [ext[1:] for ext in meshio._helpers._extension_to_filetype.keys()]
meshio_input_filetypes = ["automatic"] + meshio_input_filetypes
@smproxy.reader(
name="meshio Reader",
extensions=meshio_extensions,
file_description="meshio-supported files",
support_reload=False,
)
class meshioReader(VTKPythonAlgorithmBase):
def __init__(self):
VTKPythonAlgorithmBase.__init__(
self, nInputPorts=0, nOutputPorts=1, outputType="vtkUnstructuredGrid"
)
self._filename = None
from paraview.util.vtkAlgorithm import (
VTKPythonAlgorithmBase,
smdomain,
smhint,
smproperty,
smproxy,
)
from vtkmodules.numpy_interface import dataset_adapter as dsa
from vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid
import meshio
paraview_plugin_version = meshio.__version__
vtk_to_meshio_type = meshio.vtk._vtk.vtk_to_meshio_type
meshio_to_vtk_type = meshio.vtk._vtk.meshio_to_vtk_type
meshio_input_filetypes = list(meshio._helpers.reader_map.keys())
meshio_extensions = [ext[1:] for ext in meshio.extension_to_filetype.keys()]
meshio_input_filetypes = ["automatic"] + meshio_input_filetypes
@smproxy.reader(
name="meshio reader",
extensions=meshio_extensions,
file_description="meshio-supported files",
support_reload=False,
)
class MeshioReader(VTKPythonAlgorithmBase):
def __init__(self):
VTKPythonAlgorithmBase.__init__(
self, nInputPorts=0, nOutputPorts=1, outputType="vtkUnstructuredGrid"
)
self._filename = None