Module cato :: Class Cato
[hide private]
[frames] | no frames]

Class Cato

source code


Instance Methods [hide private]
 
__init__(self)
Default constructor sets default values for cato options.
source code
 
parse_license(self, lic_name)
Parse a license file and split it into the full flagged license to be included into a "LICENSE" file and an embedded version to be included at the beginning of each source file.
source code
 
patch_file(self, filename, embedded_license)
Embed the license in the given source code file.
source code
 
patch_dir(self, dirname, extended_license)
Insert a license file into a directory naming it "LICENSE".
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Default constructor sets default values for cato options.

Overrides: object.__init__

parse_license(self, lic_name)

source code 

Parse a license file and split it into the full flagged license to be included into a "LICENSE" file and an embedded version to be included at the beginning of each source file. It also substitute the license tags in the license text.

Parameters:
  • lic_name (string) - license file name key
Returns:
(full_licensem, embedded_license)

patch_file(self, filename, embedded_license)

source code 

Embed the license in the given source code file. The license is inserted where the first empty line is found. If no empty line is present no license is embedded.

Parameters:
  • filename - file path
  • embedded_license - the embedded license as obtained by parse_license function
Returns:
True if a license has been embedded

patch_dir(self, dirname, extended_license)

source code 

Insert a license file into a directory naming it "LICENSE".

Parameters:
  • dirname - the target directory path
  • extended_license - the license text as obtained by parse_license function