<commit_before>#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to resolve double redirects, and to delete broken redirects. Requires
access to MediaWiki's maintenance pages or to a XML dump file. Delete
function requires adminship.

Syntax:

    python redirect.py action [-arguments ...]

where action can be one of these:

double         Fix redirects which point to other redirects
broken         Tries to fix broken redirect to the last moved target of the
               destination page. If this fails and -delete option is given
               it deletes redirects where targets don't exist if bot has
               admin rights otherwise it marks the page with a speedy deletion
               template if available.
both           Both of the above.

and arguments can be:

-xml           Retrieve information from a local XML dump
               (http://download.wikimedia.org). Argument can also be given as
               "-xml:filename.xml". Cannot be used with -fullscan or -moves.

-fullscan      Retrieve redirect pages from live wiki, not from a special page
               Cannot be used with -xml.

-moves         Use the page move log to find double-redirect candidates. Only
               works with action "double", does not work with -xml.

               NOTE: You may use only one of these options above.
               If neither of -xml -fullscan -moves is given, info will be
               loaded from a special page of the live wiki.

-namespace:n   Namespace to process. Can be given multiple times, for several
               namespaces. If omitted, only the main (article) namespace is
               treated.

-offset:n      With -moves, the number of hours ago to start scanning moved
               pages. With -xml, the number of the redirect to restart with
               (see progress). Otherwise, ignored.

-start:title   The starting page title in each namespace. Page need not exist.

-until:title   The possible last page title in each namespace. Page needs not
               exist.

-step:n        The number of entries retrieved at oncevia API

-total:n       The maximum count of redirects to work upon. If omitted, there
               is no limit.

-delete        Enables deletion of broken redirects.

-always        Don't prompt you for each replacement.

"""
#
# (C) <NAME>, 2004.
# (C) <NAME>, 2009.
# (C) xqt, 2009-2013
# (C) Pywikibot team, 2004-2013
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
#

import re
import datetime
import pywikibot
from pywikibot import i18n
from pywikibot import config
from pywikibot import xmlreader


class RedirectGenerator:
    def __init__(self, xmlFilename=None, namespaces=[], offset=-1,
                 use_move_log=False, use_api=False, start=None, until=None,
                 number=None, step=None):<commit_msg>remove unused import<commit_after>#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to resolve double redirects, and to delete broken redirects. Requires
access to MediaWiki's maintenance pages or to a XML dump file. Delete
function requires adminship.

Syntax:

    python redirect.py action [-arguments ...]

where action can be one of these:

double         Fix redirects which point to other redirects
broken         Tries to fix broken redirect to the last moved target of the
               destination page. If this fails and -delete option is given
               it deletes redirects where targets don't exist if bot has
               admin rights otherwise it marks the page with a speedy deletion
               template if available.
both           Both of the above.

and arguments can be:

-xml           Retrieve information from a local XML dump
               (http://download.wikimedia.org). Argument can also be given as
               "-xml:filename.xml". Cannot be used with -fullscan or -moves.

-fullscan      Retrieve redirect pages from live wiki, not from a special page
               Cannot be used with -xml.

-moves         Use the page move log to find double-redirect candidates. Only
               works with action "double", does not work with -xml.

               NOTE: You may use only one of these options above.
               If neither of -xml -fullscan -moves is given, info will be
               loaded from a special page of the live wiki.

-namespace:n   Namespace to process. Can be given multiple times, for several
               namespaces. If omitted, only the main (article) namespace is
               treated.

-offset:n      With -moves, the number of hours ago to start scanning moved
               pages. With -xml, the number of the redirect to restart with
               (see progress). Otherwise, ignored.

-start:title   The starting page title in each namespace. Page need not exist.

-until:title   The possible last page title in each namespace. Page needs not
               exist.

-step:n        The number of entries retrieved at oncevia API

-total:n       The maximum count of redirects to work upon. If omitted, there
               is no limit.

-delete        Enables deletion of broken redirects.

-always        Don't prompt you for each replacement.

"""
#
# (C) <NAME>, 2004.
# (C) <NAME>, 2009.
# (C) xqt, 2009-2013
# (C) Pywikibot team, 2004-2013
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
#

import re
import datetime
import pywikibot
from pywikibot import i18n
from pywikibot import xmlreader


class RedirectGenerator:
    def __init__(self, xmlFilename=None, namespaces=[], offset=-1,
                 use_move_log=False, use_api=False, start=None, until=None,
                 number=None, step=None):
{'fraction_non_alphanumeric': 0.06382228490832158, 'fraction_numerical': 0.009873060648801129, 'mean_word_length': 2.3194850789935635, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6570131', 'n_tokens_mistral': 1519, 'n_tokens_neox': 1434, 'n_words': 721}