<commit_before>"""Abstraction of all ultrasonic sensors as one unit."""

import lib.lib as lib
import hardware.us as us_mod


class USHub(object):

    """Class for abstracting all ultrasonics, working with them as a unit."""

    def __init__(self):
        """Build ultrasonic abstraction objects and logger."""
        # Get and store logger object
        self.logger = lib.get_logger()

        # Load system configuration
        config = lib.load_config()

        # Create IR array objects
        self.USs = {}
        for name, params in config["ultrasonics"]:
            self.USs[name] = us_mod.US(name, params)

    def __str__(self):
        """Returns human-readable representation of USHub.

        :returns: Info about each ultrasonic sensor owned by this USHub.

        """
        return "USHub: {}".format("; ".join(str(us)
                                   for us in self.USs.itervalues()))

    def read_all(self):
        """Get readings from all ultrasonic sensors.

        :returns: Readings from all ultrasonic sensors managed by this object.

        """
        readings = {}
        for position, us in self.USs.iteritems():
            readings[positoin] = us.distance<commit_msg>Minor bugfix in us_hub<commit_after>"""Abstraction of all ultrasonic sensors as one unit."""

import lib.lib as lib
import hardware.us as us_mod


class USHub(object):

    """Class for abstracting all ultrasonics, working with them as a unit."""

    def __init__(self):
        """Build ultrasonic abstraction objects and logger."""
        # Get and store logger object
        self.logger = lib.get_logger()

        # Load system configuration
        config = lib.load_config()

        # Create IR array objects
        self.USs = {}
        for name, params in config["ultrasonics"].iteritems():
            self.USs[name] = us_mod.US(name, params)

    def __str__(self):
        """Returns human-readable representation of USHub.

        :returns: Info about each ultrasonic sensor owned by this USHub.

        """
        return "USHub: {}".format("; ".join(str(us)
                                   for us in self.USs.itervalues()))

    def read_all(self):
        """Get readings from all ultrasonic sensors.

        :returns: Readings from all ultrasonic sensors managed by this object.

        """
        readings = {}
        for position, us in self.USs.iteritems():
            readings[positoin] = us.distance
{'fraction_non_alphanumeric': 0.10167415271539404, 'fraction_numerical': 0.0, 'mean_word_length': 2.2710280373831777, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4509009', 'n_tokens_mistral': 702, 'n_tokens_neox': 635, 'n_words': 228}