mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
I think it will always be valid. (remove Deserializable.check_json)
This commit is contained in:
parent
5853973db8
commit
9e894cf06b
36 changed files with 0 additions and 86 deletions
|
|
@ -102,22 +102,6 @@ class Deserializable:
|
|||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@staticmethod
|
||||
def check_json(raw_data) -> dict:
|
||||
"""
|
||||
Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is.
|
||||
If it is not, it is converted to a dict by means of json.loads(json_type)
|
||||
:param raw_data:
|
||||
:return:
|
||||
"""
|
||||
|
||||
if isinstance(raw_data, dict):
|
||||
return raw_data
|
||||
elif isinstance(raw_data, str):
|
||||
return json.loads(raw_data)
|
||||
else:
|
||||
raise ValueError("data should be a json dict or string.")
|
||||
|
||||
def __str__(self):
|
||||
return str(self.to_json())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue