Method to check if the test cases already exist in cache If not, create the directory structure to store test cases
(site, contest, problem)
| 126 | |
| 127 | @staticmethod |
| 128 | def check_cache(site, contest, problem): |
| 129 | """ |
| 130 | Method to check if the test cases already exist in cache |
| 131 | If not, create the directory structure to store test cases |
| 132 | """ |
| 133 | |
| 134 | if problem is None: |
| 135 | if not os.path.isdir(os.path.join(Utilities.cache_dir, site, contest)): |
| 136 | os.makedirs(os.path.join(Utilities.cache_dir, site, contest)) |
| 137 | return False |
| 138 | |
| 139 | # Handle case for SPOJ specially as it does not have contests |
| 140 | contest = '' if site == 'spoj' else contest |
| 141 | |
| 142 | if os.path.isdir(os.path.join(Utilities.cache_dir, site, contest, problem)): |
| 143 | return True |
| 144 | else: |
| 145 | os.makedirs(os.path.join(Utilities.cache_dir, site, |
| 146 | contest, problem)) |
| 147 | return False |
| 148 | |
| 149 | @staticmethod |
| 150 | def clear_cache(site): |
no outgoing calls
no test coverage detected