# Path: pykern/pkconst.py
# STRING_TYPES = None
#     STRING_TYPES = basestring
#     STRING_TYPES = str
#     PY_PATH_LOCAL_TYPE = type(py.path.local())
# BASE62_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'


from pykern import pkconst
    from pykern import pkcompat
import contextlib
import errno
import glob
import io
import os
import os.path
import py
import random
import re
import shutil
    Args:
        path (str): path to convert (or None for current dir)

    Returns:
        py.path.Local: path
    """
    global pkunit_prefix

    res = py.path.local(path, expanduser=True)
    if pkunit_prefix:
        # Allow for <test>_work and <test>_data so we don't add
        # prefix if there's a common parent directory.
        if not str(res).startswith(pkunit_prefix.dirname):
            res = pkunit_prefix.join(res)
        py.path.local(res.dirname).ensure(dir=True)
    return res


def random_base62(length=16):
    """Returns a safe string of sufficient length to be a nonce.

    The default is 62^16, which is 4e28. For comparison, 2^64 is 1e19 and
    2^128 is 3e38.

    Args:
        length (int): how long to make the base62 string [16]
    Returns:
        str: random base62 characters
    """
    r = random.SystemRandom()

# Path: pykern/pkconst.py
# STRING_TYPES = None
#     STRING_TYPES = basestring
#     STRING_TYPES = str
#     PY_PATH_LOCAL_TYPE = type(py.path.local())
# BASE62_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'


# Path: pykern/pkio.py
from pykern import pkconst
    from pykern import pkcompat
import contextlib
import errno
import glob
import io
import os
import os.path
import py
import random
import re
import shutil

    Args:
        path (str): path to convert (or None for current dir)

    Returns:
        py.path.Local: path
    """
    global pkunit_prefix

    res = py.path.local(path, expanduser=True)
    if pkunit_prefix:
        # Allow for <test>_work and <test>_data so we don't add
        # prefix if there's a common parent directory.
        if not str(res).startswith(pkunit_prefix.dirname):
            res = pkunit_prefix.join(res)
        py.path.local(res.dirname).ensure(dir=True)
    return res


def random_base62(length=16):
    """Returns a safe string of sufficient length to be a nonce.

    The default is 62^16, which is 4e28. For comparison, 2^64 is 1e19 and
    2^128 is 3e38.

    Args:
        length (int): how long to make the base62 string [16]
    Returns:
        str: random base62 characters
    """
    r = random.SystemRandom()

    return ''.join(r.choice(pkconst.BASE62_CHARS) for x in range(length))