All Samples(465) | Call(456) | Derive(0) | Import(9)
count(s, sub[, start[,end]]) -> int Return the number of occurrences of substring sub in string s[start:end]. Optional arguments start and end are interpreted as in slice notation.
def count(s, *args):
"""count(s, sub[, start[,end]]) -> int
Return the number of occurrences of substring sub in string
s[start:end]. Optional arguments start and end are
interpreted as in slice notation.
"""
return s.count(*args)
# With thanks to Adam from IndexData and Mike Taylor for their valuable input from shlex import shlex from string import split, replace, find, lower, count, join from xml.sax.saxutils import escape from xml.dom.minidom import Node, parseString from SRWDiagnostics import *
def convertMetachars(self, t):
"Convert SRW meta characters in to Cheshire's meta characters"
# Fail on ?, ^ or * not at the end.
if (count(t, "?") != count(t, "\\?")):
diag = Diagnostic28()
diag.details = "? Unsupported"
raise diag
elif (count(t, "^") != count(t, "\\^")):
diag = Diagnostic31()
diag.details = "^ Unsupported"
raise diag
elif (count(t, "*") != count(t, "\\*")):
src/d/o/dominic-HEAD/dominic/yapps2/yappsrt.py dominic(Download)
# Yapps 2.0 Runtime # # This module is needed to run generated parsers. from string import join, count, find, rfind import re
def print_error(input, err, scanner):
"""This is a really dumb long function to print error messages nicely."""
p = err.pos
# Figure out the line number
line = count(input[:p], '\n')
print err.msg+" on line "+repr(line+1)+":"
# Now try printing part of the line
try:
print_error(input, s, parser._scanner)
except ImportError:
print 'Syntax Error',s.msg,'on line',1+count(input[:s.pos], '\n')
except NoMoreTokens:
print 'Could not complete parsing; stopped around here:'
print parser._scanner
src/d/o/dominic-HEAD/dominic/xpath/yappsrt.py dominic(Download)
# Yapps 2.0 Runtime # # This module is needed to run generated parsers. from string import join, count, find, rfind import re
def print_error(input, err, scanner):
"""This is a really dumb long function to print error messages nicely."""
p = err.pos
# Figure out the line number
line = count(input[:p], '\n')
print err.msg+" on line "+repr(line+1)+":"
# Now try printing part of the line
try:
print_error(input, s, parser._scanner)
except ImportError:
print 'Syntax Error',s.msg,'on line',1+count(input[:s.pos], '\n')
except NoMoreTokens:
print 'Could not complete parsing; stopped around here:'
print parser._scanner
src/e/n/ensuite-HEAD/yencap/yapps2lc/yappsrt.py ensuite(Download)
# Yapps 2.0 Runtime # # This module is needed to run generated parsers. from string import join, count, find, rfind import re
def print_error(input, err, scanner):
"""This is a really dumb long function to print error messages nicely."""
p = err.pos
# Figure out the line number
line = count(input[:p], '\n')
print err.msg+" on line "+repr(line+1)+":"
# Now try printing part of the line
try:
print_error(input, s, parser._scanner)
except ImportError:
print 'Syntax Error',s.msg,'on line',1+count(input[:s.pos], '\n')
except NoMoreTokens:
print 'Could not complete parsing; stopped around here:'
print parser._scanner
src/r/2/r2d3-HEAD/r2d3_fwd_inv_gui.py r2d3(Download)
# Yapps 2.0 Runtime # # This module is needed to run generated parsers. from string import join, count, find, rfind import re class SyntaxError(Exception):
def print_error(input, err, scanner):
"""This is a really dumb long function to print error messages nicely."""
p = err.pos
# Figure out the line number
line = count(input[:p], '\n')
print err.msg+" on line "+repr(line+1)+":"
# Now try printing part of the line
try:
print_error(input, s, parser._scanner)
except ImportError:
print 'Syntax Error',s.msg,'on line',1+count(input[:s.pos], '\n')
except NoMoreTokens:
print 'Could not complete parsing; stopped around here:'
print parser._scanner
src/b/o/boni-asm-HEAD/yappsrt.py boni-asm(Download)
# Yapps 2.0 Runtime # # This module is needed to run generated parsers. from string import join, count, find, rfind import re
def print_error(input, err, scanner):
"""This is a really dumb long function to print error messages nicely."""
p = err.pos
# Figure out the line number
line = count(input[:p], '\n')
print err.msg+" on line "+repr(line+1)+":"
# Now try printing part of the line
try:
print_error(input, s, parser._scanner)
except ImportError:
print 'Syntax Error',s.msg,'on line',1+count(input[:s.pos], '\n')
except NoMoreTokens:
print 'Could not complete parsing; stopped around here:'
print parser._scanner
src/d/j/djangorestmodel-HEAD/xpath/yappsrt.py djangorestmodel(Download)
# Yapps 2.0 Runtime # # This module is needed to run generated parsers. from string import join, count, find, rfind import re
def print_error(input, err, scanner):
"""This is a really dumb long function to print error messages nicely."""
p = err.pos
# Figure out the line number
line = count(input[:p], '\n')
print err.msg+" on line "+repr(line+1)+":"
# Now try printing part of the line
try:
print_error(input, s, parser._scanner)
except ImportError:
print 'Syntax Error',s.msg,'on line',1+count(input[:s.pos], '\n')
except NoMoreTokens:
print 'Could not complete parsing; stopped around here:'
print parser._scanner
src/p/y/python-websocket-signal-HEAD/websocket.py python-websocket-signal(Download)
from urllib2 import urlopen from SocketServer import TCPServer, ThreadingMixIn, BaseRequestHandler from sys import argv from string import count, rjust from hashlib import md5 class ThreadingTCPServer(ThreadingMixIn, TCPServer):
def sec_websocket_key_decode(s):
number = int(''.join([x for x in s if x in '0123456789']))
spaces = count(s, ' ')
return number_to_bytes(int(number/spaces))
def websocket_msg(s):
return '\x00' + s + '\xff'
src/a/d/Adytum-PyMonitor-1.0.5/lib/os/processes.py Adytum-PyMonitor(Download)
def matchProcess(self, match_list=None):
from string import count
counts = []
if not match_list:
match_list = self.match_list
if not self.process_list:
self.getProcessList()