Skip to content

Commit d07947e

Browse files
committed
style: cleaned up some dead code
1 parent 4ef2261 commit d07947e

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

cls/TestCoverage/Data/CodeUnit.cls

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri
142142
do pCodeUnit.Lines.Insert("")
143143

144144
// Filling in the MethodMap and LineToMethodMap properties
145-
Set ClassName = $Piece(tName,".", *)
146-
Set tMethodInfo = ##class(TestCoverage.Utils).GetPythonMethodMapping(pDocumentText, ClassName)
145+
Set tMethodInfo = ##class(TestCoverage.Utils).GetPythonMethodMapping(pDocumentText)
147146
// tMethodInfo is a python tuple of (line to method info, method map info)
148147
Set tLineToMethodInfo = tMethodInfo."__getitem__"(0) // a python builtins list where the item at index i is the name of the method that line i is a part of
149148
Set tMethodMapInfo = tMethodInfo."__getitem__"(1) // a python builtins dict with key = method name, value = the line number of its definition
@@ -356,7 +355,7 @@ Method UpdateSourceMap(pSourceNamespace As %String, ByRef pCache) As %Status
356355
Set tClassLineCode = $zstrip(pCLSCodeUnit.Lines.GetAt(tCLSMethodNum + tClassLineNum + 1), "<>W")
357356
Set tPyLineCode = $zstrip(..Lines.GetAt(i), "<>W")
358357
if (tPyLineCode '= tClassLineCode) {
359-
Set tSC = $$$ERROR($$$GeneralError,"Compiled .py code doesn't match .CLS python code ")
358+
Set tSC = $$$ERROR($$$GeneralError,"Compiled .py code doesn't match .CLS python code at line " _ $char(10,13) _ tPyLineCode)
360359
}
361360
}
362361
Do ..MethodMap.GetNext(.tMethod)

cls/TestCoverage/Utils.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,13 @@ ClassMethod CodeArrayToList(ByRef pCodeArray, Output pDocumentText As %List)
441441
/// returns a python tuple of (line to method info, method map info)
442442
/// linetomethodinfo: a python builtins list where the item at index i is the name of the method that line i is a part of
443443
/// methodmapinfo: a python builtins dict with key = method name, value = the line number of its definition
444-
ClassMethod GetPythonMethodMapping(pDocumentText, ClassName) [ Language = python ]
444+
ClassMethod GetPythonMethodMapping(pDocumentText) [ Language = python ]
445445
{
446446
import iris
447447
import ast
448448
source_lines = iris.cls('%SYS.Python').ToList(pDocumentText)
449449
source_lines = [line + "\n" for line in source_lines] # contains a list of each line of the source code
450450

451-
class_name = ClassName
452451
source = ''.join(source_lines)
453452
tree = ast.parse(source)
454453
line_function_map = [None] * (len(source_lines)+2)
@@ -480,6 +479,7 @@ ClassMethod GetPythonMethodMapping(pDocumentText, ClassName) [ Language = python
480479
if self.outermost_function == node.name:
481480
self.outermost_function = None
482481

482+
# preprocessing the ending line number for each function
483483
tree_with_line_numbers = ast.increment_lineno(tree, n=1)
484484
for node in ast.walk(tree_with_line_numbers):
485485
if isinstance(node, ast.FunctionDef):

cls/TestCoverage/Utils/LineByLineMonitor.cls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ ClassMethod PyStartWithScope(pCoverageClasses As %List) [ Language = python ]
6565
# extracts frame code
6666
code = frame.f_code
6767
# extracts calling function name and the class that the function is in
68-
func_name = code.co_name
6968
class_name = frame.f_globals['__name__']
7069
# extracts the line number
7170
line_no = frame.f_lineno

0 commit comments

Comments
 (0)