<commit_before># -*- coding: utf-8 -*-
# vim:set expandtab tabstop=4 shiftwidth=4:
#
# The MIT License (MIT)
# LdapCherry
# Copyright (c) 2014 <NAME>

from ldapcherry.exceptions import MissingParameter


class PPolicy:

    def __init__(self, config, logger):
        """ password policy constructor
        @dict config: the configuration of the ppolicy
        @logger logger: a python logger
        """
        pass

    def check(self, password):
        """ check that a password match the ppolicy
        @str password: the password to check
        @rtype: dict with keys 'match' a boolean
            (True if ppolicy matches, False otherwise)
            and 'reason', an explaination string
        """
        ret = {'match': True, 'reason': 'no password policy'}
        return ret

    def info(self):
        """ gives information about the ppolicy
        @rtype: a string describing the ppolicy
        """
        ret = "There is no password policy configured"

    def get_param(self, param, default=None):
        """
        @str param: name of the paramter to recover
        default: the default value, raises an exception
            if param is not in configuration and default
            is None (which is the default value).
        """
        if param in self.config:
            return self.config[param]
        elif default is not None:
            return default
        else:
            raise MissingParameter('ppolicy', param)<commit_msg>fix doc string in ppolicy<commit_after># -*- coding: utf-8 -*-
# vim:set expandtab tabstop=4 shiftwidth=4:
#
# The MIT License (MIT)
# LdapCherry
# Copyright (c) 2014 <NAME>

from ldapcherry.exceptions import MissingParameter


class PPolicy:

    def __init__(self, config, logger):
        """ Password policy constructor

        :dict config: the configuration of the ppolicy
        :logger logger: a python logger
        """
        pass

    def check(self, password):
        """ Check if a password match the ppolicy

        :str password: the password to check
        :rtype: dict with keys 'match' a boolean
            (True if ppolicy matches, False otherwise)
            and 'reason', an explaination string
        """
        ret = {'match': True, 'reason': 'no password policy'}
        return ret

    def info(self):
        """ Gives information about the ppolicy

        :rtype: a string describing the ppolicy
        """
        ret = "There is no password policy configured"

    def get_param(self, param, default=None):
        """ Get a parameter in config (handle default value)

        :str param: name of the paramter to recover
        :str default: the default value, raises an exception
            if param is not in configuration and default
            is None (which is the default value).
        """
        if param in self.config:
            return self.config[param]
        elif default is not None:
            return default
        else:
            raise MissingParameter('ppolicy', param)
{'fraction_non_alphanumeric': 0.08250497017892644, 'fraction_numerical': 0.004638833664678595, 'mean_word_length': 2.1913319238900635, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1053448', 'n_tokens_mistral': 784, 'n_tokens_neox': 753, 'n_words': 324}