text
stringlengths
1
93.6k
The following would not be a correct use:
x,y = new_conditional_graph_set(a,c)
Variables:
graph_set is a graph-set generator
condition_list is a list of first order functions returning boolean values when passed a graph.
"""
try:
condition_list[0]
except TypeError:
raise TypeError("""
Subsampling from a graph requires passing in a list of conditions encoded
as first-class functions that accept networkX graphs as an input and return boolean values.""")
graph_set_newer, graph_set_test = tee(graph_set,2)
def gen():
for G in graph_set_test:
G_test = G.copy()
if all([c(G_test) for c in condition_list]):
yield G_test
return graph_set_newer, gen()
# def add_edge_attribute(graph,edge,attribute_name,attribute_value):
# graph[edge[0]][edge[1]][attribute_name]=attribute_value
# pass
# def add_multiple_edge_attributes(graph,edge_list,attribute_name,attribute_value):
# for edge in edge_list:
# add_edge_attribute(graph,edge,attribute_name,attribute_value)
# pass
# def add_gamma_attribute_values(graph,edge_list,base_rate,scale):
# pass
# <FILESEP>
#!/usr/bin/env python3
# coding: utf-8
import time
import json
from js8net import *
import argparse
# Main program.
if __name__ == "__main__":
parser=argparse.ArgumentParser(description='Test Script')
parser.add_argument('--js8-host',default=False,help='IP/DNS of JS8Call server (default localhost)')
parser.add_argument('--js8-port',default=False,help='TCP port of JS8Call server (default 2442)')
parser.add_argument("--fill-time",default=False,help="How far back to fill in (default 600 seconds)")
parser.add_argument("--sleep-time",default=False,help="How long to sleep between requests (default 120 seconds)")
parser.add_argument("--freq-audio",default=False,help="Specify transmit offset freq (hz, ex: 1000)")
args=parser.parse_args()
js8host=False
js8port=False
if(args.js8_host):
js8host=args.js8_host
else:
js8host='localhost'
if(args.js8_port):
js8port=int(args.js8_port)
else:
js8port=2442
if(args.fill_time):
filltime=int(args.fill_time)
else:
filltime=600
if(args.sleep_time):
sleeptime=int(args.sleep_time)
else:
sleeptime=120
flag=False
start_net(js8host,js8port)
print("Connected.")
if(args.freq_audio):
f=get_freq()
print(f)
set_freq(f['dial'],int(args.freq_audio))
stuff=get_call_activity()
print("Missing grids:")
for s in stuff:
if(not(s.grid) and s.age()<=filltime):
print(s.call)
print("")
for s in stuff:
if(not(s.grid) and s.age()<=filltime):
print("Requesting grid from "+s.call)
query_grid(s.call)
time.sleep(sleeptime)
flag=True