Skip to content

Commit ced8e29

Browse files
committed
Improve docstrings of Lang and is_language
1 parent 5e0d029 commit ced8e29

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

iso639/iso639.py

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from operator import itemgetter
2-
from typing import Dict, Iterator, List, Optional, Union, Set, Tuple
31
from functools import lru_cache
2+
from operator import itemgetter
3+
from typing import Dict, Iterator, List, Optional, Set, Tuple, Union
44

55
from .datafile import load_file
66
from .exceptions import DeprecatedLanguageValue, InvalidLanguageValue
@@ -15,23 +15,50 @@ class Lang(tuple):
1515
1616
...
1717
18+
Parameters
19+
----------
20+
name_or_identifier : str or Lang, optional
21+
ISO 639 identifier or name, by default None.
22+
name : str, optional
23+
ISO 639 name (or other name), by default None.
24+
pt1 : str, optional
25+
Two-letter ISO 639-1 identifier, by default None.
26+
pt2b : str, optional
27+
Three-letter ISO 639-2/B identifier for bibliographic applications, by
28+
default None.
29+
pt2t : str, optional
30+
Three-letter ISO 639-2/T identifier for terminology applications, by
31+
default None.
32+
pt3 : str, optional
33+
Three-letter ISO 639-3 identifier, by default None.
34+
pt5 : str, optional
35+
Three-letter ISO 639-5 identifier, by default None.
36+
37+
Raises
38+
------
39+
InvalidLanguageValue
40+
Raised when the arguments are not valid and compatible.
41+
DeprecatedLanguageValue
42+
Raised when the arguments point to a deprecated ISO 639 language name
43+
or identifier.
44+
1845
Attributes
1946
----------
2047
name : str
2148
ISO 639-3 reference name for languages, ISO 639-5 English name for
2249
groups of languages.
2350
pt1 : str
24-
two-letter ISO 639-1 identifier, if there is one.
51+
Two-letter ISO 639-1 identifier, if there is one.
2552
pt2b : str
26-
three-letter ISO 639-2/B identifier for bibliographic applications, if
27-
there is one
53+
Three-letter ISO 639-2/B identifier for bibliographic applications, if
54+
there is one.
2855
pt2t : str
29-
three-letter ISO 639-2/T identifier for terminology applications,
30-
if there is one
56+
Three-letter ISO 639-2/T identifier for terminology applications,
57+
if there is one.
3158
pt3 : str
32-
three-letter ISO 639-3 identifier, if there is one
59+
Three-letter ISO 639-3 identifier, if there is one.
3360
pt5 : str
34-
three-letter ISO 639-5 identifier, if there is one
61+
Three-letter ISO 639-5 identifier, if there is one.
3562
3663
Examples
3764
--------
@@ -403,7 +430,7 @@ def is_language(
403430
----------
404431
value : str
405432
The language value to validate.
406-
identifiers_or_names : Union[str, Tuple[str, ...]], optional
433+
identifiers_or_names : str or tuple of str, optional
407434
The ISO 639 identifiers or names to check against. Defaults to all
408435
available identifiers and names.
409436

0 commit comments

Comments
 (0)