# Path: mapmyfitness/validators/base.py
# class BaseValidator(object):
#     privacy_options = (PUBLIC, PRIVATE, FRIENDS)
# 
#     def type_or_types_to_str(self, type_or_types):
#         def repr_to_str(repr):
#             return repr.split(" '")[1].split("'>")[0]
#         if isinstance(type_or_types, (list, tuple)):
#             types = []
#             for repr in type_or_types:
#                 types.append(repr_to_str(str(repr)))
#             return ' or '.join(types)
#         else:
#             return repr_to_str(str(type_or_types))
# 
#     def __init__(self, create_obj=None, search_kwargs=None):
#         if create_obj is None and search_kwargs is None:
#             raise ValidatorException('Either create_obj or search_kwargs must be passed when instantiating a validator.')
#         if create_obj is not None:
#             self.create_obj = create_obj
#         else:  # search_kwargs is not None
#             self.search_kwargs = search_kwargs
#         self.errors = []
# 
#         if hasattr(self, 'create_obj'):
#             self.validate_create()
#         else:  # hasattr(self, 'search_kwargs')
#             self.validate_search()
# 
#     def add_error(self, error):
#         if error not in self.errors:
#             self.errors.append(error)
# 
#     @property
#     def valid(self):
#         return len(self.errors) == 0
# 
#     def validate_create(self):
#         """This should be overridden by subclasses of BaseValidator"""
# 
#     def validate_search(self):
#         """This should be overridden by subclasses of BaseValidator"""
# 
#     def __repr__(self):
#         if len(self.errors):
#             return ' '.join(self.errors)


from .base import BaseValidator


class UserValidator(BaseValidator):
    def validate_search(self):
        search_kwargs = self.search_kwargs

        if 'friends_with' not in search_kwargs and 'requested_friendship_with' not in search_kwargs and 'suggested_friends_for' not in search_kwargs:
            self.add_error('Either a friends_with, requested_friendship_with or suggested_friends_for argument must be passed to search for users.')
            return

        if 'friends_with' in search_kwargs:
            if not isinstance(search_kwargs['friends_with'], int):
                self.add_error('User friends_with must be of type int.')

# Path: mapmyfitness/validators/base.py
# class BaseValidator(object):
#     privacy_options = (PUBLIC, PRIVATE, FRIENDS)
# 
#     def type_or_types_to_str(self, type_or_types):
#         def repr_to_str(repr):
#             return repr.split(" '")[1].split("'>")[0]
#         if isinstance(type_or_types, (list, tuple)):
#             types = []
#             for repr in type_or_types:
#                 types.append(repr_to_str(str(repr)))
#             return ' or '.join(types)
#         else:
#             return repr_to_str(str(type_or_types))
# 
#     def __init__(self, create_obj=None, search_kwargs=None):
#         if create_obj is None and search_kwargs is None:
#             raise ValidatorException('Either create_obj or search_kwargs must be passed when instantiating a validator.')
#         if create_obj is not None:
#             self.create_obj = create_obj
#         else:  # search_kwargs is not None
#             self.search_kwargs = search_kwargs
#         self.errors = []
# 
#         if hasattr(self, 'create_obj'):
#             self.validate_create()
#         else:  # hasattr(self, 'search_kwargs')
#             self.validate_search()
# 
#     def add_error(self, error):
#         if error not in self.errors:
#             self.errors.append(error)
# 
#     @property
#     def valid(self):
#         return len(self.errors) == 0
# 
#     def validate_create(self):
#         """This should be overridden by subclasses of BaseValidator"""
# 
#     def validate_search(self):
#         """This should be overridden by subclasses of BaseValidator"""
# 
#     def __repr__(self):
#         if len(self.errors):
#             return ' '.join(self.errors)


# Path: mapmyfitness/validators/user.py
from .base import BaseValidator



class UserValidator(BaseValidator):
    def validate_search(self):
        search_kwargs = self.search_kwargs

        if 'friends_with' not in search_kwargs and 'requested_friendship_with' not in search_kwargs and 'suggested_friends_for' not in search_kwargs:
            self.add_error('Either a friends_with, requested_friendship_with or suggested_friends_for argument must be passed to search for users.')
            return

        if 'friends_with' in search_kwargs:
            if not isinstance(search_kwargs['friends_with'], int):
                self.add_error('User friends_with must be of type int.')

        elif 'requested_friendship_with' in search_kwargs: