From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
Date: Sun, 10 Jul 2011 12:34:52 +0000 (UTC) [thread overview]
Message-ID: <53efdd7a7b7317b8baa1d86cdbad55f1a303d488.mgorny@gentoo> (raw)
commit: 53efdd7a7b7317b8baa1d86cdbad55f1a303d488
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 11:22:44 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 11:22:44 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=53efdd7a
Re-doc core code.
---
gentoopm/__init__.py | 13 +++++++++++--
gentoopm/preferences.py | 3 +++
gentoopm/querycli.py | 18 ++++++++++++++++++
gentoopm/submodules.py | 26 ++++++++++++++++----------
4 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index f05d6ec..8fc5b3f 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -5,11 +5,20 @@
PV = '0'
+"""
+The package version.
+
+@type: string
+"""
+
def get_package_manager():
"""
Get the PackageManager instance for the best package manager available.
- Takes user preferences into consideration. Raises an exception if no PM
- could be found.
+ Takes user preferences into consideration.
+
+ @return: Best package manager instance available
+ @rtype: L{PackageManager}
+ @raise Exception: No package manager could be imported.
"""
from gentoopm.preferences import get_preferred_pms
diff --git a/gentoopm/preferences.py b/gentoopm/preferences.py
index c33f744..7141c6d 100644
--- a/gentoopm/preferences.py
+++ b/gentoopm/preferences.py
@@ -13,6 +13,9 @@ def get_preferred_pms():
"""
Find out what are the user's PM preferences and return the preferred PM
names as an iterable, with the most preferred one coming first.
+
+ @return: Preferred PMs, in order
+ @rtype: iterable(string)
"""
ret = []
diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index 9267c4e..e1ea091 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -13,6 +13,11 @@ def reponame(val):
"""
Check the value for correctness as repository name. In fact, it only ensures
it isn't a path so that it won't confuse pm.repositories[val].
+
+ @param val: the config option value
+ @type val: string
+ @return: whether the value is a correct repo name
+ @rtype: bool
"""
if os.path.isabs(val):
raise ValueError('Invalid repository name: %s' % val)
@@ -25,6 +30,9 @@ class PMQueryCommand(ABCObject):
def help(self):
"""
Return the help string for a sub-command.
+
+ @return: the help string
+ @rtype: string
"""
descdoc = ' '.join(self.__doc__.split())
descdoc = descdoc[0].lower() + descdoc[1:]
@@ -33,6 +41,9 @@ class PMQueryCommand(ABCObject):
def __init__(self, argparser):
"""
Instantiate the subcommand, setting argument parser as necessary.
+
+ @param argparser: sub-command argument parser
+ @type argparser: C{argparse.ArgumentParser}
"""
argparser.set_defaults(instance = self)
self._arg = argparser
@@ -43,6 +54,13 @@ class PMQueryCommand(ABCObject):
Call the sub-command, passing pm (a working PackageManager instance)
and args (the result of argument parsing). Can return exit code
for the process if relevant. If it doesn't, 0 will be used.
+
+ @param pm: package manager instance
+ @type pm: L{PackageManager}
+ @param args: command arguments
+ @type args: C{argparse.Namespace}
+ @return: Process exit code or None if irrelevant
+ @rtype: bool/None
"""
pass
diff --git a/gentoopm/submodules.py b/gentoopm/submodules.py
index 7659361..82945bf 100644
--- a/gentoopm/submodules.py
+++ b/gentoopm/submodules.py
@@ -11,14 +11,15 @@ supported_pms = {
def get_pm(pm_name):
"""
- Get the PackageManager instance for a particularly named PM. Either returns
- a PackageManager subclass instance or raises one of the following
- exceptions:
-
- - KeyError if pm_name doesn't refer to a supported PM,
- - ImportError if modules required for a particular PM are not available,
- - NameError if for some reason required class isn't provided by the module
- (consider this an internal error).
+ Get the PackageManager instance for a particularly named PM.
+
+ @param pm_name: name of package manager to use
+ @type pm_name: string
+ @return: A package manager instance
+ @rtype: L{PackageManager}
+ @raise KeyError: pm_name doesn't refer to a supported PM
+ @raise ImportError: modules required for the PM are not available
+ @raise NameError: PM class is not available
"""
modname, clsname = supported_pms[pm_name]
@@ -28,8 +29,13 @@ def get_pm(pm_name):
def get_any_pm(pm_list):
"""
Get the first working PackageManager from the pm_list. This function will
- try to import them in order and either return the first succeeding or raise
- an exception if all of them fail.
+ try to import them in order and return the first succeeding.
+
+ @param pm_list: list of preferred package manager names, in order
+ @type pm_list: iterable(string)
+ @return: Best available package manager instance
+ @rtype: L{PackageManager}
+ @raise Exception: if none of the PMs are available
"""
for pm_name in pm_list:
next reply other threads:[~2011-07-10 12:35 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-10 12:34 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-08-08 23:02 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/ Michał Górny
2013-02-16 11:42 Michał Górny
2012-12-10 21:04 Michał Górny
2012-10-14 21:35 Michał Górny
2012-01-09 16:09 Michał Górny
2011-12-24 10:36 Michał Górny
2011-11-15 18:58 Michał Górny
2011-11-14 21:44 Michał Górny
2011-09-09 21:13 Michał Górny
2011-08-23 20:39 Michał Górny
2011-08-15 16:00 Michał Górny
2011-08-15 8:48 Michał Górny
2011-08-13 18:49 Michał Górny
2011-08-13 18:49 Michał Górny
2011-08-13 18:49 Michał Górny
2011-08-13 10:31 Michał Górny
2011-08-13 10:31 Michał Górny
2011-08-13 10:31 Michał Górny
2011-08-12 21:10 Michał Górny
2011-08-12 20:07 Michał Górny
2011-08-12 9:28 Michał Górny
2011-08-12 8:53 Michał Górny
2011-08-12 8:24 Michał Górny
2011-08-12 8:24 Michał Górny
2011-08-12 7:28 Michał Górny
2011-07-29 6:18 Michał Górny
2011-07-27 8:26 Michał Górny
2011-07-23 9:27 Michał Górny
2011-07-22 13:16 Michał Górny
2011-07-21 23:00 Michał Górny
2011-07-21 23:00 Michał Górny
2011-07-21 23:00 Michał Górny
2011-07-20 18:30 Michał Górny
2011-07-19 12:07 Michał Górny
2011-07-17 22:19 Michał Górny
2011-07-17 13:58 Michał Górny
2011-07-10 12:34 Michał Górny
2011-07-10 12:34 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53efdd7a7b7317b8baa1d86cdbad55f1a303d488.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox