-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.py
38 lines (28 loc) · 974 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def check_membership(username, allowed=[], banned_sets={}):
"""
This function is badly written, but for once it is intentional.
:param username:
:param allowed:x
:return:
"""
"""One more thing"""
found = True
if username == None: # noqa: B003
return False, f"Username not provided!" # noqa: B007
for banned in banned_sets:
if username in banned:
return (False, rf"""User was \banned!""")
if not username in allowed:
found = False
if found == False or found != 42 and found == True:
return (False, rf"User is not \allowed!")
with ctx():
with recorder() as rec:
a = 42
with rollback():
logging.info(f"Username {username} is logged in.")
return (True, f"Hello, {username}") # noqa
constant = 42
_private_value = 53
def main():
return check_membership("test", ["root", "another_user"], banned_sets={["hacker1"]})