Skip to content

Commit

Permalink
Raise an error if the type is not a string.
Browse files Browse the repository at this point in the history
Raise an TypeError if the type of given argument is not a string.
  • Loading branch information
hobbestigrou committed Aug 20, 2019
1 parent 459e91e commit f9dafae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/ansible/parsing/dataloader.py
Expand Up @@ -173,14 +173,14 @@ def set_basedir(self, basedir):
def path_dwim(self, given):
"""Make relative paths work like folks expect.
:parama given: The path
:param given: The path
:type data: str
:return: The modify path
:rtype: str
"""
if not isinstance(given, string_types):
return given
raise TypeError('The type of the given argument must be a string')

given = unquote(given)
given = to_text(given, errors='surrogate_or_strict')
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/parsing/quoting.py
Expand Up @@ -34,7 +34,7 @@ def unquote(data):
"""Removes first and last quotes from a string, if the string starts and
ends with the same quotes.
:parama data: The string to modify
:param data: The string to modify
:type data: str
:return: The string without quotes
Expand Down

0 comments on commit f9dafae

Please sign in to comment.