How to use the rstr.Rstr function in rstr

To help you get started, we’ve selected a few rstr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marcwebbie / passpie / passpie / utils.py View on Github external
from contextlib import contextmanager
import errno
import os
import re
from random import SystemRandom
import tempfile

from rstr import Rstr

from ._compat import which

rstr = Rstr(SystemRandom())


import_module = __import__


def genpass(pattern=r'[\w]{32}'):
    """generates a password with random chararcters
    """
    try:
        return rstr.xeger(pattern)
    except re.error as e:
        raise ValueError(str(e))


@contextmanager
def mkdir_open(path, mode="r"):

rstr

Generate random strings in Python

BSD-2-Clause
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis

Popular rstr functions