コード例 #1
0
	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)
コード例 #2
0
ファイル: bulkloader.py プロジェクト: Flux7Labs/ccm
 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)
コード例 #3
0
ファイル: container.py プロジェクト: imitablerabbit/woof-tile
    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)
コード例 #4
0
ファイル: network.py プロジェクト: juancq/character-evolver
 def __init__(self):
     Node.__init__(self, -1)
     self.nodes = {}
     self.connections = {}
     self.index = 0
     self.tnodes = {}
     self.doprop = True
コード例 #5
0
ファイル: environment.py プロジェクト: jvasilakes/farm-game
    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)
コード例 #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)
コード例 #7
0
ファイル: core.py プロジェクト: jggatc/nexus
 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
コード例 #8
0
ファイル: edge.py プロジェクト: matyukhin/Graphs
 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")
コード例 #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])
コード例 #10
0
ファイル: serverproxy.py プロジェクト: onze/goLive
 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.")
コード例 #11
0
ファイル: core.py プロジェクト: jggatc/nexus
 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
コード例 #12
0
 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)]
コード例 #13
0
 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()
コード例 #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)
コード例 #15
0
ファイル: site.py プロジェクト: cboling-zz/SDNdbg
    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)
コード例 #16
0
 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()
コード例 #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()
コード例 #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()
コード例 #19
0
ファイル: cave_system.py プロジェクト: jvasilakes/farm-game
    def __init__(self, Ystart, Xstart, graphics_file, space):

	self.name = 'Room'

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

	self.doors = {}
	self.find_doors()
コード例 #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 = {}
コード例 #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
コード例 #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)
コード例 #23
0
ファイル: router.py プロジェクト: sssundar/NetworkSimulator
	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
コード例 #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)
コード例 #25
0
ファイル: login_node.py プロジェクト: iLtc/HRMS
    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)
コード例 #26
0
	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()
コード例 #27
0
    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
コード例 #28
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]
コード例 #29
0
ファイル: environment.py プロジェクト: jvasilakes/farm-game
    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
コード例 #30
0
ファイル: consumer.py プロジェクト: p0llx/Edge_Cache_Sim
    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
コード例 #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]
コード例 #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
コード例 #33
0
 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'
コード例 #34
0
ファイル: environment.py プロジェクト: jvasilakes/farm-game
    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)
コード例 #35
0
ファイル: cclass.py プロジェクト: rlofc/cldoc
    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 = {}
コード例 #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
コード例 #37
0
ファイル: ctype.py プロジェクト: rlofc/cldoc
    def __init__(self, tp):
        Node.__init__(self, None, None)

        self.tp = tp

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

        self.extract(tp)
コード例 #38
0
	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"
コード例 #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)
コード例 #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)
コード例 #41
0
ファイル: room.py プロジェクト: elebumm/PythonTextAdventure
 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
コード例 #42
0
ファイル: environment.py プロジェクト: jvasilakes/farm-game
    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)
コード例 #43
0
ファイル: gionode.py プロジェクト: rjw57/wood
	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
コード例 #44
0
ファイル: environment.py プロジェクト: jvasilakes/farm-game
    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)
コード例 #45
0
ファイル: central_server.py プロジェクト: iLtc/HRMS
    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 = {}
コード例 #46
0
ファイル: transformNode.py プロジェクト: acarl123/wxPython
 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        
コード例 #47
0
ファイル: payroll_node.py プロジェクト: iLtc/HRMS
    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)
コード例 #48
0
ファイル: environment.py プロジェクト: jvasilakes/farm-game
    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)])
コード例 #49
0
ファイル: transformNode.py プロジェクト: wangdyna/wxPython
 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
コード例 #50
0
ファイル: workspace.py プロジェクト: imitablerabbit/woof-tile
    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
コード例 #51
0
ファイル: collection.py プロジェクト: uxvworks/matlab2cpp
    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)
コード例 #52
0
ファイル: function.py プロジェクト: rlofc/cldoc
    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))
コード例 #53
0
ファイル: cave_system.py プロジェクト: jvasilakes/farm-game
    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)
コード例 #54
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))
コード例 #55
0
ファイル: player.py プロジェクト: onze/goLive
	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}})
コード例 #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)
コード例 #57
0
    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