Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor bug in utils.py #642

Open
bkreider opened this issue Mar 29, 2023 · 0 comments
Open

minor bug in utils.py #642

bkreider opened this issue Mar 29, 2023 · 0 comments

Comments

@bkreider
Copy link
Contributor

bkreider commented Mar 29, 2023

Utils.py has an error when calling parse_specs() that can be fixed with the following diff.

Error

p = parse_specs("bkreider/foo/1.2.3/blah-1.2.3.tar.bz2?x=1")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [131], in <cell line: 1>()
----> 1 p = parse_specs("bkreider/foo/1.2.3/blah-1.2.3.tar.bz2?x=1")

File /opt/anaconda/lib/python3.9/site-packages/binstar_client/utils/spec.py:88, in parse_specs(spec)
     86 if basename and '?' in basename:
     87     basename, qsl = basename.rsplit('?', 1)
---> 88     attrs = dict(urlparse.parse_qsl(qsl))
     90 return PackageSpec(user, package, version, basename, attrs, spec)

AttributeError: 'function' object has no attribute 'parse_qsl'

Test case

Tested like this:

import binstar_client.utils.spec
binstar_client.utils.spec.parse_specs("bkreider/foo/1.2.3/blah-1.2.3.tar.bz2?x=1")

fix

diff --git a/binstar_client/utils/spec.py b/binstar_client/utils/spec.py
index 7cbd30d..c4a2cfd 100644
--- a/binstar_client/utils/spec.py
+++ b/binstar_client/utils/spec.py
@@ -1,4 +1,4 @@
-from six.moves.urllib.parse import urlparse
+from six.moves.urllib import parse
 
 from binstar_client.errors import UserError
 
@@ -85,7 +85,7 @@ def parse_specs(spec):
 
     if basename and '?' in basename:
         basename, qsl = basename.rsplit('?', 1)
-        attrs = dict(urlparse.parse_qsl(qsl))
+        attrs = dict(parse.parse_qsl(qsl))
 
     return PackageSpec(user, package, version, basename, attrs, spec)
 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant