Home | Trees | Index | Help |
|
---|
Package pywikipedia :: Module date |
|
Classes | |
---|---|
FormatDate |
Function Summary | |
---|---|
dec0(i)
| |
dec1(i)
| |
This function helps in year parsing. | |
decoding helper for a single integer value, no conversion, round to decimals (used in decades) | |
decoding helper for a single integer value, no conversion, no rounding (used in centuries, milleniums) | |
decoding helper for a single roman number (used in centuries, milleniums) | |
Converts a string pattern into a regex expression. | |
formatYear(lang,
year)
| |
Returns (dictName,value), where value can be a year, date, etc, and dictName is 'yearsBC','december',etc. | |
noConv(i)
| |
singleVal(v)
| |
This is a test function, to be used interactivelly to test all year maps at once... | |
This is a test function, to be used interactivelly to test the validity of the above maps. |
re
,
types
,
pywikipedia.wikipedia
dateFormats
,
days_in_month
,
maxyearBC
,
monthNames
,
romanNums
Function Details |
---|
dh(value, pattern, encf, decf)This function helps in year parsing. Usually it will be used as a lambda call in a map: lambda val: dh( val, u'pattern string', encodingFunc, decodingFunc ) encodingFunc converts from an integer parameter to a single number or a tuple parameter that can be passed as format argument to the pattern: pattern % encodingFunc(year) decodingFunc converts a list of positive integers found in the original value string into a year value. dh() searches creates this list based on the pattern string. dh() interprets %d as a decimal and %s as a roman numeral number. Usage scenarios: decadesAD['en'](1980) => u'1980s' decadesAD['en'](u'1980s') => 1980 decadesAD['en'](u'anything else') => raise ValueError (or some other exception?) |
dh_dec(value, pattern)decoding helper for a single integer value, no conversion, round to decimals (used in decades) |
dh_noConv(value, pattern)decoding helper for a single integer value, no conversion, no rounding (used in centuries, milleniums) |
dh_roman(value, pattern)decoding helper for a single roman number (used in centuries, milleniums) |
escapePattern(pattern)Converts a string pattern into a regex expression. Substitutes %d with (\d+), and %s with ([IVX]+). Returns a compiled regex object |
getDictionaryYear(lang, linkname)Returns (dictName,value), where value can be a year, date, etc, and dictName is 'yearsBC','december',etc. |
testAll()This is a test function, to be used interactivelly to test all year maps at once Usage example: run python interpreter >>> import date >>> date.testAll() |
testYearMap(m, year, testYear)This is a test function, to be used interactivelly to test the validity of the above maps. To test, run this function with the map name, year to be tested, and the final year expected. Usage example: run python interpreter >>> import date >>> date.testYearMap( 'decadesAD', 1992, 1990 ) >>> date.testYearMap( 'centuriesAD', 20, 20 ) |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sun Jul 03 17:07:36 2005 | http://epydoc.sf.net |