Package translate :: Package storage :: Module poparser
[hide private]
[frames] | no frames]

Module poparser

source code

Classes [hide private]
  ParseState
Functions [hide private]
bool
isspace(S)
Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
source code
int
find(S, sub, start=... , end=...)
Return the lowest index in S where substring sub is found, such that sub is contained within s[start:end].
source code
int
rfind(S, sub, start=... , end=...)
Return the highest index in S where substring sub is found, such that sub is contained within s[start:end].
source code
bool
startswith(S, prefix, start=..., end=...)
Return True if S starts with the specified prefix, False otherwise.
source code
 
append(L, object)
append object to end
source code
object
decode(S, encoding=..., errors=...)
Decodes S using the codec registered for encoding.
source code
 
read_prevmsgid_lines(parse_state)
Read all the lines belonging starting with #|.
source code
 
parse_prev_msgctxt(parse_state, unit) source code
 
parse_prev_msgid(parse_state, unit) source code
 
parse_prev_msgid_plural(parse_state, unit) source code
 
parse_comment(parse_state, unit) source code
 
parse_comments(parse_state, unit) source code
 
read_obsolete_lines(parse_state)
Read all the lines belonging to the current unit if obsolete.
source code
 
parse_obsolete(parse_state, unit) source code
 
parse_quoted(parse_state, start_pos=0) source code
 
parse_msg_comment(parse_state, msg_comment_list, string) source code
 
parse_multiple_quoted(parse_state, msg_list, msg_comment_list, first_start_pos=0) source code
 
parse_message(parse_state, start_of_string, start_of_string_len, msg_list, msg_comment_list=None) source code
 
parse_msgctxt(parse_state, unit) source code
 
parse_msgid(parse_state, unit) source code
 
parse_msgstr(parse_state, unit) source code
 
parse_msgid_plural(parse_state, unit) source code
 
add_to_dict(msgstr_dict, line, right_bracket_pos, entry) source code
 
get_entry(parse_state, right_bracket_pos) source code
 
parse_msgstr_array_entry(parse_state, msgstr_dict) source code
 
parse_msgstr_array(parse_state, unit) source code
 
parse_plural(parse_state, unit) source code
 
parse_msg_entries(parse_state, unit) source code
 
parse_unit(parse_state, unit=None) source code
 
set_encoding(parse_state, store, unit) source code
 
decode_list(lst, decode) source code
 
decode_header(unit, decode) source code
 
parse_header(parse_state, store) source code
 
parse_units(parse_state, store) source code
Variables [hide private]
  MSGSTR_ARRAY_ENTRY_LEN = 7

Imports: re


Function Details [hide private]

find(S, sub, start=... , end=...)

source code 

Return the lowest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

Returns: int

rfind(S, sub, start=... , end=...)

source code 

Return the highest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

Returns: int

startswith(S, prefix, start=..., end=...)

source code 

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

Returns: bool

decode(S, encoding=..., errors=...)

source code 

Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a UnicodeDecodeError. Other possible values are 'ignore' and 'replace' as well as any other name registerd with codecs.register_error that is able to handle UnicodeDecodeErrors.

Returns: object

read_prevmsgid_lines(parse_state)

source code 

Read all the lines belonging starting with #|. These lines contain the previous msgid and msgctxt info. We strip away the leading '#| ' and read until we stop seeing #|.