Skip to content

Commit 549690e

Browse files
committed
Remove dead check in _process_initial
str.split(" ") always returns a non-empty list, so the `len(parts) and isinstance(parts, list)` guard could never be false.
1 parent 89a6877 commit 549690e

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

nameparser/parser.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,9 @@ def _process_initial(self, name_part: str, firstname: bool = False) -> str:
264264
"""
265265
parts = name_part.split(" ")
266266
initials = []
267-
if len(parts) and isinstance(parts, list):
268-
for part in parts:
269-
if not (self.is_prefix(part) or self.is_conjunction(part)) or firstname:
270-
initials.append(part[0])
267+
for part in parts:
268+
if not (self.is_prefix(part) or self.is_conjunction(part)) or firstname:
269+
initials.append(part[0])
271270
if len(initials) > 0:
272271
return self.initials_separator.join(initials)
273272
# Return '' (never empty_attribute_default, which may be None) when a

0 commit comments

Comments
 (0)