Skip to content

Commit a74fb30

Browse files
made some more doc string and comment formatting improvements
1 parent 35097e3 commit a74fb30

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

robottools/library/keywords/__init__.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
class Keyword(object):
4444
"""The Keyword handler for Test Library instances.
4545
46-
- Provides inspection of names, args and docs.
47-
- Gets called by Test Library's run_keyword().
46+
* Provides inspection of Keyword name, arguments, and documentation.
47+
* Instances get called by Test Libraries' ``.run_keyword()`` method.
4848
"""
4949
def __init__(self, name, func, libinstance):
5050
"""Initialize with Keyword's display `name`,
@@ -53,30 +53,34 @@ def __init__(self, name, func, libinstance):
5353
self.name = name
5454
self.func = func
5555
self.libinstance = libinstance
56-
# Get all ContextHandler classes for which this Keyword
57-
# has context-specific implementations,
58-
# to implicitly provide additional <context>= switching kwargs:
56+
# Get all ContextHandler-derived classes for which this Keyword
57+
# has context-specific implementations,
58+
# to implicitly provide additional context_name= switching kwargs:
5959
self.context_handlers = set(ctx.handler for ctx in func.contexts)
6060

6161
@property
6262
def __doc__(self):
63+
"""The Keyword's documentation string,
64+
taken from ``self.func.__doc__``.
65+
"""
6366
return self.func.__doc__
6467

6568
@property
6669
def libname(self):
67-
"""The Test Library's class and display name.
70+
"""The Keyword's Test Library class name,
71+
which also represents the Library's display name.
6872
"""
6973
return type(self.libinstance).__name__
7074

7175
@property
7276
def longname(self):
73-
"""The Keyword's full display name (TestLibraryName.Keyword Name).
77+
"""The Keyword's full display name (**TestLibraryName.Keyword Name**).
7478
"""
7579
return '%s.%s' % (self.libname, self.name)
7680

7781
def args(self):
7882
"""Iterate the Keyword's argument spec in Robot's Dynamic API style,
79-
usable by Test Library's get_keyword_arguments().
83+
usable by Test Libraries' ``.get_keyword_arguments()`` method.
8084
"""
8185
# First look for custom override args list:
8286
if self.func.args:
@@ -117,7 +121,7 @@ def args(self):
117121
yield '**options'
118122

119123
def __call__(self, *args, **kwargs):
120-
"""Call the Keyword's function with the given arguments.
124+
"""Call the Keyword's actual function with the given arguments.
121125
"""
122126
func = self.func
123127
# look for explicit <session>= and <context>= switching options

robottools/library/keywords/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
class KeywordName(str):
3636
""":class:`str` wrapper to work with Keyword names in a Robot way.
3737
38-
- Converts the given raw Keyword name (usually a function name)
38+
* Converts the given raw Keyword name (usually a function name)
3939
to Capitalized Robot Style.
40-
- Uses :func:`robot.utils.normalize`d conversions
40+
* Uses :func:`robot.utils.normalize`d conversions
4141
(plain lowercase without spaces and underscores)
4242
for comparing and hashing.
4343
"""
@@ -58,8 +58,8 @@ def __hash__(self):
5858

5959

6060
class KeywordsDict(object):
61-
"""Store Keyword functions or :class:`Keyword` objects
62-
with :class:`KeywordName` keys.
61+
"""Store Keyword functions or :class:`robottools.Keyword` instances
62+
with :class:`robottools.KeywordName` keys.
6363
"""
6464
def __init__(self):
6565
self._dict = {}
@@ -89,6 +89,7 @@ def __nonzero__(self):
8989
return self.__bool__()
9090

9191
def __dir__(self):
92-
"""The Keyword names in CamelCase.
92+
"""The Keyword names in CamelCase
93+
to be used with :meth:`self.__getattr__`.
9394
"""
9495
return [''.join(name.split()) for name in self._dict]

0 commit comments

Comments
 (0)