original_docstring: Read puzzle data from file.
docstring: Read puzzle data from file.
docstring_tokens: Read puzzle data from file .
code: def raw_data(self, filename: Optional[str]) -> str:
      """Read puzzle data from file."""
      if filename not in self._filecache:
        if filename is None:
          path = self.data_file
        else:
          path = pathlib.Path(filename)
  
        if not path.exists():
          if filename:
            raise RuntimeError(f'Input file {filename} does not exist.')
          else:
            print(f'Input does not exist. Downloading.')
            path.write_text(self.site().get_input())
  
        self._filecache[filename] = path.read_text().strip()
      return self._filecache[filename]
code_tokens: def raw_data ( self , filename : Optional [ str ] ) -> str : if filename not in self . _filecache : if filename is None : path = self . data_file else : path = pathlib . Path ( filename ) if not path . exists ( ) : if filename : raise RuntimeError ( f'Input file {filename} does not exist.' ) else : print ( f'Input does not exist. Downloading.' ) path . write_text ( self . site ( ) . get_input ( ) ) self . _filecache [ filename ] = path . read_text ( ) . strip ( ) return self . _filecache [ filename ]
short_docstring: Read puzzle data from file.
short_docstring_tokens: Read puzzle data from file .
comment: """Read puzzle data from file."""