Xqt created this task.
Xqt added projects: Pywikibot-Scripts, good first task.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
Restricted Application added a project: Pywikibot.
TASK DESCRIPTION
`cleanUpTitle()` function of flickrripper can be simplified. It contains
title = title.strip()
title = re.sub(r'[<{\[]', '(', title)
title = re.sub(r'[>}\]]', ')', title)
title = re.sub(r'[ _]?\(!\)', '', title)
title = re.sub(',:[ _]', ', ', title)
title = re.sub('[;:][ _]', ', ', title)
title = re.sub(r'[\t\n ]+', ' ', title)
title = re.sub(r'[\r\n ]+', ' ', title)
title = re.sub('[\n]+', '', title)
title = re.sub('[?!]([.\"]|$)', r'\1', title)
title = re.sub('[&#%?!]', '^', title)
title = re.sub('[;]', ',', title)
title = re.sub(r'[/+\\:]', '-', title)
title = re.sub('--+', '-', title)
title = re.sub(',,+', ',', title)
title = re.sub('[-,^]([.]|$)', r'\1', title)
title = title.replace(' ', '_')
title = title.strip('_')
obviously the regex `--+` can be replaced with `-+`, `,,+` with `,+` etc. Any
replacement to `' '` can be directly shorten to `'_'` which is the last resort
of these statements. `[;]` is the same as just `;`. `[\t\n ]+` and ` [\r\n ]+`
can be combined and `[\n]+` is obsolet. `[/+\\:]` can also be combined with
`--+` and there are several other replacements which can be combined or
simplified or removed.
TASK DETAIL
https://phabricator.wikimedia.org/T246874
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: Aklapper, pywikibot-bugs-list, Xqt, Chaytanya, Zkhalido, Viztor, DannyS712,
Wenyi, Kieubinhtb, Tks4Fish, Mh-3110, Asad_Ali_Palijo, Lahi, Soteriaspace,
JakeTheDeveloper, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, D3r1ck01,
Altostratus, Avicennasis, MuhammadShuaib, Tmalhotra, SimmeD, mys_721tx, jayvdb,
Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs