feat: add given_names attribute (closes #157)#180
Merged
Conversation
…loses #157) Adds given_names (and given_names_list), the first name followed by all middle names, mirroring the existing surnames attribute (middle + last). Reimplemented fresh on current master from the approach in #157, which was based on a pre-refactor codebase and had drifted. Co-Authored-By: fdesoye <fdesoye@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…attern in AGENTS.md Covers the `or self.C.empty_attribute_default` branch (untested before this commit) and the no-middle boundary case. Also adds a note to AGENTS.md reminding future contributors to include an empty-path test for any new aggregate property. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
given_namesattribute (andgiven_names_list) that returns the first name followed by all middle names — the given-name counterpart to the existingsurnamesattribute (middle + last). The two aggregates deliberately overlap onmiddle, as convenience views over the parse buckets.Reimplemented fresh on current
masterrather than merging #157, which was based on a pre-refactor codebase (pre type-hints,tests.pymonolith,__unicode__) and had drifted into mostly-unrelated style churn. Supersedes and closes #157; credit to @fdesoye for the original feature and naming idea. Namedgiven_names/given_names_list(plural) to parallelsurnames/surnames_list.Changes
nameparser/parser.py—given_names_list+given_namesproperties; added to the class docstring attribute listtests/test_python_api.py— two tests paralleling thesurnamestests (written test-first)docs/usage.rst— agiven_namesdoctest beside thesurnamesexampledocs/release_log.rst— Unreleased entryVerification
uv run pytest— 829 passed, 0 failed (dual fixture also coversempty_attribute_default=None)uv run mypy nameparser/— cleanuv run ruff check nameparser/ tests/— cleanCloses #157
🤖 Generated with Claude Code