<commit_before>#!/usr/bin/python

import os
import sys
import argparse
import json

# unmount the directories
def unmount_directories(local_mount_dir, directories):

    directories_unmounted = 0

    for directory in directories:
        dir_path = "%s/%s" % (local_mount_dir, directory)
        # check if this directory is a mount point, and if not, skip it
        if not os.path.ismount(dir_path):
            continue
        else:
            os.system("umount %s/test" % dir_path)
            if not os.path.ismount(dir_path):
                print '"%s" directory unmounted' % directory
                os.system("rm -r %s" % dir_path)
                directories_unmounted += 1
            else:
                print 'error unmounting "%s" directory' % directory
                break

    if directories_unmounted == 0:
        print "No directories currently mounted"

# get configuration
def get_config(config_file):
    with open(config_file) as f:
        data = json.load(f)
    return data


# parse the args input by the user
parser = argparse.ArgumentParser(description='Unmount directories on local filesystem.')
parser.add_argument("-d", "--directories", nargs='*', help="list of directories to unmount")

# get args
args = parser.parse_args()

config_dir, script_file = os.path.split(os.path.abspath(__file__))
config_file = "%s/pymount_config.json" % config_dir
config = get_config(config_file)

local_mount_dir = config["local_mount_dir"]

if args.directories:
    unmount_directories(local_mount_dir, args.directories)
else:
    if not os.path.ismount(local_mount_dir):
        print "Directory not mounted"
    else:
        os.system("umount %s" % local_mount_dir)
<commit_msg>removing debugging from unmount script<commit_after>#!/usr/bin/python

import os
import sys
import argparse
import json

# unmount the directories
def unmount_directories(local_mount_dir, directories):

    directories_unmounted = 0

    for directory in directories:
        dir_path = "%s/%s" % (local_mount_dir, directory)
        # check if this directory is a mount point, and if not, skip it
        if not os.path.ismount(dir_path):
            continue
        else:
            os.system("umount %s" % dir_path)
            if not os.path.ismount(dir_path):
                print '"%s" directory unmounted' % directory
                os.system("rm -r %s" % dir_path)
                directories_unmounted += 1
            else:
                print 'error unmounting "%s" directory' % directory
                break

    if directories_unmounted == 0:
        print "No directories currently mounted"

# get configuration
def get_config(config_file):
    with open(config_file) as f:
        data = json.load(f)
    return data


# parse the args input by the user
parser = argparse.ArgumentParser(description='Unmount directories on local filesystem.')
parser.add_argument("-d", "--directories", nargs='*', help="list of directories to unmount")

# get args
args = parser.parse_args()

config_dir, script_file = os.path.split(os.path.abspath(__file__))
config_file = "%s/pymount_config.json" % config_dir
config = get_config(config_file)

local_mount_dir = config["local_mount_dir"]

if args.directories:
    unmount_directories(local_mount_dir, args.directories)
else:
    if not os.path.ismount(local_mount_dir):
        print "Directory not mounted"
    else:
        os.system("umount %s" % local_mount_dir)

{'fraction_non_alphanumeric': 0.09708454810495627, 'fraction_numerical': 0.001749271137026239, 'mean_word_length': 2.980278422273782, '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': '4684755', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1016, 'n_words': 282}