query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Evaluate function for embedding network.
def evaluate(embed_net, trials_loader, mode="norm2", eval_L=300, num_eval=6, device=None, batch_size=30, embed_norm=True, trials_feat=None, load_wav=None): def _prefeat(embed_net, trials_loader, L, num_eval, batch_size, embed_norm, device, load_wav=None): if load_wav is None: def load_trial_wav(path): return loadWAV( path, L=L, evalmode=True, num_eval=num_eval) else: load_trial_wav = load_wav wav_file = [[trials_loader.dataset[i]["enroll"], trials_loader.dataset[i]["test"]] for i in range(len(trials_loader.dataset))] wav_file = sorted(list(set(np.concatenate(wav_file).tolist()))) trials = waveform(wav_file, load_trial_wav) def collate_fn(batch): """collect from a batch of VoxWave Dataset.""" file = [item["file"] for item in batch] wave = torch.cat([item["wave"] for item in batch], dim=0) return {"file": file, "wave": wave} trialoader = DataLoader(trials, batch_size=batch_size, num_workers=5, collate_fn=collate_fn, shuffle=False) trials_feat = {} with torch.no_grad(): embed_net.to(device) embed_net.eval() for data in tqdm(trialoader, total=len(trialoader)): file = data["file"] wave = data["wave"].to(device) feat = embed_net(wave) if embed_norm is True: feat = F.normalize(feat, p=2, dim=1).detach().cpu() for i, j in enumerate(range(0, feat.shape[0], num_eval)): trials_feat[file[i]] = feat[j: j + num_eval].clone() return trials_feat if trials_feat is None: trials_feat = _prefeat(embed_net, trials_loader, eval_L, num_eval, batch_size, embed_norm, device, load_wav) all_scores = [] all_labels = [] all_trials = [] for trial in tqdm(trials_loader, total=len(trials_loader)): label = trial["label"] enroll = trial["enroll"] test = trial["test"] for i in range(len(label)): enroll_embed = trials_feat[enroll[i]] test_embed = trials_feat[test[i]] score = calculate_score(enroll_embed.to(device), test_embed.to(device), mode=mode, num_eval=num_eval) all_scores.append(score) all_trials.append([enroll[i], test[i]]) all_labels.extend(label.numpy().tolist()) all_scores = np.array(all_scores) all_labels = np.array(all_labels) eer, thresh = calculate_eer(all_labels, all_scores, 1) return eer, thresh, all_scores, all_labels, all_trials, trials_feat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, prediction_fn):\n pass", "def evaluate():\n model.eval()\n with torch.no_grad():\n loss, n = 0, 0\n for xb, yb in valid_dl:\n n += len(xb)\n loss += loss_func(model(xb), yb) * len(xb)\n\n return loss/n", "def eva...
[ "0.65809673", "0.65288246", "0.63682526", "0.631708", "0.6305707", "0.63028127", "0.6297462", "0.6287825", "0.62783986", "0.627571", "0.6149087", "0.604402", "0.6024852", "0.60223997", "0.60162747", "0.6010527", "0.5999741", "0.5989639", "0.5989639", "0.5984649", "0.5969839",...
0.5704392
49
collect from a batch of VoxWave Dataset.
def collate_fn(batch): file = [item["file"] for item in batch] wave = torch.cat([item["wave"] for item in batch], dim=0) return {"file": file, "wave": wave}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data(self, train=True, batch_size=2):\n if train:\n elements = self.prepare_batch(self.training_albums)\n else:\n elements = self.prepare_batch(self.validation_albums)\n\n while len(elements) > 0:\n # Collect the batch\n batch = []\n f...
[ "0.61692625", "0.6092687", "0.60661197", "0.60572034", "0.6030449", "0.59338397", "0.59050703", "0.5902262", "0.57682383", "0.57110006", "0.5708979", "0.5663044", "0.565785", "0.56574595", "0.5642957", "0.5642957", "0.56295526", "0.56236845", "0.5613696", "0.55893534", "0.557...
0.0
-1
collect from a batch of VoxWave Dataset.
def collate_fn(batch): file = [item["file"] for item in batch] wave = torch.cat([item["wave"] for item in batch], dim=0) return {"file": file, "wave": wave}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data(self, train=True, batch_size=2):\n if train:\n elements = self.prepare_batch(self.training_albums)\n else:\n elements = self.prepare_batch(self.validation_albums)\n\n while len(elements) > 0:\n # Collect the batch\n batch = []\n f...
[ "0.61714315", "0.60954803", "0.60674745", "0.6059908", "0.60306466", "0.59371", "0.5907216", "0.5905398", "0.57684493", "0.5712042", "0.5711107", "0.56662107", "0.56599396", "0.56588864", "0.56463087", "0.56463087", "0.5631652", "0.56258637", "0.56173337", "0.5593329", "0.557...
0.0
-1
Returns the single qubit gate Sqrt(X)
def sqrtx(): return Operator([[(1.+1.j)/2,(1.-1.j)/2],[(1.-1.j)/2,(1.+1.j)/2]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sq(self, x):\n\t\treturn x * x", "def qrst_tm(x):\n return 0.2228*x - 0.6685", "def sq(x):\n\n return x ** x", "def isqrt(n): # newton (from stackoverflow)\n if n < 0:\n print(f\"segur que vols fer l'arrel de {n}?\")\n n = -n\n x = n\n y = (x + 1) // 2\n while y < x:\n ...
[ "0.6638449", "0.66072994", "0.65911305", "0.63476807", "0.6344686", "0.62796086", "0.6270373", "0.62620115", "0.62110555", "0.614344", "0.61330664", "0.61031693", "0.6101553", "0.6096317", "0.608822", "0.6087951", "0.6056629", "0.60234123", "0.59946364", "0.5992759", "0.59535...
0.6088627
14
Returns the single qubit gate Sqrt(Y)
def sqrty(): return Operator([[(1.+1.j)/2,(-1-1.j)/2],[(1.+1.j)/2,(1.+1.j)/2]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrst_tm(x):\n return 0.2228*x - 0.6685", "def Y(t, p, q):\n \n if t <= 0:\n return float('inf')\n \n if q == 1:\n return (t**(p+1) - 1) / (p * (p+1)) - np.log(t) / q + (p - 1) / p * (t-1)\n else:\n return (t**(p+1) - 1) / (p * (p+1)) + (t**(1-q) - 1) / (q*(q-1)) + (p - ...
[ "0.6507779", "0.62822163", "0.62746733", "0.6241614", "0.61534065", "0.61482567", "0.61480504", "0.6128632", "0.6057746", "0.6013973", "0.59892964", "0.5979296", "0.5942681", "0.592979", "0.59215605", "0.59135765", "0.5904457", "0.59001505", "0.58625853", "0.58580345", "0.581...
0.61223656
8
Returns the single qubit gate Sqrt(W)
def sqrtw(): return Operator([[(1.+1.j)/2,-1.j/np.sqrt(2)],[1./np.sqrt(2),(1.+1.j)/2]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrst_tm(x):\n return 0.2228*x - 0.6685", "def W(self):\n if not self.isVaild():\n pass\n return self.Wq() + 1.0/self.muy", "def sq(x):\n\n return x ** x", "def calc_q_square(self):\n return self._q_x()**2 + self._q_z()**2", "def sqrty():\n return Operator([[(1.+1.j)...
[ "0.6371148", "0.63678783", "0.627648", "0.6267146", "0.6152248", "0.61319304", "0.6127212", "0.60720533", "0.6038319", "0.603076", "0.6025137", "0.5983519", "0.5961708", "0.58924997", "0.58151203", "0.5788785", "0.57599264", "0.5748499", "0.57308507", "0.571389", "0.57128286"...
0.54470795
40
Constructor parent reference to the parent widget QWidget
def __init__(self, parent=None): super(ProgressDlg, self).__init__(parent) self.setupUi(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, parent):\n self.widget = QtCore.QObject(parent)", "def __init__(self, parent=None):\n super(Dialog, self).__init__(parent)\n self.setupUi(self)", "def __init__(self, parent=None):\n super(Form, self).__init__(parent)\n self.setupUi(self)", "def __init__(sel...
[ "0.80446535", "0.790637", "0.7829028", "0.7829028", "0.7818371", "0.770407", "0.770407", "0.770407", "0.770407", "0.770407", "0.76782995", "0.76558757", "0.76455885", "0.7594716", "0.7536031", "0.75227404", "0.751839", "0.7513868", "0.7468696", "0.7376986", "0.736306", "0.7...
0.74049985
19
Construct a new Player
def __init__(self): self.loop = asyncio.get_event_loop() self.aiohttp = web.Application( loop=self.loop, middlewares=[unhandled_route], ) self.client = ClientSession() self.ws = WebSocketHandler(self) self.cert = self._load_ssl_certificate() self.config()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createPlayer(self):\n sw, ne = self.playerCreationRectangle\n x = self.random.randrange(sw.x, ne.x)\n y = 1.0\n z = self.random.randrange(sw.y, ne.y)\n player = Player(Vector(x, y, z), 2, self.seconds)\n for observer in self.observers:\n observer.playerCreat...
[ "0.8133294", "0.73655224", "0.7338226", "0.7169045", "0.7107056", "0.71011436", "0.7019268", "0.70154893", "0.7000745", "0.6951531", "0.6851873", "0.68201184", "0.6619382", "0.6601898", "0.6583949", "0.65359473", "0.65358025", "0.6531014", "0.6509729", "0.6432442", "0.639431"...
0.0
-1
Load all quest handlers here
def load_quests(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_handlers(self):\n\t\tself.handlers = []\n\t\tfor mod in os.listdir('classes/handlers'):\n\t\t\tif mod == '__init__.py' or mod[-3:] != '.py':\n\t\t\t\tcontinue\n\t\t\tlib = __import__(mod[:-3], locals(), globals())\n\t\t\tself.handlers.append(lib)\n\t\t#\n\t\tself.handlers.sort(key=lambda x: x.order, rever...
[ "0.6526081", "0.6394275", "0.60561556", "0.59975696", "0.596935", "0.5927591", "0.59075165", "0.5878692", "0.569096", "0.5556501", "0.5527142", "0.5512644", "0.55046976", "0.54805523", "0.54044414", "0.5394727", "0.5393246", "0.5391057", "0.5354453", "0.5347178", "0.53144395"...
0.71654475
0
Add a quest handler to the aiohttp app
def add_quest(self, method: str, route: str, handler): self.aiohttp.router.add_route(method, route, handler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _response_handler(self):", "async def startup_handler(app):\n\n spotify_client_id = os.environ.get(SPOTIFY_CLIENT_ID)\n spotify_client_secret = os.environ.get(SPOTIFY_CLIENT_SECRET)\n\n # Save dependencies in the HTTP app.\n http.register_dependency(app, SPOTIFY_CLIENT_ID, s...
[ "0.5878627", "0.5799518", "0.57429504", "0.57207054", "0.5717911", "0.5691735", "0.5681638", "0.5614569", "0.55652535", "0.5559621", "0.5534234", "0.5512763", "0.5455151", "0.5423512", "0.5397953", "0.5394697", "0.5374808", "0.5370889", "0.53686166", "0.53405356", "0.5336915"...
0.6682835
0
Start the application and connect to the server
def connect(self): Log.info(f'Connecting to Kodeventure server at {SERVER_HOST}') web.run_app( self.aiohttp, host=PLAYER_HOST, port=PLAYER_PORT, ssl_context=self.cert )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\t\t\n\t\tself.connect(self.config[\"server\"])", "def start_server(self):\n app.run(host=str(self.__constants.host),\n port=int(self.__constants.port),\n debug=bool(self.__constants.runindebug))", "def start(self):\n run(self.app, host=self.host, por...
[ "0.83166367", "0.80134946", "0.79343057", "0.7532442", "0.74999815", "0.74902725", "0.7488411", "0.7407796", "0.7407796", "0.7342273", "0.73058623", "0.72899777", "0.7254523", "0.72319925", "0.72092813", "0.71867055", "0.7134933", "0.71249473", "0.7120971", "0.7115196", "0.71...
0.75330657
3
Configure the Player object by attaching some event handlers, adding default route and loading quests
def config(self): # Set up on_startup listener for connecting to the server self.aiohttp.on_startup.append(self.ws.connect) # Await websocket and client session termination async def shutdown(app): await self.ws.close() await self.client.close() # Set up on_shutdown listeners for graceful shutdown self.aiohttp.on_shutdown.append(shutdown) # Add a default route self.aiohttp.router.add_route('*', '/', lambda request: web.json_response({ "msg": "I'm alive" })) # Load user defined quests self.load_quests()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handler_init(self):\r\n\t\tself._handlers[\"player-join\"] = FunctionDelegate()\r\n\t\tself._handlers[\"player-quit\"] = FunctionDelegate()\r\n\t\tself._handlers[\"game-start\"] = FunctionDelegate()\r\n\t\tself._handlers[\"game-stop\"] = FunctionDelegate()", "def start(self):\n self.__init__()\n ...
[ "0.6703167", "0.6290751", "0.6279966", "0.6227849", "0.6143075", "0.6136186", "0.6016518", "0.60164726", "0.5974453", "0.5964595", "0.5954566", "0.5888326", "0.5855741", "0.5851218", "0.58509254", "0.5828278", "0.5817811", "0.5815114", "0.5780424", "0.57746065", "0.574305", ...
0.57329845
22
Private helper to load SSL certificate from disk
def _load_ssl_certificate(self) -> ssl.SSLContext: sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) sslcontext.load_cert_chain( path.join(path.dirname(__file__), '..', '..', 'player.crt'), path.join(path.dirname(__file__), '..', '..', 'player.key') ) return sslcontext
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ssl_certificate():", "def load_cert_chain(self, certfile, keyfile: Optional[Any] = ...):\n ...", "def _load_ssl(self, ssl_options: tuple):\n try:\n self._ssl.load_cert_chain(certfile=ssl_options[0], keyfile=ssl_options[1], password=ssl_options[2])\n except IOError as e:\...
[ "0.7039763", "0.70248497", "0.69557095", "0.69070625", "0.6604512", "0.6576468", "0.6486132", "0.6481465", "0.6431241", "0.6423316", "0.6407451", "0.63593185", "0.6340354", "0.61137533", "0.60513645", "0.6047259", "0.59898525", "0.59736806", "0.59400916", "0.5930687", "0.5902...
0.67338187
4
Constructor with data and next element
def __init__(self, data): self.data = data self.next = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data, next=None):\n self.data = data\n self.next = next", "def __init__(self, data, next = None):\n\t\tself.data = data\n\t\tself.next = next", "def __init__(self, data=None, next=None):\n self.data = data\n self.next = next", "def __init__(self, data, next_node...
[ "0.8599574", "0.85121983", "0.84967536", "0.8359982", "0.8315263", "0.8315263", "0.81818867", "0.8087428", "0.80368114", "0.8025065", "0.8019018", "0.7919946", "0.76897675", "0.7610863", "0.7575822", "0.75584215", "0.7526036", "0.7419128", "0.72142625", "0.7198809", "0.708651...
0.8276122
7
Representation of the linked list
def __repr__(self): return "LinkedList([{}],{}/{})".format(self.cur_node, self.cur_pos, self.length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n return \"LinkedList created\"", "def __repr__(self):\r\n return \"ListNode({})\".format(self.data)", "def __repr__(self):\n return 'LinkedList({!r})'.format(self.items())", "def __repr__(self):\n return \"{}\".format(self._head)", "def __init__(se...
[ "0.77007776", "0.76717454", "0.7663137", "0.7242428", "0.72094405", "0.7121683", "0.7095792", "0.6991777", "0.6974106", "0.69680715", "0.69224", "0.68925244", "0.6854505", "0.6827989", "0.6827989", "0.6827989", "0.6827989", "0.6827989", "0.6827928", "0.67615014", "0.6742917",...
0.76858366
1
Insert a new node into the linked list
def add_node(self, data): new_node = Node(data) if self.cur_node is not None: new_node.next, self.cur_node.next = self.cur_node.next, new_node self.cur_node = new_node self.length += 1 self.cur_pos += 1 if self.start_node is None: self.start_node = self.cur_node # print("Node({}) added to {}".format(new_node.data, self.cur_pos-1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_node(self, head, node):\n prev, curr = None, head\n while curr.val < node.val:\n prev, curr = curr, curr.next\n if not prev:\n head = node\n else:\n prev.next = node\n node.next = curr\n return head", "def insert(self, data):\n...
[ "0.8028355", "0.8022881", "0.78825825", "0.7828899", "0.78155625", "0.78046495", "0.7687818", "0.76444274", "0.76059026", "0.76059026", "0.75250113", "0.75250113", "0.7509364", "0.7460348", "0.74056655", "0.73841995", "0.73401856", "0.7332098", "0.7327415", "0.7317284", "0.72...
0.6689157
74
Print the linked list
def list_print(self): node = self.cur_node # cant point to ll! while node: print(node.data) node = node.next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_list(self) -> None:\n cur_node = self.head\n while cur_node:\n print(cur_node.data)\n cur_node = cur_node.next", "def print_list(self):\n\n current = self.head\n\n while current is not None:\n print current.data\n current = current...
[ "0.8673001", "0.86067754", "0.85906494", "0.8569578", "0.85571915", "0.8512224", "0.84492445", "0.8400473", "0.82561886", "0.8178204", "0.8120253", "0.8110577", "0.809658", "0.7893961", "0.7872987", "0.7842627", "0.78114355", "0.77788997", "0.77637863", "0.7760473", "0.774224...
0.88183177
0
Move in the linked list n places, if reached the end start from the start
def move_circular(self, count): planned_move = self.cur_pos + count if count + planned_move < self.length: move_count = count self.cur_pos += move_count # print("Move less from {} to {}({})".format( # self.cur_pos, # self.cur_pos + move_count, # planned_move # )) else: self.cur_node = self.start_node move_count = max(0, (planned_move % (self.length))) # print("Move circ from {} to {}({})".format(self.cur_pos, move_count, planned_move)) self.cur_pos = move_count for _ in range(move_count): self.cur_node = self.cur_node.next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, n: int) -> \"Linked[T]\":\n out = self\n if n >= 0:\n for _ in range(n):\n out = out.forward\n else:\n for _ in range(-n):\n out = out.backward\n return out", "def move_stack(n, start, end):\n assert 1 <= start <= 3...
[ "0.70314944", "0.6992453", "0.68459344", "0.66120696", "0.66120696", "0.6502313", "0.64976275", "0.6037973", "0.59619963", "0.592741", "0.5908573", "0.5853676", "0.58296", "0.58181906", "0.5809934", "0.5785236", "0.5776495", "0.57708544", "0.57155955", "0.5683604", "0.5644946...
0.64244884
7
Get the data of the next node
def get_next(self): return self.cur_node.next.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next(node):\n return node['next']", "def data(self):\n return self.first_node.data", "def get_data(node):\n return node['data']", "def node_data(self):\n return self.node_data_", "def _next(self):\n node = self.head\n while node != None:\n yield node.dat...
[ "0.7340955", "0.72560537", "0.71013474", "0.70286286", "0.70277715", "0.6898941", "0.67155683", "0.67155683", "0.67155683", "0.6683656", "0.6547143", "0.65334487", "0.65334487", "0.64254665", "0.6382568", "0.63816816", "0.63672584", "0.63516414", "0.630895", "0.6291807", "0.6...
0.8156502
0
Constructor for the twister
def __init__(self, init): self.stepforward = int(init) self.data = Linkedlist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user_ctor, seed=0):\n self._user_ctor = user_ctor\n self._seed = seed\n self.reset_sampler()", "def __init__(self, seed):\n self.mt = MT19937(seed & 0xFFFF)\n self.keystream = []", "def __init__(self, seed=__default):\n\n seed = self.__default if seed == 0 else ...
[ "0.65222347", "0.63090914", "0.62000424", "0.6192566", "0.614152", "0.612248", "0.6101128", "0.60043067", "0.59858197", "0.59820634", "0.5972612", "0.5955955", "0.595311", "0.59528494", "0.5922501", "0.5905344", "0.5901768", "0.58944374", "0.5858806", "0.58463246", "0.5831957...
0.0
-1
Representation of the spinlock
def __repr__(self): return "Spinlock({})".format(self.stepforward)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock_control(self):\n raise NotImplementedError('PlatformService: Implementation incomplete')", "def spinlocks(self):\n return self._spinlocks", "def lock(self):\n raise NotImplementedError", "def lock(self):\r\n return self._lock", "def f_lock(self):\n self._locked = Tru...
[ "0.6281956", "0.61268324", "0.60570246", "0.60079235", "0.5999252", "0.5991468", "0.5932551", "0.5889748", "0.57721347", "0.5762535", "0.5744118", "0.57419753", "0.5740945", "0.5726452", "0.57194465", "0.56717205", "0.56714046", "0.56600225", "0.5617723", "0.5606084", "0.5601...
0.71650106
0
Move n steps then insert a new value
def process(self, count): self.data.add_node(0) for index in range(1, count + 1): # print("{}.: {}".format(index, self.data)) self.data.move_circular(self.stepforward) self.data.add_node(index) return self.data.get_next()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_step(self, n_steps: int) -> None:\n self.step = self.policy.increment_step(n_steps)", "def increment_step(self, n_steps: int) -> None:\n self.step = self.policy.increment_step(n_steps)", "def increment_steps(self):\n self.num_steps += 1", "def make_step(self):\n self...
[ "0.6520088", "0.6520088", "0.61909217", "0.6150601", "0.61039525", "0.6089643", "0.60866725", "0.6062686", "0.6013688", "0.59797156", "0.59569323", "0.58549404", "0.58222437", "0.5809769", "0.5773611", "0.5759914", "0.57056457", "0.56964505", "0.5682795", "0.5681156", "0.5659...
0.5482471
38
Solution to the problem
def solution(data): lock = Spinlock(data) return lock.process(2017)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(self):\n pass", "def solve(self):\n pass", "def solve(self):\n ...", "def problem_298():\n pass", "def solvate(self):\n\n pass", "def solution(s):", "def get_sol(self):", "def test_get_solution(self):\n pass", "def solution(self)...
[ "0.7423277", "0.7013315", "0.7013315", "0.69836867", "0.6830721", "0.6752851", "0.64645183", "0.6391518", "0.63800526", "0.63478065", "0.61165357", "0.6100315", "0.6074178", "0.60716605", "0.60713553", "0.60587716", "0.60174394", "0.5986508", "0.59821045", "0.59797627", "0.59...
0.0
-1
Given the tile location (x,y) and zoom level z, fetch the corresponding tile from the server and save it to the location specfied in fpath. Note, this saves just one tile; usually, want to use `positive_dataset` instead.
def save_tile(x,y,z,fpath): UA = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/77.0" tile_url = f"https://{random.choice('abc')}.tile.openstreetmap.org/{z}/{x}/{y}.png" # cmd = f"wget --user-agent='please download' -O {fpath} {url}" if os.path.exists(fpath): print(f"Already have tile {fpath}!") return 0 if os.path.isdir(fpath): raise ValueError(f"requested path {fpath} exists and is a directory!") try: res = rq.get( url=tile_url, headers={'User-Agent': UA} ) status = res.status_code if status == 200: with open(fpath,'wb') as of: of.write(res.content) return 0 else: print(f"Error: response {status} from server:\n{res.reason}") return status except Exception as e: print(f"Error getting tile: {e}") return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_tile(map_layer, zoom, x, y):\n try:\n tile_url = map_layer.get_tile_url(zoom, x, y)\n tmp_file, headers = urllib.request.urlretrieve(tile_url)\n return (x, y), tmp_file\n except URLError as e:\n app.logger.info(\"Error downloading tile x={}, y={}, z={} for layer {}: {...
[ "0.7046244", "0.6987471", "0.6816313", "0.6353406", "0.6337127", "0.63041425", "0.6291108", "0.6263484", "0.6197", "0.6188584", "0.6176481", "0.6158082", "0.60673577", "0.60509396", "0.60040617", "0.58420604", "0.5838847", "0.58381325", "0.5794229", "0.5779506", "0.57553935",...
0.7838271
0
Save the tiles whose coordinates are in the input DataFrame, defined by columns x, y, and z
def save_tiles(df,output_dir,namefunc = None): if not isinstance(df,pd.core.frame.DataFrame): raise TypeError("df must be a pandas DataFrame!") if any(e not in df.columns for e in ('z','x','y')): raise ValueError("df must have columns x, y, and z") if namefunc is None: def namefunc(x,y,z): return f'{z}_{x}_{y}.png' opath = os.path.abspath(os.path.expanduser(output_dir)) Path(opath).mkdir(parents=True, exist_ok=True) L = df.shape[0] flocs = [''] * L for i,xyz in enumerate(zip(df['x'],df['y'],df['z'])): x,y,z = xyz print(f"({i+1} of {L})...") sleep(0.75) outloc = os.path.join(opath,namefunc(x,y,z)) if save_tile(x,y,z,outloc) == 0: flocs[i] = outloc df = df.assign(file_loc = flocs) return df[df['file_loc'] != '']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_coords(self, coords, output_dir):\n new_rows = []\n for i, (lat, lon) in enumerate(coords):\n row = {\n 'tile_id': i,\n 'lat':lat,\n 'long':lon,\n 'side_length': self.side_len \n }\n\n new_rows.appen...
[ "0.6151705", "0.60504067", "0.5954003", "0.576589", "0.5702577", "0.5660171", "0.56481516", "0.5625405", "0.55865616", "0.5577034", "0.5532618", "0.55072516", "0.5442371", "0.542948", "0.5415182", "0.5410632", "0.54070646", "0.53605324", "0.5332602", "0.5332529", "0.5324701",...
0.7190305
0
add latitude/longitude values to a dataframe
def add_latlon(df): LLs = [num2deg(x,y,z) for x,y,z in zip(df['x'],df['y'],df['z'])] LLdf = pd.DataFrame.from_records(LLs,columns = ['latitude','longitude']) return pd.concat([df.reset_index(drop=True),LLdf],axis = 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_demo_location_history() -> geopandas.GeoDataFrame:\n np.random.seed(123)\n\n time = pd.date_range(start=datetime.fromtimestamp(1624241116), end=datetime.now(), freq=\"1min\").values\n\n center_point = (-36.875990410695394, 174.76398830024274)\n lat = np.random.normal(loc=center_point[0], sca...
[ "0.63746387", "0.63202995", "0.60851926", "0.6078423", "0.6073065", "0.60551715", "0.60244256", "0.59730685", "0.59513515", "0.5890462", "0.5884484", "0.58564293", "0.58458704", "0.58379817", "0.58235085", "0.5796834", "0.5791018", "0.5752113", "0.5700064", "0.5698395", "0.56...
0.79349303
0
This function creates outputs (x,y,z) tile coordinate files which can be fed into download_tiles.sh or the save_tiles function to get tiles from the OSM server.
def basic_tileset(geo_dict, zooms, buffer = 0,n_neg = None): if not len(geo_dict['elements']): raise ValueError("The query is empty - cannot continue!") if type(zooms) is int: zooms = [zooms] if any(z < 2 or z > 19 for z in zooms): raise ValueError("all zoom levels must be between 2 and 19") nodes = atomize_features(geo_dict) points_list = [(node['lat'],node['lon']) for node in nodes] pos_DFs, neg_DFs = [], [] for zoom in zooms: zxy = [(zoom,*deg2num(x,y,zoom)) for x,y in points_list] pos_df = pd.DataFrame.from_records(zxy,columns = ['z','x','y'])\ .drop_duplicates(subset = ['x','y']) num_neg = pos_df.shape[0] if n_neg is None else int(n_neg) neg_x, neg_y = sample_complement(pos_df['x'],pos_df['y'],num_neg,buffer) neg_df = pd.DataFrame({'z': zoom,'x': neg_x,'y': neg_y}).sort_values(by = ['z','x','y']) pos_DFs.append(pos_df) neg_DFs.append(neg_df) out_pos = add_latlon(pd.concat(pos_DFs,axis = 0)) out_neg = add_latlon(pd.concat(neg_DFs,axis = 0)) common_row = pd.merge(out_pos,out_neg,on = ['z','x','y']).shape[0] if common_row > 0: raise RuntimeError(f"Somehow there are {common_row} common rows!") return {'positive': out_pos, 'negative': out_neg }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_metadata(self):\n if self.options.mbtiles:\n return\n if not os.path.exists(self.output):\n os.makedirs(self.output)\n\n if self.options.profile == 'mercator':\n\n south, west = self.mercator.MetersToLatLon( self.ominx, self.ominy)\n north, east = self.mercator.MetersToLatLon( self.omaxx, s...
[ "0.65990293", "0.64210165", "0.6350539", "0.6310586", "0.6223159", "0.6142363", "0.6141133", "0.61198944", "0.60979927", "0.60793155", "0.605626", "0.6051542", "0.6041125", "0.5997875", "0.59818053", "0.5976445", "0.5960446", "0.5947027", "0.5920985", "0.5904805", "0.58695346...
0.0
-1
Create a DataFrame containing information on all tiles identified as downloadable
def shapely_tileset(processed_query,min_ovp = 0,max_ovp = 1, n_neg = None,buffer = 0): types, xx, yy, qual, tags = [],[],[],[],[] z = processed_query['zoom'] for elem in processed_query['elements']: for tile in elem['tiles']: qq = tile[1] if qq >= min_ovp and qq <= max_ovp: x,y,_ = find_tile_coords(tile[0],z) xx.append(x) yy.append(y) qual.append(tile[1]) tags.append(json.dumps(elem['tags'])) types.append(elem['type']) pos_df = pd.DataFrame({ 'z': z, 'x' : xx, 'y': yy, 'entity': types, 'overlap': qual,'tags': tags, 'placename': processed_query['query_info']['placename'] }) \ .drop_duplicates(subset = ['x','y']) \ .sort_values(by = ['x','y']) if n_neg is None: n_neg = pos_df.shape[0] negt = sample_complement(pos_df['x'],pos_df['y'],n_neg,buffer) neg_df = pd.DataFrame({'z': z,'x': negt[0],'y': negt[1]}) \ .sort_values(by = ['x','y']) return { 'positive': add_latlon(pos_df), 'negative': add_latlon(neg_df) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_tiles(x_index = None, y_index = None):\n db_cursor2 = self.db_connection.cursor()\n\n sql = \"\"\"-- Check for any existing tiles\nselect\n tile_id,\n x_index,\n y_index,\n tile_type_id,\n tile_pathname,\n dataset_id,\n tile_class_id,\n tile_size\nfrom tile_footprint\...
[ "0.5520219", "0.55059403", "0.5477932", "0.5469635", "0.5457995", "0.54150224", "0.5368179", "0.534763", "0.5336239", "0.53228396", "0.53197813", "0.5276907", "0.5260043", "0.52545166", "0.52139163", "0.521263", "0.5197093", "0.5197093", "0.5183362", "0.51803267", "0.5175006"...
0.0
-1
Infinite sequence of integers.
def integers(): i = 1 while True: yield i i = i + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_sequence_infinite(seq):\n while True:\n for item in seq:\n yield item", "def infinite_increment():\n i = 0\n while 1:\n yield i\n i += 1", "def int_to_seq(i):\n\ts = []\n\tprime = xprimes()\n\twhile i != 1:\n\t\ts.append(0)\n\t\tp = next(prime)\n\t\twhile i % p == 0:\n\t\t...
[ "0.7470997", "0.7343358", "0.6424951", "0.6344632", "0.63421345", "0.62673986", "0.60785764", "0.60572314", "0.60339946", "0.6026884", "0.5996939", "0.59359825", "0.5839094", "0.58256906", "0.58099836", "0.5782609", "0.57588905", "0.5748371", "0.5706836", "0.5637029", "0.5626...
0.7472032
1
Returns first n values from the given sequence.
def take(n, seq): seq = iter(seq) result = [] try: for i in range(n): result.append(next(seq)) except StopIteration: pass return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(n, seq):\n return itertools.islice(seq, n)", "def nth(n, seq):\n try:\n return seq[n]\n except TypeError:\n return next(itertools.islice(seq, n, None))", "def take(iterable, n):\n return list(itertools.islice(iterable, n))", "def lookahead(n, iterable):\n for value in is...
[ "0.7429517", "0.6876003", "0.6727532", "0.67118037", "0.66985476", "0.66985476", "0.66961426", "0.6665714", "0.6665714", "0.66652995", "0.6647308", "0.64990807", "0.6490624", "0.6476307", "0.6448948", "0.6416278", "0.6414325", "0.64115244", "0.6388718", "0.63765794", "0.63302...
0.7366886
1
Report Method to Get Work Order Details.
def get_work_order_detail(self, date_range): work_order_obj = self.env["task.line"] start = datetime.strptime(date_range.get("date_from"), "%Y-%m-%d") end = datetime.strptime(date_range.get("date_to"), "%Y-%m-%d") step = timedelta(days=1) workorder_detail = [] while start <= end: sdate = str( datetime.strptime( str(start.date()) + " 00:00:00", DEFAULT_SERVER_DATETIME_FORMAT ) ) edate = str( datetime.strptime( str(start.date()) + " 23:59:59", DEFAULT_SERVER_DATETIME_FORMAT ) ) work_order_ids = work_order_obj.search( [("date_issued", ">=", sdate), ("date_issued", "<=", edate)] ) if work_order_ids: parts_data = {} parts_value = [] for parts_line in work_order_ids: if ( parts_line.fleet_service_id and parts_line.fleet_service_id.state == "done" ): parts_dict = { "wo_name": parts_line.fleet_service_id and parts_line.fleet_service_id.name or "", "vehicle_id": parts_line.fleet_service_id and parts_line.fleet_service_id.vehicle_id and parts_line.fleet_service_id.vehicle_id.name or "", "part_no": parts_line.product_id and parts_line.product_id.default_code or "", "part_name": parts_line.product_id and parts_line.product_id.name or "", "vehicle_make": parts_line.vehicle_make_id and parts_line.vehicle_make_id.name or "", "qty": parts_line.qty or 0.0, "uom": parts_line.product_uom and parts_line.product_uom.name or "", "old_part_return": parts_line.old_part_return and "Yes" or "No", "issued_by": parts_line.issued_by and parts_line.issued_by.name or "", "remarks": parts_line.fleet_service_id and parts_line.fleet_service_id.note or "", } parts_value.append(parts_dict) if parts_value: parts_value = sorted(parts_value, key=lambda k: k["wo_name"]) parts_data = {"date": start.date(), "value": parts_value} workorder_detail.append(parts_data) start += step return workorder_detail
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_report():", "def work_order_receipt_retrieve(self, work_order_id, id=None):\n pass", "def get_order_detail(orderid): \n data = order_obj.get_order_detail(orderid)\n return data", "def open_workorders(self, cr, uid, ids, context=None):\n context = context or {}\n models_da...
[ "0.68440074", "0.6475144", "0.6159926", "0.6083596", "0.608028", "0.59921384", "0.5808397", "0.58080214", "0.5693121", "0.5688188", "0.56651086", "0.5659879", "0.5623415", "0.56180996", "0.5615256", "0.5562105", "0.55497396", "0.55432594", "0.55332184", "0.5496018", "0.546495...
0.70237696
0
Generate xlsx format print report.
def generate_xlsx_report(self, workbook, data, parts_data): worksheet = workbook.add_worksheet("daily_parts_issuance_wizard") worksheet.set_column(0, 0, 10) worksheet.set_column(1, 1, 15) worksheet.set_column(2, 2, 20) worksheet.set_column(3, 3, 15) worksheet.set_column(4, 4, 10) worksheet.set_column(5, 5, 12) worksheet.set_column(6, 6, 10) worksheet.set_column(7, 7, 10) worksheet.set_column(8, 8, 15) worksheet.set_column(9, 9, 10) worksheet.set_column(10, 10, 15) worksheet.set_column(11, 11, 10) worksheet.set_column(12, 12, 20) worksheet.set_column(13, 13, 5) worksheet.set_column(14, 14, 5) worksheet.set_column(15, 15, 5) bold = workbook.add_format( {"bold": True, "font_name": "Arial", "font_size": "10"} ) tot = workbook.add_format( {"border": 2, "bold": True, "font_name": "Arial", "font_size": "10"} ) border = workbook.add_format( {"border": 2, "font_name": "Arial", "font_size": "10"} ) merge_format = workbook.add_format({"border": 2, "align": "center"}) format1 = workbook.add_format( {"border": 2, "bold": True, "font_name": "Arial", "font_size": "10"} ) format1.set_bg_color("gray") date = workbook.add_format({"num_format": "dd/mm/yy"}) worksheet.merge_range("C3:F3", "Merged Cells", merge_format) row = 0 row += 1 row += 1 worksheet.write(row, 2, "DAILY PARTS ISSUANCE", tot) row += 1 worksheet.write(row, 2, "Date From:", tot) worksheet.write(row, 3, data["form"]["date_from"] or "", border) worksheet.write(row, 4, "To:", tot) worksheet.write(row, 5, data["form"]["date_to"] or "", border) row += 2 worksheet.write(row, 0, "CMF", bold) row = 3 for objec in self.get_work_order_detail(data["form"]): row += 3 worksheet.write(row, 0, "DATE ISSUED :", bold) worksheet.write(row, 1, objec.get("date") or "", date) row += 2 worksheet.write(row, 0, "NO.", format1) worksheet.write(row, 1, "WO NO.", format1) worksheet.write(row, 2, "VEHICLE ID", format1) worksheet.write(row, 3, "PART NO.", format1) worksheet.write(row, 4, "PART NAME", format1) worksheet.write(row, 5, "VEHICLE MAKE", format1) worksheet.write(row, 6, "USED", format1) worksheet.write(row, 7, "UNIT TYPE", format1) worksheet.write(row, 8, "OLD PART RETURND", format1) worksheet.write(row, 9, "ISSUED BY", format1) worksheet.write(row, 10, "REMARKS", format1) line_row = row + 1 line_col = 0 counter = 1 for obj in objec.get("value"): worksheet.write(line_row, line_col, counter, border) line_col += 1 worksheet.write(line_row, line_col, obj.get("wo_name") or "", border) line_col += 1 worksheet.write(line_row, line_col, obj.get("vehicle_id") or "", border) line_col += 1 worksheet.write(line_row, line_col, obj.get("part_no") or "", border) line_col += 1 worksheet.write(line_row, line_col, obj.get("part_name") or "", border) line_col += 1 worksheet.write( line_row, line_col, obj.get("vehicle_make") or "", border ) line_col += 1 worksheet.write(line_row, line_col, obj.get("qty") or "", border) line_col += 1 worksheet.write(line_row, line_col, obj.get("uom") or "", border) line_col += 1 worksheet.write( line_row, line_col, obj.get("old_part_return") or "", border ) line_col += 1 worksheet.write(line_row, line_col, obj.get("issued_by") or "", border) line_col += 1 worksheet.write(line_row, line_col, obj.get("remarks") or "", border) line_col = 0 line_row += 1 counter += 1 worksheet.write(line_row, line_col, "********", border)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_xlsx(self):\n if self.date_from and self.date_to:\n if self.date_from > self.date_to:\n raise ValidationError(\"Date From must be less than Date To\")\n\n # active_record = self._context['id']\n # record = self.env['room.accommodation'].browse(active_record)...
[ "0.7330527", "0.6696778", "0.64272696", "0.6423999", "0.640377", "0.63337004", "0.625461", "0.621144", "0.61932975", "0.61916244", "0.6103704", "0.59963775", "0.5941088", "0.5938474", "0.5917404", "0.58896947", "0.58573407", "0.5852752", "0.5852723", "0.58489084", "0.5818077"...
0.69838953
1
Sample pure Lambda function
def lambda_handler(event, context): # try: # ip = requests.get("http://checkip.amazonaws.com/") # except requests.RequestException as e: # # Send some context about this error to Lambda Logs # print(e) # raise e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_lambda(n):\n for i in range(n):\n yield lambda : i", "def test_lambda(n):\n return [lambda v=i: v for i in range(n)]", "def lambda_method(self,t): \n return 5*math.sin(2*math.pi*1*t) # I don't see the value of 1 here but this is how lamda is defined in the exercise.", "def...
[ "0.71773744", "0.69108605", "0.6901355", "0.65597636", "0.6500524", "0.62655693", "0.62334967", "0.6138908", "0.6111436", "0.6015638", "0.5991434", "0.5974308", "0.5957245", "0.5953069", "0.59432507", "0.59294564", "0.5925585", "0.59229636", "0.5896368", "0.58732843", "0.5852...
0.0
-1
Checks num for primality. Returns bool.
def isPrime(num): if num == 2: return True elif num < 2 or not num % 2: # even numbers > 2 not prime return False # factor can be no larger than the square root of num for i in range(3, int(num ** .5 + 1), 2): if not num % i: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_prime(self, num):\n if num == 2:\n return True\n if num < 2 or num % 2 == 0:\n return False\n for n in range(3, int(num ** 0.5) + 2, 2):\n if num % n == 0:\n return False\n return True", "def is_prime(num: int) -> bool:\n retu...
[ "0.818409", "0.8014647", "0.7901733", "0.7833093", "0.782687", "0.7789034", "0.7774602", "0.77519137", "0.773821", "0.77361023", "0.77142495", "0.77123564", "0.77093136", "0.7696949", "0.76745045", "0.76480395", "0.7635072", "0.760836", "0.7582893", "0.7576612", "0.75485444",...
0.7704085
13
Here we define the configuration settings needed for all ingestion plugins with reasonable defaults.
def vdk_configure(self, config_builder: ConfigurationBuilder) -> None: # Plugin-related configurations config_builder.add( key="INGEST_METHOD_DEFAULT", default_value=None, description="Default Ingestion method to be used.", ) config_builder.add( key="INGEST_TARGET_DEFAULT", default_value=None, description="Default Ingestion target to be used.", ) # Configure ingestion specific environment variables ingester_configuration.add_definitions(config_builder=config_builder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration():", "def init_config(self):\n pass", "def configure(self):", "def configure(self):", "def configure(self):", "def configure(self):", "def configure(self):\n\n pass", "def get_default_config(self):\n config = super(SignalfxHandler, self).get_default_config()\n\n...
[ "0.6318215", "0.6309264", "0.62523276", "0.62523276", "0.62523276", "0.62523276", "0.62494737", "0.62309724", "0.6225098", "0.6225098", "0.6183282", "0.6180916", "0.6179421", "0.6114876", "0.6098103", "0.60826004", "0.60826004", "0.6071773", "0.6046305", "0.60166687", "0.6011...
0.6801265
0
Save a piece of data in the configuration directory.
def save_data(data: str, data_name: str): with open(config_path / data_name, "w") as f: f.write(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n try:\n with open(self._filename, 'w') as conf_file:\n conf_file.write(json.dumps(self._data))\n except OSError:\n _LOGGER.exception(\"Can't store config in %s\", self._filename)", "def save(self):\n file = open(self.path, 'w')\n s...
[ "0.78885645", "0.7684677", "0.76479673", "0.76162696", "0.75278085", "0.7526425", "0.7504001", "0.74552506", "0.74546015", "0.72604036", "0.72053385", "0.7191787", "0.71898353", "0.7184517", "0.7153047", "0.7149685", "0.71368116", "0.71217936", "0.7120903", "0.7091909", "0.70...
0.7392408
13
Load a piece of data from the configuration directory.
def load_data(data_name) -> str: with open(config_path / data_name, "r") as f: data = f.readline().strip().split()[0] return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load():\n # get (or create) config path\n p = initialize()\n return load_config(open(p['config']))", "def load_data_from_config(self):\n\n config_file_name = \"cicada/config/config.yaml\"\n config_dict = None\n self.labels = []\n self.to_add_labels = []\n if os.pat...
[ "0.7237997", "0.71998596", "0.70477736", "0.701441", "0.69010216", "0.6879877", "0.6821252", "0.6756391", "0.6728431", "0.66508085", "0.66283035", "0.65852034", "0.6569168", "0.6547239", "0.64764965", "0.6467039", "0.64538944", "0.64244694", "0.64153147", "0.6405894", "0.6381...
0.59277076
85
Get a single TW task as an Albert Item.
def get_tw_item(task: taskw.task.Task) -> v0.Item: # type: ignore field = get_as_subtext_field task_id = tw_side.get_task_id(task) actions = [ FuncAction( "Complete task", lambda args_list=["done", task_id]: run_tw_action(args_list), ), FuncAction( "Delete task", lambda args_list=["delete", task_id]: run_tw_action(args_list), ), FuncAction( "Start task", lambda args_list=["start", task_id]: run_tw_action(args_list), ), FuncAction( "Stop task", lambda args_list=["stop", task_id]: run_tw_action(args_list), ), FuncAction( "Edit task interactively", lambda args_list=["edit", task_id]: run_tw_action(args_list, need_pty=True), ), FuncAction( "Fail task", lambda task_id=task_id: fail_task(task_id=task_id), ), ClipAction("Copy task UUID", f"{task_id}"), ] found_urls = url_re.findall(task["description"]) if "annotations" in task.keys(): found_urls.extend(url_re.findall(" ".join(task["annotations"]))) for url in found_urls[-1::-1]: actions.insert(0, UrlAction(f"Open {url}", url)) if reminders_tag_path.is_file(): global reminders_tag reminders_tag = load_data(reminders_tag_path) else: save_data("remindme", str(reminders_tag_path)) actions.append( FuncAction( f"Add to Reminders (+{reminders_tag})", lambda args_list=[ "modify", task_id, f"+{reminders_tag}", ]: run_tw_action(args_list), ) ) actions.append( FuncAction( "Work on next (+next)", lambda args_list=[ "modify", task_id, "+next", ]: run_tw_action(args_list), ) ) urgency_str, icon = urgency_to_visuals(task.get("urgency")) text = task["description"] due = None if "due" in task: due = task["due"].astimezone(dateutil.tz.tzlocal()).strftime("%Y-%m-%d %H:%M:%S") # type: ignore return get_as_item( text=text, subtext="{}{}{}{}{}".format( field(urgency_str), "ID: {}... | ".format(tw_side.get_task_id(task)[:8]), field(task["status"]), field(task.get("tags"), "tags"), field(due, "due"), )[:-2], icon=[str(icon)], completion=f'{curr_trigger}{task["description"]}', actions=actions, urgency=task.get("urgency"), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTask():\n\tcontent = requests.get(MANAGER_URL+\"task\", params={\"apiKey\": API_KEY}).text\n\tif content == \"null\":\n\t\treturn None\n\telse:\n\t\treturn json.loads(content)", "def get_task(task_id):\n return db.task.find_one({'_id': ObjectId(task_id)})", "def get_item(self):\n return self.i...
[ "0.6219642", "0.6196074", "0.6165974", "0.6165974", "0.61451584", "0.61449784", "0.61061776", "0.6070151", "0.6032105", "0.6015247", "0.6007213", "0.59836924", "0.59652644", "0.59573513", "0.59348106", "0.5902991", "0.5900254", "0.58807874", "0.58392173", "0.58383256", "0.583...
0.676394
0
Query for a specific subcommand.
def __init__(self, subcommand: Subcommand, query: str): self.command = subcommand self.query = query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_subcommand(self, name):\n try:\n subcommand_class = self.subcommands[name]\n except KeyError:\n self.print_command_unkown_error(name)\n sys.exit(1)\n return subcommand_class(self.prog, name, self.argv[2:], self.stdout)", "def fetch_command(self, glo...
[ "0.6903667", "0.68024147", "0.66922116", "0.667356", "0.659423", "0.65638745", "0.63775086", "0.6367834", "0.636292", "0.6309504", "0.623588", "0.62239105", "0.6186224", "0.6177531", "0.61727655", "0.6118774", "0.6098485", "0.6085753", "0.6055098", "0.6037985", "0.6026761", ...
0.6384904
6
Get a subcommand with the indicated name.
def get_subcommand_for_name(name: str) -> Optional[Subcommand]: matching = [s for s in subcommands if s.name.lower() == name.lower()] if matching: return matching[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_subcommand(self, name):\n try:\n subcommand_class = self.subcommands[name]\n except KeyError:\n self.print_command_unkown_error(name)\n sys.exit(1)\n return subcommand_class(self.prog, name, self.argv[2:], self.stdout)", "def get_subcmd(self, name: ...
[ "0.8886178", "0.8527717", "0.79279536", "0.7438187", "0.735898", "0.7330646", "0.72542876", "0.7133576", "0.70916045", "0.70674455", "0.7017528", "0.6924694", "0.6864823", "0.6756936", "0.6737042", "0.6726676", "0.6696921", "0.6614363", "0.66121435", "0.66044974", "0.65040296...
0.8167717
2
Determine whether current query is of a subcommand. If so first returned the corresponding SubcommandQeury object.
def get_subcommand_query(query_str: str) -> Optional[SubcommandQuery]: if not query_str: return None # spilt: # "subcommand_name rest of query" -> ["subcommand_name", "rest of query""] query_parts = query_str.strip().split(None, maxsplit=1) if len(query_parts) < 2: query_str = "" else: query_str = query_parts[1] subcommand = get_subcommand_for_name(query_parts[0]) if subcommand: return SubcommandQuery(subcommand=subcommand, query=query_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_sub_commands(self) -> bool:\n if self.__dict__.get(\"sub_commands\"):\n return True\n\n return False", "def _subcommand_for_name(self, name):\n for subcommand in self.subcommands:\n if name == subcommand.name or \\\n name in subcommand....
[ "0.65202355", "0.6357731", "0.63516015", "0.6259924", "0.60126", "0.59781826", "0.5967946", "0.5843146", "0.5827129", "0.5752442", "0.5749248", "0.57485867", "0.5696898", "0.5505429", "0.5458622", "0.53960603", "0.5385143", "0.53838754", "0.5379334", "0.53359336", "0.5302235"...
0.6729017
0
Establishes a upper limit for the forloop that parses the SWMM input file
def countsubcatchments(inputfilename=FileSettings.settingsdict['inputfilename']): global count with open(inputfilename, 'r') as swmmput: contents = swmmput.readlines() count = len(contents) return(count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _uppLim(self):\n if self.getResult(param='TS value')[0] >= self.tsmin:\n print(\"\\t=== TS value {} is above TSmin {}, no need to compute an upperlimit ===\"\n .format(self.getResult(param='TS value')[0], self.tsmin))\n return\n\n from UpperLimits import Uppe...
[ "0.6134237", "0.6107441", "0.5806846", "0.5753623", "0.56226695", "0.5602243", "0.5540518", "0.54625756", "0.5389855", "0.5387457", "0.53571594", "0.53309345", "0.53300595", "0.53155893", "0.5291036", "0.5275519", "0.52754134", "0.523921", "0.5234351", "0.52126867", "0.520834...
0.0
-1
Opens and reads the parameters in the [SUBCATCHMENT] and [SUBAREA] headers within the SWMM input file. Adds these parameters (as strings) to a numpy array
def read_initial_parameters(inputfilename): subc_params = [] subarea_params = [] global subc_names subc_names = [] subcatchment_parameters = [] inputfile = open(inputfilename, 'r') for line in inputfile: if(line.find("[SUBCATCHMENTS]") != -1): line = inputfile.readline() for i in range(count): templine = list(line) if templine[0] == ";" or templine[0] == " " or len(templine) < 10: line = inputfile.readline() continue elif (line.find("[") != -1): break else: linesplit = line.split() subc_params.append(linesplit[4:7]) subc_names.append(linesplit[0]) line = inputfile.readline() if (line.find("[SUBAREAS]") != -1): line = inputfile.readline() for i in range(count): templine = list(line) if templine[0] == ";" or templine[0] == " " or len(templine) < 10: line = inputfile.readline() continue elif (line.find("[") != -1): break else: linesplit = line.split() subarea_params.append(linesplit[1:6]) line = inputfile.readline() inputfile.close() #Part of the function that experiments with np array. Potentially removes the need for the list transformation # functions that chew up a lot of time. Each subcatchment has a row, each parameter type has a column. global subcatchment_parameters_np subcatchment_parameters_np = np.empty((len(subc_params[0]) + len(subarea_params[0]), len(subc_params)), dtype=float) for row in range(len(subc_params)): for col in range(len(subc_params[0])): subcatchment_parameters_np[row, col] = float(subc_params[row][col]) for row in range(len(subarea_params)): for col in range(len(subarea_params[0])): subcatchment_parameters_np[row, col + len(subc_params[0])] = float(subarea_params[row][col]) #Old string code # for i in range(len(subc_params)): # for j in range(len(subarea_params[i])): # subc_params[i].append(subarea_params[i][j]) # subcatchment_parameters.append(subc_params[i]) return(np_subcatchment_parameters)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subcatch(ini_file='subcatch.ini'):\n config.read(ini_file)\n print 'Read the file ', ini_file\n\n file_in = config.get('file_in', 'file_in')\n\n file_out = config.get('file_out', 'file_out')\n\n picture_out = config.get('picture_out', 'picture_out')\n\n Xoutlet = config.getfloat('coord_outlet...
[ "0.58298117", "0.5741129", "0.5640352", "0.54980344", "0.5496068", "0.5432148", "0.5394989", "0.53380096", "0.53087157", "0.5273573", "0.52647877", "0.5246655", "0.5224779", "0.5212376", "0.52076614", "0.5198927", "0.5182285", "0.5177914", "0.5172997", "0.5172781", "0.516248"...
0.7251039
0
Old string code that takes any 2D list and maps it to a 1D list by adding each subsequent row to the end of the first row
def transformation_flatten(twoDlistinput): oneDlistoutput = [] for i in range(len(twoDlistinput)): for j in range(len(twoDlistinput[i])): oneDlistoutput.append(twoDlistinput[i][j]) return(oneDlistoutput)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_row(lst, is_collocation):\n split_list = lst[0].split(\"\\t\")\n if is_collocation:\n return [split_list[0] + \" \" + split_list[1], \"1\"]\n return [split_list[0] + \" \" + split_list[1], \"0\"]", "def transpose(str_list):\n # takes list of strings of dimensions n x m\n if (n :...
[ "0.66831225", "0.6467971", "0.6433592", "0.62176746", "0.61118764", "0.59531605", "0.59194076", "0.5904703", "0.5842135", "0.58245844", "0.5760106", "0.57579666", "0.573827", "0.5714012", "0.5692371", "0.569116", "0.56879634", "0.56724775", "0.56658834", "0.5663291", "0.56433...
0.576872
10
Converts Penn Treebank tags to WordNet.
def penn2morphy(penntag): morphy_tag = {'NN':'n', 'JJ':'a', 'VB':'v', 'RB':'r'} try: return morphy_tag[penntag[:2]] except: return 'n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def penn_to_wn(self,tag):\n if tag.startswith('N'):\n return 'n'\n \n if tag.startswith('V'):\n return 'v'\n \n if tag.startswith('J'):\n return 'a'\n \n if tag.startswith('R'):\n return 'r'\n \n return None", "def pen...
[ "0.6572314", "0.65697056", "0.65697056", "0.64920396", "0.6471394", "0.64376074", "0.64255834", "0.64045995", "0.6399852", "0.6393718", "0.6372048", "0.6361967", "0.63461703", "0.6333776", "0.6136483", "0.60728174", "0.60711044", "0.6015081", "0.60002613", "0.58672816", "0.57...
0.5299345
36
Make API request with given params. Signs the request with secret key.
def request(self, params): params["public_key"] = self.__PUBLIC_KEY post_data = urllib.parse.urlencode(params) hmac_ = hmac.new(self.__SECRET_KEY, post_data.encode("utf-8"), hashlib.sha256).hexdigest() curl = pycurl.Curl() curl.setopt(pycurl.URL, self.__URL) curl.setopt(pycurl.HTTPHEADER, ['HMAC: ' + str(hmac_)]) curl.setopt(pycurl.POST, True) curl.setopt(pycurl.POSTFIELDS, post_data) curl.setopt(pycurl.CONNECTTIMEOUT, 10) curl.setopt(pycurl.TIMEOUT, 5) buf = io.BytesIO() curl.setopt(pycurl.WRITEFUNCTION, buf.write) curl.perform() response = buf.getvalue() # Uncomment to debug raw JSON response # self.__log("< " + response) http_code = curl.getinfo(pycurl.HTTP_CODE) curl.close() result = json.loads(response.decode('utf-8')) if http_code != 200: if result["error"]: # 404 with some valid JSON self.__log("ERROR: HTTP " + str(http_code) + ": " + json.dumps(result["error"])) else: self.__log("ERROR: HTTP " + str(http_code) + ": " + response) else: if result is None: self.__log("ERROR: Unparsable JSON " + response) else: if 'error' in result: # || !$result["result"] self.__log("ERROR: " + json_encode(result["error"])) else: result = result["result"] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_signed_call(self, api_endpoint, params):\r\n if (not self.secret) or (not self.secret.know_secret()):\r\n self.debug(\"### don't know secret, cannot call %s\" % api_endpoint)\r\n return\r\n\r\n key = self.secret.key\r\n sec = self.secret.secret\r\n\r\n if ...
[ "0.7493004", "0.69957143", "0.6800038", "0.6760122", "0.67544", "0.672769", "0.67007923", "0.6548487", "0.6517478", "0.649527", "0.63868725", "0.6383492", "0.6381418", "0.6370356", "0.63326025", "0.6278101", "0.62663436", "0.62406445", "0.6220862", "0.6220461", "0.6168506", ...
0.69033766
2
Monitor stats for all the rigs
def getCurrentStats(self): params = { 'method': 'getCurrentStats' } stats = self.request(params) if 'error' in stats: return False return stats
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitor(self, rms):\n pass", "def monitor(self):", "def _calc_stats(self):\n\n for res in self.rsts:\n _LOG.info(\"Calculate statistics for '%s'\", res.reportid)\n res.calc_stats(regexs=self._stats_colnames, funcnames=self._stats_funcs)", "def refresh_stats(self) -> No...
[ "0.6406339", "0.63248503", "0.615353", "0.60156983", "0.5939783", "0.58072263", "0.57075703", "0.56916606", "0.5660787", "0.56502295", "0.56461763", "0.5633014", "0.55788845", "0.54534495", "0.5422858", "0.54086626", "0.54054075", "0.53678644", "0.5366866", "0.53413457", "0.5...
0.0
-1
Sets parameters for rigs rig_ids_str coma separated string with rig ids "1,2,3,4" miner Miner to set. Leave it null if you do not want to change. "claymore", "claymorez", "ewbf", ... miner2 Second miner to set. Leave it null if you do not want to change. "0" if you want to unset it. id_wal ID of wallet. Leave it null if you do not want to change. id_oc ID of OC profile. Leave it null if you do not want to change. bool|mixed
def multiRocket(self, rig_ids_str, miner, miner2, id_wal, id_oc): if rig_ids_str is not None: self.log("Rigs ids required") exit() params = { 'method': 'multiRocket', 'rig_ids_str': rig_ids_str, 'miner': miner, 'miner2': miner2, 'id_wal': id_wal, 'id_oc': id_oc } result = self.request(params) if 'error' in result: return False return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sids(self, sids):\n self._sids = sids\n # encode sids in RGB\n r = sids // 256**2\n rem = sids % 256**2 # remainder\n g = rem // 256\n b = rem % 256\n self.rgbsids = np.zeros((self.npoints, 3), dtype=np.uint8)\n self.rgbsids[:, 0] = r\n self.rg...
[ "0.50190747", "0.50190747", "0.4670787", "0.45393595", "0.45045197", "0.44899312", "0.44867754", "0.4224754", "0.42206508", "0.4202021", "0.4202021", "0.41952497", "0.41925597", "0.41226864", "0.41184327", "0.40634874", "0.40553337", "0.40470064", "0.40200716", "0.40155357", ...
0.6751865
0
Dump utils image template.py as a Dict. The key is like "simnet/lndbtc"
def _dump_template(self, utils_image) -> Dict[str, str]: cmd = f"docker run -i --rm --entrypoint python {utils_image}" p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT) out, _ = p.communicate(input=SCRIPT.encode()) output = out.decode() if p.returncode != 0: self._logger.error("Failed to dump %s template.py\n%s", utils_image, output) raise RuntimeError("Failed to dump %s template.py" % utils_image) lines = output.splitlines() result = {} for line in lines: key, value = line.split() result[key] = value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _driver_template_data(self):\n return {\n 'driver_module': self.driver_modulename(),\n 'file': self.driver_relative_path(),\n 'author': self.metadata.author,\n 'driver_name': self.metadata.driver_name,\n 'driver_path': self.metadata.driver_path,\n ...
[ "0.5737873", "0.55475605", "0.5534782", "0.5529993", "0.55225337", "0.55086523", "0.5487717", "0.54603654", "0.545359", "0.54374003", "0.53441983", "0.53371257", "0.5325836", "0.5310178", "0.530841", "0.5289318", "0.5286247", "0.52432984", "0.5220684", "0.5216042", "0.5184362...
0.7714567
0
Update the doubleQ method, i.e. make sure to select actions a' using self.Q but evaluate the Qvalues using the target network (see slides). In other words, > self.target(s) is a Qfunction network which evaluates
def experience_replay(self): s,a,r,sp,done = self.memory.sample(self.batch_size) # TODO: 5 lines missing. raise NotImplementedError("") self.Q.fit(s, target=target)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learn(self):\n if self.learn_step_counter % self.target_q_update_step == 0:\n self.target_net.load_state_dict(self.eval_net.state_dict()) #update target_net's parameters\n logging.info(\"updtate target q\")\n self.learn_step_counter += 1\n\n rgbs,depths, rgbs_1, dept...
[ "0.6463897", "0.6316078", "0.61735415", "0.61302334", "0.611619", "0.6111125", "0.60791606", "0.605653", "0.60473", "0.60191995", "0.6005732", "0.59470886", "0.59439164", "0.59313065", "0.5930287", "0.59225607", "0.5906226", "0.5905362", "0.5883166", "0.58092326", "0.5794577"...
0.0
-1
Sending data through a queue
def send_message(self, data): self.agent_msg_queue.put(data) self._send_counter += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_msg(self, my_queue, my_msg):", "def send_data(queue, data):\n for obj in data:\n queue.put(dumps(obj, protocol=-1))", "def add_to_send_queue(self, data):\n if self.socket is not None:\n self.send_queue.put(data)", "def send_message(data):\n if data is not None:\n ...
[ "0.7874383", "0.7698461", "0.7406423", "0.7342643", "0.7194812", "0.7130858", "0.7115332", "0.7114572", "0.7103772", "0.70748067", "0.70712423", "0.70644194", "0.69962597", "0.6987004", "0.6939428", "0.6920469", "0.6905456", "0.68996507", "0.68771124", "0.68152535", "0.680416...
0.6878409
18
Send detection data and return status
def send_detection_data(self, image_width, image_height, image, detection_result): if self._send_buffer.full() is True: log_error("Send detection data failed for buffer is full") return False image_data = None if isinstance(image, AclImage): image_data = DataBuf(image.data(), image.size).copy_to_local() elif isinstance(image, np.ndarray): image_data = image else: log_error("Invalid data to send") return False request_msg = pm.image_frame_request(image_width, image_height, image_data.tobytes(), detection_result) self.send_message(request_msg) self._send_buffer.put(image_data) self._release_send_success_data() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_image(self, image_width, image_height, image):\n detection_result = []\n return self.send_detection_data(image_width, image_height, image, detection_result)", "def test_http_classifier(self):\n \n msg = \"\"\n \n files = 0\n tp = 0\n fp = 0\n ...
[ "0.6287213", "0.6152359", "0.60468817", "0.57658076", "0.5763883", "0.56264436", "0.5618451", "0.56042737", "0.5574418", "0.5567113", "0.5565702", "0.55625457", "0.55605626", "0.553324", "0.5526417", "0.5485286", "0.5476039", "0.54632705", "0.5459137", "0.54455686", "0.543737...
0.6724717
0
send detection image data
def send_image(self, image_width, image_height, image): detection_result = [] return self.send_detection_data(image_width, image_height, image, detection_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_detection_data(self, image_width, image_height,\n image, detection_result):\n if self._send_buffer.full() is True:\n log_error(\"Send detection data failed for buffer is full\")\n return False\n\n image_data = None\n if isinstance(image...
[ "0.7168172", "0.6857813", "0.6741724", "0.65148985", "0.64819443", "0.64530796", "0.64069283", "0.6382538", "0.6379917", "0.633284", "0.6293329", "0.6292463", "0.6283481", "0.6194607", "0.6180911", "0.617084", "0.61642075", "0.61596763", "0.615218", "0.61351126", "0.6130977",...
0.7531366
0
get channel presenter_server_ip, port, channel_name, content_type
def get_channel_config(config_file): config = configparser.ConfigParser() config.read(config_file) presenter_server_ip = config['baseconf']['presenter_server_ip'] port = int(config['baseconf']['presenter_server_port']) channel_name = config['baseconf']['channel_name'] content_type = int(config['baseconf']['content_type']) log_info("presenter server ip %s, port %d, channel name %s, " "type %d " % (presenter_server_ip, port, channel_name, content_type)) return presenter_server_ip, port, channel_name, content_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getChannel(self):\r\n return self.channel", "def get_channel(channel_id):\r\n if channel_id[0] == 'C':\r\n type = \"channel\"\r\n elif channel_id[0] == 'G':\r\n type = \"group\"\r\n elif channel_id[0] == 'D':\r\n return False\r\n else:\r\n return False\r\n da...
[ "0.65134233", "0.643602", "0.6210229", "0.619519", "0.6009834", "0.5932588", "0.58862126", "0.58620787", "0.5847913", "0.5847913", "0.584146", "0.58371985", "0.58296996", "0.5799957", "0.57254803", "0.57109845", "0.57049286", "0.5669257", "0.5649315", "0.5622001", "0.5602927"...
0.74030155
0
according to config open channel
def open_channel(config_file): server_ip, port, channel_name, content_type = get_channel_config(config_file) channel = PresenterChannel(server_ip, port, channel_name, content_type) ret = channel.startup() if ret: log_error("ERROR:Open channel failed") return None return channel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_channel(self) -> int:\r\n ...", "def open_channel(self):\n # LOGGER.info('Creating a new channel')\n self._connection.channel(on_open_callback=self.on_channel_task_open)\n self._connection.channel(on_open_callback=self.on_channel_ctrl_open)", "def channel_open(self):\n ...
[ "0.6495685", "0.6411523", "0.6357903", "0.6315835", "0.6212122", "0.6187699", "0.6173837", "0.61588097", "0.61560345", "0.6084364", "0.60564893", "0.60467905", "0.60155", "0.6004395", "0.5985936", "0.59202945", "0.58966035", "0.58927876", "0.5869291", "0.5857404", "0.5834471"...
0.5856543
20
Dial a model defined in Swagger
def __init__(self, caller=None, dialstatus=None, dialstring=None, forward=None, forwarded=None, peer=None): # noqa: E501 # noqa: E501 self._caller = None self._dialstatus = None self._dialstring = None self._forward = None self._forwarded = None self._peer = None self.discriminator = None if caller is not None: self.caller = caller self.dialstatus = dialstatus if dialstring is not None: self.dialstring = dialstring if forward is not None: self.forward = forward if forwarded is not None: self.forwarded = forwarded self.peer = peer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opt_model_create_rest_api():\n request_json = request.get_json()\n OptimModelRequestAPI(request_json).validate()\n return create_model_data(request_json)", "def openapi(self) -> api.OpenAPISpec:\n return self._get_model(model=api.OpenAPISpec)", "def swagger_definition(self, base_path=None, ...
[ "0.6751859", "0.633995", "0.63148445", "0.6260051", "0.6195077", "0.6152982", "0.5982219", "0.59721094", "0.59506464", "0.5930559", "0.5904223", "0.5891059", "0.5891059", "0.5891059", "0.5891059", "0.5891059", "0.58744615", "0.5842159", "0.58389103", "0.5817477", "0.5785608",...
0.0
-1
Sets the caller of this Dial.
def caller(self, caller): self._caller = caller
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_scripts_caller(self, caller):\n self._scripts_caller = caller", "def sender(self, sender):\n\n self._sender = sender", "def sender(self, sender):\n\n self._sender = sender", "def sender(self, sender):\n\n self._sender = sender", "def sender(self, sender):\n\n self...
[ "0.5862553", "0.55642617", "0.55642617", "0.55642617", "0.55642617", "0.55642617", "0.55458647", "0.52504754", "0.52443874", "0.5207483", "0.5065583", "0.5034338", "0.50276506", "0.50047404", "0.5002639", "0.49828595", "0.49691632", "0.49691632", "0.49691632", "0.49691632", "...
0.74337715
0
Sets the dialstatus of this Dial.
def dialstatus(self, dialstatus): if dialstatus is None: raise ValueError("Invalid value for `dialstatus`, must not be `None`") # noqa: E501 self._dialstatus = dialstatus
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def setstatus(self, status):\n with self.lock:\n self.status = status", "def SetStatus(self, status)...
[ "0.6324947", "0.6324947", "0.6324947", "0.62151617", "0.6139082", "0.6040312", "0.6012847", "0.60080004", "0.5966004", "0.59111637", "0.5868122", "0.5861913", "0.58358765", "0.58328503", "0.58328503", "0.58328503", "0.58328503", "0.58328503", "0.58328503", "0.58328503", "0.58...
0.8169267
0
Sets the dialstring of this Dial.
def dialstring(self, dialstring): self._dialstring = dialstring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_value(self, string_value):\n\n self._string_value = string_value", "def setString(self, name: unicode, value: unicode) -> None:\n ...", "def setstring(self):\n self._str = 's '+' '.join([self.src, self.start, self.size,\n self.strand, self.srcSi...
[ "0.5384727", "0.5367918", "0.52513164", "0.5229012", "0.5229012", "0.51429296", "0.4930052", "0.49152938", "0.48876902", "0.48603123", "0.48325157", "0.47601306", "0.47166997", "0.46935034", "0.46845663", "0.46628696", "0.46405885", "0.4633442", "0.4625754", "0.46073928", "0....
0.8753864
0
Sets the forward of this Dial.
def forward(self, forward): self._forward = forward
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward( self ):\n self._has_change = True\n print( \"Forward\" )", "def fastforward(self):\n self.run_command('fastforward')", "def forward(self):\n self.cursor.forward()", "def forward(self):\n pass", "def forward(self):\n pass", "def go_forward(self):\n ...
[ "0.6834646", "0.67426616", "0.6636892", "0.64269316", "0.64269316", "0.6326287", "0.62784827", "0.62357396", "0.62272525", "0.62225056", "0.6159911", "0.6145522", "0.6091365", "0.6059019", "0.6059019", "0.6059019", "0.60449684", "0.60174173", "0.5994386", "0.5994386", "0.5978...
0.7644515
0
Sets the forwarded of this Dial.
def forwarded(self, forwarded): self._forwarded = forwarded
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, forward):\n\n self._forward = forward", "def forwarder(self, forwarder: ICNForwarder):\n self._forwarder = forwarder", "def forward(self):\n pass", "def forward(self):\n pass", "def forward( self ):\n self._has_change = True\n print( \"Forward\" )...
[ "0.6887666", "0.6606515", "0.6383124", "0.6383124", "0.62122256", "0.60811234", "0.594021", "0.5932288", "0.5932288", "0.5932288", "0.581016", "0.5741199", "0.57171863", "0.56688905", "0.5637646", "0.5620836", "0.5603269", "0.5560376", "0.5535223", "0.5532661", "0.5506793", ...
0.81721765
0
Sets the peer of this Dial.
def peer(self, peer): if peer is None: raise ValueError("Invalid value for `peer`, must not be `None`") # noqa: E501 self._peer = peer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPeer (self, peer):\n\t\tself.peer = peer", "def setPeerToPeerNetwork(self, peerToPeerNetwork):\r\n raise NotImplementedError()", "def peer(self, value: Optional[MicrobitPeer]) -> None:\n if self.__peer is not None:\n self.__peer.remove_listener(self.__execute)\n\n if valu...
[ "0.83918417", "0.67424357", "0.6415004", "0.60654163", "0.5945206", "0.5834176", "0.5686866", "0.5547047", "0.54729116", "0.54373324", "0.54167396", "0.53934383", "0.5380653", "0.5360441", "0.5354226", "0.53020024", "0.5296971", "0.5267418", "0.52219296", "0.52138495", "0.517...
0.7684957
1
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value if issubclass(Dial, dict): for key, value in self.items(): result[key] = value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85849506", "0.78144926", "0.7789918", "0.77506983", "0.77506983", "0.7712724", "0.7699126", "0.76694965", "0.7650795", "0.7600532", "0.7582587", "0.75700307", "0.75406003", "0.7523009", "0.7515774", "0.75006944", "0.74870557", "0.74870557", "0.7468478", "0.74514323", "0.74...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Dial): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.808826", "0.808826", "0.8054592", "0.79827315", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Provide video codec vcodec = "h264" acodec = "copy" extra = "" split_cmd = "ffmpeg i '%s' vcodec %s acodec %s y %s" % (file_path, vcodec, acodec, extra) s_cmd = " i '%s' vcodec %s acodec %s"%(file_path, vcodec, acodec)
def split_video_random(file_path, start_pos, split_length, out_path): s_cmd = " -i '%s'"%(file_path) #use default CODEC try: fileext = file_path.split(".")[-1] except IndexError as e: raise IndexError("No ext. in filename. Error: " + str(e)) split_start = start_pos split_length = split_length head, tail = os.path.split(file_path) name, ext = tail.split('.') filebase=name+'_'+str(start_pos)+'-'+str(split_length) dstfilebase = out_path + '/' + filebase # create output file base #split_str = "" #split_str += " -ss " + str(split_start) + " -t " + str(split_length) + " '"+ dstfilebase + "." + fileext + "'" s_str = "" #s_str += "ffmpeg"+" -ss "+str(split_start)+" -t "+str(split_length) + s_cmd + " '"+dstfilebase + "." + fileext + "'" s_str += "ffmpeg" + " -ss " + str(split_start) + s_cmd + " -t " + str(split_length) + " '"+ dstfilebase + "." + fileext + "'" print("########################################################") #print "About to run: "+split_cmd+split_str print("About to run: "+s_str) print("########################################################") #output = subprocess.Popen(split_cmd+split_str, shell = True, stdout = subprocess.PIPE).stdout.read() output = subprocess.Popen(s_str, shell=True, stdout=subprocess.PIPE).stdout.read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_by_manifest(filename, manifest, vcodec=\"copy\", acodec=\"copy\",\n extra=\"\", **kwargs):\n if not os.path.exists(manifest):\n raise SystemExit\n\n with open(manifest) as manifest_file:\n manifest_type = manifest.split(\".\")[-1]\n if manifest_type == \"js...
[ "0.67609626", "0.6545024", "0.64391136", "0.6160051", "0.6078338", "0.60496306", "0.6016545", "0.6010689", "0.5968558", "0.59620136", "0.5842451", "0.583345", "0.5804066", "0.5784901", "0.5773912", "0.5729956", "0.56486654", "0.56443024", "0.5613024", "0.5551656", "0.54755616...
0.6554189
1
Verifies credentials for username and password. Returns None on success or a string describing the error on failure Adapt to your needs
def check_credentials(username, password): LDAP_SERVER = 'ldap://172.24.1.102:389' # fully qualified AD user name LDAP_USERNAME = '%s' % username # your password LDAP_PASSWORD = password base_dn = 'DC=LGE,DC=NET' ldap_filter = 'userPrincipalName=%s' % username attrs = ['memberOf'] #print "entered username : %s " % username #print "entered password : %s " % password try: # build a client ldap_client = ldap.initialize(LDAP_SERVER) #print ldap_client # perform a synchronous bind ldap_client.set_option(ldap.OPT_REFERRALS,0) ldap_client.simple_bind_s(LDAP_USERNAME, LDAP_PASSWORD) except ldap.INVALID_CREDENTIALS: ldap_client.unbind() return 'Wrong username or password' except ldap.SERVER_DOWN: return 'AD server not available' # all is well ldap_client.unbind() return "success"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_auth_password(self, username, password):\n return AUTH_FAILED", "def check_credentials(username, password):\n\t\n\tconn = sqlite3.connect('db/user_task.db')\n\tcursor = conn.execute(\"SELECT password from user WHERE username == \\'%s\\'\" % (username))\n\tdata = cursor.fetchall()\n\tconn.close()...
[ "0.7673481", "0.7532174", "0.74800336", "0.7391194", "0.7332672", "0.72637135", "0.72405916", "0.7238133", "0.7238133", "0.7210242", "0.7194319", "0.71895075", "0.7168887", "0.71352327", "0.712828", "0.71126574", "0.71101016", "0.7096003", "0.70950186", "0.7062774", "0.705137...
0.0
-1
Initialize component which does the ligand depiction. If Nones is provided as parameters just the defalt RDKit functionality is going to be used.
def __init__( self, pubchem_templates_path: str = "", general_templates_path: str = config.general_templates, ) -> None: self.coordgen_params = rdCoordGen.CoordGenParams() self.coordgen_params.coordgenScaling = 50 / 1.5 self.coordgen_params.templateFileDir = config.coordgen_templates self.pubchem_templates = ( pubchem_templates_path if os.path.isdir(pubchem_templates_path) else "" ) self.templates: Dict[str, rdkit.Chem.rdchem.Mol] = OrderedDict() if os.path.isdir(general_templates_path): for k in sorted(os.listdir(general_templates_path)): template = self._load_template(os.path.join(general_templates_path, k)) template_name = k.split(".")[0] self.templates[template_name] = template
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n self.ros.enable()\n self.phone_link.enable()", "def __init__(self, lbda=None, bandname=None, zp=None, \n mjd=None, empty=False,**kwargs):\n self.__build__()\n if empty:\n return\n prop = kwargs_update(dict(lbda=lbda, bandna...
[ "0.56644416", "0.5561239", "0.55297834", "0.54553896", "0.5450353", "0.5445349", "0.5430579", "0.5426074", "0.54253256", "0.5354728", "0.53483224", "0.5339778", "0.5335766", "0.5325919", "0.5325185", "0.5315453", "0.52921635", "0.52817094", "0.52803695", "0.5268682", "0.52672...
0.0
-1
Given input molecule tries to generate its depictions.
def depict_molecule( self, het_id: str, mol: rdkit.Chem.rdchem.Mol ) -> DepictionResult: temp_mol = Chem.RWMol(mol) templateMol = Chem.RWMol(temp_mol).GetMol() pubchemMol = Chem.RWMol(temp_mol).GetMol() rdkitMol = Chem.RWMol(temp_mol).GetMol() results = [] pubchem_res = ( self._get_2D_by_pubchem(het_id, pubchemMol) if self.pubchem_templates else None ) template_res = self._get_2D_by_template(templateMol) if self.templates else [] rdkit_res = self._get_2D_by_rdkit(rdkitMol) if pubchem_res is not None: results.append(pubchem_res) if rdkit_res is not None: results.append(rdkit_res) results = results + template_res results.sort(key=lambda l: (l.score, l.source)) if results: to_return = results[0] fix_conformer(to_return.mol.GetConformer(0)) return to_return return DepictionResult( source=DepictionSource.Failed, template_name="", mol=None, score=1000 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sc2depictions(chromosome, root_name=\"output\", lot=0):\n mol_structure = sc2mol_structure(chromosome, lot=lot)\n mol2pdb(mol_structure, \"{0}.pdb\".format(root_name))\n mol2xyz(mol_structure, \"{0}.xyz\".format(root_name))\n Draw.MolToFile(mol_structure, \"{0}.png\".format(root_name))\n logger....
[ "0.6078832", "0.55234087", "0.5375857", "0.53457975", "0.5281195", "0.5259086", "0.5258982", "0.5205008", "0.5194316", "0.5151961", "0.5147367", "0.51438403", "0.51321965", "0.5130582", "0.5127317", "0.51114666", "0.51019084", "0.50857204", "0.50702864", "0.5066564", "0.50647...
0.4942241
28
Get path to the PubChem template if it exists.
def _get_pubchem_template_path(self, het_id): path = os.path.join(self.pubchem_templates, f"{het_id}.sdf") return path if os.path.isfile(path) else ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template_path(self):\n raise NotImplementedError()", "def template_path(self) -> str:\n return self._values.get(\"template_path\")", "def get_template(self, template):\n\n template_path = aj.config.data['email']['templates'].get(template, 'default')\n\n if template_path == '...
[ "0.6953855", "0.68982375", "0.68708664", "0.67688173", "0.65419143", "0.64124465", "0.63890076", "0.63717955", "0.6362928", "0.63347596", "0.6195259", "0.61605114", "0.61545146", "0.61206657", "0.6091912", "0.60857964", "0.60805887", "0.6065575", "0.60610527", "0.6056612", "0...
0.7834179
0
Loads a template molecule with 2D coordinates
def _load_template(self, path): mol = Chem.RWMol() extension = os.path.basename(path).split(".")[1] if extension == "sdf": mol = Chem.MolFromMolFile(path, sanitize=True, removeHs=True) elif extension == "pdb": mol = Chem.MolFromPDBFile(path, sanitize=True, removeHs=True) else: raise ValueError("Unsupported molecule type '{}'".format(extension)) p = Chem.AdjustQueryParameters() p.makeAtomsGeneric = True p.makeBondsGeneric = True mol = Chem.AdjustQueryProperties(mol, p) return mol
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_xyz(filename):\n periodic = load_periodic()\n #read molecule\n with open(filename) as f:\n size = int(next(f))\n title = next(f).strip()\n molecule = Molecule(title,size)\n for _ in range(size):\n row = next(f).split()\n tag = row[0]\n ...
[ "0.61214197", "0.57492346", "0.5670216", "0.5607972", "0.5434534", "0.5393163", "0.5368674", "0.53446394", "0.53130543", "0.53116614", "0.52955234", "0.5252723", "0.52483314", "0.5248229", "0.5230815", "0.5224649", "0.5208221", "0.52067053", "0.51932734", "0.51882654", "0.513...
0.54654664
4
Get depiction done using solely the default RDKit functionality.
def _get_2D_by_rdkit(self, mol): try: rdCoordGen.AddCoords(mol, self.coordgen_params) flaws = DepictionValidator(mol).depiction_score() return DepictionResult( source=DepictionSource.RDKit, template_name=None, mol=mol, score=flaws ) except Exception: return DepictionResult( source=DepictionSource.Failed, template_name=None, mol=None, score=1000 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_rd(self):\n return self.__rd", "def dl():\n raise NotImplementedError()", "def d(self):\n pass", "def d(self):\n pass", "def DM(self):", "def rd_dr(self, rd):\n # add bits for the bypassed devices\n tdi = bits.bits(rd.n + self.ndevs_before + self.ndevs_after)\n self....
[ "0.56659234", "0.5606022", "0.5375053", "0.5375053", "0.53526074", "0.5315714", "0.52649176", "0.5223769", "0.52229035", "0.5210231", "0.51464874", "0.50903726", "0.5070479", "0.5032436", "0.4937754", "0.4928767", "0.4920147", "0.49045533", "0.48884135", "0.48746234", "0.4869...
0.45862034
61
Depict ligand using Pubchem templates.
def _get_2D_by_pubchem(self, code, mol): try: template_path = self._get_pubchem_template_path(code) if template_path: template = self._load_template(template_path) if mol.HasSubstructMatch(template): AllChem.GenerateDepictionMatching2DStructure(mol, template) flaws = DepictionValidator(mol).depiction_score() return DepictionResult( source=DepictionSource.PubChem, template_name=code, mol=mol, score=flaws, ) except Exception as e: print(str(e), file=sys.stderr) return DepictionResult( source=DepictionSource.Failed, template_name=None, mol=None, score=1000 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_ligand_template(self, ligand_template: pd.Series) -> oechem.OEMolBase:\n from openeye import oechem\n\n from ..modeling.OEModeling import read_molecules, select_chain, select_altloc, remove_non_protein\n from ..utils import FileDownloader, LocalFileStorage\n\n logging.debug...
[ "0.5465929", "0.5270106", "0.50946057", "0.5082453", "0.5056115", "0.5039706", "0.5006837", "0.4973848", "0.49720326", "0.49520364", "0.4933591", "0.492104", "0.49198148", "0.4917505", "0.4915033", "0.49145043", "0.4857332", "0.4847261", "0.48379815", "0.48348796", "0.4830842...
0.0
-1
Depict ligand using userprovided templates
def _get_2D_by_template(self, mol): results = list() try: for key, template in self.templates.items(): temp_mol = Chem.RWMol(mol) if temp_mol.HasSubstructMatch(template): AllChem.GenerateDepictionMatching2DStructure(temp_mol, template) flaws = DepictionValidator(temp_mol).depiction_score() results.append( DepictionResult( source=DepictionSource.Template, template_name=key, mol=temp_mol, score=flaws, ) ) except Exception: # if it fails it fails, but generally it wont logging.warning("Depiction generation by template failed") return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_mrk():\n return render_template(\"l_markers.html\")", "def get_html(self):\r\n context = {\r\n 'display_name': self.display_name_with_default,\r\n 'instructions_html': self.instructions,\r\n 'annotation_storage': self.annotation_storage_url,\r\n ...
[ "0.5381906", "0.5355605", "0.5339362", "0.5280232", "0.5247648", "0.52295977", "0.52190715", "0.51928127", "0.51736635", "0.5143805", "0.5141572", "0.5127012", "0.50930816", "0.50833154", "0.50804555", "0.5062896", "0.5048909", "0.50279593", "0.50187063", "0.50133497", "0.501...
0.0
-1
True if two bonds collide, false otherwise. Note that false is retrieved even in case the bonds share common atom, as this is not a problem case. Cramer's rule is used for the linear equations system.
def _intersection(self, bondA, bondB): atoms = [ bondA.GetBeginAtom(), bondA.GetEndAtom(), bondB.GetBeginAtom(), bondB.GetEndAtom(), ] names = [a.GetProp("name") for a in atoms] points = [self.conformer.GetAtomPosition(a.GetIdx()) for a in atoms] vecA = Geometry.Point2D(points[1].x - points[0].x, points[1].y - points[0].y) vecB = Geometry.Point2D(points[3].x - points[2].x, points[3].y - points[2].y) # we need to set up directions of the vectors properly in case # there is a common atom. So we identify angles correctly # e.g. B -> A; B -> C and not A -> B; C -> B. if len(set(names)) == 3: angle = self.__get_angle(names, vecA, vecB) return angle < 10.0 # Cramer's rule to identify intersection det = vecA.x * -vecB.y + vecA.y * vecB.x if round(det, 2) == 0.00: return False a = points[2].x - points[0].x b = points[2].y - points[0].y detP = (a * -vecB.y) - (b * -vecB.x) p = round(detP / det, 3) if p < 0 or p > 1: return False detR = (vecA.x * b) - (vecA.y * a) r = round(detR / det, 3) if 0 <= r <= 1: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_bond_crossing(self):\n return self.count_bond_collisions() > 0", "def collide(b1,b2):\n if mag(b1.pos-b2.pos) < (b1.radius + b2.radius - .05):\n return True", "def accurate_collision(self, other) -> bool:\r\n if self.collide:\r\n if self.bbox_intersect(other):\r\n ...
[ "0.6964965", "0.6896832", "0.67123353", "0.6666151", "0.6524003", "0.6504052", "0.6484017", "0.6371618", "0.63714135", "0.62512064", "0.6232055", "0.62242526", "0.62045306", "0.6202152", "0.6201165", "0.6185181", "0.61452067", "0.6140926", "0.6111029", "0.60970056", "0.609508...
0.65765357
4
Get the size of the angle formed by two bonds which share common atom.
def __get_angle(self, names, vecA, vecB): pivot = max(names, key=names.count) if names[0] != pivot: # Atoms needs to be order to pick vectors correctly vecA = vecA * -1 if names[2] != pivot: vecB = vecB * -1 radians = vecA.AngleTo(vecB) angle = 180 / math.pi * radians return angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_length(self):\n return AtomMath.length(self.atom1.position - self.atom2.position)", "def _bond_dist(geom, a1, a2):\n if isinstance(geom, np.ndarray):\n geom = geom.flatten().tolist()\n a13 = a1 * 3\n a23 = a2 * 3\n\n xd = (geom[a13] - geom[a23])**2\n yd = (geom[a13 + 1] - ge...
[ "0.6803342", "0.6031538", "0.60075694", "0.58700997", "0.58499944", "0.58232963", "0.58183986", "0.57610923", "0.57447034", "0.57311267", "0.5706374", "0.5695668", "0.5695543", "0.56807685", "0.5657946", "0.5650897", "0.5618208", "0.5611929", "0.5603994", "0.55947745", "0.558...
0.0
-1
Detects whether the structure has a pair or atoms closer to each other than threshold. This can detect structures which may need a template as they can be handled by RDKit correctly.
def has_degenerated_atom_positions(self, threshold): for i in range(0, len(self.conformer.GetNumAtoms())): center = self.conformer.GetAtomPosition(i) point = [center.x, center.y, center.z] surrounding = self.kd_tree.query_ball_point(point, threshold) if len(surrounding) > 1: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_closest_threshold(x: float, y: float, rw_info: pd.DataFrame) -> Tuple[int, int, int]:\n\n min_dist = CONTROL_ZONE_RADIUS\n min_ind = (0, 0, 0)\n\n for ind in rw_info.index:\n\n hp_x = rw_info[0][ind]\n hp_y = rw_info[1][ind]\n\n dist1 = np.sqrt((x - hp_x) ** 2 + (y - hp_y) **...
[ "0.5863067", "0.57756513", "0.56205285", "0.55818784", "0.54911447", "0.5490294", "0.5413528", "0.5393008", "0.53929734", "0.5383899", "0.5383543", "0.5363858", "0.533649", "0.5334817", "0.53021765", "0.5235089", "0.5234669", "0.52207446", "0.52092874", "0.52092874", "0.52015...
0.54279095
6
Detects whether the structure has a pair or atoms in the range meaning that the depiction could be improved.
def count_suboptimal_atom_positions(self, lowerBound, upperBound): counter = 0 for i in range(self.conformer.GetNumAtoms()): center = self.conformer.GetAtomPosition(i) point = [center.x, center.y, center.z] surroundingLow = self.kd_tree.query_ball_point(point, lowerBound) surroundingHigh = self.kd_tree.query_ball_point(point, upperBound) if len(surroundingHigh) - len(surroundingLow) > 0: counter += 1 return counter / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isRangeValid(self) -> bool:\n ...", "def check_unibranch_validity(pair, positions, intersection):\n assert(intersection is not None)\n check = []\n for par in pair:\n b = 0\n pos = positions[par-1]\n for branch in intersection:\n b +=1\n for tup in b...
[ "0.61594635", "0.59847325", "0.58420426", "0.58221036", "0.58218324", "0.5720427", "0.5718489", "0.57073534", "0.5707279", "0.568753", "0.5665801", "0.5664754", "0.56299406", "0.5600717", "0.55935943", "0.55612284", "0.55557734", "0.5544614", "0.5533591", "0.5522513", "0.5516...
0.0
-1
Counts number of collisions among all bonds. Can be used for estimations of how 'wrong' the depiction is.
def count_bond_collisions(self): errors = 0 for i in range(0, len(self.bonds)): for a in range(i + 1, len(self.bonds)): result = self._intersection(self.bonds[i], self.bonds[a]) if result: errors += 1 return errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_bonds(self):\n n = 0\n for bond in self.iter_bonds():\n n += 1\n return n", "def count_bonds(self):\n n = 0\n for bond in self.iter_bonds():\n n += 1\n return n", "def get_collisions(self) -> int:\n if len(self.obstacles) == 0:\n ...
[ "0.6844145", "0.6844145", "0.68411255", "0.68388706", "0.67286265", "0.66780823", "0.64739144", "0.62883806", "0.6247389", "0.62287146", "0.61868566", "0.617473", "0.6031441", "0.60012114", "0.5952148", "0.5952148", "0.5926391", "0.5919017", "0.5828075", "0.5818269", "0.58110...
0.7136189
0
Tells if the structure contains collisions
def has_bond_crossing(self): return self.count_bond_collisions() > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collision_check(self):\n return True", "def check_collisions(self):", "def validate_collision(self):\n pass", "def _check_for_collision(self, sample):\n collide=False\n for i in range(len(self.obstacles)):\n collide=collide or self.obstacles[i].in_collision(sample)\...
[ "0.80110776", "0.7117187", "0.69468826", "0.69385827", "0.69306934", "0.6928933", "0.6904321", "0.6890036", "0.6859777", "0.681465", "0.6788974", "0.6769276", "0.67647177", "0.6714456", "0.6694013", "0.66029567", "0.6584946", "0.6561978", "0.65351593", "0.6516069", "0.6511501...
0.590947
88
Calculate quality of the ligand depiction. The higher the worse. Ideally that should be 0.
def depiction_score(self): collision_penalty = 1 degenerated_penalty = 0.4 bond_collisions = self.count_bond_collisions() degenerated_atoms = self.count_suboptimal_atom_positions(0.0, 0.5) score = ( collision_penalty * bond_collisions + degenerated_penalty * degenerated_atoms ) return round(score, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quality(self) -> float:\n if self.get_cover_size() == 0:\n return 0\n else:\n if self.baseline == Baseline.COMPLEMENT:\n return self.__complement_quality()\n else:\n return self.__population_quality()", "def quality(self) -> int:\n ...
[ "0.66823983", "0.6546814", "0.65287745", "0.6406672", "0.6386629", "0.6259903", "0.6180249", "0.6049594", "0.6018899", "0.5956084", "0.58994746", "0.5833759", "0.57996166", "0.5788256", "0.57742614", "0.5768054", "0.57475317", "0.5742199", "0.5725896", "0.57138395", "0.567269...
0.0
-1
Get batch generator `batch_generator` must define a `shape` property that returns the shape of generated sequences as a (n_samples, n_features) tuple. `batch_generator` must define a method called `get_steps_per_epoch` with the signature `def get_steps_per_epoch(self, protocol, subset)` that returns the number of batches to generate before ending an epoch. `batch_generator` may optionally define a method called `callbacks` with the signature `def callbacks(self, extract_embedding=None)` that is expected to return a list of Keras callbacks that will be added to the list of callbacks during training. This might come in handy in case the `batch_generator` depends on the internal state of the model currently being trained.
def get_generator(self, file_generator, batch_size=None, **kwargs): raise NotImplementedError('')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_generator(self, generator: \"DataGenerator\", nb_epochs: int = 20, **kwargs) -> None:\n raise NotImplementedError", "def gen_batch(self):\n batch_size = self.batch_size\n shuffle = self.shuffle\n data = np.array(self.sentences)\n\n data_size = len(data)\n num_bat...
[ "0.62859094", "0.627278", "0.6238411", "0.6231443", "0.61449736", "0.6116078", "0.6102709", "0.6071425", "0.6071153", "0.60535413", "0.60365564", "0.6031602", "0.60167223", "0.59738314", "0.5962088", "0.59487414", "0.59423554", "0.5910736", "0.5903543", "0.5894708", "0.586065...
0.6673094
0
Design the model for which the loss is optimized
def build_model(self, input_shape, design_embedding, **kwargs): return design_embedding(input_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model(self):\n self.g12 = G12(conv_dim=self.g_conv_dim)\n init_weights(self.g12, init_type='normal')\n self.g21 = G21(conv_dim=self.g_conv_dim)\n init_weights(self.g21, init_type='normal')\n self.d1 = D1(conv_dim=self.d_conv_dim, use_labels=self.use_labels)\n ini...
[ "0.70582205", "0.69713557", "0.68715394", "0.68682396", "0.675125", "0.66826314", "0.6662389", "0.6640771", "0.6632258", "0.6623443", "0.662218", "0.6608138", "0.66036206", "0.6591534", "0.65909654", "0.65843874", "0.65824467", "0.6580098", "0.657169", "0.65641236", "0.656231...
0.0
-1
Extract embedding from internal Keras model
def extract_embedding(self, from_model): return from_model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gensim_to_keras(model):\n return model.wv.get_keras_embedding()", "def get_embedding(self, model):\n embedding = []\n for node in range(len(self.graph.nodes())):\n embedding.append(list(model[str(node)]))\n embedding = np.array(embedding)\n return embedding", "def ...
[ "0.7617932", "0.7358305", "0.7260656", "0.70529824", "0.70419127", "0.6889344", "0.6849663", "0.681078", "0.6796582", "0.67891294", "0.6745876", "0.66203314", "0.6616796", "0.659487", "0.6581204", "0.65696263", "0.6557681", "0.6531176", "0.649195", "0.6473366", "0.6431787", ...
0.77565044
0
Get a logger that produces reasonable output.
def _get_logger(): logger = logging.getLogger(__name__) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter("%(asctime)s [%(levelname)8s] %(message)s")) logger.addHandler(ch) logger.setLevel(logging.DEBUG) return logger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logger(name=\"unknown_logger\"):\n logger = logging.getLogger(name)\n logger.setLevel(logging.DEBUG)\n handler = logging.StreamHandler(sys.stdout)\n handler.setLevel(logging.DEBUG)\n handler.setFormatter(FORMATTER)\n logger.addHandler(handler)\n logger.propagate = False # to avoid pri...
[ "0.76173455", "0.73903525", "0.7385359", "0.73532313", "0.72620827", "0.7261054", "0.7208833", "0.72087556", "0.7140604", "0.7138828", "0.7128172", "0.71156687", "0.7111992", "0.7104806", "0.70627075", "0.70546305", "0.70511794", "0.7048386", "0.70350707", "0.7021459", "0.699...
0.76066315
1
Find the first time a running sum repeats
def find_repeating_frequency(values): frequencies = set([0]) index = 0 frequency = 0 while True: found = False for value in values: frequency += value index += 1 if frequency in frequencies: found = True break frequencies.add(frequency) if found: break return frequency
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FirstRepeatingFrequency(self):\n prev_freqs = {0}\n freq = 0\n for offset in cycle(self.freq_changes):\n freq += offset\n if freq in prev_freqs:\n return freq\n else:\n prev_freqs.add(freq)", "def take_first(nums):\n take=...
[ "0.6377952", "0.6170564", "0.61421", "0.5981056", "0.5942517", "0.5867513", "0.5838692", "0.58114886", "0.58026123", "0.5784409", "0.5751145", "0.5738505", "0.56759614", "0.56725645", "0.56579083", "0.5624306", "0.55687976", "0.55209714", "0.5511702", "0.5495576", "0.54878193...
0.57920206
9
import count or FPKM table
def import_countOrFPKMTable( self,filename_I): #import and format the data io = base_importData(); io.read_tab(filename_I); countOrFPKMTable = self.format_countOrFPKMTable(io.data); return countOrFPKMTable;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n ans = self.execute(self.commands.table_count(self.name))\n return ans[0][0]", "def count():", "def samples(app, args):\n engine = create_engine(args.datafile)\n meta = MetaData()\n meta.reflect(engine)\n print(\"\\t\".join([str(x).replace('counts.', '')\n ...
[ "0.6216667", "0.59590936", "0.5957887", "0.5952389", "0.5868071", "0.58158195", "0.57693267", "0.57693267", "0.5755721", "0.5700496", "0.56974876", "0.5680915", "0.56658834", "0.5662107", "0.56482613", "0.56469244", "0.5637406", "0.559692", "0.5541019", "0.55354065", "0.55352...
0.7532327
0
reformat attr tables into a dictionary for rapid alignment of attr table with tracking_id
def reformat_attrTable( self): #format into a dictionary of rows for quick aligning with the tracking_id if self.attrTable: attrTable = self.attrTable[:]; else: attrTable = []; attrTable_dict = {}; for row in attrTable: attrTable_dict[row['tracking_id']] = row; return attrTable_dict;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_attrs(attrs):\n new_attrs = OrderedDict()\n for attr in attrs:\n col = attr\n if isinstance(attr, tuple):\n col, attr = attr\n # special cases\n if attr == 'class_name':\n attr = '__class__.__name__'\n if attr == 'repr':\n attr ...
[ "0.65014577", "0.60592574", "0.60217834", "0.6018756", "0.6007916", "0.5968255", "0.58305824", "0.58305734", "0.57943606", "0.575547", "0.57497114", "0.574563", "0.5674587", "0.56742924", "0.56551945", "0.565404", "0.56439865", "0.5624873", "0.561691", "0.55270827", "0.551784...
0.8673553
0
reformat count table into a flattened table of sample_names/values
def reformat_countTable( self,analysis_id_I=None,sna2experimentID_I=None, sna2sns_I=None): if self.countTable: countTable = self.countTable[:]; else: countTable = []; countTable_flat = self.reformat_countOrFPKMTable( countOrFPKMTable_I=countTable, analysis_id_I=analysis_id_I, sna2experimentID_I=sna2experimentID_I, sna2sns_I=sna2sns_I, count_or_FPKM = 'count'); return countTable_flat;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq_table(a):\n Detail_freq = a.loc[:, (a.dtypes == object) | (a.dtypes == long) ].columns.get_values().tolist()\n print(Detail_freq)\n for freq in Detail_freq:\n df1 = pd.DataFrame(a[freq].value_counts(dropna=False).astype(float).map('{:20,.0f}'.format).sort_index()).rename(columns={freq:...
[ "0.57405555", "0.56753397", "0.56595165", "0.56088334", "0.558755", "0.5580088", "0.55345875", "0.55330217", "0.5509548", "0.543421", "0.5379833", "0.5359173", "0.53470004", "0.52842575", "0.52725303", "0.5265805", "0.5256941", "0.52491903", "0.52491903", "0.52352023", "0.521...
0.627885
0
reformat fpkm table into flattened table of sample_names/values
def reformat_fpkmTable( self,analysis_id_I=None,sna2experimentID_I=None, sna2sns_I=None): if self.fpkmTable: fpkmTable = self.fpkmTable[:]; else: fpkmTable = []; fpkmTable_flat = self.reformat_countOrFPKMTable( countOrFPKMTable_I=fpkmTable, analysis_id_I=analysis_id_I, sna2experimentID_I=sna2experimentID_I, sna2sns_I=sna2sns_I, count_or_FPKM = 'fpkm'); return fpkmTable_flat;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_unifrac_sample_mapping(sample_ids, otu_ids, otu_table_array):\r\n out = []\r\n for i, row in enumerate(otu_table_array):\r\n for j, val in enumerate(row):\r\n if val > 0:\r\n line = [otu_ids[i], sample_ids[j], str(val)]\r\n out.append('\\t'.join(line...
[ "0.60229045", "0.5637049", "0.5637049", "0.53095335", "0.53014034", "0.52432746", "0.5227828", "0.51772594", "0.51730895", "0.51567525", "0.51420665", "0.51343006", "0.511792", "0.511474", "0.5104135", "0.5101256", "0.50933254", "0.5086502", "0.5055283", "0.5043328", "0.50231...
0.5961496
1
reformat count or FPKM tables into flattened table of sample_names/values for rapid alignment of attr table with tracking_id
def reformat_countOrFPKMTable( self, countOrFPKMTable_I=None, analysis_id_I=None, sna2experimentID_I=None, sna2sns_I=None, count_or_FPKM = 'count'): #format into a dictionary of rows for quick aligning with the tracking_id countOrFPKMTable_flat = []; for row in countOrFPKMTable_I: for k,v in row.items(): if k=='tracking_id':continue; tmp = {}; tmp['analysis_id'] = analysis_id_I; tmp['tracking_id'] = row['tracking_id']; sample_name_lst = k.split('_'); sample_name_base = '_'.join(sample_name_lst[:-1]); sample_name_rep = eval(sample_name_lst[-1]); if sna2experimentID_I: experiment_id = sna2experimentID_I[sample_name_base]; else: experiment_id=None; tmp['experiment_id'] = experiment_id; if sna2sns_I: sample_name = sna2sns_I[sample_name_base][sample_name_rep]; else: sample_name=k; tmp['sample_name'] = sample_name; tmp['value'] = v; tmp['value_units'] = count_or_FPKM; tmp['used_'] = True; tmp['comment_'] = None; countOrFPKMTable_flat.append(tmp); return countOrFPKMTable_flat;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alignAndReformat_countFPKMattrTables(\n self,analysis_id_I=None,sna2experimentID_I=None,\n sna2sns_I=None):\n #reformat\n countTable_flat = self.reformat_countTable(\n analysis_id_I=analysis_id_I,\n sna2experimentID_I=sna2experimentID_I,\n sna2sns_I=...
[ "0.5996871", "0.5834174", "0.56089836", "0.5596423", "0.5548671", "0.554599", "0.5534935", "0.548897", "0.5448419", "0.5394029", "0.537485", "0.5362557", "0.5339601", "0.53235745", "0.52827585", "0.5272961", "0.5233933", "0.522556", "0.52244353", "0.5220203", "0.5207982", "...
0.63312393
0
reformat count or FPKM tables into a dictionary for rapid alignment of attr table with tracking_id
def alignAndReformat_countFPKMattrTables( self,analysis_id_I=None,sna2experimentID_I=None, sna2sns_I=None): #reformat countTable_flat = self.reformat_countTable( analysis_id_I=analysis_id_I, sna2experimentID_I=sna2experimentID_I, sna2sns_I=sna2sns_I,); fpkmTable_flat = self.reformat_fpkmTable( analysis_id_I=analysis_id_I, sna2experimentID_I=sna2experimentID_I, sna2sns_I=sna2sns_I,); attrTable_dict = self.reformat_attrTable(); #align countAndFpkmTable_aligned = []; for row in countTable_flat[:]: row.update(attrTable_dict[row['tracking_id']]); countAndFpkmTable_aligned.append(row); for row in fpkmTable_flat[:]: row.update(attrTable_dict[row['tracking_id']]); countAndFpkmTable_aligned.append(row); return countAndFpkmTable_aligned;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformat_attrTable(\n self):\n #format into a dictionary of rows for quick aligning with the tracking_id\n if self.attrTable: attrTable = self.attrTable[:];\n else: attrTable = [];\n\n attrTable_dict = {};\n for row in attrTable:\n attrTable_dict[row['tracki...
[ "0.7227093", "0.64672595", "0.63795495", "0.5744344", "0.5535398", "0.5517264", "0.54640967", "0.542029", "0.53676605", "0.5360893", "0.5334983", "0.5295043", "0.5288153", "0.5281474", "0.52813345", "0.5253252", "0.52377903", "0.5232528", "0.51988035", "0.51941615", "0.517988...
0.63274735
3
formats raw string input into their appropriate values
def format_countOrFPKMTable(self,fpkmTracking_I): for fpkmTracking in fpkmTracking_I: for k,v in fpkmTracking.items(): if k=='tracking_id' and type(fpkmTracking['tracking_id'])==type('string'): pass; elif k!='tracking_id' and type(fpkmTracking[k])==type('string'): fpkmTracking[k] = eval(v); return fpkmTracking_I;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_raw_input(user_input):\n # Replace silly “ or ” characters with \"\n # TODO: Swap out with regex\n raw_input = user_input.strip().replace(\n '“', '\"').replace(\"”\", '\"').replace(\",\", \"\").replace(\"\\n\", \" \")\n # Break apart the string into each coordinate\n raw_inputs = [...
[ "0.66427", "0.6007272", "0.5868643", "0.58346975", "0.57762647", "0.5764655", "0.57391506", "0.57352734", "0.5719354", "0.5683081", "0.5664899", "0.5664475", "0.5585627", "0.5576046", "0.5576046", "0.55689394", "0.5552692", "0.5552692", "0.5544937", "0.5495645", "0.54807526",...
0.0
-1
View for rendering hours as json.
def json_hours(request): current_site = Site.find_for_request(request) if request.method == 'GET': if request.GET.get('fallback'): fallback = request.GET['fallback'] return JsonResponse( { 'llid': get_default_unit().location.libcal_library_id, } ) else: libcalid = request.GET['libcalid'] all_building_hours = json.dumps(get_building_hours_and_lid(current_site)) return JsonResponse( { 'all_building_hours': all_building_hours, 'current_hours': get_json_hours_by_id(int(libcalid), all_building_hours), 'llid': libcalid, 'llid_fallback': get_default_unit().location.libcal_library_id, } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_hours(employee_id):\n\n if not g.user:\n flash(\"Please Login to continue.\", \"danger\")\n return redirect(\"/\")\n \n employee = Employee.query.get_or_404(employee_id)\n\n labels = json.dumps( [\"Completed\", \"Required\"])\n data = json.dumps([employee.completed, employe...
[ "0.6702672", "0.63559496", "0.6134469", "0.60062844", "0.58493066", "0.5845087", "0.5821502", "0.58081955", "0.57617134", "0.5753844", "0.5742273", "0.5733102", "0.57142144", "0.56817853", "0.56517273", "0.5609031", "0.558943", "0.5580721", "0.5514128", "0.549668", "0.5485034...
0.72261083
0
View for rendering events feed data as json.
def json_events(request): if request.method == 'GET': ttrss_url = request.GET['feed'] # need xml for this. university_url = 'http://events.uchicago.edu/widgets/rss.php?key=47866f880d62a4f4517a44381f4a990d&id=48' n = datetime.datetime.now() return JsonResponse( { 'events': flatten_events(get_events(university_url, ttrss_url, n, n + relativedelta(years=1), False)) } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_events():\n result = get_events_helper(Event)\n return jsonify(result[0]), result[1]", "def get():\n return jsonify({'events': 'Events API'}), 200", "def get_event():\n json_data = request.args or {}\n return make_response(jsonify({ \"data\" : Event.get_events(json_data)}))"...
[ "0.76628214", "0.67185247", "0.6591272", "0.6508852", "0.6443426", "0.62528884", "0.6215547", "0.6096349", "0.60427344", "0.604139", "0.5985696", "0.5972402", "0.5937236", "0.5932184", "0.59189314", "0.58994985", "0.58941627", "0.5889959", "0.58717847", "0.58609265", "0.58606...
0.778918
0
View for rendering news feed data as json.
def json_news(request): if request.method == 'GET': feed = request.GET['feed'] return JsonResponse( { 'news': get_news(feed), } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_news():\n data = get_top_news()\n return jsonify(data)", "def news():\n\n # ensure parameters are present\n # geo = request.args.get(\"geo\")\n geo = '95060'\n if not geo:\n raise RuntimeError(\"missing geo\")\n\n # lookup articles and store them as JSON array\n article_lis...
[ "0.673006", "0.66394603", "0.6454153", "0.6373204", "0.6363174", "0.63411576", "0.6298449", "0.61722803", "0.61526084", "0.60082966", "0.59839356", "0.5969505", "0.5918859", "0.5916364", "0.5914569", "0.5899843", "0.58803356", "0.5869351", "0.58558553", "0.5835319", "0.581607...
0.78444064
0
View for retreiving the chat status for Ask a Librarian pages. Returns json.
def chat_status(request): if request.method == 'GET': ask_name = request.GET['name'] status = get_chat_status_and_css(ask_name) return JsonResponse( { 'chat_status': status[0], 'chat_css': status[1], } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat_status(request):\n team = Hunt.objects.get(is_current_hunt=True).team_from_user(request.user)\n if request.method == 'GET' and request.is_ajax():\n if(team is None):\n return render(request, 'access_error.html', {'reason': \"team\"})\n status = team.num_waiting_messages\n ...
[ "0.7056218", "0.58047336", "0.57761455", "0.56156147", "0.56094897", "0.5595043", "0.55575705", "0.5555067", "0.5535522", "0.553365", "0.5530453", "0.55122775", "0.540345", "0.53645366", "0.53573716", "0.53215814", "0.53145057", "0.52810264", "0.5262246", "0.5239236", "0.5229...
0.76308614
0
Fonction pour placer un disque de couleur 'col' a la coordonnee (xa,ya)
def create_point(xa,ya,col): disque = canvas.create_oval(xa-(rayon),ya-(rayon),xa+(rayon),ya+(rayon),fill="white",outline=col) return disque
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xy_position(row, col):\n spacing_x = 86 + 11\n spacing_y = 98 + 8\n top_y = 50\n left_x = 50\n return left_x + col * spacing_x, top_y + row * spacing_y", "def colWithTile(self, pos):\n\n\n return self.colWithBox(pos, [2.0,2.0,2.0])", "def em_coord_turtle(lin, col, dim, tam_celula):\n ...
[ "0.68489397", "0.67793953", "0.6498352", "0.63620645", "0.6283588", "0.62691915", "0.6266249", "0.62381095", "0.61900526", "0.6178052", "0.6152861", "0.6122054", "0.60530484", "0.6049112", "0.60243577", "0.59963053", "0.59574944", "0.5950011", "0.59291357", "0.59247184", "0.5...
0.60508746
13