@@ -123,7 +123,7 @@ class DataTypeSingleton(type):
123123
124124 def __call__ (cls : type [T ]) -> T : # type: ignore[override]
125125 if cls not in cls ._instances : # type: ignore[attr-defined]
126- cls ._instances [cls ] = super (DataTypeSingleton , cls ).__call__ () # type: ignore[misc, attr-defined]
126+ cls ._instances [cls ] = super ().__call__ () # type: ignore[misc, attr-defined]
127127 return cls ._instances [cls ] # type: ignore[attr-defined]
128128
129129
@@ -535,7 +535,8 @@ def __init__(self, startField: Optional[int] = None, endField: Optional[int] = N
535535
536536 fields = DayTimeIntervalType ._fields
537537 if startField not in fields or endField not in fields :
538- raise RuntimeError (f"interval { startField } to { endField } is invalid" )
538+ msg = f"interval { startField } to { endField } is invalid"
539+ raise RuntimeError (msg )
539540 self .startField = cast ("int" , startField )
540541 self .endField = cast ("int" , endField )
541542
@@ -917,7 +918,8 @@ def toInternal(self, obj: tuple) -> tuple: # noqa: D102
917918 for n , f , c in zip (self .names , self .fields , self ._needConversion )
918919 )
919920 else :
920- raise ValueError (f"Unexpected tuple { obj !r} with StructType" )
921+ msg = f"Unexpected tuple { obj !r} with StructType"
922+ raise ValueError (msg )
921923 else :
922924 if isinstance (obj , dict ):
923925 return tuple (obj .get (n ) for n in self .names )
@@ -927,7 +929,8 @@ def toInternal(self, obj: tuple) -> tuple: # noqa: D102
927929 d = obj .__dict__
928930 return tuple (d .get (n ) for n in self .names )
929931 else :
930- raise ValueError (f"Unexpected tuple { obj !r} with StructType" )
932+ msg = f"Unexpected tuple { obj !r} with StructType"
933+ raise ValueError (msg )
931934
932935 def fromInternal (self , obj : tuple ) -> "Row" : # noqa: D102
933936 if obj is None :
@@ -1177,23 +1180,24 @@ def __contains__(self, item: Any) -> bool: # noqa: D105, ANN401
11771180 if hasattr (self , "__fields__" ):
11781181 return item in self .__fields__
11791182 else :
1180- return super (Row , self ).__contains__ (item )
1183+ return super ().__contains__ (item )
11811184
11821185 # let object acts like class
11831186 def __call__ (self , * args : Any ) -> "Row" : # noqa: ANN401
11841187 """Create new Row object."""
11851188 if len (args ) > len (self ):
1186- raise ValueError (f"Can not create Row with fields { self } , expected { len (self ):d} values but got { args } " )
1189+ msg = f"Can not create Row with fields { self } , expected { len (self ):d} values but got { args } "
1190+ raise ValueError (msg )
11871191 return _create_row (self , args )
11881192
11891193 def __getitem__ (self , item : Any ) -> Any : # noqa: D105, ANN401
11901194 if isinstance (item , (int , slice )):
1191- return super (Row , self ).__getitem__ (item )
1195+ return super ().__getitem__ (item )
11921196 try :
11931197 # it will be slow when it has many fields,
11941198 # but this will not be used in normal cases
11951199 idx = self .__fields__ .index (item )
1196- return super (Row , self ).__getitem__ (idx )
1200+ return super ().__getitem__ (idx )
11971201 except IndexError :
11981202 raise KeyError (item ) # noqa: B904
11991203 except ValueError :
0 commit comments