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/a/r/artie-HEAD/example/applications/scrape.py artie(Download)
def iregex(template, *params, **kwargs):
"""Compile a regular expression, substituting in any passed parameters
for placeholders of the form __0__, __1__, __2__, etc. in the template.
Specify the named argument 'flags' to set regular expression compilation
flags; by default, DOTALL and IGNORECASE are set."""
kwargs['flags'] = kwargs.get('flags', 0) | re.IGNORECASE
return regex(template, *params, **kwargs)
src/s/r/srsbot-HEAD/example.py srsbot(Download)
if(message.sender==bot.nickname and message.type=="JOIN"): #See if you've joined a channel
bot.privmsg(channel, "EXAMPLEBOT IS IN THE HIZZOUSE") #Send a private message to the channel
if(re.search("hey examplebot", message.body, re.IGNORECASE)): #Use a regular expression to search the message body
bot.privmsg(channel, "hey")
if(re.search("what it do, dawg\?", message.body, re.IGNORECASE)):
bot.privmsg(channel, "nothin much, man")
bot.privmsg(channel, "nothin much")
if(re.search("cool beans", message.body, re.IGNORECASE)):
src/t/w/twitstream-HEAD/examples/fixreplies.py twitstream(Download)
class Formatter(object):
url_pat = re.compile(r'\b(http://\S+[^\s\.\,\?\)\]\>])', re.IGNORECASE)
ent_pat = re.compile("&#?\w+;")
user_pat = re.compile(r'(@\w+)')
wrap = textwrap.TextWrapper(initial_indent=' ', subsequent_indent=' ')
def __init__(self, friends=[]):
self.friend_pat = re.compile('(@%s)\\b' % "|@".join(friends), re.IGNORECASE)
src/s/a/saucebrush-HEAD/examples/fec_electronic.py saucebrush(Download)
def process_file(self):
begintext = re.compile('\[BEGINTEXT\]', re.IGNORECASE)
endtext = re.compile('\[ENDTEXT\]', re.IGNORECASE)
in_textblock = False
for line in self.fecfile:
src/t/w/twitstream-HEAD/examples/textori.py twitstream(Download)
class Formatter(object):
url_pat = re.compile(r'\b(http://\S+[^\s\.\,\?\)\]\>])', re.IGNORECASE)
ent_pat = re.compile("&#?\w+;")
wrap = textwrap.TextWrapper(initial_indent=' ', subsequent_indent=' ')
def __init__(self, keywords=[]):
self.kw_pat = re.compile('\\b(%s)\\b' % "|".join(keywords), re.IGNORECASE)
src/m/o/modu-HEAD/examples/modusite/modusite/scripts/release.py modu(Download)
from modusite.model import project, release
from modu.sites import modusite_site
RE_TARBALL_VERSION = re.compile(r'^(\w+?)-((?:\d\.)+\d.*)\.tar\.gz$', re.IGNORECASE)
def get_release_request(hostname):
env = {
src/n/o/notmm-0.4.1/examples/lib/satchmo_utils/thumbnail/text.py notmm(Download)
"since", "than", "the", "this", "that", "to", "up", "via",
"with"
]
_RE_REMOVE = re.compile('\\b(' + '|'.join(_REMOVELIST) + ')\\b', re.IGNORECASE)
_RE_UNNEEDED = re.compile(r'[^\w\s-]')
return ret
# URLify
_BR_CLEANUP = re.compile(r'<\s*br\s*/?\s*>', re.IGNORECASE)
def text_cleanup(txt, clean_br=True, cleanup_double_space=True, strip_ws=True):
if txt:
src/d/i/diesel-HEAD/examples/crawler.py diesel(Download)
count = 0 files = 1 url_exp = re.compile(r'(src|href)="([^"]+)', re.MULTILINE | re.IGNORECASE) links = None def get_links(s):
src/e/d/Edwin-HEAD/scripts/msg/examples/pygtkjab.py Edwin(Download)
def __init__(self, gui):
Tab.__init__(self, gui, 'URLs')
self._id = 'URLs'
self._regexp = re.compile('(http://[^\s]+)', re.IGNORECASE)
self._scrolled_win = gtk.GtkScrolledWindow()
src/m/a/mapfish.plugin.client-0.2/mapfishpluginclient/template/+package+/public/lib/ext/Ext/examples/locale/create_languages_js.py mapfish.plugin.client(Download)
print " http://chardet.feedparser.org or apt-get install python-chardet"
sys.exit()
regexp_language = re.compile("\* +(.+) +translation", re.IGNORECASE)
js_template = """/* This file is automaticly generated by create_language_js.py */
// some data used in the examples
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next