<commit_before>#!/usr/bin/env python3

import requests
import json
import os
import re
import uuid
import subprocess
import pkg_resources
import multiprocessing


from os import scandir

SERVER_UUID = None
STORJSHARE_PATH = None

STORJ_WINDOWS_VERSION = '0.2.0'

def examine_configs(path, windows=False):
    if windows == False:
        version = pkg_resources.get_distribution("storjdash").version
    else:
        version = STORJ_WINDOWS_VERSION
    #version = '0.6.3'
    if windows == False:
        storj_node_pairs = examine_storjstatus()
    else:
        storj_node_pairs = None
    #storj_node_pairs = None
    #print(storj_node_pairs)
    report_uuid = str(uuid.uuid4())
    potential_config_files = os.scandir(path)
    mp_args = []
    for config_file in potential_config_files:
        if config_file.is_file():
           mp_args.append([config_file.name, config_file.path, report_uuid, storj_node_pairs, version, windows])

    pool = multiprocessing.Pool()

    results = pool.starmap(send_report, mp_args)
    print(results)
    print('All reports sent')

def get_size_of_path(path):
    try:
        details = scandir(path)
    except FileNotFoundError:
        print('Path does not exist: ' + path)
        return 0
    size = 0
    for item in details:
        if item.is_dir():
            size += get_size_of_path(item.path)
        else:
            try:
                size += item.stat().st_size
            except FileNotFoundError:
                pass
    return size

def examine_storjstatus():
    env = os.environ
    env['PATH'] = os.environ.get('PATH') + ':' + STORJSHARE_PATH
    proc = subprocess.Popen(['storjshare', 'status'], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    results = proc.communicate()
    #print(results)
    cells = results[0].split(b'\xe2')
    #print(cells)
    node_pairs = {}
    for index, cell in enumerate(cells):<commit_msg>Fix for permission errors<commit_after>#!/usr/bin/env python3

import requests
import json
import os
import re
import uuid
import subprocess
import pkg_resources
import multiprocessing


from os import scandir

SERVER_UUID = None
STORJSHARE_PATH = None

STORJ_WINDOWS_VERSION = '0.2.0'

def examine_configs(path, windows=False):
    if windows == False:
        version = pkg_resources.get_distribution("storjdash").version
    else:
        version = STORJ_WINDOWS_VERSION
    #version = '0.6.3'
    if windows == False:
        storj_node_pairs = examine_storjstatus()
    else:
        storj_node_pairs = None
    #storj_node_pairs = None
    #print(storj_node_pairs)
    report_uuid = str(uuid.uuid4())
    potential_config_files = os.scandir(path)
    mp_args = []
    for config_file in potential_config_files:
        if config_file.is_file():
           mp_args.append([config_file.name, config_file.path, report_uuid, storj_node_pairs, version, windows])

    pool = multiprocessing.Pool()

    results = pool.starmap(send_report, mp_args)
    print(results)
    print('All reports sent')

def get_size_of_path(path):
    try:
        details = scandir(path)
    except FileNotFoundError:
        print('Path does not exist: ' + path)
        return 0
    except PermissionError:
        print('Access Denied' + path)
        return 0
    size = 0
    for item in details:
        if item.is_dir():
            try:
                size += get_size_of_path(item.path)
            except PermissionError:
                pass
        else:
            try:
                size += item.stat().st_size
            except FileNotFoundError:
                pass
            except PermissionError:
                pass
    return size

def examine_storjstatus():
    env = os.environ
    env['PATH'] = os.environ.get('PATH') + ':' + STORJSHARE_PATH
    proc = subprocess.Popen(['storjshare', 'status'], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    results = proc.communicate()
    #print(results)
    cells = results[0].split(b'\xe2')
    #print(cells)
    node_pairs = {}
    for index, cell in enumerate(cells):
{'fraction_non_alphanumeric': 0.09925742574257426, 'fraction_numerical': 0.006188118811881188, 'mean_word_length': 2.752089136490251, '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': '6594223', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1306, 'n_words': 288}