- Revision
- 11243
- Author
- bear
- Date
- 2006-07-22 14:43:31 -0700 (Sat, 22 Jul 2006)
Log Message
Epydoc text cleanup
Modified Paths
Diff
Modified: trunk/chandler/i18n/__init__.py (11242 => 11243)
--- trunk/chandler/i18n/__init__.py 2006-07-22 21:17:52 UTC (rev 11242) +++ trunk/chandler/i18n/__init__.py 2006-07-22 21:43:31 UTC (rev 11243) @@ -24,13 +24,17 @@ OSAF_DOMAIN = "osaf" -"""I18nManager instance used by the internationalization API. - It is not exposed to external developers but can be referenced - for advanced operations""" +""" +I18nManager instance used by the internationalization API. +It is not exposed to external developers but can be referenced +for advanced operations +""" _I18nManager = i18nmanager.I18nManager(OSAF_DOMAIN) -"""Expose the I18nManager instance methods""" +""" +Expose the I18nManager instance methods +""" getLocaleSet = _I18nManager.getLocaleSet getImage = _I18nManager.getImage getHTML = _I18nManager.getHTML @@ -40,52 +44,52 @@ def MessageFactory(domain): """ - Chandler translation API. A MessageFactory is leveraged per - unique domain to access the localiztion files - which are in gettext .mo format. + Chandler translation API. A MessageFactory is leveraged per + unique domain to access the localiztion files + which are in gettext .mo format. - A unique domain can be created per parcel or for a - grouping of parcels. + A unique domain can be created per parcel or for a + grouping of parcels. - A domain is namespace under which translation strings reside. + A domain is namespace under which translation strings reside. - The default domain for Chandler core is "osaf" and - can be accessed using the OSAFMessageFactory. + The default domain for Chandler core is "osaf" and + can be accessed using the OSAFMessageFactory. - A MessageFactory example: - >>> from i18n import MessageFactory - >>> _ = MessageFactory("mydomain") - >>> translatedString = _(u"Some text for translation") + A MessageFactory example: + >>> from i18n import MessageFactory + >>> _ = MessageFactory("mydomain") + >>> translatedString = _(u"Some text for translation") - An alternate example which does not use the _ method shortcut. - It should be noted that the gettext api looks for _() to find - translation strings: + An alternate example which does not use the _ method shortcut. + It should be noted that the gettext api looks for _() to find + translation strings: - >>> from i18n import MessageFactory - >>> m = MessageFactory("mydomain") - >>> translatedString = m.getTranslation(u"Some text for translation") + >>> from i18n import MessageFactory + >>> m = MessageFactory("mydomain") + >>> translatedString = m.getTranslation(u"Some text for translation") - @type domain: ASCII str - @param domain: unique ASCII domain name + @type domain: ASCII str + @param domain: unique ASCII domain name - @rtype: function - @return: A MessageFactory.getTranslation function instance + @rtype: function + @return: A MessageFactory.getTranslation function instance """ def getTranslation(defaultText): """ - Performs a translation lookup using the defaultText as the key. - Translation files are stored in the gettext .mo format and - cached on startup. The defaultText key is looked up for - each locale in the curent locale set until a match is found. - If no match is found the defaultText is returned as the value. + Performs a translation lookup using the defaultText as the key. + Translation files are stored in the gettext .mo format and + cached on startup. The defaultText key is looked up for + each locale in the curent locale set until a match is found. + If no match is found the defaultText is returned as the value. - @type defaultText: unicode or ascii - @param defaultText: the unicode or ascii default key + @type defaultText: unicode or ascii + @param defaultText: the unicode or ascii default key - @rtype: unicode - @return: The unicode localized string for key defaultText or the + @rtype: unicode + @return: The unicode localized string for key defaultText or the defaultText if no match found """ @@ -101,25 +105,25 @@ def wxMessageFactory(defaultText): """ - The translation message factory for WxWidgets. - The wxMessageFactory is intended as shortcut to allow easy - access to translations in the "wxstd" domain. + The translation message factory for WxWidgets. + The wxMessageFactory is intended as shortcut to allow easy + access to translations in the "wxstd" domain. - The domain must have been loaded by the I18nManager - in order to access the translations. Otherwise an - i18n.I18nException will be raised. + The domain must have been loaded by the I18nManager + in order to access the translations. Otherwise an + i18n.I18nException will be raised. - A wxMessageFactory example: - >>> from i18n import wxMessageFactory as w - >>> translatedString = w("Cancel") + A wxMessageFactory example: + >>> from i18n import wxMessageFactory as w + >>> translatedString = w("Cancel") - @type defaultText: unicode or ascii - @param defaultText: the unicode or ascii default key + @type defaultText: unicode or ascii + @param defaultText: the unicode or ascii default key - @rtype: unicode - @return: The unicode localized string for key defaultText or the - defaultText if no match found + @rtype: unicode + @return: The unicode localized string for key defaultText or the + defaultText if no match found """ @@ -132,29 +136,29 @@ def OSAFMessageFactory(defaultText): """ - The translation message factory for Chandler Core. - The OSAFMessageFactory is intended as shortcut to allow easy - access to translations in the "osaf" domain. + The translation message factory for Chandler Core. + The OSAFMessageFactory is intended as shortcut to allow easy + access to translations in the "osaf" domain. - An OSAFMessageFactory example: - >>> from i18n import OSAFMessageFactory as _ - >>> translatedString = _(u"Some text for translation") + An OSAFMessageFactory example: + >>> from i18n import OSAFMessageFactory as _ + >>> translatedString = _(u"Some text for translation") - The functionality provided by the OSAFMessageFactory can - be accessed using a MessageFactory. Again the OSAFMessageFactory - is provided as a shortcut + The functionality provided by the OSAFMessageFactory can + be accessed using a MessageFactory. Again the OSAFMessageFactory + is provided as a shortcut - >>> from i18n import MessageFactory - >>> import i18n - >>> _ = MessageFactory(i18n.OSAF_DOMAIN) - >>> translatedString = _(u"Some text for translation") + >>> from i18n import MessageFactory + >>> import i18n + >>> _ = MessageFactory(i18n.OSAF_DOMAIN) + >>> translatedString = _(u"Some text for translation") - @type defaultText: unicode - @param defaultText: the unicode default key in english + @type defaultText: unicode + @param defaultText: the unicode default key in english - @rtype: unicode - @return: The unicode localized string for key defaultText or the - defaultText if no match found + @rtype: unicode + @return: The unicode localized string for key defaultText or the + defaultText if no match found """ return MessageFactory(OSAF_DOMAIN)(defaultText)
Modified: trunk/chandler/i18n/i18nmanager.py (11242 => 11243)
--- trunk/chandler/i18n/i18nmanager.py 2006-07-22 21:17:52 UTC (rev 11242) +++ trunk/chandler/i18n/i18nmanager.py 2006-07-22 21:43:31 UTC (rev 11243) @@ -73,15 +73,15 @@ def setRootPath(self, path): """ - Set the root path under which the I18nManager runs. - This path is used to locale resources and - optionally is used as part of the wxTranslation - loading mechanism. If the root path is not explicitly - set it defaults to "." + Set the root path under which the I18nManager runs. + This path is used to locale resources and + optionally is used as part of the wxTranslation + loading mechanism. If the root path is not explicitly + set it defaults to "." - @type path: unicode or str - @param path: A filesystem path to the root directory that the - I18nManager is run under + @type path: unicode or str + @param path: A filesystem path to the root directory that the + I18nManager is run under """ assert(path is not None) @@ -95,18 +95,18 @@ def setWxPath(self, path): """ - Set the WxWidgets translation filesystem path. - Under this path be the following structure: + Set the WxWidgets translation filesystem path. + Under this path be the following structure: - $LOCALE_NAME/LC_MESSAGES/wxstd.mo + $LOCALE_NAME/LC_MESSAGES/wxstd.mo - Setting the wxPath is optional. But - if not set the wx localizations files for - the "wxstd" domain will not be loaded. + Setting the wxPath is optional. But + if not set the wx localizations files for + the "wxstd" domain will not be loaded. - @type path: unicode or str - @param path: A filesystem path to the directory - that contains the wx translations + @type path: unicode or str + @param path: A filesystem path to the directory + that contains the wx translations """ assert(path is not None) @@ -120,9 +120,9 @@ def flushCache(self): """ - Flushes the current resource path and translation per locale cache. - This should be called when a locale set has been changed during runtime - or to reload translations. + Flushes the current resource path and translation per locale cache. + This should be called when a locale set has been changed during runtime + or to reload translations. """ del self._cache self._cache = {"RESOURCES": {}, "TRANSLATIONS": {}} @@ -130,13 +130,13 @@ def discoverLocaleSet(self): """ - Queries the Operating System for the current locale sets. - The Operating System may return one or more locales. In the case - where more than one locale is returned the translation fallback will - try each locale in the set in order till a resource or translation is - encountered. + Queries the Operating System for the current locale sets. + The Operating System may return one or more locales. In the case + where more than one locale is returned the translation fallback will + try each locale in the set in order till a resource or translation is + encountered. - For .7 only the primary locale will be used. + For .7 only the primary locale will be used. """ # For .7 we will use wx to get the primary OS locale. @@ -154,11 +154,11 @@ def setLocaleSet(self, localeSet=None): """ - Sets the current locale set for translation. + Sets the current locale set for translation. - @type localeSet: List - @param localeSet: an ordered List of locale strings - for example ['en_US', 'en'] + @type localeSet: List + @param localeSet: an ordered List of locale strings + for example ['en_US', 'en'] """ assert isinstance(localeSet, ListType) @@ -263,23 +263,23 @@ def wxTranslate(self, defaultText): """ - Returns the translation for the current localeset for the - WxWidgets "wxstd" domain. + Returns the translation for the current localeset for the + WxWidgets "wxstd" domain. - The WxWidgets localization path needs to be set - prior to calling wxTranslate via the setWxPath method. - Setting the wxPath tells the I18nManager how to - find the wxstd.mo translation files. + The WxWidgets localization path needs to be set + prior to calling wxTranslate via the setWxPath method. + Setting the wxPath tells the I18nManager how to + find the wxstd.mo translation files. - If the wx path has not been set wxTranslate will raise a - i18n.I18nException. + If the wx path has not been set wxTranslate will raise a + i18n.I18nException. - @type defaultText: unicode - @param defaultText: the unicode or ascii default key + @type defaultText: unicode + @param defaultText: the unicode or ascii default key - @rtype: unicode - @return: The translated unicode string for key defaultText - or defaultText itself if no translation found + @rtype: unicode + @return: The translated unicode string for key defaultText + or defaultText itself if no translation found """ #if not self._initialized: @@ -300,22 +300,22 @@ def getImage(self, fileName, domain=None): """ - Retrieves the localized image for the given domain. - A folder structure based on the ordered locale set of the domain - is searched for a image with the passed in fileName. When a match is - found an open file object for the resource is returned. This path is - then cached for future lookups. If no match is found for - the given locale set and no default file with the - fileName is found None is returned. + Retrieves the localized image for the given domain. + A folder structure based on the ordered locale set of the domain + is searched for a image with the passed in fileName. When a match is + found an open file object for the resource is returned. This path is + then cached for future lookups. If no match is found for + the given locale set and no default file with the + fileName is found None is returned. - @type fileName: unicode - @param fileName: The name of the file to return + @type fileName: unicode + @param fileName: The name of the file to return - @type domain: ASCII str - @param domain: unique ASCII domain name + @type domain: ASCII str + @param domain: unique ASCII domain name - @rtype: file or None - @return: An open file handle to the resource or None if no file found + @rtype: file or None + @return: An open file handle to the resource or None if no file found """ if domain is None: @@ -326,22 +326,22 @@ def getHTML(self, fileName, domain=None): """ - Retrieves the localized html file for the given domain. - A folder structure based on the ordered locale set of the domain - is searched for an html file with the passed in fileName. - When a match is found an open file object for the resource is - returned. This path is then cached for future lookups. - If no match is found for the given locale set - and no default file with the fileName is found None is returned. + Retrieves the localized html file for the given domain. + A folder structure based on the ordered locale set of the domain + is searched for an html file with the passed in fileName. + When a match is found an open file object for the resource is + returned. This path is then cached for future lookups. + If no match is found for the given locale set + and no default file with the fileName is found None is returned. - @type fileName: unicode - @param fileName: The name of the file to return + @type fileName: unicode + @param fileName: The name of the file to return - @type domain: ASCII str - @param domain: unique ASCII domain name + @type domain: ASCII str + @param domain: unique ASCII domain name - @rtype: file or None - @return: An open file handle to the resource or None if no file found + @rtype: file or None + @return: An open file handle to the resource or None if no file found """ if domain is None: @@ -352,22 +352,22 @@ def getAudio(self, fileName, domain=None): """ - Retrieves the localized audio file for the given domain. - A folder structure based on the ordered locale set of the domain - is searched for an audio file with the passed in fileName. - When a match is found an open file object for the - resource is returned. This path is then cached for - future lookups. If no match is found for the given locale set - and no default file with the fileName is found None is returned. + Retrieves the localized audio file for the given domain. + A folder structure based on the ordered locale set of the domain + is searched for an audio file with the passed in fileName. + When a match is found an open file object for the + resource is returned. This path is then cached for + future lookups. If no match is found for the given locale set + and no default file with the fileName is found None is returned. - @type fileName: unicode - @param fileName: The name of the file to return + @type fileName: unicode + @param fileName: The name of the file to return - @type domain: ASCII str - @param domain: unique ASCII domain name + @type domain: ASCII str + @param domain: unique ASCII domain name - @rtype: file or None - @return: An open file handle to the resource or None if no file found + @rtype: file or None + @return: An open file handle to the resource or None if no file found """ if domain is None: @@ -378,28 +378,28 @@ def getResource(self, relPath, fileName, domain=None): """ - Generic method for looking up localized resources. - retrieves the localized file for the given domain - and relative file path. A folder structure based on - the ordered locale set of the domain is searched for - a resource with the passed in fileName. When a match is - found an open file object for the resource is returned. - This path is then cached for future lookups. - If no match is found for the given locale set and - no default file with the fileName is found None is returned. + Generic method for looking up localized resources. + retrieves the localized file for the given domain + and relative file path. A folder structure based on + the ordered locale set of the domain is searched for + a resource with the passed in fileName. When a match is + found an open file object for the resource is returned. + This path is then cached for future lookups. + If no match is found for the given locale set and + no default file with the fileName is found None is returned. - @type relPath: unicode - @param relPath: The relative file path in - relation to the domain file path + @type relPath: unicode + @param relPath: The relative file path in + relation to the domain file path - @type fileName: unicode - @param fileName: The name of the file to return + @type fileName: unicode + @param fileName: The name of the file to return - @type domain: ASCII str - @param domain: unique ASCII domain name + @type domain: ASCII str + @param domain: unique ASCII domain name - @rtype: file or None - @return: An open file handle to the resource or None if no file found + @rtype: file or None + @return: An open file handle to the resource or None if no file found """ if domain is None:
Modified: trunk/chandler/parcels/osaf/framework/blocks/Block.py (11242 => 11243)
--- trunk/chandler/parcels/osaf/framework/blocks/Block.py 2006-07-22 21:17:52 UTC (rev 11242) +++ trunk/chandler/parcels/osaf/framework/blocks/Block.py 2006-07-22 21:43:31 UTC (rev 11243) @@ -167,7 +167,7 @@ @param arguments: arguments to pass to the event @type arguments: a C{dict} @param sender: the block that sent the event - @type arguments: a C{Block} + @type sender: a C{Block} @return: the value returned by the event handler """ try:
Modified: trunk/chandler/util/timing.py (11242 => 11243)
--- trunk/chandler/util/timing.py 2006-07-22 21:17:52 UTC (rev 11242) +++ trunk/chandler/util/timing.py 2006-07-22 21:43:31 UTC (rev 11243) @@ -14,16 +14,17 @@ """ -The util.timing module is a simple way to time critical sections of your -code. By placing begin() and end() calls around the sections you want to time, -you can get a report of how many times that section was called, total time, -and average time -- a lightweight profiler. The begin() and end() methods -take a name parameter that is a string which describes the operation you -are timing -- make sure they match! -- that will appear in the report printed -by the results() method. +The util.timing module is a simple way to time critical sections +of your code. By placing begin() and end() calls around the sections +you want to time, you can get a report of how many times that section +was called, total time, and average time -- a lightweight profiler. -Example: +The begin() and end() methods take a name parameter that is a string +which describes the operation you are timing -- make sure they match! +That string will appear in the report printed by the results() method. +Example:: + import util.timing def myFunction(): @@ -52,11 +53,12 @@ Totals: 1460 8.429 0.006 -Gotchas: +Gotchas:: -- Recursion isn't handled (you will get an assert if you try to call begin() -on the same label without an intervening end()) -- The grand total will be inflated if any of the timed sections are nested. + - Recursion isn't handled (you will get an assert if you try to + call begin() on the same label without an intervening end()) + - The grand total will be inflated if any of the timed sections + are nested. """ import time
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
