<commit_before>#! /usr/bin/env python3
import argparse
import os
import sys
parser = argparse.ArgumentParser(description="Change brightness of your displays.", prog="backlight")
parser.add_argument("percentage", metavar="N%", help="change brightness to given percentage value", type=int)
group1 = parser.add_mutually_exclusive_group()
group1.add_argument("-d", "--dec", help="decrease value by given percentage value", action="store_true")
group1.add_argument("-i", "--inc", help="increase value by given percentage value", action="store_true")
parser.add_argument("-v", "--verbose", help="enable verbose output", action="store_true")
parser.add_argument("--directory", metavar="DIR", help="change directory of display devices", default="/sys/class/backlight/")
args = parser.parse_args()
operator = str()
path = dict()
max_brightness = dict()
brightness = dict()
if (not os.path.exists(args.directory)):
	print("devices path not found ("+args.directory+")", file=sys.stderr)
	exit(1)
for i in os.listdir(args.directory):
	path[i] = os.path.join(args.directory, i)
	if (args.verbose):
		print("found", i)
if (len(path) <= 0):
	print("there are no display devices in given directory", file=sys.stderr)
	exit(2)
for i in path.keys():
	f = open(os.path.join(path[i], "max_brightness"), "r")
	max_brightness[i] = int(f.readline()[:-1])
	f.close()
	f = open(os.path.join(path[i], "brightness"), "r")
	brightness[i] = int(f.readline()[:-1])<commit_msg>root required message added<commit_after>#! /usr/bin/env python3
import argparse
import os
import sys
if not os.geteuid() == 0: 
    print("root privileges required!" ,file=sys.stderr)
    exit(1)
parser = argparse.ArgumentParser(description="Change brightness of your displays.", prog="backlight")
parser.add_argument("percentage", metavar="N%", help="change brightness to given percentage value", type=int)
group1 = parser.add_mutually_exclusive_group()
group1.add_argument("-d", "--dec", help="decrease value by given percentage value", action="store_true")
group1.add_argument("-i", "--inc", help="increase value by given percentage value", action="store_true")
parser.add_argument("-v", "--verbose", help="enable verbose output", action="store_true")
parser.add_argument("--directory", metavar="DIR", help="change directory of display devices", default="/sys/class/backlight/")
args = parser.parse_args()
operator = str()
path = dict()
max_brightness = dict()
brightness = dict()
if (not os.path.exists(args.directory)):
	print("devices path not found ("+args.directory+")", file=sys.stderr)
	exit(1)
for i in os.listdir(args.directory):
	path[i] = os.path.join(args.directory, i)
	if (args.verbose):
		print("found", i)
if (len(path) <= 0):
	print("there are no display devices in given directory", file=sys.stderr)
	exit(2)
for i in path.keys():
	f = open(os.path.join(path[i], "max_brightness"), "r")
	max_brightness[i] = int(f.readline()[:-1])
	f.close()
	f = open(os.path.join(path[i], "brightness"), "r")
	brightness[i] = int(f.readline()[:-1])
{'fraction_non_alphanumeric': 0.1786071309563479, 'fraction_numerical': 0.006664445184938354, 'mean_word_length': 6.268765133171913, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2070615', 'n_tokens_mistral': 1012, 'n_tokens_neox': 986, 'n_words': 251}