<commit_before>import os
import yaml

import panoptes.utils.logger as logger
import panoptes.utils.serial as serial
import panoptes.utils.config as config
import panoptes.utils.error as error


@logger.has_logger
@config.has_config
class AbstractMount():

    """ 
    Abstract Base class for controlling a mount 
 
    Methods to be implemented:
        - check_coordinates
        - sync_coordinates
        - slew_to_coordinates
        - slew_to_park
        - echo

    """

    def __init__(self,
                 config=dict(),
                 commands=dict(),
                 connect=False,
                 ):
        """ 
        Create a new mount class. Sets the following properies:
        
            - self.non_sidereal_available = False
            - self.PEC_available = False
            - self.is_connected = False
            - self.is_slewing = False
            - self.is_initialized = False

        After setting, calls the following:

            - setup_commands
            - setup_serial
        """
        self.mount_config = self.config.get('mount')

        if config:
            self.mount_config.update(config)


        assert self.mount_config.get('port') is not None, self.logger.error('No mount port specified, cannot create mount')

        self.logger.info('Creating mount')
        # Setup commands for mount
        self.commands = self.setup_commands(commands)

        # self.logger.debug("Commands available to mount: \n {}".format(self.commands))

        # We set some initial mount properties. May come from config
        self.non_sidereal_available = self.mount_config.setdefault('non_sidereal_available', False)
        self.PEC_available = self.mount_config.setdefault('PEC_available', False) 
        self.port = self.mount_config.get('port')

        # Initial states
        self.is_connected = False
        self.is_initialized = False
        
        # Slew is checked each time. See is_slewing()
        self._is_slewing = False

        # Setup connection
        if connect:
            self.connect()

        self.logger.info('Mount created')

    def setup_commands(self, commands):
        """ 
        Does any setup for the commands needed for this mount. Mostly responsible for 
        setting the pre- and post-commands. We could also do some basic checking here
        to make sure required commands are in fact available.
        """
        self.logger.info('Setting up commands for mount')
        # If commands are not passed in, look for configuration file
        self.logger.debug('commands: {}'.format(commands))

        if len(commands) == 0:<commit_msg>Fixing mount class config and tests<commit_after>import os
import yaml

import panoptes.utils.logger as logger
import panoptes.utils.serial as serial
import panoptes.utils.error as error

@logger.has_logger
class AbstractMount():

    """ 
    Abstract Base class for controlling a mount 
 
    Methods to be implemented:
        - check_coordinates
        - sync_coordinates
        - slew_to_coordinates
        - slew_to_park
        - echo

    """

    def __init__(self,
                 config=dict(),
                 commands=dict(),
                 connect=False,
                 ):
        """ 
        Create a new mount class. Sets the following properies:
        
            - self.non_sidereal_available = False
            - self.PEC_available = False
            - self.is_connected = False
            - self.is_slewing = False
            - self.is_initialized = False

        After setting, calls the following:

            - setup_commands
            - setup_serial
        """
        self.mount_config = dict()

        if config:
            self.mount_config.update(config.get('mount'))

        assert self.mount_config.get('port') is not None, self.logger.error('No mount port specified, cannot create mount')

        self.logger.info('Creating mount')
        # Setup commands for mount
        self.commands = self.setup_commands(commands)

        # We set some initial mount properties. May come from config
        self.non_sidereal_available = self.mount_config.setdefault('non_sidereal_available', False)
        self.PEC_available = self.mount_config.setdefault('PEC_available', False) 
        self.port = self.mount_config.get('port')

        # Initial states
        self.is_connected = False
        self.is_initialized = False
        
        # Slew is checked each time. See is_slewing()
        self._is_slewing = False

        # Setup connection
        if connect:
            self.connect()

        self.logger.info('Mount created')

    def setup_commands(self, commands):
        """ 
        Does any setup for the commands needed for this mount. Mostly responsible for 
        setting the pre- and post-commands. We could also do some basic checking here
        to make sure required commands are in fact available.
        """
        self.logger.info('Setting up commands for mount')
        # If commands are not passed in, look for configuration file
        # self.logger.debug('commands: {}'.format(commands))

        if len(commands) == 0:
{'fraction_non_alphanumeric': 0.08016304347826086, 'fraction_numerical': 0.00038819875776397513, 'mean_word_length': 2.065437239738251, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5275992', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1298, 'n_words': 395}