You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project has several modules in the MVC folder structures. During development and unit testing it was found that the import statement for the modules from different directories does not work unless we include statement to insert the path to the modules. However, the caveat is that these insert statement and the corresponding import sys statement need to be present before the statement to import the project modules from other directories. This violates the styling principles of having import statements at the beginning of the file and having import statements in alphabetical order. This is caught by linter as well, and we had to suppress it by applying a linter hint to ignore the relevant error message for this specific case.
An example below, taken from LIME_Education_Ex.py. As you can see from below, we had to import sys and include statements to insert the MVC folder paths into PATH environment variable with the sys.path.insert command. And the actual required import statement(s) is after the "extra" import and insert statements.
sumanbhagavathula
changed the title
Issue with importing project modules from different directory paths
Issue with importing project modules from different directory paths (using cloned repo)
Jun 11, 2019
sumanbhagavathula
changed the title
Issue with importing project modules from different directory paths (using cloned repo)
Issue with linter for including PATH insert statements before other module imports
Jun 11, 2019
The project has several modules in the MVC folder structures. During development and unit testing it was found that the import statement for the modules from different directories does not work unless we include statement to insert the path to the modules. However, the caveat is that these insert statement and the corresponding import sys statement need to be present before the statement to import the project modules from other directories. This violates the styling principles of having import statements at the beginning of the file and having import statements in alphabetical order. This is caught by linter as well, and we had to suppress it by applying a linter hint to ignore the relevant error message for this specific case.
An example below, taken from LIME_Education_Ex.py. As you can see from below, we had to import sys and include statements to insert the MVC folder paths into PATH environment variable with the sys.path.insert command. And the actual required import statement(s) is after the "extra" import and insert statements.
import sys
sys.path.insert(0, '../LIMEaid/LIMEaid/controller')
sys.path.insert(0, '../LIMEaid/LIMEaid/model')
sys.path.insert(0, '../LIMEaid/LIMEaid/view')
import fit_sklearn_models as fsm
The workaround is in travis.yml file on line 37, NOTE the ignore switch and the argument value.
flake8 LIMEaid --ignore=E402
The text was updated successfully, but these errors were encountered: