MCPcopy Index your code
hub / github.com/DeepL/deepl-python / from_json

Method from_json

deepl/api_data.py:943–967  ·  view source on GitHub ↗

Create StyleRuleInfo from the given API JSON object.

(json)

Source from the content-addressed store, hash-verified

941
942 @staticmethod
943 def from_json(json) -> "StyleRuleInfo":
944 """Create StyleRuleInfo from the given API JSON object."""
945 configured_rules_data = json.get("configured_rules")
946 configured_rules = None
947 if configured_rules_data:
948 configured_rules = ConfiguredRules.from_json(configured_rules_data)
949
950 custom_instructions_data = json.get("custom_instructions")
951 custom_instructions = None
952 if custom_instructions_data:
953 custom_instructions = [
954 CustomInstruction.from_json(instruction)
955 for instruction in custom_instructions_data
956 ]
957
958 return StyleRuleInfo(
959 style_id=json["style_id"],
960 name=json["name"],
961 creation_time=parse_timestamp(json["creation_time"]),
962 updated_time=parse_timestamp(json["updated_time"]),
963 language=json["language"],
964 version=json["version"],
965 configured_rules=configured_rules,
966 custom_instructions=custom_instructions,
967 )
968
969 @property
970 def style_id(self) -> str:

Callers

nothing calls this directly

Calls 3

parse_timestampFunction · 0.90
StyleRuleInfoClass · 0.85
from_jsonMethod · 0.45

Tested by

no test coverage detected