示例#1
0
    def __call__(self, event, hint):
        """Sanitize a section with sensitive keys."""
        try:
            data = glom.glom(event, self.section_path)
        except glom.PathAccessError:
            return

        data_out = {}
        for key, value in data.items():
            if self.is_sensitive_key(key):
                data_out[key] = "[filtered]"
            else:
                data_out[key] = value
        glom.glom(event, glom.Assign(self.section_path, data_out))
示例#2
0
    def _transform_io_sections(cls, config_dict):
        clone = config_dict.copy()
        for io_type in ["events", "data"]:
            for io_direction in ["inputs", "outputs"]:
                path = "job_config.{}.{}".format(io_type, io_direction)

                glom_assign = glom.Assign(
                    path, glom.Spec((path, cls._transform_io_list)))
                glom.glom(
                    clone,
                    glom_assign,
                    default=None,
                )

        return clone