mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2025-06-23 01:20:57 +00:00
Linted with black
This commit is contained in:
parent
167f551a96
commit
202db95f52
10 changed files with 325 additions and 168 deletions
|
@ -7,11 +7,13 @@ banned = {}
|
|||
active = False
|
||||
threshold = -1
|
||||
|
||||
|
||||
def clear_banned():
|
||||
global banned
|
||||
banned = {}
|
||||
|
||||
def setup(violations_threshold = 100):
|
||||
|
||||
def setup(violations_threshold=100):
|
||||
global active
|
||||
global threshold
|
||||
|
||||
|
@ -31,6 +33,7 @@ def report(request_ip):
|
|||
banned[request_ip] = banned.get(request_ip, 0)
|
||||
banned[request_ip] += 1
|
||||
|
||||
|
||||
def is_banned(request_ip):
|
||||
# More than X offences?
|
||||
return active and banned.get(request_ip, 0) >= threshold
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue