mindquantum.utils.fdopen

View Source On Gitee
mindquantum.utils.fdopen(fname, mode, perms=384, encoding=None)[source]

Context manager for opening files with correct permissions.

Parameters
  • fname (str) – Path to file to open for reading/writing

  • mode (str) – Mode in which the file is opened (see help for builtin open())

  • perms (int) – Permission mask (see help for os.open())

  • encoding (str) – The name of encoding used to decode or encode the file.