Package translate :: Package convert :: Module convert :: Class ArchiveConvertOptionParser

[hide private]
[frames] | no frames]

# Class ArchiveConvertOptionParser

source code

ConvertOptionParser that can handle recursing into single archive files. archiveformats maps extension to class. if the extension doesn't matter, it can be None. if the extension is only valid for input/output/template, it can be given as (extension, filepurpose)

Instance Methods | [hide private]

__init__(self, formats, usetemplates=False, usepots=False, description=None, archiveformats=None) construct the specialized Option Parser | source code

setarchiveoptions(self, **kwargs) allows setting options that will always be passed to openarchive | source code

isrecursive(self, fileoption, filepurpose=`'``input``'`) checks if fileoption is a recursive file | source code

isarchive(self, fileoption, filepurpose=`'``input``'`) returns whether the file option is an archive file | source code

getarchiveclass(self, fileext, filepurpose, isdir=False) returns the archiveclass for the given fileext and filepurpose | source code

openarchive(self, archivefilename, filepurpose, **kwargs) creates an archive object for the given file | source code

recurseinputfiles(self, options) recurse through archive file / directories and return files to be converted | source code

recursearchivefiles(self, options) recurse through archive files and convert files | source code

openinputfile(self, options, fullinputpath) opens the input file | source code

getfullinputpath(self, options, inputpath) gets the absolute path to an input file | source code

opentemplatefile(self, options, fulltemplatepath) opens the template file (if required) | source code

getfulltemplatepath(self, options, templatepath) gets the absolute path to a template file | source code

templateexists(self, options, templatepath) returns whether the given template exists... | source code

getfulloutputpath(self, options, outputpath) gets the absolute path to an output file | source code

checkoutputsubdir(self, options, subdir) checks to see if subdir under options.output needs to be created, creates if neccessary | source code

openoutputfile(self, options, fulloutputpath) opens the output file | source code

inittemplatearchive(self, options) opens the templatearchive if not already open | source code

initoutputarchive(self, options) creates an outputarchive if required | source code

recursiveprocess(self, options) recurse through directories and convert files | source code

processfile(self, fileprocessor, options, fullinputpath, fulloutputpath, fulltemplatepath) run an invidividual conversion | source code

Inherited from `ConvertOptionParser`: `add_duplicates_option`, `add_fuzzy_option`, `add_multifile_option`, `filterinputformats`, `filteroutputoptions`, `getformathelp`, `potifyformat`, `run`, `setpotoption`, `verifyoptions`

Inherited from `misc.optrecurse.RecursiveOptionParser`: `define_option`, `finalizetempoutputfile`, `format_manpage`, `get_prog_name`, `getoutputname`, `getoutputoptions`, `getpassthroughoptions`, `gettemplatename`, `getusageman`, `getusagestring`, `initprogressbar`, `isexcluded`, `isvalidinputname`, `mkdir`, `opentempoutputfile`, `parse_args`, `print_manpage`, `recurseinputfilelist`, `reportprogress`, `set_usage`, `seterrorleveloptions`, `setformats`, `setmanpageoption`, `setprogressoptions`, `setpsycooption`, `splitext`, `splitinputext`, `splittemplateext`, `usepsyco`, `warning`

Inherited from `optparse.OptionParser`: `add_option_group`, `check_values`, `destroy`, `disable_interspersed_args`, `enable_interspersed_args`, `error`, `exit`, `expand_prog_name`, `format_epilog`, `format_help`, `format_option_help`, `get_default_values`, `get_description`, `get_option_group`, `get_usage`, `get_version`, `print_help`, `print_usage`, `print_version`, `set_default`, `set_defaults`, `set_process_default_values`

Inherited from `optparse.OptionParser` (private): `_add_help_option`, `_add_version_option`, `_create_option_list`, `_get_all_options`, `_get_args`, `_get_encoding`, `_init_parsing_state`, `_match_long_opt`, `_populate_option_list`, `_process_args`, `_process_long_opt`, `_process_short_opts`

Inherited from `optparse.OptionContainer`: `add_option`, `add_options`, `format_description`, `get_option`, `has_option`, `remove_option`, `set_conflict_handler`, `set_description`

Inherited from `optparse.OptionContainer` (private): `_check_conflict`, `_create_option_mappings`, `_share_option_mappings`

Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]

Inherited from `optparse.OptionParser`: `standard_option_list`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, formats, usetemplates=False, usepots=False, description=None, archiveformats=None)
(Constructor)

source code

construct the specialized Option Parser

Parameters:
  - `formats` - See setformats() for an explanation of the formats parameter.
Overrides: object.__init__
  (inherited documentation)

### isrecursive(self, fileoption, filepurpose=`'``input``'`)

source code

checks if fileoption is a recursive file

Overrides: misc.optrecurse.RecursiveOptionParser.isrecursive

### recurseinputfiles(self, options)

source code

recurse through archive file / directories and return files to be converted

Overrides: misc.optrecurse.RecursiveOptionParser.recurseinputfiles

### openinputfile(self, options, fullinputpath)

source code

opens the input file

Overrides: misc.optrecurse.RecursiveOptionParser.openinputfile

### getfullinputpath(self, options, inputpath)

source code

gets the absolute path to an input file

Overrides: misc.optrecurse.RecursiveOptionParser.getfullinputpath

### opentemplatefile(self, options, fulltemplatepath)

source code

opens the template file (if required)

Overrides: misc.optrecurse.RecursiveOptionParser.opentemplatefile

### getfulltemplatepath(self, options, templatepath)

source code

gets the absolute path to a template file

Overrides: misc.optrecurse.RecursiveOptionParser.getfulltemplatepath

### templateexists(self, options, templatepath)

source code

returns whether the given template exists...

Overrides: misc.optrecurse.RecursiveOptionParser.templateexists

### getfulloutputpath(self, options, outputpath)

source code

gets the absolute path to an output file

Overrides: misc.optrecurse.RecursiveOptionParser.getfulloutputpath

### checkoutputsubdir(self, options, subdir)

source code

checks to see if subdir under options.output needs to be created, creates if neccessary

Overrides: misc.optrecurse.RecursiveOptionParser.checkoutputsubdir

### openoutputfile(self, options, fulloutputpath)

source code

opens the output file

Overrides: misc.optrecurse.RecursiveOptionParser.openoutputfile

### recursiveprocess(self, options)

source code

recurse through directories and convert files

Overrides: misc.optrecurse.RecursiveOptionParser.recursiveprocess

### processfile(self, fileprocessor, options, fullinputpath, fulloutputpath, fulltemplatepath)

source code

run an invidividual conversion

Overrides: misc.optrecurse.RecursiveOptionParser.processfile