# Path: gffutils/constants.py
# SCHEMA = """
# 
# CREATE TABLE features (
#     id text,
#     seqid text,
#     source text,
#     featuretype text,
#     start int,
#     end int,
#     score text,
#     strand text,
#     frame text,
#     attributes text,
#     extra text,
#     bin int,
#     primary key (id)
#     );
# 
# CREATE TABLE relations (
#     parent text,
#     child text,
#     level int,
#     primary key (parent, child, level)
#     );
# 
# CREATE TABLE meta (
#     dialect text,
#     version text
#     );
# 
# CREATE TABLE directives (
#     directive text
#     );
# 
# CREATE TABLE autoincrements (
#     base text,
#     n int,
#     primary key (base)
#     );
# 
# CREATE TABLE duplicates (
#     idspecid text,
#     newid text,
#     primary key (newid)
#     );
# 
# 
# """
# _SELECT = "SELECT " \
#     + ', '.join(_keys) \
#     + ", features.rowid as file_order FROM features "
# _INSERT = "INSERT INTO features (" \
#     + ', '.join(_keys) + ") VALUES (" + ','.join(list('?' * len(_keys))) + ")"
# _UPDATE = "UPDATE features SET " + _update_clause + " WHERE id = ?"
# INDEXES = []
# 
# Path: gffutils/exceptions.py
# class AttributeStringError(Exception):
#     pass


import re
import copy
import collections
import logging
from six.moves import urllib
from gffutils import constants
from gffutils.exceptions import AttributeStringError
    from gffutils import feature

        # Only key provided?
        elif len(item) == 1:
                key = item[0]
                val = ''

        # Pathological cases where values of a key have within them the key-val
        # separator, e.g.,
        #  Alias=SGN-M1347;ID=T0028;Note=marker name(s): T0028 SGN-M1347 |identity=99.58|escore=2e-126
        #                                                                         ^            ^
        else:
            key = item[0]
            val = dialect['keyval separator'].join(item[1:])

        # Is the key already in there?
        if key in quals:
            dialect['repeated keys'] = True
        else:
            quals[key] = []

        # Remove quotes in GFF2
        if len(val) > 0 and val[0] == '"' and val[-1] == '"':
            val = val[1:-1]
            dialect['quoted GFF2 values'] = True
        if val:
            # TODO: if there are extra commas for a value, just use empty
            # strings
            # quals[key].extend([v for v in val.split(',') if v])
            vals = val.split(',')
            if (len(vals) > 1) and dialect['repeated keys']:

# Path: gffutils/constants.py
# SCHEMA = """
# 
# CREATE TABLE features (
#     id text,
#     seqid text,
#     source text,
#     featuretype text,
#     start int,
#     end int,
#     score text,
#     strand text,
#     frame text,
#     attributes text,
#     extra text,
#     bin int,
#     primary key (id)
#     );
# 
# CREATE TABLE relations (
#     parent text,
#     child text,
#     level int,
#     primary key (parent, child, level)
#     );
# 
# CREATE TABLE meta (
#     dialect text,
#     version text
#     );
# 
# CREATE TABLE directives (
#     directive text
#     );
# 
# CREATE TABLE autoincrements (
#     base text,
#     n int,
#     primary key (base)
#     );
# 
# CREATE TABLE duplicates (
#     idspecid text,
#     newid text,
#     primary key (newid)
#     );
# 
# 
# """
# _SELECT = "SELECT " \
#     + ', '.join(_keys) \
#     + ", features.rowid as file_order FROM features "
# _INSERT = "INSERT INTO features (" \
#     + ', '.join(_keys) + ") VALUES (" + ','.join(list('?' * len(_keys))) + ")"
# _UPDATE = "UPDATE features SET " + _update_clause + " WHERE id = ?"
# INDEXES = []
# 
# Path: gffutils/exceptions.py
# class AttributeStringError(Exception):
#     pass


# Path: gffutils/parser.py
import re
import copy
import collections
import logging
from six.moves import urllib
from gffutils import constants
from gffutils.exceptions import AttributeStringError
    from gffutils import feature


        # Only key provided?
        elif len(item) == 1:
                key = item[0]
                val = ''

        # Pathological cases where values of a key have within them the key-val
        # separator, e.g.,
        #  Alias=SGN-M1347;ID=T0028;Note=marker name(s): T0028 SGN-M1347 |identity=99.58|escore=2e-126
        #                                                                         ^            ^
        else:
            key = item[0]
            val = dialect['keyval separator'].join(item[1:])

        # Is the key already in there?
        if key in quals:
            dialect['repeated keys'] = True
        else:
            quals[key] = []

        # Remove quotes in GFF2
        if len(val) > 0 and val[0] == '"' and val[-1] == '"':
            val = val[1:-1]
            dialect['quoted GFF2 values'] = True
        if val:
            # TODO: if there are extra commas for a value, just use empty
            # strings
            # quals[key].extend([v for v in val.split(',') if v])
            vals = val.split(',')
            if (len(vals) > 1) and dialect['repeated keys']:

                raise AttributeStringError(