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
Add more connection endpoints. Connection may have many endpoints, mixing protocols and types.
def addEndpoints(self, endpoints): self.endpoints.extend(endpoints) self._connectOrBind(endpoints)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def connections_endpoints(request: web.BaseRequest):\n context: AdminRequestContext = request[\"context\"]\n connection_id = request.match_info[\"conn_id\"]\n\n profile = context.profile\n connection_mgr = ConnectionManager(profile)\n try:\n endpoints = await connection_mgr.get_endpoint...
[ "0.6581431", "0.62893325", "0.6268082", "0.6254711", "0.6199637", "0.6168774", "0.6061122", "0.60520715", "0.6042876", "0.6022899", "0.5892089", "0.5878343", "0.5851649", "0.58505166", "0.58410054", "0.5814967", "0.57680947", "0.5753131", "0.572161", "0.57154876", "0.57008517...
0.7782683
0
Shutdown connection and socket.
def shutdown(self): self.factory.reactor.removeReader(self) self.factory.connections.discard(self) self.socket.close() self.socket = None self.factory = None if self.read_scheduled is not None: self.read_scheduled.cancel() self.read_scheduled =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown(self):\n self.sock.close()", "def shutdown(self):\r\n self.socket.close()\r\n # self.socket_video.close()\r\n self.socket_state.close()", "def shutdown(self):\n self.connected = False\n self.protocol.send_message(self.sock, '__!shutdown__')\n data =...
[ "0.8116628", "0.8094799", "0.8060814", "0.79759955", "0.78641194", "0.7841892", "0.7702921", "0.7702643", "0.7657929", "0.7616718", "0.7593503", "0.749319", "0.74762684", "0.7362442", "0.7351249", "0.73482984", "0.7346527", "0.73362386", "0.7329469", "0.73156035", "0.73146766...
0.6914994
69
Called when the connection was lost. Part of L{IFileDescriptor}. This is called when the connection on a selectable object has been lost. It will be called whether the connection was closed explicitly, an exception occurred in an event handler, or the other end of the connection closed it first.
def connectionLost(self, reason): if self.factory: self.factory.reactor.removeReader(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loseConnection(self):\n self.lost_connection.callback(self)\n return None", "def connectionLost(self, reason):\n self.factory._r_on_connection_lost(self)", "def connectionLost(self, reason=None):\n\n # Log the disconnection\n MaverickServerProtocol._logger.debug(\"Client ...
[ "0.7431634", "0.73637027", "0.7295924", "0.7279225", "0.7188222", "0.71682227", "0.7115157", "0.70909446", "0.7086776", "0.70710385", "0.7067346", "0.70491093", "0.70391434", "0.7022612", "0.70011073", "0.6968903", "0.6921659", "0.69068295", "0.6879366", "0.6867376", "0.68571...
0.65599656
37
Read multipart in nonblocking manner, returns with ready message or raising exception (in case of no more messages available).
def _readMultipart(self): while True: self.recv_parts.append(self.socket.recv(constants.NOBLOCK)) if not self.socket_get(constants.RCVMORE): result, self.recv_parts = self.recv_parts, [] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doRead(self):\n if self.read_scheduled is not None:\n if not self.read_scheduled.called:\n self.read_scheduled.cancel()\n self.read_scheduled = None\n\n while True:\n if self.factory is None: # disconnected\n return\n\n ev...
[ "0.7202878", "0.6593352", "0.6501937", "0.64703834", "0.63924545", "0.6380673", "0.6375113", "0.63678604", "0.6358247", "0.6302495", "0.6219391", "0.6152119", "0.6034115", "0.6021782", "0.6014445", "0.594972", "0.59420466", "0.5936738", "0.5936738", "0.59349895", "0.59290695"...
0.72168154
0
Some data is available for reading on your descriptor. ZeroMQ is signalling that we should process some events, we're starting to to receive incoming messages. Part of L{IReadDescriptor}.
def doRead(self): if self.read_scheduled is not None: if not self.read_scheduled.called: self.read_scheduled.cancel() self.read_scheduled = None while True: if self.factory is None: # disconnected return events = self.soc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_read(self):\n pass", "def doRead(self):\n return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived)", "def _handle_read(self):\n pass", "def _notify_read(self, cuds_object):", "def whenReadReady(self, channel, call):", "def read(self):\n pass", "def inRea...
[ "0.6884566", "0.6863841", "0.67576945", "0.66687995", "0.6382098", "0.63627136", "0.6359575", "0.63490164", "0.63316524", "0.6277192", "0.6174218", "0.6168974", "0.6167152", "0.61480916", "0.61083895", "0.6058517", "0.60197777", "0.6003864", "0.59779453", "0.59479123", "0.594...
0.60894215
15
Send message via ZeroMQ. Sending is performed directly to ZeroMQ without queueing. If HWM is reached on ZeroMQ side, sending operation is aborted with exception from ZeroMQ (EAGAIN).
def send(self, message): if not hasattr(message, '__iter__'): self.socket.send(message, constants.NOBLOCK) else: for m in message[:-1]: self.socket.send(m, constants.NOBLOCK | constants.SNDMORE) self.socket.send(message[-1], constants.NOBLOCK) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, msg):\n self.house.PLM.send_queue.put( msg )", "def __send(self):\r\n self.msgLock.acquire()\r\n if self.numMsg > 0:\r\n self.socket.send(self.msg.pop(0))\r\n self.numMsg -= 1\r\n self.msgLock.release()", "def send(self, msg):\n with self....
[ "0.671881", "0.6497291", "0.64011776", "0.6373785", "0.6349839", "0.6319402", "0.6285288", "0.62469214", "0.6214353", "0.6164441", "0.6128295", "0.6097054", "0.60968465", "0.60759246", "0.60734814", "0.604762", "0.6045848", "0.6039005", "0.6007811", "0.6002121", "0.6000013", ...
0.0
-1
Called on incoming message from ZeroMQ.
def messageReceived(self, message): raise NotImplementedError(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self, message):", "def receive_message(self, message):", "def handle_message(self, msg):\n pass", "def receive_message(self, message):\r\n return", "def handle(self, message):", "def _handle_message(self, msg):\n self.event('message', msg)", "def on_msg_recv(msg):\n...
[ "0.6974165", "0.6928344", "0.6919641", "0.6894543", "0.68906176", "0.68757933", "0.6871723", "0.68622655", "0.68468934", "0.68297577", "0.67970884", "0.67825955", "0.6753128", "0.67452276", "0.6700199", "0.6622171", "0.6585881", "0.65731514", "0.6529273", "0.6512468", "0.6509...
0.6205774
50
Connect and/or bind socket to endpoints.
def _connectOrBind(self, endpoints): for endpoint in endpoints: if endpoint.type == ZmqEndpointType.connect: self.socket.connect(endpoint.address) elif endpoint.type == ZmqEndpointType.bind: self.socket.bind(endpoint.address) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind(self):\n self._conn = socket.socket(socket.AF_INET, self.protocol.value)\n try:\n self._conn.bind((self.host, self.port))\n except OSError as e:\n self.close()\n raise BindError(str(e))\n self._conn.setblocking(False)\n self._conn.listen(...
[ "0.7130075", "0.7112576", "0.6801621", "0.6775071", "0.6772604", "0.6653766", "0.6643562", "0.66249806", "0.66118973", "0.659476", "0.6579499", "0.6578894", "0.6578408", "0.6554303", "0.6552846", "0.654279", "0.6523097", "0.651956", "0.64632034", "0.6457388", "0.64059734", ...
0.7718711
0
Atom(symbol, displacement, ...) > atom object. The chemical symbol or the atomic number must be given (``symbol`` or ``Z``). The rest of the arguments (``mass``, ``displacement``, ``force``, ``momentum``, ``velocity`` and ``magmom``) have default values.
def __init__(self, symbol=None, Z=None, mass=None, displacement=None, force=None, momentum=None, velocity=None, magmom=0.0): self._properties={} if symbol is None: if Z is None: raise Value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addAtom(self, symbol, position, massNum = None, **kwds):\n self.MagCell.addAtom(symbol, position, massNum, **kwds)", "def __init__(self, position, momentum, mass):\n self.position = position\n self.momentum = momentum\n self.mass = mass", "def add_atom(molecule, atomic_num, x_co...
[ "0.62646323", "0.5459874", "0.5274294", "0.52713656", "0.52178127", "0.51740944", "0.5111022", "0.5087099", "0.4997732", "0.49159324", "0.4915145", "0.49009722", "0.48384157", "0.48236147", "0.48070416", "0.47763655", "0.47691646", "0.4750681", "0.47204223", "0.47154075", "0....
0.5423634
2
ADJ, ADJ_SAT, ADV, NOUN, VERB = "a", "s", "r", "n", "v"
def lemmatize_text(self, text, print_tokens=False): # text = text.replace("/", ' or ') # text = text.replace("\\", ' or ') # # text = text.replace("'s", '') # # text = text.replace("’s", '') if print_tokens: print(pos_tag(word_tokenize(text))) # text = "We’r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verb_lemma(word):\n if word.endswith(\"ed\"):\n if word[:-2].endswith(\"v\"):\n return word[:-2].lower() + \"e\"\n elif word[:-2].endswith(\"at\"):\n return word[:-2].lower() + \"e\"\n elif word[:-2].endswith(\"it\"):\n return word[:-2].lower() + \"e\"\n...
[ "0.6282963", "0.62601596", "0.5897731", "0.5872146", "0.5858878", "0.5748334", "0.57213783", "0.56774324", "0.56710875", "0.56707567", "0.56644166", "0.55686545", "0.55204165", "0.54814506", "0.5448419", "0.53462553", "0.5303483", "0.5303483", "0.52700055", "0.5265413", "0.52...
0.0
-1
get a single word's wordnet POS (PartofSpeech) tag.
def get_wordnet_pos(self, word): # token = word_tokenize(word) base_tag = pos_tag([word])[0][1][:2] return self.pos_tag_dict.get(base_tag, wordnet.NOUN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wordnet_pos(word):\n tag = nltk.pos_tag([word])[0][1][0].upper()\n tag_dict = {\"J\": wordnet.ADJ,\n \"N\": wordnet.NOUN,\n \"V\": wordnet.VERB,\n \"R\": wordnet.ADV}\n return tag_dict.get(tag, wordnet.NOUN)", "def get_wordnet_pos(word):\n tag = nl...
[ "0.7593354", "0.7576574", "0.7576574", "0.7576574", "0.7576574", "0.7576574", "0.7576574", "0.75293577", "0.7503421", "0.7377293", "0.719029", "0.71326035", "0.71208805", "0.709108", "0.70407254", "0.7016819", "0.6993947", "0.69855785", "0.69850004", "0.6918058", "0.6874751",...
0.7755339
0
Cleans a single review (simplifies it as much as possible)
def clean_review(self, text): text = text.lower() # lowercase capital letters if self.remove_stopwords: text = self.remove_stopwords_f(text, keep_neg_words=True) text = re.sub('[^a-zA-Z]+', ' ', text) # select only alphabet characters (letters only) # text = re.sub('[^a-z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize(review):\n # c) Remove all punctuation, as well as the stop-words.\n # First replace punctuations with empty char then tokenize it\n # Replace punctuation with spaces using fast method\n clean = review.translate(review.maketrans(string.punctuation,\n ...
[ "0.7039309", "0.6684278", "0.64323676", "0.6006801", "0.5992633", "0.5959121", "0.5953015", "0.5914954", "0.58682597", "0.5802497", "0.5769421", "0.5647594", "0.56341743", "0.559752", "0.5589405", "0.55746025", "0.5561322", "0.5524036", "0.55173266", "0.5471399", "0.54688805"...
0.71801054
0
Cleans a single resume (resume text)
def clean_resume(self, text): text = text.lower() # lowercase capital letters text = re.sub(r'(http|www)\S+\s*', '', text) # remove URLs text = re.sub(r'\S+@\S+\s*', '', text) # remove emails text = re.sub(r'@\S+\s*', '', text) # remove mentions text = re.sub(r'#\S+\s*', '',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleaning(full_text):\n try:\n if open(RESULT_PATH):\n os.remove(RESULT_PATH)\n \n else:\n print(\"No output.mp3\")\n except Exception as e:\n print(str(e))\n\n text = full_text\n\n book = ''.join(text)\n\n\n book = book.replace('.', '.<eos>')\n ...
[ "0.65953624", "0.59690464", "0.5925192", "0.57667595", "0.5754863", "0.572727", "0.56936944", "0.5628845", "0.5601159", "0.55797684", "0.55733097", "0.55511904", "0.554485", "0.552263", "0.55109733", "0.5505896", "0.5464441", "0.5445689", "0.54276085", "0.5422343", "0.5397728...
0.7648608
0
Euclidean distance Squared Euclidean distance more frequently used
def euc_dist(self, squared=True):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEuclideanDistance():\r\n global euclideanDistance\r\n return euclideanDistance", "def euclidean_distance(x1, x2):\n return np.sqrt(np.sum(np.square(np.subtract(x1, x2))))", "def euclidean_distance(s1,s2): \n tmpsum = 0\n \n for index,value in enumerate(s1):\n tmpsum += (s1[in...
[ "0.73311925", "0.7217947", "0.72092783", "0.71997476", "0.71303356", "0.70067096", "0.6991867", "0.6981154", "0.69637036", "0.6960269", "0.6941405", "0.69364357", "0.6935467", "0.69090146", "0.68860257", "0.68558615", "0.68158317", "0.6806122", "0.6798799", "0.6798116", "0.67...
0.7476734
0
Y is the output of the classifier vector of size (m,1) of the estimated class of each sample
def compute_Y(X, w): Y = np.sign(np.dot(X, w)) return Y # for i in range(A.shape[0]): # # prevent overflow by subtracting the max value from each entry in row i # A[i, :] = A[i, :] - A[i, :].max() # A[i, :] = np.exp(A[i, :]) # Y[i, :] = A[i, :] / A[i, :].sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self,X,y):\n self.X_train = X\n self.y_train = y\n self.class_labels = np.unique(self.y_train)", "def multiclass_toy_data(): \n #dataset = np.zeros((10,5), np.int)\n dataset = np.array([[0,0,0,0,4],\n [0,0,0,0,5],\n [1,3,0,0,0],\n ...
[ "0.73219055", "0.7197235", "0.7050374", "0.6989029", "0.6952847", "0.6943367", "0.6921751", "0.6869864", "0.68615234", "0.6858735", "0.6842073", "0.6842073", "0.68230265", "0.6822966", "0.6810576", "0.6805199", "0.67613393", "0.667963", "0.6678272", "0.66574466", "0.66427875"...
0.0
-1
Gradient of log loss function at the current w
def compute_gradient(X, t, w): # TODO: try to change to square loss since it's hessian is easier to obtain # TODO : print to console the max gradient in every run A = np.dot(X, w) m = t.shape[0] C = -1 * t * (1 / (1 + np.exp(A * t))) return (1 / m) * np.dot(X.T, C)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood_gradient(y, tx, w):\n return tx.T.dot(sigmoid(tx.dot(w))-y)", "def grad_reglog(w, X, y, **kwargs):\n p = np.exp(-y * (np.dot(X, w)))\n P = p / (1. + p)\n return -1 * np.dot(X.T, P * y) / X.shape[0]", "def _loss_gradient(x0, x1, b, w, lam, weights=None):\n nvars = len(w)\n\...
[ "0.8048596", "0.76594067", "0.75782055", "0.75694907", "0.75582236", "0.7449882", "0.7397625", "0.7279694", "0.7203933", "0.7198174", "0.7188557", "0.7125099", "0.71196514", "0.71061635", "0.7087161", "0.7081187", "0.70647085", "0.70532495", "0.70407975", "0.70192206", "0.697...
0.6936435
24
Gradient of log loss function at the current w
def compute_gradient(self): # TODO: try to change to square loss since it's hessian is easier to obtain A = np.dot(self.X, self.w) m = self.t.shape[0] C = -1 * self.t * (1 / (1 + np.exp(A * self.t))) return (1 / m) * np.dot(self.X.T, C)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood_gradient(y, tx, w):\n return tx.T.dot(sigmoid(tx.dot(w))-y)", "def grad_reglog(w, X, y, **kwargs):\n p = np.exp(-y * (np.dot(X, w)))\n P = p / (1. + p)\n return -1 * np.dot(X.T, P * y) / X.shape[0]", "def _loss_gradient(x0, x1, b, w, lam, weights=None):\n nvars = len(w)\n\...
[ "0.8048325", "0.76605856", "0.75776166", "0.7570397", "0.7558319", "0.7449295", "0.73966116", "0.7279479", "0.72035617", "0.71984977", "0.71885246", "0.71245855", "0.71195346", "0.7105514", "0.70863146", "0.7082717", "0.7064733", "0.70527214", "0.7041097", "0.7020151", "0.697...
0.6894576
33
Gradient of log loss function at the current w
def compute_gradient(self): A = np.dot(self.X, self.w) m = self.t.shape[0] C = -1 * self.t * (1 / (1 + np.exp(A * self.t))) return (1 / m) * np.dot(self.X.T, C)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood_gradient(y, tx, w):\n return tx.T.dot(sigmoid(tx.dot(w))-y)", "def grad_reglog(w, X, y, **kwargs):\n p = np.exp(-y * (np.dot(X, w)))\n P = p / (1. + p)\n return -1 * np.dot(X.T, P * y) / X.shape[0]", "def _loss_gradient(x0, x1, b, w, lam, weights=None):\n nvars = len(w)\n\...
[ "0.80493027", "0.7659334", "0.7578845", "0.7569231", "0.75586885", "0.7450052", "0.7397052", "0.72792256", "0.72056633", "0.7200397", "0.71906173", "0.71262753", "0.7120781", "0.71080154", "0.70880324", "0.70810807", "0.70663065", "0.7054109", "0.70421106", "0.7017045", "0.69...
0.667223
62
Gradient of log loss function with regularization at the current w
def compute_reg_gradient(self): A = np.dot(self.X, self.w) m = self.t.shape[0] C = -1 * self.t * (1 / (1 + np.exp(A * self.t))) return (1 / m) * np.dot(self.X.T, C) + self.lambda_reg * self.w # add regularization term
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grad_reglog(w, X, y, **kwargs):\n p = np.exp(-y * (np.dot(X, w)))\n P = p / (1. + p)\n return -1 * np.dot(X.T, P * y) / X.shape[0]", "def log_likelihood_gradient(y, tx, w):\n return tx.T.dot(sigmoid(tx.dot(w))-y)", "def _loss_gradient(x0, x1, b, w, lam, weights=None):\n nvars = len(w)\n\...
[ "0.791353", "0.7674807", "0.763062", "0.756356", "0.75527704", "0.7370547", "0.72928864", "0.72234875", "0.7171148", "0.71650624", "0.71579814", "0.71459574", "0.7117442", "0.7092932", "0.707363", "0.7057667", "0.70241106", "0.7017027", "0.7012952", "0.7012573", "0.7011721", ...
0.7077802
14
An estimator for the gradient of log loss function at the current w, by taking only a single sample
def compute_sgd_gradient(self, x_j, t_j): a = np.dot(x_j.T, self.w) return -1 * t_j * (1 / (1 + np.exp(a * t_j))) * x_j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_prior_grad(self, inputs):", "def grad_reglog(w, X, y, **kwargs):\n p = np.exp(-y * (np.dot(X, w)))\n P = p / (1. + p)\n return -1 * np.dot(X.T, P * y) / X.shape[0]", "def log_likelihood_gradient(y, tx, w):\n return tx.T.dot(sigmoid(tx.dot(w))-y)", "def grad_log(self, X):\n # \"\"\"\...
[ "0.7409512", "0.727362", "0.72355455", "0.6930026", "0.68873745", "0.68859917", "0.6878263", "0.68434113", "0.6838884", "0.68350923", "0.6825335", "0.6803445", "0.6798429", "0.6794086", "0.6712138", "0.67044675", "0.6703921", "0.6699552", "0.66310096", "0.6619995", "0.6588419...
0.0
-1
Test elementwise for fill values and return result as a boolean array.
def isfillvalue(a): a = numpy.asarray(a) if a.dtype.kind == 'i': mask = a == -999999999 elif a.dtype.kind == 'f': mask = numpy.isnan(a) elif a.dtype.kind == 'S': mask = a == '' else: raise ValueError('Fill value not known for dtype %s' % a.dtype) return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_array_booleans(n: int = 1024, random_seed: int = None) -> TYPE_ARRAY:\n return _RNG.randint(0, 2, n).astype(bool)", "def __call__(self, size=1):\n\n # A completely empty numpy array\n results = numpy.zeros(self.shape, dtype=bool)\n\n # Gets a set of random indices that need t...
[ "0.60772234", "0.59158", "0.5880896", "0.5725829", "0.5717447", "0.57084936", "0.56891406", "0.5651735", "0.5627813", "0.56104505", "0.5576027", "0.5572044", "0.55715203", "0.5566624", "0.55537015", "0.5498187", "0.5478841", "0.54585373", "0.5433937", "0.5429966", "0.5427257"...
0.5984257
1
Return the start/stop times in milliseconds since 111970
def as_millis(self): return int(ntplib.ntp_to_system_time(self.start) * 1000), int(ntplib.ntp_to_system_time(self.stop) * 1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runtime_cal(start,end) :\n run_time = end - start\n mm = int(run_time/60)\n ss = round(run_time%60)\n return mm, ss", "def get_time_ms():\n return int(round(time.time() * 1000))", "def getTimes():", "def getTimes():", "def getTimes():", "def elapsed_micros(start: int, /) -> int:", "d...
[ "0.6986291", "0.6958346", "0.69455504", "0.69455504", "0.69455504", "0.69351584", "0.6922508", "0.6904034", "0.69000614", "0.6889413", "0.6834017", "0.6818947", "0.6816358", "0.67783904", "0.67711294", "0.67618895", "0.67332286", "0.6714469", "0.6713183", "0.6713183", "0.6713...
0.73437476
0
Simple timebased cache. Only valid for functions which have no arguments
def timed_cache(expire_seconds): cache = {'cache_time': 0, 'cache_value': None} def expired(): return cache['cache_time'] + expire_seconds < time.time() def wrapper(func): @wraps(func) def inner(): if expired(): cache['cache_value'] = func() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cached(func):\n return _lru_cache(None)(func)", "def dynCache(*args, **kwargs)->None:\n pass", "def cached(function):\n\t@wraps(function)\n\tdef check_cache_first(cls, *args):\n\t\tif not args in cls._cache:\n\t\t\tcode = function(cls, *args)\n\t\t\tif code:\n\t\t\t\tcls._cache[args] = code\n\t\t...
[ "0.7704695", "0.7487862", "0.7305302", "0.72399396", "0.7158932", "0.71499777", "0.7103249", "0.7094693", "0.6992508", "0.69538873", "0.69481593", "0.685329", "0.68105304", "0.68082714", "0.68078345", "0.679467", "0.67882276", "0.67683274", "0.67584336", "0.67443854", "0.6742...
0.6433214
38
Function to recursively check if two dicts are equal
def dict_equal(d1, d2): if isinstance(d1, dict) and isinstance(d2, dict): # check keysets if set(d1) != set(d2): return False # otherwise loop through all the keys and check if the dicts and items are equal return all((dict_equal(d1[key], d2[key]) for key in d1)) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_equal(d1: Dict, d2: Dict) -> bool:\n\n # iterate over the dict with more keys\n # di is the dictionary to iterate over\n # dj is the one to compare to\n if len(d2) > len(d1):\n di = d2\n dj = d1\n else:\n di = d1\n dj = d2\n for key, value in di.items():\n ...
[ "0.82100755", "0.7669566", "0.7605134", "0.7587031", "0.7573984", "0.7369974", "0.735764", "0.72046685", "0.71447515", "0.70782727", "0.70460093", "0.69822705", "0.6968151", "0.69324183", "0.69310194", "0.69286764", "0.6905533", "0.6891169", "0.6882714", "0.6858757", "0.68475...
0.7747674
1
Test that we can read observed/synthetic traces with the preprocess mod.
def test_default_read(): # If new data formats are added to preprocess, they need to be tested tested_data_formats = ["ASCII", "SU", "SAC"] preprocess = Default() assert(set(tested_data_formats) == set(preprocess._obs_acceptable_data_formats)) st1 = preprocess.read(os.path.join(TEST_DAT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decode_trace(self):\n self.assertEqual(td.trace(), decoder.decode_trace(BytesIO(td.trace(True))))", "def test_basic_parser_trace():", "def prepare_traces():\n \n # Identify the number of traces for the largest dataset\n num_traces = max([size[\"traces\"] for size in sizes])\n \n # Create f...
[ "0.62672204", "0.6000139", "0.59205806", "0.5894753", "0.5821288", "0.5764435", "0.5706461", "0.569139", "0.56367767", "0.5617839", "0.55851614", "0.5573745", "0.5566541", "0.5566249", "0.5565095", "0.5563263", "0.5532253", "0.5523213", "0.55199015", "0.5490037", "0.5487379",...
0.5085053
77
Test that we can write synthetic waveforms to formats that SPECFEM recognizes
def test_default_write(tmpdir): # If new data formats supported by SPECFEM are added to preprocess, # they need to be tested tested_data_formats = ["ASCII", "SU"] preprocess = Default() assert(set(tested_data_formats) == set(preprocess._syn_acceptable_data_formats)) st1 = preprocess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_simple_test():\n count = 1\n mdict = {\n 'operating_frequency': 3e8,\n 'sample_rate': 8e3,\n 'signal': [1] * 5,\n 'origin_pos': [1000, 0, 0],\n 'dest_pos': [300, 200, 50],\n 'origin_vel': [0] * 3,\n ...
[ "0.6389405", "0.6367297", "0.62679857", "0.62373686", "0.62114215", "0.6170687", "0.6146791", "0.6146547", "0.6139426", "0.6124821", "0.6114333", "0.6075158", "0.604245", "0.5976598", "0.5962665", "0.58959585", "0.58732283", "0.5865532", "0.5864507", "0.5856483", "0.58444536"...
0.61198735
10
Make sure we can write empty adjoint sources expected by SPECFEM
def test_default_initialize_adjoint_traces(tmpdir): preprocess = Default() preprocess.syn_data_format = "ASCII" data_filenames = glob(os.path.join(TEST_DATA, "*semd")) preprocess.initialize_adjoint_traces(data_filenames=data_filenames, output=tmpdir) prepro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_empty_sources(self):\n for source in [\"dxf\", \"edilizia\", \"easyroom\", \"merged\"]:\n if source in self and not self[source]:\n del self[source]", "def _prepare(self):\n logging.warning('-> preparing EMPTY experiments...')", "def test_missing_data_sources(self):", ...
[ "0.5989031", "0.58842367", "0.573989", "0.5713581", "0.56372374", "0.5469574", "0.5406883", "0.53961045", "0.53875965", "0.53536177", "0.5325273", "0.5302966", "0.5258798", "0.52277917", "0.5221645", "0.5215781", "0.5201497", "0.51766396", "0.5165727", "0.5138119", "0.5130737...
0.0
-1
Quantify misfit with some example data
def test_default_quantify_misfit(tmpdir): preprocess = Default(syn_data_format="ascii", obs_data_format="ascii", unit_output="disp", misfit="waveform", adjoint="waveform", path_preprocess=tmpdir, path_solver=TEST_SOLVER, source_prefix="SOURC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_genextreme_fit(self):\n p = generic.fit(self.genextreme, \"genextreme\")\n np.testing.assert_allclose(p, (0.20949, 297.954091, 75.7911863), 1e-5)", "def fit(self, X):", "def test_fit(self):\n X = np.zeros((2, 3), dtype=np.float64)\n snv = SNV(q=50)\n try:\n ...
[ "0.62091", "0.6153025", "0.61098146", "0.6083619", "0.6002775", "0.5955667", "0.59443253", "0.5894886", "0.58396775", "0.57995504", "0.5769619", "0.57624996", "0.5748213", "0.5731888", "0.5731888", "0.5731888", "0.57293093", "0.57270885", "0.57270885", "0.56752056", "0.567476...
0.6377925
0
Test setup procedure for SeisFlows which internalizes some workflow information that is crucial for later tasks
def test_pyaflowa_setup(tmpdir): pyaflowa = Pyaflowa( workdir=tmpdir, path_specfem_data=os.path.join(TEST_SOLVER, "mainsolver", "DATA"), path_solver=os.path.join(TEST_SOLVER, "mainsolver"), source_prefix="SOURCE", ntask=2, components="Y", ) assert(pyaflowa._s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_workflow():\n pass", "def test_deploy_workflow_definition(self):\n pass", "def setUp(self) -> None:\n self.sqlite_db = setup_sqlite_in_memory_db()\n create_tables(self.sqlite_db)\n seed_all_distributions()\n container_flow_generation_manager = ContainerFlowGenerat...
[ "0.6903731", "0.67200714", "0.66473234", "0.65858454", "0.6584684", "0.6562488", "0.6548605", "0.6540773", "0.6528661", "0.64872205", "0.6467191", "0.64631706", "0.64592195", "0.64543176", "0.6420024", "0.64105207", "0.64105207", "0.64105207", "0.64105207", "0.64105207", "0.6...
0.0
-1
Test Config setup that is used to control `quantify_misfit` function
def test_pyaflowa_setup_config(tmpdir): pyaflowa = Pyaflowa( workdir=tmpdir, path_specfem_data=os.path.join(TEST_SOLVER, "mainsolver", "DATA"), path_solver=TEST_SOLVER, source_prefix="SOURCE", ntask=1, data_case="synthetic", components="Y", fix_windows="ITER", ) pyaflowa.setu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_configure(config):\n config.addinivalue_line(\n \"markers\",\n \"serial: Tests that will not execute with more than 1 MPI process\")\n config.addinivalue_line(\"markers\",\n \"gpu: Tests that should only run on the gpu.\")\n config.addinivalue_line(\n ...
[ "0.6671106", "0.6536968", "0.63120526", "0.61878663", "0.6127497", "0.61204", "0.60867697", "0.6026608", "0.5973575", "0.5944742", "0.5929044", "0.59058183", "0.5883714", "0.58775496", "0.5862785", "0.5830396", "0.580627", "0.5784229", "0.5772616", "0.57701033", "0.5727601", ...
0.55039436
49
Test that misfit window bool returner always returns how we want it to.
def test_pyaflowa_check_fixed_windows(): pf = Pyaflowa(fix_windows=True) assert (pf._check_fixed_windows(iteration=99, step_count=99)[0]) pf = Pyaflowa(fix_windows="ITER") assert (not pf._check_fixed_windows(iteration=1, step_count=0)[0]) assert (pf._check_fixed_windows(iteration=1, step_count=1)[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wip(self):\n self.assertTrue(not return_true())", "def test_next_window_time_no_sample_passed(self):\n test_window_scheme = WindowingScheme(self.window_test_filter, 3)\n time.sleep(4)\n collected_value = test_window_scheme.filter(self.more_than_upper_bound)\n self.asse...
[ "0.6687499", "0.6173785", "0.61068255", "0.599548", "0.59855723", "0.59814656", "0.59571654", "0.5826708", "0.5824917", "0.5815543", "0.5805709", "0.58000684", "0.57855296", "0.5784521", "0.5780538", "0.5759117", "0.57221144", "0.57156813", "0.5714309", "0.57061833", "0.56979...
0.5426089
51
Test that the Pyaflowa preprocess class can quantify misfit over the course of a few evaluations (a line search) and run its finalization task Essentially an integration test testing the entire preprocessing module works as a whole
def test_pyaflowa_line_search(tmpdir): pyaflowa = Pyaflowa( workdir=tmpdir, path_specfem_data=os.path.join(TEST_SOLVER, "mainsolver", "DATA"), path_output=os.path.join(tmpdir, "output"), path_solver=TEST_SOLVER, source_prefix="SOURCE", ntask=2, data_case="synthetic", componen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_predictor():", "def test_active_inference_SPM_1b(self):", "def test_preprocess(self):\r\n\r\n # Should discard all reads due to sequence length being too short\r\n\r\n fasta_files = [self.sample_fasta_file]\r\n qual_files = [self.sample_qual_file]\r\n mapping_file = self.sa...
[ "0.629093", "0.62761736", "0.620866", "0.6105234", "0.6059339", "0.6007366", "0.5925567", "0.59123164", "0.5886541", "0.58703196", "0.58566153", "0.5794662", "0.57678074", "0.5767124", "0.5744852", "0.5740845", "0.57300746", "0.5707568", "0.5697885", "0.5695476", "0.56930786"...
0.6344366
0
dataList item renderer for Posts on the Bulletin Board.
def cms_post_list_layout(list_id, item_id, resource, rfields, record): record_id = record["cms_post.id"] #item_class = "thumbnail" T = current.T db = current.db s3db = current.s3db settings = current.deployment_settings permit = current.auth.s3_has_permission raw = record._row dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serializePostsData(influencer, posts, length_limit=30, highlight=False):\n from debra import serializers\n\n posts_data = []\n urls = set()\n posts = list(posts)\n dated = []\n undated = []\n for post in posts:\n if post.create_date:\n dated.append(post)\n else:\n ...
[ "0.5797765", "0.5777556", "0.569845", "0.5545204", "0.5486257", "0.54002476", "0.5336475", "0.5334056", "0.5324463", "0.5311351", "0.5307505", "0.53025407", "0.52784413", "0.5277002", "0.52619624", "0.52491385", "0.5233054", "0.52293384", "0.5213067", "0.5183145", "0.51277083...
0.5974937
0
Custom lookup method for activity rows, does a left join with the tag. Parameters key and fields are not used, but are kept for API compatibility reasons.
def lookup_rows(self, key, values, fields=None): s3db = current.s3db atable = s3db.project_activity aotable = s3db.project_activity_organisation left = aotable.on((aotable.activity_id == atable.id) & \ (aotable.role == 1)) qty = len(values) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_lookup_rows(self, key, values, fields=None):\n\n s3db = current.s3db\n atable = s3db.project_activity\n aotable = s3db.project_activity_organisation\n\n left = aotable.on((aotable.activity_id == atable.id) & \\\n (aotable.role == 1))\n\n qty = ...
[ "0.644779", "0.644779", "0.48791754", "0.4854704", "0.4740543", "0.4670432", "0.4572707", "0.4572707", "0.4470965", "0.44454432", "0.44387135", "0.44191992", "0.43801567", "0.43525732", "0.4290411", "0.4239853", "0.42330432", "0.4208889", "0.41861644", "0.41510016", "0.413323...
0.6190899
2
Represent a single Row
def represent_row(self, row, prefix=None): # Custom Row (with the Orgs left-joined) organisation_id = row["project_activity_organisation.organisation_id"] if organisation_id: return self.org_represent(organisation_id) else: # Fallback to name name = r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row(self) -> TableRow:\n raise NotImplementedError", "def row(self):\n return self[\"row\"]", "def format_row(self, row):\n raise NotImplementedError()", "def row(self, row_id):\r\n return Row(self, row_id)", "def row(self):\n\t\treturn self.__row", "def _get_single_row(\n ...
[ "0.73848474", "0.7132799", "0.7046983", "0.7046112", "0.69383246", "0.67201823", "0.6698179", "0.65055215", "0.6408882", "0.6400499", "0.63518995", "0.63350195", "0.63344663", "0.632651", "0.6285745", "0.6270171", "0.62334025", "0.6231116", "0.6205497", "0.6188944", "0.616573...
0.6021808
48
Custom lookup method for need rows, does a left join with the tag. Parameters key and fields are not used, but are kept for API compatibility reasons.
def lookup_rows(self, key, values, fields=None): s3db = current.s3db ntable = s3db.need_need nttable = s3db.need_tag left = nttable.on((nttable.need_id == ntable.id) & \ (nttable.tag == "req_number")) qty = len(values) if qty == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_lookup_rows(self, key, values, fields=None):\n\n s3db = current.s3db\n atable = s3db.project_activity\n aotable = s3db.project_activity_organisation\n\n left = aotable.on((aotable.activity_id == atable.id) & \\\n (aotable.role == 1))\n\n qty = ...
[ "0.61288434", "0.61288434", "0.60024345", "0.60024345", "0.59321815", "0.568484", "0.5589088", "0.55711323", "0.5527114", "0.53464085", "0.52466536", "0.5171651", "0.5166802", "0.5062962", "0.4989849", "0.49464908", "0.4922893", "0.4887462", "0.4826645", "0.4806405", "0.47985...
0.5737034
5
Represent a single Row
def represent_row(self, row, prefix=None): # Custom Row (with the tag left-joined) req_number = row["need_need_tag.value"] if req_number: return s3_str(req_number) else: # Fallback to name name = row["need_need.name"] if name: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row(self) -> TableRow:\n raise NotImplementedError", "def row(self):\n return self[\"row\"]", "def format_row(self, row):\n raise NotImplementedError()", "def row(self, row_id):\r\n return Row(self, row_id)", "def row(self):\n\t\treturn self.__row", "def _get_single_row(\n ...
[ "0.73848474", "0.7132799", "0.7046983", "0.7046112", "0.69383246", "0.67201823", "0.6698179", "0.65055215", "0.6408882", "0.6400499", "0.63518995", "0.63350195", "0.63344663", "0.632651", "0.6285745", "0.6270171", "0.62334025", "0.6231116", "0.6205497", "0.6188944", "0.616573...
0.5698491
83
Count need lines per status for all open Events
def needs_by_status(cls): db = current.db s3db = current.s3db table = s3db.need_line etable = s3db.event_event ltable = s3db.event_event_need # Extract the data status = table.status number = table.id.count() query = (etable.closed == False) & \...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def counts_by_test_result_status(self, status):\n return len([\n [key, event] for (key, event) in self.result_events.items()\n if event.get(\"status\", \"\") == status])", "def countSimulationEvents(self, handle):\r\n raise NotImplementedError()", "def num_test_cases(self, l...
[ "0.5970372", "0.5815089", "0.5798976", "0.5784204", "0.5764056", "0.5751111", "0.57467", "0.5698221", "0.56825036", "0.56721026", "0.56549156", "0.56248385", "0.5612142", "0.56002754", "0.5567197", "0.5566079", "0.5564478", "0.55583984", "0.55577123", "0.5551859", "0.5550557"...
0.5355044
35
Count need lines per district and status (top 5 districts) for all open Events
def needs_by_district(cls): T = current.T db = current.db s3db = current.s3db table = s3db.need_line ntable = s3db.need_need etable = s3db.event_event ltable = s3db.event_event_need status = table.status number = table.id.count() locatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def needs_by_district(cls):\n\n T = current.T\n\n db = current.db\n s3db = current.s3db\n\n table = s3db.req_need_line\n ntable = s3db.req_need\n\n left = ntable.on(ntable.id == table.need_id)\n\n status = table.status\n number = table.id.count()\n loc...
[ "0.5754938", "0.551308", "0.54789215", "0.5473855", "0.5299601", "0.5225415", "0.519377", "0.5175258", "0.50648946", "0.50605243", "0.50548464", "0.5018038", "0.5015188", "0.5013341", "0.50113225", "0.5009056", "0.49946627", "0.49912676", "0.49895993", "0.49847665", "0.497986...
0.63438565
0
Count total number of affected people by demographic type for all open Events
def people_affected(cls): db = current.db s3db = current.s3db table = s3db.need_line etable = s3db.event_event ltable = s3db.event_event_need query = (etable.closed == False) & \ (etable.id == ltable.event_id) & \ (ltable.need_id == tabl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eventcount(self):\n return self.serviceinstance_set.aggregate(Count('service__category', distinct=True))['service__category__count']", "def getEventsCounters (attack_df, events):\n n_11 = 0 \n n_12 = 0 \n n_21 = 0 \n n_22 = 0 \n event_type = 0\n for event in events:\n is_attac...
[ "0.60838836", "0.5981166", "0.5896875", "0.58534044", "0.5848672", "0.58462423", "0.5830182", "0.576765", "0.5761788", "0.57357055", "0.57058483", "0.56708616", "0.566682", "0.5646494", "0.56389904", "0.5599355", "0.5591146", "0.55907875", "0.55860656", "0.55800164", "0.55293...
0.5335479
33
Update data files for homepage statistics NB requires writepermission for static/themes/SHARE/data folder+files
def update_data(cls): SEPARATORS = (",", ":") import os os_path_join = os.path.join json_dump = json.dump base = os_path_join(current.request.folder, "static", "themes", "SHARE", "data") path = os_path_join(base, "needs_by_status.json") data = cls.needs_by_sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_stats():\r\n\turl = \"https://www.pathofexile.com/\" + \"api/trade/data/stats\"\r\n\tsave_path = \"data/stats.json\"\r\n\tr = requests.get(url)\r\n\twith open(save_path, \"w\") as fileID:\r\n\t\tfileID.write(r.text)", "def updateFileData(self):\n with open(pagePath(self.pageName)) as f:\n ...
[ "0.6064881", "0.5944808", "0.5934855", "0.58855736", "0.57900345", "0.5746033", "0.56906706", "0.56259215", "0.55120313", "0.54862833", "0.54578334", "0.5341463", "0.53402764", "0.5334595", "0.5310195", "0.5301385", "0.52986026", "0.5267236", "0.52602994", "0.52589476", "0.52...
0.5832078
5
Get last update time of homepage stats
def last_update(cls): import datetime, os from s3 import S3DateTime # Probe file (probing one is good enough since update_data # writes them all at the same time) filename = os.path.join(current.request.folder, "static", "themes", "SHARE", "data"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_updated() -> str:\n return GLOBAL.get(\"last_update\")", "def last_update(self):\r\n request = http.Request('GET', '/metadata/last_update.json')\r\n return request, parsers.parse_json", "async def do_lastupdated():\n\n download = urllib.request.urlopen(server_api)\n data...
[ "0.71105576", "0.69535", "0.68770844", "0.68684065", "0.6840563", "0.679554", "0.6738593", "0.67062396", "0.6684188", "0.6616763", "0.6616763", "0.65213495", "0.64894754", "0.6487261", "0.6483056", "0.6455679", "0.6435866", "0.6434377", "0.63968486", "0.6383192", "0.6383192",...
0.6324592
33
returns an instance for tracking max value
def max(): return KeeperOfMinOrMax(int.__lt__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max(self):\n raise NotImplementedError(\"This is an abstract method and needs to be implemented in derived classes.\")", "def _get_maximum(self):\n return self._maximum", "def get_maximum ( self, object ):\n return self.maximum", "def _get_maximum_value(self):\n if hasattr...
[ "0.801089", "0.79525405", "0.78954244", "0.7758301", "0.7726418", "0.76395977", "0.762583", "0.7622539", "0.76116127", "0.7597168", "0.75255555", "0.74806607", "0.74806607", "0.7441403", "0.7303434", "0.7303434", "0.7265719", "0.7265719", "0.7265719", "0.7265719", "0.7265719"...
0.6979214
35
returns an instance for tracking min value
def min(): return KeeperOfMinOrMax(int.__gt__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self):\n return min(self)", "def get_min(self):\n raise NotImplementedError(\"This is an abstract method and needs to be implemented in derived classes.\")", "def min(self):\n return self.__min", "def _get_minimum(self):\n return self._minimum", "def find_min(self):\n ...
[ "0.79605174", "0.7933093", "0.78569067", "0.78530514", "0.7848658", "0.7848658", "0.7670498", "0.7670498", "0.76520526", "0.76520526", "0.7593828", "0.7530433", "0.74971557", "0.74556816", "0.7447431", "0.7379914", "0.73778284", "0.73778284", "0.7338228", "0.7338228", "0.7338...
0.724613
29
performs comparison and saves the value and payload if the value is the value is greater or less that already stored
def check_keep_or_reject(self, value, payload=None): if self._value == None: self._value = value self._payload = payload return if self._comp_method(self._value, value): self._value = value self._payload = payload
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n\t\ttry:\n\t\t\treturn self.val > other.val\n\t\texcept:\n\t\t\treturn self.val > other", "def greater(value, other):\n return value < other", "def less(value, other):\n return value > other", "def __ge__( self, value ):\r\n\t\treturn ( self > value ) or ( self == value )", ...
[ "0.6650728", "0.6521543", "0.6342532", "0.6316787", "0.62671894", "0.62653714", "0.62531865", "0.61790437", "0.61547315", "0.61547315", "0.6138513", "0.61190176", "0.6106534", "0.6106469", "0.60966355", "0.60682696", "0.6064519", "0.60631853", "0.60225266", "0.601887", "0.601...
0.0
-1
Write the design to the Specctra format
def write(self, design, filename): self._convert(design) with open(filename, "w") as f: f.write(self._to_string(self.pcb.compose()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_fits(self, filename, comment=None, overwrite = False):\n\n\n hdu = fits.PrimaryHDU(self.flux)\n hdu.header = self.header\n\n # Update header information\n crval = self.dispersion[0]\n cd = self.dispersion[1]-self.dispersion[0]\n crpix = 1\n\n hdu.header...
[ "0.6008693", "0.5994822", "0.59387493", "0.5817487", "0.5813526", "0.58061814", "0.5734599", "0.5709072", "0.56894326", "0.56894326", "0.5635465", "0.56147325", "0.56106025", "0.5595291", "0.55891746", "0.55859977", "0.5578043", "0.55598426", "0.55499566", "0.55450016", "0.55...
0.6873917
0
Converts absolute position and updates min/max values for boundary calculation
def _from_pixels_abs(self, point): point = self.resolution.from_pixels(point) self.max_x = max(self.max_x, point[0]) self.max_y = max(self.max_y, point[1]) self.min_x = min(self.min_x, point[0]) self.min_y = min(self.min_y, point[1]) return point
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_limits(self):\n if self.pos_x > self.max_x:\n self.max_x = self.pos_x\n if self.pos_y > self.max_y:\n self.max_y = self.pos_y\n if self.pos_x < self.min_x:\n self.min_x = self.pos_x\n if self.pos_y < self.min_y:\n self.min_y = self...
[ "0.7696437", "0.7344893", "0.6768861", "0.66314876", "0.6551718", "0.65184176", "0.64234716", "0.6389439", "0.632587", "0.62951785", "0.6265869", "0.62353206", "0.6231852", "0.6217978", "0.62174475", "0.617853", "0.61744654", "0.61670834", "0.61637664", "0.6155718", "0.614500...
0.6252436
11
Converts relative position and updates max value for boundary calculation
def _from_pixels(self, point): point = self.resolution.from_pixels(point) if isinstance(point, tuple): self.max_offset = max(self.max_offset, max(abs(point[0]), abs(point[1]))) else: self.max_offset = max(self.max_offset, abs(point)) return point
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_wrt_max(self):\n\n x_min = min(self.x)\n x_max = max(self.x)\n y_min = min(self.y)\n y_max = max(self.y)\n\n x_range = x_max - x_min\n y_range = y_max - y_min\n max_range = max(x_range, y_range)\n\n x = np.array(self.x)\n y = np.array(sel...
[ "0.74460256", "0.730433", "0.67018455", "0.65427494", "0.64605635", "0.6406799", "0.6257399", "0.6246046", "0.6205769", "0.619715", "0.61709636", "0.6141251", "0.61297596", "0.6058174", "0.60514766", "0.6039516", "0.6028614", "0.60220474", "0.59769976", "0.59608996", "0.59607...
0.0
-1
Convert a pin into an outline
def _convert_pin_to_outline(self, pin): pcbshape = specctraobj.Path() pcbshape.layer_id = 'Front' pcbshape.aperture_width = self._from_pixels(1) pcbshape.vertex.append(self._from_pixels((pin.p1.x, pin.p1.y))) pcbshape.vertex.append(self._from_pixels((pin.p2.x, pin.p2.y))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_pin(self, pin, xform):\n # TODO special pin characteristics (inverted, clock)?\n line = [xform.chain(p) for p in (pin.p1, pin.p2)]\n self.canvas.line([(p.x, p.y) for p in line],\n fill=self.options.style['part'])", "def draw_pins():\n\n pass", "def add_o...
[ "0.6245729", "0.6115153", "0.5688149", "0.54557323", "0.5455196", "0.5401273", "0.53704077", "0.5337081", "0.53153765", "0.53109276", "0.52516943", "0.5228548", "0.5222575", "0.51996744", "0.5138629", "0.5120291", "0.5064127", "0.5062142", "0.5055162", "0.504735", "0.5032255"...
0.84876585
0
Specctra does not have arcs so convert them to qarcs
def _get_arc_qarcs(self, arc): min_angle = min(arc.start_angle, arc.end_angle) max_angle = max(arc.start_angle, arc.end_angle) def make_point(angle): """ Make a point """ opp = math.sin(angle * math.pi) * arc.radius adj = math.cos(angle * math.pi) * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_convert_to_q(self):\n\n riskfree = .01\n lmbd = .01\n lmbd_s = .5\n lmbd_y = .5\n mean_v = .5\n kappa_s = 1.5\n kappa_y = .5\n eta_s = .1\n eta_y = .01\n rho = -.5\n\n theta = [riskfree, mean_v, kappa_s, kappa_y, eta_s, eta_y,\n ...
[ "0.5714827", "0.5679851", "0.55328906", "0.5450051", "0.53392696", "0.5317252", "0.53133285", "0.53072596", "0.5298972", "0.5282553", "0.5273815", "0.52621067", "0.52590996", "0.52144307", "0.51778543", "0.5177588", "0.51557475", "0.51449573", "0.5140957", "0.51292527", "0.50...
0.56375253
2
Specctra does not have arcs so convert them to lines
def _get_arc_points(self, arc): min_angle = min(arc.start_angle, arc.end_angle) max_angle = max(arc.start_angle, arc.end_angle) step = 0.2 count = int((max_angle - min_angle) / step) angle = min_angle angles = [] for _ in xrange(count): angle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plt_spec_lines():\n\n for i in range(0, Molecule.species_count):\n mid_line = (Molecule.right_endpt[i] + Molecule.left_endpt[i]) / 2\n shift1 = Molecule.energy[i] - PlotParameter.energy_vshift\n shift2 = Molecule.energy[i] + PlotParameter.name_vshift\n\n en = '{0:5.2f}'.format(Mo...
[ "0.6028584", "0.596023", "0.5728867", "0.570794", "0.5633558", "0.56145054", "0.55716956", "0.55079204", "0.5438757", "0.5379036", "0.5368009", "0.53570163", "0.5322952", "0.5302706", "0.5289199", "0.52479637", "0.5243231", "0.5240698", "0.5237717", "0.52343535", "0.52219564"...
0.0
-1
Convert points to paths
def _points_to_paths(self, points): prev = points[0] result = [] for point in points[1:]: path = specctraobj.Path() path.aperture_width = self._from_pixels(1) path.vertex.append(prev) path.vertex.append(point) result.append(path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_path_to_points(path):\n\n points_x = [path[0][0]]\n points_y = [path[1][0]]\n\n new_path = path\n prev_turn, new_path = path_to_command_thymio(new_path)\n\n for i in range(len(new_path[0]) - 1):\n\n new_turn, new_path = path_to_command_thymio(new_path)\n\n if new_turn != prev_...
[ "0.66994214", "0.65940034", "0.6466729", "0.6385552", "0.6291015", "0.61070466", "0.6079898", "0.6022747", "0.59725976", "0.59154207", "0.59085953", "0.58816546", "0.57742137", "0.5762992", "0.5753632", "0.57504135", "0.57386243", "0.57256794", "0.5717574", "0.5676891", "0.56...
0.83508885
0
Convert to a string
def _to_string(self, lst, indent=''): result = [] for elem in lst: if isinstance(elem, list): if len(elem) > 0: result.append('\n') result.append(self._to_string(elem, indent + ' ')) elif isinstance(elem, float): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str(self) -> str:", "def to_string(self):\r\n return self.__str__()", "def to_string(self, name, value):\r\n \r\n return str(value)", "def as_str(self):\n return self.as_type(str)", "def safeToString():", "def _tostr(t):\n\treturn t.__unicode__()", "def _convert_to_st...
[ "0.82510626", "0.75375146", "0.74364364", "0.7400011", "0.7356428", "0.72777385", "0.717622", "0.7157074", "0.7113981", "0.7066711", "0.7045882", "0.7045882", "0.700627", "0.6949001", "0.6942355", "0.69317114", "0.69135857", "0.6883385", "0.68819666", "0.68667454", "0.6826494...
0.0
-1
Returns the metric used in the search
def metric(self): return self.__metric
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metric(self):\n return self._metric", "def metric(self) -> str:\r\n return self._metric", "def metric(self):\n\n if not self._metric_cache:\n # Select an appropriate statistic\n cls = utils.import_class_or_module(self._metric)\n self._metric_cache = cls...
[ "0.73544544", "0.7343437", "0.7094367", "0.6804628", "0.67208123", "0.6674424", "0.65164226", "0.6417011", "0.6387913", "0.63811266", "0.6376277", "0.6376277", "0.6359819", "0.63471746", "0.63471746", "0.63350976", "0.63268703", "0.63268703", "0.63268703", "0.63268703", "0.63...
0.74399334
0
Returns the clusters obtained through KMeans
def c(self): if self.__c is not None: return self.__c else: raise ValueError("Run .fit() first!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_kmeans(self, data, n_clusters):\n km = cl.KMeans(n_clusters)\n kmf = km.fit(data)\n\n labels = kmf.labels_\n\n return labels, [np.nan]", "def kmeans_clustering(self,k):\r\n \r\n print(colored(\"Performing K-means clustering with %d clusters\\n\"%k,color = 'ye...
[ "0.77555126", "0.7701694", "0.75619465", "0.75249857", "0.7498958", "0.7489687", "0.7466645", "0.74505085", "0.7402365", "0.7400164", "0.7396624", "0.7394601", "0.73939574", "0.7392411", "0.7386585", "0.7364562", "0.7359076", "0.73535013", "0.73448026", "0.732836", "0.7328291...
0.0
-1
Fits the main dataset
def _fit( self, x, clusters=50, a=5, Niter=15, device=None, backend=None, approx=False, n=50, ): if type(clusters) != int: raise ValueError("Clusters must be an integer") if clusters >= len(x): raise Valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n in_dataset, out_dataset = self.get_datasets()", "def setup(self):\n in_dataset, out_dataset = self.get_datasets()", "def datasets(self):\n pass", "def fill_dataset(self):\n rm, rstd = self.get_rolling_stats()\n\n self.add_rolling_mean(rm)\n self.ad...
[ "0.6949576", "0.6949576", "0.69010836", "0.6890312", "0.6760334", "0.67182213", "0.67167246", "0.65993917", "0.65751356", "0.6545717", "0.6540795", "0.64323676", "0.6403967", "0.63968486", "0.6337045", "0.63136876", "0.6257601", "0.6245073", "0.62386703", "0.6236609", "0.6221...
0.0
-1
Obtain the k nearest neighbors of the query dataset y
def _kneighbors(self, y): if self.__x is None: raise ValueError("Input dataset not fitted yet! Call .fit() first!") if self.__device and self.tools.device(y) != self.__device: raise ValueError("Input dataset and query dataset must be on same device") if len(y.shape) != 2:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def k_nearest_neighbors(x_test, df_training, k):\n\n return np.argpartition(distance_to_each_training_point(x_test,\n df_training), k-1)[:,0:k]", "def k_neighbors(self, unknown, dataset, k):\n distances = []\n for title in dataset:\n ...
[ "0.7755072", "0.7698316", "0.76627266", "0.7543038", "0.73983365", "0.70976907", "0.7065738", "0.70630825", "0.70598435", "0.7000754", "0.6987801", "0.6964323", "0.6951839", "0.69448984", "0.6932475", "0.692119", "0.69113904", "0.68482804", "0.68467015", "0.6817071", "0.67800...
0.7627212
3
Performs a brute force search with KeOps
def brute_force(self, x, y, k=5): x_LT = self.__LazyTensor(self.tools.unsqueeze(x, 0)) y_LT = self.__LazyTensor(self.tools.unsqueeze(y, 1)) D_ij = self.__distance(y_LT, x_LT) return D_ij.argKmin(K=k, axis=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bruteForceSearch(digraph, start, end, maxTotalDist, maxDistOutdoors):\n bFSResult = {}\n \n# Helper function to calculate Total Distance in a path\n def Dist(path):\n result = 0\n if path == None:\n return result\n if len(path) == 0:\n return result\n ...
[ "0.6327519", "0.6254991", "0.6160002", "0.6040337", "0.5772051", "0.5755324", "0.5755324", "0.5755324", "0.5739468", "0.57314223", "0.5714742", "0.57073474", "0.5679389", "0.5658943", "0.5656112", "0.5643047", "0.551255", "0.5510731", "0.5510731", "0.5510731", "0.5509149", ...
0.0
-1
Initialise the IVFFlat class. IVFFlat is a KNN approximation algorithm that first clusters the data and then performs the query search on a subset of the input dataset.
def __init__(self, k=5, metric="euclidean", normalise=False): from pykeops.torch import LazyTensor self.__get_tools() super().__init__(k=k, metric=metric, normalise=normalise, LazyTensor=LazyTensor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dataset, ix_lst=None, size=None):\n # Indexes\n if ix_lst is None:\n ix_lst = [ix for ix in range(len(dataset.instances))\n if ix not in dataset.hold_out_ixs]\n self.instances = [ex for ix, ex in enumerate(dataset.instances)\n ...
[ "0.5946044", "0.59000456", "0.5887465", "0.58563083", "0.58301413", "0.5791947", "0.57555425", "0.57498944", "0.5745469", "0.5719567", "0.5717328", "0.5681291", "0.5667393", "0.5657065", "0.56502914", "0.56476444", "0.5627035", "0.5598171", "0.55951315", "0.5588736", "0.55792...
0.0
-1
Fits a dataset to perform the nearest neighbour search over KMeans is performed on the dataset to obtain clusters Then the closest clusters to each cluster is stored for use during query time
def fit(self, x, clusters=50, a=5, Niter=15, approx=False, n=50): if type(x) != torch.Tensor: raise ValueError("Input dataset must be a torch tensor") return self._fit( x, clusters=clusters, a=a, Niter=Niter, device=x.device, approx=approx, n=n )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, data):\n\t\tepsilon = self.epsilon\n\t\ttempDist = 1.0\n\t\tk = self.k\n\t\tcenters = data.rdd.takeSample(False, k, 1)\n\t\ti = 0 \n\t\twhile tempDist > epsilon or self.maxNoOfIteration > i:\n\t\t\ti+=1\t\t\t\n\t\t\tclosest = data.map(lambda p: (closestCluster(p, centers), (np.array(p), 1)))\n ...
[ "0.7502585", "0.7192687", "0.7173278", "0.70446146", "0.70254654", "0.68059593", "0.6731044", "0.6718728", "0.667073", "0.6650163", "0.6635303", "0.6587959", "0.6564522", "0.6552284", "0.65222496", "0.65213925", "0.65047365", "0.64732283", "0.6452072", "0.6439149", "0.6438148...
0.0
-1
Obtains the nearest neighbors for an input dataset from the fitted dataset
def kneighbors(self, y): if type(y) != torch.Tensor: raise ValueError("Query dataset must be a torch tensor") return self._kneighbors(y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_neighbor(data):\n features = set([i for i, x in enumerate(data[0][1])])\n return leave_one_out_cross_validation(data, features)", "def nearest_neighbors_classifier(data):\n clf = KNeighborsClassifier(3, 'distance')\n clf.name = \"KNN\"\n train_predict_and_results(data, clf)", "def kn...
[ "0.7695886", "0.7258682", "0.68946004", "0.6866377", "0.65122396", "0.6471687", "0.64388853", "0.64172477", "0.64019704", "0.6378176", "0.6361856", "0.6331139", "0.63292724", "0.632762", "0.63014627", "0.62986773", "0.62903064", "0.6278115", "0.6265846", "0.6227376", "0.61939...
0.0
-1
List the currently connected accounts
def GetAccountList(self): return self.accounts.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_accounts(self):\n pass", "def display_accounts(cls):\n return cls.account_list", "def getConnectedAccounts(**kwargs):\n strProdURL = kwargs[\"strProdURL\"]\n orgID = kwargs[\"ORG_ID\"]\n sessiontoken = kwargs[\"sessiontoken\"]\n\n accounts = get_connected_accounts_json(strPro...
[ "0.79298896", "0.7443954", "0.71552277", "0.7138856", "0.7105416", "0.70626193", "0.70603573", "0.7036063", "0.6985466", "0.6974549", "0.69650537", "0.6957853", "0.6915955", "0.6900481", "0.6807097", "0.6788111", "0.67642707", "0.6755638", "0.6753649", "0.6729993", "0.6722212...
0.7261498
2
Select an account and set it as the current 'working' account Calling this method also cleares the Batch Queue, if it isn't empty
def SelectAccount(self, nickname): self.ClearBatchQueue() if nickname in self.accounts: self.current_account = self.accounts[nickname] self.client = self.current_account.client return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account(self, account):\n\n self._account = account", "def account(self, account):\n\n self._account = account", "def account(self, account):\n\n self._account = account", "def account(self, account):\n\n self._account = account", "def account(self, account: str):\n s...
[ "0.5898519", "0.5898519", "0.5898519", "0.5898519", "0.58418894", "0.5787817", "0.5739551", "0.57178605", "0.5570972", "0.55681026", "0.55255353", "0.54933035", "0.5438046", "0.54226345", "0.5285505", "0.52594006", "0.52074546", "0.5121794", "0.5118399", "0.50960463", "0.5094...
0.6025916
0
Clear the batch queue
def ClearBatchQueue(self): self.batch_queue = gdata.contacts.data.ContactsFeed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearQueueAll():", "def clear_queue(self):\n self.queue = deque()", "def clear(self):\n self.queue.clear()", "def clear_queue(self):\n while not self.queue.empty():\n self.queue.get()", "def clear(self):\n self.queue = Queue()", "def clear_batch(self):\n ...
[ "0.8027347", "0.79099566", "0.7851463", "0.780406", "0.7732012", "0.75668514", "0.7311712", "0.721093", "0.721093", "0.721093", "0.7194719", "0.7069694", "0.70656955", "0.69665104", "0.6955623", "0.6941233", "0.68873274", "0.6882734", "0.68424505", "0.68145674", "0.6807092", ...
0.8334762
0
Add an action to the batch queue
def BatchEnqueue(self, action, contact): if action == 'retrieve': self.batch_queue.AddQuery(entry=contact, batch_id_string='retrieve') elif action == 'create': contact.group_membership_info = [gdata.contacts.data.GroupMembershipInfo(href=self.GetFirstGroupId())] self.batch_queue.AddInsert(entry=contact,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_action(self, talk_action):\n self.action_queue.put(talk_action)", "def enqueue_action(self, pid:PID, action: PlayerActions):\n\t\tif not action:\n\t\t\treturn\n\n\t\tself._action_queue[pid].append(action)", "def push(self, trigger, action):\n self.queue.append((trigger, action))", "def ...
[ "0.80876786", "0.7393114", "0.714681", "0.70303786", "0.700273", "0.69231564", "0.68621415", "0.68621415", "0.684907", "0.6752141", "0.66660917", "0.653858", "0.65167445", "0.6484835", "0.64816564", "0.6444585", "0.6358973", "0.63230836", "0.6305995", "0.62774354", "0.6236577...
0.6674077
10
Execute all actions in the batch queue
def ExecuteBatchQueue(self): self.client.ExecuteBatch(self.batch_queue, 'https://www.google.com/m8/feeds/contacts/default/full/batch') self.ClearBatchQueue();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):\n for action in self.actions:\n self._logger.info('[~] Executing %s.', action)\n self._execute_action(action)", "def execute(self):\n for move in self._queue:\n move.execute()", "def execute(self):\n\n if self.__command_queue:\n ...
[ "0.78203684", "0.75656724", "0.69675845", "0.6904114", "0.6751323", "0.6749497", "0.67120445", "0.6696298", "0.66439104", "0.6619434", "0.65914667", "0.6333632", "0.6331009", "0.6319987", "0.6319611", "0.6280162", "0.6272014", "0.6271824", "0.626646", "0.6262457", "0.62222123...
0.69831717
2
Get a list of all the contacts from the currently selected account
def GetContactList(self): feeds = [] feed = self.client.GetContacts() feeds.append(feed) next = feed.GetNextLink() while next: feed = self.client.GetContacts(uri=next.href) feeds.append(feed) next = feed.GetNextLink() contacts = [] for feed in feeds: if not feed.entry: continue else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_contacts(self):\n return self.contacts", "def fetch_contacts(owner_account_id):\n resp = oauth.tapkey.get(f\"Owners/{owner_account_id}/Contacts?$select=id,identifier\")\n contacts = resp.json()\n return contacts", "def get_queryset(self):\n return self.request.user.contacts.all(...
[ "0.80982107", "0.7876462", "0.7686326", "0.7612732", "0.75763845", "0.74758196", "0.7394858", "0.73458034", "0.72936374", "0.72662973", "0.7218797", "0.71633536", "0.7125692", "0.70462304", "0.69273126", "0.6882803", "0.68397015", "0.6831734", "0.6804959", "0.6799883", "0.677...
0.7307596
8
Lazily get the first contact group's Atom Id
def GetFirstGroupId(self): return self.client.GetGroups().entry[0].id.text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_contact_group(dbcon: DBConnection, id: int) -> Any: # Use any because optional returns suck.\n q = \"\"\"select id, name, active from contact_groups where id=%s\"\"\"\n row = await dbcon.fetch_row(q, (id,))\n contact = None\n if row:\n contact = object_models.ContactGroup(*row)\n ...
[ "0.6018908", "0.5888721", "0.5825256", "0.57383466", "0.56857145", "0.54320073", "0.54071623", "0.538237", "0.5367063", "0.5323985", "0.52931386", "0.5278044", "0.52581567", "0.52283746", "0.52128196", "0.51881367", "0.51880187", "0.51782674", "0.51699287", "0.5155815", "0.51...
0.6422962
0
Add a contact to the selected account
def AddContact(self, contact): contact.group_membership_info = [gdata.contacts.data.GroupMembershipInfo(href=self.GetFirstGroupId())] try: self.client.CreateContact(contact) except gdata.client.RequestError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_contact(self, name, number, email, zipcode):\n \n new_contact = f\"{name}, {number}, {email}, {zipcode}\"\n contact_list = [name,number,email,zipcode]\n self.contacts.append(contact_list)\n self.save()\n print(f\"Thank you {new_contact} has been added to your conta...
[ "0.77608013", "0.7678672", "0.75593245", "0.7524902", "0.74078804", "0.73187745", "0.7144197", "0.71273273", "0.7037132", "0.7000438", "0.6976581", "0.68927115", "0.6833474", "0.6822567", "0.6807116", "0.66798747", "0.66762304", "0.6609145", "0.65774065", "0.65446246", "0.649...
0.7551735
3
Remove a contact from the selected account
def RemoveContact(self, contact): self.client.Delete(contact)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_contact(self):\n contact_mob_num = input(\"-=\" * 30 + \"\\n\" + \"Please enter contact's mobile number to be removed: \")\n contact = self.auth.get_users_by_MobNum(contact_mob_num)\n if (not contact) or contact not in self._user.contacts:\n print('This user not in your c...
[ "0.7927598", "0.78937054", "0.76196754", "0.760548", "0.7403511", "0.7339263", "0.7177775", "0.71389616", "0.69924855", "0.6943864", "0.68841195", "0.681138", "0.6772057", "0.67245716", "0.66446775", "0.6630713", "0.66240466", "0.65467685", "0.653159", "0.64608634", "0.642118...
0.82682854
0
Remove all contacts from the selected account
def RemoveAll(self): contacts = self.GetContactList() for contact in contacts: self.BatchEnqueue('delete', contact) self.ExecuteBatchQueue()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_contacts(self):\n self.db.delete_all_contacts()\n return self.update_contacts()", "def del_contact_all(self):\n\n send_key(KEY_MENU)\n delstr = contact.get_value('contact_delete')\n if search_text(delstr):\n click_textview_by_text(delstr)\n clic...
[ "0.7838508", "0.73882663", "0.71244544", "0.6743833", "0.6735509", "0.66522604", "0.6644226", "0.65938866", "0.6535013", "0.6475446", "0.63914645", "0.62559044", "0.6243891", "0.6176765", "0.610713", "0.6046226", "0.60396665", "0.60009325", "0.598013", "0.5964348", "0.5959389...
0.7585864
1
Copy all contacts from one account to another This method does not check for duplicates
def CopyContacts(self, from_nickname, to_nickname): self.SelectAccount(from_nickname) contacts = self.GetContactList() self.SelectAccount(to_nickname) for contact in contacts: self.BatchEnqueue('create', contact) self.ExecuteBatchQueue()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MultiWaySync(self, accounts):\n\t\tcleaned_contacts = []\n\t\tcontacts = []\n\t\t\n\t\tfor account in accounts:\n\t\t\tself.SelectAccount(account)\n\t\t\tcontacts.extend(self.GetContactList())\n\t\t\n\t\tduplicates, originals = ceFindDuplicates(contacts)\n\t\tmerged, todelete = ceMergeDuplicates(duplicates)\n\...
[ "0.6812184", "0.6329817", "0.5751867", "0.5707562", "0.5707562", "0.5586134", "0.5383878", "0.5352327", "0.5340893", "0.53407866", "0.53282636", "0.53140664", "0.5285255", "0.5284708", "0.52719766", "0.52107036", "0.52066034", "0.51984245", "0.51651853", "0.5159195", "0.51517...
0.756032
0
Move all contacts from one account to another This method does not check for duplicates
def MoveContacts(self, from_nickname, to_nickname): self.SelectAccount(from_nickname) contacts = self.GetContactList() # Copy contacts -before- deleting self.SelectAccount(to_nickname) for contact in contacts: self.BatchEnqueue('create', contact) self.ExecuteBatchQueue() # Then delete self.Sele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MultiWaySync(self, accounts):\n\t\tcleaned_contacts = []\n\t\tcontacts = []\n\t\t\n\t\tfor account in accounts:\n\t\t\tself.SelectAccount(account)\n\t\t\tcontacts.extend(self.GetContactList())\n\t\t\n\t\tduplicates, originals = ceFindDuplicates(contacts)\n\t\tmerged, todelete = ceMergeDuplicates(duplicates)\n\...
[ "0.69824326", "0.6433265", "0.57518244", "0.56264514", "0.56264514", "0.5607597", "0.5603125", "0.55658954", "0.5536112", "0.5534724", "0.54958487", "0.5490326", "0.5480002", "0.5392368", "0.53907484", "0.5382409", "0.53588146", "0.5324467", "0.5263877", "0.52340406", "0.5210...
0.72994787
0
Perform a multiway sync between given accounts
def MultiWaySync(self, accounts): cleaned_contacts = [] contacts = [] for account in accounts: self.SelectAccount(account) contacts.extend(self.GetContactList()) duplicates, originals = ceFindDuplicates(contacts) merged, todelete = ceMergeDuplicates(duplicates) cleaned_contacts.extend(origina...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_nas(self, users_from_db: Iterator):", "def synch_all(cls, account, type, filter=None, *args):\n for repo_data in repositories(account, type, filter):\n repo = cls(repo_data)\n repo.synch(*args)", "def sync(self, sync_from, sync_to, **kwargs):\n return self.exec_comm...
[ "0.6455885", "0.6311536", "0.6180077", "0.61477345", "0.6121937", "0.6006474", "0.58930635", "0.5883944", "0.5810142", "0.5777375", "0.5727696", "0.57057714", "0.56830674", "0.5662616", "0.5652426", "0.564118", "0.5630871", "0.56220114", "0.5602681", "0.55613834", "0.55493385...
0.7644102
0
Update based on device list.
def update_visual(screen: pygame.Surface, device_list: list): for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() return None white = (255, 255, 255) black = (0, 0, 0) blue = (0, 0, 128) screen.fill(white) dev_num = 1 num_devs = len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_device_list(self):\n\n # Update devices via HTTP request (basic device data - no status)\n self.__http_update_device_list()\n\n # Fetch status for each known device via MQTT\n for gdev in self.__devices.values():\n gdev.request_status()", "def update_device_list(...
[ "0.82892597", "0.77920574", "0.7386299", "0.73323125", "0.7261158", "0.7261158", "0.70637846", "0.6975202", "0.69620645", "0.69328254", "0.6882042", "0.68545794", "0.67855287", "0.6754338", "0.6658994", "0.66031986", "0.6598942", "0.659559", "0.6547921", "0.65373826", "0.6494...
0.6028516
50
Runs `det experiment describe` CLI command on a finished experiment. Will raise an exception if `det experiment describe` encounters a traceback failure.
def run_describe_cli_tests(experiment_id: int) -> None: # "det experiment describe" without metrics. with tempfile.TemporaryDirectory() as tmpdir: subprocess.check_call( [ "det", "-m", conf.make_master_url(), "experiment", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe():", "def describe(self, *args, **kwargs):\n\t\treturn self.data.describe(*args, **kwargs)", "def test_describe_model(self):\n\t\tdetails = self.watcher.describe()\n\t\tprint(details)\n\t\tself.assertEqual(len(details), 11)", "def test_recognize_describe(self):\n pass", "def test_descri...
[ "0.5586464", "0.5564415", "0.5341794", "0.5270411", "0.5181873", "0.5082891", "0.5071718", "0.50258327", "0.50245225", "0.4985327", "0.49451223", "0.49108976", "0.48686293", "0.48666832", "0.48470518", "0.48347655", "0.4822859", "0.47746998", "0.47700247", "0.47659424", "0.47...
0.7508023
0
Runs listrelated CLI commands on a finished experiment. Will raise an exception if the CLI command encounters a traceback failure.
def run_list_cli_tests(experiment_id: int) -> None: subprocess.check_call( ["det", "-m", conf.make_master_url(), "experiment", "list-trials", str(experiment_id)] ) subprocess.check_call( ["det", "-m", conf.make_master_url(), "experiment", "list-checkpoints", str(experiment_id)] ) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pre_cli_list(run):\n out, err = run(dork.cli.the_predork_cli, [], *(\"\", \"-l\"))\n assert \"test.yml\" in out, \\\n \"Failed run the dork.cli.the_predork_cli method: {err}\"\\\n .format(err=err)", "def command_list(self, command):\n\n # See if the list exists and return resu...
[ "0.61308813", "0.59608287", "0.5957649", "0.58396363", "0.5808478", "0.5768765", "0.57584125", "0.5753735", "0.5732263", "0.56613624", "0.56290406", "0.56156904", "0.5615358", "0.5497544", "0.5480825", "0.5480825", "0.5471782", "0.5451167", "0.54397607", "0.54342854", "0.5424...
0.7019173
0
This function is called when the user uses help.
def usage(): print 'Convert a Debian or an RPM Package into an Arch Linux package (' + \ 'and vice-versa).' print print 'Usage: %s [OPTIONS] debian_package.deb [arch_package.pkg.tar.gz]' \ % os.path.basename(sys.argv[0]) print print "OPTIONS :" print " -h, --help ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help():\n print \"Help comes to those who ask\"", "def help(self):", "def help(self):", "def help():\n \n pass", "def help():", "def help(self):\n pass", "def help(self):\n pass", "def show_help():\n pass", "def help(self):\n\t\treturn", "def help():\n pri...
[ "0.86703736", "0.86196375", "0.86196375", "0.86186236", "0.8600454", "0.8447618", "0.8447618", "0.8386246", "0.8376183", "0.8332743", "0.83264875", "0.82946587", "0.82228065", "0.8130156", "0.81278056", "0.8123208", "0.8053051", "0.80143815", "0.7959358", "0.7923357", "0.7890...
0.0
-1
Suggest to the user to read the help.
def more_informations(): print "--help for more informations." sys.exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def askForHelp(self):\n try:\n serverResult = self.game.server.askForHelp(self.game.authKey)\n if type(serverResult) == types.ListType:\n self.help = serverResult\n self.displayHelpMessage()\n else:\n self.modeMsgBox(serverResult)...
[ "0.67134285", "0.6657495", "0.65506464", "0.6540987", "0.6528242", "0.6509463", "0.64629525", "0.6430398", "0.64146763", "0.6410141", "0.6392874", "0.6388566", "0.6374893", "0.6357002", "0.63350844", "0.6324055", "0.6314089", "0.6314089", "0.62832314", "0.6282355", "0.6279245...
0.0
-1
Handle all options in the arguments. This function returns a dictionary contain 'input_pkg' and 'output_pkg' keywords.
def handle_arguments(): result = {'input_pkg':'', 'output_pkg':''} try: args = sys.argv[1:] optlist = gnu_getopt(args, 'h', ['help']) except GetoptError: print 'Error when parsing arguments.' more_informations() if len(sys.argv) < 2: print 'No input file.' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processArgs(printHelp=False):\n parser = OptionParser()\n\n parser.add_option('-i', '--input',\n dest='input',\n help='Name of the latex file, for example, document.tex',\n metavar='string')\n parser.add_option('-o', '--output',\n ...
[ "0.5959439", "0.5875722", "0.5843192", "0.5764533", "0.5762908", "0.57036674", "0.5702611", "0.56741303", "0.56671953", "0.5666019", "0.56415075", "0.5633455", "0.5577047", "0.55590963", "0.5546385", "0.55420923", "0.5530415", "0.55239266", "0.5492701", "0.5489848", "0.547874...
0.8013772
0
Get a message to speak on first load of the skill. Useful for postinstall setup instructions.
def get_intro_message(self): self.speak_dialog("thank.you") return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speak(message):\n print(message)", "def speak(self):\n print(\"meow!\")", "def speak(self):\n print(\"hello\")", "def install_default_skills(speak=True):\n if exists(MSM_BIN):\n p = subprocess.Popen(MSM_BIN + \" default\", stderr=subprocess.STDOUT,\n s...
[ "0.61970544", "0.59956497", "0.5926281", "0.5872123", "0.58696866", "0.5797025", "0.579132", "0.57152486", "0.5705992", "0.56784135", "0.56503886", "0.5580634", "0.552781", "0.55209553", "0.55069524", "0.5461222", "0.54496735", "0.5446346", "0.5446035", "0.54340476", "0.54330...
0.6545299
0
Handle conversation. This method gets a peek at utterances before the normal intent handling process after a skill has been invoked once. To use, override the converse() method and return True to indicate that the utterance has been handled.
def converse(self, utterances, lang="en-us"): # check if game was abandoned midconversation and we should clean it up self.maybe_end_game() if self.playing: ut = utterances[0] # if self will trigger do nothing and let intents handle it if self.will_trigger(ut)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_converse_request(message):\n skill_id = int(message.data[\"skill_id\"])\n utterances = message.data[\"utterances\"]\n lang = message.data[\"lang\"]\n global ws, loaded_skills\n # loop trough skills list and call converse for skill with skill_id\n for skill in loaded_skills:\n if...
[ "0.607286", "0.60394377", "0.59018356", "0.5812541", "0.5732079", "0.5696963", "0.56619567", "0.56086385", "0.5504005", "0.54966825", "0.54938865", "0.5492362", "0.5490855", "0.54654175", "0.5454416", "0.5349049", "0.5348369", "0.53459346", "0.5345559", "0.53378665", "0.53232...
0.66725177
0
Lists cases assigned to the current user.
def do_jira(self, arg): jql = self.settings['jira_jql'] if arg.startswith('b'): out.info('Opening browser.') webbrowser.open(self.jira_url() + '/issues/?jql=' + jql) else: open_issues = self.get_open_issues() cases = [ (issue.key, i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_cases(context,case_id):\n\n adapter = context.obj['adapter']\n\n if case_id is not None:\n results = adapter.find_case({'case_id': case_id})\n\n else:\n results = adapter.find_cases({})\n\n click.echo(pprint(results))", "def list(self):\n print \"\\nAvailable Test Cases\...
[ "0.5828191", "0.57715195", "0.5665513", "0.56009257", "0.5560734", "0.55546606", "0.5414231", "0.5294118", "0.5283976", "0.5227256", "0.5224363", "0.52142394", "0.5208721", "0.5202496", "0.51961356", "0.51907045", "0.51902115", "0.51801664", "0.51342934", "0.51191497", "0.511...
0.0
-1
Creates a git commit message template for cases currently assigned to you.
def do_jira_case_commit_message(self, arg): cases = [(issue.key, issue.fields.summary, self.jira_url() + "/browse/" + issue.key) for issue in self.get_open_issues()] msg = """ -------------------------------------------------------------------- [{}] {} <msg> {} ------------------------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_commit(\n self, msg: Optional[str] = None, author: Optional[str] = None\n ) -> dict:\n if author:\n mes_author = author\n else:\n mes_author = self._author\n if not msg:\n msg = f\"Commit via python client {__version__}\"\n ci = {...
[ "0.58265114", "0.56810087", "0.56475306", "0.54282033", "0.53819776", "0.5301259", "0.52773494", "0.5231186", "0.5216202", "0.5213242", "0.5183639", "0.517318", "0.5149136", "0.5134215", "0.512786", "0.5119132", "0.5117917", "0.50955975", "0.50477743", "0.5016975", "0.5010600...
0.5991317
0
For PFG enabling forms ('service' field)
def getServices(self): catalog = plone.api.portal.get_tool('portal_catalog') path = '{}/catalog'.format('/'.join(plone.api.portal.get().getPhysicalPath())) query = dict(portal_type='Service', sort_on='sortable_title', path=path) result = list() for brain in catalog(**query): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_changed(self):\n\n if self.ui.comboBox_service.currentText() == \"Google\":\n self.ui.label_id.setEnabled(False)\n self.ui.lineEdit_id.setEnabled(False)\n self.ui.label_key.setEnabled(False)\n self.ui.lineEdit_key.setEnabled(False)\n self.ui...
[ "0.6525419", "0.5879964", "0.572268", "0.56772685", "0.5677172", "0.56644684", "0.5658642", "0.5644498", "0.5629904", "0.55910754", "0.5581871", "0.55702734", "0.55578226", "0.5544959", "0.5526073", "0.5516057", "0.55154926", "0.550897", "0.54889435", "0.5470525", "0.54473627...
0.0
-1
For PFG enabling forms ('project' field)
def getProjects(self): catalog = plone.api.portal.get_tool('portal_catalog') path = '{}/projects'.format('/'.join(plone.api.portal.get().getPhysicalPath())) query = dict(portal_type='Project', sort_on='sortable_title', path=path) result = list() for brain in catalog(**query): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_project_cant_disable_itself(self):\n page_projects = self._page_projects()\n project_name = self.app.current_project\n\n with page_projects.table_projects.row(\n name=project_name).dropdown_menu as menu:\n menu.button_toggle.click()\n menu.item_ed...
[ "0.6683946", "0.66821754", "0.6651207", "0.6266415", "0.61734617", "0.6170577", "0.61583537", "0.60570997", "0.60456896", "0.59930354", "0.5979971", "0.5880963", "0.58326745", "0.5829549", "0.5805503", "0.580025", "0.57936114", "0.57883453", "0.5727333", "0.56871516", "0.5658...
0.0
-1
Reports the state of the toil.
def main(): ########################################## #Construct the arguments. ########################################## parser = getBasicOptionParser("usage: %prog [--toil] JOB_TREE_DIR [options]", "%prog 0.1") parser.add_option("--toil", dest="toil", help=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_state(self):\n raise AIError(\"Must be implemented in child class!\")", "def Report(self):\n return True", "def report():\n pass", "def log_state(self):\n rospy.loginfo(\"STATE: %s [%s]\" %(self.__class__.__name__, 15 - self.ros_node.get_time()))", "def save_state(se...
[ "0.6147335", "0.6102503", "0.6033684", "0.59858537", "0.5905538", "0.5904048", "0.5902007", "0.5894178", "0.5862637", "0.5854155", "0.5839881", "0.57337976", "0.5700883", "0.56285226", "0.56130916", "0.56054235", "0.55884707", "0.55884707", "0.5560808", "0.5552423", "0.554738...
0.0
-1
lambda function handler for getting trash day
def lambda_handler(event, context) -> dict: logging.info('Starting function with context=%s and event=%s', context, event) date = event['date'] holiday_schedule = trash_schedule_service.get_schedule() trash_day = trash.next_trash_day(date, holiday_schedule) logging.info('Completed function with res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n logging.info('Starting function with context=%s and event=%s', context, event)\n holiday_schedule = trash.holidayschedule()\n old_holiday_schedule = trash_service.list()['data']\n old_holidays = [old_holiday['name'] for old_holiday in old_holiday_schedule]\n log...
[ "0.6090012", "0.54774374", "0.5461324", "0.5409436", "0.53761524", "0.53742063", "0.5331051", "0.5287995", "0.51901144", "0.5178555", "0.5161938", "0.5114322", "0.5079114", "0.50751776", "0.5070596", "0.50560266", "0.50401527", "0.50214356", "0.49688548", "0.49537805", "0.495...
0.74920136
0
Convert an image from LAB color space to XYZ color space
def lab_to_xyz(image: tf.Tensor) -> tf.Tensor: l, a, b = tf.unstack(image, axis=-1) var_y = (l + 16) / 116 var_x = a / 500 + var_y var_z = var_y - b / 200 var_x = tf.where(tf.pow(var_x, 3) > 0.008856, tf.pow(var_x, 3), (var_x - 16 / 116) / 7.787) var_y = tf.where(tf.pow(var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Lab_to_XYZ(cobj, *args, **kwargs):\r\n\r\n illum = cobj.get_illuminant_xyz()\r\n xyz_y = (cobj.lab_l + 16.0) / 116.0\r\n xyz_x = cobj.lab_a / 500.0 + xyz_y\r\n xyz_z = xyz_y - cobj.lab_b / 200.0\r\n \r\n if math.pow(xyz_y, 3) > color_constants.CIE_E:\r\n xyz_y = math.pow(xyz_y, 3)\r\n ...
[ "0.72538626", "0.6935359", "0.6835545", "0.6804529", "0.6711759", "0.66599464", "0.6521106", "0.64231324", "0.6351376", "0.63161516", "0.62939584", "0.62429935", "0.6191677", "0.6155172", "0.6133433", "0.60679656", "0.605217", "0.600619", "0.6003839", "0.5994653", "0.5972754"...
0.72095025
1
Convert an image from XYZ color space to LAB color space
def xyz_to_lab(image: tf.Tensor) -> tf.Tensor: x, y, z = tf.unstack(image, axis=-1) refx = 95.047 refy = 100.00 refz = 108.883 var_x = x / refx var_y = y / refy var_z = z / refz var_x = tf.where(var_x > 0.008856, tf.pow(var_x, 1 / 3), (7.787 * var_x) + (16 / 116))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_to_lab(image: tf.Tensor) -> tf.Tensor:\n xyz = rgb_to_xyz(image)\n lab_image = xyz_to_lab(xyz)\n return lab_image", "def XYZ_to_Lab(cobj, *args, **kwargs):\r\n\r\n illum = cobj.get_illuminant_xyz()\r\n temp_x = cobj.xyz_x / illum[\"X\"]\r\n temp_y = cobj.xyz_y / illum[\"Y\"]\r\n temp...
[ "0.7460319", "0.7458232", "0.72022015", "0.7077035", "0.6824317", "0.6632177", "0.65915054", "0.65851694", "0.65589637", "0.65200937", "0.6511321", "0.6508878", "0.63595843", "0.62574404", "0.6182268", "0.61593455", "0.61016095", "0.6056708", "0.6038471", "0.6021243", "0.5998...
0.6739732
5
Convert an image from XYZ color space to RGB color space
def xyz_to_rgb(image: tf.Tensor) -> tf.Tensor: x, y, z = tf.unstack(image, axis=-1) var_x = x / 100 var_y = y / 100 var_z = z / 100 var_r = var_x * 3.2406 + var_y * -1.5372 + var_z * -0.4986 var_g = var_x * -0.9689 + var_y * 1.8758 + var_z * 0.0415 var_b = var_x * 0.0557 + var_y * -0.2040 +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XYZ_to_RGB(XYZ,\n illuminant_XYZ,\n illuminant_RGB,\n XYZ_to_RGB_matrix,\n chromatic_adaptation_transform='CAT02',\n encoding_cctf=None):\n\n M = chromatic_adaptation_matrix_VonKries(\n xyY_to_XYZ(xy_to_xyY(illuminant_XYZ)),\n ...
[ "0.6828028", "0.68103015", "0.68066865", "0.6763418", "0.66843706", "0.66742265", "0.66261303", "0.65840024", "0.6561155", "0.6552539", "0.64690375", "0.645088", "0.63681024", "0.6365761", "0.63621247", "0.6326144", "0.6306346", "0.6306079", "0.6283632", "0.6256421", "0.62433...
0.7146014
0
Convert an image from RGB color space to XYZ color space
def rgb_to_xyz(image: tf.Tensor) -> tf.Tensor: r, g, b = tf.unstack(image, axis=-1) var_r = r / 255 var_g = g / 255 var_b = b / 255 var_r = tf.where(var_r > 0.04045, tf.pow((var_r + 0.055) / 1.055, 2.4), var_r / 12.92) var_g = tf.where(var_g > 0.04045, tf.pow((var_g + 0.055...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_to_xyz(rgb_color):\n\n r = (rgb_color[0] / 255)\n g = (rgb_color[1] / 255)\n b = (rgb_color[2] / 255)\n\n if r > 0.04045:\n r = ((r + 0.055) / 1.055) ** 2.4\n else:\n r = r / 12.92\n\n if g > 0.04045:\n g = ((g + 0.055) / 1.055) ** 2.4\n else:\n g = g / 12.9...
[ "0.6907906", "0.6867097", "0.68299574", "0.66412497", "0.66398394", "0.65136164", "0.6503859", "0.6343428", "0.6280779", "0.6266033", "0.62629265", "0.620036", "0.61658543", "0.6152105", "0.60904413", "0.6024829", "0.5986624", "0.59797454", "0.597226", "0.5968314", "0.5912936...
0.7601516
0
Convert an image from RGB color space to LAB color space RGB > XYZ > LAB
def rgb_to_lab(image: tf.Tensor) -> tf.Tensor: xyz = rgb_to_xyz(image) lab_image = xyz_to_lab(xyz) return lab_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lab_to_rgb(image: tf.Tensor) -> tf.Tensor:\n xyz = lab_to_xyz(image)\n rgb_image = xyz_to_rgb(xyz)\n return rgb_image", "def lab_to_rgb(img):\n new_img = np.zeros((256, 256, 3))\n for i in range(len(img)):\n for j in range(len(img[i])):\n pix = img[i, j]\n new_img[...
[ "0.76128566", "0.736024", "0.7093746", "0.70733243", "0.688894", "0.67929274", "0.67809963", "0.6703727", "0.66217625", "0.6567671", "0.6539482", "0.6528808", "0.6519189", "0.64457124", "0.64197767", "0.63783777", "0.637468", "0.630608", "0.6248861", "0.6204791", "0.618432", ...
0.7743007
0
Convert an image from LAB color space to RGB color space LAB > XYZ > RGB
def lab_to_rgb(image: tf.Tensor) -> tf.Tensor: xyz = lab_to_xyz(image) rgb_image = xyz_to_rgb(xyz) return rgb_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lab_to_rgb(img):\n new_img = np.zeros((256, 256, 3))\n for i in range(len(img)):\n for j in range(len(img[i])):\n pix = img[i, j]\n new_img[i, j] = [(pix[0] + 1) * 50, (pix[1] + 1) / 2 * 255 - 128, (pix[2] + 1) / 2 * 255 - 128]\n new_img = color.lab2rgb(new_img) * 255\n ...
[ "0.7471666", "0.7259688", "0.7216436", "0.6839209", "0.6759264", "0.67525685", "0.67007047", "0.6603421", "0.6600922", "0.6595562", "0.6580605", "0.6568346", "0.6499439", "0.64541537", "0.64526325", "0.6431422", "0.63929", "0.6372881", "0.63197166", "0.6308842", "0.63075536",...
0.7765698
0
Checks if the given character is a letter.
def is_letter(c): return 'A' <= c <= 'Z' or 'a' <= c <= 'z'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_letter(string_):\n if string_ not in string.ascii_letters or len(string_) > 1:\n return False\n return True", "def isLetter(c):\n ret = libxml2mod.xmlIsLetter(c)\n return ret", "def is_letter(user_input):\n # If any characters is letter -> return boolean True else False\n if any...
[ "0.8101875", "0.7942589", "0.77772945", "0.7760421", "0.7488684", "0.7349609", "0.7162389", "0.7131679", "0.7119435", "0.71050584", "0.7094554", "0.70823413", "0.70609343", "0.7013201", "0.69936603", "0.69796395", "0.6963873", "0.6928611", "0.6889942", "0.68720996", "0.683491...
0.84225947
0
Checks if the given character is a number.
def is_number(c): return '0' <= c <= '9'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_num_char(x):\n return ord('0') <= ord(x) <= ord('9')", "def is_number_char(c: str) -> bool:\n return c.isdigit() or c == \".\"", "def is_number(s):\r\n try:\r\n int(s)\r\n return True\r\n except ValueError:\r\n return False", "def is_number(s):\n try:\n int(s...
[ "0.8297935", "0.80840826", "0.7704204", "0.76546836", "0.75744826", "0.7568717", "0.7393754", "0.73098946", "0.7302559", "0.7258665", "0.72420657", "0.7230359", "0.7195663", "0.71815383", "0.7179277", "0.7152408", "0.71477836", "0.71332264", "0.71325856", "0.71297145", "0.712...
0.82398206
1
Checks if the given nametag is valid, that it only contains letters, numbers, dashes, underscores and apostrophes. It must also start with the given tags in `Tags.py `. And returns the nametag if it is valid.
def get_nametag(nametag): # start must be valid if not nametag.startswith(Tags.NAMETAG_START.value): return None # removes the start of the tag nametag = nametag[len(Tags.NAMETAG_START.value):] # end must be valid if not nametag.endswith(Tags.NAMETAG_END.value): return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValidTagName(s):\n if s.lower().startswith(\"xml\"):\n return False\n return re.match(\"[^\\W\\d][\\w\\-_.]*\", s)", "def name_valid(name):\n return name.isalpha()", "def validname(name):\r\n return len(name)>0 and (\r\n Context.__invalid_character.search(name) is None)"...
[ "0.7056981", "0.6984154", "0.6797562", "0.65576094", "0.65357757", "0.6507386", "0.6452223", "0.63574183", "0.6310293", "0.6288627", "0.62855893", "0.6240301", "0.62214375", "0.61912215", "0.6171858", "0.615459", "0.61444604", "0.6139254", "0.6049716", "0.6022824", "0.5989654...
0.7059107
0
Checks whether the given nametag is reachable by another branch or not. This means that the given nametag must appear in at least one branch as an end tag.
def is_nametag_reachable(nametag, branches): for branch in branches: for next_nametag in branches[branch].next_nametags: if next_nametag == nametag: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_branches(branches):\n\n # for every branch in the list\n for branch in branches:\n\n # make sure it is either reachable or has the special tag \"start\"\n if branches[branch].name != \"start\" and not is_nametag_reachable(branches[branch].name, branches):\n return False\n\n...
[ "0.6780454", "0.67798984", "0.61064994", "0.555332", "0.54905283", "0.5410261", "0.5404235", "0.5332533", "0.52437496", "0.52371407", "0.5203334", "0.5191445", "0.5187049", "0.5181029", "0.5169189", "0.51587147", "0.51385343", "0.5123286", "0.50983757", "0.50803226", "0.50749...
0.79997444
0
Checks whether the given nametag is indeed labelling a branch.
def branch_exists(nametag, branches): for branch in branches: if branches[branch].name == nametag: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_nametag_reachable(nametag, branches):\n for branch in branches:\n for next_nametag in branches[branch].next_nametags:\n if next_nametag == nametag:\n return True\n return False", "def _is_branch(self, reference_name):\n return reference_name.startswith(\"refs/...
[ "0.715576", "0.7042534", "0.6742809", "0.67223674", "0.6595517", "0.6064686", "0.6029496", "0.6010573", "0.59576434", "0.5933389", "0.58508664", "0.58427274", "0.584109", "0.582408", "0.58061534", "0.5799144", "0.5777416", "0.5758434", "0.5737931", "0.5732576", "0.5721581", ...
0.7622634
0
Checks that the given branches are valid (every single branch is supposed valid). The idea here is to make sure that every ending nametag leads to another branch and that every branch is reachable.
def valid_branches(branches): # for every branch in the list for branch in branches: # make sure it is either reachable or has the special tag "start" if branches[branch].name != "start" and not is_nametag_reachable(branches[branch].name, branches): return False # make sur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_branches(num_branches, num_blocks, in_channels, num_channels):\n if num_branches != len(num_blocks):\n error_msg = f'NUM_BRANCHES({num_branches}) != NUM_BLOCKS({len(num_blocks)})'\n raise ValueError(error_msg)\n if num_branches != len(num_channels):\n error...
[ "0.6998986", "0.66559356", "0.64833444", "0.6398546", "0.62924314", "0.6202438", "0.6100306", "0.6061971", "0.60214883", "0.5950823", "0.57404685", "0.5680982", "0.56484795", "0.5646791", "0.56122196", "0.5460472", "0.5450381", "0.54337895", "0.5420128", "0.54145825", "0.5402...
0.838676
0