File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed
sagemaker-core/src/sagemaker/core/modules/train/container_drivers/common Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -124,23 +124,15 @@ def safe_deserialize(data: Any) -> Any:
124124
125125 This function handles the following cases:
126126 1. If `data` is not a string, it returns the input as-is.
127- 2. If `data` is a string and matches common boolean values ("true" or "false"),
128- it returns the corresponding boolean value (True or False).
129- 3. If `data` is a JSON-encoded string, it attempts to deserialize it using `json.loads()`.
130- 4. If `data` is a string but cannot be decoded as JSON, it returns the original string.
127+ 2. If `data` is a JSON-encoded string, it attempts to deserialize it using `json.loads()`.
128+ 3. If `data` is a string but cannot be decoded as JSON, it returns the original string.
131129
132130 Returns:
133131 Any: The deserialized data, or the original input if it cannot be JSON-decoded.
134132 """
135133 if not isinstance (data , str ):
136134 return data
137135
138- lower_data = data .lower ()
139- if lower_data in ["true" ]:
140- return True
141- if lower_data in ["false" ]:
142- return False
143-
144136 try :
145137 return json .loads (data )
146138 except json .JSONDecodeError :
You can’t perform that action at this time.
0 commit comments