Wikipedia:Bots/Requests for approval/Theo's Little Bot 10
[[User:Theo's Little Bot|Theo's Little Bot 10]]
{{Newbot|Theo's Little Bot|10}}
Operator: {{botop|Theopolisme}}
Time filed: 01:55, Friday April 26, 2013 (UTC)
Automatic, Supervised, or Manual: Automatic
Programming language(s): Python + mwclient + mwparserfromhell
Source code available: [https://github.com/theopolisme/theobot/blob/master/tafi_archiver_and_mover.py on github]
Function overview: Automatically archives old nominations at WP:TAFI, either moving them to an archive page (if unsuccessful) or to the TAFI holding area (if successful).
Links to relevant discussions (where appropriate): Wikipedia_talk:Today's_articles_for_improvement#A_bot_to_automatically_handle_nominations.3F
Edit period(s): Daily
Estimated number of pages affected: 3 per month (TAFI noms page, TAFI monthly archive page, and TAFI holding area).
Exclusion compliant (Yes/No): No, unneeded
Already has a bot flag (Yes/No): Yes
Function details: For each nomination on Wikipedia:Today's articles for improvement/Nominated articles...
- If the nomination has a net support of 3 or more (wherein opposes count as -1), it is moved to the Wikipedia:Today's articles for improvement/Holding area.
- If the nomination has been inactive for 10 days and has less that 3 supports, the bot moves it to the current month's archive.
= Discussion =
- Seems like an appropriate bot task, and you have community support via a request, straight forward, experienced operator, good communication. -166.137.210.34 (talk) 18:24, 26 April 2013 (UTC)
- Accidentally did a test run with the bot account instead of my own to make sure replace() method was working alright—which it was. Sorry about that. —Theopolisme (talk) 19:42, 27 April 2013 (UTC)
:{{BotTrial|edits=50|days=5}} ·Add§hore· Talk To Me! 09:47, 29 April 2013 (UTC)
- Day 1 of trial complete - [http://en.wikipedia.org/w/index.php?title=Wikipedia:Today%27s_articles_for_improvement/Nominated_articles&diff=prev&oldid=552706143 to nominations page], [http://en.wikipedia.org/w/index.php?title=Wikipedia:Today%27s_articles_for_improvement/Holding_area&diff=prev&oldid=552706130 to holding area], [http://en.wikipedia.org/w/index.php?title=Wikipedia:Today%27s_articles_for_improvement/Archives/Unsuccessful_Nominations/April_2013&diff=prev&oldid=552706099 to archive] —Theopolisme (talk) 11:11, 29 April 2013 (UTC)
- {{BotTrialComplete}} Edits can be viewed at [http://toolserver.org/~snottywong/cgi-bin/commentsearch.cgi?name=Theo%27s+Little+Bot&search=%28%5B%5BWP%3ABOT%7Cbot%5D%5D+on+trial+-+%5B%5BUser%3ATheo%27s+Little+Bot%2Fdisable%2Ftafi+arch%7Cdisable%5D%5D%29&max=100&server=enwiki&ns=none] Theopolisme (talk) 11:11, 4 May 2013 (UTC)
:Would it be possible to stop the bot from leaving multiple new lines in a row? ·Add§hore· Talk To Me! 14:19, 2 May 2013 (UTC)
::{{ping|Addshore}} Sorry, I don't think I quite understand what you're talking about--could you give an example? Thanks, Theopolisme (talk) 02:13, 5 May 2013 (UTC)
:::[http://en.wikipedia.org/w/index.php?title=Wikipedia:Today%27s_articles_for_improvement/Nominated_articles&oldid=553473016 This] is the revision your bot made; notice that there is a blank line at the bottom of the Cantopop section. [http://en.wikipedia.org/w/index.php?title=Wikipedia:Today%27s_articles_for_improvement/Nominated_articles&oldid=553373873 Before your bot edited] there was not a blank line at the bottom of this section. -68.107.137.178 (talk) 09:08, 5 May 2013 (UTC)
::::Thanks for pointing that out. Hmm, I'm currently using the following regular expression to make each nomination:
. {{ping|Legoktm}} could you take a look, since you're the real wiz around here? Theopolisme (talk) 12:38, 5 May 2013 (UTC)
:::::It should be as simple as changing it to something like
I think! ·Add§hore· Talk To Me! 09:53, 7 May 2013 (UTC)
::::::{{headdesk}} Thanks. Implemented [https://github.com/theopolisme/theobot/commit/aa96ba052cb3947d9f4c657027308e82595b5648 on github]. Theopolisme (talk) 11:12, 7 May 2013 (UTC)
::::::{{BotTrial|edits=a few more}} ·Add§hore· Talk To Me! 12:06, 7 May 2013 (UTC)
:::::::Well, that didn't work. I tried
as well...which didn't work. Hmmm...are the newlines using some other character? Theopolisme (talk) 11:27, 8 May 2013 (UTC)
::::::::A hacky solution that *works* for now is just replacing \(UTC\)\n\n*(?!#)
with (UTC)\n\n
. Theopolisme (talk) 11:20, 9 May 2013 (UTC)
{{:BAGAssistanceNeeded}} Can I get approval on this (prompted via Wikipedia_talk:Today's_articles_for_improvement#Improvement_tracking_2)? Theopolisme (talk) 20:30, 14 May 2013 (UTC)
- {{Nao}} The comment directly above this says that you are using a "hacky solution"... Has that been resolved correctly? I would think that a requirement of approval would be "no hacky solutions", but as I'm a no-body here, I could be wrong. FTR, I think this is a great idea and I support this bot, I just think it should be as hack/bug free as possible before approval. File:Coin Icon.svg Technical 13 (talk) 14:20, 15 May 2013 (UTC)
- I agree that a non-hacky solution is called for. This is a long term, daily bot, can you try to fix this in a more robust way? -166.137.209.148 (talk) 17:44, 15 May 2013 (UTC)
- I currently don't have the regular expression skills to resolve this on my own. I asked Legoktm for help, but he didn't respond. Anyone is welcome to comment, of course:
(\
is the regex I'm using currently, and I need it to match newlines above and below the text in question. Theopolisme (talk) 21:09, 15 May 2013 (UTC){\{TAFI nom[.\|].*?)(?=[^=]{{TAFI) - Firstly, shouldn't it be
and then, couldn't you go a little further and mark the start with(\{\{TAFI nom[.\|].*?)(?=[^=]\{\{TAFI) ^
like
In order for me to refine it further (I think it will need it) I need to figure out exactly what you are trying to find and what you are replacing it with... Unfortunately, I don't have quite that much time right this minute. Technical 13 (talk) 21:36, 15 May 2013 (UTC)^(\{\{TAFI nom[.\|].*?)(?=[^=]\{\{TAFI) - So you want to match the template, and any comment lines below? Stopping just before the next template? ·Add§hore· Talk To Me! 10:40, 18 May 2013 (UTC)
- The regex I have now matches the template and all comment lines below, stopping just before the next template, yes. But I now also want to match any and all whitespace before the template...and
\n*
didn't work. Maybe\s
? Theopolisme (talk) 13:52, 18 May 2013 (UTC) \s
is the same as[ \t\r\n\v\f]
which would actually catch those instances of there being just a space or a tab on a line that we can't see but throws the match off. Technical 13 (talk) 18:12, 18 May 2013 (UTC)- {{ping|Technical 13|Legoktm}} Tried
\s
; didn't work. Here's the [https://github.com/theopolisme/theobot/blob/master/tafi_archiver_and_mover.py#L61 current code]. Theopolisme (talk) 13:48, 19 May 2013 (UTC)
→'(\s*\{\{TAFI nom[.\|].*?)[\r\n]*?(?=[^=]{{TAFI)'
Is it being greedy at the start and are there unusual spaces in the middle? Also, shouldn't the'(\s*?\{\{TAFI nom[.\|].*?)\s*?(?=[^=]\{\{TAFI)' {
near the end be escaped? Technical 13 (talk) 14:31, 19 May 2013 (UTC)- In the source code I linked, I was already using exactly what you just suggested. And yes, it was (already) escaped. Cheers, and thanks for your help, Theopolisme (talk) 20:53, 20 May 2013 (UTC)
- {{comment}} Are we good to go for approval? MBisanz talk 03:11, 21 May 2013 (UTC)
- Good for me if the bot operator thinks the spacing issue is covered, maybe run through initial edits himself and confirm, but it seems good to me. -166.137.209.152 (talk) 12:53, 22 May 2013 (UTC)
::*All good here; ready for approval. Theopolisme (talk) 21:49, 23 May 2013 (UTC)
:::{{BotApproved}} ·Add§hore· Talk To Me! 21:50, 23 May 2013 (UTC)
:The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA.