Pārlūkot izejas kodu

bugfixes and docs

master
Ivan "KaiSD" Korystin pirms 10 gadiem
vecāks
revīzija
1410b492e4
7 mainītis faili ar 512 papildinājumiem un 11 dzēšanām
  1. +1
    -1
      atgcsv.py
  2. +9
    -10
      att/atg.py
  3. +62
    -0
      docs/att.atg.html
  4. +83
    -0
      docs/att.atr.html
  5. +170
    -0
      docs/att.data.html
  6. +25
    -0
      docs/att.html
  7. +162
    -0
      docs/att.template.html

+ 1
- 1
atgcsv.py Parādīt failu

@@ -12,7 +12,7 @@ License: GPLv3
'''
from sys import argv
from os.path import split
from ktt import ATG, CSVData, TemplateV2
from att import ATG, CSVData, TemplateV2

if __name__ == '__main__':
if len(argv) == 3:


+ 9
- 10
att/atg.py Parādīt failu

@@ -30,15 +30,14 @@ class ATG(object):
else:
self.multiple = False
def join_filename(self, path, name, extension):
'''
Returns a file name for given path, name and extension.
'''
if extension:
return join(unicode(path),name+'.'+extension)
else:
return join(unicode(path),name)
def join_filename(self, path, name, extension):
'''
Returns a file name for given path, name and extension.
'''
if extension:
return join(unicode(path),name+'.'+extension)
else:
return join(unicode(path),name)
def write_files(self, outputDir='.'):
'''
@@ -72,7 +71,7 @@ class ATG(object):
newpath = join(newpath, i)
if not exists(join(unicode(outputDir),newpath)):
makedirs(join(unicode(outputDir),newpath))
fname = self.join_filename(outputDir, name, extension)
fname = self.join_filename(outputDir, name, extension)
f = open(fname, 'w')
f.write(out.encode(encoding))
self.log(' Saved %s' % fname)


+ 62
- 0
docs/att.atg.html Parādīt failu

@@ -0,0 +1,62 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module att.atg</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="att.html"><font color="#ffffff">att</font></a>.atg</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/workbench/projects/att/att/atg.py">c:\workbench\projects\att\att\atg.py</a></font></td></tr></table>
<p><tt>Automatic&nbsp;Text&nbsp;Generator&nbsp;module&nbsp;for&nbsp;a&nbsp;Automatic&nbsp;Text&nbsp;Tools.<br>
&nbsp;<br>
(c)&nbsp;2013&nbsp;Ivan&nbsp;"Kai&nbsp;SD"&nbsp;Korystin&nbsp;<br>
&nbsp;<br>
License:&nbsp;GPLv3</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="att.atg.html#ATG">ATG</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="ATG">class <strong>ATG</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Automatic&nbsp;Text&nbsp;Generator&nbsp;is&nbsp;a&nbsp;class,&nbsp;created&nbsp;to&nbsp;generate&nbsp;multiple<br>
text&nbsp;files&nbsp;from&nbsp;table&nbsp;data.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ATG-__init__"><strong>__init__</strong></a>(self, data, template)</dt><dd><tt>Constructor.<br>
data&nbsp;-&nbsp;an&nbsp;instance&nbsp;of&nbsp;the&nbsp;data.Data&nbsp;class&nbsp;(i.e.&nbsp;CSVData)<br>
template&nbsp;-&nbsp;an&nbsp;instance&nbsp;of&nbsp;the&nbsp;template.Template&nbsp;class&nbsp;(i.e.&nbsp;TemplateV2)</tt></dd></dl>

<dl><dt><a name="ATG-join_filename"><strong>join_filename</strong></a>(self, path, name, extension)</dt><dd><tt>Returns&nbsp;a&nbsp;file&nbsp;name&nbsp;for&nbsp;given&nbsp;path,&nbsp;name&nbsp;and&nbsp;extension.</tt></dd></dl>

<dl><dt><a name="ATG-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>

<dl><dt><a name="ATG-write_files"><strong>write_files</strong></a>(self, outputDir<font color="#909090">='.'</font>)</dt><dd><tt>Write&nbsp;generated&nbsp;files&nbsp;to&nbsp;the&nbsp;given&nbsp;directory.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table>
</body></html>

+ 83
- 0
docs/att.atr.html Parādīt failu

@@ -0,0 +1,83 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module att.atr</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="att.html"><font color="#ffffff">att</font></a>.atr</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/workbench/projects/att/att/atr.py">c:\workbench\projects\att\att\atr.py</a></font></td></tr></table>
<p><tt>Automatic&nbsp;Text&nbsp;Replacer&nbsp;module&nbsp;for&nbsp;a&nbsp;Automatic&nbsp;Text&nbsp;Tools.<br>
&nbsp;<br>
(c)&nbsp;2013&nbsp;Ivan&nbsp;"Kai&nbsp;SD"&nbsp;Korystin&nbsp;<br>
&nbsp;<br>
License:&nbsp;GPLv3</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="att.atr.html#ATR">ATR</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="ATR">class <strong>ATR</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Automatic&nbsp;Text&nbsp;Replacer&nbsp;-&nbsp;is&nbsp;a&nbsp;class,&nbsp;created&nbsp;to&nbsp;make&nbsp;multiple&nbsp;replacements<br>
in&nbsp;the&nbsp;content&nbsp;or&nbsp;names&nbsp;of&nbsp;text&nbsp;file.<br>
It&nbsp;can&nbsp;make&nbsp;plain&nbsp;replacements,&nbsp;or&nbsp;use&nbsp;ATG&nbsp;templates&nbsp;to&nbsp;do&nbsp;something&nbsp;more&nbsp;complex.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ATR-__init__"><strong>__init__</strong></a>(self, files)</dt><dd><tt>Constructor</tt></dd></dl>

<dl><dt><a name="ATR-clear_replacements"><strong>clear_replacements</strong></a>(self)</dt><dd><tt>Removes&nbsp;all&nbsp;replacements.</tt></dd></dl>

<dl><dt><a name="ATR-log"><strong>log</strong></a>(self, string)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>

<dl><dt><a name="ATR-plain_replace"><strong>plain_replace</strong></a>(self, pattern, string, regexp<font color="#909090">=False</font>)</dt><dd><tt>Replaces&nbsp;the&nbsp;given&nbsp;pattern&nbsp;with&nbsp;string&nbsp;in&nbsp;files.</tt></dd></dl>

<dl><dt><a name="ATR-replace_in_names"><strong>replace_in_names</strong></a>(self)</dt><dd><tt>Do&nbsp;replacement,&nbsp;but&nbsp;in&nbsp;file&nbsp;names&nbsp;instead&nbsp;of&nbsp;file&nbsp;content.&nbsp;Returns&nbsp;the&nbsp;list&nbsp;of&nbsp;new&nbsp;file&nbsp;names,<br>
you&nbsp;can&nbsp;use&nbsp;it&nbsp;with&nbsp;writeNewFiles()&nbsp;method.</tt></dd></dl>

<dl><dt><a name="ATR-templated_replace"><strong>templated_replace</strong></a>(self, pattern, template, data, keyFormat<font color="#909090">='filename'</font>, regexp<font color="#909090">=False</font>)</dt><dd><tt>Replaces&nbsp;the&nbsp;given&nbsp;pattern&nbsp;with&nbsp;data&nbsp;formated&nbsp;by&nbsp;template.<br>
Valid&nbsp;values&nbsp;for&nbsp;keyFormat:<br>
filename&nbsp;-&nbsp;take&nbsp;data&nbsp;rows&nbsp;by&nbsp;filename(path&nbsp;ignored),&nbsp;key&nbsp;value&nbsp;of&nbsp;the&nbsp;data&nbsp;row&nbsp;should&nbsp;store&nbsp;the&nbsp;filename.<br>
fullname&nbsp;-&nbsp;as&nbsp;filename,&nbsp;but&nbsp;with&nbsp;path.<br>
index&nbsp;-&nbsp;take&nbsp;data&nbsp;rows&nbsp;in&nbsp;order,&nbsp;key&nbsp;value&nbsp;of&nbsp;the&nbsp;data&nbsp;row&nbsp;should&nbsp;store&nbsp;the&nbsp;index.&nbsp;Indexes&nbsp;starts&nbsp;with&nbsp;0.<br>
If&nbsp;filename&nbsp;or&nbsp;index&nbsp;cannot&nbsp;be&nbsp;found&nbsp;in&nbsp;data&nbsp;keys,&nbsp;pattern&nbsp;will&nbsp;not&nbsp;be&nbsp;replaced.</tt></dd></dl>

<dl><dt><a name="ATR-write_in_place"><strong>write_in_place</strong></a>(self)</dt><dd><tt>Do&nbsp;replacement&nbsp;and&nbsp;save&nbsp;the&nbsp;files</tt></dd></dl>

<dl><dt><a name="ATR-write_new_files"><strong>write_new_files</strong></a>(self, outfiles)</dt><dd><tt>Do&nbsp;replacement,&nbsp;but&nbsp;save&nbsp;to&nbsp;given&nbsp;files&nbsp;instead&nbsp;of&nbsp;the&nbsp;original&nbsp;ones.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table>
</body></html>

+ 170
- 0
docs/att.data.html Parādīt failu

@@ -0,0 +1,170 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module att.data</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="att.html"><font color="#ffffff">att</font></a>.data</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/workbench/projects/att/att/data.py">c:\workbench\projects\att\att\data.py</a></font></td></tr></table>
<p><tt><a href="#Data">Data</a>&nbsp;module&nbsp;for&nbsp;a&nbsp;Automatic&nbsp;Text&nbsp;Tools.<br>
&nbsp;<br>
(c)&nbsp;2013&nbsp;Ivan&nbsp;"Kai&nbsp;SD"&nbsp;Korystin&nbsp;<br>
&nbsp;<br>
License:&nbsp;GPLv3</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="cStringIO.html">cStringIO</a><br>
</td><td width="25%" valign=top><a href="codecs.html">codecs</a><br>
</td><td width="25%" valign=top><a href="csv.html">csv</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="att.data.html#Data">Data</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="att.data.html#CSVData">CSVData</a>
</font></dt></dl>
</dd>
</dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="CSVData">class <strong>CSVData</strong></a>(<a href="att.data.html#Data">Data</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Class&nbsp;for&nbsp;reading&nbsp;CSV&nbsp;files.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="att.data.html#CSVData">CSVData</a></dd>
<dd><a href="att.data.html#Data">Data</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="CSVData-__init__"><strong>__init__</strong></a>(self, file, encoding<font color="#909090">='utf-8'</font>, delimiter<font color="#909090">=';'</font>, quotechar<font color="#909090">='"'</font>, **kwargs)</dt><dd><tt>Constructor.<br>
&nbsp;<br>
filename&nbsp;-&nbsp;CSV&nbsp;table&nbsp;filename<br>
encoding&nbsp;-&nbsp;CSV&nbsp;table&nbsp;encoding&nbsp;(default:&nbsp;utf-8)<br>
delimiter&nbsp;-&nbsp;CSV&nbsp;table&nbsp;delimiter&nbsp;(default:&nbsp;;)<br>
quotechar&nbsp;-&nbsp;CSV&nbsp;table&nbsp;quotechar&nbsp;(default:&nbsp;")</tt></dd></dl>

<dl><dt><a name="CSVData-export_csv"><strong>export_csv</strong></a>(self, filename, encoding<font color="#909090">='utf-8'</font>, delimiter<font color="#909090">=';'</font>, quotechar<font color="#909090">='"'</font>, **kwargs)</dt><dd><tt>Saves&nbsp;the&nbsp;data&nbsp;to&nbsp;CSV&nbsp;file<br>
&nbsp;<br>
filename&nbsp;-&nbsp;CSV&nbsp;table&nbsp;filename<br>
encoding&nbsp;-&nbsp;CSV&nbsp;table&nbsp;encoding&nbsp;(default:&nbsp;utf-8)<br>
delimiter&nbsp;-&nbsp;CSV&nbsp;table&nbsp;delimiter&nbsp;(default:&nbsp;;)<br>
quotechar&nbsp;-&nbsp;CSV&nbsp;table&nbsp;quotechar&nbsp;(default:&nbsp;")</tt></dd></dl>

<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>Reader</strong> = &lt;class att.data.Reader&gt;</dl>

<dl><dt><strong>Writer</strong> = &lt;class att.data.Writer&gt;</dl>

<hr>
Methods inherited from <a href="att.data.html#Data">Data</a>:<br>
<dl><dt><a name="CSVData-__getitem__"><strong>__getitem__</strong></a>(self, pair)</dt><dd><tt>Returns&nbsp;a&nbsp;value&nbsp;for&nbsp;given&nbsp;key&nbsp;and&nbsp;row.</tt></dd></dl>

<dl><dt><a name="CSVData-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>

<dl><dt><a name="CSVData-__setitem__"><strong>__setitem__</strong></a>(self, pair, value)</dt><dd><tt>Sets&nbsp;a&nbsp;value&nbsp;for&nbsp;given&nbsp;key&nbsp;and&nbsp;row.</tt></dd></dl>

<dl><dt><a name="CSVData-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>Returns&nbsp;data&nbsp;as&nbsp;string.</tt></dd></dl>

<dl><dt><a name="CSVData-add_data"><strong>add_data</strong></a>(self, other)</dt><dd><tt>Adds&nbsp;rows&nbsp;from&nbsp;another&nbsp;data&nbsp;table&nbsp;to&nbsp;this&nbsp;one.</tt></dd></dl>

<dl><dt><a name="CSVData-add_keys"><strong>add_keys</strong></a>(self, *h)</dt><dd><tt>Adds&nbsp;new&nbsp;keys&nbsp;to&nbsp;the&nbsp;data.</tt></dd></dl>

<dl><dt><a name="CSVData-add_rows"><strong>add_rows</strong></a>(self, n<font color="#909090">=1</font>)</dt><dd><tt>Adds&nbsp;some&nbsp;empty&nbsp;rows&nbsp;to&nbsp;the&nbsp;data.</tt></dd></dl>

<dl><dt><a name="CSVData-col_by_idx"><strong>col_by_idx</strong></a>(self, idx)</dt><dd><tt>Returns&nbsp;a&nbsp;column&nbsp;by&nbsp;header's&nbsp;index</tt></dd></dl>

<dl><dt><a name="CSVData-col_by_key"><strong>col_by_key</strong></a>(self, key)</dt><dd><tt>Returns&nbsp;a&nbsp;column&nbsp;by&nbsp;header's&nbsp;name</tt></dd></dl>

<dl><dt><a name="CSVData-del_row"><strong>del_row</strong></a>(self, idx)</dt><dd><tt>Removes&nbsp;giver&nbsp;row&nbsp;from&nbsp;data</tt></dd></dl>

<dl><dt><a name="CSVData-has_key"><strong>has_key</strong></a>(self, key)</dt><dd><tt>Returns&nbsp;True&nbsp;if&nbsp;given&nbsp;key&nbsp;exists&nbsp;in&nbsp;data</tt></dd></dl>

<dl><dt><a name="CSVData-row_by_idx"><strong>row_by_idx</strong></a>(self, idx)</dt><dd><tt>Returns&nbsp;a&nbsp;row&nbsp;by&nbsp;index.</tt></dd></dl>

<dl><dt><a name="CSVData-transpose"><strong>transpose</strong></a>(self, key_idx<font color="#909090">=0</font>)</dt><dd><tt>Returns&nbsp;the&nbsp;transposed&nbsp;copy&nbsp;of&nbsp;the&nbsp;data.<br>
&nbsp;<br>
key_idx&nbsp;-&nbsp;index&nbsp;of&nbsp;the&nbsp;column,&nbsp;that&nbsp;contains&nbsp;keywords&nbsp;(default:&nbsp;0)</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="att.data.html#Data">Data</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Data">class <strong>Data</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Empty&nbsp;data&nbsp;class.&nbsp;Can&nbsp;be&nbsp;used&nbsp;for&nbsp;a&nbsp;subclassing&nbsp;or&nbsp;procedural&nbsp;data&nbsp;creation.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Data-__getitem__"><strong>__getitem__</strong></a>(self, pair)</dt><dd><tt>Returns&nbsp;a&nbsp;value&nbsp;for&nbsp;given&nbsp;key&nbsp;and&nbsp;row.</tt></dd></dl>

<dl><dt><a name="Data-__init__"><strong>__init__</strong></a>(self, *args, **kwargs)</dt><dd><tt>Constructor</tt></dd></dl>

<dl><dt><a name="Data-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>

<dl><dt><a name="Data-__setitem__"><strong>__setitem__</strong></a>(self, pair, value)</dt><dd><tt>Sets&nbsp;a&nbsp;value&nbsp;for&nbsp;given&nbsp;key&nbsp;and&nbsp;row.</tt></dd></dl>

<dl><dt><a name="Data-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>Returns&nbsp;data&nbsp;as&nbsp;string.</tt></dd></dl>

<dl><dt><a name="Data-add_data"><strong>add_data</strong></a>(self, other)</dt><dd><tt>Adds&nbsp;rows&nbsp;from&nbsp;another&nbsp;data&nbsp;table&nbsp;to&nbsp;this&nbsp;one.</tt></dd></dl>

<dl><dt><a name="Data-add_keys"><strong>add_keys</strong></a>(self, *h)</dt><dd><tt>Adds&nbsp;new&nbsp;keys&nbsp;to&nbsp;the&nbsp;data.</tt></dd></dl>

<dl><dt><a name="Data-add_rows"><strong>add_rows</strong></a>(self, n<font color="#909090">=1</font>)</dt><dd><tt>Adds&nbsp;some&nbsp;empty&nbsp;rows&nbsp;to&nbsp;the&nbsp;data.</tt></dd></dl>

<dl><dt><a name="Data-col_by_idx"><strong>col_by_idx</strong></a>(self, idx)</dt><dd><tt>Returns&nbsp;a&nbsp;column&nbsp;by&nbsp;header's&nbsp;index</tt></dd></dl>

<dl><dt><a name="Data-col_by_key"><strong>col_by_key</strong></a>(self, key)</dt><dd><tt>Returns&nbsp;a&nbsp;column&nbsp;by&nbsp;header's&nbsp;name</tt></dd></dl>

<dl><dt><a name="Data-del_row"><strong>del_row</strong></a>(self, idx)</dt><dd><tt>Removes&nbsp;giver&nbsp;row&nbsp;from&nbsp;data</tt></dd></dl>

<dl><dt><a name="Data-has_key"><strong>has_key</strong></a>(self, key)</dt><dd><tt>Returns&nbsp;True&nbsp;if&nbsp;given&nbsp;key&nbsp;exists&nbsp;in&nbsp;data</tt></dd></dl>

<dl><dt><a name="Data-row_by_idx"><strong>row_by_idx</strong></a>(self, idx)</dt><dd><tt>Returns&nbsp;a&nbsp;row&nbsp;by&nbsp;index.</tt></dd></dl>

<dl><dt><a name="Data-transpose"><strong>transpose</strong></a>(self, key_idx<font color="#909090">=0</font>)</dt><dd><tt>Returns&nbsp;the&nbsp;transposed&nbsp;copy&nbsp;of&nbsp;the&nbsp;data.<br>
&nbsp;<br>
key_idx&nbsp;-&nbsp;index&nbsp;of&nbsp;the&nbsp;column,&nbsp;that&nbsp;contains&nbsp;keywords&nbsp;(default:&nbsp;0)</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table>
</body></html>

+ 25
- 0
docs/att.html Parādīt failu

@@ -0,0 +1,25 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: package att</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>att</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/workbench/projects/att/att/__init__.py">c:\workbench\projects\att\att\__init__.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="att.atg.html">atg</a><br>
</td><td width="25%" valign=top><a href="att.atr.html">atr</a><br>
</td><td width="25%" valign=top><a href="att.data.html">data</a><br>
</td><td width="25%" valign=top><a href="att.template.html">template</a><br>
</td></tr></table></td></tr></table>
</body></html>

+ 162
- 0
docs/att.template.html Parādīt failu

@@ -0,0 +1,162 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module att.template</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="att.html"><font color="#ffffff">att</font></a>.template</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/workbench/projects/att/att/template.py">c:\workbench\projects\att\att\template.py</a></font></td></tr></table>
<p><tt><a href="#Template">Template</a>&nbsp;module&nbsp;for&nbsp;a&nbsp;Automatic&nbsp;Text&nbsp;Tools.<br>
&nbsp;<br>
(c)&nbsp;2013&nbsp;Ivan&nbsp;"Kai&nbsp;SD"&nbsp;Korystin&nbsp;<br>
&nbsp;<br>
License:&nbsp;GPLv3</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="att.template.html#Template">Template</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="att.template.html#TemplateV2">TemplateV2</a>
</font></dt></dl>
</dd>
</dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Template">class <strong>Template</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Empty&nbsp;template&nbsp;class.&nbsp;Generates&nbsp;empty&nbsp;text.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Template-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>

<dl><dt><a name="Template-process"><strong>process</strong></a>(self, data)</dt><dd><tt>Replace&nbsp;this&nbsp;method&nbsp;in&nbsp;subclasses.</tt></dd></dl>

<dl><dt><a name="Template-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints&nbsp;a&nbsp;warning</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="TemplateV2">class <strong>TemplateV2</strong></a>(<a href="att.template.html#Template">Template</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Class&nbsp;for&nbsp;reading&nbsp;ATGv2&nbsp;templates.<br>
&nbsp;<br>
ATGv2&nbsp;template&nbsp;file&nbsp;should&nbsp;be&nbsp;a&nbsp;plain&nbsp;text&nbsp;file,&nbsp;starting&nbsp;with&nbsp;the&nbsp;line<br>
ATGV2<br>
followed&nbsp;by&nbsp;the&nbsp;info&nbsp;line:<br>
[$KeyField$Extension$Prefix$Encoding$]<br>
where<br>
KeyField&nbsp;-&nbsp;is&nbsp;a&nbsp;name&nbsp;of&nbsp;a&nbsp;data&nbsp;column,&nbsp;that&nbsp;contains&nbsp;an&nbsp;identifier.<br>
Extension&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;extension&nbsp;for&nbsp;the&nbsp;generated&nbsp;files.<br>
Prefix&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;filename&nbsp;prefix&nbsp;for&nbsp;the&nbsp;generated&nbsp;files<br>
Encoding&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;encoding&nbsp;for&nbsp;the&nbsp;generated&nbsp;files.<br>
The&nbsp;line&nbsp;may&nbsp;also&nbsp;have&nbsp;some&nbsp;optional&nbsp;keywords&nbsp;before&nbsp;the&nbsp;closing&nbsp;bracket:<br>
oneFile$&nbsp;-&nbsp;place&nbsp;all&nbsp;generated&nbsp;text&nbsp;into&nbsp;a&nbsp;single&nbsp;file&nbsp;instead&nbsp;of<br>
generating&nbsp;a&nbsp;file&nbsp;for&nbsp;each&nbsp;table&nbsp;row.<br>
After&nbsp;the&nbsp;info&nbsp;line,&nbsp;you&nbsp;can&nbsp;put&nbsp;your&nbsp;text.<br>
You&nbsp;can&nbsp;use&nbsp;following&nbsp;commands&nbsp;to&nbsp;handle&nbsp;the&nbsp;data:<br>
*&nbsp;[$Name$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;the&nbsp;column&nbsp;header,<br>
will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;value&nbsp;from&nbsp;the&nbsp;current&nbsp;row.<br>
*&nbsp;[$ATGLINDEX$]&nbsp;will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;number&nbsp;of&nbsp;a&nbsp;current&nbsp;row.<br>
*&nbsp;[$ATGHEADER$Text$]&nbsp;and&nbsp;[$ATGFOOTER$Text$]&nbsp;will&nbsp;place&nbsp;the&nbsp;given&nbsp;text<br>
at&nbsp;the&nbsp;begining&nbsp;or&nbsp;at&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;file.&nbsp;You&nbsp;can't&nbsp;use&nbsp;other<br>
commands&nbsp;in&nbsp;this&nbsp;text.<br>
*&nbsp;[$ATGLIST$Name$Text$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;a&nbsp;multi-column&nbsp;header<br>
(i.e.&nbsp;'Col'&nbsp;will&nbsp;represent&nbsp;'Col1',&nbsp;'Col2',&nbsp;'Col3'&nbsp;etc)<br>
will&nbsp;repeat&nbsp;the&nbsp;given&nbsp;text&nbsp;for&nbsp;each&nbsp;non-empty&nbsp;value.<br>
You&nbsp;can&nbsp;use&nbsp;other&nbsp;commands&nbsp;in&nbsp;Text.&nbsp;Also&nbsp;[$Name$]&nbsp;inside&nbsp;the&nbsp;list<br>
will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;value&nbsp;for&nbsp;the&nbsp;current&nbsp;row&nbsp;and&nbsp;column.<br>
*&nbsp;[$ATGLINDEX$]&nbsp;can&nbsp;be&nbsp;used&nbsp;only&nbsp;inside&nbsp;the&nbsp;ATGLIST&nbsp;text,<br>
will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;current&nbsp;column&nbsp;index.<br>
*&nbsp;[$ATGLISTCUT$Name$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGLIST,&nbsp;but&nbsp;the&nbsp;last&nbsp;symbol<br>
will&nbsp;be&nbsp;removed.&nbsp;Useful&nbsp;for&nbsp;removing&nbsp;unnecessary&nbsp;newlines.<br>
*&nbsp;[$ATGIF$Name$Value$Text$]&nbsp;will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;given&nbsp;text<br>
only&nbsp;if&nbsp;the&nbsp;the&nbsp;given&nbsp;column's&nbsp;value&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;given&nbsp;one.<br>
Will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;empty&nbsp;text&nbsp;otherwise.&nbsp;You&nbsp;can&nbsp;use&nbsp;other<br>
commands&nbsp;in&nbsp;Text.<br>
*&nbsp;[$ATGIFNOT$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGIF,&nbsp;but&nbsp;the&nbsp;column's&nbsp;value<br>
should&nbsp;not&nbsp;be&nbsp;equal&nbsp;to&nbsp;the&nbsp;given&nbsp;one.<br>
*&nbsp;[$ATGGREATER$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGIF,&nbsp;but&nbsp;the&nbsp;value&nbsp;should<br>
be&nbsp;the&nbsp;number&nbsp;and&nbsp;it&nbsp;should&nbsp;be&nbsp;greater&nbsp;then&nbsp;the&nbsp;given&nbsp;one.<br>
*&nbsp;[$ATGGREATER$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGGREATER,&nbsp;but&nbsp;the&nbsp;value<br>
should&nbsp;be&nbsp;less&nbsp;then&nbsp;the&nbsp;given&nbsp;one.<br>
*&nbsp;[$ATGREPLACE$Text1$Text2$]&nbsp;-&nbsp;Will&nbsp;replace&nbsp;Text1&nbsp;with&nbsp;Text2.&nbsp;Replacements<br>
will&nbsp;be&nbsp;done&nbsp;after&nbsp;all&nbsp;other&nbsp;commands.&nbsp;You&nbsp;can't&nbsp;use&nbsp;regular&nbsp;expressions&nbsp;or<br>
other&nbsp;commands&nbsp;in&nbsp;the&nbsp;text.<br>
*&nbsp;[$ATGPREFIX$Text$]&nbsp;-&nbsp;Will&nbsp;add&nbsp;the&nbsp;given&nbsp;text&nbsp;to&nbsp;the&nbsp;filename&nbsp;prefix.<br>
You&nbsp;can&nbsp;use&nbsp;other&nbsp;commands&nbsp;in&nbsp;text,&nbsp;but&nbsp;do&nbsp;it&nbsp;carefully.<br>
*&nbsp;[$ATGSKIP$]&nbsp;-&nbsp;Skip&nbsp;the&nbsp;current&nbsp;row.&nbsp;Use&nbsp;only&nbsp;in&nbsp;combination&nbsp;with&nbsp;the<br>
ATGIF/ATGIFNOT,&nbsp;or&nbsp;you&nbsp;will&nbsp;generate&nbsp;nothing.<br>
*&nbsp;[$ATGPREV$Name$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;the&nbsp;column&nbsp;header,<br>
will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;with&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;given&nbsp;header&nbsp;from&nbsp;the<br>
previous&nbsp;row.&nbsp;ATGSKIP&nbsp;will&nbsp;be&nbsp;used&nbsp;for&nbsp;the&nbsp;first&nbsp;row.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="att.template.html#TemplateV2">TemplateV2</a></dd>
<dd><a href="att.template.html#Template">Template</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="TemplateV2-__init__"><strong>__init__</strong></a>(self, filename<font color="#909090">=None</font>, encoding<font color="#909090">='utf-8'</font>, text<font color="#909090">=''</font>)</dt><dd><tt>Constructor.<br>
&nbsp;<br>
filename&nbsp;-&nbsp;name&nbsp;of&nbsp;the&nbsp;ATGv2&nbsp;template&nbsp;file.<br>
encoding&nbsp;-&nbsp;encoding&nbsp;of&nbsp;the&nbsp;template&nbsp;file.<br>
text&nbsp;-&nbsp;text&nbsp;to&nbsp;use&nbsp;if&nbsp;no&nbsp;filename&nbsp;has&nbsp;been&nbsp;provided.</tt></dd></dl>

<dl><dt><a name="TemplateV2-process"><strong>process</strong></a>(self, data)</dt><dd><tt>Generate&nbsp;text&nbsp;for&nbsp;the&nbsp;given&nbsp;data.</tt></dd></dl>

<hr>
Static methods defined here:<br>
<dl><dt><a name="TemplateV2-express"><strong>express</strong></a>(cls, text, **kwargs)</dt></dl>

<hr>
Methods inherited from <a href="att.template.html#Template">Template</a>:<br>
<dl><dt><a name="TemplateV2-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>

<dl><dt><a name="TemplateV2-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints&nbsp;a&nbsp;warning</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="att.template.html#Template">Template</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table>
</body></html>