Best Python code snippet using webdriver_manager
archive.py
Source:archive.py
...6 def unpack(self, directory):7 if self.file_path.endswith(".zip"):8 return self.__extract_zip(directory)9 elif self.file_path.endswith(".tar.gz"):10 return self.__extract_tar_file(directory)11 def __extract_zip(self, to_directory):12 archive = zipfile.ZipFile(self.file_path)13 try:14 archive.extractall(to_directory)15 except Exception as e:16 if e.args[0] not in [26, 13] and e.args[1] not in ['Text file busy', 'Permission denied']:17 raise e18 return archive.namelist()19 def __extract_tar_file(self, to_directory):20 try:21 tar = tarfile.open(self.file_path, mode="r:gz")22 except tarfile.ReadError:23 tar = tarfile.open(self.file_path, mode="r:bz2")24 members = tar.getmembers()25 tar.extractall(to_directory)26 tar.close()...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!