# Path: hgvs/exceptions.py
# class HGVSError(Exception):
#     pass
# 
# class HGVSDataNotAvailableError(HGVSError):
#     pass


import os
import re
import six
import hgvs
import logging
import inspect
import psycopg2
import psycopg2.extras
import psycopg2.pool
import contextlib
from six.moves.urllib import parse as urlparse
from hgvs.exceptions import HGVSError, HGVSDataNotAvailableError

                # autocommit=True obviates closing explicitly
                conn.autocommit = True

                cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
                cur.execute("set search_path = {self.url.schema};".format(self=self))

                yield cur

                # contextmanager executes these when context exits
                cur.close()
                if self.pooling:
                    self._pool.putconn(conn)

                break

            except psycopg2.OperationalError:

                _logger.warning(
                    "Lost connection to {url}; attempting reconnect".format(url=self.url))
                if self.pooling:
                    self._pool.closeall()
                self._connect()
                _logger.warning("Reconnected to {url}".format(url=self.url))

            n_tries_rem -= 1

        else:

            # N.B. Probably never reached

# Path: hgvs/exceptions.py
# class HGVSError(Exception):
#     pass
# 
# class HGVSDataNotAvailableError(HGVSError):
#     pass


# Path: hgvs/dataproviders/ncbi.py
import os
import re
import six
import hgvs
import logging
import inspect
import psycopg2
import psycopg2.extras
import psycopg2.pool
import contextlib
from six.moves.urllib import parse as urlparse
from hgvs.exceptions import HGVSError, HGVSDataNotAvailableError


                # autocommit=True obviates closing explicitly
                conn.autocommit = True

                cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
                cur.execute("set search_path = {self.url.schema};".format(self=self))

                yield cur

                # contextmanager executes these when context exits
                cur.close()
                if self.pooling:
                    self._pool.putconn(conn)

                break

            except psycopg2.OperationalError:

                _logger.warning(
                    "Lost connection to {url}; attempting reconnect".format(url=self.url))
                if self.pooling:
                    self._pool.closeall()
                self._connect()
                _logger.warning("Reconnected to {url}".format(url=self.url))

            n_tries_rem -= 1

        else:

            # N.B. Probably never reached

            raise HGVSError("Permanently lost connection to {url} ({n} retries)".format(