<commit_before>import sys
import platform
import os
import re
from substance.shell import (Shell)
from subprocess import check_output
from functools import lru_cache
from pathlib import (PureWindowsPath, PurePosixPath)

from substance.platform import (isWSL, isCygwin)

@lru_cache(maxsize=None)
def inner(path):
    if isCygwin():
        path = check_output(["cygpath", "-u", path]).decode().strip()
    if isWSL() and PureWindowsPath(path).drive:
        path = check_output(["wslpath", "-u", path]).decode().strip()
    return path
       
@lru_cache(maxsize=None)
def outer(posixPath):
    if isCygwin():
        path = check_output(["cygpath", "-w", posixPath]).decode().strip()
    elif isWSL():
        path = check_output(["wslpath", "-w", posixPath]).decode().strip()
    else:
        path = posixPath
    return path


@lru_cache(maxsize=None)
def getHomeDirectory(subpath=None):
    if isWSL():
        homePath = getWindowsHomeDirectory()
    else:
        homePath = getUnixHomeDirectory()

    path = homePath.joinpath(subpath) if subpath else homePath
    return inner(str(path))

@lru_cache(maxsize=None)
def getUnixHomeDirectory():
    return PurePosixPath(os.path.expanduser('~'))

@lru_cache(maxsize=None)
def getWindowsHomeDirectory():
    winPath = PureWindowsPath(check_output(["cmd.exe", "/C", 'echo %USERPROFILE%']).decode().strip())
    return PurePosixPath(winPath.as_posix())

def pathComponents(path):
    folders = []
    path = os.path.normpath(path)
    while 1:
        path, folder = os.path.split(path)

        if folder != "":
            folders.append(folder)
        else:
            if path != "":
                folders.append(path)
            break

    folders.reverse()
    return folders

def expandLocalPath(path, basePath=None):<commit_msg>chore: lint + pep8 path.py<commit_after>import sys
import platform
import os
import re
from substance.shell import (Shell)
from subprocess import check_output
from functools import lru_cache
from pathlib import (PureWindowsPath, PurePosixPath)

from substance.platform import (isWSL, isCygwin)


@lru_cache(maxsize=None)
def inner(path):
    if isCygwin():
        path = check_output(["cygpath", "-u", path]).decode().strip()
    if isWSL() and PureWindowsPath(path).drive:
        path = check_output(["wslpath", "-u", path]).decode().strip()
    return path


@lru_cache(maxsize=None)
def outer(posixPath):
    if isCygwin():
        path = check_output(["cygpath", "-w", posixPath]).decode().strip()
    elif isWSL():
        path = check_output(["wslpath", "-w", posixPath]).decode().strip()
    else:
        path = posixPath
    return path


@lru_cache(maxsize=None)
def getHomeDirectory(subpath=None):
    if isWSL():
        homePath = getWindowsHomeDirectory()
    else:
        homePath = getUnixHomeDirectory()

    path = homePath.joinpath(subpath) if subpath else homePath
    return inner(str(path))


@lru_cache(maxsize=None)
def getUnixHomeDirectory():
    return PurePosixPath(os.path.expanduser('~'))


@lru_cache(maxsize=None)
def getWindowsHomeDirectory():
    winPath = PureWindowsPath(check_output(["cmd.exe", "/C", 'echo %USERPROFILE%']).decode().strip())
    return PurePosixPath(winPath.as_posix())


def pathComponents(path):
    folders = []
    path = os.path.normpath(path)
    while 1:
        path, folder = os.path.split(path)

        if folder != "":
            folders.append(folder)
        else:
            if path != "":
                folders.append(path)
            break

    folders.reverse()
    return folders


def expandLocalPath(path, basePath=None):
{'fraction_non_alphanumeric': 0.13327768503060658, 'fraction_numerical': 0.0008347245409015025, 'mean_word_length': 3.476961394769614, 'pattern_counts': {'":': 4, '<': 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': '1309178', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1154, 'n_words': 254}