# Path: pale/arguments/string.py
# class StringListArgument(ListArgument):
#     """StringListArgument is a special case of ListArgument that allows for
#     passing in a single string as the argument, and using a separator to split
#     it into a list."""
#     allowed_types = (list, tuple, str, unicode)
#     list_item_type = StringArgument('String list')
# 
#     def __init__(self, *args, **kwargs):
#         self.separator = kwargs.pop('separator', ' ')
#         self.trim_whitespace = kwargs.pop('trim_whitespace', False)
#         super(StringListArgument, self).__init__(*args, **kwargs)
# 
#     def validate(self, item_list, item_name):
#         if item_list is None:
#             item_list = self.default
# 
#         if isinstance(item_list, (str, unicode)):
#             item_list = item_list.split(self.separator)
#         elif isinstance(item_list, list) and len(item_list) == 1:
#             # Separate QS strings which come in as a single list.
#             if isinstance(item_list[0], basestring) and self.separator in item_list[0]:
#                 item_list = item_list[0].split(self.separator)
# 
#         if self.trim_whitespace:
#             item_list = [ item.strip() for item in item_list ]
# 
#         # list validation
#         item_list = super(StringListArgument, self).validate(item_list,
#                                                              item_name)
#         if item_list is not None:
#             item_list = [unicode(val) for val in item_list]
#         return item_list


from pale.arguments.string import StringListArgument

class ScopeArgument(StringListArgument):
    """A field for OAuth 2.0 Scope strings.

    This is basically just a space-separated string list"""

    def __init__(self, *args, **kwargs):
        kwargs['separator'] = ' '

# Path: pale/arguments/string.py
# class StringListArgument(ListArgument):
#     """StringListArgument is a special case of ListArgument that allows for
#     passing in a single string as the argument, and using a separator to split
#     it into a list."""
#     allowed_types = (list, tuple, str, unicode)
#     list_item_type = StringArgument('String list')
# 
#     def __init__(self, *args, **kwargs):
#         self.separator = kwargs.pop('separator', ' ')
#         self.trim_whitespace = kwargs.pop('trim_whitespace', False)
#         super(StringListArgument, self).__init__(*args, **kwargs)
# 
#     def validate(self, item_list, item_name):
#         if item_list is None:
#             item_list = self.default
# 
#         if isinstance(item_list, (str, unicode)):
#             item_list = item_list.split(self.separator)
#         elif isinstance(item_list, list) and len(item_list) == 1:
#             # Separate QS strings which come in as a single list.
#             if isinstance(item_list[0], basestring) and self.separator in item_list[0]:
#                 item_list = item_list[0].split(self.separator)
# 
#         if self.trim_whitespace:
#             item_list = [ item.strip() for item in item_list ]
# 
#         # list validation
#         item_list = super(StringListArgument, self).validate(item_list,
#                                                              item_name)
#         if item_list is not None:
#             item_list = [unicode(val) for val in item_list]
#         return item_list


# Path: pale/arguments/scope.py
from pale.arguments.string import StringListArgument


class ScopeArgument(StringListArgument):
    """A field for OAuth 2.0 Scope strings.

    This is basically just a space-separated string list"""

    def __init__(self, *args, **kwargs):
        kwargs['separator'] = ' '

        super(ScopeArgument, self).__init__(*args, **kwargs)