Modules | Files | Inheritance Tree | Inheritance Graph | Name Index | Config
module Synopsis::Core::Util
class PyWriter
Files: Synopsis/Core/Util.py

A class that allows writing data in such a way that it can be read in by just 'exec'ing the file. You should extend it and override write_item()


Operations Summary:
 __init__(self, ostream) [Source]
 indent(self) [Source]
 outdent(self) [Source]
 ensure_import(self, module, names) [Source]
 ensure_struct(self) [Source]
 write_top(self, str)
Writes a string to the top of the file [Source]
 write(self, str) [Source]
 write_item(self, item)
Writes arbitrary items by looking up write_Foo functions where Foo is the class name of the item [Source]
 flush(self)
Writes the buffer to the stream and closes the buffer [Source]
 long(self, list)
Remembers list as wanting 'long' representation (an item per line) [Source]
 write_list(self, list)
Writes a list on one line. [Source]
 write_long_list(self, list)
Writes a list with each item on a new line [Source]
 write_attr(self, name, value) [Source]
 flatten_struct(self, struct)
Flattens a struct into a (possibly nested) list. [Source]
 write_PyWriterStruct(self, struct) [Source]

Operation Details:
  write_list(self, list)

Writes a list on one line. If long(list) was previously called, the list from its cache and calls write_long_list


  flatten_struct(self, struct)

Flattens a struct into a (possibly nested) list. A struct is an object with only the following members: numbers, strings, sub-structs, lists and tuples.