nebius/SWE-bench-extra huggingface dataset:
Repository: package-url/packageurl-python

Issue:
PackageURL type is not hashable
Storing `PackageURL` instances in a set can be useful. Currently attempting this fails with the following error:

```
Python 3.8.2 (default, Feb 26 2020, 22:21:03) 
[GCC 9.2.1 20200130] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from packageurl import PackageURL
>>> {PackageURL(name='test', type='pypi')}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'collections.OrderedDict'
```

Comments:

Patch:
diff --git a/src/packageurl/__init__.py b/src/packageurl/__init__.py
index 71225e9..ae6e148 100644
--- a/src/packageurl/__init__.py
+++ b/src/packageurl/__init__.py
@@ -282,6 +282,9 @@ class PackageURL(namedtuple('PackageURL', _components)):
     def __str__(self, *args, **kwargs):
         return self.to_string()
 
+    def __hash__(self):
+        return hash(self.to_string())
+
     def to_dict(self, encode=False):
         """
         Return an ordered dict of purl components as {key: value}. If `encode`


Test patch:
diff --git a/tests/test_packageurl.py b/tests/test_packageurl.py
index 912b380..6081912 100644
--- a/tests/test_packageurl.py
+++ b/tests/test_packageurl.py
@@ -286,3 +286,9 @@ class NormalizePurlTest(unittest.TestCase):
             ('subpath', u'this/is/a/path')
         ])
         assert expected == purl.to_dict(encode=True)
+
+
+def test_purl_is_hashable():
+    s = {PackageURL(name='hashable', type='pypi')}
+    assert len(s) == 1
+