<commit_before>import sys

from libcloud.types import NodeState

readable_status = {NodeState.RUNNING: "Running",
        NodeState.REBOOTING: "Rebooting",
        NodeState.TERMINATED: "Terminated",
        NodeState.PENDING: "Pending",
        NodeState.UNKNOWN: "Unknown"}


class Printer(object):
    _formats = {"nodeimage": "image %(name)s (id = %(id)s)",
            "nodesize": ("size %(name)s (id=%(id)s, ram=%(ram)s,"
                " disk=%(disk)s bandwidth=%(bandwidth)s)"),
            "rackspacesharedipgroup": ("IP group %(name)s"
                " (id = %(id)s, servers = %(servers)s)"),
            "gogridipaddress": ("ip %(ip)s "
                "(id=%(id)s, public=%(public)s, state=%(state)s, subnet=%(subnet)s)"),
            "loadbalancer": "%(id)s %(name)s %(ip)s:%(port)s"
            }

    @classmethod
    def do(self, thing, format=None):
        """Smart print object depending on its type.

        Order of preference: _print_$objtime() method -> _formats -> str(obj)"""

        print_class = thing.__class__.__name__.lower()
        print_method = "_print_%s" % print_class

        if hasattr(self, print_method):
            return getattr(self, print_method)(thing, format)<commit_msg>Fix old-style import to make code work with new libcloud versions.<commit_after>import sys

from libcloud.compute.types import NodeState

readable_status = {NodeState.RUNNING: "Running",
        NodeState.REBOOTING: "Rebooting",
        NodeState.TERMINATED: "Terminated",
        NodeState.PENDING: "Pending",
        NodeState.UNKNOWN: "Unknown"}


class Printer(object):
    _formats = {"nodeimage": "image %(name)s (id = %(id)s)",
            "nodesize": ("size %(name)s (id=%(id)s, ram=%(ram)s,"
                " disk=%(disk)s bandwidth=%(bandwidth)s)"),
            "rackspacesharedipgroup": ("IP group %(name)s"
                " (id = %(id)s, servers = %(servers)s)"),
            "gogridipaddress": ("ip %(ip)s "
                "(id=%(id)s, public=%(public)s, state=%(state)s, subnet=%(subnet)s)"),
            "loadbalancer": "%(id)s %(name)s %(ip)s:%(port)s"
            }

    @classmethod
    def do(self, thing, format=None):
        """Smart print object depending on its type.

        Order of preference: _print_$objtime() method -> _formats -> str(obj)"""

        print_class = thing.__class__.__name__.lower()
        print_method = "_print_%s" % print_class

        if hasattr(self, print_method):
            return getattr(self, print_method)(thing, format)
{'fraction_non_alphanumeric': 0.1655364978061428, 'fraction_numerical': 0.0, 'mean_word_length': 2.8466257668711656, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 7, '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': '3348343', 'n_tokens_mistral': 840, 'n_tokens_neox': 822, 'n_words': 173}