# Path: partycrasher/pc_exceptions.py
# class BadProjectNameError(PartyCrasherError):
#     """Invalid project name in crash data. Project names must be alphanumeric (including underscores)."""
#     http_code = 400
#     
#     def __init__(self, project_name, **kwargs):
#         message = "Bad project name: %s" % project_name
#         super(BadProjectNameError, self).__init__(message)
#         self.project_name = project_name
# 
# class BadKeyNameError(PartyCrasherError):
#     """Invalid key-value pair in crash data. Keys must be alphanumeric (including underscores)."""
#     http_code = 400
#     
#     def __init__(self, key_name, **kwargs):
#         message = "Bad key name: %s" % key_name
#         super(BadKeyNameError, self).__init__(message)
#         self.key_name = key_name


from six import string_types
from partycrasher.pc_exceptions import BadProjectNameError, BadKeyNameError
from partycrasher.pc_type import (
    PCType,
    PCMaybeType,
    PCMultiType,
    key_type
    )
import re
#  Copyright (C) 2015, 2016 Joshua Charles Campbell

#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


class Project(object):
    """
    Metadata about a project.
    """
    __slots__ = ('name',)
    
    def __init__(self, project):
        if isinstance(project, Project):
            self.name = project.name
        else:
            try:
                self.name = key_type(project)
            except BadKeyNameError as e:

# Path: partycrasher/pc_exceptions.py
# class BadProjectNameError(PartyCrasherError):
#     """Invalid project name in crash data. Project names must be alphanumeric (including underscores)."""
#     http_code = 400
#     
#     def __init__(self, project_name, **kwargs):
#         message = "Bad project name: %s" % project_name
#         super(BadProjectNameError, self).__init__(message)
#         self.project_name = project_name
# 
# class BadKeyNameError(PartyCrasherError):
#     """Invalid key-value pair in crash data. Keys must be alphanumeric (including underscores)."""
#     http_code = 400
#     
#     def __init__(self, key_name, **kwargs):
#         message = "Bad key name: %s" % key_name
#         super(BadKeyNameError, self).__init__(message)
#         self.key_name = key_name


# Path: partycrasher/project.py
from six import string_types
from partycrasher.pc_exceptions import BadProjectNameError, BadKeyNameError
from partycrasher.pc_type import (
    PCType,
    PCMaybeType,
    PCMultiType,
    key_type
    )
import re

#  Copyright (C) 2015, 2016 Joshua Charles Campbell

#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


class Project(object):
    """
    Metadata about a project.
    """
    __slots__ = ('name',)
    
    def __init__(self, project):
        if isinstance(project, Project):
            self.name = project.name
        else:
            try:
                self.name = key_type(project)
            except BadKeyNameError as e:

                raise BadProjectNameError(repr(project))