[utils] Introduce expand_path

This commit is contained in:
Sergey M․ 2017-03-26 02:30:10 +07:00
parent fb4fc44928
commit 51098426b8
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D
2 changed files with 16 additions and 0 deletions

View file

@ -39,6 +39,7 @@ from .compat import (
compat_basestring,
compat_chr,
compat_etree_fromstring,
compat_expanduser,
compat_html_entities,
compat_html_entities_html5,
compat_http_client,
@ -539,6 +540,11 @@ def sanitized_Request(url, *args, **kwargs):
return compat_urllib_request.Request(sanitize_url(url), *args, **kwargs)
def expand_path(s):
"""Expand shell variables and ~"""
return os.path.expandvars(compat_expanduser(s))
def orderedSet(iterable):
""" Remove all duplicates from the input iterable """
res = []