René's URL Explorer Experiment


Title: Fix leading space in surnames after capitalize() with empty middle name by patchwright · Pull Request #164 · derek73/python-nameparser · GitHub

Open Graph Title: Fix leading space in surnames after capitalize() with empty middle name by patchwright · Pull Request #164 · derek73/python-nameparser

X Title: Fix leading space in surnames after capitalize() with empty middle name by patchwright · Pull Request #164 · derek73/python-nameparser

Description: Summary After capitalize() is called on a name with any absent attribute, the corresponding *_list attribute becomes [''] instead of []. The most visible symptom is a spurious leading space in surnames (e.g. ' Doe' instead of 'Doe'). The same class of bug also affects suffix_list. Reproduction from nameparser import HumanName n = HumanName('john doe') n.capitalize() print(repr(n.surnames)) # ' Doe' <- leading space print(n.middle_list) # [''] <- should be [] print(n.title_list) # [''] <- should be [] print(n.suffix_list) # [''] <- should be [] (no suffix present) The leading space is a real observable artifact, not just an empty-list detail: downstream code that joins or compares surnames silently breaks. Cause cap_piece(...) returns '' for an absent name part. Splitting an empty string with an explicit separator always preserves a spurious empty token: ''.split(' ') → [''] ''.split(', ') → [''] whereas str.split() with no argument returns [] for an empty string. Fix Whitespace-delimited attributes (title, first, middle, last) Drop the explicit separator — bare .split() correctly returns [] for an empty string: - self.title_list = self.cap_piece(self.title, 'title').split(' ') - self.first_list = self.cap_piece(self.first, 'first').split(' ') - self.middle_list = self.cap_piece(self.middle, 'middle').split(' ') - self.last_list = self.cap_piece(self.last, 'last').split(' ') + self.title_list = self.cap_piece(self.title, 'title').split() + self.first_list = self.cap_piece(self.first, 'first').split() + self.middle_list = self.cap_piece(self.middle, 'middle').split() + self.last_list = self.cap_piece(self.last, 'last').split() Suffix suffix_list must keep its comma delimiter (suffixes are stored as "Ph.D., M.D."), so bare .split() can't be used. Instead, filter empty tokens after splitting: - self.suffix_list = self.cap_piece(self.suffix, 'suffix').split(', ') + self.suffix_list = [s for s in self.cap_piece(self.suffix, 'suffix').split(', ') if s] Tests Split the original regression test into three focused methods (normal path, force=True path, list invariants) Added test_capitalize_title_and_last_only_no_spurious_tokens — exercises empty first_list and middle_list simultaneously Added three suffix tests: empty suffix → [], single suffix, multiple suffixes Full suite: 686 tests OK (20 expected failures).

Open Graph Description: Summary After capitalize() is called on a name with any absent attribute, the corresponding *_list attribute becomes [''] instead of []. The most visible symptom is a spurious leading space...

X Description: Summary After capitalize() is called on a name with any absent attribute, the corresponding *_list attribute becomes [&#39;&#39;] instead of []. The most visible symptom is a spurious leadi...

Opengraph URL: https://github.com/derek73/python-nameparser/pull/164

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:90a99534-d72a-dd3e-a123-ce43f76e2eba
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9B10:1A7343:2BBDA7:3AE021:6A554E0C
html-safe-nonce18f80e5c03fe1ffdafd4cc1f78bfe286b4e8d12a74e12929a6a0b7e4ae53ed15
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjEwOjFBNzM0MzoyQkJEQTc6M0FFMDIxOjZBNTU0RTBDIiwidmlzaXRvcl9pZCI6IjgzOTcxMzU5NzYwNTM2NzMwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac09e1f4295cc13b68dc4b9b08ac4d6940c237a9c042bf9876314aaf9e08450aba
hovercard-subject-tagpull_request:3863581573
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/derek73/python-nameparser/pull/164/files
twitter:imagehttps://avatars.githubusercontent.com/u/292882882?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/292882882?s=400&v=4
og:image:altSummary After capitalize() is called on a name with any absent attribute, the corresponding *_list attribute becomes [''] instead of []. The most visible symptom is a spurious leading space...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecd9eea424140838b22e9eabd53d92b5702617ddd6d76efcd3a37f08d44309ca5
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/derek73/python-nameparser git https://github.com/derek73/python-nameparser.git
octolytics-dimension-user_id18306
octolytics-dimension-user_loginderek73
octolytics-dimension-repository_id18353524
octolytics-dimension-repository_nwoderek73/python-nameparser
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id18353524
octolytics-dimension-repository_network_root_nwoderek73/python-nameparser
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3084b9f587e8f1e19803bbe0c77ac77ce3c99c5c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/derek73/python-nameparser/pull/164/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fderek73%2Fpython-nameparser%2Fpull%2F164%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fderek73%2Fpython-nameparser%2Fpull%2F164%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=derek73%2Fpython-nameparser
Reloadhttps://github.com/derek73/python-nameparser/pull/164/files
Reloadhttps://github.com/derek73/python-nameparser/pull/164/files
Reloadhttps://github.com/derek73/python-nameparser/pull/164/files
derek73 https://github.com/derek73
python-nameparserhttps://github.com/derek73/python-nameparser
Notifications https://github.com/login?return_to=%2Fderek73%2Fpython-nameparser
Fork 111 https://github.com/login?return_to=%2Fderek73%2Fpython-nameparser
Star 711 https://github.com/login?return_to=%2Fderek73%2Fpython-nameparser
Code https://github.com/derek73/python-nameparser
Issues 22 https://github.com/derek73/python-nameparser/issues
Pull requests 2 https://github.com/derek73/python-nameparser/pulls
Actions https://github.com/derek73/python-nameparser/actions
Projects https://github.com/derek73/python-nameparser/projects
Wiki https://github.com/derek73/python-nameparser/wiki
Security and quality 0 https://github.com/derek73/python-nameparser/security
Insights https://github.com/derek73/python-nameparser/pulse
Code https://github.com/derek73/python-nameparser
Issues https://github.com/derek73/python-nameparser/issues
Pull requests https://github.com/derek73/python-nameparser/pulls
Actions https://github.com/derek73/python-nameparser/actions
Projects https://github.com/derek73/python-nameparser/projects
Wiki https://github.com/derek73/python-nameparser/wiki
Security and quality https://github.com/derek73/python-nameparser/security
Insights https://github.com/derek73/python-nameparser/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fderek73%2Fpython-nameparser%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fderek73%2Fpython-nameparser%2Fissues%2Fnew%2Fchoose
derek73https://github.com/derek73
derek73:masterhttps://github.com/derek73/python-nameparser/tree/master
patchwright:fix/capitalize-leading-spacehttps://github.com/patchwright/python-nameparser/tree/fix/capitalize-leading-space
Conversation 3 https://github.com/derek73/python-nameparser/pull/164
Commits 3 https://github.com/derek73/python-nameparser/pull/164/commits
Checks 5 https://github.com/derek73/python-nameparser/pull/164/checks
Files changed https://github.com/derek73/python-nameparser/pull/164/files
Please reload this pagehttps://github.com/derek73/python-nameparser/pull/164/files
Fix leading space in surnames after capitalize() with empty middle name https://github.com/derek73/python-nameparser/pull/164/files#top
Show all changes 3 commits https://github.com/derek73/python-nameparser/pull/164/files
7fbb73c Fix leading space in surnames after capitalize() with empty middle name patchwright Jun 14, 2026 https://github.com/derek73/python-nameparser/pull/164/commits/7fbb73cbdcc3f980748cf4067dd4232e5b66d500
665f148 tests: split capitalize regression test and clarify comments derek73 Jun 27, 2026 https://github.com/derek73/python-nameparser/pull/164/commits/665f148e8b1d7f4bc7f5e334a32488eeb2cc7183
06cd543 Fix spurious '' token in suffix_list after capitalize() with no suffix derek73 Jun 27, 2026 https://github.com/derek73/python-nameparser/pull/164/commits/06cd54398fd47456ea0eb9a601e67047d47fb6bd
Clear filters https://github.com/derek73/python-nameparser/pull/164/files
Please reload this pagehttps://github.com/derek73/python-nameparser/pull/164/files
Please reload this pagehttps://github.com/derek73/python-nameparser/pull/164/files
parser.py https://github.com/derek73/python-nameparser/pull/164/files#diff-03c2f987f4d661012a7843bb797f32bcbbc5126415024e3dfc7255766a95d3fe
test_capitalization.py https://github.com/derek73/python-nameparser/pull/164/files#diff-27e90bd9d313312c78b8a260c0d39a1ec9ce8ec955fc7e2fc809c7383bb901c4
nameparser/parser.pyhttps://github.com/derek73/python-nameparser/pull/164/files#diff-03c2f987f4d661012a7843bb797f32bcbbc5126415024e3dfc7255766a95d3fe
View file https://github.com/patchwright/python-nameparser/blob/06cd54398fd47456ea0eb9a601e67047d47fb6bd/nameparser/parser.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/derek73/python-nameparser/pull/164/{{ revealButtonHref }}
https://github.com/derek73/python-nameparser/pull/164/files#diff-03c2f987f4d661012a7843bb797f32bcbbc5126415024e3dfc7255766a95d3fe
https://github.com/derek73/python-nameparser/pull/164/files#diff-03c2f987f4d661012a7843bb797f32bcbbc5126415024e3dfc7255766a95d3fe
tests/test_capitalization.pyhttps://github.com/derek73/python-nameparser/pull/164/files#diff-27e90bd9d313312c78b8a260c0d39a1ec9ce8ec955fc7e2fc809c7383bb901c4
View file https://github.com/patchwright/python-nameparser/blob/06cd54398fd47456ea0eb9a601e67047d47fb6bd/tests/test_capitalization.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/derek73/python-nameparser/pull/164/{{ revealButtonHref }}
https://github.com/derek73/python-nameparser/pull/164/files#diff-27e90bd9d313312c78b8a260c0d39a1ec9ce8ec955fc7e2fc809c7383bb901c4
https://github.com/derek73/python-nameparser/pull/164/files#diff-27e90bd9d313312c78b8a260c0d39a1ec9ce8ec955fc7e2fc809c7383bb901c4
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.