# Path: pymatgen/db/builders/schema.py
# DEFAULT_VERSION = "1.0.0"
# ANY_VERSION = "*.*.*"
# OPTIONAL_FLAG = "?"
# SPECIAL = "__"
# SPECIAL_LEN = len(SPECIAL)
# VALUE_RE = re.compile(r"(?:{spec})?([a-zA-Z]+)(?:{spec})?\s*(.*)".format(spec=SPECIAL))
#     FIELD_SEP = ","
#     KV_SEP = ":"
#     IS_LIST, IS_DICT, IS_SCALAR = 0, 1, 2
#     TYPES = {
#         "string": lambda x: isinstance(x, str),
#         "bool": lambda x: x is True or x is False,
#         "datetime": _is_datetime,
#         "date": _is_datetime,
#         "float": lambda x: isinstance(x, float),
#         "int": lambda x: isinstance(x, int),
#         "null": lambda x: x is None,
#         "array": lambda x: isinstance(x, list),
#         "object": lambda x: isinstance(x, dict),
#     }
#     JSTYPES = {
#         "datetime": "string",
#         "date": "string",
#         "string": "string",
#         "bool": "boolean",
#         "int": "integer",
#         "float": "number",
#         "null": "null",
#     }
# class SchemaError(Exception):
# class SchemaTypeError(SchemaError):
# class SchemaPathError(SchemaError):
# class SchemaParseError(SchemaError):
# class HasMeta:
# class Schema(HasMeta):
# class Scalar(HasMeta):
#     def __init__(self, typename):
# def add_schemas(path, ext="json"):
# def get_schema(name):
# def load_schema(file_or_fp):
#     def __init__(self, meta):
#     def add_meta(self, key, value):
#     def __init__(self, schema, optional=False, meta=""):
#     def validate(self, doc, path="(root)"):
#     def json_schema(self, **add_keys):
#     def _build_schema(self, s):
#     def _jstype(self, stype, sval):
#     def _vresult(self, path, fmt, *args):
#     def _parse(self, value):
#     def _whatis(self, obj):
#     def _typestr(self, t):
#     def __str__(self):
#     def __repr__(self):
# def _is_datetime(d):
#     def __init__(self, typecode, optional=False, meta=""):
#     def jstype(self):
#     def __str__(self):
#     def __repr__(self):
# 
# Path: pymatgen/db/builders/util.py
# def get_test_dir(name=None):
# def get_schema_dir(db_version=1):
# def get_schema_file(db_version=1, db="mg_core", collection="materials"):
# def get_builder_log(name):
# 
# Path: pymatgen/db/util.py
# DEFAULT_PORT = DBConfig.DEFAULT_PORT
# DEFAULT_CONFIG_FILE = DBConfig.DEFAULT_FILE
# DEFAULT_SETTINGS = DBConfig.DEFAULT_SETTINGS
# class MongoJSONEncoder(json.JSONEncoder):
#     def default(self, o):
# def get_settings(config_file):
# def get_database(config_file=None, settings=None, admin=False, **kwargs):
# def get_collection(config_file, admin=False, settings=None):
# def collection_keys(coll, sep="."):
#     def _keys(x, pre=""):
# def csv_list(l):
# def quotable(v):
# def csv_dict(d):
# def kvp_dict(d):


from abc import ABCMeta, abstractmethod
from pymatgen.db.builders import schema, util
from pymatgen.db import util as dbutil
import copy
import logging
import multiprocessing
import queue as Queue
import traceback
"""
Shared code for builders.

For developers implementing a new builder,
you should inherit from :class:`Builder`.
"""
__author__ = "Dan Gunter <dkgunter@lbl.gov>"
__date__ = "5/29/13"

## Imports

# system


# local

## Logging


# Path: pymatgen/db/builders/schema.py
# DEFAULT_VERSION = "1.0.0"
# ANY_VERSION = "*.*.*"
# OPTIONAL_FLAG = "?"
# SPECIAL = "__"
# SPECIAL_LEN = len(SPECIAL)
# VALUE_RE = re.compile(r"(?:{spec})?([a-zA-Z]+)(?:{spec})?\s*(.*)".format(spec=SPECIAL))
#     FIELD_SEP = ","
#     KV_SEP = ":"
#     IS_LIST, IS_DICT, IS_SCALAR = 0, 1, 2
#     TYPES = {
#         "string": lambda x: isinstance(x, str),
#         "bool": lambda x: x is True or x is False,
#         "datetime": _is_datetime,
#         "date": _is_datetime,
#         "float": lambda x: isinstance(x, float),
#         "int": lambda x: isinstance(x, int),
#         "null": lambda x: x is None,
#         "array": lambda x: isinstance(x, list),
#         "object": lambda x: isinstance(x, dict),
#     }
#     JSTYPES = {
#         "datetime": "string",
#         "date": "string",
#         "string": "string",
#         "bool": "boolean",
#         "int": "integer",
#         "float": "number",
#         "null": "null",
#     }
# class SchemaError(Exception):
# class SchemaTypeError(SchemaError):
# class SchemaPathError(SchemaError):
# class SchemaParseError(SchemaError):
# class HasMeta:
# class Schema(HasMeta):
# class Scalar(HasMeta):
#     def __init__(self, typename):
# def add_schemas(path, ext="json"):
# def get_schema(name):
# def load_schema(file_or_fp):
#     def __init__(self, meta):
#     def add_meta(self, key, value):
#     def __init__(self, schema, optional=False, meta=""):
#     def validate(self, doc, path="(root)"):
#     def json_schema(self, **add_keys):
#     def _build_schema(self, s):
#     def _jstype(self, stype, sval):
#     def _vresult(self, path, fmt, *args):
#     def _parse(self, value):
#     def _whatis(self, obj):
#     def _typestr(self, t):
#     def __str__(self):
#     def __repr__(self):
# def _is_datetime(d):
#     def __init__(self, typecode, optional=False, meta=""):
#     def jstype(self):
#     def __str__(self):
#     def __repr__(self):
# 
# Path: pymatgen/db/builders/util.py
# def get_test_dir(name=None):
# def get_schema_dir(db_version=1):
# def get_schema_file(db_version=1, db="mg_core", collection="materials"):
# def get_builder_log(name):
# 
# Path: pymatgen/db/util.py
# DEFAULT_PORT = DBConfig.DEFAULT_PORT
# DEFAULT_CONFIG_FILE = DBConfig.DEFAULT_FILE
# DEFAULT_SETTINGS = DBConfig.DEFAULT_SETTINGS
# class MongoJSONEncoder(json.JSONEncoder):
#     def default(self, o):
# def get_settings(config_file):
# def get_database(config_file=None, settings=None, admin=False, **kwargs):
# def get_collection(config_file, admin=False, settings=None):
# def collection_keys(coll, sep="."):
#     def _keys(x, pre=""):
# def csv_list(l):
# def quotable(v):
# def csv_dict(d):
# def kvp_dict(d):


# Path: pymatgen/db/builders/core.py
from abc import ABCMeta, abstractmethod
from pymatgen.db.builders import schema, util
from pymatgen.db import util as dbutil
import copy
import logging
import multiprocessing
import queue as Queue
import traceback

"""
Shared code for builders.

For developers implementing a new builder,
you should inherit from :class:`Builder`.
"""
__author__ = "Dan Gunter <dkgunter@lbl.gov>"
__date__ = "5/29/13"

## Imports

# system


# local

## Logging


_log = util.get_builder_log("core")