Robot Framework Integrated Development Environment (RIDE)
model.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from itertools import chain
17 
18 from robotide.lib.robot.model import Tags
19 from robotide.lib.robot.utils import getshortdoc, Sortable, setter
20 
21 from .writer import LibdocWriter
22 from .output import LibdocOutput
23 
24 
25 class LibraryDoc():
26 
27  def __init__(self, name='', doc='', version='', type='library',
28  scope='', named_args=True, doc_format=''):
29  self.namename = name
30  self.docdoc = doc
31  self.versionversion = version
32  self.typetype = type
33  self.scopescope = scope
34  self.named_argsnamed_args = named_args
35  self.doc_formatdoc_formatdoc_format = doc_format
36  self.initsinits = []
37  self.keywordskeywordskeywords = []
38 
39  @setter
40  def doc_format(self, format):
41  return format or 'ROBOT'
42 
43  @setter
44  def keywords(self, kws):
45  return sorted(kws)
46 
47  @property
48  all_tags = property
49 
50  def all_tags(self):
51  return Tags(chain.from_iterable(kw.tags for kw in self.keywordskeywordskeywords))
52 
53  def save(self, output=None, format='HTML'):
54  with LibdocOutput(output, format) as outfile:
55  LibdocWriter(format).write(self, outfile)
56 
57 
58 class KeywordDoc(Sortable):
59 
60  def __init__(self, name='', args=(), doc='', tags=()):
61  self.namename = name
62  self.argsargs = args
63  self.docdoc = doc
64  self.tagstags = Tags(tags)
65 
66  @property
67  shortdoc = property
68 
69  def shortdoc(self):
70  return getshortdoc(self.docdoc)
71 
72  @property
73  _sort_key = property
74 
75  def _sort_key(self):
76  return self.namename.lower()
def __init__(self, name='', args=(), doc='', tags=())
Definition: model.py:60
def save(self, output=None, format='HTML')
Definition: model.py:53
def __init__(self, name='', doc='', version='', type='library', scope='', named_args=True, doc_format='')
Definition: model.py:28
def write(msg, level='INFO', html=False)
Writes the message to the log file using the given level.
Definition: logger.py:86
def LibdocWriter(format=None)
Definition: writer.py:22
def getshortdoc(doc_or_item, linesep='\n')
Definition: text.py:181