• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(10819)  |  Call(10671)  |  Derive(0)  |  Import(148)
Try to apply the pattern at the start of the string, returning
a match object, or None if no match was found.

        def match(pattern, string, flags=0):
    """Try to apply the pattern at the start of the string, returning
    a match object, or None if no match was found."""
    return _compile(pattern, flags).match(string)
        


src/i/t/itools-HEAD/srx/srx.py   itools(Download)
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
# Import from python
from re import match, compile, DOTALL, MULTILINE
 
# Import from itools
from itools.xml import XMLParser, XML_DECL, START_ELEMENT, END_ELEMENT, TEXT
    def get_rules(self, language):
        language_rules = self.language_rules
        cascade = self.header['cascade']
 
        result = []
        for pattern, lang in self.map_rules:
            if match(pattern, language, DOTALL | MULTILINE):

src/a/s/asr-builder-HEAD/trunk/src/ASRBuilder/Parser.py   asr-builder(Download)
from md5 import md5
from os.path import join
from threading import Thread
from re import sub, split, match, findall
 
from HTKAssist import HTKAssist
from HTKWrapper import HTKWrapper
                line_count += 1
                if not pass_flag:
 
                    if match(r' *#', line) is None and\
                       len(line) > 0:
                        # Check for external module syntax
                        if match(r'^ *\[.*\]', line) is not None:
                                raise ParserError("Invalid number of arguments")
 
                        # Check for for-loop syntax
                        elif match(r'^ *FOR *[0-9]* *[0-9]* *[\w]*', 
                                      line) is not None:
                            temp = split(r' *', line.strip(" :\n\r"))
                            params = self._removeNulls(temp)
                            lineBuffer = []
                            offset = 0
                            for index in range(line_count + 1, line_total):
                                if match(r'^ *END *(?<= )%s(?!\w+)' 
                                         %variable, run_data[index]) is None:
                                    lineBuffer.append(run_data[index]) 
                                elif match(r'^ *END *(?<= )%s(?!\w+)' 
                        # Check for other "normal syntax"
                        else:
                            temp = line.strip(" \n\r")
                            if match(r'^.*\<.*\>', temp) is not None:
                                nonstd = findall(r'\<.*\>', temp)[0].strip("<>")
                                parts = split(r',', nonstd)
                                retrieve = {}

src/a/s/asr-builder-HEAD/src/ASRBuilder/Parser.py   asr-builder(Download)
from md5 import md5
from os.path import join
from threading import Thread
from re import sub, split, match, findall
 
from HTKAssist import HTKAssist
from HTKWrapper import HTKWrapper
                line_count += 1
                if not pass_flag:
 
                    if match(r' *#', line) is None and\
                       len(line) > 0:
                        # Check for external module syntax
                        if match(r'^ *\[.*\]', line) is not None:
                                raise ParserError("Invalid number of arguments")
 
                        # Check for for-loop syntax
                        elif match(r'^ *FOR *[0-9]* *[0-9]* *[\w]*', 
                                      line) is not None:
                            temp = split(r' *', line.strip(" :\n\r"))
                            params = self._removeNulls(temp)
                            lineBuffer = []
                            offset = 0
                            for index in range(line_count + 1, line_total):
                                if match(r'^ *END *(?<= )%s(?!\w+)' 
                                         %variable, run_data[index]) is None:
                                    lineBuffer.append(run_data[index]) 
                                elif match(r'^ *END *(?<= )%s(?!\w+)' 
                        # Check for other "normal syntax"
                        else:
                            temp = line.strip(" \n\r")
                            if match(r'^.*\<.*\>', temp) is not None:
                                nonstd = findall(r'\<.*\>', temp)[0].strip("<>")
                                parts = split(r',', nonstd)
                                retrieve = {}

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
        if pattern is None:
            return
        try:
            match(pattern, '')
        except reerror:
            print3("\nBad user-defined singular pattern:\n\t%s\n" % pattern)
            raise BadUserDefinedPatternError
        ordinal('one') returns 'first'
 
        '''
        if match(r"\d", str(num)):
            try:
                num % 2
                n = num

src/s/e/sepy-HEAD/core/ui/panels/package/ClassExplorer.py   sepy(Download)
#!/usr/bin/env python
# @version $Id: ClassExplorer.py,v 1.1 2006/03/28 10:11:06 sephiroth_tmm Exp $
 
import cPickle, sys
from os import listdir, path
from time import time
from re import search, match
                        classType = "class"
                    isAClass = True
                if isAClass:
                    p = match("^([\s+]?function\s+)(?P<name>[\w0-9_\$ ]+)(\s+)?(\()[\s]*(?P<param_list>[\w\.\_,: ]*)[\s]*[\)][:]*(?P<return_type>[\w\_\.]*)", currentLine)
                    if p:
                        isFunction = True
                        if p.groupdict().get('name') != "":
                            fn.append([p.groupdict(),buf+p.span()[0]])
                    else:
                        p = match("^(\s+)?(?P<name>[\w0-9_\$\.]+)([\s]*=[\s]*)(function)[\s]*[\(][\s]*(?P<param_list>[\w\.\_,: ]*)[\s]*[\)][:]*(?P<return_type>[\w\_\.]*)", currentLine)

src/z/a/zamboni-lib-HEAD/lib/python/sqlalchemy/dialects/firebird/kinterbasdb.py   zamboni-lib(Download)
        # Interbase signature. This is more than enough for our purposes,
        # as this is mainly (only?) used by the testsuite.
 
        from re import match
 
        fbconn = connection.connection
        version = fbconn.server_version
        m = match('\w+-V(\d+)\.(\d+)\.(\d+)\.(\d+) \w+ (\d+)\.(\d+)', version)

src/r/e/reporter-lib-HEAD/packages/sqlalchemy/lib/sqlalchemy/dialects/firebird/kinterbasdb.py   reporter-lib(Download)
        # Interbase signature. This is more than enough for our purposes,
        # as this is mainly (only?) used by the testsuite.
 
        from re import match
 
        fbconn = connection.connection
        version = fbconn.server_version
        m = match('\w+-V(\d+)\.(\d+)\.(\d+)\.(\d+) \w+ (\d+)\.(\d+)', version)

src/z/a/zamboni-lib-HEAD/lib/python/IPython/Extensions/PhysicalQInput.py   zamboni-lib(Download)
def prefilter_PQ(self,line,continuation):
    """Alternate prefilter for input of PhysicalQuantityInteractive objects.
 
    This assumes that the function PhysicalQuantityInteractive() has been
    imported."""
 
    from re import match
    from IPython.iplib import InteractiveShell
 
    # This regexp is what does the real work
    unit_split = match(r'\s*(\w+)\s*=\s*(-?\d*\.?\d*[eE]?-?\d*)\s+([a-zA-Z].*)',

src/r/e/redrain-HEAD/redrain.py   redrain(Download)
import re
import os
from feedparser import parse
from re import search, match
from datetime import datetime
from urllib import urlretrieve, urlopen
 
    f = open(path, 'r')
    for line in f.readlines():
        # match a comment
        m = match(r'#', line)
        if m is not None:
            continue
 
        m = match(r'(.+)=(.+)', line)
        if m is not None:
            config[m.group(1)] = m.group(2)
 
    # straighten up paths in the config
    for n in config.keys():
        m = match(r'(f_)', n)
    # make sure that any directories in the configuration actually exist.
    # if they don't exist, create them.
    for n in config.keys():
        m = match(r'd_', n)
        if m is not None:
            p = fixpath(config[n])
            if os.path.exists(p) == False:
 
    for line in f.readlines():
        # discard a comment
        m = match(r'#', line)
        if m is not None:
            continue
 
        m = match(r'(guid|url)=(.+)', line)
    # iterate over the url
    for line in f.readlines():
        # discard comments
        m = match(r'#', line)
        if m is not None:
            continue
 
        m = match(r'(guid|url)=(.+)', line)
    show = dict()
    for line in f.readlines():
        # match a key=value line
        m = match(r'(.+?)=(.+)', line)
        if m is not None:
            show[m.group(1)] = m.group(2)
            continue
 
        # match a comment
        m = match(r'#', line)
            continue
 
        # match a % and start the next show
        m = match(r'%', line)
        if m is not None:
            # skip the show if the entry contains "skip=true"
            if show.get('skip', 'false') == 'true':

src/p/o/powervpn-HEAD/trunk/source/powervpn-0.0.4/module/openvpn.py   powervpn(Download)
#!/usr/bin/python
import gtk, os, time
from time import strftime, gmtime
from re import findall, split, match, search
from sys import prefix
from powervpn.sub import pref, sysconf, cmd
 
	def list(self):
		locate = '%s%s' %(pref.read("%s/share/powervpn/openvpn/server" %(prefix), "config_path", "VPN_server"), pref.read("%s/share/powervpn/openvpn/server" %(prefix), "user_folder", "VPN_server"))
		if (os.path.isdir(locate)) and (os.access(locate, os.X_OK)):
			for list in os.listdir(u'%s' %(locate)):
				if match('(.*)\.txt', list):
					list = search('(.*)\.txt', list)
					yield list.group(1)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next