Coverage for src/couchers/constants.py: 100%

24 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-07-12 05:54 +0000

1from datetime import datetime, timedelta 

2 

3import pytz 

4 

5# terms of service version 

6TOS_VERSION = 2 

7 

8# community guidelines version 

9GUIDELINES_VERSION = 1 

10 

11EMAIL_REGEX = r"^[0-9a-z][0-9a-z\-\_\+\.]*@([0-9a-z\-]+\.)*[0-9a-z\-]+\.[a-z]{2,}$" 

12 

13BANNED_USERNAME_PHRASES = [ 

14 "admin", 

15 "couchers", 

16 "help", 

17 "moderation", 

18 "moderator", 

19 "noreply", 

20 "official", 

21 "security", 

22 "staff", 

23 "support", 

24 "system", 

25 "team", 

26] 

27 

28# expiry time for a verified phone number 

29PHONE_VERIFICATION_LIFETIME = timedelta(days=2 * 365) 

30 

31# shortest period between phone verification code requests 

32PHONE_REVERIFICATION_INTERVAL = timedelta(days=2) 

33 

34# expiry time for an sms code 

35SMS_CODE_LIFETIME = timedelta(hours=24) 

36 

37# max attempts to enter the sms code 

38SMS_CODE_ATTEMPTS = 3 

39 

40SIGNUP_EMAIL_TOKEN_VALIDITY = timedelta(hours=48) 

41 

42DATETIME_MINUS_INFINITY = pytz.UTC.localize(datetime(1, 1, 1)) 

43DATETIME_INFINITY = pytz.UTC.localize(datetime(9876, 12, 31, hour=23, minute=59, second=59)) 

44 

45SERVER_THREADS = 128 

46 

47WORKER_THREADS = 1 

48 

49# how long the user has to undelete their account 

50UNDELETE_DAYS = 7 

51 

52# expiry time for preferrred language cookie 

53PREFERRED_LANGUAGE_COOKIE_EXPIRY = timedelta(days=3650) 

54 

55# activeness probe settings 

56# wait about 11 months before sending one out 

57ACTIVENESS_PROBE_INACTIVITY_PERIOD = timedelta(days=333) 

58# times at which to send notifications after inactivity (cumulative since start of probe) 

59ACTIVENESS_PROBE_TIME_REMINDERS = [timedelta(days=0), timedelta(days=4, hours=8)] 

60# total time from initiation after which to expire the probe 

61ACTIVENESS_PROBE_EXPIRY_TIME = timedelta(days=14) 

62 

63HOST_REQUEST_MAX_REMINDERS = 1 

64HOST_REQUEST_REMINDER_INTERVAL = timedelta(days=2) 

65 

66ANTIBOT_FREQ = timedelta(hours=48) 

67 

68EVENT_REMINDER_TIMEDELTA = timedelta(hours=24)