import signal import subprocess import sys import tempfile import traceback import time import attr import lib50 import requests import termcolor from . import internal, renderer, __version__ from .runner import CheckRunner lib50.set_local_path(os.environ.get("CHECK50_PATH", "~/.local/share/check50")) SLUG = None class RemoteCheckError(internal.Error): def __init__(self, remote_json): super().__init__("check50 ran into an error while running checks! Please contact [email protected]!") self.payload = {"remote_json": remote_json} @contextlib.contextmanager def nullcontext(entry_result=None): """This is just contextlib.nullcontext but that function is only available in 3.7+.""" yield entry_result
import contextlib import os import re import sys import lib50 from . import HELPERS, PREPROCESSORS lib50.set_local_path(os.environ.get("HELP50_PATH", "~/.local/share/help50")) CONFIG_LOADER = lib50.config.Loader("help50") @contextlib.contextmanager def _syspath(newpath): """ Useful contextmanager that temporarily replaces sys.path. """ oldpath = sys.path sys.path = newpath try: yield finally: sys.path = oldpath def load_config(dir): """ Read cs50 YAML file and apply default configuration to unspecified fields. """ options = { "helpers": ["helpers"] } try: config_file = lib50.config.get_config_filepath(dir) with open(config_file) as f: