"""Bi alîkariya [[Bikarhêner:Balyozxane/skrîpt/py/category creator.py]] kategoriyên ku tên xwestin çêdike. Wisa:python pwb.py category_creator_run -lang:ku -family:wikipedia -wantedcategories"""importpywikibotfrompywikibot.botimportSingleSiteBot,ConfigParserBot,AutomaticTWSummaryBotfrompywikibotimportpagegeneratorsfrompywikibot.exceptionsimportLockedPageErrorimportrefromcategory_creatorimportCategoryCreator# Import the CategoryCreator classbedeng=Falsedefprint_sirove(sirove):ifnotbedeng:returnpywikibot.output(sirove)classAppendTextBot(SingleSiteBot,ConfigParserBot,AutomaticTWSummaryBot,):summary_key='basic-changing'use_redirects=Falseupdate_options={'summary':None,'text':'','top':False,}def__init__(self,*args,category_creator=None,**kwargs):self.category_creator=category_creatorsuper().__init__(*args,**kwargs)deftreat_page(self)->None:page=self.current_pageifpage.exists():pywikibot.output(f"Skipping {page.title()} already exists.")returnself.category_creator.create_ku_category(page.title(with_ns=False))defmain(*args:str)->None:local_args=pywikibot.handle_args(args)gen_factory=pagegenerators.GeneratorFactory()local_args=gen_factory.handle_args(local_args)options={'text':''}forarginlocal_args:option,_,value=arg.partition(':')ifoptionin('summary','text'):ifnotvalue:pywikibot.input(f'Please enter a value for {option}')options[option]=valueelse:options[option]=Truecategory_creator=CategoryCreator()gen=gen_factory.getCombinedGenerator(preload=True)ifnotpywikibot.bot.suggest_help(missing_generator=notgen):bot=AppendTextBot(generator=gen,category_creator=category_creator,**options)bot.run()if__name__=='__main__':main()