nxt_io module

Methods for file input and output of nxt file data.

register_reference_path_expander(expander)[source]

Register a method to expand reference paths. An expander is a callable that takes exactly 1 argument, a filepath.

Parameters:expander (callable) – A python callable that takes a single argument, and returns an expanded filepath.
load_file_data(filepath)[source]

Given a file path this function determines if its a known nxt save format and attempts to open it. If the file is out of date it is passed to the legacy converter for conversion.

Parameters:filepath (str) – string of save file filepath
Returns:dict of file data
save_file_data(save_data, filepath=None, file_format='.nxt')[source]

Saves the given file data to the given file path in the given file format. If no filepath is provided a temp file is generated. The default file format is ASCII.

Parameters:
  • save_data – dict of save data
  • filepath – string of desired output file path or None
  • file_format – FILE_FORMAT constant
Returns:

string of output file path.