Revision: 4323
Author: russblau
Date: 2007-09-18 19:51:42 +0000 (Tue, 18 Sep 2007)
Log Message:
-----------
clean up docstring; use shortpath
Modified Paths:
--------------
trunk/pywikipedia/category.py
Modified: trunk/pywikipedia/category.py
===================================================================
--- trunk/pywikipedia/category.py 2007-09-18 16:30:40 UTC (rev 4322)
+++ trunk/pywikipedia/category.py 2007-09-18 19:51:42 UTC (rev 4323)
@@ -6,12 +6,12 @@
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
- * listify - make a list of all of the articles that are in a category
+ * 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
+ * listify - make a list of all of the articles that are in a category
and option can be one of these:
* -person - sort persons by their last name (for action 'add')
@@ -21,36 +21,40 @@
Also, the category to make a list of in the listify option
* -to: - The category to move to (for the move option)
- Also, the name of the list to make in the listify option
- NOTE: If the category names have spaces in them you may need to use a
- special syntax in your shell so that the names aren't treated as separate
- parameters. For instance, in BASH, use single quotes, e.g. -from:'Polar
bears'
- * -batch - Don't prompt to delete emptied categories (do it automatically).
+ NOTE: If the category names have spaces in them you may need to use
+ a special syntax in your shell so that the names aren't treated as
+ separate parameters. For instance, in BASH, use single quotes,
+ e.g. -from:'Polar bears'
+ * -batch - Don't prompt to delete emptied categories (do it
+ automatically).
* -summary: - Pick a custom edit summary for the bot.
* -inplace - Use this flag to change categories in place rather than
rearranging them.
* -delsum - An option for remove, this specifies to use the custom edit
- summary as the deletion reason (rather than a canned deletion reason)
- * -overwrite - An option for listify, this overwrites the current page with the
- list even if something is already there.
- * -showimages - An option for listify, this displays images rather than linking them
- in the list.
- * -talkpages - An option for listify, this outputs the links to talk pages of the
- pages to be listified in addition to the pages themselves.
+ summary as the deletion reason (rather than a canned
+ deletion reason)
+ * -overwrite - An option for listify, this overwrites the current page with
+ the list even if something is already there.
+ * -showimages - An option for listify, this displays images rather than
+ linking them in the list.
+ * -talkpages - An option for listify, this outputs the links to talk pages
+ of the pages to be listified in addition to the pages
+ themselves.
* -recurse - Recurse through all subcategories of categories.
- * -match - Only work on pages whose titles match the given regex (for move and
remove actions).
+ * -match - Only work on pages whose titles match the given regex (for
+ move and remove actions).
+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 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.
-
Or to do it all from the command-line, use the following syntax:
python category.py move -from:US -to:'United States'
@@ -158,7 +162,8 @@
if not os.path.isabs(filename):
filename = wikipedia.datafilepath(filename)
f = bz2.BZ2File(filename, 'r')
- wikipedia.output(u'Reading dump from %s' % filename)
+ wikipedia.output(u'Reading dump from %s'
+ % wikipedia.shortpath(filename))
databases = pickle.load(f)
f.close()
# keys are categories, values are 2-tuples with lists as entries.
@@ -223,7 +228,8 @@
'''
if not os.path.isabs(filename):
filename = wikipedia.datafilepath(filename)
- wikipedia.output(u'Dumping to %s, please wait...' % filename)
+ wikipedia.output(u'Dumping to %s, please wait...'
+ % wikipedia.shortpath(filename))
f = bz2.BZ2File(filename, 'w')
databases = {
'catContentDB': self.catContentDB,
Show replies by date