<commit_before>#!/usr/bin/python
# -*- coding: utf-8  -*-
"""
This script is a clone of [[en:User:SmackBot]]
Syntax: python datebot.py
"""

#
# (C) Legoktm 2008-2009, MIT License
# 

import re, sys, time
import os
from pywikibot import wiki, pagegen, config

# Define global constants
readDelay  = 20	# seconds
writeDelay = 60 # seconds
usernames = {
	'en.wikipedia':'Legobot II'
}
def checktalk():
	page = wiki.Page('%s/Stop' %(usernames[config.wiki]))
	try:
		wikitext = page.get()
	except:
		sys.exit()
	if wikitext.lower() != 'run':
		sys.exit()
def process_article(page):
	try:
		wikitext = state1 = page.get()
	except wiki.IsRedirectPage:
		return
	# Fix Casing (Reduces the number of possible expressions)
	wikitext = re.compile(r'\{\{\s*(template:|)fact', re.IGNORECASE).sub(r'{{Fact', wikitext)
	# Fix some redirects
	wikitext = re.compile(r'\{\{\s*(template:|)cn\}\}', re.IGNORECASE).sub(r'{{Fact}}', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)citation needed', re.IGNORECASE).sub(r'{{Fact', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)proveit', re.IGNORECASE).sub(r'{{Fact', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)sourceme', re.IGNORECASE).sub(r'{{Fact', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)fct', re.IGNORECASE).sub(r'{{Fact', wikitext)
	# State point.  Count any changes as needing an update if they're after this line
	state0 = wikitext
	
	# Date the tags
	wikitext = re.compile(r'\{\{\s*fact\}\}', re.IGNORECASE).sub(r'{{Fact|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)
	wikitext = re.compile(r'\{\{\s*wikify\}\}', re.IGNORECASE).sub(r'{{Wikify|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)
	wikitext = re.compile(r'\{\{\s*orphan\}\}', re.IGNORECASE).sub(r'{{Orphan|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)
	wikitext = re.compile(r'\{\{\s*uncategorized\}\}', re.IGNORECASE).sub(r'{{Uncategorized|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)<commit_msg>add setUser function<commit_after>#!/usr/bin/python
# -*- coding: utf-8  -*-
"""
This script is a clone of [[en:User:SmackBot]]
Syntax: python datebot.py
"""

#
# (C) Legoktm 2008-2009, MIT License
# 

import re, sys, time
import os
from pywikibot import wiki, pagegen, config

# Define global constants
readDelay  = 20	# seconds
writeDelay = 60 # seconds
usernames = {
	'en.wikipedia':'Legobot II'
}
wiki.setUser(usernames[config.wiki])
def checktalk():
	page = wiki.Page('%s/Stop' %(usernames[config.wiki]))
	try:
		wikitext = page.get()
	except:
		sys.exit()
	if wikitext.lower() != 'run':
		sys.exit()
def process_article(page):
	try:
		wikitext = state1 = page.get()
	except wiki.IsRedirectPage:
		return
	# Fix Casing (Reduces the number of possible expressions)
	wikitext = re.compile(r'\{\{\s*(template:|)fact', re.IGNORECASE).sub(r'{{Fact', wikitext)
	# Fix some redirects
	wikitext = re.compile(r'\{\{\s*(template:|)cn\}\}', re.IGNORECASE).sub(r'{{Fact}}', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)citation needed', re.IGNORECASE).sub(r'{{Fact', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)proveit', re.IGNORECASE).sub(r'{{Fact', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)sourceme', re.IGNORECASE).sub(r'{{Fact', wikitext)
	wikitext = re.compile(r'\{\{\s*(template:|)fct', re.IGNORECASE).sub(r'{{Fact', wikitext)
	# State point.  Count any changes as needing an update if they're after this line
	state0 = wikitext
	
	# Date the tags
	wikitext = re.compile(r'\{\{\s*fact\}\}', re.IGNORECASE).sub(r'{{Fact|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)
	wikitext = re.compile(r'\{\{\s*wikify\}\}', re.IGNORECASE).sub(r'{{Wikify|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)
	wikitext = re.compile(r'\{\{\s*orphan\}\}', re.IGNORECASE).sub(r'{{Orphan|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)
	wikitext = re.compile(r'\{\{\s*uncategorized\}\}', re.IGNORECASE).sub(r'{{Uncategorized|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}', wikitext)
{'fraction_non_alphanumeric': 0.21491658488714427, 'fraction_numerical': 0.007360157016683023, 'mean_word_length': 5.575806451612904, 'pattern_counts': {'":': 0, '<': 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': '281533', 'n_tokens_mistral': 1696, 'n_tokens_neox': 1630, 'n_words': 282}