Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sink_generator = RandomEdgeGenerator(
net, get_prob_fun(options, "_outgoing", forbidden_sink_fringe))
if options.weightsprefix:
if os.path.isfile(options.weightsprefix + SOURCE_SUFFIX):
source_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SOURCE_SUFFIX))
if os.path.isfile(options.weightsprefix + SINK_SUFFIX):
sink_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SINK_SUFFIX))
except InvalidGenerator:
print("Error: no valid edges for generating source or destination. Try using option --allow-fringe",
file=sys.stderr)
return None
try:
via_generator = RandomEdgeGenerator(
net, get_prob_fun(options, None, None))
if options.weightsprefix and os.path.isfile(options.weightsprefix + VIA_SUFFIX):
via_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + VIA_SUFFIX))
except InvalidGenerator:
if options.intermediate > 0:
print(
"Error: no valid edges for generating intermediate points", file=sys.stderr)
return None
else:
via_generator = None
return RandomTripGenerator(
source_generator, sink_generator, via_generator, options.intermediate, options.pedestrians)
def buildTripGenerator(net, options):
try:
forbidden_source_fringe = None if options.allow_fringe else "_outgoing"
forbidden_sink_fringe = None if options.allow_fringe else "_incoming"
source_generator = RandomEdgeGenerator(
net, get_prob_fun(options, "_incoming", forbidden_source_fringe))
sink_generator = RandomEdgeGenerator(
net, get_prob_fun(options, "_outgoing", forbidden_sink_fringe))
if options.weightsprefix:
if os.path.isfile(options.weightsprefix + SOURCE_SUFFIX):
source_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SOURCE_SUFFIX))
if os.path.isfile(options.weightsprefix + SINK_SUFFIX):
sink_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SINK_SUFFIX))
except InvalidGenerator:
print("Error: no valid edges for generating source or destination. Try using option --allow-fringe",
file=sys.stderr)
return None
try:
def buildTripGenerator(net, options):
try:
forbidden_source_fringe = None if options.allow_fringe else "_outgoing"
forbidden_sink_fringe = None if options.allow_fringe else "_incoming"
source_generator = RandomEdgeGenerator(
net, get_prob_fun(options, "_incoming", forbidden_source_fringe))
sink_generator = RandomEdgeGenerator(
net, get_prob_fun(options, "_outgoing", forbidden_sink_fringe))
if options.weightsprefix:
if os.path.isfile(options.weightsprefix + SOURCE_SUFFIX):
source_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SOURCE_SUFFIX))
if os.path.isfile(options.weightsprefix + SINK_SUFFIX):
sink_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SINK_SUFFIX))
except InvalidGenerator:
print("Error: no valid edges for generating source or destination. Try using option --allow-fringe",
file=sys.stderr)
return None
try:
via_generator = RandomEdgeGenerator(
net, get_prob_fun(options, None, None))
if options.weightsprefix and os.path.isfile(options.weightsprefix + VIA_SUFFIX):
via_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + VIA_SUFFIX))
except InvalidGenerator:
def buildTripGenerator(net, options):
try:
forbidden_source_fringe = None if options.allow_fringe else "_outgoing"
forbidden_sink_fringe = None if options.allow_fringe else "_incoming"
source_generator = RandomEdgeGenerator(
net, get_prob_fun(options, "_incoming", forbidden_source_fringe))
sink_generator = RandomEdgeGenerator(
net, get_prob_fun(options, "_outgoing", forbidden_sink_fringe))
if options.weightsprefix:
if os.path.isfile(options.weightsprefix + SOURCE_SUFFIX):
source_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SOURCE_SUFFIX))
if os.path.isfile(options.weightsprefix + SINK_SUFFIX):
sink_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + SINK_SUFFIX))
except InvalidGenerator:
print("Error: no valid edges for generating source or destination. Try using option --allow-fringe",
file=sys.stderr)
return None
try:
via_generator = RandomEdgeGenerator(
net, get_prob_fun(options, None, None))
if options.weightsprefix and os.path.isfile(options.weightsprefix + VIA_SUFFIX):
via_generator = RandomEdgeGenerator(
net, LoadedProps(options.weightsprefix + VIA_SUFFIX))
except InvalidGenerator:
if options.intermediate > 0:
print(
"Error: no valid edges for generating intermediate points", file=sys.stderr)