Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
98edfc6
WIP DecodedURL with path and replace
mahmoud Dec 17, 2017
dce971b
DecodedURL.replace(query) and DecodedURL.query working. Fix up userin…
mahmoud Dec 18, 2017
2162c67
DecodedURL userinfo now working
mahmoud Dec 18, 2017
d1bfc68
add new arguments to _percent_decode and use them in the DecodedURL
mahmoud Dec 30, 2017
adc7370
added DecodedURL to the public API, started on tests, added DecodedUR…
mahmoud Dec 31, 2017
fc28ee3
add host and port to DecodedURL
mahmoud Dec 31, 2017
358402f
add DecodedURL.scheme property, plus some more tests
mahmoud Dec 31, 2017
34d4212
add and test a bunch of DecodedURL passthrough methods
mahmoud Dec 31, 2017
161e93a
test DecodedURL userinfo-related properties. Add generic percent enco…
mahmoud Dec 31, 2017
95ea9ea
add, test, and slightly refactor query manipulation methods. still pr…
mahmoud Dec 31, 2017
976c083
fix and test the aforementioned issue with query parameters which are…
mahmoud Dec 31, 2017
02a841c
bit of housekeeping on DecodedURL, rearranging and adding a couple mi…
mahmoud Dec 31, 2017
9a0438e
DecodedURL: made .query a tuple. more obvious errors on attempted mut…
mahmoud Dec 31, 2017
662ec79
DecodedURL.replace() now fixed and tested working for roundtripping U…
mahmoud Dec 31, 2017
3aa4b61
add some Twisted-style methods to DecodedURL for consistency with URL…
mahmoud Dec 31, 2017
82deb29
some notes and docs on DecodedURL
mahmoud Dec 31, 2017
0b311d7
split out host decoding to its own function, remove duplicated code
mahmoud Jan 1, 2018
30e19a6
fix delimiter typo in docstring, thanks alex!
mahmoud Jan 1, 2018
696e8fd
add parse convenience function and EncodedURL alias for URL to top-le…
mahmoud Jan 1, 2018
67ab0ec
add lazy keyword to DecodedURL methods where appropriate. Add some co…
mahmoud Jan 1, 2018
6a90f4a
DecodedURL pretty much fully covered by tests
mahmoud Jan 6, 2018
ad63b9b
docstrings for all DecodedURL members
mahmoud Jan 6, 2018
afc907b
cover another line in _percent_decode
mahmoud Jan 6, 2018
9f3212b
Merge branch 'master' into i44_decoded_url
mahmoud Jan 6, 2018
ac3be79
fixing test coverage for parse
mahmoud Jan 6, 2018
dd8248c
Merge branch 'i44_decoded_url' of github.com:python-hyper/hyperlink i…
mahmoud Jan 6, 2018
6dd3272
DecodedURL: address most of the comments about docstrings
mahmoud Jan 7, 2018
e8616fa
add a few more DecodedURL/parse tests and a couple comments
mahmoud Jan 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add lazy keyword to DecodedURL methods where appropriate. Add some co…
…verage-oriented tests. Remove the password attributes of DecodedURL pending future discussion.
  • Loading branch information
mahmoud committed Jan 1, 2018
commit 67ab0ec2c2f05ed8c0b003cbbd1a3b6528949682
15 changes: 4 additions & 11 deletions hyperlink/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -1519,9 +1519,9 @@ def __init__(self, url, lazy=False):
return

@classmethod
def from_text(cls, text):
def from_text(cls, text, lazy=False):
_url = URL.from_text(text)
return cls(_url)
return cls(_url, lazy=lazy)

@property
def encoded_url(self):
Expand Down Expand Up @@ -1622,13 +1622,6 @@ def userinfo(self):
def user(self):
return self.userinfo[0]

@property
def password(self):
try:
return self.userinfo[1]
except IndexError:
return None

@property
def uses_netloc(self):
return self._url.uses_netloc
Expand Down Expand Up @@ -1711,8 +1704,8 @@ def __hash__(self):
asIRI = to_iri

@classmethod

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this its own classmethod when the instance methods are aliased?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twisted-style single character argument name copied for consistency with URL.

def fromText(cls, s):
return cls.from_text(s)
def fromText(cls, s, lazy=False):
return cls.from_text(s, lazy=lazy)

def asText(self, includeSecrets=False):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twisted-style camelCase argument name.

return self.to_text(with_password=includeSecrets)
Expand Down
8 changes: 7 additions & 1 deletion hyperlink/test/test_decoded_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def test_durl_basic():
assert durl.get('zot') == ['23%']

assert durl.user == 'user'
assert durl.password == '\0\0\0\0'
assert durl.userinfo == ('user', '\0\0\0\0')


Expand All @@ -37,6 +36,8 @@ def test_passthroughs():
durl = DecodedURL.from_text(TOTAL_URL)
assert durl.sibling('te%t').path[-1] == 'te%t'
assert durl.child('../test2%').path[-1] == '../test2%'
assert durl.child() == durl
assert durl.child() is durl
assert durl.click('/').path[-1] == ''
assert durl.user == 'user'

Expand All @@ -51,6 +52,11 @@ def test_passthroughs():
assert durl.absolute
assert durl.rooted

assert durl == durl.encoded_url.get_decoded_url()

durl2 = DecodedURL.from_text(TOTAL_URL, lazy=True)
assert durl2 == durl2.encoded_url.get_decoded_url(lazy=True)


def test_repr():
durl = DecodedURL.from_text(TOTAL_URL)
Expand Down