sportsref/decorators.py
def switch_to_dir(dirPath):
    """
    Decorator that switches to given directory before executing function, and
    then returning to orignal directory.
    """

    def decorator(func):
        @funcutils.wraps(func)
        def wrapper(*args, **kwargs):
            orig_cwd = os.getcwd()
            os.chdir(dirPath)
            ret = func(*args, **kwargs)
            os.chdir(orig_cwd)
            return ret
        return wrapper

    return decorator
def switch_to_dir(dirPath):
    """
    Decorator that switches to given directory before executing function, and
    then returning to orignal directory.
    """

    def decorator(func):
        @funcutils.wraps(func)
        def wrapper(*args, **kwargs):
            orig_cwd = os.getcwd()
            os.chdir(dirPath)
            ret = func(*args, **kwargs)
            os.chdir(orig_cwd)
            return ret
        return wrapper

    return decorator
def switch_to_dir ( dirPath ) : def decorator ( func ) : @ funcutils . wraps ( func ) def wrapper ( * args , * * kwargs ) : orig_cwd = os . getcwd ( ) os . chdir ( dirPath ) ret = func ( * args , * * kwargs ) os . chdir ( orig_cwd ) return ret return wrapper return decorator
Decorator that switches to given directory before executing function, and
    then returning to orignal directory.
Decorator that switches to given directory before executing function and then returning to orignal directory .