pyplusplus.file_writers.writer.writer_t

Package pyplusplus :: Package file_writers :: Module writer :: Class writer_t |

# type writer_t

source code

    object --+
             |
            writer_t

Known Subclasses:
  - multiple_files.multiple_files_t
  - , single_file.single_file_t

Base class for all module/code writers.

All writers should have similar usage:

     w = writer_class(module, file, ...)
     w.write()

Instance Methods
__init__(self, extmodule, files_sum_repository=None, encoding=`'``ascii``'`) | source code
write(self) Main write method. | source code
write_code_repository(self, dir) creates files defined in code_repository package | source code
get_user_headers(self, creators) | source code
save_exposed_decls_db(self, file_path) | source code

Static Methods
create_backup(fpath) creates backup of the file, by renaming it to `fpath + ~` | source code
write_file(fpath, content, files_sum_repository=None, encoding=`'``ascii``'`) Write a source file. | source code

Class Variables
| logger = `_logging_.loggers.file_writer`

Properties
| encoding encoding name used to write generated code to files
| extmodule The root of the code creator tree ( code_creators.module_t )
| files_sum_repository

Method Details

### __init__(self, extmodule, files_sum_repository=None, encoding=`'``ascii``'`) (Constructor) | source code
Overrides: object.__init__ (inherited documentation)

### write(self) | source code
Main write method. Should be overridden by derived classes.

### write_file(fpath, content, files_sum_repository=None, encoding=`'``ascii``'`) Static Method | source code
Write a source file. This method writes the string content into the specified file. An additional fixed header is written at the top of the file before content. Parameters: `fpath` (str) - File name `content` (str) - The content of the file

Property Details

### encoding encoding name used to write generated code to files

### extmodule The root of the code creator tree ( code_creators.module_t )

### files_sum_repository