# Path: datapackage_pipelines/utilities/resources.py
# PATH_PLACEHOLDER = '_'
# 
# def streaming(descriptor):
#     return descriptor.get(PROP_STREAMING)
# 
# Path: datapackage_pipelines/utilities/extended_json.py
# class json(object):
#     dumps = _dumps
#     loads = _loads
#     dumpl = _dumpl
#     loadl = _loadl
#     dump = _dump
#     load = _load
#     JSONDecodeError = _json.JSONDecodeError


import sys
import copy
import logging
import datapackage
from tableschema.exceptions import ValidationError, CastError
from tableschema import Schema
from ..utilities.resources import PATH_PLACEHOLDER, streaming
from ..utilities.extended_json import json
        # Since this might happen in the early stages of a pipeline,
        # we're adding this hack to avoid validation errors
        dp_to_validate = copy.deepcopy(dp)
        dp_to_validate['resources'] = [{
            'name': '__placeholder__',
            'path': PATH_PLACEHOLDER
        }]
    else:
        dp_to_validate = dp
    try:
        datapackage.validate(dp_to_validate)
    except ValidationError as e:
        logging.info('FAILED TO VALIDATE %r', dp_to_validate)
        for e in e.errors:
            try:
                logging.error("Data Package validation error: %s at dp%s",
                              e.message,
                              "[%s]" % "][".join(repr(index) for index in e.path))
            except AttributeError:
                logging.error("Data Package validation error: %s", e)
        raise

    infile.readline().strip()

    def resources_iterator(_resources, _original_resources):
        # we pass a resource instance that may be changed by the processing
        # code, so we must keep a copy of the original resource (used to
        # validate incoming data)
        ret = []
        for resource, orig_resource in zip(_resources, _original_resources):

# Path: datapackage_pipelines/utilities/resources.py
# PATH_PLACEHOLDER = '_'
# 
# def streaming(descriptor):
#     return descriptor.get(PROP_STREAMING)
# 
# Path: datapackage_pipelines/utilities/extended_json.py
# class json(object):
#     dumps = _dumps
#     loads = _loads
#     dumpl = _dumpl
#     loadl = _loadl
#     dump = _dump
#     load = _load
#     JSONDecodeError = _json.JSONDecodeError


# Path: datapackage_pipelines/wrapper/input_processor.py
import sys
import copy
import logging
import datapackage
from tableschema.exceptions import ValidationError, CastError
from tableschema import Schema
from ..utilities.resources import PATH_PLACEHOLDER, streaming
from ..utilities.extended_json import json

        # Since this might happen in the early stages of a pipeline,
        # we're adding this hack to avoid validation errors
        dp_to_validate = copy.deepcopy(dp)
        dp_to_validate['resources'] = [{
            'name': '__placeholder__',
            'path': PATH_PLACEHOLDER
        }]
    else:
        dp_to_validate = dp
    try:
        datapackage.validate(dp_to_validate)
    except ValidationError as e:
        logging.info('FAILED TO VALIDATE %r', dp_to_validate)
        for e in e.errors:
            try:
                logging.error("Data Package validation error: %s at dp%s",
                              e.message,
                              "[%s]" % "][".join(repr(index) for index in e.path))
            except AttributeError:
                logging.error("Data Package validation error: %s", e)
        raise

    infile.readline().strip()

    def resources_iterator(_resources, _original_resources):
        # we pass a resource instance that may be changed by the processing
        # code, so we must keep a copy of the original resource (used to
        # validate incoming data)
        ret = []
        for resource, orig_resource in zip(_resources, _original_resources):

            if not streaming(resource):