# Path: libxyz/exceptions.py
# class XYZValueError(XYZError):
#     pass


from libxyz.exceptions import XYZValueError
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# XYZCommander 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 Lesser Public License for more details.
# You should have received a copy of the GNU Lesser Public License
# along with XYZCommander. If not, see <http://www.gnu.org/licenses/>.


class Namespace(object):
    """
    Plugin namespace abstraction
    """

    # All wildcard
    ALL = u"*"

    def __init__(self, path):
        _path = path

        if not path.startswith(u":"):
            raise XYZValueError(_(u"Invalid plugin path: %s") % path)
        else:
            _path = path[1:]

        _raw = _path.split(u":")
        _len = len(_raw)

        if _len < 2 or _len > 3:

# Path: libxyz/exceptions.py
# class XYZValueError(XYZError):
#     pass


# Path: libxyz/core/plugins/ns.py
from libxyz.exceptions import XYZValueError

# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# XYZCommander 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 Lesser Public License for more details.
# You should have received a copy of the GNU Lesser Public License
# along with XYZCommander. If not, see <http://www.gnu.org/licenses/>.


class Namespace(object):
    """
    Plugin namespace abstraction
    """

    # All wildcard
    ALL = u"*"

    def __init__(self, path):
        _path = path

        if not path.startswith(u":"):
            raise XYZValueError(_(u"Invalid plugin path: %s") % path)
        else:
            _path = path[1:]

        _raw = _path.split(u":")
        _len = len(_raw)

        if _len < 2 or _len > 3:

            raise XYZValueError(_(u"Invalid plugin path: %s") % path)