Robot Framework Integrated Development Environment (RIDE)
commands.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 import os
17 
18 from ..controller.ctrlcommands import FindOccurrences, FindVariableOccurrences, _Command
19 # import FindOccurrences, _Command, FindVariableOccurrences
20 # from ..controller import macrocontrollers
21 # from ..controller.macrocontrollers import KeywordNameController
22 # import KeywordNameController
23 
24 
26 
27  def execute(self, context):
28  from ..controller.macrocontrollers import KeywordNameController
29 
30  prev = None
31  for occ in FindOccurrences.execute(self, context):
32  if isinstance(occ.item, KeywordNameController):
33  continue
34  if prev == occ:
35  prev.count += 1
36  else:
37  if prev:
38  yield prev
39  prev = occ
40  if prev:
41  yield prev
42 
43 
45 
46  def execute(self, context):
47  prev = None
48  for occ in FindVariableOccurrences.execute(self, context):
49  if prev == occ:
50  prev.count += 1
51  else:
52  if prev:
53  yield prev
54  prev = occ
55  if prev:
56  yield prev
57 
58 
60 
61 
64  def execute(self, context):
65  for imp in context.get_where_used():
66  yield ResourceUsage(context, imp)
67 
68 
70 
71  def execute(self, context):
72  for imp in context.get_where_used():
73  yield ResourceUsage(*imp)
74 
75 
76 class ResourceUsage():
77 
78  def __init__(self, resource, imp):
79  self.res_nameres_name = resource.name
80  self.res_srcres_src = resource.source
81  user = imp.datafile_controller
82  self.locationlocation = user.filename
83  self.namename = user.display_name
84  self.itemitem = user.imports
85  self.parentparent = user
86  self.can_be_renamedcan_be_renamed = imp.contains_filename(os.path.basename(resource.filename))
def execute(self, context)
from ..controller.filecontrollers import TestCaseFileController if isinstance(context,...
Definition: commands.py:64
def execute(self, context)
Definition: commands.py:27
def __init__(self, resource, imp)
Definition: commands.py:78