forked from conda/conda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start using doctests in test runs and coverage
- Loading branch information
Showing
4 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,8 +55,11 @@ def urlparse(url): | |
|
||
|
||
def url_to_s3_info(url): | ||
""" | ||
Convert a S3 url to a tuple of bucket and key | ||
"""Convert an s3 url to a tuple of bucket and key. | ||
Examples: | ||
>>> url_to_s3_info("s3://bucket-name.bucket/here/is/the/key") | ||
('bucket-name.bucket', '/here/is/the/key') | ||
""" | ||
parsed_url = parse_url(url) | ||
assert parsed_url.scheme == 's3', "You can only use s3: urls (not %r)" % url | ||
|
@@ -213,7 +216,7 @@ def is_windows_path(value): | |
@memoize | ||
def get_proxy_username_and_pass(scheme): | ||
username = input("\n%s proxy username: " % scheme) | ||
passwd = getpass("Password:") | ||
passwd = getpass("Password: ") | ||
return username, passwd | ||
|
||
|
||
|
@@ -224,7 +227,15 @@ def add_username_and_password(url, username, password): | |
|
||
|
||
def maybe_add_auth(url, auth, force=False): | ||
"""add auth if the url doesn't currently have it""" | ||
"""Add auth if the url doesn't currently have it. | ||
By default, does not replace auth if it already exists. Setting ``force`` to ``True`` | ||
overrides this behavior. | ||
Examples: | ||
>>> maybe_add_auth("https://www.conda.io", "user:passwd") | ||
'https://user:[email protected]' | ||
""" | ||
if not auth: | ||
return url | ||
url_parts = urlparse(url)._asdict() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters