The sgf Module

utilities for parsing SGF (Smart Game Format) files

sente.sgf.dump(game: sente.Game, file_name: str) None

saves a game as an SGF

sente.sgf.dumps(game: sente.Game) str

Serialize a string as an SGF

sente.sgf.load(filename: str, disable_warnings: bool = False, ignore_illegal_properties: bool = True, fix_file_format: bool = True) sente.Game

Loads a go game from an SGF file.

Parameters
  • filename – the name of the file

  • disable_warnings – whether to ignore warnings when loading an illegal SGF file

  • ignore_illegal_properties – whether or not to ignore illegal SGF properties

  • fix_file_format – whether or not to fix the file format if it is wrong

Returns

a sente.Game object populated with data from the SGF file

sente.sgf.loads(sgf_text: str, disable_warnings: bool = False, ignore_illegal_properties: bool = True, fix_file_format: bool = True) sente.Game

Loads a go game from an SGF file.

Parameters
  • sgf_text – the text of the SGF file to read from

  • disable_warnings – whether to ignore warnings when loading an illegal SGF file

  • ignore_illegal_properties – whether or not to ignore illegal SGF properties

  • fix_file_format – whether or not to fix the file format if it is wrong

Returns

a sente.Game object populated with data from the SGF file