All Samples(0) | Call(0) | Derive(0) | Import(0)
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/f/r/freebase-1.0.6/examples/freebase-images-appengine/freebase/rison.py freebase(Download)
'][^' + not_idchar + ']*')
# regexp to check for valid rison ids
id_ok_re = re.compile('^' + idrx + '$', re.M)
# regexp to find the end of an id when parsing
next_id_re = re.compile(idrx, re.M)
src/p/y/pyjamas-0.7/examples/libtest/ReModuleTest.py Pyjamas(Download)
m = r.match("ed ed", 3)
self.assertEqual(m.group(0), "ed")
r = re.compile("^a.*$", re.M)
m = r.match("a ")
self.assertEqual(m.group(0), "a ")
src/h/t/HTMLtoRST-HEAD/generate_pdf_examples/BeautifulSoup.py HTMLtoRST(Download)
NESTABLE_LIST_TAGS, NESTABLE_TABLE_TAGS)
# Used to detect the charset in a META tag; see start_meta
CHARSET_RE = re.compile("((^|;)\s*charset=)([^;]*)", re.M)
def start_meta(self, attrs):
"""Beautiful Soup can detect a charset included in a META tag,
src/b/r/braintree_python_examples-HEAD/tr_checkout_app_engine/web/template.py braintree_python_examples(Download)
def emit(self, indent, text_indent=''):
import re
rx = re.compile('^', re.M)
return rx.sub(indent, self.code).rstrip(' ')
def __repr__(self):
return "<code: %s>" % repr(self.code)
def compile_templates(root):
"""Compiles templates to python code."""
re_start = re_compile('^', re.M)
for dirpath, dirnames, filenames in os.walk(root):
filenames = [f for f in filenames if not f.startswith('.') and not f.endswith('~') and not f.startswith('__init__.py')]
src/t/r/TracShellExampleMacro-1.0/shellexample/macro.py TracShellExampleMacro(Download)
('^(?P<path>~ |~?/[^ ]+ |.:.*?\\\\|[a-zA-Z]+@[a-zA-Z]+ )?(?P<cli>[#$] |>)(?P<input>(?:[^\\\\\n\'"]+|\\\\\n|%s|%s|[\\\\\'"]){0,255})$' % (regexp_db_qstr, regexp_si_qstr)) +
'|^(?P<option_space>\s+)(?P<option>-[a-zA-Z0-9]\\b|--[^ \t\n]+)(?P<option_desc>.*)$'
'|^(?P<note>\(.*\))$'
, re.M)
regexp_string = re.compile('(?:%s|%s)' % (regexp_db_qstr, regexp_si_qstr))
def expand_macro(self, formatter, name, txt):
src/o/b/oblivionworks-HEAD/Tags/Wrye Bash/290/Mopy/bosh.py oblivionworks(Download)
null4 = null1*4 #--Header tags reGroup = re.compile(r'^Group: *(.*)',re.M) reRequires = re.compile(r'^Requires: *(.*)',re.M) reReqItem = re.compile(r'^([a-zA-Z]+) *([0-9]*\.?[0-9]*)$') reVersion = re.compile(r'^(version[:\.]*|ver[:\.]*|rev[:\.]*|r[:\.\s]+|v[:\.\s]+) *([-0-9a-zA-Z\.]*\+?)',re.M|re.I)
def buildPatch(self,log,progress,patchFile):
"""Edits patch file as desired. Will write to log."""
count = {}
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
keep = patchFile.getKeeper()
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
if record.text and not record.enchantment:
text = record.text
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
src/o/b/oblivionworks-HEAD/Tags/Wrye Bash/289/Mopy/bosh.py oblivionworks(Download)
null4 = null1*4 #--Header tags reGroup = re.compile(r'^Group: *(.*)',re.M) reRequires = re.compile(r'^Requires: *(.*)',re.M) reReqItem = re.compile(r'^([a-zA-Z]+) *([0-9]*\.?[0-9]*)$') reVersion = re.compile(r'^(version[:\.]*|ver[:\.]*|rev[:\.]*|r[:\.\s]+|v[:\.\s]+) *([-0-9a-zA-Z\.]*\+?)',re.M|re.I)
def buildPatch(self,log,progress,patchFile):
"""Edits patch file as desired. Will write to log."""
count = {}
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
keep = patchFile.getKeeper()
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
if record.text and not record.enchantment:
text = record.text
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
src/o/b/oblivionworks-HEAD/Tags/Wrye Bash/288/Mopy/bosh.py oblivionworks(Download)
null4 = null1*4 #--Header tags reGroup = re.compile(r'^Group: *(.*)',re.M) reRequires = re.compile(r'^Requires: *(.*)',re.M) reReqItem = re.compile(r'^([a-zA-Z]+) *([0-9]*\.?[0-9]*)$') reVersion = re.compile(r'^(version[:\.]*|ver[:\.]*|rev[:\.]*|r[:\.\s]+|v[:\.\s]+) *([-0-9a-zA-Z\.]*\+?)',re.M|re.I)
def buildPatch(self,log,progress,patchFile):
"""Edits patch file as desired. Will write to log."""
count = {}
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
keep = patchFile.getKeeper()
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
if record.text and not record.enchantment:
text = record.text
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
src/o/b/oblivionworks-HEAD/Programs/Wrye Bash/Mopy/bosh.py oblivionworks(Download)
null4 = null1*4 #--Header tags reGroup = re.compile(r'^Group: *(.*)',re.M) reRequires = re.compile(r'^Requires: *(.*)',re.M) reReqItem = re.compile(r'^([a-zA-Z]+) *([0-9]*\.?[0-9]*)$') reVersion = re.compile(r'^(version[:\.]*|ver[:\.]*|rev[:\.]*|r[:\.\s]+|v[:\.\s]+) *([-0-9a-zA-Z\.]*\+?)',re.M|re.I)
def buildPatch(self,log,progress,patchFile):
"""Edits patch file as desired. Will write to log."""
count = {}
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
keep = patchFile.getKeeper()
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
if record.text and not record.enchantment:
text = record.text
reColor = re.compile(r'<font color="?([a-fA-F0-9]+)"?>',re.I+re.M)
reTagInWord = re.compile(r'([a-z])<font face=1>',re.M)
reFont1 = re.compile(r'(<?<font face=1( ?color=[0-9a-zA]+)?>)+',re.I+re.M)
reDiv = re.compile(r'<div',re.I+re.M)
reFont = re.compile(r'<font',re.I+re.M)
reHead2 = re.compile(r'^(<<|\^\^|>>|)==\s*(\w[^=]+?)==\s*\r\n',re.M)
reHead3 = re.compile(r'^(<<|\^\^|>>|)===\s*(\w[^=]+?)\r\n',re.M)
reBold = re.compile(r'(__|\*\*|~~)')
reAlign = re.compile(r'^(<<|\^\^|>>)',re.M)
src/s/h/shot-o-matic-HEAD/vendor/tornado-0.2/demos/blog/markdown.py shot-o-matic(Download)
# (see _ProcessListItems() for details):
list_level = 0
_ws_only_line_re = re.compile(r"^[ \t]+$", re.M)
def __init__(self, html4tags=False, tab_width=4, safe_mode=None,
extras=None, link_patterns=None, use_file_vars=False):
self._instance_extras = self.extras.copy()
self.link_patterns = link_patterns
self.use_file_vars = use_file_vars
self._outdent_re = re.compile(r'^(\t|[ ]{1,%d})' % tab_width, re.M)
def reset(self):
self.urls = {}
# Cribbed from a post by Bart Lateur:
# <http://www.nntp.perl.org/group/perl.macperl.anyperl/154>
_detab_re = re.compile(r'(.*?)\t', re.M)
def _detab_sub(self, match):
g1 = match.group(1)
return g1 + (' ' * (self.tab_width - len(g1) % self.tab_width))
(?=\n+|\Z) # followed by a newline or end of document
)
""" % _block_tags_a,
re.X | re.M)
_block_tags_b = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math'
_liberal_tag_block_re = re.compile(r"""
(?=\n+|\Z) # followed by a newline or end of document
)
""" % _block_tags_b,
re.X | re.M)
def _hash_html_block_sub(self, match, raw=False):
html = match.group(1)
[ \t]*
)? # title is optional
(?:\n+|\Z)
""" % less_than_tab, re.X | re.M | re.U)
return _link_def_re.sub(self._extract_link_def_sub, text)
def _extract_link_def_sub(self, match):
# Lookahead for non-space at line-start, or end of doc.
(?:(?=^[ ]{0,%d}\S)|\Z)
''' % (less_than_tab, self.tab_width, self.tab_width),
re.X | re.M)
return footnote_def_re.sub(self._extract_footnote_def_sub, text)
_hr_res = [
re.compile(r"^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$", re.M),
re.compile(r"^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$", re.M),
re.compile(r"^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$", re.M),
^([ ]{0,%d})>>>[ ].*\n # first line
^(\1.*\S+.*\n)* # any number of subsequent lines
^\n # ends with a blank line
""" % less_than_tab, re.M | re.X)
return _pyshell_block_re.sub(self._pyshell_block_sub, text)
return text
_setext_h_re = re.compile(r'^(.+)[ \t]*\n(=+|-+)[ \t]*\n+', re.M)
def _setext_h_sub(self, match):
n = {"=": 1, "-": 2}[match.group(2)[0]]
demote_headers = self.extras.get("demote-headers")
(?<!\\) # ensure not an escaped trailing '#'
\#* # optional closing #'s (not counted)
\n+
''', re.X | re.M)
def _atx_h_sub(self, match):
n = len(match.group(1))
demote_headers = self.extras.get("demote-headers")
# static s/// patterns rather than one conditional pattern.
if self.list_level:
sub_list_re = re.compile("^"+whole_list, re.X | re.M | re.S)
text = sub_list_re.sub(self._list_sub, text)
else:
list_re = re.compile(r"(?:(?<=\n\n)|\A\n?)"+whole_list,
re.X | re.M | re.S)
(\n{1,2})) # eols = \5
(?= \n* (\Z | \2 (%s) [ \t]+))
''' % (_marker_any, _marker_any),
re.M | re.X | re.S)
_last_li_endswith_two_eols = False
def _list_item_sub(self, match):
)
((?=^[ ]{0,%d}\S)|\Z) # Lookahead for non-space at line-start, or end of doc
''' % (self.tab_width, self.tab_width),
re.M | re.X)
return code_block_re.sub(self._code_block_sub, text)
\n* # blanks
)+
)
''', re.M | re.X)
_bq_one_level_re = re.compile('^[ \t]*>[ \t]?', re.M);
_html_pre_block_re = re.compile(r'(\s*<pre>.+?</pre>)', re.S)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next