55import typing
66from datetime import datetime , timezone
77from difflib import get_close_matches
8- from distutils .util import strtobool as _stb # pylint: disable=import-error
98from itertools import takewhile , zip_longest
109from urllib import parse
1110
5655def strtobool (val ):
5756 if isinstance (val , bool ):
5857 return val
59- try :
60- return _stb (str (val ))
61- except ValueError :
62- val = val .lower ()
63- if val == "enable" :
64- return 1
65- if val == "disable" :
66- return 0
67- raise
58+ val = str (val ).lower ()
59+ if val in ("y" , "yes" , "on" , "1" , "true" , "t" , "enable" ):
60+ return 1
61+ if val in ("n" , "no" , "off" , "0" , "false" , "f" , "disable" ):
62+ return 0
63+ raise ValueError (f"invalid truth value { val } " )
6864
6965
7066class User (commands .MemberConverter ):
@@ -373,7 +369,7 @@ def create_not_found_embed(word, possibilities, name, n=2, cutoff=0.6) -> discor
373369
374370def parse_alias (alias , * , split = True ):
375371 def encode_alias (m ):
376- return "\x1a U " + base64 .b64encode (m .group (1 ).encode ()).decode () + "\x1a U "
372+ return "\x1A U " + base64 .b64encode (m .group (1 ).encode ()).decode () + "\x1A U "
377373
378374 def decode_alias (m ):
379375 return base64 .b64decode (m .group (1 ).encode ()).decode ()
@@ -395,7 +391,7 @@ def decode_alias(m):
395391 iterate = [alias ]
396392
397393 for a in iterate :
398- a = re .sub (" \x1a U (.+?)\x1a U " , decode_alias , a )
394+ a = re .sub (r"\x1AU (.+?)\x1AU " , decode_alias , a )
399395 if a [0 ] == a [- 1 ] == '"' :
400396 a = a [1 :- 1 ]
401397 aliases .append (a )
@@ -617,7 +613,6 @@ def return_or_truncate(text, max_length):
617613class AcceptButton (discord .ui .Button ):
618614 def __init__ (self , custom_id : str , emoji : str ):
619615 super ().__init__ (style = discord .ButtonStyle .gray , emoji = emoji , custom_id = custom_id )
620- self .view : ConfirmThreadCreationView
621616
622617 async def callback (self , interaction : discord .Interaction ):
623618 self .view .value = True
@@ -628,7 +623,6 @@ async def callback(self, interaction: discord.Interaction):
628623class DenyButton (discord .ui .Button ):
629624 def __init__ (self , custom_id : str , emoji : str ):
630625 super ().__init__ (style = discord .ButtonStyle .gray , emoji = emoji , custom_id = custom_id )
631- self .view : ConfirmThreadCreationView
632626
633627 async def callback (self , interaction : discord .Interaction ):
634628 self .view .value = False
0 commit comments