# Path: augur/__version__.py
# def is_augur_version_compatible(version):
# 
# Path: augur/__version__.py
# def is_augur_version_compatible(version):
#     """
#     Checks if the provided **version** is the same major version
#     as the currently running version of augur.
# 
#     Parameters
#     ----------
#     version : str
#         version to check against the current version
# 
#     Returns
#     -------
#     Bool
# 
#     """
#     import packaging.version
# 
#     current_version = packaging.version.parse(__version__)
#     this_version = packaging.version.parse(version)
#     return this_version.release[0] == current_version.release[0]
# 
# Path: augur/validate.py
# def validate_json(jsonToValidate, schema, filename):
#     print("Validating schema of {!r}...".format(filename))
#     try:
#         schema.validate(jsonToValidate) # https://python-jsonschema.readthedocs.io/en/latest/validate/
#     except jsonschema.exceptions.ValidationError:
#         for error in sorted(schema.iter_errors(jsonToValidate), key=str):
#             trace = list(error.schema_path) # this may be really long for nested tree structures
#             if len(trace) > 6:
#                 trace = ["..."] + trace[-5:]
#             trace = [str(x) for x in trace]
#             print("\tERROR: {}. Trace: {}".format(error.message, " - ".join(trace)), file=sys.stderr)
#         raise ValidateError("Validation of {!r} failed.".format(filename))
# 
# class ValidateError(Exception):
#     pass
# 
# def load_json_schema(path):
#     '''
#     Load a JSON schema from the augur included set of schemas
#     (located in augur/data)
#     '''
#     try:
#         schema = json.loads(resource_string(__package__, os.path.join("data", path)))
#     except json.JSONDecodeError as err:
#         raise ValidateError("Schema {} is not a valid JSON file. Error: {}".format(path, err))
#     # check loaded schema is itself valid -- see http://python-jsonschema.readthedocs.io/en/latest/errors/
#     Validator = jsonschema.validators.validator_for(schema)
#     try:
#         Validator.check_schema(schema)
#     except jsonschema.exceptions.SchemaError as err:
#         raise ValidateError(f"Schema {path} is not a valid JSON Schema ({Validator.META_SCHEMA['$schema']}). Error: {err}")
#     return Validator(schema)


import json
from augur.__version__ import __version__
from augur.__version__ import is_augur_version_compatible
from augur.validate import validate_json, ValidateError, load_json_schema
        filtered_attrs = {
            key: value for key, value in self.attrs.items() if key not in FILTERED_ATTRS
        }

        return filtered_attrs.items()

    def validate(self):
        if self.annotations:
            try:
                validate_json(
                    self.annotations,
                    load_json_schema("schema-annotations.json"),
                    self.fname,
                )
            except ValidateError as err:
                raise RuntimeError(
                    f"{self.fname} contains an `annotations` attribute of an invalid JSON format. Was it "
                    "produced by different version of augur the one you are currently using "
                    f" ({__version__})? Please check the program that produced that JSON file."
                ) from err

        if not isinstance(self.nodes, dict):
            raise RuntimeError(
                f"`nodes` value in {self.fname} is not a dictionary. Please check the formatting of this JSON!"
            )

        if self.is_generated_by_incompatible_augur:
            raise RuntimeError(
                f"Augur version incompatibility detected: the JSON {self.fname} was generated by "
                f"{self.generated_by}, which is incompatible with the current augur version "

# Path: augur/__version__.py
# def is_augur_version_compatible(version):
# 
# Path: augur/__version__.py
# def is_augur_version_compatible(version):
#     """
#     Checks if the provided **version** is the same major version
#     as the currently running version of augur.
# 
#     Parameters
#     ----------
#     version : str
#         version to check against the current version
# 
#     Returns
#     -------
#     Bool
# 
#     """
#     import packaging.version
# 
#     current_version = packaging.version.parse(__version__)
#     this_version = packaging.version.parse(version)
#     return this_version.release[0] == current_version.release[0]
# 
# Path: augur/validate.py
# def validate_json(jsonToValidate, schema, filename):
#     print("Validating schema of {!r}...".format(filename))
#     try:
#         schema.validate(jsonToValidate) # https://python-jsonschema.readthedocs.io/en/latest/validate/
#     except jsonschema.exceptions.ValidationError:
#         for error in sorted(schema.iter_errors(jsonToValidate), key=str):
#             trace = list(error.schema_path) # this may be really long for nested tree structures
#             if len(trace) > 6:
#                 trace = ["..."] + trace[-5:]
#             trace = [str(x) for x in trace]
#             print("\tERROR: {}. Trace: {}".format(error.message, " - ".join(trace)), file=sys.stderr)
#         raise ValidateError("Validation of {!r} failed.".format(filename))
# 
# class ValidateError(Exception):
#     pass
# 
# def load_json_schema(path):
#     '''
#     Load a JSON schema from the augur included set of schemas
#     (located in augur/data)
#     '''
#     try:
#         schema = json.loads(resource_string(__package__, os.path.join("data", path)))
#     except json.JSONDecodeError as err:
#         raise ValidateError("Schema {} is not a valid JSON file. Error: {}".format(path, err))
#     # check loaded schema is itself valid -- see http://python-jsonschema.readthedocs.io/en/latest/errors/
#     Validator = jsonschema.validators.validator_for(schema)
#     try:
#         Validator.check_schema(schema)
#     except jsonschema.exceptions.SchemaError as err:
#         raise ValidateError(f"Schema {path} is not a valid JSON Schema ({Validator.META_SCHEMA['$schema']}). Error: {err}")
#     return Validator(schema)


# Path: augur/util_support/node_data_file.py
import json
from augur.__version__ import __version__
from augur.__version__ import is_augur_version_compatible
from augur.validate import validate_json, ValidateError, load_json_schema

        filtered_attrs = {
            key: value for key, value in self.attrs.items() if key not in FILTERED_ATTRS
        }

        return filtered_attrs.items()

    def validate(self):
        if self.annotations:
            try:
                validate_json(
                    self.annotations,
                    load_json_schema("schema-annotations.json"),
                    self.fname,
                )
            except ValidateError as err:
                raise RuntimeError(
                    f"{self.fname} contains an `annotations` attribute of an invalid JSON format. Was it "
                    "produced by different version of augur the one you are currently using "
                    f" ({__version__})? Please check the program that produced that JSON file."
                ) from err

        if not isinstance(self.nodes, dict):
            raise RuntimeError(
                f"`nodes` value in {self.fname} is not a dictionary. Please check the formatting of this JSON!"
            )

        if self.is_generated_by_incompatible_augur:
            raise RuntimeError(
                f"Augur version incompatibility detected: the JSON {self.fname} was generated by "
                f"{self.generated_by}, which is incompatible with the current augur version "

                f"({__version__}). We suggest you rerun the pipeline using the current version of "