Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def communicate():
ret = yield from client.call.single_param(1)
self.assertEqual(ret, 2)
ret = yield from client.call.single_param('1')
self.assertEqual(ret, 2)
ret = yield from client.call.single_param(1.0)
self.assertEqual(ret, 2)
msg = "Invalid value for argument 'arg'"
with self.assertRaisesRegex(aiozmq.rpc.ParametersError, msg):
yield from client.call.single_param('1.0')
with self.assertRaisesRegex(aiozmq.rpc.ParametersError, msg):
yield from client.call.single_param('bad value')
with self.assertRaisesRegex(aiozmq.rpc.ParametersError, msg):
yield from client.call.single_param({})
with self.assertRaisesRegex(aiozmq.rpc.ParametersError, msg):
yield from client.call.single_param(None)
if sys.version_info >= (3, 5):
msg = "TypeError.*missing a required argument: 'arg'"
else:
msg = "TypeError.*'arg' parameter lacking default value"
with self.assertRaisesRegex(aiozmq.rpc.ParametersError, msg):
yield from client.call.single_param()
with self.assertRaisesRegex(aiozmq.rpc.ParametersError, msg):
def replay_server(fast5, channels, port, good_class, time_warp=1):
"""Create an RPC server to replay data from a .fast5 file.
:param fast5: input .fast5 file for simulation.
:param channels: list of channels to simulate.
:param port: port on which to listen for clients.
:param good_class: read classification name of desirable reads.
:returns: instance of :class:`ReplayFast5`.
"""
server = yield from rpc.serve_rpc(
ReplayFast5(fast5, channels, good_class=good_class, time_warp=time_warp),
bind='tcp://127.0.0.1:{}'.format(port),
translation_table=translation_table,
)
return server
if k in lang:
volume_list.append(deeplearning_sample_volume)
break
# Mount only actually existing volumes
mount_list = []
for vol in volume_list:
if vol.name in avail_volume_names:
mount_list.append(vol)
else:
log.info('skipped attaching extra volume {0} '
'to a kernel based on image {1}',
vol.name, lang)
return mount_list
class AgentRPCServer(aiozmq.rpc.AttrHandler):
def __init__(self, etcd, config, loop=None):
self.loop = loop if loop else current_loop()
self.etcd = etcd
self.config = config
self.agent_id = hashlib.md5(__file__.encode('utf-8')).hexdigest()[:12]
self.blocking_cleans = {}
self.event_sock = None
self.computers: Mapping[str, ComputerContext] = {}
self.container_registry = {}
self.hb_timer = None
self.clean_timer = None
self.scan_images_timer = None
self.images = []
self.vfolder_as_pvc = False
self.ecr_address = ''
@aiozmq.rpc.method
def func(self, data):
return data