prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
return bindata
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
for radio in self.radios: radio._recv(addr, bindata, frequency, bandwidth)
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
log.debug("packet collision detected on channel %d" % (frequency,))
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
p = random.randint(-40, -20)
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
p = random.randint(-90, -80)
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
__init__
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
_recv
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
set_configuration
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
binsend
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
binrecv
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
__init__
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
_get_radio
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
_dispatcher
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
get_radio_pair
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
get_spectrum
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
get_frequency_range
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
get_bandwidth_range
<|file_name|>simulation.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si # # Written by Tomaz Solc, tomaz.solc@ijs.si # # This work has been partially funded by the European Community through the # 7th Framework Programme project CREW (FP7-ICT-2009-258301). ...
get_power_range
<|file_name|>easy_install-script.py<|end_file_name|><|fim▁begin|>#!D:\PycharmProjects\UFT\Scripts\python.exe # EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==0.6c11','console_scripts','easy_install' __requires__ = 'setuptools==0.6c11' import sys from pkg_resources import load_entry_point<|fim▁hole|> sys.exit( load_entry_po...
<|file_name|>268-missing-number.py<|end_file_name|><|fim▁begin|>class Solution(object): def missingNumber(self, nums): """ :type nums: List[int] :rtype: int """ xor = len(nums) <|fim▁hole|> return xor inputs = [ [0], [1], [3,0,1], [9,6,4,2,3,5,7,0,1] ]...
for i, n in enumerate(nums): xor ^= n xor ^= i
<|file_name|>268-missing-number.py<|end_file_name|><|fim▁begin|>class Solution(object): <|fim_middle|> inputs = [ [0], [1], [3,0,1], [9,6,4,2,3,5,7,0,1] ] s = Solution() for i in inputs: print s.missingNumber(i) <|fim▁end|>
def missingNumber(self, nums): """ :type nums: List[int] :rtype: int """ xor = len(nums) for i, n in enumerate(nums): xor ^= n xor ^= i return xor
<|file_name|>268-missing-number.py<|end_file_name|><|fim▁begin|>class Solution(object): def missingNumber(self, nums): <|fim_middle|> inputs = [ [0], [1], [3,0,1], [9,6,4,2,3,5,7,0,1] ] s = Solution() for i in inputs: print s.missingNumber(i) <|fim▁end|>
""" :type nums: List[int] :rtype: int """ xor = len(nums) for i, n in enumerate(nums): xor ^= n xor ^= i return xor
<|file_name|>268-missing-number.py<|end_file_name|><|fim▁begin|>class Solution(object): def <|fim_middle|>(self, nums): """ :type nums: List[int] :rtype: int """ xor = len(nums) for i, n in enumerate(nums): xor ^= n xor ^= i return xo...
missingNumber
<|file_name|>test.py<|end_file_name|><|fim▁begin|><|fim▁hole|># Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must ret...
###
<|file_name|>test.py<|end_file_name|><|fim▁begin|>### # Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
plugins = ('MyChannelLogger',)
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
if ping is not None \ else SocketPing()
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): <|fim_mi...
DEFAULT_PING_INTERVAL = 30 MAX_PING_TIME = 3 def __init__(self, server_list, rule=None, ping_strategy=None, ping=None, ping_on_start=True): assert isinstance(server_list, ServerList) assert rule is None or isinstance(rule, Rule) assert ping_strategy is None or isinstance(ping_strat...
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
assert isinstance(server_list, ServerList) assert rule is None or isinstance(rule, Rule) assert ping_strategy is None or isinstance(ping_strategy, PingStrategy) assert ping is None or isinstance(ping, Ping) # some locks for thread-safety self._lock = threading.Lock() ...
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
return self._ping_interval
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
self._ping_interval = value if self._ping_timer_running: self._stop_ping_timer() self._start_ping_timer()
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
if self._ping is None: return 0 return self._ping.max_ping_time
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
if self._ping is not None: self._ping.max_ping_time = value
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
return self._stats
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
with self._server_lock: return set(self._servers)
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
with self._server_lock: servers = set() for s in self._servers: if s.is_alive: servers.add(s) return servers
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
server = self._rule.choose() return server
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
self._logger.debug("Marking server down: %s", server) server._is_alive = False
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
if server is None: self._ping_all_servers() else: is_alive = self._ping.is_alive(server) server._is_alive = is_alive
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
if server is None: # self._ping_all_servers() t = threading.Thread(name='ballast-worker', target=self._ping_all_servers) t.daemon = True t.start() else: is_alive = self._ping.is_alive(server) server._is_alive = is_alive
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
with self._server_lock: results = self._ping_strategy.ping( self._ping, self._server_list ) self._servers = set(results)
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
with self._lock: if self._ping_timer_running: self._logger.debug("Background pinger already running") return self._ping_timer_running = True self._ping_timer = threading.Thread(name='ballast-worker', target=self._ping_loop) self._p...
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
with self._lock: self._ping_timer_running = False self._ping_timer = None
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
while self._ping_timer_running: try: self._ping_all_servers() except BaseException as e: self._logger.error("There was an error pinging servers: %s", e) time.sleep(self._ping_interval)
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
def get_server_stats(self, server): pass
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
pass
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
self._start_ping_timer()
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
self._stop_ping_timer() self._start_ping_timer()
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
return 0
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
self._ping.max_ping_time = value
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
servers.add(s)
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
self._ping_all_servers()
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
is_alive = self._ping.is_alive(server) server._is_alive = is_alive
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
t = threading.Thread(name='ballast-worker', target=self._ping_all_servers) t.daemon = True t.start()
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
is_alive = self._ping.is_alive(server) server._is_alive = is_alive
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
self._logger.debug("Background pinger already running") return
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
__init__
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
ping_interval
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
ping_interval
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
max_ping_time
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
max_ping_time
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
stats
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
servers
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
reachable_servers
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
choose_server
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
mark_server_down
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
ping
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
ping_async
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
_ping_all_servers
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
_start_ping_timer
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
_stop_ping_timer
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
_ping_loop
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_...
get_server_stats
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
return 'Edge(a.ip="{}", b.ip="{}")'.format(self.a.ip, self.b.ip)
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): <|fim_middle|> class Edge(object): def __init__(self, a, b): self.a, self.b = sorted([a, b]) def __eq__(self, that): retur...
def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not valid_version(version): raise ValueError('Invalid version') self.ip = ip self.version = int(version) self.label = ip[-4:] or lab...
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): <|fim_middle|> def __lt__(self, b): return self.ip < b.ip def __repr__(sel...
if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not valid_version(version): raise ValueError('Invalid version') self.ip = ip self.version = int(version) self.label = ip[-4:] or label
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
return self.ip < b.ip
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
return 'Node(ip="%s", version=%s, label="%s")' % ( self.ip, self.version, self.label)
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
def __init__(self, a, b): self.a, self.b = sorted([a, b]) def __eq__(self, that): return self.a.ip == that.a.ip and self.b.ip == that.b.ip def __repr__(self): return 'Edge(a.ip="{}", b.ip="{}")'.format(self.a.ip, self.b.ip)
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
self.a, self.b = sorted([a, b])
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
return self.a.ip == that.a.ip and self.b.ip == that.b.ip
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
return 'Edge(a.ip="{}", b.ip="{}")'.format(self.a.ip, self.b.ip)
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
return CJDNS_IP_REGEX.match(ip)
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
try: return int(version) < 30 except ValueError: return False
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): <|fim_middle|> if not valid_versi...
raise ValueError('Invalid IP address')
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
raise ValueError('Invalid version')
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def <|fim_middle|>(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') i...
__init__
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
__lt__
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
__repr__
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
__init__
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
__eq__
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
__repr__
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
valid_cjdns_ip
<|file_name|>graph.py<|end_file_name|><|fim▁begin|>import re CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE) class Node(object): def __init__(self, ip, version=None, label=None): if not valid_cjdns_ip(ip): raise ValueError('Invalid IP address') if not ...
valid_version
<|file_name|>server.py<|end_file_name|><|fim▁begin|>from flask import Flask, Response, make_response from video_stream_handler import stream_handler import logging import cv2 # see line 398 of connectionpool.py: logging.basicConfig(level=logging.DEBUG) thetav = None app = Flask(__name__, static_url_path='/public', s...
def video_feed(): cap = cv2.VideoCapture(0) # cap.set(3, 3840) # cap.set(4, 1920)
<|file_name|>server.py<|end_file_name|><|fim▁begin|>from flask import Flask, Response, make_response from video_stream_handler import stream_handler import logging import cv2 # see line 398 of connectionpool.py: logging.basicConfig(level=logging.DEBUG) thetav = None app = Flask(__name__, static_url_path='/public', s...
cap = cv2.VideoCapture(0) # cap.set(3, 3840) # cap.set(4, 1920) return Response(stream_handler(cap), mimetype='multipart/x-mixed-replace; boundary=frame')
<|file_name|>server.py<|end_file_name|><|fim▁begin|>from flask import Flask, Response, make_response from video_stream_handler import stream_handler import logging import cv2 # see line 398 of connectionpool.py: logging.basicConfig(level=logging.DEBUG) thetav = None app = Flask(__name__, static_url_path='/public', s...
app.run(host='0.0.0.0', threaded=True)
<|file_name|>server.py<|end_file_name|><|fim▁begin|>from flask import Flask, Response, make_response from video_stream_handler import stream_handler import logging import cv2 # see line 398 of connectionpool.py: logging.basicConfig(level=logging.DEBUG) thetav = None app = Flask(__name__, static_url_path='/public', s...
video_feed
<|file_name|>727. Minimum Window Subsequence.py<|end_file_name|><|fim▁begin|>from collections import defaultdict class Solution(object): def minWindow(self, S, T): """ :type S: str :type T: str :rtype: str """ pre = defaultdict(list) for i, c in enumerate(T,...
<|file_name|>727. Minimum Window Subsequence.py<|end_file_name|><|fim▁begin|>from collections import defaultdict class Solution(object): <|fim_middle|> # print(Solution().minWindow("abcdebdde", "bde")) # print(Solution().minWindow("nkzcnhczmccqouqadqtmjjzltgdzthm", "bt")) print(Solution().minWindow("cnhczmccqou...
def minWindow(self, S, T): """ :type S: str :type T: str :rtype: str """ pre = defaultdict(list) for i, c in enumerate(T, -1): pre[c].append(i) for val in pre.values(): val.reverse() start_index = [None] * (len(T) + 1) ...
<|file_name|>727. Minimum Window Subsequence.py<|end_file_name|><|fim▁begin|>from collections import defaultdict class Solution(object): def minWindow(self, S, T): <|fim_middle|> # print(Solution().minWindow("abcdebdde", "bde")) # print(Solution().minWindow("nkzcnhczmccqouqadqtmjjzltgdzthm", "bt")) prin...
""" :type S: str :type T: str :rtype: str """ pre = defaultdict(list) for i, c in enumerate(T, -1): pre[c].append(i) for val in pre.values(): val.reverse() start_index = [None] * (len(T) + 1) lo, hi = float('-inf'),...