def insert_arc(self, arc, context): x_arc = x(context.points[arc.pid]) new_node = BreakPointNode(arc=arc) if self.left is None: self.left = new_node else: previous_arc_node = self.find_arc(x_arc, context) left_arc_node, right_arc_node = previous_arc_node.split() if previous_arc_node is self.left: self.left = left_arc_node br_left = BreakPointNode(left=left_arc_node, right=new_node) br_right = BreakPointNode(left=new_node, right=right_arc_node) left_arc_node.right_node = br_left left_arc_node.left_node = previous_arc_node.left_node new_node.left_node = br_left new_node.right_node = br_right right_arc_node.left_node = br_right right_arc_node.right_node = previous_arc_node.right_node try: previous_arc_node.left_node.right_node = left_arc_node except: pass try: previous_arc_node.right_node.left_node = right_arc_node except: pass return new_node
def plot(self, context, x_min, x_max): xes = np.linspace(x_min, x_max, 200) point = context.points[self.pid] try: if y(point) == context.line: plt.axvline(x(point)) else: a, b, c = compute_coefs(point, context.line) yes = xes**2 * a + xes * b + c plt.plot(xes, yes, alpha=0.5) except: pass
def insert_arc(self, arc, context): x_arc = x(context.points[arc.pid]) arc_node = self.find_arc_node(x_arc, context) intersecting_arc = arc_node.arc left_br = BreakPoint(intersecting_arc, arc) right_br_node = BreakPointNode( breakpoint=BreakPoint(arc, intersecting_arc)) arc_node.arc = None arc_node.breakpoint = left_br arc_node.left_node = BreakPointNode(arc=intersecting_arc) arc_node.right_node = right_br_node right_br_node.left_node = arc right_br_node.right_node = intersecting_arc
def __init__(self, left, middle, right, context): self.left = left self.middle = middle self.right = right if self.middle.arc.die_event is not None: self.middle.arc.die_event.abort_event() self.center = np.zeros(2, dtype='float64') a, b, c = (context.points[self.left.arc.pid], context.points[self.middle.arc.pid], context.points[self.right.arc.pid]) self.center, self.radius = circle_from_points(a, b, c) wrong_turn = ((x(b) - x(a)) * (y(c) - y(a)) - (x(c) - x(a)) * (y(b) - y(a)) <= 0) self.aborted = self.radius < 0 or wrong_turn if not self.aborted: # self.middle.arc.die_event.abort_event() # self.middle.arc.die_event = self print("----------AFTER", self.middle.arc, id(self.middle.arc), self.middle.arc.die_event)
def save(self): self.xnomo = x(self.nomo) super(Lando, self).save()
# print_header("3.1 Set Daemon umask (Scored)") check_equal("grep umask /etc/sysconfig/init", "umask 027") # print_header("3.2 Remove X Windows (Scored)") # Original CIS test # check_equal( # 'grep "^id:" /etc/inittab', # "id:3:initdefault" # ) # Syco hardened servers use this. check_equal('grep "^\~\~\:S\:wait\:\/sbin\/sulogin" /etc/inittab', "~~:S:wait:/sbin/sulogin") result = x('yum grouplist "X Window System"') max_lines = len(result) assert_contains(result[max_lines - 3], "Available Groups:") assert_contains(result[max_lines - 2], " X Window System") assert_contains(result[max_lines - 1], "Done") # print_header("3.3 Disable Avahi Server (Scored)") check_equal("rpm -q avahi", "package avahi is not installed") check_empty("chkconfig --list | grep avahi") # print_header("3.4 Disable Print Server - CUPS (Not Scored)") check_equal("rpm -q cups", "package cups is not installed") check_empty("chkconfig --list | grep cups")
def __gt__(self, other): return x(self.center) > x(other.center)
) # print_header("3.2 Remove X Windows (Scored)") # Original CIS test # check_equal( # 'grep "^id:" /etc/inittab', # "id:3:initdefault" # ) # Syco hardened servers use this. check_equal( 'grep "^\~\~\:S\:wait\:\/sbin\/sulogin" /etc/inittab', "~~:S:wait:/sbin/sulogin" ) result = x('yum grouplist "X Window System"') max_lines = len(result) assert_contains(result[max_lines-3], "Available Groups:") assert_contains(result[max_lines-2], " X Window System") assert_contains(result[max_lines-1], "Done") # print_header("3.3 Disable Avahi Server (Scored)") check_equal( "rpm -q avahi", "package avahi is not installed" ) check_empty("chkconfig --list | grep avahi") # print_header("3.4 Disable Print Server - CUPS (Not Scored)")