<commit_before>import logging

from crispy.lib.module import *
from crispy.lib.fprint import *

logger = logging.getLogger(__name__)

__class_name__ = "AppsModule"
class AppsModule(CrispyModule):
    """ Enum applications on a remote machine. """

    # can be: 'Darwin', 'Linux', 'Windows', 'Android'
    compatible_systems = ['Darwin']

    def run(self, args):
        logger.debug("run(args) was called")
        info("Getting installed apps now...")

        if (self.is_compatible()):
            print "\nInstalled applications:\n==================="

            try:
                if self.client.is_darwin():
                    apps = self.client.conn.modules['os'].listdir('/Applications') 
                    for app in apps:
                        if app.endswith(".app"): 
                            try:
                                pl = self.client.conn.modules['plistlib'].readPlist('/Applications/' + app + '/Contents/Info.plist')
                                print app[:-4] + " " + pl["CFBundleShortVersionString"]
                            except:
                                print app[:-4] + " [No version in plist]"
            except Exception as e:
                logger.error(e)<commit_msg>clean up<commit_after>import logging

from crispy.lib.module import *
from crispy.lib.fprint import *

logger = logging.getLogger(__name__)

__class_name__ = "AppsModule"
class AppsModule(CrispyModule):
    """ Enum applications on a remote machine. """

    # can be: 'Darwin', 'Linux', 'Windows', 'Android'
    compatible_systems = ['Darwin']

    def run(self, args):
        logger.debug("run(args) was called")

        if (self.is_compatible()):
            print "\nInstalled applications:\n==================="

            try:
                if self.client.is_darwin():
                    apps = self.client.conn.modules['os'].listdir('/Applications') 
                    for app in apps:
                        if app.endswith(".app"): 
                            try:
                                pl = self.client.conn.modules['plistlib'].readPlist('/Applications/' + app + '/Contents/Info.plist')
                                print app[:-4] + " " + pl["CFBundleShortVersionString"]
                            except:
                                print app[:-4] + " [No version in plist]"
            except Exception as e:
                logger.error(e)
{'fraction_non_alphanumeric': 0.13706004140786748, 'fraction_numerical': 0.0016563146997929607, 'mean_word_length': 1.6755260243632337, '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': '2721070', 'n_tokens_mistral': 663, 'n_tokens_neox': 610, 'n_words': 144}