123456789101112131415161718192021222324252627282930313233343536373839404142 |
- # -*- coding: utf-8 -*-
- # @Time : 2023/8/14 14:49
- # @Author : XuJiakai
- # @File : base_utils
- # @Software: PyCharm
- import json
- import platform
- def is_windows():
- if platform.system() == "Windows":
- return True
- return False
- def get_or_none(json: dict, key: str):
- if not json:
- return None
- if key not in json:
- return None
- return json[key]
- pass
- def parse_env_and_name(val, env):
- if '.' in val:
- tmp = val.split('.')
- env = tmp[0]
- val = tmp[1]
- return env, val
- def to_string(obj, is_format=True):
- if is_format:
- return json.dumps(obj, indent=4, ensure_ascii=False, sort_keys=True)
- else:
- return json.dumps(obj, ensure_ascii=False, sort_keys=True)
- pass
- if __name__ == '__main__':
- pass
|