Did I find the right examples for you? yes no

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
Checks if a string/unicode string contains only ASCII chars.  

        def isASCII(s):
    """ Checks if a string/unicode string contains only ASCII chars.  """

    if isinstance(s, unicode):
        try:
            s.encode('ascii')
            return True
        except UnicodeError:
            return False

    elif isinstance(s, str):
        try:
            unicode(s, 'ascii')
            return True
        except UnicodeError:
            return False

    else:
        raise TypeError('isASCII() requires a string or unicode string')
        


src/p/y/pypimirror-1.0.16.4/src/z3c/pypimirror/mirror.py   pypimirror(Download)
    def __init__(self, package_name, pypi_base_url="http://pypi.python.org/simple"):
        self._links_cache = None
 
        if not util.isASCII(package_name):
            raise PackageError("%s is not a valid package name." % package_name)

src/p/y/pypimirror-1.0.16.4/src/pypimirror/mirror.py   pypimirror(Download)
    def __init__(self, package_name, pypi_base_url="http://pypi.python.org/simple"):
        self._links_cache = None
 
        if not util.isASCII(package_name):
            raise PackageError("%s is not a valid package name." % package_name)

src/z/3/z3c.pypimirror-1.0.16/src/z3c/pypimirror/mirror.py   z3c.pypimirror(Download)
    def __init__(self, package_name, pypi_base_url="http://pypi.python.org/simple"):
        self._links_cache = None
 
        if not util.isASCII(package_name):
            raise PackageError("%s is not a valid package name." % package_name)