# Path: src/zinc/defaults.py

# 
# Path: src/zinc/pathfilter.py
# class PathFilter(object):
# 
#     class Rule(object):
#         def __init__(self, pattern, match_action):
#             assert match_action in (Match.ACCEPT, Match.REJECT)
#             self.pattern = pattern
#             self.match_action = match_action
# 
#         def match(self, path):
#             if fnmatch.fnmatch(path, self.pattern):
#                 return self.match_action
#             return Match.UNKNOWN
# 
#     def __init__(self, rules):
#         self._rules = rules
# 
#     def match(self, path):
#         """Tests the path against all rules in this filter"""
#         for rule in self._rules:
#             if rule.match(path) == Match.ACCEPT:
#                 return True
#             elif rule.match(path) == Match.REJECT:
#                 return False
#         return True
# 
#     @staticmethod
#     def from_rule_list(rule_list):
#         """Read from a dict. `version` is ignored"""
#         rules = []
#         for rule_string in rule_list:
#             rule_string = rule_string.strip()
#             rule_comps = rule_string.split()
#             match_action_string = rule_comps[0]
#             if match_action_string == '+':
#                 match_action = Match.ACCEPT
#             elif match_action_string == '-':
#                 match_action = Match.REJECT
#             else:
#                 raise ValueError("unknown match type: %s" %
#                                  (match_action_string))
#             pattern = string.join(rule_comps[1:], ' ')
#             rules.append(PathFilter.Rule(pattern, match_action))
#         return PathFilter(rules)


import json
import UserDict
import jsonschema
from functools import wraps
from pkg_resources import resource_string
from .defaults import defaults
from .pathfilter import PathFilter
        Checks if the *contents* of two FileLists are equivalent. This checks
        the file paths, sha, and flavors, but skips things like formats. This is
        a looser equality than what `__eq__` provides.
        """
        if len(self) != len(other_filelist):
            return False

        for path in other_filelist.keys():
            my_sha = self.sha_for_file(path)
            if my_sha is None:
                return False

            other_sha = other_filelist.sha_for_file(path)
            if other_sha != my_sha:
                return False

            my_flavors = self.flavors_for_file(path)
            other_flavors = other_filelist.flavors_for_file(path)
            if other_flavors != my_flavors:
                return False

        return True


### ZincManifest #############################################################

class ZincManifest(ZincModel):

    def __init__(self, catalog_id, bundle_name, version, **kwargs):
        super(ZincManifest, self).__init__(**kwargs)

# Path: src/zinc/defaults.py

# 
# Path: src/zinc/pathfilter.py
# class PathFilter(object):
# 
#     class Rule(object):
#         def __init__(self, pattern, match_action):
#             assert match_action in (Match.ACCEPT, Match.REJECT)
#             self.pattern = pattern
#             self.match_action = match_action
# 
#         def match(self, path):
#             if fnmatch.fnmatch(path, self.pattern):
#                 return self.match_action
#             return Match.UNKNOWN
# 
#     def __init__(self, rules):
#         self._rules = rules
# 
#     def match(self, path):
#         """Tests the path against all rules in this filter"""
#         for rule in self._rules:
#             if rule.match(path) == Match.ACCEPT:
#                 return True
#             elif rule.match(path) == Match.REJECT:
#                 return False
#         return True
# 
#     @staticmethod
#     def from_rule_list(rule_list):
#         """Read from a dict. `version` is ignored"""
#         rules = []
#         for rule_string in rule_list:
#             rule_string = rule_string.strip()
#             rule_comps = rule_string.split()
#             match_action_string = rule_comps[0]
#             if match_action_string == '+':
#                 match_action = Match.ACCEPT
#             elif match_action_string == '-':
#                 match_action = Match.REJECT
#             else:
#                 raise ValueError("unknown match type: %s" %
#                                  (match_action_string))
#             pattern = string.join(rule_comps[1:], ' ')
#             rules.append(PathFilter.Rule(pattern, match_action))
#         return PathFilter(rules)


# Path: src/zinc/models.py
import json
import UserDict
import jsonschema
from functools import wraps
from pkg_resources import resource_string
from .defaults import defaults
from .pathfilter import PathFilter

        Checks if the *contents* of two FileLists are equivalent. This checks
        the file paths, sha, and flavors, but skips things like formats. This is
        a looser equality than what `__eq__` provides.
        """
        if len(self) != len(other_filelist):
            return False

        for path in other_filelist.keys():
            my_sha = self.sha_for_file(path)
            if my_sha is None:
                return False

            other_sha = other_filelist.sha_for_file(path)
            if other_sha != my_sha:
                return False

            my_flavors = self.flavors_for_file(path)
            other_flavors = other_filelist.flavors_for_file(path)
            if other_flavors != my_flavors:
                return False

        return True


### ZincManifest #############################################################

class ZincManifest(ZincModel):

    def __init__(self, catalog_id, bundle_name, version, **kwargs):
        super(ZincManifest, self).__init__(**kwargs)

        self._format = defaults['zinc_format']