24 from .model
import LibraryDoc, KeywordDoc
31 _argument_separator =
'::'
40 doc_format=lib.doc_format)
51 path = library.replace(
'/', os.sep)
52 if os.path.exists(path):
53 return os.path.abspath(path)
57 return lib.doc
or "Documentation for library ``%s``." % lib.name
60 if lib.init.arguments.maxargs:
75 @disable_curdir_processing
80 if os.path.isfile(path):
81 return os.path.normpath(path)
82 for dire
in [item
for item
in sys.path
if os.path.isdir(item)]:
83 candidate = os.path.normpath(os.path.join(dire, path))
84 if os.path.isfile(candidate):
86 raise DataError(
"Resource file '%s' does not exist." % path)
91 return "Documentation for resource file ``%s``." % res.name
100 return [self.
build_keywordbuild_keyword(kw)
for kw
in lib.handlers]
105 args=self.
_get_args_get_args(kw.arguments),
112 return doc, kw.tags + tags
115 if self.
_resource_resource
and not isinstance(kw, UserErrorHandler):
123 args = [self.
_format_arg_format_arg(arg, argspec)
for arg
in argspec.positional]
125 args.append(
'*%s' % self.
_format_arg_format_arg(argspec.varargs, argspec))
126 if argspec.kwonlyargs:
127 if not argspec.varargs:
129 args.extend(self.
_format_arg_format_arg(arg, argspec)
130 for arg
in argspec.kwonlyargs)
132 args.append(
'**%s' % self.
_format_arg_format_arg(argspec.kwargs, argspec))
137 if argspec.types
is not None and arg
in argspec.types:
138 result =
'%s: %s' % (result, self.
_format_type_format_type(argspec.types[arg]))
139 if arg
in argspec.defaults:
140 result =
'%s=%s' % (result, argspec.defaults[arg])
144 return type_.__name__
if isinstance(type_, type)
else type_
Used when variable does not exist.
def _get_args(self, argspec)
:type argspec: :py:class:robot.running.arguments.ArgumentSpec
def build_keywords(self, lib)
def __init__(self, resource=False)
def _format_arg(self, arg, argspec)
def _get_doc_and_tags(self, kw)
def build_keyword(self, kw)
def _format_type(self, type_)
def _normalize_library_path(self, library)
def _split_library_name_and_args(self, library)
string _argument_separator
def _get_initializers(self, lib)
def _import_resource(self, path)
def _find_resource_file(self, path)
def TestLibrary(name, args=None, variables=None, create_handlers=True)
def split_tags_from_doc(doc)