User:ChristieBot/GA config.py

import os

# Global variables
is_live = True # Are we running in the production environment?
logging = True
# The GAN.log method uses the logging flags to decide which log messages to write
logging_flags = {
            'add_GA_star': False,
            'check_reviewer_data': False,
			'display_table': False,
			'find_incomplete_moves: finding': False,
			'find_incomplete_moves: reporting': False,
            'GAH.evaluate_page_classes': False,
            'GAH.update_historical_GA_reviews': False,
            'GANbot': False,
			'GANbot:after setup, about to execute flags': False,
			'GANbot:all_articles loop': False,
			'GANbot:exceptions': True,
			'GANbot:in_cat': False,
			'GANbot:in_cat:match values is False': False,
			'GANbot:in_cat:match values is True': False,
			'GANbot:in_cat:page number has changed': False,
			'GANbot:in_last': False,
			'GAN_records.__init__': False,
			'get_fields_from_GAN_entry': False,
			'get_link_redirect_target': False,
			'get_link_redirect_target:exceptions': True,
			'get_params': False,
			'get_params:exceptions': True,
			'get_review_info': False,
			'get_review_info:exceptions': True,
			'mark_superseded_reviews': False,
			'save_nomination_state': False,
			'scan_for_new_pages': False,
			'sub_page_missing': False,
			'table_row': False,
			'transclude': False,
			'transclude:protected page': True,
			'update_active_nominations': False,
			'update_statistics': False,
			'update_users': False,
			'write_statistics': False
}

errors_found = False  # Used by two different error recording methods.  If false at the end of the run the errors page can be cleared.
current_errors = [] # Tracks the errors found in a given run that will need reporting
inactivity_age = 21 # time in days since last edit to consider a user inactive
free_GAs = 0 # number of GAs a nominator can have before they are taken off the top of the sort order in custom_sort_1
sort_order = 'custom_sort_2'
single_title = None
audit_days_to_keep = 2  # Number of days of data to keep in the audit trail
reviewers_who_notify_nominators = ["SilkTork"] # If the reviewer is in this list, the bot does not leave the nominator talk page messages.

strings = {}
if is_live:
	strings['GAN page'] = 'Wikipedia:Good article nominations'
	strings['GA topic pages base'] = 'Wikipedia:Good article nominations/Topic lists/'
	
	top_text = ["{{Short description|Wikipedia page for submissions and discussions on Good article distinction candidates}}"]
	top_text.append("<noinclude>{{pp-semi-indef}}{{pp-move-indef}}</noinclude>")
	top_text.append("<!-- Putting categories and inter language links here to avoid confusion from people adding to the bottom of last articles section. -->")
	top_text.append("[[Category:WikiProject Good articles|Good article nominations]]")
	top_text.append("[[Category:Non-talk pages that are automatically signed]]")
	top_text.append("<!-- [[Category:Articles needing attention]] -->")
	top_text.append("{{User:Dispenser/Checklinks/config|interval=fortnightly|generator=all|convert=None|namespaces=0}}")
	top_text.append("<!-- End of categories and interwikis-->")
	top_text.append("{{/guidelines}}")
	top_text.append("")
	#top_text.append("={{anchor|NomsByTopic}}Nominations=")
	top_text.append("{{anchor|NomsByTopic}}")
	top_text.append("[[File:GA candidate.svg|40px|left|Good article nominations]]")
	#top_text.append("<div style=\"font-size: 20px; text-align: center;\">[[User:SDZeroBot/GAN sorting|Alternative annotated list of articles awaiting review]]</div>")
	top_text.append("<div style=\"font-size: 20px; text-align: center;\">Alternative lists of articles awaiting review</div>")
	top_text.append("<div style=\"font-size: 16px; text-align: center;\">[[User:SDZeroBot/GAN sorting|Sortable list annotated with more detailed topic information]]</div>")
	top_text.append("<div style=\"font-size: 16px; text-align: center;\">[[User:ChristieBot/SortableGANoms|List allowing sorting by nominator, review count, and other fields]]</div>")
	top_text.append("")
	top_text.append("To add good article nominations to this page, please see the [[Wikipedia:Good article nominations/Instructions|instructions]].")
	#top_text.append("")
	#top_text.append("Note: For guidance in locating and [[Wikipedia:Citing sources|citing sources]] for articles, please see [[Wikipedia:Identifying reliable sources]]. For guidance in locating and citing sources for medicine and psychology-related articles, see [[Wikipedia:Identifying reliable sources (medicine)]]. For guidance in locating and citing sources for science and math-related articles, please see [[Wikipedia:Scientific citation guidelines]].")
	#top_text.append("")
	#top_text.append("Note that as of January 2023, the order in which the nominations are sorted has changed.  Nominators who have no promoted GAs are sorted at the top of each section, in descending order of the number of GA reviews they have performed.  Then nominators who have at least one promoted GA are listed, in descending order of the ratio of reviews they have performed to the number of GAs they have had promoted.  For example, a nomination by a nominator who has 5 GAs and has done 10 reviews is listed above a nomination by a nominator who has 10 GAs and has done 5 reviews.")
	#top_text.append("__NOTOC__")
	top_text.append("<!-- NOMINATION CATEGORIES BEGIN HERE -->")
	top_text.append("<!-- EVERYTHING BELOW THIS COMMENT IS UPDATED AUTOMATICALLY BY A BOT -->")
	top_text.append("")
	strings['GAN top text'] = "\n".join(top_text)

	bottom_text= ["<!-- EVERYTHING ABOVE THIS COMMENT IS UPDATED AUTOMATICALLY BY A BOT -->"]
	bottom_text.append("{{-}}<!-- For proper page length when Misc is empty -->")
	bottom_text.append("{{Wikipedia:Good article nominations/Topic lists}}")
	bottom_text.append("{{Wikipedia community}}")
	bottom_text.append("<!-- NOMINATION CATEGORIES END HERE -->")
	strings['GAN bottom text'] = "\n".join(bottom_text)

	strings['GA reviewing stats page'] = 'User:GA bot/Stats'
	strings['GA reviewing stats corrections page'] = 'User:ChristieBot/Corrections to GA reviewing statistics'
	strings['GAN errors page'] = 'User talk:ChristieBot/GAN errors'
	strings['GAN bugs page'] = 'User talk:ChristieBot/Bug messages'
	strings['GAN backlog by sort order'] = 'Wikipedia:Good article nominations/backlog/by sort order'
	strings['Moved pages that did not move GA subpages'] = 'User:ChristieBot/Incompletely moved pages'
	strings['GAN as a single table'] = 'User:ChristieBot/SortableGANoms'
	strings['GAN activity log'] = 'User:ChristieBot/Recent GAN activity'

	# The table name strings are used in SQL queries to allow tests to run without risking production data
	strings['active nominations table name'] = "active_nominations"                             # This table contains the contents of the GAN page
	strings['GA reviewing statistics table name'] = "GA_reviewing"                              # Contains a row for each GA reviewer, recording the total number of reviews they've done
	strings['GA reviewing statistics corrections table name'] = "GA_reviewing_corrections"      # Each row gives a correction for a GA review, changing the reviewer from one editor to another editor.
	strings['GA reviewing baseline table name'] = "GA_reviewing_baseline"                       # Contains a row for each GA reviewer, recording the number of reviews they had done up to the switch to ChristieBot
	strings['GA reviews table name'] = "GA_reviews"                                             # Contains a row for each GA review done under ChristieBot.  The count from this is used to update the GA reviewing statistics table.
	strings['name changes table name'] = "name_changes"                                         # Tracks users whose names have changed, and for whom statistics need to be combined from multiple names
	strings['nominations table name'] = "nominations"                                           # Contains a history of each nomination under ChristieBot.  A new record is written when the information changes.
	strings['audit table name'] = "audit"                                                       # Audit trail data.  Cleaned after 60 days.
	strings['historical GA reviews table name'] = "historical_GA_reviews"                       # Contains the results of a scraping exercise to find pre-ChristieBot reviews.

	# Logging file name
	strings['log file'] = "ChristieBot.log"
else:
	strings['GAN page'] = 'User:ChristieBot/GAN existing format'
	strings['GA topic pages base'] = 'User:ChristieBot/Topic lists existing format/'
	strings['GAN top text'] = ""
	strings['GAN bottom text'] = ""
	strings['GA reviewing stats page'] = 'User:ChristieBot/GA reviewing stats'
	strings['GA reviewing stats corrections page'] = 'User:ChristieBot/Test corrections to GA reviewing statistics'
	strings['GA nominator talk page'] = 'User talk:ChristieBot/Test'
	strings['GAN errors page'] = 'User talk:ChristieBot/Test errors'
	strings['GAN bugs page'] = 'User talk:ChristieBot/Test bug messages'
	strings['GAN backlog by sort order'] = 'User talk:ChristieBot/backlog by sort order'
	strings['Moved pages that did not move GA subpages'] = 'User:ChristieBot/Incompletely moved pages (test)'
	strings['GAN as a single table'] = 'User:ChristieBot/SortableGANoms (test)'

	# The table name strings are used in SQL queries to allow tests to run without risking production data
	strings['active nominations table name'] = "active_nominations_test"
	strings['GA reviewing statistics table name'] = "GA_reviewing_statistics_test"
	strings['GA reviewing statistics corrections table name'] = "GA_reviewing_corrections_test"      # Each row gives a correction for a GA review, changing the reviewer from one editor to another editor.
	strings['GA reviewing baseline table name'] = "GA_reviewing_baseline_test"
	strings['GA reviews table name'] = "GA_reviews_test"
	strings['name changes table name'] = "name_changes_test"
	strings['nominations table name'] = "nominations_test"
	strings['audit table name'] = "audit_test"
	strings['historical GA reviews table name'] = "historical_GA_reviews_test"

	# Logging file name
	strings['log file'] = "ChristieBot.test_log"