Skip to content

Commit 38b8dcb

Browse files
derek73claude
andcommitted
style: ParsedName repr indents with 4 spaces, matching HumanName's
The facade (and v1.4 before it) already indent the multi-line repr body with 4 spaces; ParsedName was the lone tab hold-out. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 17efbbe commit 38b8dcb

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

nameparser/_types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,15 @@ def __str__(self) -> str:
297297
return self.render()
298298

299299
def __repr__(self) -> str:
300+
# 4-space indent, matching HumanName's repr (v1 style)
300301
lines = []
301302
for role in Role:
302303
text = self._text_for(role)
303304
if text:
304-
lines.append(f"\t{role.value}: {text!r}")
305+
lines.append(f" {role.value}: {text!r}")
305306
if self.ambiguities:
306307
kinds = [a.kind.value for a in self.ambiguities]
307-
lines.append(f"\tambiguities: {kinds!r}")
308+
lines.append(f" ambiguities: {kinds!r}")
308309
body = "\n".join(lines)
309310
return f"<ParsedName: [\n{body}\n]>" if lines else "<ParsedName: []>"
310311

tests/v2/test_reprs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_parsedname_repr_lists_nonempty_fields_in_canonical_order() -> None:
2323
Token("Smith", Span(5, 10), Role.FAMILY),
2424
))
2525
assert repr(pn) == (
26-
"<ParsedName: [\n\tgiven: 'John'\n\tfamily: 'Smith'\n]>"
26+
"<ParsedName: [\n given: 'John'\n family: 'Smith'\n]>"
2727
)
2828

2929

0 commit comments

Comments
 (0)