PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` from base64 import b64encode import functools import random import string def b64str(s: str) -> str: """Return `s` base64-encoded. :param s: string to encode """ return b64encode(s.encode()).decode() def fmap(func, obj): "Homomorphic mapping of a function" # strings are specifically not fmap-able because that invites # consideration as byte characters, not unicode if isinstance(obj, tuple): return tuple(map(functools.partial(fmap, func), obj)) iterableitems = isinstance(obj, (list, dict)) if not iterableitems: try: iterableitems = isinstance(obj, (filter, map, zip, range)) except TypeError: # pragma: nocover # Python2 doesn't have objects like the above # The corresponding operations just result in lists # which is already covered pass if iterableitems: if hasattr(obj, 'items'): return dict(map(functools.partial(fmap, func), obj.items())) return list(map(functools.partial(fmap, func), obj)) if hasattr(obj, 'fmap'): return obj.fmap(func) return func(obj) def random_password(length: int = None) -> str: """Create a random password. :param length: An int specifying password length :returns: the password, in cleartext """ if not length: length = random.randint(10, 23) edited_punctuation = string.punctuation.replace('"', '').replace("'", "").replace("\\", "") return ''.join([random.choice(string.digits + string.ascii_letters + edited_punctuation) for X in range(length)])