# Path: linux_story/common.py
# def get_max_challenge_number():
# def get_username():
# def get_story_file(name):


import filecmp
import os
import shutil
import stat
import errno
from linux_story.common import fake_home_dir, tq_file_system, get_story_file
    if os.path.exists(path):
        if os.path.isdir(path):
            shutil.rmtree(path)
        else:
            os.remove(path)


def revert_to_default_permissions(filesystem):
    for root, dirs, files in os.walk(filesystem):
        for d in dirs:
            path = os.path.join(root, d)
            os.chmod(path, 0755)
        for f in files:
            path = os.path.join(root, f)
            os.chmod(path, 0644)


def get_oct_permissions(path):
    return oct(os.stat(path).st_mode & 0777)


def get_int_permissions(path):
    return int(os.stat(path).st_mode & 0777)


def delete_items(items):
    if not items:
        return

    for path in items:

# Path: linux_story/common.py
# def get_max_challenge_number():
# def get_username():
# def get_story_file(name):


# Path: linux_story/file_creation/FileTree.py
import filecmp
import os
import shutil
import stat
import errno
from linux_story.common import fake_home_dir, tq_file_system, get_story_file

    if os.path.exists(path):
        if os.path.isdir(path):
            shutil.rmtree(path)
        else:
            os.remove(path)


def revert_to_default_permissions(filesystem):
    for root, dirs, files in os.walk(filesystem):
        for d in dirs:
            path = os.path.join(root, d)
            os.chmod(path, 0755)
        for f in files:
            path = os.path.join(root, f)
            os.chmod(path, 0644)


def get_oct_permissions(path):
    return oct(os.stat(path).st_mode & 0777)


def get_int_permissions(path):
    return int(os.stat(path).st_mode & 0777)


def delete_items(items):
    if not items:
        return

    for path in items:

        real_path = os.path.expanduser(path.replace('~', fake_home_dir))