Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Azure
GitHub Repository: Azure/Azure-Sentinel-Notebooks
Path: blob/master/scenario-notebooks/UserSecurityMetadata/NodeEdge.py
3253 views
1
# -------------------------------------------------------------------------
2
# Copyright (c) Microsoft Corporation. All rights reserved.
3
# Licensed under the MIT License. See License.txt in the project root for
4
# license information.
5
# --------------------------------------------------------------------------
6
from abc import ABC, abstractmethod
7
8
9
class Node:
10
def __init__(self, id, label, group):
11
self.id = id
12
self.label = label
13
self.group = group
14
15
def __eq__(self, other):
16
return self.id == other.id
17
18
def __hash__(self):
19
return hash(self.id)
20
21
22
class DrawableNode(ABC):
23
def __init__(self):
24
super().__init__()
25
26
@abstractmethod
27
def getNode(self):
28
pass
29
30
31
class Edge:
32
def __init__(self, from_, to, label):
33
self.from_ = from_
34
self.to = to
35
self.label = label
36
37
def __eq__(self, other):
38
return self.from_ == other.from_ and self.to == other.to and self.label == other.label
39
40
def __hash__(self):
41
return hash(self.from_ + self.to + self.label)
42
43