diff --git a/app/main.py b/app/main.py index 442b381e..dc61aa34 100644 --- a/app/main.py +++ b/app/main.py @@ -1,3 +1,16 @@ +from os import remove +from typing import Optional, Type + + class CleanUpFile: - # write your code here - pass + def __init__(self, name: str) -> None: + self.filename = name + + def __enter__(self) -> "CleanUpFile": + return self + + def __exit__(self, + exc_type: Optional[Type[BaseException]], + exc_val: Optional[Type[BaseException]], + exc_tb: Optional[object]) -> None: + remove(self.filename)