Skip to content

Commit

Permalink
more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Sep 27, 2024
1 parent 6abb09a commit 33e69ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/test_smw_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def testGetConcept(self):
print(concept)
self.assertEqual(concept, "Semantic MediaWiki Cons 2012")

def getSMWs(self, wikiId="smwcopy"):
def getSMWs(self, wikiId="smwcopy",debug:bool=False):
"""get the alternative SMW access instances for the given wiki id"""
wikiuser = self.getSMW_WikiUser(wikiId)
wikibot = WikiBot.ofWikiUser(wikiuser)
wikiclient = WikiClient.ofWikiUser(wikiuser)
wikibot = WikiBot.ofWikiUser(wikiuser,debug=debug)
wikiclient = WikiClient.ofWikiUser(wikiuser,debug=debug)
smwbot = SMWBot(wikibot.site)
# https://github.com/wikimedia/pywikibot/blob/master/pywikibot/config.py#L719
smwclient = SMWClient(wikiclient.getSite())
Expand Down Expand Up @@ -281,7 +281,7 @@ def testIssue5(self):
prop,
prop,
)
for smw in self.getSMWs("smwcopy"):
for smw in self.getSMWs("smwcopy",debug=debug):
result = self.getAskResult(smw, ask)
if debug:
print(f"{prop}: {result}")
Expand Down
5 changes: 3 additions & 2 deletions wikibot3rd/wikibot.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ def getBots(limit=None, name=None, valueExpr=None):
return bots

@staticmethod
def ofWikiId(wikiId, lenient=True, debug=False):
def ofWikiId(wikiId, lenient:bool=True, debug:bool=False):
wikiUser = WikiUser.ofWikiId(wikiId, lenient=lenient)
wikibot = WikiBot(wikiUser, debug=debug)
return wikibot

@staticmethod
def ofWikiUser(wikiUser):
def ofWikiUser(wikiUser,debug:bool=False):
wikibot = WikiBot(wikiUser)
wikibot.debug=debug
return wikibot

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion wikibot3rd/wikiclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def ofWikiId(
wiki_id: str, lenient: bool = True, debug: bool = False
) -> "WikiClient":
"""Deprecated: Use of_wiki_id instead."""
return WikiClient.of_wiki_id(wiki_id, lenient, debug)
return WikiClient.of_wiki_id(wiki_id, lenient=lenient, debug=debug)

@staticmethod
def of_wiki_user(wiki_user: WikiUser) -> "WikiClient":
Expand Down

0 comments on commit 33e69ef

Please sign in to comment.