Robot Framework Integrated Development Environment (RIDE)
comments.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
robotide.lib.robot.utils
import
is_string
17
18
19
class
CommentCache
():
20
21
def
__init__
(self):
22
self.
_comments
_comments = []
23
24
def
add
(self, comment):
25
self.
_comments
_comments.append(comment)
26
27
def
consume_with
(self, function):
28
print(f
"DEBUG: CommentCache enter consume_with {self._comments}"
)
29
for
comment
in
self.
_comments
_comments:
30
function(comment)
31
self.
__init__
__init__()
32
33
34
class
Comments
():
35
36
def
__init__
(self):
37
self.
_comments
_comments = []
38
39
def
add
(self, row):
40
if
row.comments:
41
self.
_comments
_comments.extend(c.strip()
for
c
in
row.comments
if
c.strip())
42
43
@property
44
value = property
45
46
def
value
(self):
47
return
self.
_comments
_comments
48
49
50
class
Comment
():
51
52
def
__init__
(self, comment_data):
53
if
is_string
(comment_data):
54
comment_data = [comment_data]
if
comment_data
else
[]
55
self.
_comment
_comment = comment_data
or
[]
56
# print(f"DEBUG RFLib Comment input={comment_data} self._comment={self._comment}")
57
58
def
__len__
(self):
59
return
len(self.
_comment
_comment)
60
61
def
as_list
(self):
62
if
self.
_not_commented
_not_commented():
63
self.
_comment
_comment[0] =
'# '
+ self.
_comment
_comment[0]
64
return
self.
_comment
_comment
65
66
def
_not_commented
(self):
67
return
self.
_comment
_comment
and
self.
_comment
_comment[0]
and
self.
_comment
_comment[0][0] !=
'#'
robotide.lib.robot.parsing.comments.CommentCache
Definition:
comments.py:19
robotide.lib.robot.parsing.comments.CommentCache.add
def add(self, comment)
Definition:
comments.py:24
robotide.lib.robot.parsing.comments.CommentCache._comments
_comments
Definition:
comments.py:22
robotide.lib.robot.parsing.comments.CommentCache.consume_with
def consume_with(self, function)
Definition:
comments.py:27
robotide.lib.robot.parsing.comments.CommentCache.__init__
def __init__(self)
Definition:
comments.py:21
robotide.lib.robot.parsing.comments.Comment
Definition:
comments.py:50
robotide.lib.robot.parsing.comments.Comment.as_list
def as_list(self)
Definition:
comments.py:61
robotide.lib.robot.parsing.comments.Comment.__init__
def __init__(self, comment_data)
Definition:
comments.py:52
robotide.lib.robot.parsing.comments.Comment._not_commented
def _not_commented(self)
Definition:
comments.py:66
robotide.lib.robot.parsing.comments.Comment._comment
_comment
Definition:
comments.py:55
robotide.lib.robot.parsing.comments.Comment.__len__
def __len__(self)
Definition:
comments.py:58
robotide.lib.robot.parsing.comments.Comments
Definition:
comments.py:34
robotide.lib.robot.parsing.comments.Comments.add
def add(self, row)
Definition:
comments.py:39
robotide.lib.robot.parsing.comments.Comments.value
value
Definition:
comments.py:44
robotide.lib.robot.parsing.comments.Comments._comments
_comments
Definition:
comments.py:37
robotide.lib.robot.parsing.comments.Comments.__init__
def __init__(self)
Definition:
comments.py:36
robotide.lib.robot.utils.robottypes2.is_string
def is_string(item)
Definition:
robottypes2.py:41
robotide.lib.robot.utils
Definition:
__init__.py:1
src
robotide
lib
robot
parsing
comments.py
Generated by
1.9.1