Page MenuHomePhabricator

Use Wikidata to check for category names instead of hardcoding in categoryToCheck
Closed, DeclinedPublicFeature

Description

Have had a quick discussion on [[w:ja:Category‐ノート:保護関連]], and from the discussion I am feeling that the current design is not a really good one.
Namely, why are we hardcoding the category names in categoryToCheck, instead of dynamically fetching, say, from several Wikidata entries such as [[d:Q4616255]] and [[d:Q10224556]]? The current design will fail whenever there is a renaming in any of the listed languages.

The more difficult part would be to remove hardcoding in template names as it involves fixing all those regex strings but I would think that the category names could act as a first step.

Event Timeline

Which is the related script?

Xqt triaged this task as Low priority.Sep 7 2019, 11:34 AM
Xqt changed the subtype of this task from "Task" to "Feature Request".

Which is the related script?

This is blockpageschecker.py

Which is the related script?

This is blockpageschecker.py

Oh - apologies - yes this is blockpageschecker.py

Hi,
I can start working on this.
Thanks

Hi,
I can start working on this.
Thanks

Sure. For any questions do not hesitate to ask for help.

Hi @Xqt ,
so if I get right, I will need to fetch categories names from wikidata, right?

Hi @Xqt ,
so if I get right, I will need to fetch categories names from wikidata, right?

Yes, that is right.

@Xqt
Can I get help on how to fetch those categories' names from wikidata ?

I wish to work on this issues . Can anyone tell me from where I can fetch categories list . Thanks for help .

Hm, the related script is blockpageschecker.py but this script is archived now and no longer maintained (see T223826). I propose to close this task except somebody is still using that script. @patilise: are you still working with blockpageschecker.py script?

Xqt removed Mh-3110 as the assignee of this task.Feb 25 2021, 11:39 AM

Yes I have made a patch for it already . How can i share my code ?Can i share a snippet of my code with you here ?

Could you just tell me if the change i made is needed or not ? Thanks

Yes I have made a patch for it already . How can i share my code ?Can i share a snippet of my code with you here ?

Yes, you can share it here. It can be merged to the code if someone uses the script and it was reactivated. Sorry for this irritation.

Is this good enough or do I need to change it ?

@Xqt Could you just check the file and let me know if it is good to be merged ?

As noted above the blockpageschecker is archived due to T223826 until someone asks for restoring it. Therefore it is not intendet to update that script currently.

Anyway there are a lot of parts to be improved with your patch:

  • please follow Python Coding Conventions
  • please follow Pywikibot Development Guidlines
  • Functions should not be in mixed case
  • print Statements should never be used; use pywikibot.output() or one of the other pywikibot.logging functions
  • never use bare exceptions
  • use a defaultdict in your fetchCategoriesToCheck
  • return None if fetchCategoriesToCheck fails
  • categoryToCheck[config.mylang][0] may fail if mylang is not found in the dict
  • -url Option is not documented
  • don't use f-strings because it does not work for older Pythons < 3.7
  • why to use pywikibot.output(f'*******{page} '), pagename is already printed in next line

Thanks for checking the code . I will be careful to follow these guidelines .

Thank you for your code. Probably you find another open task for your welcomed contribution

The script is archived. Please feel free to reopen if you are still using this script.