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

Class GlossaryInfo

deepl/api_data.py:588–663  ·  view source on GitHub ↗

Information about a glossary, excluding the entry list. GlossaryInfo is compatible with the /v2 glossary endpoints and can only support mono-lingual glossaries (e.g. a glossary with only one source and target language defined). :param glossary_id: Unique ID assigned to the glossary.

Source from the content-addressed store, hash-verified

586
587
588class GlossaryInfo:
589 """Information about a glossary, excluding the entry list. GlossaryInfo
590 is compatible with the /v2 glossary endpoints and can only support
591 mono-lingual glossaries (e.g. a glossary with only one source and
592 target language defined).
593
594 :param glossary_id: Unique ID assigned to the glossary.
595 :param name: User-defined name assigned to the glossary.
596 :param ready: True iff the glossary may be used for translations.
597 :param source_lang: Source language code of the glossary.
598 :param target_lang: Target language code of the glossary.
599 :param creation_time: Timestamp when the glossary was created.
600 :param entry_count: The number of entries contained in the glossary.
601 """
602
603 def __init__(
604 self,
605 glossary_id: str,
606 name: str,
607 ready: bool,
608 source_lang: str,
609 target_lang: str,
610 creation_time: datetime.datetime,
611 entry_count: int,
612 ):
613 self._glossary_id = glossary_id
614 self._name = name
615 self._ready = ready
616 self._source_lang = source_lang
617 self._target_lang = target_lang
618 self._creation_time = creation_time
619 self._entry_count = entry_count
620
621 def __str__(self) -> str:
622 return f'Glossary "{self.name}" ({self.glossary_id})'
623
624 @staticmethod
625 def from_json(json) -> "GlossaryInfo":
626 """Create GlossaryInfo from the given API JSON object."""
627 return GlossaryInfo(
628 json["glossary_id"],
629 json["name"],
630 bool(json["ready"]),
631 str(json["source_lang"]).upper(),
632 str(json["target_lang"]).upper(),
633 parse_timestamp(json["creation_time"]),
634 int(json["entry_count"]),
635 )
636
637 @property
638 def glossary_id(self) -> str:
639 return self._glossary_id
640
641 @property
642 def name(self) -> str:
643 return self._name
644
645 @property

Callers 1

from_jsonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected