PyFunceble/percentage.py
def _calculate(cls):
        """
        Calculate the percentage of each status.
        """

        # We map the current state/counters of the different status.
        percentages = {
            "up": PyFunceble.INTERN["counter"]["number"]["up"],
            "down": PyFunceble.INTERN["counter"]["number"]["down"],
            "invalid": PyFunceble.INTERN["counter"]["number"]["invalid"],
        }

        for percentage in percentages:
            # We loop through our map index.

            # We calculate the percentage.
            calculation = (
                percentages[percentage]
                * 100
                // PyFunceble.INTERN["counter"]["number"]["tested"]
            )

            # And we update the percentage counter of the actual status.
            PyFunceble.INTERN["counter"]["percentage"].update({percentage: calculation})
def _calculate(cls):
        # We map the current state/counters of the different status.
        percentages = {
            "up": PyFunceble.INTERN["counter"]["number"]["up"],
            "down": PyFunceble.INTERN["counter"]["number"]["down"],
            "invalid": PyFunceble.INTERN["counter"]["number"]["invalid"],
        }

        for percentage in percentages:
            # We loop through our map index.

            # We calculate the percentage.
            calculation = (
                percentages[percentage]
                * 100
                // PyFunceble.INTERN["counter"]["number"]["tested"]
            )

            # And we update the percentage counter of the actual status.
            PyFunceble.INTERN["counter"]["percentage"].update({percentage: calculation})
def _calculate ( cls ) : # We map the current state/counters of the different status. percentages = { "up" : PyFunceble . INTERN [ "counter" ] [ "number" ] [ "up" ] , "down" : PyFunceble . INTERN [ "counter" ] [ "number" ] [ "down" ] , "invalid" : PyFunceble . INTERN [ "counter" ] [ "number" ] [ "invalid" ] , } for percentage in percentages : # We loop through our map index. # We calculate the percentage. calculation = ( percentages [ percentage ] * 100 // PyFunceble . INTERN [ "counter" ] [ "number" ] [ "tested" ] ) # And we update the percentage counter of the actual status. PyFunceble . INTERN [ "counter" ] [ "percentage" ] . update ( { percentage : calculation } )
Calculate the percentage of each status.
Calculate the percentage of each status .