# Path: pyanaconda/iutil.py
# def augmentEnv():
# def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None):
#     def chroot():
# def execWithRedirect(command, argv, stdin=None, stdout=None,
#                      root='/', env_prune=None):
# def execWithCapture(command, argv, stdin=None, root='/'):
# def execReadlines(command, argv, stdin=None, root='/', env_prune=None):
#     def queue_lines(out, queue):
#     def chroot():
# def execConsole():
# def getDirSize(directory):
#     def getSubdirSize(directory):
# def mkdirChain(directory):
# def get_active_console(dev="console"):
# def isConsoleOnVirtualTerminal(dev="console"):
# def strip_markup(text):
# def reIPL(ipldev):
# def resetRpmDb():
# def parseNfsUrl(nfsurl):
# def add_po_path(module, directory):
# def setup_translations(module):
# def fork_orphan():
# def _run_systemctl(command, service):
# def start_service(service):
# def stop_service(service):
# def restart_service(service):
# def service_running(service):
# def dracut_eject(device):
# def vtActivate(num):
#     def __init__(self, url=None, protocol="http://", host=None, port="3128",
#                  username=None, password=None):
#     def parse_url(self):
#     def parse_components(self):
#     def dict(self):
#     def __str__(self):
# def getdeepattr(obj, name):
# def setdeepattr(obj, name, value):
# def strip_accents(s):
# def cmp_obj_attrs(obj1, obj2, attr_list):
# def dir_tree_map(root, func, files=True, dirs=True):
# def chown_dir_tree(root, uid, gid, from_uid_only=None, from_gid_only=None):
#     def conditional_chown(path, uid, gid, from_uid=None, from_gid=None):
# def is_unsupported_hw():
# def _toASCII(s):
# def upperASCII(s):
# def lowerASCII(s):
# def upcase_first_letter(text):
# class ProxyStringError(Exception):
# class ProxyString(object):
# 
# Path: pyanaconda/iutil.py
# def strip_accents(s):
#     """This function takes arbitrary unicode string
#     and returns it with all the diacritics removed.
# 
#     :param s: arbitrary string
#     :type s: unicode
# 
#     :return: s with diacritics removed
#     :rtype: unicode
# 
#     """
#     return ''.join((c for c in unicodedata.normalize('NFD', s)
#                       if unicodedata.category(c) != 'Mn'))
# 
# Path: pyanaconda/constants.py
# PASSWORD_MIN_LEN = 6


import libuser
import string
import crypt
import random
import tempfile
import os
import os.path
import pwquality
import logging
from pyanaconda import iutil
from pyanaconda.iutil import strip_accents
from pyanaconda.i18n import _
from pyanaconda.constants import PASSWORD_MIN_LEN
       pwquality will raise a PWQError on a weak password, which, honestly,
       is kind of dumb behavior. A weak password isn't exceptional, it's what
       we're asking about! Anyway, this function does not raise PWQError. If
       the password fails the PWQSettings conditions, the first member of the
       return tuple will be False and the second member of the tuple will be 0.

       :param pw: the password to check
       :type pw: string

       :param user: the username for which the password is being set. If no
                    username is provided, "root" will be used. Use user=None
                    to disable the username check.
       :type user: string

       :param settings: an optional PWQSettings object
       :type settings: pwquality.PWQSettings

       :returns: A tuple containing (bool(valid), int(score), str(message))
       :rtype: tuple
    """

    valid = True
    message = None
    strength = 0

    if settings is None:
        # Generate a default PWQSettings once and save it as a member of this function
        if not hasattr(validatePassword, "pwqsettings"):
            validatePassword.pwqsettings = pwquality.PWQSettings()
            validatePassword.pwqsettings.read_config()

# Path: pyanaconda/iutil.py
# def augmentEnv():
# def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None):
#     def chroot():
# def execWithRedirect(command, argv, stdin=None, stdout=None,
#                      root='/', env_prune=None):
# def execWithCapture(command, argv, stdin=None, root='/'):
# def execReadlines(command, argv, stdin=None, root='/', env_prune=None):
#     def queue_lines(out, queue):
#     def chroot():
# def execConsole():
# def getDirSize(directory):
#     def getSubdirSize(directory):
# def mkdirChain(directory):
# def get_active_console(dev="console"):
# def isConsoleOnVirtualTerminal(dev="console"):
# def strip_markup(text):
# def reIPL(ipldev):
# def resetRpmDb():
# def parseNfsUrl(nfsurl):
# def add_po_path(module, directory):
# def setup_translations(module):
# def fork_orphan():
# def _run_systemctl(command, service):
# def start_service(service):
# def stop_service(service):
# def restart_service(service):
# def service_running(service):
# def dracut_eject(device):
# def vtActivate(num):
#     def __init__(self, url=None, protocol="http://", host=None, port="3128",
#                  username=None, password=None):
#     def parse_url(self):
#     def parse_components(self):
#     def dict(self):
#     def __str__(self):
# def getdeepattr(obj, name):
# def setdeepattr(obj, name, value):
# def strip_accents(s):
# def cmp_obj_attrs(obj1, obj2, attr_list):
# def dir_tree_map(root, func, files=True, dirs=True):
# def chown_dir_tree(root, uid, gid, from_uid_only=None, from_gid_only=None):
#     def conditional_chown(path, uid, gid, from_uid=None, from_gid=None):
# def is_unsupported_hw():
# def _toASCII(s):
# def upperASCII(s):
# def lowerASCII(s):
# def upcase_first_letter(text):
# class ProxyStringError(Exception):
# class ProxyString(object):
# 
# Path: pyanaconda/iutil.py
# def strip_accents(s):
#     """This function takes arbitrary unicode string
#     and returns it with all the diacritics removed.
# 
#     :param s: arbitrary string
#     :type s: unicode
# 
#     :return: s with diacritics removed
#     :rtype: unicode
# 
#     """
#     return ''.join((c for c in unicodedata.normalize('NFD', s)
#                       if unicodedata.category(c) != 'Mn'))
# 
# Path: pyanaconda/constants.py
# PASSWORD_MIN_LEN = 6


# Path: pyanaconda/users.py
import libuser
import string
import crypt
import random
import tempfile
import os
import os.path
import pwquality
import logging
from pyanaconda import iutil
from pyanaconda.iutil import strip_accents
from pyanaconda.i18n import _
from pyanaconda.constants import PASSWORD_MIN_LEN

       pwquality will raise a PWQError on a weak password, which, honestly,
       is kind of dumb behavior. A weak password isn't exceptional, it's what
       we're asking about! Anyway, this function does not raise PWQError. If
       the password fails the PWQSettings conditions, the first member of the
       return tuple will be False and the second member of the tuple will be 0.

       :param pw: the password to check
       :type pw: string

       :param user: the username for which the password is being set. If no
                    username is provided, "root" will be used. Use user=None
                    to disable the username check.
       :type user: string

       :param settings: an optional PWQSettings object
       :type settings: pwquality.PWQSettings

       :returns: A tuple containing (bool(valid), int(score), str(message))
       :rtype: tuple
    """

    valid = True
    message = None
    strength = 0

    if settings is None:
        # Generate a default PWQSettings once and save it as a member of this function
        if not hasattr(validatePassword, "pwqsettings"):
            validatePassword.pwqsettings = pwquality.PWQSettings()
            validatePassword.pwqsettings.read_config()

            validatePassword.pwqsettings.minlen = PASSWORD_MIN_LEN