Package pywikipedia :: Module category
[show private | hide private]
[frames | no frames]

Module pywikipedia.category

Scripts to manage categories.

Syntax: python category.py action [-option]

where action can be one of these:
 * add    - mass-add a category to a list of pages
 * remove - remove category tag from all pages in a category
 * move - move all pages in a category to another category
 * tidy   - tidy up a category by moving its articles into subcategories
 * tree   - show a tree of subcategories of a given category

and option can be one of these:
 * person  - sort persons by their last name (for action 'add')
 * rebuild - reset the database

For the actions tidy and tree, the bot will store the category structure locally
in category.dump. This saves time and server load, but if it uses these data
later, they may be outdated; use the -rebuild parameter in this case.

For example, to create a new category from a list of persons, type:
    
  python category.py add -person
    
and follow the on-screen instructions.

Classes
CategoryDatabase This is a temporary knowledge base saving for each category the contained subcategories and articles, so that category pages don't need to be loaded over and over again
CategoryMoveRobot  
CategoryRemoveRobot Removes the category tag from all pages in a given category and from the category pages of all subcategories, without prompting.
CategoryTidyRobot Script to help a human to tidy up a category by moving its articles into subcategories Specify the category name on the command line.
CategoryTreeRobot Robot to create tree overviews of the category structure.

Function Summary
  add_category(sort_by_last_name)
A robot to mass-add a category to a list of pages.
  sorted_by_last_name(catlink, pagelink)
given a Category, returns a Category which has an explicit sort key which sorts persons by their last names.

Imported modules:
bz2, pywikipedia.catlib, pywikipedia.config, pywikipedia.interwiki, pickle, re, string, sys, pywikipedia.wikipedia
Imported variables:
__version__, deletion_reason_move, msg_add, msg_change
Function Details

add_category(sort_by_last_name=False)

A robot to mass-add a category to a list of pages.

sorted_by_last_name(catlink, pagelink)

given a Category, returns a Category which has an explicit sort key which sorts persons by their last names. Trailing words in brackets will be removed. Example: If category_name is 'Author' and pl is a Page to [[Alexandre Dumas (senior)]], this function will return this Category: [[Category:Author|Dumas, Alexandre]]

Generated by Epydoc 2.1 on Sun Jul 03 17:07:35 2005 http://epydoc.sf.net