Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ The `status` parameter determines the review outcome. Only `pass` means the lice
### Constraints

- `redis` must stay on `<6.0.0` — Toolforge runs Redis server 6.0.16, and redis-py 7.x requires Redis 7.2+.
- pywikibot config is accessed via `pwb.config` where `pwb` is imported from `pywikibot.scripts.wrapper`. Importing through the wrapper triggers proper pywikibot initialization — using `pywikibot.config` directly does not work. The ty `possibly-missing-submodule` warnings on `pwb.config` are expected (exit 0).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The reference to the ty tool is missing backticks, which makes it look like a typo for 'the' or 'type'. Adding backticks clarifies that it refers to the command-line tool defined in the 'Commands' section of this document. Additionally, backticking exit 0 improves readability as it refers to a process exit code.

Suggested change
- pywikibot config is accessed via `pwb.config` where `pwb` is imported from `pywikibot.scripts.wrapper`. Importing through the wrapper triggers proper pywikibot initialization — using `pywikibot.config` directly does not work. The ty `possibly-missing-submodule` warnings on `pwb.config` are expected (exit 0).
- pywikibot config is accessed via `pwb.config` where `pwb` is imported from `pywikibot.scripts.wrapper`. Importing through the wrapper triggers proper pywikibot initialization — using `pywikibot.config` directly does not work. The `ty` `possibly-missing-submodule` warnings on `pwb.config` are expected (`exit 0`).

8 changes: 4 additions & 4 deletions src/wikibots/lib/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Any

import mwparserfromhell
import pywikibot.config
import requests
from deepdiff import DeepDiff
from mwparserfromhell.wikicode import Wikicode
Expand All @@ -28,6 +27,7 @@
from pywikibot.data.api import Request
from pywikibot.page import BasePage
from pywikibot.page._collections import ClaimCollection
from pywikibot.scripts.wrapper import pwb
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The import statement from pywikibot.scripts.wrapper import pwb is likely incorrect. In standard pywikibot installations, wrapper is a module (the pwb.py script) and does not contain an object or submodule named pwb. To import the wrapper module and alias it as pwb (which allows accessing pwb.config as intended), you should use the import ... as ... syntax.

Suggested change
from pywikibot.scripts.wrapper import pwb
import pywikibot.scripts.wrapper as pwb

from redis import Redis

from wikibots.lib.wikidata import WikidataEntity, WikidataProperty
Expand Down Expand Up @@ -71,11 +71,11 @@ def __init__(self, **kwargs: Any):
_access_token,
_access_secret,
)
pywikibot.config.authenticate["commons.wikimedia.org"] = authenticate
pwb.config.authenticate["commons.wikimedia.org"] = authenticate
else:
pywikibot.config.password_file = "user-password.py"
pwb.config.password_file = "user-password.py"

pywikibot.config.put_throttle = self.throttle
pwb.config.put_throttle = self.throttle

self.wikidata = Site("wikidata", "wikidata")
self.commons = Site("commons", "commons", user=os.getenv("PWB_USERNAME"))
Expand Down
Loading