Best Python code snippet using autotest_python
scrapper.py
Source:scrapper.py
...37 self.download_dir = download_dir if download_dir else os.path.join(expanduser("~"), "meps", "meps_data")38 self.sleep = sleep39 def run(self):40 """ Primary entry point of ScrapMEPS """41 self.get_data_files(folder="population_characteristics", year_lookup=FYPCDF_PUF_LOOKUP)42 self.get_data_files(folder="medical_conditions", year_lookup=MCDF_PUF_LOOKUP)43 self.get_data_files(folder="prescribed_medicines", year_lookup=PMDF_PUF_LOOKUP)44 self.get_data_files(folder="dental_visits", year_lookup=DVDF_PUF_LOOKUP)45 self.get_data_files(folder="other_medical_expenses", year_lookup=OMEDF_PUF_LOOKUP)46 self.get_data_files(folder="hospital_inpatient_stays", year_lookup=HISDF_PUF_LOOKUP)47 self.get_data_files(folder="emergency_room_visits", year_lookup=ERVDF_PUF_LOOKUP)48 self.get_data_files(folder="outpatient_visits", year_lookup=OVDF_PUF_LOOKUP)49 self.get_data_files(folder="office_based_visits", year_lookup=OBMPVDF_PUF_LOOKUP)50 self.get_data_files(folder="home_health", year_lookup=HHDF_PUF_LOOKUP)51 def get_data_files(self, folder, year_lookup):52 """ Takes a folder name and a year to PUF no. lookup. Sets the download directory to the folder name within the53 output directory. Spools up the chromedriver and downloads all files in the years list """54 download_dir = os.path.join(self.download_dir, folder)55 if not os.path.exists(download_dir):56 os.makedirs(download_dir)57 else:58 shutil.rmtree(download_dir)59 chrome_options = webdriver.ChromeOptions()60 prefs = {"download.default_directory": download_dir}61 chrome_options.add_experimental_option("prefs", prefs)62 executable_path = os.path.join(os.path.join(expanduser("~"), "meps", "meps_dev", "chromedriver"))63 driver = webdriver.Chrome(executable_path=executable_path, chrome_options=chrome_options)64 for year in self.years:65 driver.get(f"{DATA_FILES_BASE_URL}{year_lookup[year]}dat.zip")...
setup.py
Source:setup.py
...13 del base[0]14 for mod_name in x[1]:15 packages.append( ".".join(base + [mod_name]) )16 return packages17def get_data_files(rel_dir):18 """19 Get a list of data files to include in install package20 """21 install_list = []22 for x in os.walk(rel_dir):23 directory = x[0]24 install_files = []25 26 # Get all the .py files27 for filename in x[2]:28 if not filename.endswith(".pyc"):29 install_files.append( os.path.join(directory, filename) )30 31 if len(install_files) > 0:32 install_path = os.path.join(G.DIR_ROOT,directory)33 install_list.append( (install_path, install_files) )34 35 36 return install_list37data_files = []38data_files += get_data_files(G.DIR_EXAMPLES)39data_files += get_data_files(G.DIR_CONF)40data_files += get_data_files(G.DIR_BINARIES)41data_files += get_data_files(G.DIR_SCRIPTS)42# Web stuff43data_files += get_data_files("webserver")44setup(name='CATAN',45 version='1.0',46 description='This package contains all of the communication libraries for CATAN.',47 author='Chad Spensky',48 author_email='chad.spensky@ll.mit.edu',49 url='N/A',50 data_files = data_files,51 packages=get_packages('catan'),...
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!!