Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(4)  |  Derive(0)  |  Import(3)
Given a sequence of items, return the sequence formatted
according to ordinary English conventions of punctuation.

If the list is empty, the value of 'empty' will be returned.

        def englishSequence(lst, empty="none", compound="and"):
    """Given a sequence of items, return the sequence formatted
       according to ordinary English conventions of punctuation.

       If the list is empty, the value of 'empty' will be returned."""

    if len(lst) == 0:
        return empty
    elif len(lst) == 1:
        return lst[0]

    punc = ", "
    for item in lst:
        if ("," in item or
            stringContains(item, " and ") or
            stringContains(item, " or ")):
            punc = "; "
            break

    if len(lst) == 2:
        if punc == ", ":
            return "%s %s %s" % (lst[0], compound, lst[1])
        else:
            return "%s; %s %s" % (lst[0], compound, lst[1])
    else:
        return "%s%s%s %s" % (punc.join(lst[0:-1]), punc, compound, lst[-1])
        


src/m/i/mixminion-HEAD/lib/mixminion/Config.py   mixminion(Download)
import mixminion.NetUtils
 
from mixminion.Common import MixError, LOG, ceilDiv, englishSequence, \
     formatBase64, isPrintingAscii, stripSpace, stringContains, UIError
 
                     in result ]
            raise UIError("%r is ambiguous.  Did you mean %s?"%(
                          name, englishSequence(secs,compound="or")))
        else:
            return result[0]
                    if acceptedIn:
                        msg += ". This key belongs in %s, but appears in %s."%(
                            englishSequence(acceptedIn, compound="or"),
                            secName)
                    if self._restrictKeys:

src/m/i/mixminion-HEAD/lib/mixminion/ClientMain.py   mixminion(Download)
import mixminion.MMTPClient
 
from mixminion.Common import LOG, Lockfile, LockfileLocked, MixError, \
     MixFatalError, MixProtocolBadAuth, MixProtocolError, STATUS, UIError, \
     UsageError, createPrivateDir, englishSequence, floorDiv, formatTime, \
            if len(f)>1:
                print "%-30s (abbreviate as %s)" % (
                    f[0], englishSequence(f[1:],compound="or"))
            else:
                print f[0]

src/m/i/mixminion-HEAD/lib/mixminion/server/ServerKeys.py   mixminion(Download)
from mixminion.ServerInfo import ServerInfo, PACKET_KEY_BYTES, MMTP_KEY_BYTES,\
     signServerInfo
from mixminion.Common import AtomicFile, LOG, MixError, MixFatalError, \
     ceilDiv, createPrivateDir, checkPrivateFile, englishSequence, \
     formatBase64, formatDate, formatTime, previousMidnight, readFile, \
        if fields['IP'] not in found:
            LOG.warn("Configured hostname %r resolves to %s, but we're publishing the IP %s",
                     fields['Hostname'], englishSequence(found), fields['IP'])
 
    # Fill in a stock server descriptor.  Note the empty Digest: and