def __init__(self, url=None, session_id=None): self.json_net = None self.warnings = [] self.files = [] self.template = None self.attributes = [] self.attr_name_map = {} self.nodes = {} self.links = {} self.groups = {} self.node_id = PluginLib.temp_ids() self.link_id = PluginLib.temp_ids() self.group_id = PluginLib.temp_ids() self.connection = JsonConnection(url) if session_id is not None: write_output("Using existing session %s" % session_id) self.connection.session_id = session_id else: self.connection.login() #3 steps: start, read, save self.num_steps = 3
def __init__(self, url=None, session_id=None): #Record the names of the files created by the plugin so we can #display them to the user. self.files = [] #A mapping from attr ID to attr object. Makes searching for attributes #easier self.attr_id_map = {} self.connection = JsonConnection(url) write_output("Connecting...") if session_id is not None: write_output("Using existing session %s"% session_id) self.connection.session_id=session_id else: self.connection.login() #Dictionaries, keyed on their name, where all the nodes, links & groups will go self.hydra_nodes = {} self.hydra_links = {} self.hydra_groups = {} self.hydra_group_members = {} #Generators of NEGATIVE IDS for the nodes & links. #Negative IDS are used as temporary client-side IDS until the network #is saved, at which point the resources will be given permanent, positive IDS. self.node_ids = temp_ids() self.link_ids = temp_ids() self.group_ids = temp_ids() # A group is an institution. #A mapping from the name of a type to the type itself. self.type_name_map = {} self.num_steps = 3
def __init__(self, url=None, session_id=None): #Record the names of the files created by the plugin so we can #display them to the user. self.files = [] #A mapping from attr ID to attr object. Makes searching for attributes #easier self.attr_id_map = {} self.connection = JsonConnection(url) write_output("Connecting...") if session_id is not None: write_output("Using existing session %s" % session_id) self.connection.session_id = session_id else: self.connection.login() self.network = None self.num_steps = 3
def __init__(self, vars, objs, actual_time_steps, url=None, session_id=None): self.vars = vars self.objs = objs self.actual_time_steps = actual_time_steps self.network_id = None self.scenario_id = None self.network = None self.res_scenario = None self.connection = JsonConnection(url) self.attrs = dict() self.time_axis = dict() if session_id is not None: log.info("Using existing session %s", session_id) self.connection.session_id = session_id else: self.connection.login()