# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pywikibot # type: ignore import sys import toolforge # type: ignore import string from typing import Iterator, Tuple import acnutils as utils __version__ = "1.2" logger = utils.getInitLogger("dcs_redir", level="VERBOSE") site = pywikibot.Site("en", "wikipedia") simulate = False def iter_pages_and_targets() -> Iterator[Tuple[pywikibot.Page, str]]: conn = toolforge.connect("enwiki_p") query = """ SELECT CONCAT("Talk:", com.page_title) as title, CONCAT("Talk:", target.page_title) as target FROM page com JOIN page target ON target.page_title = REPLACE(com.page_title, "/Comments", "") WHERE com.page_namespace = 1
# See the License for the specific language governing permissions and # limitations under the License. from __future__ import annotations import pywikibot # type: ignore import acnutils import dataclasses import datetime import json import string from typing import Literal, Optional __version__ = "0.1" logger = acnutils.getInitLogger("catcron", level="VERBOSE") site = pywikibot.Site("commons", "commons") @dataclasses.dataclass class Target: """ Information about a category to create :param schedule: How often to create a new category :param title: Title of the category to be created :param text: Text of the category page :param offset: How far in advance to create categories """ schedule: Literal["daily", "monthly", "yearly"]
# See the License for the specific language governing permissions and # limitations under the License. import pywikibot # type: ignore import toolforge import datetime import acnutils as utils import argparse import string import json import collections from typing import Tuple, Iterator, Optional, cast, Deque __version__ = "1.8" logger = utils.getInitLogger("nolicense", level="INFO") site = pywikibot.Site("commons", "commons") cluster = "web" simulate = None def get_config(): page = pywikibot.Page(site, "User:AntiCompositeBot/NoLicense/Config.json") conf_json = json.loads(page.text) logger.info(f"Loaded config from {page.title(as_link=True)}") logger.debug(conf_json) return conf_json def iter_files_and_users(
Union, Dict, List, Iterator, Iterable, Optional, Any, Tuple, Set, Sequence, ) __version__ = "2.0.3" logger = utils.getInitLogger("ASNBlock", level="VERBOSE", filename="stderr", thread=True) site = pywikibot.Site("en", "wikipedia") simulate = False session = requests.session() session.headers[ "User-Agent"] = f"ASNBlock/{__version__} {toolforge.set_user_agent('anticompositebot')}" whois_api = "https://whois-dev.toolforge.org" IPNetwork = Union[ipaddress.IPv4Network, ipaddress.IPv6Network] class DataRow(NamedTuple): """Represents a row in an RIR bulk report."""
# You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import toolforge # type: ignore import acnutils import datetime __version__ = "0.3" logger = acnutils.getInitLogger("uncat", level="VERBOSE") def run_query(): query = """ SELECT page_title, COUNT(*) FROM page JOIN templatelinks ON tl_from = page_id JOIN globalimagelinks ON page_title = gil_to WHERE tl_title = "Uncategorized" AND tl_namespace = 10 AND page_namespace = 6 GROUP BY page_id ORDER BY COUNT(*) DESC """
.. [1] https://commons.wikimedia.org/wiki/Commons:Bots/Requests/AntiCompositeBot_3 :status: archived :author: AntiCompositeNumber """ import pywikibot # type: ignore import toolforge import re import sys import time import acnutils as utils __version__ = "0.5" logger = utils.getInitLogger("wla_append", filename="stderr", level="VERBOSE") site = pywikibot.Site("commons", "commons") last_edit = 0 def iter_files(): conn = toolforge.connect("commonswiki") query = """ SELECT CONCAT("File:", page_title) FROM page JOIN categorylinks ON cl_from = page_id WHERE cl_to IN ( SELECT page_title FROM page
import pywikibot # type: ignore import toolforge import requests import itertools import math import json import acnutils as utils from string import Template from dataclasses import dataclass from datetime import datetime from typing import Optional, Tuple, Iterator, Iterable, cast, Dict, Union __version__ = "1.0" logger = utils.getInitLogger("essayassesment", level="VERBOSE", filename="essayimpact.log") site = pywikibot.Site("en", "wikipedia") session = requests.session() session.headers.update( {"User-Agent": toolforge.set_user_agent("anticompositebot")}) simulate = False @dataclass class Essay: page: pywikibot.Page links: Optional[int] = None watchers: Optional[int] = None views: Optional[int] = None
"""Generates reports for highly-used images that should use vector graphics.""" import datetime import argparse import re import json import pywikibot # type: ignore import toolforge import acnutils as utils from pymysql.err import OperationalError from pywikibot import pagegenerators from typing import Dict, Iterator, NamedTuple, List, cast, Tuple __version__ = "2.2" logger = utils.getInitLogger("ShouldBeSVG", level="VERBOSE") class FileUsage(NamedTuple): title: str usage: int def gallery_line(self, i: int) -> str: return f"{self.title}|{i}. Used {self.usage} times." class UsageResult(NamedTuple): files: List[FileUsage] total: int skipped: List[str]