Skip to content

Commit 4e657a8

Browse files
derek73claude
andcommitted
docs: name_order states its valid values and comma-input scope
Verified: assign consults name_order only for the NO_COMMA structure; 'Yamamoto, Haruki' takes family from the comma format with name_order never read. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent d7df3ce commit 4e657a8

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

docs/customize.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ listed below.
6565
- Assigns positional (no-comma) input to given/middle/family in
6666
this order. Use the exported ``GIVEN_FIRST`` (default),
6767
``FAMILY_FIRST``, or ``FAMILY_FIRST_GIVEN_LAST`` constants.
68+
Ignored for comma-format input ("Yamamoto, Haruki"), which
69+
states its own order.
6870
* - ``patronymic_rules``
6971
- ``frozenset[PatronymicRule]``
7072
- Reorders patronymic-shaped names via opt-in detectors — East

nameparser/_policy.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ class Policy:
6464
only what you change -- ``Policy(maiden_delimiters={("(", ")")})``
6565
-- and pass the result to ``Parser(policy=...)``."""
6666

67-
#: How positional (no-comma) input maps onto given/middle/family;
68-
#: one of the exported GIVEN_FIRST (default), FAMILY_FIRST,
69-
#: FAMILY_FIRST_GIVEN_LAST orders.
67+
#: How positional (no-comma) input maps onto given/middle/family.
68+
#: Valid values are exactly the three exported constants --
69+
#: GIVEN_FIRST (the default), FAMILY_FIRST, and
70+
#: FAMILY_FIRST_GIVEN_LAST; any other tuple of Roles raises
71+
#: ValueError. Ignored when the input contains a comma:
72+
#: comma-format input ("Yamamoto, Haruki") states its own order
73+
#: explicitly.
7074
name_order: tuple[Role, Role, Role] = GIVEN_FIRST
7175
#: Opt-in detectors that reorder patronymic-shaped names
7276
#: (EAST_SLAVIC, TURKIC); usually set via a locale pack.

0 commit comments

Comments
 (0)