# Path: muninn/util.py
# def split_path(path):
#     """Recursively apply os.path.split() to split a path into a sequence of path segments.
# 
#     Example:
#         [segment for segment in split_path("/a/b/c/d.txt")] returns ["/", "a", "b", "c", "d.txt"]
# 
#     """
#     head, tail = os.path.split(path)
#     if not tail:
#         head, tail = os.path.split(head)
# 
#     if head.endswith(os.sep):
#         yield os.sep
#     elif head:
#         for segment in split_path(head):
#             yield segment
# 
#     if tail:
#         yield tail


import os
from muninn.schema import *
from muninn.util import split_path
from muninn.remote import *
#
# Copyright (C) 2014-2022 S[&]T, The Netherlands.
#

from __future__ import absolute_import, division, print_function




class ArchivePath(Text):
    _alias = "archive_path"

    @classmethod
    def validate(cls, value):
        super(ArchivePath, cls).validate(value)
        if os.path.isabs(value) or os.path.pardir in split_path(value):
            raise ValueError("invalid value %r for type %r" % (value, cls.name()))


class Basename(Text):

# Path: muninn/util.py
# def split_path(path):
#     """Recursively apply os.path.split() to split a path into a sequence of path segments.
# 
#     Example:
#         [segment for segment in split_path("/a/b/c/d.txt")] returns ["/", "a", "b", "c", "d.txt"]
# 
#     """
#     head, tail = os.path.split(path)
#     if not tail:
#         head, tail = os.path.split(head)
# 
#     if head.endswith(os.sep):
#         yield os.sep
#     elif head:
#         for segment in split_path(head):
#             yield segment
# 
#     if tail:
#         yield tail


# Path: muninn/core.py
import os
from muninn.schema import *
from muninn.util import split_path
from muninn.remote import *

#
# Copyright (C) 2014-2022 S[&]T, The Netherlands.
#

from __future__ import absolute_import, division, print_function




class ArchivePath(Text):
    _alias = "archive_path"

    @classmethod
    def validate(cls, value):
        super(ArchivePath, cls).validate(value)
        if os.path.isabs(value) or os.path.pardir in split_path(value):
            raise ValueError("invalid value %r for type %r" % (value, cls.name()))


class Basename(Text):

    @classmethod