# Path: json_utils/clean.py
# def clean_json(text):
#     # Remove single-line comments
#     text = _c_style_comment.sub("", text)
#     # Remove multi-line comments
#     text = _multiline_comment.sub("", text)
#     # Replace trailing commas
#     text = _trailing_commas.sub(r"\1", text)
# 
#     return text


import sys
import os
import json
import re
from json_utils import clean_json

    KEY_FILTERS = "filters"
    KEY_EXCLUDE = "exclude"
    # filter parameters
    KEY_METHOD = "method"
    KEY_TEXT = "text"
    KEY_CASE_SENS = "case_sensitive"
    REQUIRED_FILTER_PARAMS = [KEY_TEXT, KEY_METHOD]
    REQUIRED_FILTER_FILE_PARAMS = [KEY_NAME, KEY_FILTERS]

    def __init__(self, name, filter_list, exclude=False):
        self.name = name
        self.filter_list = filter_list
        self.exclude = exclude

    @staticmethod
    def parse_filter_file(file_text, skip_invalid_filters=False):
        """
        Parses JSON text into a filter file object

        :param file_text: the text of the filter file
        :type file_text: str
        :param skip_invalid_filters: behavior to take when an invalid filter is discovered.
                                     If set to True, that specific filter will just be ignored and parsing will continue.
                                     If set to False, a FilterAttributeError will be thrown
        :type skip_invalid_filters: bool

        :return: the corresponding FilterFile object
        :rtype: FilterFile
        """
        try:

# Path: json_utils/clean.py
# def clean_json(text):
#     # Remove single-line comments
#     text = _c_style_comment.sub("", text)
#     # Remove multi-line comments
#     text = _multiline_comment.sub("", text)
#     # Replace trailing commas
#     text = _trailing_commas.sub(r"\1", text)
# 
#     return text


# Path: filter/serial_filter.py
import sys
import os
import json
import re
from json_utils import clean_json

    KEY_FILTERS = "filters"
    KEY_EXCLUDE = "exclude"
    # filter parameters
    KEY_METHOD = "method"
    KEY_TEXT = "text"
    KEY_CASE_SENS = "case_sensitive"
    REQUIRED_FILTER_PARAMS = [KEY_TEXT, KEY_METHOD]
    REQUIRED_FILTER_FILE_PARAMS = [KEY_NAME, KEY_FILTERS]

    def __init__(self, name, filter_list, exclude=False):
        self.name = name
        self.filter_list = filter_list
        self.exclude = exclude

    @staticmethod
    def parse_filter_file(file_text, skip_invalid_filters=False):
        """
        Parses JSON text into a filter file object

        :param file_text: the text of the filter file
        :type file_text: str
        :param skip_invalid_filters: behavior to take when an invalid filter is discovered.
                                     If set to True, that specific filter will just be ignored and parsing will continue.
                                     If set to False, a FilterAttributeError will be thrown
        :type skip_invalid_filters: bool

        :return: the corresponding FilterFile object
        :rtype: FilterFile
        """
        try:

            file = json.loads(clean_json(file_text))
