# Path: axes/utils.py
# def reset(ip: str = None, username: str = None, ip_or_username=False) -> int:
#     """
#     Reset records that match IP or username, and return the count of removed attempts.
# 
#     This utility method is meant to be used from the CLI or via Python API.
#     """
# 
#     return AxesProxyHandler.reset_attempts(
#         ip_address=ip, username=username, ip_or_username=ip_or_username
#     )


from django.core.management.base import BaseCommand
from axes.utils import reset



class Command(BaseCommand):
    help = "Reset all access attempts and lockouts for given usernames"

    def add_arguments(self, parser):
        parser.add_argument("username", nargs="+", type=str)

    def handle(self, *args, **options):
        count = 0

        for username in options["username"]:

# Path: axes/utils.py
# def reset(ip: str = None, username: str = None, ip_or_username=False) -> int:
#     """
#     Reset records that match IP or username, and return the count of removed attempts.
# 
#     This utility method is meant to be used from the CLI or via Python API.
#     """
# 
#     return AxesProxyHandler.reset_attempts(
#         ip_address=ip, username=username, ip_or_username=ip_or_username
#     )


# Path: axes/management/commands/axes_reset_username.py
from django.core.management.base import BaseCommand
from axes.utils import reset




class Command(BaseCommand):
    help = "Reset all access attempts and lockouts for given usernames"

    def add_arguments(self, parser):
        parser.add_argument("username", nargs="+", type=str)

    def handle(self, *args, **options):
        count = 0

        for username in options["username"]:

            count += reset(username=username)