# Path: metatlas/datastructures/object_helpers.py
# ON_NERSC = 'METATLAS_LOCAL' not in os.environ
# def callback_method(func):
#     def notify(self, *args, **kwargs):
#     def __getitem__(self, item):
#     def __init__(self, *args):
#     def register_callback(self, cb):
#     def unregister_callback(self, cbid):
# def set_docstring(cls):
# def _get_subclasses(cls):
#     def __init__(self):
#     def get_instance(cls):
#     def get_connection(self):
#     def close_connection(self):
#     def convert_to_double(self, table, entry):
#     def save_objects(self, objects, _override=False):
#     def create_link_tables(self, klass):
#     def _get_save_data(self, obj, override=False):
#     def fix_table(self, table_name):
#     def retrieve(self, object_type, **kwargs):
#     def remove(self, object_type, **kwargs):
#     def remove_objects(self, objects, all_versions=True, **kwargs):
# def format_timestamp(tstamp):
#     def validate(self, obj, value):
#     def retrieve(self):
#     def __repr__(self):
#     def __str__(self):
#     def validate(self, obj, value):
# def get_from_nersc(user, relative_path):
# def rollback_and_log(db_connection, err):
# class NotifyList(list):
# class Workspace(object):
# class MetList(List):
# class MetUnicode(CUnicode):
# class MetFloat(CFloat):
# class MetInt(CInt):
# class MetBool(CBool):
# class Stub(HasTraits):
# class MetInstance(Instance):
# class MetEnum(Enum):


import getpass
import logging
import os
import pprint
import time
import uuid
import pandas as pd
from typing import Dict
from pwd import getpwuid
from tabulate import tabulate
from .object_helpers import (
    set_docstring, Workspace, format_timestamp, MetList,
    MetUnicode, MetFloat, MetInstance, MetInt, MetEnum, MetBool, HasTraits,
    Stub
)
from six.moves import zip
from __future__ import absolute_import
from __future__ import print_function




logger = logging.getLogger(__name__)

#Making a new table means adding a new class to metatlas_objects.py.
#Floats are set as single precision by default, unfortunately, so here is the best way to create a table containing floats:
#Create a new table
#1) Create a new class in metatlas_objects.py.
#2) Create a new object of that class and store it.
#3) Log into database
#4) Run alter table TABLE_NAME modify COLUMN_NAME double; for each float column
#Add a floating point object to a new table
#1) Update the class in metatlas_objects.py.
#2) Create an object with the updated class and store it.
#3) Log into database
#4) Run alter table TABLE_NAME modify COLUMN_NAME double; for each new float column


# Whether to fetch stubs automatically, disabled when we want to display
# a large number of objects.
FETCH_STUBS = True
ADDUCTS = ('','[M]+','[M+H]+','[M+H]2+','[M+2H]2+','[M+H-H2O]2+','[M+K]2+','[M+NH4]+','[M+Na]+','[M+H-H2O]+','[M-H]-','[M-2H]-','[M-H+Cl]-','[M-2H]2-','[M+Cl]-','[2M+H]+','[2M-H]-','[M-H+Na]+','[M+K]+','[M+2Na]2+','[M-e]+','[M+acetate]-','[M+formate]-','[M-H+Cl]2-','[M-H+2Na]+')

# Path: metatlas/datastructures/object_helpers.py
# ON_NERSC = 'METATLAS_LOCAL' not in os.environ
# def callback_method(func):
#     def notify(self, *args, **kwargs):
#     def __getitem__(self, item):
#     def __init__(self, *args):
#     def register_callback(self, cb):
#     def unregister_callback(self, cbid):
# def set_docstring(cls):
# def _get_subclasses(cls):
#     def __init__(self):
#     def get_instance(cls):
#     def get_connection(self):
#     def close_connection(self):
#     def convert_to_double(self, table, entry):
#     def save_objects(self, objects, _override=False):
#     def create_link_tables(self, klass):
#     def _get_save_data(self, obj, override=False):
#     def fix_table(self, table_name):
#     def retrieve(self, object_type, **kwargs):
#     def remove(self, object_type, **kwargs):
#     def remove_objects(self, objects, all_versions=True, **kwargs):
# def format_timestamp(tstamp):
#     def validate(self, obj, value):
#     def retrieve(self):
#     def __repr__(self):
#     def __str__(self):
#     def validate(self, obj, value):
# def get_from_nersc(user, relative_path):
# def rollback_and_log(db_connection, err):
# class NotifyList(list):
# class Workspace(object):
# class MetList(List):
# class MetUnicode(CUnicode):
# class MetFloat(CFloat):
# class MetInt(CInt):
# class MetBool(CBool):
# class Stub(HasTraits):
# class MetInstance(Instance):
# class MetEnum(Enum):


# Path: metatlas/datastructures/metatlas_objects.py
import getpass
import logging
import os
import pprint
import time
import uuid
import pandas as pd
from typing import Dict
from pwd import getpwuid
from tabulate import tabulate
from .object_helpers import (
    set_docstring, Workspace, format_timestamp, MetList,
    MetUnicode, MetFloat, MetInstance, MetInt, MetEnum, MetBool, HasTraits,
    Stub
)
from six.moves import zip

from __future__ import absolute_import
from __future__ import print_function




logger = logging.getLogger(__name__)

#Making a new table means adding a new class to metatlas_objects.py.
#Floats are set as single precision by default, unfortunately, so here is the best way to create a table containing floats:
#Create a new table
#1) Create a new class in metatlas_objects.py.
#2) Create a new object of that class and store it.
#3) Log into database
#4) Run alter table TABLE_NAME modify COLUMN_NAME double; for each float column
#Add a floating point object to a new table
#1) Update the class in metatlas_objects.py.
#2) Create an object with the updated class and store it.
#3) Log into database
#4) Run alter table TABLE_NAME modify COLUMN_NAME double; for each new float column


# Whether to fetch stubs automatically, disabled when we want to display
# a large number of objects.
FETCH_STUBS = True
ADDUCTS = ('','[M]+','[M+H]+','[M+H]2+','[M+2H]2+','[M+H-H2O]2+','[M+K]2+','[M+NH4]+','[M+Na]+','[M+H-H2O]+','[M-H]-','[M-2H]-','[M-H+Cl]-','[M-2H]2-','[M+Cl]-','[2M+H]+','[2M-H]-','[M-H+Na]+','[M+K]+','[M+2Na]2+','[M-e]+','[M+acetate]-','[M+formate]-','[M-H+Cl]2-','[M-H+2Na]+')

POLARITY = ('positive', 'negative', 'alternating')