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

BUG FIX: Remove Python plugin import error handling. #1019

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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Insert documentation here for #PLUGIN_NAME#
"""
from #PLUGIN_NAME#.Plugin import #PLUGIN_NAME#
from .Plugin import #PLUGIN_NAME#

__all__ = ['#PLUGIN_NAME#', 'get_plugin']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,8 @@ inline Result<> InsertFilterNameInPluginFiles(const std::filesystem::path& plugi
if(line == lastMarkerLine && insertToken)
{
outFile << "# FILTER_START: " << filterName << "\n"
<< "try:\n"
<< " from " << pluginName << "." << filterName << " import " << filterName << "\n"
<< " __all__.append('" << filterName << "')\n"
<< "except ImportError:\n"
<< " pass\n"
<< "from ." << filterName << " import " << filterName << "\n"
<< "__all__.append('" << filterName << "')\n"
<< "# FILTER_END: " << filterName << "\n\n";
}
outFile << line << '\n'; // Write the line out to the file
Expand Down Expand Up @@ -161,11 +158,8 @@ inline Result<> InsertFilterNameInPluginFiles(const std::filesystem::path& plugi
if(line == lastMarkerLine && insertToken)
{
outFile << "# FILTER_START: " << filterName << "\n"
<< "try:\n"
<< " from " << pluginName << "." << filterName << " import " << filterName << "\n"
<< " _filters.append(" << filterName << ")\n"
<< "except ImportError:\n"
<< " pass\n"
<< "from ." << filterName << " import " << filterName << "\n"
<< "_filters.append(" << filterName << ")\n"
<< "# FILTER_END: " << filterName << "\n\n";
}
outFile << line << '\n'; // Write the line out to the file
Expand Down Expand Up @@ -305,11 +299,8 @@ inline std::string GeneratePythonPlugin(const std::string& pluginName, const std
for(const auto& name : filterList)
{
ss << "# FILTER_START: " << name << "\n"
<< "try:\n"
<< " from " << pluginName << "." << name << " import " << name << "\n"
<< " _filters.append(" << name << ")\n"
<< "except ImportError:\n"
<< " pass\n"
<< "from ." << name << " import " << name << "\n"
<< "_filters.append(" << name << ")\n"
<< "# FILTER_END: " << name << "\n\n";
}
content = StringUtilities::replace(content, "#PLUGIN_IMPORT_CODE#", ss.str());
Expand Down Expand Up @@ -413,11 +404,8 @@ inline Result<> WritePythonPluginFiles(const std::filesystem::path& outputDirect
for(const auto& name : filterList)
{
ss << "# FILTER_START: " << name << "\n"
<< "try:\n"
<< " from " << pluginName << "." << name << " import " << name << "\n"
<< " __all__.append('" << name << "')\n"
<< "except ImportError:\n"
<< " pass\n"
<< "from ." << name << " import " << name << "\n"
<< "__all__.append('" << name << "')\n"
<< "# FILTER_END: " << name << "\n\n";
}
content = StringUtilities::replace(content, "#PLUGIN_IMPORT_CODE#", ss.str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,107 +13,68 @@
_filters = []

# FILTER_START: CalculateHistogramFilter
try:
from NXDataAnalysisToolkit.CalculateHistogramFilter import CalculateHistogramFilter
_filters.append(CalculateHistogramFilter)
except ImportError:
pass
from .CalculateHistogramFilter import CalculateHistogramFilter
_filters.append(CalculateHistogramFilter)
# FILTER_END: CalculateHistogramFilter

# FILTER_START: InterpolateGridDataFilter
try:
from NXDataAnalysisToolkit.InterpolateGridDataFilter import InterpolateGridDataFilter
_filters.append(InterpolateGridDataFilter)
except ImportError:
pass
from .InterpolateGridDataFilter import InterpolateGridDataFilter
_filters.append(InterpolateGridDataFilter)
# FILTER_END: InterpolateGridDataFilter

# FILTER_START: CliReaderFilter
try:
from NXDataAnalysisToolkit.CliReaderFilter import CliReaderFilter
_filters.append(CliReaderFilter)
except ImportError:
pass
from .CliReaderFilter import CliReaderFilter
_filters.append(CliReaderFilter)
# FILTER_END: CliReaderFilter

# FILTER_START: ContourDetectionFilter
try:
from NXDataAnalysisToolkit.ContourDetectionFilter import ContourDetectionFilter
_filters.append(ContourDetectionFilter)
except ImportError:
pass
from .ContourDetectionFilter import ContourDetectionFilter
_filters.append(ContourDetectionFilter)
# FILTER_END: ContourDetectionFilter

# FILTER_START: NPSortArray
try:
from NXDataAnalysisToolkit.NPSortArray import NPSortArray
_filters.append(NPSortArray)
except ImportError:
pass
from .NPSortArray import NPSortArray
_filters.append(NPSortArray)
# FILTER_END: NPSortArray

# FILTER_START: ReadPeregrineHDF5File
try:
from NXDataAnalysisToolkit.ReadPeregrineHDF5File import ReadPeregrineHDF5File
_filters.append(ReadPeregrineHDF5File)
except ImportError:
pass
from .ReadPeregrineHDF5File import ReadPeregrineHDF5File
_filters.append(ReadPeregrineHDF5File)
# FILTER_END: ReadPeregrineHDF5File

# FILTER_START: WriteAbaqusFile
try:
from DataAnalysisToolkit.WriteAbaqusFile import WriteAbaqusFile
_filters.append(WriteAbaqusFile)
except ImportError:
pass
from .WriteAbaqusFile import WriteAbaqusFile
_filters.append(WriteAbaqusFile)
# FILTER_END: WriteAbaqusFile

# FILTER_START: WriteAnsysFile
try:
from DataAnalysisToolkit.WriteAnsysFile import WriteAnsysFile
_filters.append(WriteAnsysFile)
except ImportError:
pass
from .WriteAnsysFile import WriteAnsysFile
_filters.append(WriteAnsysFile)
# FILTER_END: WriteAnsysFile

# FILTER_START: WriteMedFile
try:
from DataAnalysisToolkit.WriteMedFile import WriteMedFile
_filters.append(WriteMedFile)
except ImportError:
pass
from .WriteMedFile import WriteMedFile
_filters.append(WriteMedFile)
# FILTER_END: WriteMedFile

# FILTER_START: WriteGmshFile
try:
from DataAnalysisToolkit.WriteGmshFile import WriteGmshFile
_filters.append(WriteGmshFile)
except ImportError:
pass
from .WriteGmshFile import WriteGmshFile
_filters.append(WriteGmshFile)
# FILTER_END: WriteGmshFile

# FILTER_START: WriteTetGenFile
try:
from DataAnalysisToolkit.WriteTetGenFile import WriteTetGenFile
_filters.append(WriteTetGenFile)
except ImportError:
pass
from .WriteTetGenFile import WriteTetGenFile
_filters.append(WriteTetGenFile)
# FILTER_END: WriteTetGenFile

# FILTER_START: WriteVtuFile
try:
from DataAnalysisToolkit.WriteVtuFile import WriteVtuFile
_filters.append(WriteVtuFile)
except ImportError:
pass
from .WriteVtuFile import WriteVtuFile
_filters.append(WriteVtuFile)
# FILTER_END: WriteVtuFile

# FILTER_START: ReadMeshFile
try:
from DataAnalysisToolkit.ReadMeshFile import ReadMeshFile
_filters.append(ReadMeshFile)
except ImportError:
pass
from .ReadMeshFile import ReadMeshFile
_filters.append(ReadMeshFile)
# FILTER_END: ReadMeshFile

import simplnx as nx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,107 +7,68 @@
"""

# FILTER_START: CalculateHistogramFilter
try:
from .CalculateHistogramFilter import CalculateHistogramFilter
__all__.append('CalculateHistogramFilter')
except ImportError:
pass
from .CalculateHistogramFilter import CalculateHistogramFilter
__all__.append('CalculateHistogramFilter')
# FILTER_END: CalculateHistogramFilter

# FILTER_START: InterpolateGridDataFilter
try:
from .InterpolateGridDataFilter import InterpolateGridDataFilter
__all__.append('InterpolateGridDataFilter')
except ImportError:
pass
from .InterpolateGridDataFilter import InterpolateGridDataFilter
__all__.append('InterpolateGridDataFilter')
# FILTER_END: InterpolateGridDataFilter

# FILTER_START: CliReaderFilter
try:
from .CliReaderFilter import CliReaderFilter
__all__.append('CliReaderFilter')
except ImportError:
pass
from .CliReaderFilter import CliReaderFilter
__all__.append('CliReaderFilter')
# FILTER_END: CliReaderFilter

# FILTER_START: ContourDetectionFilter
try:
from .ContourDetectionFilter import ContourDetectionFilter
__all__.append('ContourDetectionFilter')
except ImportError:
pass
from .ContourDetectionFilter import ContourDetectionFilter
__all__.append('ContourDetectionFilter')
# FILTER_END: ContourDetectionFilter

# FILTER_START: NPSortArray
try:
from .NPSortArray import NPSortArray
__all__.append('NPSortArray')
except ImportError:
pass
from .NPSortArray import NPSortArray
__all__.append('NPSortArray')
# FILTER_END: NPSortArray

# FILTER_START: ReadPeregrineHDF5File
try:
from .ReadPeregrineHDF5File import ReadPeregrineHDF5File
__all__.append('ReadPeregrineHDF5File')
except ImportError:
pass
from .ReadPeregrineHDF5File import ReadPeregrineHDF5File
__all__.append('ReadPeregrineHDF5File')
# FILTER_END: ReadPeregrineHDF5File

# FILTER_START: WriteAbaqusFile
try:
from .WriteAbaqusFile import WriteAbaqusFile
__all__.append('WriteAbaqusFile')
except ImportError:
pass
from .WriteAbaqusFile import WriteAbaqusFile
__all__.append('WriteAbaqusFile')
# FILTER_END: WriteAbaqusFile

# FILTER_START: WriteAnsysFile
try:
from .WriteAnsysFile import WriteAnsysFile
__all__.append('WriteAnsysFile')
except ImportError:
pass
from .WriteAnsysFile import WriteAnsysFile
__all__.append('WriteAnsysFile')
# FILTER_END: WriteAnsysFile

# FILTER_START: WriteMedFile
try:
from .WriteMedFile import WriteMedFile
__all__.append('WriteMedFile')
except ImportError:
pass
from .WriteMedFile import WriteMedFile
__all__.append('WriteMedFile')
# FILTER_END: WriteMedFile

# FILTER_START: WriteGmshFile
try:
from .WriteGmshFile import WriteGmshFile
__all__.append('WriteGmshFile')
except ImportError:
pass
from .WriteGmshFile import WriteGmshFile
__all__.append('WriteGmshFile')
# FILTER_END: WriteGmshFile

# FILTER_START: WriteTetGenFile
try:
from .WriteTetGenFile import WriteTetGenFile
__all__.append('WriteTetGenFile')
except ImportError:
pass
from .WriteTetGenFile import WriteTetGenFile
__all__.append('WriteTetGenFile')
# FILTER_END: WriteTetGenFile

# FILTER_START: WriteVtuFile
try:
from .WriteVtuFile import WriteVtuFile
__all__.append('WriteVtuFile')
except ImportError:
pass
from .WriteVtuFile import WriteVtuFile
__all__.append('WriteVtuFile')
# FILTER_END: WriteVtuFile

# FILTER_START: ReadMeshFile
try:
from .ReadMeshFile import ReadMeshFile
__all__.append('ReadMeshFile')
except ImportError:
pass
from .ReadMeshFile import ReadMeshFile
__all__.append('ReadMeshFile')
# FILTER_END: ReadMeshFile

def get_plugin():
Expand Down
Loading