<commit_before>#!/usr/bin/python3
#I know most of you still prefer python2 and it is still more widle
#awaiable and installed by default, but I am a python starter. This is
#my fisrt real application ever, and I see no reason to learn something
#old that will wanish completely not in so faar future, instead I want
#to make sure I can put the skill I gain in use in the future easily.
#Same thing applys to the gtk3 too ^_^

#### Imports
### Backend
import sys
import os
import configparser
import io #We need to emulate a dummy [section] header for
          #configparesr to underdstand our config.txt file.
import rpiconf
###Gui
##GTK+ 3.x
from gi.repository import Gtk
##What about ncurses and QT variants too? Turn this into a full fledged
##library on handling the config file.
####

#Helper variables
raw_hdmi_mode = ['AUTO', ''] #One for resolution, one for refreshrate
advanced = False

##Load some of our widgets from the glade file to the current namespace
#Load our window from the glade/gtkbuilder file
builder = Gtk.Builder()
builder.add_from_file("mainwindow.ui")
refreshrate_box = builder.get_object("combo_refreshrate")

#Get the proper filename for our config file.
configfile = rpiconf.get_configfile(sys.argv)
# Thanks for user Tauran on stackowerflow for this hack
config_str = io.StringIO()
config_str.write('[dummy]')
config_str.write(open(configfile, 'r').read())
config_str.seek(0, os.SEEK_SET)

config_parser = configparser.ConfigParser()
config_parser.read_file(config_str)

config = rpiconf.rpi_config()
#This check whether the configfile has the option defined
#and sets it accordigly to our config object.
def populate_options(option):
	if config_parser.has_option('dummy', option):
		#I was told to be extreamly carefull with this, so I think it
		#is a bit dangerous way to do stuff. So Im more than happy
		#if someone tells me a more safer way to do this
		setattr(config , option, config_parser.get('dummy', option))

def populate_refreshrates(mode):
	# Set the refreshrate list to that of supported ones
	#Make 1st sure we are clean of the old ones
	refreshrate_box.remove_all()
	if mode != "AUTO" or mode != "VGA":
		if advanced:<commit_msg>Fix the detection of VGA and AUTO resolutions in populate_refreshrates().<commit_after>#!/usr/bin/python3
#I know most of you still prefer python2 and it is still more widle
#awaiable and installed by default, but I am a python starter. This is
#my fisrt real application ever, and I see no reason to learn something
#old that will wanish completely not in so faar future, instead I want
#to make sure I can put the skill I gain in use in the future easily.
#Same thing applys to the gtk3 too ^_^

#### Imports
### Backend
import sys
import os
import configparser
import io #We need to emulate a dummy [section] header for
          #configparesr to underdstand our config.txt file.
import rpiconf
###Gui
##GTK+ 3.x
from gi.repository import Gtk
##What about ncurses and QT variants too? Turn this into a full fledged
##library on handling the config file.
####

#Helper variables
raw_hdmi_mode = ['AUTO', ''] #One for resolution, one for refreshrate
advanced = False

##Load some of our widgets from the glade file to the current namespace
#Load our window from the glade/gtkbuilder file
builder = Gtk.Builder()
builder.add_from_file("mainwindow.ui")
refreshrate_box = builder.get_object("combo_refreshrate")

#Get the proper filename for our config file.
configfile = rpiconf.get_configfile(sys.argv)
# Thanks for user Tauran on stackowerflow for this hack
config_str = io.StringIO()
config_str.write('[dummy]')
config_str.write(open(configfile, 'r').read())
config_str.seek(0, os.SEEK_SET)

config_parser = configparser.ConfigParser()
config_parser.read_file(config_str)

config = rpiconf.rpi_config()
#This check whether the configfile has the option defined
#and sets it accordigly to our config object.
def populate_options(option):
	if config_parser.has_option('dummy', option):
		#I was told to be extreamly carefull with this, so I think it
		#is a bit dangerous way to do stuff. So Im more than happy
		#if someone tells me a more safer way to do this
		setattr(config , option, config_parser.get('dummy', option))

def populate_refreshrates(mode):
	# Set the refreshrate list to that of supported ones
	#Make 1st sure we are clean of the old ones
	refreshrate_box.remove_all()
	if mode != "AUTO" and mode != "VGA":
		if advanced:
{'fraction_non_alphanumeric': 0.08033491740212718, 'fraction_numerical': 0.0027155465037338763, 'mean_word_length': 4.854304635761589, 'pattern_counts': {'":': 2, '<': 3, '<?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': '576554', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1329, 'n_words': 590}