All Samples(47) | Call(0) | Derive(0) | Import(47)
int(x[, base]) -> integer Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If base is zero, the proper base is guessed based on the string content. If the argument is outside the integer range a long object will be returned instead.
src/i/n/inflect-0.2.1/inflect.py inflect(Download)
''' from re import match, search, subn, IGNORECASE, VERBOSE from re import split as splitre from re import error as reerror from re import sub as resub
def ud_match(self, word, wordlist):
for i in range(len(wordlist)-2, -2, -2): # backwards through even elements
mo = search(r'^%s$' % wordlist[i], word, IGNORECASE)
if mo:
if wordlist[i+1] is None:
return None
pl = resub(r'\$(\d+)',r'\\1',wordlist[i+1]) # change $n to \n for expand
# HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
mo = search(r"^(?:%s)$" % pl_sb_postfix_adj_stems, word, IGNORECASE)
if mo and mo.group(2) != '':
return "%s%s" % (self._plnoun(mo.group(1), 2), mo.group(2))
if ' a ' in lowerword or '-a-' in lowerword:
mo = search(r"^(?:%s)$" % pl_sb_prep_dual_compound, word, IGNORECASE)
return lowerword[:-2]
mo = search(r"^(.*[^s])s$",
word, IGNORECASE)
if mo:
return mo.group(1)
# HANDLE AMBIGUOUS PRESENT TENSES (SIMPLE AND COMPOUND)
mo = search(r"^(%s)((\s.*)?)$" % plverb_ambiguous_pres_keys,
word, IGNORECASE)
if mo:
return "%s%s" % (plverb_ambiguous_pres[mo.group(1).lower()],
mo.group(2))
# HANDLE AMBIGUOUS PRETERITE AND PERFECT TENSES
mo = search(r"^(%s)((\s.*)?)$" % plverb_ambiguous_non_pres,
word, IGNORECASE)
# HANDLE KNOWN CASES
mo = search(r"^(%s)$" % pl_adj_special_keys,
word, IGNORECASE)
if mo:
return "%s" % (pl_adj_special[mo.group(1).lower()])
# HANDLE POSSESSIVES
mo = search(r"^(%s)$" % pl_adj_poss_keys,
word, IGNORECASE)
return word
# HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
mo = search(r"^(?:%s)$" % pl_sb_postfix_adj_stems, word, IGNORECASE)
if mo and mo.group(2) != '':
return "%s%s" % (self._sinoun(mo.group(1), 1, gender=gender), mo.group(2))
'''
mo = search(r"\A(\s*)(?:an?\s+)?(.+?)(\s*)\Z",
text, IGNORECASE)
if mo:
word = mo.group(2)
if not word:
(r"^(%s)" % A_ordinal_a, "a"),
(r"^(%s)" % A_ordinal_an, "an"),
):
mo = search(a[0], word, IGNORECASE)
if mo:
return "%s %s" % (a[1], word)
(r"^[aefhilmnorsx]$", "an"),
(r"^[bcdgjkpqtuvwyz]$", "a"),
):
mo = search(a[0], word, IGNORECASE)
if mo:
return "%s %s" % (a[1], word)
# HANDLE ABBREVIATIONS
for a in (
(r"(%s)" % A_abbrev, "an", VERBOSE),
(r"^[aefhilmnorsx][.-]", "an", IGNORECASE),
(r"^[a-z][.-]", "a", IGNORECASE),
# HANDLE CONSONANTS
mo = search(r"^[^aeiouy]", word, IGNORECASE)
if mo:
return "a %s" % word
(r"^uni([^nmd]|mo)", "a"),
(r"^u[bcfhjkqrst][aeiou]", "a"),
):
mo = search(a[0], word, IGNORECASE)
if mo:
return "%s %s" % (a[1], word)
# HANDLE VOWELS
mo = search(r"^[aeiou]", word, IGNORECASE)
if mo:
return "an %s" % word
# HANDLE y... (BEFORE CERTAIN CONSONANTS IMPLIES (UNNATURALIZED) "i.." SOUND)
mo = search(r"^(%s)" % A_y_cons, word, IGNORECASE)
src/p/y/pypy3-HEAD/lib-python/3.1.2/_strptime.py pypy3(Download)
import locale import calendar from re import compile as re_compile from re import IGNORECASE, ASCII from re import escape as re_escape from datetime import date as datetime_date try:
def compile(self, format):
"""Return a compiled re object for the format string."""
return re_compile(self.pattern(format), IGNORECASE)
_cache_lock = _thread_allocate_lock()
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock
# first!
src/t/a/tablib-HEAD/tablib/packages/xlwt/ExcelFormulaLexer.py tablib(Download)
# -*- coding: windows-1252 -*- import sys from antlr import EOF, CommonToken as Tok, TokenStream, TokenStreamException import struct import ExcelFormulaParser from re import compile as recompile, match, LOCALE, UNICODE, IGNORECASE, VERBOSE
_re = recompile(
'(' + ')|('.join([i[0] for i in pattern_type_tuples]) + ')',
VERBOSE+LOCALE+IGNORECASE)
_toktype = [None] + [i[1] for i in pattern_type_tuples]
# need dummy at start because re.MatchObject.lastindex counts from 1
src/p/y/pyexcelerator-HEAD/trunk/pyExcelerator/ExcelFormulaLexer.py pyexcelerator(Download)
from antlr import EOF, CommonToken as Tok, TokenStream, TokenStreamException import struct import ExcelFormulaParser from re import compile as recompile, match, LOCALE, UNICODE, IGNORECASE int_const_pattern = recompile(r"\d+") flt_const_pattern = recompile(r"\d*\.\d+(?:[Ee][+-]?\d+)?") str_const_pattern = recompile(r'["][^"]*["]') #range2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+:\$?[A-I]?[A-Z]\$?\d+") ref2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+") true_pattern = recompile(r"TRUE", IGNORECASE) false_pattern = recompile(r"FALSE", IGNORECASE)
src/p/y/pyexcelerator-HEAD/pyExcelerator/ExcelFormulaLexer.py pyexcelerator(Download)
from antlr import EOF, CommonToken as Tok, TokenStream, TokenStreamException import struct import ExcelFormulaParser from re import compile as recompile, match, LOCALE, UNICODE, IGNORECASE int_const_pattern = recompile(r"\d+") flt_const_pattern = recompile(r"\d*\.\d+(?:[Ee][+-]?\d+)?") str_const_pattern = recompile(r'["][^"]*["]') #range2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+:\$?[A-I]?[A-Z]\$?\d+") ref2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+") true_pattern = recompile(r"TRUE", IGNORECASE) false_pattern = recompile(r"FALSE", IGNORECASE)
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/_strptime.py ironruby(Download)
import locale import calendar from re import compile as re_compile from re import IGNORECASE from re import escape as re_escape from datetime import date as datetime_date try:
def compile(self, format):
"""Return a compiled re object for the format string."""
return re_compile(self.pattern(format), IGNORECASE)
_cache_lock = _thread_allocate_lock()
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock
# first!
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/CPython/27/Lib/_strptime.py ironruby(Download)
import locale import calendar from re import compile as re_compile from re import IGNORECASE from re import escape as re_escape from datetime import date as datetime_date try:
def compile(self, format):
"""Return a compiled re object for the format string."""
return re_compile(self.pattern(format), IGNORECASE)
_cache_lock = _thread_allocate_lock()
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock
# first!
src/j/y/jython-HEAD/sandbox/tobias/jython/CPythonLib/_strptime.py jython(Download)
import locale import calendar from re import compile as re_compile from re import IGNORECASE from re import escape as re_escape from datetime import date as datetime_date try:
def compile(self, format):
"""Return a compiled re object for the format string."""
return re_compile(self.pattern(format), IGNORECASE)
_cache_lock = _thread_allocate_lock()
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock
# first!
src/p/y/pyexcelerator-0-0.6.4a/pyExcelerator/ExcelFormulaLexer.py pyExcelerator(Download)
from antlr import EOF, CommonToken as Tok, TokenStream, TokenStreamException import struct import ExcelFormulaParser from re import compile as recompile, match, LOCALE, UNICODE, IGNORECASE int_const_pattern = recompile(r"\d+") flt_const_pattern = recompile(r"\d*\.\d+(?:[Ee][+-]?\d+)?") str_const_pattern = recompile(r'["][^"]*["]') #range2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+:\$?[A-I]?[A-Z]\$?\d+") ref2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+") true_pattern = recompile(r"TRUE", IGNORECASE) false_pattern = recompile(r"FALSE", IGNORECASE)
src/p/y/pyexcel-HEAD/src/ExcelFormulaLexer.py pyexcel(Download)
from antlr import EOF, CommonToken as Tok, TokenStream, TokenStreamException import struct import ExcelFormulaParser from re import compile as recompile, match, LOCALE, UNICODE, IGNORECASE int_const_pattern = recompile(r"\d+") flt_const_pattern = recompile(r"\d*\.\d+(?:[Ee][+-]?\d+)?") str_const_pattern = recompile(r'["][^"]*["]') #range2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+:\$?[A-I]?[A-Z]\$?\d+") ref2d_pattern = recompile(r"\$?[A-I]?[A-Z]\$?\d+") true_pattern = recompile(r"TRUE", IGNORECASE) false_pattern = recompile(r"FALSE", IGNORECASE)
1 | 2 | 3 | 4 | 5 Next