File tree Expand file tree Collapse file tree 2 files changed +18
-17
lines changed Expand file tree Collapse file tree 2 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,8 @@ class PlexObject:
5454 initpath (str): Relative path requested when retrieving specified `data` (optional).
5555 parent (:class:`~plexapi.base.PlexObject`): The parent object that this object is built from (optional).
5656 """
57- TAG : Optional [str ] = None # xml element tag
58- TYPE : Optional [str ] = None # xml element type
57+ TAG : Optional [str ] = None # xml element tag
58+ TYPE : Optional [str ] = None # xml element type
5959 key : Optional [str ] = None # plex relative url
6060 _INCLUDES = {
6161 'checkFiles' : 1 ,
Original file line number Diff line number Diff line change @@ -171,21 +171,22 @@ def cast(
171171 func (func): Callback function to used cast to type (int, bool, float).
172172 value (any): value to be cast and returned.
173173 """
174- if value is None :
175- return value
176- if func == bool :
177- if value in (1 , True , "1" , "true" ):
178- return True
179- if value in (0 , False , "0" , "false" ):
180- return False
181- raise ValueError (value )
182-
183- if func in (int , float ):
184- try :
185- return func (value )
186- except ValueError :
187- return float ('nan' )
188- return func (value )
174+ if value is not None :
175+ if func == bool :
176+ if value in (1 , True , "1" , "true" ):
177+ return True
178+ elif value in (0 , False , "0" , "false" ):
179+ return False
180+ else :
181+ raise ValueError (value )
182+
183+ elif func in (int , float ):
184+ try :
185+ return func (value )
186+ except ValueError :
187+ return float ('nan' )
188+ return func (value )
189+ return value
189190
190191
191192def joinArgs (args ):
You can’t perform that action at this time.
0 commit comments