Thu, 15 Feb 2024 13:59:02 +0100
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
10574
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de> |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the code coverage request handler of the eric-ide server. |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from coverage import Coverage |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | from coverage.misc import CoverageException |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from eric7.SystemUtilities import FileSystemUtilities |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | from .EricRequestCategory import EricRequestCategory |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | class EricServerCoverageRequestHandler: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | Class implementing the code coverage request handler of the eric-ide server. |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | def __init__(self, server): |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | Constructor |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | @param server reference to the eric-ide server object |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | @type EricServer |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | self.__server = server |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | self.__requestMethodMapping = { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | "LoadData": self.__loadCoverageData, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | "AnalyzeFile": self.__analyzeFile, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | "AnalyzeFiles": self.__analyzeFiles, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | "AnalyzeDirectory": self.__analyzeDirectory, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | self.__cover = None |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | def handleRequest(self, request, params, reqestUuid): |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | Public method handling the received file system requests. |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | @param request request name |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | @type str |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | @param params dictionary containing the request parameters |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | @type dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | @param reqestUuid UUID of the associated request as sent by the eric IDE |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | @type str |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | try: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | result = self.__requestMethodMapping[request](params) |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.__server.sendJson( |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | category=EricRequestCategory.Coverage, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | reply=request, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | params=result, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | reqestUuid=reqestUuid, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | ) |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | except KeyError: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | self.__server.sendJson( |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | category=EricRequestCategory.Coverage, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | reply=request, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | params={"Error": f"Request type '{request}' is not supported."}, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | ) |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | def __loadCoverageData(self, params): |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | Private method to load the data collected by a code coverage run. |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | @param params dictionary containing the request data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | @type dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | @return dictionary containing the reply data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | @rtype dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | if self.__cover is not None: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | del self.__cover |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.__cover = None |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | try: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | self.__cover = Coverage(data_file=params["data_file"]) |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | self.__cover.load() |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.__cover.exclude(params["exclude"]) |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | return {"ok": True} |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | except CoverageException as err: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | "ok": False, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | "error": str(err), |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | def __analyzeFile(self, params): |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | Private method to analyze a single file. |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | @param params dictionary containing the request data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | @type dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | @return dictionary containing the reply data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | @rtype dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | if self.__cover is None: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | "ok": False, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | "error": "Coverage data has to be loaded first.", |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | try: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | "ok": True, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | "result": self.__cover.analysis2(params["filename"]), |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | except CoverageException as err: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | "ok": False, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | "error": str(err), |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | def __analyzeFiles(self, params): |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | Private method to analyze a list of files. |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | @param params dictionary containing the request data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | @type dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | @return dictionary containing the reply data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | @rtype dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | # TODO: not implemented yet |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | if self.__cover is None: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | "ok": False, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | "error": "Coverage data has to be loaded first.", |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | try: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | "ok": True, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | "results": [self.__cover.analysis2(f) for f in params["filenames"]], |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | except CoverageException as err: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | "ok": False, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | "error": str(err), |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | def __analyzeDirectory(self, params): |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | Private method to analyze files of a directory tree. |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | @param params dictionary containing the request data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | @type dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | @return dictionary containing the reply data |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | @rtype dict |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | """ |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | # TODO: not implemented yet |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | if self.__cover is None: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | "ok": False, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | "error": "Coverage data has to be loaded first.", |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | files = FileSystemUtilities.direntries(params["directory"], True, "*.py", False) |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | try: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | "ok": True, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | "results": [self.__cover.analysis2(f) for f in files], |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | } |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | except CoverageException as err: |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | return { |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | "ok": False, |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | "error": str(err), |
622e59b51640
Implemented the profiling and code coverage interface of the dialogs to the eric-ide server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | } |