def __init__(self, tp, first=None, second=None):  
		Node.__init__(self)
		self.type = tp
		if first is not None: 
			self.set_left_child(first)
		if second is not None: 
			self.set_right_child(second)
Beispiel #2
0
 def __init__(self, cluster):
     # A lot of things are wrong in that method. It assumes that the ip
     # 127.0.0.<nbnode> is free and use standard ports without asking.
     # It should problably be fixed, but will be good enough for now.
     addr = '127.0.0.%d' % (len(cluster.nodes) + 1)
     self.path = tempfile.mkdtemp(prefix='bulkloader-')
     Node.__init__(self, 'bulkloader', cluster, False, (addr, 9160), (addr, 7000), str(9042), 2000, None)
Beispiel #3
0
    def __init__(self, window_id, woof_id):
        Node.__init__(self, 0)  # This is barely a node at all

        self.window_id = window_id
        self.woof_id = woof_id
        self.state = WINDOW_STATE.NORMAL
        self.window_class = system_calls.get_window_class(self.window_id)
Beispiel #4
0
 def __init__(self):
     Node.__init__(self, -1)
     self.nodes = {}
     self.connections = {}
     self.index = 0
     self.tnodes = {}
     self.doprop = True
Beispiel #5
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Pond'

	Node.__init__(self, Ystart, Xstart, graphics_file, space)

	self.vicinity = find_vicinity(self.boundaries)
Beispiel #6
0
 def __init__(self):
     # The base class constructor has to run to set all
     # the properties here.
     #
     # The most important property on an Input is value.
     # self.value is set during `topological_sort` later.
     Node.__init__(self)
Beispiel #7
0
 def __init__(self, matrix, x, y, identity):
     Node.__init__(self, matrix, x, y, identity)
     self.name = 'Nexus'
     self.images['operational'] = self.images['node_operational']
     self.images['damaged'] = self.images['node_damaged']
     self.images['failed'] = self.images['node_failed']
     self.image = self.images['operational']
     self.rect = self.image.get_rect(center=(int(self.x),int(self.y)))
     self.radius = (self.image.get_width()//2)
     self.sound = {}
     self.sound['bootup'] = load_sound('powerup.wav')
     self.sound['bootup'].set_volume(0.3)
     self.matrix.node_update(self)
     self.initiation = False
     self.initiate = False
     self.init_count = 3
     self.aware = False
     self.data_type = ['noncorrupt','corrupt']
     self.data_process = 0
     self.data_corruption = 0
     self.data_integration = 0
     self.data_integration_top = 0
     self.integrity_high_color = engine.Color(80,100,220)
     self.integrity_low_color = engine.Color(180,50,50)
     self.integrity_loss = -0.001
     self.integrity = 1.0
     self.count = 10
Beispiel #8
0
 def __init__(self, start, end):
     Node.__init__(self)
     self.start = start
     self.end = end
     self.outter = False
     self.inverse = None
     logger.info("the edge has been created")
Beispiel #9
0
 def __init__(self, y, a):
     """
     The mean squared error cost function.
     Should be used as the last node for a network.
     """
     # Call the base class' constructor.
     Node.__init__(self, [y, a])
Beispiel #10
0
 def __init__(self):
     self.launch_local_server(ip, port)
     self.buf = ""
     self.connect_to_server(ip, port)
     Node.__init__(self, self.socket)
     network.serverproxy = self
     out("proxy connected.")
Beispiel #11
0
 def __init__(self, matrix, x, y, identity):
     Node.__init__(self, matrix, x, y, identity)
     self.name = 'Nexus'
     self.images['operational'] = self.images['node_operational']
     self.images['damaged'] = self.images['node_damaged']
     self.images['failed'] = self.images['node_failed']
     self.image = self.images['operational']
     self.rect = self.image.get_rect(center=(int(self.x), int(self.y)))
     self.radius = (self.image.get_width() // 2)
     self.sound = {}
     self.sound['bootup'] = load_sound('powerup.wav')
     self.sound['bootup'].set_volume(0.3)
     self.matrix.node_update(self)
     self.initiation = False
     self.initiate = False
     self.init_count = 3
     self.aware = False
     self.data_type = ['noncorrupt', 'corrupt']
     self.data_process = 0
     self.data_corruption = 0
     self.data_integration = 0
     self.data_integration_top = 0
     self.integrity_high_color = engine.Color(80, 100, 220)
     self.integrity_low_color = engine.Color(180, 50, 50)
     self.integrity_loss = -0.001
     self.integrity = 1.0
     self.count = 10
 def __init__(self, name, description, width, height):
     Node.__init__(self, name, description)
     
     self.width = width if width >= 0 else -width
     self.height = height if height >= 0 else -height
         
     self.map_grid = [[False]*self.height for row in range(self.width)]
 def __init__(self):
     duckiebot = rospy.get_param('localization/duckiebot')
     Node.__init__(self, duckiebot, "localization")
     # Initialize tf listener and pose/trajectory publisher.
     self.tf_listener = tf.TransformListener()
     topic = str("/" + duckiebot + "/intnav/pose")
     self.pose_pub = rospy.Publisher(topic,
                                     PoseWithCovarianceStamped,
                                     queue_size=1)
     topic = str("/" + duckiebot + "/intnav/trajectory")
     self.traj_pub = rospy.Publisher(topic, Path, queue_size=1)
     self.traj = Path()
     # Initialize control input subscriber.
     topic = str("/" + duckiebot + "/joy_mapper_node/car_cmd")
     self.vel_sub = rospy.Subscriber(topic, Twist2DStamped,
                                     self.control_callback)
     topic = str("/" + duckiebot + "/intnav/direction")
     self.direction_sub = rospy.Subscriber(topic, String,
                                           self.direction_callback)
     # Initialize april pose subscriber - Low-frequent update.
     self.tag_sub = rospy.Subscriber("/tag_detections",
                                     AprilTagDetectionArray,
                                     self.tag_callback)
     # Initialize april tag id subscriber (that are taken into account
     # for localization).
     topic = str("/" + duckiebot + "/intnav/tagids")
     self.tagid_sub = rospy.Subscriber(topic, Int16MultiArray,
                                       self.tagid_callback)
     rospy.spin()
Beispiel #14
0
    def __init__(self, **kwargs):
        Node.__init__(self, 1)

        self.name = kwargs.get('name', 'unnamed')
        self.geometry = kwargs.get('geometry', None)
        self.state = kwargs.get('state', SCREEN_STATE.INACTIVE)
        self.last_active_window_id = kwargs.get('last_active_window_id', None)
Beispiel #15
0
    def __init__(self, **kwargs):
        logging.debug('Site.__init__: args:\n{}'.format(
            pprint.PrettyPrinter().pformat(kwargs)))

        # No VIMs/NFV infrastructure or SDN controllers yet.  Will populate during discovery

        Node.__init__(self, **kwargs)
 def __init__(self):
     duckiebot = rospy.get_param('april_activator/duckiebot')
     self.switch_pub = rospy.Publisher('apriltag_detector_node/switch',
                                       BoolStamped,
                                       queue_size=1)
     Node.__init__(self, duckiebot, "april_activator")
     rospy.spin()
Beispiel #17
0
 def __init__(self):
     duckiebot = rospy.get_param('interface/duckiebot')
     Node.__init__(self, duckiebot, "interface")
     # Initialize intersection type publisher and hard set the type.
     topic = str("/" + duckiebot + "/intnav/type")
     self.itype_pub = rospy.Publisher(topic, String, queue_size=1)
     # Initialize direction publisher.
     topic = str("/" + duckiebot + "/intnav/direction")
     self.direction_pub = rospy.Publisher(topic, String, queue_size=1)
     # Start timer.
     self.timer = rospy.Timer(rospy.Duration(0.5), self.timer_callback)
     # Initialize pose callback to switch back to lane following
     # as well as state & lane following switch.
     topic = str("/" + duckiebot + "/intnav/pose")
     self.pose_sub = rospy.Subscriber(topic, PoseWithCovarianceStamped,
                                      self.pose_callback)
     topic = str("/" + duckiebot + "/lane_controller_node/switch")
     self.lc_switch_pub = rospy.Publisher(topic, BoolStamped, queue_size=1)
     topic = str("/" + duckiebot + "/intnav/switch")
     self.int_switch_pub = rospy.Publisher(topic, Bool, queue_size=1)
     topic = str("/" + duckiebot + "/fsm_node/mode")
     self.fsm_pub = rospy.Publisher(topic, FSMState, queue_size=1)
     self.tag_sub = rospy.Subscriber("/tag_detections",
                                     AprilTagDetectionArray,
                                     self.tag_callback)
     # publish apriltag IDs to be detected
     topic = str("/" + duckiebot + "/intnav/tagids")
     self.tagid_pub = rospy.Publisher(topic, Int16MultiArray, queue_size=1)
     rospy.spin()
Beispiel #18
0
 def __init__(self, x, y, nodes_per_dim, dimensions):
     Node.__init__(self, dimensions)
     self.x = x
     self.y = y
     self.nodes_per_dim = nodes_per_dim
     self.labels_history = 20
     self.current_label_index = 0
     self.reset_labels()
Beispiel #19
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Room'

	Node.__init__(self, Ystart, Xstart, graphics_file, space)

	self.doors = {}
	self.find_doors()
Beispiel #20
0
    def __init__(self, cursor, comment):
        Node.__init__(self, cursor, comment)

        self.process_children = True
        self.current_access = cindex.CXXAccessSpecifier.PRIVATE
        self.bases = []
        self.subclasses = []
        self.name_to_method = {}
Beispiel #21
0
    def __init__(self, is_start, port):
        Node.__init__(self)
        self.port = port
        self.communicator_socket = None
        self.is_start = is_start

        self.next_port = None
        self.next_ip = None
Beispiel #22
0
 def __init__(self, cluster):
     # A lot of things are wrong in that method. It assumes that the ip
     # 127.0.0.<nbnode> is free and use standard ports without asking.
     # It should problably be fixed, but will be good enough for now.
     addr = '127.0.0.%d' % (len(cluster.nodes) + 1)
     self.path = tempfile.mkdtemp(prefix='bulkloader-')
     Node.__init__(self, 'bulkloader', cluster, False, (addr, 9160),
                   (addr, 7000), str(9042), 2000, None)
Beispiel #23
0
	def __init__(self, identity, links):
		Node.__init__(self, identity)				
		self.link = links
		self.current = {}	# Current Routing table
		self.new = {}		# Routing table under construction	
		self.itr = 0
		self.host_array = []
		self.no_change = 0
Beispiel #24
0
    def __init__(self, parent, pos, w, h, color=Color.BLACK, refresh=True):

        Node.__init__(self, parent, pos)

        self.w = w
        self.h = h
        self.color = color

        self.display_surface = self.init_display_surface(color, refresh)
Beispiel #25
0
    def __init__(self, max_peers, server_port):
        Node.__init__(self, max_peers, server_port, 'LOGIN', node_desc='Handle User Login and Logout')

        self.debug = True

        self.addhandler('LOGI', self.__handle_login)
        self.addhandler('PASS', self.__handle_change_password)
        self.addhandler('PASU', self.__handle_change_password_user)
        self.addhandler('LOGO', self.__handle_logout)
	def __init__(self,config):
		Node.__init__(self , config)
		self.previous_cp_time = -1

		if self.name + ".log" in os.listdir("."):
			self.recover()

		self.regulator = threading.Thread(target=self.regulate_cp , args=())
		self.regulator.start()
    def __init__(self, name, description, width, height):
        Node.__init__(self, name, description)

        self.width = width
        self.height = height
        self.entrance = None

        self.floor_matrix = [[False] * self.height for row in range(self.width)]
        self.goal_complete = False
    def __init__(self, name, description, creature_type, health, armors):
        Node.__init__(self, name, description)
        self.creature_type = creature_type

        self.health = health

        self.armor = armors[0]
        self.resist_tarnish = armors[1]
        self.resist_environment = armors[2]
Beispiel #29
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Rock'

	Node.__init__(self, Ystart, Xstart, graphics_file, space)

	self.vicinity = find_vicinity(self.boundaries)

	self.resource_qty = 1
Beispiel #30
0
    def __init__(self, name, memorySize, totalPower, processingPowerUnit,
                 transmissionPowerUnit, arch):

        Node.__init__(self, name, memorySize, totalPower, processingPowerUnit,
                      transmissionPowerUnit, arch)
        self.interestName = name.split(':')[1]

        self.totalWaitingTime = 0
        self.numberOfresponses = 0
Beispiel #31
0
    def __init__(self, name, description, creature_type, health, armors):
        Node.__init__(self, name, description)
        self.creature_type = creature_type

        self.health = health

        self.armor = armors[0]
        self.resist_tarnish = armors[1]
        self.resist_environment = armors[2]
Beispiel #32
0
 def __init__(self, name, cpu_id):
     """
     name: name of the node, can be any arbitrary string
     cpu_id: the integer id of the CPU that this Node should be running on
     """
     Node.__init__(self, name)
     self.cpu_id = cpu_id
     self.is_cpu = True
     self.is_gpu = False
 def __init__(self, v): 
     Node.__init__(self)
     # tries to parse v as a float. If it doesn't work, then it's a function. 
     try:
         self.value = float(v)
     except ValueError: 
         self.value = None
         self.left_child = Function_Call(v, None)
     self.type = 'Double'
Beispiel #34
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Bush'

	Node.__init__(self, Ystart, Xstart, graphics_file, space)

	self.vicinity = find_vicinity(self.boundaries)

	random.seed()
	self.resource_qty = random.randint(0, 2)
Beispiel #35
0
    def __init__(self, cursor, comment):
        Node.__init__(self, cursor, comment)

        self.process_children = True
        self.current_access = cindex.CXXAccessSpecifier.PRIVATE
        self.bases = []
        self.implements = []
        self.implemented_by = []
        self.subclasses = []
        self.name_to_method = {}
Beispiel #36
0
 def __init__(self, upstreamLinks, downstreamLinks, priority):
     if len(upstreamLinks) < 1 or len(downstreamLinks) != 1:
         raise WrongNodeTypeException
     Node.__init__(self, upstreamLinks, downstreamLinks)
     self.priority = priority
     if min(priority.values()) <= 0:
         print(
             "Merge nodes must have strictly positive priority values for incoming links."
         )
         raise WrongNodeTypeException
Beispiel #37
0
    def __init__(self, tp):
        Node.__init__(self, None, None)

        self.tp = tp

        self._qualifier = []
        self._declared = None
        self._builtin = False

        self.extract(tp)
	def __init__(self, var):  
		Node.__init__(self)
		if isinstance(var, float):
			self.string_value = None
			self.left_child = Double_Node(var)
			self.type = "ReturnStmt"
		else: 
			if isinstance(var, str): 
				self.string_value = var 
				self.type = "ReturnStmt"
Beispiel #39
0
    def __init__(self, **kwargs):
        Node.__init__(self, 0)  # This is barely a node at all

        self.window_id = kwargs.get('window_id', None)
        self.woof_id = kwargs.get('woof_id', None)
        self.state = kwargs.get('state', WINDOW_STATE.NORMAL)
        if 'window_class' in kwargs:
            self.window_class = kwargs.get('window_class')
        else:
            self.window_class = system_calls.get_window_class(self.window_id)
Beispiel #40
0
    def __init__(self, tp):
        Node.__init__(self, None, None)

        self.tp = tp

        self._qualifier = []
        self._declared = None
        self._builtin = False

        self.extract(tp)
Beispiel #41
0
 def __init__(self, name, description, exits=''):
     Node.__init__(self, name, description)
     self.children = {
         'creatures': [],
         'pickups': [],
         'features': []
     }
     
     self.exits = exits ## perhaps make a 'auto_generate_exits' method
     self.coordinate = None
Beispiel #42
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Crop'

	# Stage of growth out of 3
        self.stage = 1

	self.value = 5

	Node.__init__(self, Ystart, Xstart, graphics_file, space)
Beispiel #43
0
	def __init__(self, file, parent = None):
		Node.__init__(self, parent)
		self.file_ = file
		self.file_info_ = self.file_.query_info(','.join([
			gio.FILE_ATTRIBUTE_STANDARD_TYPE,
			gio.FILE_ATTRIBUTE_STANDARD_NAME,
			gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
			gio.FILE_ATTRIBUTE_STANDARD_ICON,
			gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
		]))
		self.children_ = None
Beispiel #44
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Shipbox'

	self.inventory = Inventory(self.name)

	Node.__init__(self, Ystart, Xstart, graphics_file, space)

	self.visible = True

	self.vicinity = find_vicinity(self.boundaries)
Beispiel #45
0
    def __init__(self, max_peers, server_port):
        Node.__init__(self, max_peers, server_port, 'CENTRAL_SERVER', 9999)

        self.debug = True

        self.addhandler("REGE", self.__handle_register)
        self.addhandler("UNRE", self.__handle_unregister)
        self.addhandler("LNOD", self.__handle_list_node)

        self.node_index = 0
        self.available_nodes = {}
Beispiel #46
0
 def __init__(self, transform, name = '', parent = None, children = []):
     #try:
     #    transform = keys['transform']
     #except KeyError:
     #    self.transform = LinearTransform2D()
     #else:
     #    self.transform = transform
     #    del keys['transform']
     #    
     Node.__init__(self, name, parent, children)
     self.transform = transform        
Beispiel #47
0
    def __init__(self, max_peers, server_port):
        Node.__init__(self,
                      max_peers,
                      server_port,
                      'PAYROLL',
                      node_desc='Handle User Payroll')

        self.debug = True

        self.addhandler('PAYS', self.__handle_payslips)
        self.addhandler('MODE', self.__handle_model)
Beispiel #48
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'House'

	Node.__init__(self, Ystart, Xstart, graphics_file, space)

	# Visible from the start
	self.visible = True

	# Location of the front door
	self.vicinity.append([(Ystart + 5), (Xstart + 5)])
Beispiel #49
0
 def __init__(self, transform, name='', parent=None, children=[]):
     #try:
     #    transform = keys['transform']
     #except KeyError:
     #    self.transform = LinearTransform2D()
     #else:
     #    self.transform = transform
     #    del keys['transform']
     #
     Node.__init__(self, name, parent, children)
     self.transform = transform
Beispiel #50
0
    def __init__(self,
                 tree_manager,
                 name,
                 geometry=None,
                 state=SCREEN_STATE.INACTIVE):
        Node.__init__(self, 1)
        Node.set_parent(self, tree_manager)

        self.name = name
        self.geometry = geometry
        self.state = state
        self.last_active_window_id = None
Beispiel #51
0
    def __init__(self, parent, name, **kws):
        """
Represents one stand-alone script or program. Each child represents the various
aspects of script/program.

Children:
    `Includes Funcs Inlines Structs Headers Log`

All keyword arguments are passed to `mc.Node.__init__`.
    """
        self._program = self
        Node.__init__(self, parent, name=name, **kws)
Beispiel #52
0
    def __init__(self, cursor, comment):
        Node.__init__(self, cursor, comment)

        self._return_type = Type(self.cursor.type.get_result())

        self._arguments = []

        for child in cursor.get_children():
            if child.kind != cindex.CursorKind.PARM_DECL:
                continue

            self._arguments.append(Argument(self, child))
Beispiel #53
0
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Entrance'

	Node.__init__(self, Ystart, Xstart, graphics_file, space)

	self.doors = {'exit': [Ystart + 4, Xstart + 2]}

	self.vicinity = [[Ystart + 1, Xstart + 2]]

	# Make sure the entrance is the first passed to Astar pathfinder
	self.space.contents['Room'].insert(0, self)
    def __init__(self, cursor, comment):
        Node.__init__(self, cursor, comment)

        self._return_type = Type(self.cursor.type.get_result())

        self._arguments = []

        for child in cursor.get_children():
            if child.kind != cindex.CursorKind.PARM_DECL:
                continue

            self._arguments.append(Argument(self, child))
Beispiel #55
0
	def __init__(self,socket,address,pid,server):
		self.pid=pid
		Player.instances[self.pid]=self
		Node.__init__(self,socket)
		self.socket.setblocking(0)
		self.address=address
		self.buf=''
		self.server=server
		self.server.update_list.append(self.update)
		#sum of tiles under player control
		self.owned_tiles=0
		self.send({network.stc_pid_setup:{'pid':self.pid}})
Beispiel #56
0
    def __init__(self, parent, name, **kws):
        """
Represents one stand-alone script or program. Each child represents the various
aspects of script/program.

Children:
    `Includes Funcs Inlines Structs Headers Log`

All keyword arguments are passed to `mc.Node.__init__`.
    """
        self._program = self
        Node.__init__(self, parent, name=name, **kws)
    def __init__(self,
                 enc_mode=defs.ENC_MODE_DEFAULT,
                 max_buf_size=defs.MAX_MSG_BUF,
                 data_size=defs.DEFAULT_DATA_SIZE):

        Node.__init__(self,
                      enc_mode=enc_mode,
                      data_size=data_size,
                      max_buf_size=max_buf_size)
        self.log_id = 'NodeServer'
        self.max_buf_size = max_buf_size

        return