MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / _remove_artifacts

Method _remove_artifacts

tools/Polygraphy/tests/test_examples.py:156–167  ·  view source on GitHub ↗
(self, must_exist=True)

Source from the content-addressed store, hash-verified

154 return [path for path in glob.iglob(os.path.join(self.path, "*")) if "__pycache__" not in path]
155
156 def _remove_artifacts(self, must_exist=True):
157 for artifact in self.artifacts:
158 if must_exist:
159 print(f"Checking for the existence of artifact: {artifact}")
160 assert os.path.exists(artifact), f"{artifact} does not exist!"
161 elif not os.path.exists(artifact):
162 continue
163
164 if os.path.isdir(artifact):
165 shutil.rmtree(artifact)
166 else:
167 os.remove(artifact)
168
169 def __enter__(self):
170 self._remove_artifacts(must_exist=False)

Callers 2

__enter__Method · 0.95
__exit__Method · 0.95

Calls 2

printFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected