Best Python code snippet using tox_python
constant.py
Source:constant.py
1from tkinter import *2from enum import Enum3HOMEDIR = "/home/pi/Desktop/github/battery_python/source/"4BATTERY = []5BLUE = []6GREEN = []7ORANGE = []8RED = []9CHROME = []10def init():11 global BATTERY, BLUE, GREEN, ORANGE, RED, CHROME12 BATTERY = [ PhotoImage(file=HOMEDIR + "image/battery_0.png"),13 PhotoImage(file=HOMEDIR + "image/battery_10.png"),14 PhotoImage(file=HOMEDIR + "image/battery_20.png"),15 PhotoImage(file=HOMEDIR + "image/battery_30.png"),16 PhotoImage(file=HOMEDIR + "image/battery_40.png"),17 PhotoImage(file=HOMEDIR + "image/battery_50.png"),18 PhotoImage(file=HOMEDIR + "image/battery_60.png"),19 PhotoImage(file=HOMEDIR + "image/battery_70.png"),20 PhotoImage(file=HOMEDIR + "image/battery_80.png"),21 PhotoImage(file=HOMEDIR + "image/battery_90.png"),22 PhotoImage(file=HOMEDIR + "image/battery_100.png")23 ]24##################################NUMBER###################################25###########################################################################26###########################################################################27###########################################################################28 BLUE = [ PhotoImage(file=HOMEDIR + "image/number/blue_00.png"),29 PhotoImage(file=HOMEDIR + "image/number/blue_01.png"),30 PhotoImage(file=HOMEDIR + "image/number/blue_02.png"),31 PhotoImage(file=HOMEDIR + "image/number/blue_03.png"),32 PhotoImage(file=HOMEDIR + "image/number/blue_04.png"),33 PhotoImage(file=HOMEDIR + "image/number/blue_05.png"),34 PhotoImage(file=HOMEDIR + "image/number/blue_06.png"),35 PhotoImage(file=HOMEDIR + "image/number/blue_07.png"),36 PhotoImage(file=HOMEDIR + "image/number/blue_08.png"),37 PhotoImage(file=HOMEDIR + "image/number/blue_09.png")38 ]39 CHROME = [ PhotoImage(file=HOMEDIR + "image/number/chrome_00.png"),40 PhotoImage(file=HOMEDIR + "image/number/chrome_01.png"),41 PhotoImage(file=HOMEDIR + "image/number/chrome_02.png"),42 PhotoImage(file=HOMEDIR + "image/number/chrome_03.png"),43 PhotoImage(file=HOMEDIR + "image/number/chrome_04.png"),44 PhotoImage(file=HOMEDIR + "image/number/chrome_05.png"),45 PhotoImage(file=HOMEDIR + "image/number/chrome_06.png"),46 PhotoImage(file=HOMEDIR + "image/number/chrome_07.png"),47 PhotoImage(file=HOMEDIR + "image/number/chrome_08.png"),48 PhotoImage(file=HOMEDIR + "image/number/chrome_09.png")49 ]50 GREEN = [ PhotoImage(file=HOMEDIR + "image/number/green_00.png"),51 PhotoImage(file=HOMEDIR + "image/number/green_01.png"),52 PhotoImage(file=HOMEDIR + "image/number/green_02.png"),53 PhotoImage(file=HOMEDIR + "image/number/green_03.png"),54 PhotoImage(file=HOMEDIR + "image/number/green_04.png"),55 PhotoImage(file=HOMEDIR + "image/number/green_05.png"),56 PhotoImage(file=HOMEDIR + "image/number/green_06.png"),57 PhotoImage(file=HOMEDIR + "image/number/green_07.png"),58 PhotoImage(file=HOMEDIR + "image/number/green_08.png"),59 PhotoImage(file=HOMEDIR + "image/number/green_09.png")60 ]61 RED = [ PhotoImage(file=HOMEDIR + "image/number/red_00.png"),62 PhotoImage(file=HOMEDIR + "image/number/red_01.png"),63 PhotoImage(file=HOMEDIR + "image/number/red_02.png"),64 PhotoImage(file=HOMEDIR + "image/number/red_03.png"),65 PhotoImage(file=HOMEDIR + "image/number/red_04.png"),66 PhotoImage(file=HOMEDIR + "image/number/red_05.png"),67 PhotoImage(file=HOMEDIR + "image/number/red_06.png"),68 PhotoImage(file=HOMEDIR + "image/number/red_07.png"),69 PhotoImage(file=HOMEDIR + "image/number/red_08.png"),70 PhotoImage(file=HOMEDIR + "image/number/red_09.png")71 ]72 ORANGE = [ PhotoImage(file=HOMEDIR + "image/number/orange_00.png"),73 PhotoImage(file=HOMEDIR + "image/number/orange_01.png"),74 PhotoImage(file=HOMEDIR + "image/number/orange_02.png"),75 PhotoImage(file=HOMEDIR + "image/number/orange_03.png"),76 PhotoImage(file=HOMEDIR + "image/number/orange_04.png"),77 PhotoImage(file=HOMEDIR + "image/number/orange_05.png"),78 PhotoImage(file=HOMEDIR + "image/number/orange_06.png"),79 PhotoImage(file=HOMEDIR + "image/number/orange_07.png"),80 PhotoImage(file=HOMEDIR + "image/number/orange_08.png"),81 PhotoImage(file=HOMEDIR + "image/number/orange_09.png")82 ]83 ###########################################################################84 ###########################################################################...
1_concat.py
Source:1_concat.py
1# ==============================================================================2# Author: Pharrell_WANG3# Date: 2017/6/284# ==============================================================================5import os6homedir = os.environ['HOME']7size_64_files = [8 homedir + '/data/poznan_hall_1920x1088/mixed_data_0.csv',9 homedir + '/data/poznan_street_1920x1088/mixed_data_0.csv',10 homedir + '/data/shark_1920x1088/mixed_data_0.csv',11 homedir + '/data/undo_dancer_1920x1088/mixed_data_0.csv',12 homedir + '/data/newspaper/mixed_data_0.csv',13 homedir + '/data/kendo/mixed_data_0.csv',14 homedir + '/data/ghost_fly/mixed_data_0.csv',15 homedir + '/data/balloons/mixed_data_0.csv'16]17size_32_files = [18 homedir + '/data/poznan_hall_1920x1088/mixed_data_1.csv',19 homedir + '/data/poznan_street_1920x1088/mixed_data_1.csv',20 homedir + '/data/shark_1920x1088/mixed_data_1.csv',21 homedir + '/data/undo_dancer_1920x1088/mixed_data_1.csv',22 homedir + '/data/newspaper/mixed_data_1.csv',23 homedir + '/data/kendo/mixed_data_1.csv',24 homedir + '/data/ghost_fly/mixed_data_1.csv',25 homedir + '/data/balloons/mixed_data_1.csv'26]27size_16_files = [28 homedir + '/data/poznan_hall_1920x1088/mixed_data_2.csv',29 homedir + '/data/poznan_street_1920x1088/mixed_data_2.csv',30 homedir + '/data/shark_1920x1088/mixed_data_2.csv',31 homedir + '/data/undo_dancer_1920x1088/mixed_data_2.csv',32 homedir + '/data/newspaper/mixed_data_2.csv',33 homedir + '/data/kendo/mixed_data_2.csv',34 homedir + '/data/ghost_fly/mixed_data_2.csv',35 homedir + '/data/balloons/mixed_data_2.csv'36]37size_08_files = [38 homedir + '/data/poznan_hall_1920x1088/mixed_data_3.csv',39 homedir + '/data/poznan_street_1920x1088/mixed_data_3.csv',40 homedir + '/data/shark_1920x1088/mixed_data_3.csv',41 homedir + '/data/undo_dancer_1920x1088/mixed_data_3.csv',42 homedir + '/data/newspaper/mixed_data_3.csv',43 homedir + '/data/kendo/mixed_data_3.csv',44 homedir + '/data/ghost_fly/mixed_data_3.csv',45 homedir + '/data/balloons/mixed_data_3.csv'46]47INPUT_LIST = [size_08_files, size_16_files, size_32_files, size_64_files]48for INPUT_FILE in INPUT_LIST:49 # for avoiding the type checking errors, here we create a new var50 INPUT_FILE_ = INPUT_FILE51 name_of_input_file = [k for k, v in locals().items() if v is INPUT_FILE_][0]52 OUTPUT_FILE = homedir + '/data/step1_output/' + name_of_input_file + '.csv'53 with open(OUTPUT_FILE, 'w') as w:54 for input_file in INPUT_FILE:55 with open(input_file, 'r') as r:56 for num, line in enumerate(r):...
setup.py
Source:setup.py
1from setuptools import setup2import os3version = "1.4.1"4homedir = "/home/pi/raspi-sump/"5if os.path.isfile(homedir + "raspisump.conf"):6 cmd = "cp -u " + homedir + "raspisump.conf " + homedir + "raspisump.conf.save"7 os.system(cmd)8raspi_sump_files = [9 "bin/rsump.py",10 "bin/rsumpchart.py",11 "bin/rsumpmonitor.py",12 "bin/rsumpwebchart.py",13 "bin/emailtest",14]15add_files = [16 (homedir + "sample_config", ["conf/raspisump.conf"]),17 (homedir + "sample_config", ["conf/lighttpd.conf"]),18 (homedir + "csv", ["conf/csv/README.md"]),19 (homedir + "logs", ["conf/logs/README.md"]),20 (homedir + "charts", ["conf/charts/README.md"]),21 (homedir + "docs", ["docs/README.md"]),22 (homedir + "docs", ["docs/install.md"]),23 (homedir + "cron", ["cron/README.md"]),24 (homedir + "cron", ["cron/picrontab"]),25 (homedir + "web", ["conf/web/index.html"]),26 (homedir + "web/images", ["conf/web/images/logo.png"]),27 (homedir + "web/css", ["conf/web/css/index.html"]),28 (homedir + "web/css", ["conf/web/css/raspi.css"]),29]30setup(31 name="raspisump",32 version=version,33 description="A sump pit monitoring system for Raspberry Pi",34 long_description_content_type="text/markdown",35 long_description=open("./README.md", "r").read(),36 classifiers=[37 "Development Status :: 5 - Production/Stable",38 "Environment :: Console",39 "Intended Audience :: End Users/Desktop",40 "Natural Language :: English",41 "Operating System :: POSIX :: Linux",42 "Programming Language :: Python :: 3.5",43 "Programming Language :: Python :: 3.7",44 "Programming Language :: Python :: 3.9",45 "Topic :: Home Automation",46 "License :: OSI Approved :: MIT License",47 ],48 author="Al Audet",49 author_email="alaudet@linuxnorth.org",50 url="http://www.linuxnorth.org/raspi-sump/",51 download_url="https://github.com/alaudet/raspi-sump/releases",52 license="MIT License",53 packages=["raspisump"],54 scripts=raspi_sump_files,55 data_files=add_files,56 install_requires=["hcsr04sensor"],57)58if os.path.isdir(homedir):59 cmd = "chown -R pi " + homedir60 os.system(cmd)61 cmd = "chmod 600 " + homedir + "raspisump.conf"...
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!!