def get_pin_and_cookie_name(app):
    pin = os.environ.get('WERKZEUG_DEBUG_PIN')
    rv = None
    num = None

    # Pin was explicitly disabled
    if pin == 'off':
        return None, None

    # Pin was provided explicitly
    if pin is not None and pin.replace('-', '').isdigit():
        # If there are separators in the pin, return it directly
        if '-' in pin:
            rv = pin
        else:
            num = pin

    modname = getattr(app, '__module__',
                      getattr(app.__class__, '__module__'))
    bits = [
        getpass.getuser(),
        str(uuid.getnode()),
        modname,
        getattr(app, '__name__', getattr(app.__class__, '__name__')),
    ]

    mod = sys.modules.get(modname)
    bits.append(getattr(mod, '__file__', None))

    h = hashlib.md5()
    for bit in bits:
        if not bit:
            continue
        if isinstance(bit, text_type):
            bit = bit.encode('utf-8')
        h.update(bit)

    if num is None:
        num = ('%09d' % int(h.hexdigest(), 16))[:9]

    h.update('cookiesalt')
    cookie_name = '__wzd' + h.hexdigest()[:12]

    # Format the pincode in groups of digits for easier remembering if
    # we don't have a result yet.
    if rv is None:
        for group_size in 5, 4, 3:
            if len(num) % group_size == 0:
                rv = '-'.join(num[x:x + group_size].rjust(group_size, '0')
                              for x in range(0, len(num), group_size))
                break
        else:
            rv = num

    return rv, cookie_name
Return help for
dataset/ETHPy150Open GoogleCloudPlatform/appengine-flask-skeleton/lib/werkzeug/debug/__init__.py/get_pin_and_cookie_name--crossover with--dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/actorstore/store.py/DocumentationStore.help