import os
import sys
import lipd

# import pythonAdapter, assumes in ../python-adapter/
tests_dir = os.path.dirname(os.path.realpath(__file__))
fc_dir = os.path.dirname(tests_dir)
python_adapter_dir = os.path.join(fc_dir, "python-adapter")
sys.path.append(python_adapter_dir)

import adapter


def fake_model(adapter):
    # check to see inside function
    print("\n---\nStart of the fake_model function\n---\n")

    # the parameters are handed to you by the adapter
    files = adapter.get_files()

    # use the parameters given by the adapter to get the binary data of the LiPD file
    lipd.readLipd(files['weldeab'])

    # get the binary data of the NetCDF file
    net_cdf_path = files['net_cdf']

    # mark the NetCDF file as an output file
    adapter.set_output_files(net_cdf_path)
    adapter.set_output_files("lipd-files\\")

    return

# have to call adapter in the adapter.py file as adapter.adapter
adapter = adapter.global_adapter

adapter.register(fake_model)
adapter.start_server()

[((7, 9, 7, 35), 'os.path.dirname', 'os.path.dirname', ({(7, 25, 7, 34): 'tests_dir'}, {}), '(tests_dir)', False, 'import os\n'), ((8, 21, 8, 59), 'os.path.join', 'os.path.join', ({(8, 34, 8, 40): 'fc_dir', (8, 42, 8, 58): '"""python-adapter"""'}, {}), "(fc_dir, 'python-adapter')", False, 'import os\n'), ((9, 0, 9, 35), 'sys.path.append', 'sys.path.append', ({(9, 16, 9, 34): 'python_adapter_dir'}, {}), '(python_adapter_dir)', False, 'import sys\n'), ((36, 0, 36, 28), 'adapter.register', 'adapter.register', ({(36, 17, 36, 27): 'fake_model'}, {}), '(fake_model)', False, 'import adapter\n'), ((37, 0, 37, 22), 'adapter.start_server', 'adapter.start_server', ({}, {}), '()', False, 'import adapter\n'), ((6, 28, 6, 54), 'os.path.realpath', 'os.path.realpath', ({(6, 45, 6, 53): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((19, 12, 19, 31), 'adapter.get_files', 'adapter.get_files', ({}, {}), '()', False, 'import adapter\n'), ((22, 4, 22, 35), 'lipd.readLipd', 'lipd.readLipd', ({(22, 18, 22, 34): "files['weldeab']"}, {}), "(files['weldeab'])", False, 'import lipd\n'), ((28, 4, 28, 42), 'adapter.set_output_files', 'adapter.set_output_files', ({(28, 29, 28, 41): 'net_cdf_path'}, {}), '(net_cdf_path)', False, 'import adapter\n'), ((29, 4, 29, 44), 'adapter.set_output_files', 'adapter.set_output_files', ({(29, 29, 29, 43): '"""lipd-files\\\\"""'}, {}), "('lipd-files\\\\')", False, 'import adapter\n')]