# Path: indra/config.py
# def get_config(key, failure_ok=True):
#     """Get value by key from config file or environment.
# 
#     Returns the configuration value, first checking the environment
#     variables and then, if it's not present there, checking the configuration
#     file.
# 
#     Parameters
#     ----------
#     key : str
#         The key for the configuration value to fetch
#     failure_ok : Optional[bool]
#         If False and the configuration is missing, an IndraConfigError is
#         raised. If True, None is returned and no error is raised in case
#         of a missing configuration. Default: True
# 
#     Returns
#     -------
#     value : str or None
#         The configuration value or None if the configuration value doesn't
#         exist and failure_ok is set to True.
#     """
#     err_msg = "Key %s not in environment or config file." % key
#     if key in os.environ:
#         return os.environ[key]
#     elif key in CONFIG_DICT:
#         val = CONFIG_DICT[key]
#         # We interpret an empty value in the config file as a failure
#         if val is None and not failure_ok:
#             msg = 'Key %s is set to an empty value in config file.' % key
#             raise IndraConfigError(msg)
#         else:
#             return val
#     elif not failure_ok:
#         raise IndraConfigError(err_msg)
#     else:
#         return None


from builtins import dict, str
from indra.config import get_config
    from kqml import KQMLModule, KQMLPerformative, KQMLList
import os
import sys
import time
import random
import signal
import logging
import subprocess

    def read_text(self, text):
        """Read a given text phrase.

        Parameters
        ----------
        text : str
            The text to read. Typically a sentence or a paragraph.
        """
        logger.info('Reading: "%s"' % text)
        msg_id = 'RT000%s' % self.msg_counter
        kqml_perf = _get_perf(text, msg_id)
        self.reply_counter += 1
        self.msg_counter += 1
        self.send(kqml_perf)

    def receive_reply(self, msg, content):
        """Handle replies with reading results."""
        reply_head = content.head()
        if reply_head == 'error':
            comment = content.gets('comment')
            logger.error('Got error reply: "%s"' % comment)
        else:
            extractions = content.gets('ekb')
            self.extractions.append(extractions)
        self.reply_counter -= 1
        if self.reply_counter == 0:
            self.exit(0)

    def _run_drum(self, host, port):

# Path: indra/config.py
# def get_config(key, failure_ok=True):
#     """Get value by key from config file or environment.
# 
#     Returns the configuration value, first checking the environment
#     variables and then, if it's not present there, checking the configuration
#     file.
# 
#     Parameters
#     ----------
#     key : str
#         The key for the configuration value to fetch
#     failure_ok : Optional[bool]
#         If False and the configuration is missing, an IndraConfigError is
#         raised. If True, None is returned and no error is raised in case
#         of a missing configuration. Default: True
# 
#     Returns
#     -------
#     value : str or None
#         The configuration value or None if the configuration value doesn't
#         exist and failure_ok is set to True.
#     """
#     err_msg = "Key %s not in environment or config file." % key
#     if key in os.environ:
#         return os.environ[key]
#     elif key in CONFIG_DICT:
#         val = CONFIG_DICT[key]
#         # We interpret an empty value in the config file as a failure
#         if val is None and not failure_ok:
#             msg = 'Key %s is set to an empty value in config file.' % key
#             raise IndraConfigError(msg)
#         else:
#             return val
#     elif not failure_ok:
#         raise IndraConfigError(err_msg)
#     else:
#         return None


# Path: indra/sources/trips/drum_reader.py
from builtins import dict, str
from indra.config import get_config
    from kqml import KQMLModule, KQMLPerformative, KQMLList
import os
import sys
import time
import random
import signal
import logging
import subprocess


    def read_text(self, text):
        """Read a given text phrase.

        Parameters
        ----------
        text : str
            The text to read. Typically a sentence or a paragraph.
        """
        logger.info('Reading: "%s"' % text)
        msg_id = 'RT000%s' % self.msg_counter
        kqml_perf = _get_perf(text, msg_id)
        self.reply_counter += 1
        self.msg_counter += 1
        self.send(kqml_perf)

    def receive_reply(self, msg, content):
        """Handle replies with reading results."""
        reply_head = content.head()
        if reply_head == 'error':
            comment = content.gets('comment')
            logger.error('Got error reply: "%s"' % comment)
        else:
            extractions = content.gets('ekb')
            self.extractions.append(extractions)
        self.reply_counter -= 1
        if self.reply_counter == 0:
            self.exit(0)

    def _run_drum(self, host, port):

        drum_path = get_config('DRUMPATH')