Change import statements with try except to enable explicit import of submodules from import to avoid conflicts with parent project.
This commit is contained in:
BIN
instruments/instrument_registry.xlsx
Normal file
BIN
instruments/instrument_registry.xlsx
Normal file
Binary file not shown.
@ -6,7 +6,10 @@ import yaml
|
||||
|
||||
#root_dir = os.path.abspath(os.curdir)
|
||||
#sys.path.append(root_dir)
|
||||
import utils.g5505_utils as utils
|
||||
try:
|
||||
from dima.utils import g5505_utils as utils
|
||||
except ModuleNotFoundError:
|
||||
import utils.g5505_utils as utils
|
||||
|
||||
|
||||
|
||||
|
@ -3,9 +3,13 @@ import sys
|
||||
#root_dir = os.path.abspath(os.curdir)
|
||||
#sys.path.append(root_dir)
|
||||
|
||||
from instruments.readers.xps_ibw_reader import read_xps_ibw_file_as_dict
|
||||
from instruments.readers.g5505_text_reader import read_txt_files_as_dict
|
||||
|
||||
try:
|
||||
from dima.instruments.readers.xps_ibw_reader import read_xps_ibw_file_as_dict
|
||||
from dima.instruments.readers.g5505_text_reader import read_txt_files_as_dict
|
||||
|
||||
except ModuleNotFoundError:
|
||||
from instruments.readers.xps_ibw_reader import read_xps_ibw_file_as_dict
|
||||
from instruments.readers.g5505_text_reader import read_txt_files_as_dict
|
||||
|
||||
file_extensions = ['.ibw','.txt','.dat','.h5','.TXT','.csv','.pkl','.json','.yaml']
|
||||
|
||||
|
@ -8,7 +8,10 @@ import json
|
||||
#from instruments.readers import set_dima_path as configpath
|
||||
#configpath.set_dima_path()
|
||||
|
||||
from utils import g5505_utils
|
||||
try:
|
||||
from dima.utils import g5505_utils as utils
|
||||
except ModuleNotFoundError:
|
||||
import utils.g5505_utils as utils
|
||||
|
||||
|
||||
def read_jsonflag_as_dict(path_to_file):
|
||||
|
@ -22,9 +22,15 @@ from datetime import datetime
|
||||
from itertools import chain
|
||||
|
||||
# Import DIMA modules
|
||||
import src.hdf5_writer as hdf5_lib
|
||||
import utils.g5505_utils as utils
|
||||
from instruments.readers import filereader_registry
|
||||
try:
|
||||
from dima.src import hdf5_writer as hdf5_lib
|
||||
from dima.utils import g5505_utils as utils
|
||||
from dima.instruments.readers import filereader_registry
|
||||
except ModuleNotFoundError:
|
||||
print(':)')
|
||||
import src.hdf5_writer as hdf5_lib
|
||||
import utils.g5505_utils as utils
|
||||
from instruments.readers import filereader_registry
|
||||
|
||||
allowed_file_extensions = filereader_registry.file_extensions
|
||||
|
||||
|
@ -15,7 +15,12 @@ if dimaPath not in sys.path: # Avoid duplicate entries
|
||||
|
||||
import h5py
|
||||
import yaml
|
||||
import src.hdf5_ops as hdf5_ops
|
||||
|
||||
try:
|
||||
from dima.src import hdf5_ops as hdf5_ops
|
||||
except ModuleNotFoundError:
|
||||
import src.hdf5_ops as hdf5_ops
|
||||
|
||||
|
||||
|
||||
def load_yaml(review_yaml_file):
|
||||
|
@ -1,7 +1,12 @@
|
||||
import subprocess
|
||||
import os
|
||||
import utils.g5505_utils as utils
|
||||
from pipelines.metadata_revision import update_hdf5_file_with_review
|
||||
|
||||
try:
|
||||
from dima.utils import g5505_utils as utils
|
||||
from dima.pipelines.metadata_revision import update_hdf5_file_with_review
|
||||
except ModuleNotFoundError:
|
||||
import utils.g5505_utils as utils
|
||||
from pipelines.metadata_revision import update_hdf5_file_with_review
|
||||
|
||||
def perform_git_operations(hdf5_upload):
|
||||
status_command = ['git', 'status']
|
||||
|
@ -17,9 +17,6 @@ if dimaPath not in sys.path: # Avoid duplicate entries
|
||||
import h5py
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
import utils.g5505_utils as utils
|
||||
import src.hdf5_writer as hdf5_lib
|
||||
import logging
|
||||
import datetime
|
||||
|
||||
@ -29,6 +26,13 @@ import yaml
|
||||
import json
|
||||
import copy
|
||||
|
||||
try:
|
||||
from dima.utils import g5505_utils as utils
|
||||
from dima.src import hdf5_writer as hdf5_lib
|
||||
except ModuleNotFoundError:
|
||||
import utils.g5505_utils as utils
|
||||
import src.hdf5_writer as hdf5_lib
|
||||
|
||||
class HDF5DataOpsManager():
|
||||
|
||||
"""
|
||||
|
@ -1,15 +1,19 @@
|
||||
import sys
|
||||
import os
|
||||
root_dir = os.path.abspath(os.curdir)
|
||||
sys.path.append(root_dir)
|
||||
#root_dir = os.path.abspath(os.curdir)
|
||||
#sys.path.append(root_dir)
|
||||
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import h5py
|
||||
import logging
|
||||
|
||||
import utils.g5505_utils as utils
|
||||
import instruments.readers.filereader_registry as filereader_registry
|
||||
try:
|
||||
from dima.utils import g5505_utils as utils
|
||||
from dima.instruments.readers import filereader_registry as filereader_registry
|
||||
except ModuleNotFoundError:
|
||||
import utils.g5505_utils as utils
|
||||
import instruments.readers.filereader_registry as filereader_registry
|
||||
|
||||
|
||||
|
||||
|
@ -13,8 +13,11 @@ from plotly.subplots import make_subplots
|
||||
import plotly.graph_objects as go
|
||||
import plotly.express as px
|
||||
#import plotly.io as pio
|
||||
from src.hdf5_ops import get_parent_child_relationships
|
||||
|
||||
try:
|
||||
from dima.src.hdf5_ops import get_parent_child_relationships
|
||||
except ModuleNotFoundError:
|
||||
from src.hdf5_ops import get_parent_child_relationships
|
||||
|
||||
|
||||
def display_group_hierarchy_on_a_treemap(filename: str):
|
||||
|
Reference in New Issue
Block a user