Package pdi :: Module parser
[show private | hide private]
[frames | no frames]

Module pdi.parser

Python-PDI - Library for Personal Data Interchange. Copyright (C) 2002-2003 Peter Gebauer

Provides with nice wrapper functions for parsing from files, strings and list of strings.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Function Summary
pdi.core.Component fromFile(fileName, inObject, bufferSize)
Opens a file and parses it line by line.
pdi.core.Component fromString(data, inObject, crlf)
Splits a string on CRLF's and parses them.
pdi.core.Component fromStrings(list, inObject)
Itterates over a list of strings and parses them.

Variable Summary
str CRLF
int RULE_MAY
int RULE_MUST
int RULE_NOT
int RULE_RECOMMENDED

Function Details

fromFile(fileName, inObject, bufferSize=4096)

Opens a file and parses it line by line. If nothing unexpected happens the inObject will be populated and returned.
Parameters:
fileName - The name of the file to read from.
inObject - An instance of a pdi.core.Component to populate.
bufferSize - The read buffer and maximum size per line. Default is 4k.
Returns:
The same instance of pdi.core.Component passed in as the second argument, only populated.
           (type=pdi.core.Component)

fromString(data, inObject, crlf='\n')

Splits a string on CRLF's and parses them. If nothing unexpected happens the inObject will be populated and returned.
Parameters:
data - A string containing the data.
           (type=string)
inObject - An instance of a pdi.core.Component.
           (type=pdi.core.Component)
crlf - Split on this substring.
           (type=string)
Returns:
The same instance of pdi.core.Component passed in as the second argument, only populated.
           (type=pdi.core.Component)

fromStrings(list, inObject)

Itterates over a list of strings and parses them. If nothing unexpected happens the inObject will be populated and returned.
Parameters:
list - A list with strings.
inObject - An instance of a pdi.core.Component to populate.
Returns:
The same instance of pdi.core.Component passed in as the second argument, only populated.
           (type=pdi.core.Component)

Variable Details

CRLF

Type:
str
Value:
'''
'''                                                                    

RULE_MAY

Type:
int
Value:
20                                                                     

RULE_MUST

Type:
int
Value:
10                                                                     

RULE_NOT

Type:
int
Value:
40                                                                     

RULE_RECOMMENDED

Type:
int
Value:
30                                                                     

Generated by Epydoc 1.1 on Sun Nov 24 14:33:25 2002 http://epydoc.sf.net