Skip to content

Commit

Permalink
Merge pull request #138 from moomoohk/master
Browse files Browse the repository at this point in the history
Make HumanName objects hashable
  • Loading branch information
derek73 authored Nov 14, 2022
2 parents ab8e5b5 + 3ae1f2a commit 0c78234
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name: Test the Python package

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
Expand Down
3 changes: 3 additions & 0 deletions nameparser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def __unicode__(self):
return self.collapse_whitespace(_s).strip(', ')
return " ".join(self)

def __hash__(self):
return hash(str(self))

def __str__(self):
if sys.version_info[0] >= 3:
return self.__unicode__()
Expand Down

0 comments on commit 0c78234

Please sign in to comment.