mirror of
https://github.com/j93es/oauth-backend.git
synced 2026-06-04 03:41:52 +09:00
[Update] 자동 오탐 검증을 위한 라우터 추가
This commit is contained in:
parent
53db0fb14e
commit
3c5db3c1fd
5 changed files with 188 additions and 23 deletions
59
lib/false_true_varifing_task.py
Normal file
59
lib/false_true_varifing_task.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from typing import Any
|
||||
from copy import deepcopy
|
||||
|
||||
class FalseTrueVarifingTask:
|
||||
"""
|
||||
A singleton class representing a task that can be either false or true.
|
||||
This class is used to handle tasks that require verification of their truth value.
|
||||
"""
|
||||
|
||||
_instance = None
|
||||
|
||||
def __new__(cls):
|
||||
if cls._instance is None:
|
||||
cls._instance = super(FalseTrueVarifingTask, cls).__new__(cls)
|
||||
cls._instance._initialized = False
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
if self._initialized:
|
||||
return
|
||||
self._is_verifing = False
|
||||
self.task_queue = []
|
||||
self._initialized = True
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Reset the task queue and verification status.
|
||||
"""
|
||||
self._is_verifing = False
|
||||
self.task_queue.clear()
|
||||
|
||||
def add_task(self, task_name: str, data: Any):
|
||||
"""
|
||||
Add a task to the task queue.
|
||||
:param task: The task to be added.
|
||||
"""
|
||||
self.task_queue.append({
|
||||
"task_name": task_name,
|
||||
"data": data})
|
||||
|
||||
def start_verification(self):
|
||||
"""
|
||||
Start the verification process for the tasks in the queue.
|
||||
"""
|
||||
self._is_verifing = True
|
||||
|
||||
def get_task_queue(self):
|
||||
"""
|
||||
Get a copy of the current task queue.
|
||||
:return: A copy of the task queue.
|
||||
"""
|
||||
return deepcopy(self.task_queue)
|
||||
|
||||
def is_verifing_false_true(self):
|
||||
"""
|
||||
Get the current verification status.
|
||||
:return: True if verification is in progress, False otherwise.
|
||||
"""
|
||||
return self._is_verifing
|
||||
Loading…
Add table
Add a link
Reference in a new issue