fresh start

This commit is contained in:
2026-01-08 22:07:03 +01:00
commit 715be97289
30 changed files with 2302 additions and 0 deletions

24
helpers.py Normal file
View File

@@ -0,0 +1,24 @@
from Database.x_classes import PostRating
def twos_complement(hexstr, bits):
value = int(hexstr,16) #convert hexadecimal to integer
#convert from unsigned number to signed number with "bits" bits
if value & (1 << (bits-1)):
value -= 1 << bits
return value
def get_rating_value(rating):
"for deciding final post rating"
match rating:
case PostRating.Explicit:
return 4
case PostRating.Questionable:
return 3
case PostRating.Sensitive:
return 2
case PostRating.General:
return 1
case _:
return 0