@@ -182,7 +182,7 @@ def __init__(
182182 self .timestamp = timestamp
183183
184184 @classmethod
185- def from_dict (cls , data : Mapping [str , Any ]) -> Self :
185+ def from_dict (cls , data : " Mapping[str, Any]" ) -> "tanjunEmbed" :
186186 self = cls .__new__ (cls )
187187
188188 self .title = None
@@ -276,11 +276,11 @@ def __eq__(self, other: object) -> bool:
276276 return self .to_dict () == other .to_dict ()
277277
278278 @property
279- def colour (self ) -> discord .Colour | None :
279+ def colour (self ) -> discord .Colour | None : # type: ignore[override]
280280 return getattr (self , "_colour" , None )
281281
282282 @colour .setter
283- def colour (self , value : int | discord .Colour | None ) -> None :
283+ def colour (self , value : int | discord .Colour | None ) -> None : # type: ignore[override]
284284 if value is None :
285285 self ._colour = None
286286 elif isinstance (value , discord .Colour ):
@@ -289,11 +289,11 @@ def colour(self, value: int | discord.Colour | None) -> None:
289289 self ._colour = discord .Colour (value = value )
290290
291291 @property
292- def color (self ) -> discord .Colour | None :
292+ def color (self ) -> discord .Colour | None : # type: ignore[override]
293293 return self .colour
294294
295295 @color .setter
296- def color (self , value : int | discord .Colour | None ) -> None :
296+ def color (self , value : int | discord .Colour | None ) -> None : # type: ignore[override]
297297 self .colour = value
298298
299299 @property
@@ -416,7 +416,7 @@ def set_field_at(self, index: int, *, name: object, value: object, inline: bool
416416 raise IndexError ("field index out of range" )
417417 return self
418418
419- def to_dict (self ) -> dict [str , Any ]:
419+ def to_dict (self ) -> dict [str , Any ]: # type: ignore[override]
420420 result : dict [str , object ] = {}
421421 for key in self .__slots__ :
422422 if key .startswith ("_" ) and hasattr (self , key ):
@@ -826,7 +826,7 @@ def eval_(node: ast.AST, variables: VariablesType) -> float | int | complex:
826826 raise TypeError (f"'{ func_id_str } ' is not a callable function." )
827827 args = [eval_ (arg , variables ) for arg in node .args ]
828828 try :
829- return func_to_call (* args )
829+ return cast ( float | int | complex , func_to_call (* args ) )
830830 except TypeError as e :
831831 raise TypeError (f"Error calling function '{ getattr (func_to_call , '__name__' , func_id_str )} ': { e } " )
832832 elif isinstance (node , ast .Name ):
@@ -858,14 +858,15 @@ def get_xp_for_level(level: int, scaling: str, custom_formula: str | None = None
858858 print (f"Warning: Unknown XP scaling '{ scaling } '. Using 'medium'." )
859859 result = LEVEL_SCALINGS ["medium" ](level )
860860
861- if isinstance (result , complex ):
861+ if type (result ) is complex : # type: ignore[redundant-expr]
862862 print (f"Warning: Custom XP formula resulted in a complex number ({ result } ). Using real part or 0." )
863863 return math .floor (result .real ) if result .real is not None else 0
864864 elif isinstance (result , (float , int )):
865865 if math .isinf (result ) or math .isnan (result ):
866866 print (f"Warning: XP calculation resulted in { result } . Returning 0." )
867867 return 0
868868 return math .floor (result )
869+ return 0
869870
870871
871872def get_level_for_xp (xp : int , scaling : str , custom_formula : str | None = None ) -> int :
@@ -1057,11 +1058,11 @@ def __init__(
10571058
10581059 @property
10591060 def guild (self ) -> discord .Guild | None :
1060- return self ._mock_guild
1061+ return cast ( discord . Guild | None , self ._mock_guild )
10611062
10621063 @property
10631064 def channel (self ) -> discord .abc .MessageableChannel | None :
1064- return self ._mock_channel
1065+ return cast ( discord . abc . MessageableChannel | None , self ._mock_channel )
10651066
10661067 async def original_response (self ) -> discord .Message :
10671068 if hasattr (self .response , "message" ) and self .response .message :
@@ -1112,7 +1113,7 @@ async def send_message(
11121113
11131114 channel = self .interaction ._mock_channel
11141115 if channel and hasattr (self .interaction , "_state" ):
1115- self .message = discord .Message (state = self .interaction ._state , channel = channel , data = message_data )
1116+ self .message = discord .Message (state = self .interaction ._state , channel = cast ( Any , channel ) , data = message_data ) # type: ignore[arg-type]
11161117 else :
11171118 self .message = None
11181119 self .interaction ._response_issued = True
@@ -1154,7 +1155,7 @@ async def send(
11541155 mock_channel = self ._state .Client .get_channel (0 )
11551156
11561157 # Use type ignore since we're mocking discord.Message creation
1157- return discord .Message (state = self ._state , channel = mock_channel , data = message_data )
1158+ return discord .Message (state = self ._state , channel = cast ( Any , mock_channel ) , data = message_data ) # type: ignore[arg-type]
11581159
11591160 async def edit_message (self , message_id : int , ** kwargs : Any ) -> discord .Message :
11601161 raise NotImplementedError
@@ -1174,10 +1175,10 @@ def create_mock_interaction(bot_instance: InteractionClient) -> MockInteraction:
11741175 A MockInteraction instance
11751176 """
11761177 # Create mock guild and channel objects that match the protocol
1177- mock_guild = type ("MockGuild" , (), {"id" : 12345 , "name" : "Mock Guild" })() if bot_instance is not None else None
1178- mock_channel = type ("MockChannel" , (), {"id" : 67890 })() if bot_instance is not None else None
1178+ mock_guild = type ("MockGuild" , (), {"id" : 12345 , "name" : "Mock Guild" })()
1179+ mock_channel = type ("MockChannel" , (), {"id" : 67890 })()
11791180
1180- if bot_instance is None or bot_instance .user is None :
1181+ if bot_instance .user is None :
11811182 raise ValueError ("Bot instance or bot user is not valid." )
11821183
11831184 # Create a mock user that matches the protocol
0 commit comments