# Path: datapackage_pipelines/utilities/extended_json.py
#     DATE_F_FORMAT = '%Y-%m-%d'
#     DATETIME_F_FORMAT = '%Y-%m-%d %H:%M:%S'
#     DATE_F_FORMAT = '%04Y-%m-%d'
#     DATETIME_F_FORMAT = '%04Y-%m-%d %H:%M:%S'
# DATE_FORMAT = DATE_F_FORMAT
# DATETIME_FORMAT = DATETIME_F_FORMAT
# TIME_FORMAT = '%H:%M:%S'
# DATE_P_FORMAT = '%Y-%m-%d'
# DATETIME_P_FORMAT = '%Y-%m-%d %H:%M:%S'
# TIME_P_FORMAT = TIME_F_FORMAT = TIME_FORMAT
# class LazyJsonLine(LazyDict):
# class CommonJSONDecoder(_json.JSONDecoder):
# class CommonJSONEncoder(_json.JSONEncoder):
# class json(object):
#     def __init__(self, args, kwargs):
#     def _evaluate(self):
#     def __str__(self):
#     def __repr__(self):
#     def object_hook(cls, obj):
#     def __init__(self, **kwargs):
#     def default(self, obj):
# def _dumpl(*args, **kwargs):
# def _loadl(*args, **kwargs):
# def _dumps(*args, **kwargs):
# def _loads(*args, **kwargs):
# def _dump(*args, **kwargs):
# def _load(*args, **kwargs):
# 
# Path: datapackage_pipelines/utilities/resources.py
# def get_path(descriptor):
#     path = descriptor.get('path')
#     if isinstance(path, str):
#         return path
#     if isinstance(path, list):
#         if len(path) > 0:
#             return path.pop(0)
#         else:
#             return None
#     assert path is None, '%r' % path
#     return None


import csv
import json
import os
import isodate
import logging
from datapackage_pipelines.utilities.extended_json import (
    DATETIME_F_FORMAT, DATE_F_FORMAT, TIME_F_FORMAT,
    DATETIME_P_FORMAT, DATE_P_FORMAT, TIME_P_FORMAT,
)
from datapackage_pipelines.utilities.resources import get_path
        'datetime': lambda d: d.strftime(DATETIME_F_FORMAT),
        'date': lambda d: d.strftime(DATE_F_FORMAT),
        'time': lambda d: d.strftime(TIME_F_FORMAT),
        'duration': lambda d: isodate.duration_isoformat(d),
        'geopoint': lambda d: '{}, {}'.format(*d),
        'geojson': json.dumps,
        'year': lambda d: '{:04d}'.format(d),
        'yearmonth': lambda d: '{:04d}-{:02d}'.format(*d),
    }
    DEFAULT_SERIALIZER = str
    NULL_VALUE = ''

    PYTHON_DIALECT = {
        'number': {
            'decimalChar': '.',
            'groupChar': ''
        },
        'date': {
            'format': DATE_P_FORMAT
        },
        'time': {
            'format': TIME_P_FORMAT
        },
        'datetime': {
            'format': DATETIME_P_FORMAT
        },
    }

    def prepare_resource(self, resource):
        resource['encoding'] = 'utf-8'

# Path: datapackage_pipelines/utilities/extended_json.py
#     DATE_F_FORMAT = '%Y-%m-%d'
#     DATETIME_F_FORMAT = '%Y-%m-%d %H:%M:%S'
#     DATE_F_FORMAT = '%04Y-%m-%d'
#     DATETIME_F_FORMAT = '%04Y-%m-%d %H:%M:%S'
# DATE_FORMAT = DATE_F_FORMAT
# DATETIME_FORMAT = DATETIME_F_FORMAT
# TIME_FORMAT = '%H:%M:%S'
# DATE_P_FORMAT = '%Y-%m-%d'
# DATETIME_P_FORMAT = '%Y-%m-%d %H:%M:%S'
# TIME_P_FORMAT = TIME_F_FORMAT = TIME_FORMAT
# class LazyJsonLine(LazyDict):
# class CommonJSONDecoder(_json.JSONDecoder):
# class CommonJSONEncoder(_json.JSONEncoder):
# class json(object):
#     def __init__(self, args, kwargs):
#     def _evaluate(self):
#     def __str__(self):
#     def __repr__(self):
#     def object_hook(cls, obj):
#     def __init__(self, **kwargs):
#     def default(self, obj):
# def _dumpl(*args, **kwargs):
# def _loadl(*args, **kwargs):
# def _dumps(*args, **kwargs):
# def _loads(*args, **kwargs):
# def _dump(*args, **kwargs):
# def _load(*args, **kwargs):
# 
# Path: datapackage_pipelines/utilities/resources.py
# def get_path(descriptor):
#     path = descriptor.get('path')
#     if isinstance(path, str):
#         return path
#     if isinstance(path, list):
#         if len(path) > 0:
#             return path.pop(0)
#         else:
#             return None
#     assert path is None, '%r' % path
#     return None


# Path: datapackage_pipelines/lib/dump/file_formats.py
import csv
import json
import os
import isodate
import logging
from datapackage_pipelines.utilities.extended_json import (
    DATETIME_F_FORMAT, DATE_F_FORMAT, TIME_F_FORMAT,
    DATETIME_P_FORMAT, DATE_P_FORMAT, TIME_P_FORMAT,
)
from datapackage_pipelines.utilities.resources import get_path

        'datetime': lambda d: d.strftime(DATETIME_F_FORMAT),
        'date': lambda d: d.strftime(DATE_F_FORMAT),
        'time': lambda d: d.strftime(TIME_F_FORMAT),
        'duration': lambda d: isodate.duration_isoformat(d),
        'geopoint': lambda d: '{}, {}'.format(*d),
        'geojson': json.dumps,
        'year': lambda d: '{:04d}'.format(d),
        'yearmonth': lambda d: '{:04d}-{:02d}'.format(*d),
    }
    DEFAULT_SERIALIZER = str
    NULL_VALUE = ''

    PYTHON_DIALECT = {
        'number': {
            'decimalChar': '.',
            'groupChar': ''
        },
        'date': {
            'format': DATE_P_FORMAT
        },
        'time': {
            'format': TIME_P_FORMAT
        },
        'datetime': {
            'format': DATETIME_P_FORMAT
        },
    }

    def prepare_resource(self, resource):
        resource['encoding'] = 'utf-8'

        basename, _ = os.path.splitext(get_path(resource))