Skip to content

Commit

Permalink
Fix few codacy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nirizr committed Jun 5, 2018
1 parent 7b288fe commit 144db3b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions idaplugin/rematch/collectors/annotations/comment.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
import ida_gdl
import ida_funcs
import ida_lines
import ida_bytes
import idautils

from . import annotation


class CommentAnnotation(annotation.Annotation):
@staticmethod
def data(offset):
func = ida_funcs.get_func(offset)
def data(self):
func = ida_funcs.get_func(self.offset)

comments = {ea - offset: self.get_comment(ea)
comments = {ea - self.offset: self.get_comment(ea)
for ea in idautils.Heads(func.startEA, func.endEA)}
return comments

@staticmethod
def get_comment(self, ea):
raise NotImplementedError("get_comment method not implemented")


def RegularCommentAnnotation(CommentAnnotation):
class RegularCommentAnnotation(CommentAnnotation):
@staticmethod
def get_comment(ea):
return ida_bytes.get_cmt(ea, 0)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def node_contained(node):
for succ in node.succs()
if succ.id in node_ids]
serialized_node = {'id': node.id, 'start': node.startEA,
'end': node.endEA,'successive': successive_nodes,
'end': node.endEA, 'successive': successive_nodes,
'assembly': assembly}
nodes_data.append(serialized_node)

Expand Down
2 changes: 1 addition & 1 deletion idaplugin/rematch/instances/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, *args, **kwargs):
collectors.vectors.MnemonicHashVector,
collectors.vectors.MnemonicHistVector,
collectors.vectors.BasicBlockSizeHistVector}
self.annotations |= {collectors.annotations.AssemblyAnnotation}
self.annotations |= {collectors.annotations.AssemblyAnnotation,
collectors.annotations.PositionalAnnotation,
collectors.annotations.RegularCommentAnnotation}

Expand Down

0 comments on commit 144db3b

Please sign in to comment.