query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Decompose a square into a tuple (file, rank, x, y)
def parse_square_to_list_index_position(self, square: str): file = utils.split_string_to_chars(square)[0] rank = utils.split_string_to_chars(square)[1] x = 8 - int(rank) y = ord(file) - 97 # board_list = self.board_to_list_of_list() # Piece = board_list[x][y] ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_2d(fpath):\n #check_isfile(fpath)\n objs = []\n ids = []\n with open(fpath, 'r') as f:\n for ff in f:\n id_position, players_x, players_y = token_position(ff)\n objs.append((players_x, players_y))\n ids.append(id_position)\n objs = np.array(objs)\n ...
[ "0.6040605", "0.59452796", "0.5857169", "0.5808402", "0.5771582", "0.5544535", "0.5497078", "0.5451959", "0.5413509", "0.54061776", "0.5386866", "0.5363126", "0.5338914", "0.5323237", "0.5323237", "0.5215982", "0.52133834", "0.5206987", "0.5149349", "0.5129755", "0.5115656", ...
0.6324437
0
Decompose a uci_move into a tuple of squares
def parse_move_to_square(self, uci_move: str): chars = utils.split_string_to_chars(uci_move) square_from = ''.join(chars[0] + chars[1]) square_to = ''.join(chars[2] + chars[3]) return square_from, square_to
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protrudes((u,v)):\r\n return ((u,v,W), (u,v,S), (u,v-1,W), (u-1,v,S))", "def result(self, state, action):\n\n # blank is the index of the blank square\n blank = self.find_blank_square(state)\n new_state = list(state)\n\n delta = {'UP': -3, 'DOWN': 3, 'LEFT': -1, 'RIGHT': 1}\n ...
[ "0.6002581", "0.56859875", "0.55557483", "0.55508876", "0.5515943", "0.5488729", "0.5458621", "0.5374532", "0.5362106", "0.5332281", "0.5239702", "0.5231208", "0.520701", "0.5192164", "0.518984", "0.5189559", "0.5177213", "0.51737314", "0.51727545", "0.5166932", "0.5120974", ...
0.7245707
0
display the board, and if PLAY is true, call generate()
def draw(): background(255) for i in range(COLS): for j in range(ROWS): if (BOARD[i][j] == 1): fill(0) else: fill(255) noStroke() # stroke(0) rect(i * CELL_SIZE, j * CELL_SIZE, CELL_SIZE, CELL_SIZE) if (PLAY): generate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_board(self):\n \n oled.fill(0)\n for r in range(_HEIGHT):\n for c in range(_WIDTH):\n sprite = _SPRITES[self.board[r * _WIDTH + c]]\n oled.blit(sprite, c * 9, (_HEIGHT - r - 1) * 8 + 16)\n \n r, c = self.last_play_rc\n i...
[ "0.7384243", "0.7330011", "0.71932364", "0.7170613", "0.71279377", "0.70968723", "0.6993534", "0.6991781", "0.69916046", "0.69845", "0.6963072", "0.6959812", "0.694722", "0.69337595", "0.6901052", "0.68925256", "0.68892676", "0.687828", "0.6870598", "0.686228", "0.68294376", ...
0.76774544
0
Reset board when 'r' is pressed Pause/Play when SPACE BAR is pressed
def keyPressed(): global PLAY if (key == ' '): PLAY = not PLAY if (key == 'r'): init()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetBoard(self):\n pass", "def reset_board(self):\n self.board = [0, 0, 0, 0, 0, 0, 0, 0, 0]\n self.turn = 0\n\n self.change_button_img_to_null()\n\n #self.Score_Label.grid(row=0,column=1, ipadx=32)\n\n self.player_highlight()\n self.change_button_state('norm...
[ "0.6779835", "0.67538184", "0.67468214", "0.67427117", "0.67210114", "0.65391445", "0.6377748", "0.6366014", "0.6217351", "0.6208616", "0.61844754", "0.61814517", "0.61462396", "0.6133739", "0.6115029", "0.6104953", "0.6065748", "0.6011567", "0.5989363", "0.5971423", "0.59659...
0.69621825
0
fill board with random values 0 or 1
def init(): for i in range(COLS): for j in range(ROWS): BOARD[i][j] = int(random(2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_board(rows, cols):\n aux = np.zeros((rows, cols))\n for i in range(rows):\n for j in range(cols):\n if np.random.random() < 0.5:\n aux[i][j] = 1\n return aux", "def init_board(rows, columns, method=\"random\"):\n if method == \"random\":\n board = ...
[ "0.7622479", "0.7339844", "0.7249803", "0.7242747", "0.71531004", "0.7088582", "0.6940646", "0.6934457", "0.6923306", "0.69165564", "0.6914283", "0.68904805", "0.6886902", "0.6827437", "0.6815936", "0.67905855", "0.6759781", "0.67422414", "0.66867644", "0.6670755", "0.6644165...
0.7704092
0
Initialize the transliteration mapping.
def __init__(self, encoding): self.trans = {} for char in u"ÀÁÂẦẤẪẨẬÃĀĂẰẮẴẶẲȦǠẠḀȂĄǍẢ": self.trans[char] = u"A" for char in u"ȀǞ": self.trans[char] = u"Ä" self.trans[u"Ǻ"] = u"Å" self.trans[u"Ä"] = u"Ae" self.trans[u"Å"] = u"Aa" for char in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mapping):\n if len(mapping) != 26:\n raise ValueError('SubstitutionCipher requires a 26-letter mapping.')\n self.charsets = [\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n 'abcdefghijklmnopqrstuvwxyz'\n ]\n self.mappings = [\n ''.join([...
[ "0.7292962", "0.6448961", "0.6370397", "0.62953097", "0.62289435", "0.6177685", "0.6132368", "0.6106209", "0.60754013", "0.6058056", "0.6049701", "0.60229737", "0.5984604", "0.5936668", "0.59295124", "0.5915709", "0.5915709", "0.5864083", "0.5798238", "0.5764856", "0.57606876...
0.66775507
1
Create a copy of given VarList. New vars_ depend on existing vars for initialization.
def copy(self): var_copies = [tf.Variable(var.initialized_value, name=var.op.name+"_copy") for var in self.vars_] return VarList(var_copies, name="copy_"+self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def varcopy(self, vars):", "def copy(*, list : Union[List[Any], ConduitVariable]) -> List[Any]:\n return list.copy()", "def _initialize_var(self, variables):\n self.var_list = {}\n for var in variables:\n self.var_list[var.name] = tf.Variable(var.value, trainable=False, dtype=va...
[ "0.68142116", "0.6180891", "0.6118914", "0.5741732", "0.5602463", "0.54974896", "0.54967934", "0.549408", "0.5450394", "0.5402753", "0.5402753", "0.5381582", "0.53570664", "0.53332454", "0.5318365", "0.52873373", "0.5268562", "0.5228183", "0.52278805", "0.52120245", "0.520851...
0.6648157
1
Creates group of assign ops that copies value of current VarList to other VarList.
def assign(self, other): assert isinstance(other, VarList) assert len(self) == len(other) ops = [] for (my_var, other_var) in zip(self.vars_, other.vars_): ops.append(my_var.assign(other_var)) return tf.group(*ops, name="assign_"+self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_scope(from_scope, to_scope):\n assigns = []\n to_vars = variables.trainable_variables(to_scope)\n from_vars = variables.trainable_variables(from_scope)\n for dst, src in zip(to_vars, from_vars):\n assigns.append(state_ops.assign(dst, src))\n return control_flow_ops.group(*assigns)", "def make_...
[ "0.6492097", "0.6444669", "0.64178634", "0.6379566", "0.63356435", "0.631033", "0.6078659", "0.6038054", "0.5940578", "0.5938925", "0.58735955", "0.5791069", "0.57677853", "0.5753888", "0.5748407", "0.5748102", "0.5744167", "0.57135344", "0.57114613", "0.5709724", "0.5698003"...
0.774114
0
Returns an op that subtracts other from current VarList. sess.run(a.sub(b)) subtracts b from a
def sub(self, other, weight=one): assert isinstance(other, VarList) assert len(self) == len(other) ops = [] if isinstance(weight, VarStruct): weight = weight.var for (my_var, other_var) in zip(self.vars_, other.vars_): ops.append(my_var.assign_sub(weight*other_var)) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sub__(self, other):\n return self._operation_sub(self, other)", "def __sub__(self, other):\n return Vector([c1 - c2 for (c1, c2) in zip(self.components, other.components)])", "def subtract(self, other):\n return self.add(other.neg())", "def __sub__(self,other):\n return Vector(s...
[ "0.7202844", "0.7058477", "0.7055489", "0.7029082", "0.7026413", "0.70175993", "0.70124584", "0.69739664", "0.69634944", "0.6957177", "0.6936571", "0.6915405", "0.6904803", "0.68915", "0.6883527", "0.6821338", "0.681603", "0.6807597", "0.67901987", "0.67482024", "0.67482024",...
0.72168976
0
Updates all covariance/SVD info of correctable factors.
def update_stats(self): # todo: split into separate stats/svd updates s = self ops = [] # update covariances # s.grad.update() # TODO: not needed # s.grad2.update() for var in s: ops.append(s[var].A.cov_update_op) ops.append(s[var].B2.cov_update_op) with u.timeit(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onUpdateFactors(self, evt):\n\t\tif self.blockFactorUpdate:\n\t\t\tprint \"Blocking factor update\"\n\t\t\treturn\n\t\tx, y, z = self.dataUnits[0].dataSource.getOriginalDimensions()\n\t\tfx = 1\n\t\tfy = 1\n\t\tfz = 1\n\t\ttry:\n\t\t\tfx = float(self.factorX.GetValue())\n\t\t\tfy = float(self.factorY.GetValue(...
[ "0.6257417", "0.60663766", "0.60663766", "0.6002122", "0.55555266", "0.5544385", "0.55299354", "0.5521187", "0.54904515", "0.5466857", "0.5458186", "0.5399575", "0.53834486", "0.5361458", "0.53340566", "0.52772313", "0.5258089", "0.5210969", "0.52065665", "0.52056324", "0.520...
0.6676322
0
Returns whether given variable is getting kfac corrected.
def needs_correction(self, var): global matmul_registry if var in matmul_registry: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isgood(self):\n\t\tanswer = True\n\t\t\n\t\tif self.mes_flux <= 0.0:\n\t\t\tanswer = False\n\n\t\treturn answer", "def check_k(bigK):\n kk = bigK.flatten()\n k = kk[0]\n check = np.equal(k,kk)\n return all(check)", "def obrien_fleming_test(z, K, current_k, alpha):\n c = obrien_fleming_cutoff...
[ "0.61115146", "0.57637507", "0.56213665", "0.5555663", "0.5527914", "0.55272746", "0.54935336", "0.5478449", "0.5426821", "0.5401977", "0.539942", "0.53585553", "0.53544044", "0.5343857", "0.533409", "0.5328351", "0.53268003", "0.5299023", "0.5293938", "0.5278593", "0.5270485...
0.59578645
1
Accepts IndexedGrad object, produces corrected version.
def correct(self, grad): s = self vars_ = [] grads_new = [] assert list(grad) == self.model.trainable_vars dsize = get_batch_size(grad) for var in grad: vars_.append(var) A = s.extract_A(grad, var) # extract activations B = s.extract_B(grad, var)*dsize # extract b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, index, grad, weight):\n allow_np = self.optimizer.allow_np_array if hasattr(self.optimizer, \"allow_np_array\") else is_np_array()\n if not isinstance(index, (list, tuple)):\n indices = [index]\n grads = [_as_classic(grad, allow_np)]\n weights = [_a...
[ "0.5687673", "0.5177182", "0.5133078", "0.5122189", "0.51101804", "0.50831807", "0.5082775", "0.5065258", "0.5062302", "0.49478665", "0.49262068", "0.49088395", "0.4894962", "0.4889018", "0.4887798", "0.48869005", "0.48869005", "0.48760557", "0.48758113", "0.48714152", "0.485...
0.6953224
0
Initialize/reset all optimization related variables. This method initializes correction factors to identity and resets history of the optimization.
def reset(self): s = self s.step_counter = 0 # TODO: initialize first layer activations here, and not everywhere else # self.model.initialize_local_vars() # self.model.initialize_global_vars() ops = [] for var in self.model.trainable_vars: if self.needs_correction(var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.reset_image_estimate()\n self.init_m_aux()\n self.reset_hessian_and_bias()\n self.reset_adadelta_variables()", "def resetParams(self):\n self.prediction = cons.init_pred # Classifier payoff - initialized to a constant initial payoff value\n sel...
[ "0.6920202", "0.66721946", "0.64612997", "0.6431148", "0.640165", "0.63812256", "0.63766646", "0.63586855", "0.6343203", "0.63043207", "0.63029104", "0.628375", "0.62772477", "0.6264784", "0.6249498", "0.62140375", "0.61908585", "0.61620176", "0.6147041", "0.6145196", "0.6139...
0.6704145
1
Replacement for sess.run which works with custom types.
def run(self, *ops): new_ops = [] for op in ops: if isinstance(op, VarStruct): new_ops.append(op.var) else: new_ops.append(op) if len(new_ops) == 1: return self.sess.run(new_ops[0]) return self.sess.run(new_ops)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval(self,\n session = None,\n as_dicts = True,\n as_top = 0,\n simplify_unitsize_minibatch=True,\n feed_dict = None):\n if tf.executing_eagerly():\n if session is not None:\n raise ValueError('Passed in session in while eager mode.')\n resu...
[ "0.59357005", "0.5740278", "0.5613583", "0.539759", "0.53656864", "0.5208564", "0.5186081", "0.5176388", "0.5103088", "0.50770843", "0.50580525", "0.5039922", "0.50112295", "0.50100607", "0.4945135", "0.4914152", "0.4884834", "0.48848155", "0.48752427", "0.48628056", "0.48608...
0.630156
0
Process the a line from the file and create a student return student
def __createStudentFromLine(self, line): fields = line.split(' ') st = student(fields[0], fields[1]) return st
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __loadFromFile(self):\n fh = open(self.__fileName)\n for line in fh:\n if line.strip() == \" \":\n continue # we have an empty line, just skip\n st = self.__createStudentFromLine(line)\n # invoke the store method from the base class\n St...
[ "0.69220656", "0.66689825", "0.5966976", "0.58614874", "0.58498096", "0.5760626", "0.5750277", "0.560665", "0.55620354", "0.5477722", "0.5467126", "0.538011", "0.5317988", "0.5298307", "0.5283938", "0.52555054", "0.5254887", "0.52271104", "0.5204271", "0.5200144", "0.5187437"...
0.79158497
0
Load __students from file process file line by line
def __loadFromFile(self): fh = open(self.__fileName) for line in fh: if line.strip() == " ": continue # we have an empty line, just skip st = self.__createStudentFromLine(line) # invoke the store method from the base class StudentsRepo.sto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_students(self, student_file_info):\n students_file = os.path.join(self.path, \"students.txt\")\n sep, header = student_file_info\n try:\n for student in file_reading_gen(students_file, 3, sep, header):\n # CWID | Name | Major\n cwid = student[0]...
[ "0.67982", "0.6682641", "0.6301331", "0.6265264", "0.6193344", "0.60639715", "0.59646547", "0.58868736", "0.5869599", "0.5856266", "0.5828706", "0.58050776", "0.57176197", "0.56783515", "0.5658877", "0.5621348", "0.55974376", "0.55309755", "0.55274415", "0.5506725", "0.549867...
0.77821475
0
Append a new line in the file representing the student st
def __appendToFile(self, st): fh = open(self.__fileName, "a") line = st.get_id_student() + " " + st.get_nume_student() fh.write("\n") fh.write(line) fh.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __appendToFile(self, sub):\n fh = open(self.__fileName, \"a\")\n line = sub.get_id_disciplina() + \" \" + sub.get_nume_disciplina() + \" \" + sub.get_profesor()\n fh.write(\"\\n\")\n fh.write(line)\n fh.close()", "def write_to_file(self, line):\r\n self.file.write(li...
[ "0.710839", "0.6710103", "0.6505764", "0.6437808", "0.62919277", "0.6212372", "0.6116176", "0.6076392", "0.6041938", "0.6003799", "0.5920774", "0.58914787", "0.5846695", "0.58434844", "0.58434844", "0.5837749", "0.57946867", "0.57767636", "0.5763817", "0.57571816", "0.5754846...
0.8693008
0
Append a new line in the file representing the student st
def __appendToFile(self, sub): fh = open(self.__fileName, "a") line = sub.get_id_disciplina() + " " + sub.get_nume_disciplina() + " " + sub.get_profesor() fh.write("\n") fh.write(line) fh.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __appendToFile(self, st):\n fh = open(self.__fileName, \"a\")\n line = st.get_id_student() + \" \" + st.get_nume_student()\n fh.write(\"\\n\")\n fh.write(line)\n fh.close()", "def write_to_file(self, line):\r\n self.file.write(line)\r\n self.file.write(NEW_LIN...
[ "0.86921793", "0.671106", "0.65066254", "0.6439414", "0.62931883", "0.6214301", "0.6115889", "0.6077522", "0.60430974", "0.6005006", "0.59214485", "0.5891371", "0.584535", "0.584535", "0.5845115", "0.5836873", "0.5794259", "0.5777147", "0.5763539", "0.5754685", "0.57541734", ...
0.71082515
1
Compute cluster centers based on PCA 3d data. We transform each data point in a 3d vector using PCA. Then, using the labels associated to a cluster solution, we compute the center of the cluster. Currently, we simply compute the average of each dimension. Other schemes can be explored.
def computeCenters3d(self, data): for i in range(self.nPoints): print("Label of point ", i, " is ", self.labels[i]) for j in range(3): self.centers[self.labels[i]][j] += data[i][j] for c in range(self.n): for j in range(3): self.cent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_centers(data, clusters):\n\n centers = [[] for i in range(len(clusters))]\n dimension = len(data[0])\n\n for index in range(len(clusters)):\n point_sum = [0.0] * dimension\n\n for index_point in clusters[index]:\n point_sum = list_math_addition(point_sum, data[index_poin...
[ "0.7005121", "0.69346493", "0.6922082", "0.6820078", "0.68149567", "0.6628756", "0.6597494", "0.6553838", "0.6486263", "0.6451496", "0.64167947", "0.6381003", "0.6377934", "0.63463736", "0.6324808", "0.62792265", "0.62716466", "0.62671524", "0.62542623", "0.62460035", "0.6245...
0.7771398
0
Doc2Vec requires documents to be tokenized and, in addition, each doc should have a unique TAG. Note that, if the corpus has been preprocessed, each document is already tokenized. Therefore, some of the steps below can be skipped.
def transform4Doc2Vec(docs): # transform documents to be used by doc2Vec documents = [] analyzedDocument = namedtuple('AnalyzedDocument', 'words tags') for i, doc in enumerate(docs): # use first line if documents are not tokenized, otherwise next line # words = text.lower().split() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_vecs_DOC(train_pos, train_neg, test_pos, test_neg):\n # Doc2Vec requires LabeledSentence objects as input.\n # Turn the datasets from lists of words to lists of LabeledSentence objects.\n # YOUR CODE HERE\n labeled_train_pos = []\n labeled_train_neg = []\n labeled_test_pos = []\n l...
[ "0.7065559", "0.6649497", "0.6375412", "0.63382894", "0.63118374", "0.6306036", "0.6200971", "0.6160527", "0.6127651", "0.61082333", "0.6036962", "0.60186374", "0.59842265", "0.5978991", "0.59773785", "0.59766704", "0.59660757", "0.5958282", "0.59546584", "0.5935719", "0.5838...
0.7011091
1
Add services Add the services that we're testing, where manila plugin is a subordinate to the manila charm, and is deployed locally, whereas the rest of the services are from lp branches that are compatible with the local charm (e.g. stable or next).
def _add_services(self): this_service = {'name': '{{ metadata.package }}'} other_services = [ {'name': 'mysql', 'location': 'cs:percona-cluster', 'constraints': {'mem': '3072M'}}, {'name': 'rabbitmq-server'}, {'name': 'keystone'}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_services(self):\n this_service = {'name': 'swift-proxy'}\n other_services = [\n {'name': 'percona-cluster'},\n {'name': 'keystone'},\n {'name': 'glance'},\n {'name': 'swift-storage'}\n ]\n super(SwiftProxyBasicDeployment, self)._add_s...
[ "0.69215655", "0.68871737", "0.6833484", "0.67326456", "0.66940486", "0.6383991", "0.6363358", "0.6300274", "0.6217806", "0.6147432", "0.6026003", "0.6014241", "0.5945852", "0.59209114", "0.5911498", "0.5895044", "0.5883449", "0.57706344", "0.57553005", "0.5751255", "0.573360...
0.75265896
0
Yield the bonds in the batch.
def get_bonds(self) -> Iterable[Bond]: yield from self._bonds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_bonds(self):\n for bond in self.bond_list:\n yield bond", "def get_bonds(self):\n\n yield from self._molecule_state.get_bonds()", "def iter_bonds(self):\n visited = {}\n for atm in self.iter_atoms():\n for bond in atm.iter_bonds():\n if ...
[ "0.7943251", "0.7452321", "0.7133443", "0.7133443", "0.7133443", "0.7097584", "0.66456985", "0.631133", "0.61824894", "0.61297166", "0.6066924", "0.5932639", "0.5841496", "0.58220917", "0.5796081", "0.57958835", "0.579542", "0.57850516", "0.5744912", "0.5725474", "0.5718149",...
0.7672025
1
Yield info about the bonds in the batch.
def get_bond_infos(self) -> Iterable[BondInfo]: yield from self._bond_infos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_bonds(self):\n for bond in self.bond_list:\n yield bond", "def get_bonds(self):\n\n yield from self._molecule_state.get_bonds()", "def get_bonds(self) -> Iterable[Bond]:\n\n yield from self._bonds", "def get_bond_infos(self):\n\n yield from self._molecule_state...
[ "0.731346", "0.71516705", "0.7150081", "0.7108808", "0.69211537", "0.69211537", "0.69211537", "0.69108063", "0.6175322", "0.61059904", "0.60942537", "0.5904467", "0.5846432", "0.57983303", "0.57776207", "0.5677673", "0.5591826", "0.55384994", "0.55384994", "0.55384994", "0.55...
0.7465963
0
Get instance centroids given an input instance map.
def get_inst_centroid(inst_map): inst_centroid_list = [] inst_id_list = list(np.unique(inst_map)) for inst_id in inst_id_list[1:]: # avoid 0 i.e background mask = np.array(inst_map == inst_id, np.uint8) inst_moment = cv2.moments(mask) inst_centroid = [ (inst_moment["m10"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_centroids(self) -> Dict[str, np.ndarray]:\n assert self._centroids != {}\n return self._centroids", "def _compute_centroids(self):\n\n for i in range(0, self.k):\n cluster = np.argwhere(self.assigned_clusters == i)\n cluster_points = self.data[cluster].squeeze()...
[ "0.6749038", "0.6650255", "0.65915966", "0.65463495", "0.6435351", "0.6376549", "0.6318737", "0.6318737", "0.627336", "0.6131731", "0.6126604", "0.61131984", "0.60867494", "0.6085481", "0.60771734", "0.606877", "0.60621566", "0.6051553", "0.6035679", "0.60333824", "0.60211354...
0.7393581
0
Remove connected components smaller than the specified size. This function is taken from skimage.morphology.remove_small_objects, but the warning is removed when a single label is provided.
def remove_small_objects(pred, min_size=64, connectivity=1): out = pred if min_size == 0: # shortcut for efficiency return out if out.dtype == bool: selem = ndimage.generate_binary_structure(pred.ndim, connectivity) ccs = np.zeros_like(pred, dtype=np.int32) ndimage.label(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_small_objects(img, min_size=7500):\n img2 = np.copy(img)\n img2 = np.uint8(img2)\n nb_components, output, stats, centroids = cv2.connectedComponentsWithStats(img2, connectivity=8)\n # connectedComponentswithStats yields every seperated component with information on each of them, such as size...
[ "0.7249536", "0.6675606", "0.65831524", "0.64335865", "0.6386387", "0.63672304", "0.6338115", "0.6261704", "0.6107368", "0.6021744", "0.5929464", "0.5798455", "0.57320964", "0.5731419", "0.570719", "0.57019466", "0.56619906", "0.56619906", "0.56422305", "0.55590737", "0.54660...
0.78350794
0
Sets the credentials in the fabric env.
def _set_credentials(): # Override credentials here if necessary if env.user == 'ubuntu': env.key_filename = [ os.path.expanduser('~/.ssh/ubuntu-id_dsa')] env.abort_on_prompts = True env.disable_known_hosts = True env.use_shell = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_credentials():", "def set_credentials(self, *args, **kwargs):\n pass", "def credentials(self, credentials):\n\n self._credentials = credentials", "def SetCredentials(self, credentials):\n self._session[_CREDENTIAL_KEY] = credentials\n self._ReCreateUserInfo(credentials)", "def s...
[ "0.7733793", "0.73339283", "0.6911024", "0.68640375", "0.65647805", "0.65469354", "0.6435264", "0.6433998", "0.6420665", "0.64105487", "0.6372905", "0.6334473", "0.626828", "0.62552655", "0.62480617", "0.6235448", "0.6180002", "0.61562866", "0.61510146", "0.6098115", "0.60749...
0.75833076
1
Deploy the api package
def deploy_api(dist_file, apt_req_file): _set_credentials() provision() _deploy_apt_requirements(apt_req_file) _deploy_python_package(dist_file) _sighup_api() _verify_api_heartbeat() send_build_stat(PROJECT_NAME, env.stage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy():", "def deploy():\n test()\n if not env.is_staging:\n backup()\n prepare()\n restart_api()", "def deploy():\n require('hosts', provided_by=[prod])\n require('whole_path', provided_by=[prod])\n require('code_root')\n upload_tar_from_git(env.whole_path)\n install_re...
[ "0.76276606", "0.7354806", "0.7237579", "0.72109026", "0.7136418", "0.6986998", "0.68986934", "0.68417567", "0.6737068", "0.6713873", "0.66925836", "0.66925836", "0.66925836", "0.66623884", "0.6631625", "0.66146374", "0.6613947", "0.6608494", "0.65903443", "0.6553972", "0.655...
0.8029433
0
Tests the host /heartbeat and aborts on failure. Only a status of 200 returned by the heartbeat is considered a success. If the heartbeat fails and `retry` is ``True``, the heartbeat will be tried again after a sleep of 2 seconds. If the heartbeat fails and `retry` is ``False``, the task is aborted.
def _verify_api_heartbeat(retry=True): url = 'http://{0}/heartbeat'.format(env.host_string) try: resp = urllib2.urlopen(url) status_code = resp.getcode() except urllib2.HTTPError as error: print '[{0}] Error while testing API: {1}'.format(env.host_string, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_heartbeat(self):\n try:\n self.api.heartbeat(\n uuid=self.agent.get_node_uuid(),\n advertise_address=self.agent.advertise_address\n )\n self.error_delay = self.initial_delay\n self.log.info('heartbeat successful')\n exce...
[ "0.64115256", "0.63925374", "0.60940117", "0.6072936", "0.60185295", "0.5927989", "0.5917114", "0.5829199", "0.5631966", "0.56256557", "0.562286", "0.56167144", "0.5586957", "0.5583009", "0.5578418", "0.556675", "0.5559254", "0.5554939", "0.5553023", "0.55368847", "0.55124897...
0.7741037
0
Deploy the worker package
def deploy_worker(dist_file): _set_credentials() provision() _deploy_python_package(dist_file) _reload_supervisor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy():\n build()\n copy()\n install()", "def deploy():", "def deploy():\n return do_deploy(do_pack())", "def deploy():\n return do_deploy(do_pack())", "def deploy():\n return do_deploy(do_pack())", "def deploy():\n build()\n collect()\n commit()\n push()", "def depl...
[ "0.7718046", "0.7630395", "0.7385096", "0.7385096", "0.7385096", "0.73254853", "0.7231828", "0.7117488", "0.70119756", "0.68702674", "0.6828064", "0.6783783", "0.6759115", "0.6733616", "0.6728094", "0.6727583", "0.67239285", "0.6709783", "0.6692385", "0.667875", "0.66738", ...
0.7999865
0
Provision the node with Chef
def provision(): sudo('chef-client')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _provision_node(self, conn, node_cfg):\n # NOTE, general prepare for a node\n conn.run(f\"mkdir -p {EXPORTER_HOME}\")\n # docker, docker-compose\n conn.run(\"docker --help\")\n conn.run(\"docker-compose --help\")\n\n hostaddr = node_cfg.get(\"hostaddr\")\n usern...
[ "0.7364842", "0.709142", "0.69633234", "0.69576794", "0.6848683", "0.6660734", "0.65720356", "0.64097774", "0.6378232", "0.63187104", "0.63186216", "0.6299766", "0.6214362", "0.6186286", "0.61723053", "0.61670905", "0.6118086", "0.60685366", "0.60608464", "0.60519785", "0.601...
0.8196906
0
Send a metric to graphite that indicates a succesful build
def send_build_stat(project_name, environment): timestamp = int(time.time()) # In graphite we can draw a non-zero value as an vertical asymptote # The packet looks like: <metric> <value> <unix_timestamp> metric = 'applications.{0}.build 1 {1}\n'.format(project_name, timestamp) port = 2003 for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_metric(model_id, metric, value):\n host, port, namespace = get_metric_endpoint()\n\n metric_name = '%s.%s' % (namespace, get_metric_name(metric, model_id))\n message = \"%s %f %d\\n\" % (metric_name, float(value), int(time.time()))\n send_tcp(host, port, message)\n\n build_no = get_build_nu...
[ "0.58904475", "0.5782482", "0.5742747", "0.57385314", "0.57384384", "0.57281494", "0.5672095", "0.55735695", "0.55725265", "0.5481119", "0.544193", "0.54338694", "0.5420257", "0.541273", "0.5382933", "0.5382122", "0.537923", "0.5369423", "0.53642374", "0.536137", "0.5313757",...
0.6461206
0
each model instance has an individual port which has limited bandwidth. This bandwidth is calcuated as $MODEL_USER_BANDWIDHT $user_num_per_ins
def change_bandwidth(self,edge_notice): #print("==============带宽控制=============",edge_notice) ports_details = edge_notice["port_details"] total_bd = edge_notice["bandwidth"]["mobilenet"] self.reset_bandwidth() print("########",total_bd) #print("model_details+++++++++",mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit():\n bwc = BandwidthConfigurator()\n bwc.limit()", "def limit_bandwidth(self):\n return self._limit_bandwidth", "def subbandwidth(self):", "def total_port(model):\n snet_info = model.get_snet_info()\n used_bw_list = []\n node_port_list = []\n for node_id in snet_info:\n ...
[ "0.59014326", "0.58834857", "0.581432", "0.5720851", "0.56502086", "0.5617164", "0.56086344", "0.5552848", "0.5530534", "0.5493761", "0.54906005", "0.54904574", "0.5468758", "0.5442504", "0.543581", "0.53889805", "0.51699436", "0.5142294", "0.51190734", "0.5113873", "0.508426...
0.6063745
0
Ode_function_call(filename_coupling, filename_vib, amplitude, omega, cycles,extra_time) Constructor.
def __init__(self, filename_coupling, filename_vib, amplitude, omega, cycles, extra_time): #Laser info. self.amplitude = amplitude self.omega = omega self.cycles = cycles self.pulse_duration = 2 * pi /(self.omega) * self.cycles self.total_duration = self.pulse_duration + extra_time #Retrieve coupling inform...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCheckAndUpdateEventsVoidString(filename, model):\n ode_name = GetOdeSystemName(filename)\n\n update_events_str = (\"void \" + ode_name + \"::CheckAndUpdateEvents(double time, const std::vector<double> & rY)\\n\" + #Define function\n \"{\\n\" + \n translator.AddTab...
[ "0.5116854", "0.51114106", "0.49591404", "0.4945009", "0.49100146", "0.48581296", "0.4812874", "0.48077983", "0.4776593", "0.4775254", "0.47738108", "0.47594947", "0.47317323", "0.47037107", "0.4699053", "0.46896175", "0.46769795", "0.46698967", "0.46568546", "0.46493703", "0...
0.553874
0
dp_dt = dpsi_dt(psi, t) Method that serves as input to the odeint() function. Calculates dpsi/dt = i S1 H(t) psi.
def dpsi_dt(self, psi, t): # #To avoid doing anything twice. (odeint tends to do that.) # #--------------------------------------------------------- # novel, result = self.check_novelty(t,psi) # if not novel: # if self.my_id == 0: # print "Time: %2.2f / %2.2f au. Runtime: %2.2f---"%( # t, self.total_duration,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dsdt(s, t, eps1, eps2):\n # model parameter constants\n lambda1 = 1e4\n lambda2 = 31.98\n d1 = 0.01\n d2 = 0.01\n f = 0.34\n k1 = 8e-7\n k2 = 1e-4\n delta = 0.7\n m1 = 1e-5\n m2 = 1e-5\n NT = 100.0\n c = 13.0\n rho1 = 1.0\n rho2 = 1.0\n lambdaE = 1\n bE = 0.3\...
[ "0.6478505", "0.64778215", "0.64682895", "0.64319116", "0.63477665", "0.62354463", "0.6162756", "0.6110217", "0.6104301", "0.61027074", "0.6083214", "0.60463536", "0.60305214", "0.5997017", "0.5975363", "0.5975053", "0.59597516", "0.5930304", "0.5896961", "0.58786666", "0.587...
0.75018954
0
psi_final = mat_vec_product(psi, t) Does the matrix vector multiplication with the Hamiltonian.
def mat_vec_product(self, psi, t): x = zeros(self.vib_basis_size * len(self.my_tasks), dtype = complex) #Matrix vector product. for i, j in enumerate(self.my_tasks): slice_x = slice(i * self.vib_basis_size, (i + 1) * self.vib_basis_size) slice_psi = slice(j * self.vib_basis_size, (j + 1) * self.vib_basis_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hprod(self,t):\n p=[self.real]+self.vec.tolist()\n t=[t.real]+t.vec.tolist()\n \"\"\"Hamiltonian product between two quaternions.\"\"\"\n return Quaternion( p[0]*t[0] -p[1]*t[1] -p[2]*t[2] -p[3]*t[3],\n p[0]*t[1] +p[1]*t[0] +p[2]*t[3] -p[3]*t[2],\n ...
[ "0.6762655", "0.64737207", "0.6456814", "0.61552614", "0.6032003", "0.5812548", "0.5799078", "0.5766681", "0.5739267", "0.5681232", "0.56440544", "0.5632397", "0.56141573", "0.5581383", "0.55762047", "0.5569413", "0.5567707", "0.55529207", "0.5530607", "0.5526705", "0.5525223...
0.7725392
0
field_strength = time_function(t) Returns the electrical field strength at the time . Assumes an electrical field on the form E(t) = sin2(pi t / T) cos(omega t)
def time_function(self, t): if type(t) == float: if t > self.pulse_duration: field_strength = 0.0 else: field_strength = (self.amplitude * sin(pi * t / self.pulse_duration)**2 * cos(self.omega * t)) else: field_strength = zeros(shape(t)) for i, time in enumerate(t): if time >...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setTimeDepStrength(self, time):\n\t\tNodeDict = self.__TDNodeDict\t\t\n\t\tfor i in NodeDict.keys():\n\t\t\tnode = NodeDict[i]\n\t\t\twaveform = node.getParam(\"waveform\")\t\t\t\n\t\t\twaveform.calc(time)\t\t\n\t\t\twaveformType = waveform.getType()\n\t\t\tif waveformType == \"kicker waveform\":\n\t\t\t\tif n...
[ "0.666536", "0.6138395", "0.60728455", "0.58621866", "0.5610522", "0.5586078", "0.54017955", "0.5312289", "0.53113896", "0.52043104", "0.51140434", "0.50993353", "0.5079993", "0.5078925", "0.50771046", "0.5025096", "0.5018475", "0.50139606", "0.50100267", "0.49892104", "0.498...
0.8161074
0
hamilton_slice = retrieve_hamiltonian(file_handle) Retrieves this processors share of the hamiltonian. This is not entirely trivial, since only half the hamiltonian is stored.
def retrieve_hamiltonian(self, file_handle): #WHEN THE ENTIRE MATRIX IS STORED. hamilton_slice = file_handle.root.couplings[ self.my_tasks[0] * self.vib_basis_size: (self.my_tasks[-1] + 1) * self.vib_basis_size, :] # WHEN ONLY HALF THE MATRIX IS STORED: # hamilton_slice = zeros([len(self.my_tasks) * sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hamiltonian(self):\n return self.hamiltonian()", "def get_hamiltonian(self):\n assert (self._integrator == 'HMC' and self._metric == 'Euclidean') or self._integrator == 'RMHMC', 'Parameter dependent metrics require the RMHMC integrator'\n if self._integrator == 'RMHMC':# and self._me...
[ "0.6460065", "0.594572", "0.5648388", "0.5551951", "0.5507146", "0.5442163", "0.5384937", "0.5342527", "0.5256403", "0.51157206", "0.5090463", "0.49669805", "0.4947076", "0.49237293", "0.49222425", "0.49201462", "0.49061158", "0.4867194", "0.4867194", "0.48602894", "0.4851109...
0.78608006
0
Propagation time = distance / speed of light
def get_propagation_time(self): return 0.0 # self.get_distance_to_gateway() / (3 * pow(10,8))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ComputeLightTravelTime(Det1Pos, Det2Pos):\n\n # Get relative position vector\n Det21Pos = Det2Pos - Det1Pos\n \n # Dot difference vector into itself to get magnitude of detector separation\n dist = np.sqrt(np.dot(Det21Pos,Det21Pos))\n\n # Normalise with speed of light\n travelTime = dist/c\n...
[ "0.680088", "0.65308124", "0.6386361", "0.62784135", "0.62624556", "0.6157229", "0.6092432", "0.60724056", "0.6070677", "0.6006433", "0.59783584", "0.5919126", "0.5852979", "0.5845047", "0.5832354", "0.5830335", "0.5830335", "0.5804268", "0.5800634", "0.57915133", "0.57892615...
0.7401812
0
Shows the banner of Halive
def show_banner(): print(""" _ _ _ _ _____ _______ | | | | / \ | | |_ _\ \ / / ____| | |_| | / _ \ | | | | \ \ / /| _| | _ |/ ___ \| |___ | | \ V / | |___ |_| |_/_/ \_\_____|___| \_/ |_____| A super fast asynchronous http and https prober, to check who is (h)alive. Developed by g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def present_banner():\n writer(BANNER, FORMAT[\"BANNER\"])\n writer(\" \" * 30 + f\"version {VERSION}\")", "def banner():\n print \"\"\" \n _____ __ \n |_ _|_ _ ___ / _| __ _ \n | |/ _` / __| |_ / _` |\n | | (_| \\__ \\ _| (_| |\n |_|\\__,_|___/_| \\__,_|\n ...
[ "0.7168971", "0.69993675", "0.67482877", "0.665359", "0.66370654", "0.6527888", "0.65237415", "0.64791477", "0.6395663", "0.6368843", "0.6327859", "0.63251394", "0.63242054", "0.6175539", "0.6136863", "0.60374933", "0.60272425", "0.6003206", "0.6002877", "0.5994797", "0.59696...
0.78254676
0
This function takes as input the list of files containing the hostnames and normalizes the format of the hostnames in order to be able to perform valid HTTP/HTTPS requests.
def get_urls(inputfiles): urls = [] scheme_rgx = re.compile(r'^https?://') for ifile in inputfiles: urls.append(ifile.read().splitlines()) urls = set([n for l in urls for n in l]) urls = list(filter(None, urls)) for i in range(len(urls)): if not scheme_rgx.match(urls[i]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_urls(zone_name, files):\n def normalize_url(url):\n \"\"\"Prepend the zone name if the url is not absolute.\"\"\"\n # print(url)\n if not url.startswith('http://') and not url.startswith('https://'):\n return 'https://{}/{}'.format(zone_name, url.replace('//', '/'))...
[ "0.660303", "0.60905206", "0.60282516", "0.60232073", "0.5929562", "0.5927056", "0.5924148", "0.5887787", "0.5870147", "0.5716313", "0.5692017", "0.5672937", "0.5626674", "0.5619234", "0.5619234", "0.5550554", "0.54896355", "0.5482563", "0.5480113", "0.5466265", "0.5440976", ...
0.6231714
1
Plots outputs, inputs and biases vs time for a closed loop simulation from a steady state to a set point
def plot(): ts, ys, lin_model, K, us, dt_control, biass, end_time = simulate() matplotlib.rcParams.update({'font.size': 18}) fig, axes = plt.subplots( 1, 3, figsize=(6.25 * 3, 5), gridspec_kw={'wspace': 0.3} ) ax = axes[0] ax.plot(ts, us[:, lin_model.inputs[1]], 'k') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_high_a_state(\n shape=(50, 20),\n time_step=0.01,\n num_changed_states=1,\n number_timesteps=3000,\n snap_shot_rate=100,\n initial_value=0.14\n):\n time_array = np.arange(0, number_timesteps * time_step, time_step)\n\n deviation_a = np.zeros(shape)\n de...
[ "0.6564813", "0.65430945", "0.6491584", "0.6481378", "0.6434348", "0.6366609", "0.63164514", "0.6306104", "0.61623895", "0.6156997", "0.61515576", "0.6137438", "0.6116677", "0.61018914", "0.6071763", "0.605609", "0.6043903", "0.6030897", "0.601587", "0.601461", "0.60132027", ...
0.6891437
0
Generator that yields available layers for registered models.
def get_available_layers(self, path): now = datetime.now() for model in self.models: query = model.objects query = query.filter( Q(available_start__isnull=True) | Q(available_start__lte=now)) query = query.filter( Q(available_stop__isn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_layers(model):\n layers = []\n for l in model.layers:\n if hasattr(l, 'layers'):\n layers += get_all_layers(l)\n else:\n layers.append(l)\n return layers", "def get_layers(model):\n layers = []\n for child in model.children():\n layer_name = c...
[ "0.6699424", "0.6278394", "0.6258025", "0.6257084", "0.6043611", "0.5944978", "0.59335124", "0.59257406", "0.5911502", "0.5887883", "0.5862389", "0.5838642", "0.5832785", "0.5832785", "0.5814316", "0.5813538", "0.5793864", "0.5721535", "0.5661522", "0.5649628", "0.56407297", ...
0.63299835
1
Tests that the response code when the signup page is requested is correct.
def test_signup_status_code(self): self.assertEquals(self.response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_signup_status_code(self):\r\n\t\tself.assertEquals(self.response.status_code, 200)", "def testsignup(self):\n rv = self.app.get('/signup')\n self.assertEqual(rv.status_code, 200, \"signup page did not load as expected\")", "def test_signup_page(self):\n res = self.client.get('/sig...
[ "0.8429749", "0.7708973", "0.7663973", "0.74415016", "0.7356823", "0.7331208", "0.7260516", "0.7198254", "0.71854806", "0.717911", "0.7178879", "0.7104698", "0.7103727", "0.7100771", "0.70967394", "0.7095285", "0.7040711", "0.7016063", "0.7010907", "0.7004001", "0.70013064", ...
0.8352
1
Test that the signup view function can be resolved correctly by Django.
def test_signup_url_resolves_signup_view(self): view = resolve('/signup/') self.assertEquals(view.func, signup)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_signup_url_resolves_signup_view(self):\r\n\t\tview = resolve('/signup/')\r\n\t\tself.assertEquals(view.func, signup)", "def test_register_view(self):\n response = self.client.get(url_for('register'))\n self.assertEqual(response.status_code, 200)", "def test_registerpage_view(self):\n ...
[ "0.80338115", "0.74195445", "0.73899305", "0.73267484", "0.7294265", "0.72814226", "0.72676265", "0.71276635", "0.7072447", "0.70591223", "0.70504224", "0.70149714", "0.6970174", "0.69528747", "0.6952263", "0.6937847", "0.69329405", "0.69225514", "0.69031656", "0.6873244", "0...
0.8065375
0
Tests that the user is redirected to the home page.
def test_redirection(self): self.assertRedirects(self.response, self.home_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_home_page_redirect_when_loggin_attempt_successful(self):\n\t\tpass", "def test_home_page(self):\r\n url = reverse('home')\r\n response = self.client.get(url)\r\n\r\n self.assertEqual(response.status_code, 200)", "def test_home(self):\n\t\tresponse = self.client.get('/')\n\t\tself....
[ "0.84217453", "0.7769299", "0.76420814", "0.7638164", "0.76040894", "0.759174", "0.758025", "0.7538141", "0.7536092", "0.74214154", "0.74214154", "0.7371821", "0.7367941", "0.7366777", "0.7333203", "0.72763914", "0.72220784", "0.71568996", "0.71443254", "0.71340394", "0.71012...
0.7805177
1
Tests that a user object has been created.
def test_user_creation(self): self.assertTrue(User.objects.exists())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_creation(self):\r\n \r\n self.assertIsInstance(self.user, User)", "def test_create_user(self) -> None:\n\n u1 = self.register_user(\"u1\", \"pass\")\n\n u1stats = self._get_current_stats(\"user\", u1)\n\n assert u1stats is not None\n\n # not in any rooms by...
[ "0.8236934", "0.7996679", "0.79890305", "0.7927308", "0.7867625", "0.7845498", "0.7822935", "0.7801538", "0.7801538", "0.7801538", "0.77257335", "0.7707351", "0.7653342", "0.7651462", "0.7645934", "0.7644955", "0.7641736", "0.7641537", "0.7638218", "0.7620543", "0.76000154", ...
0.84415
0
Tests that the system has detected that a user has been authenticated.
def test_user_authentication(self): response = self.client.get(self.home_url) user = response.context.get('user') self.assertTrue(user.is_authenticated)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_can_login(self):\n user = authenticate(username='Marry', password='secret')\n self.assertFalse(user is None)\n self.assertTrue(user.is_authenticated)", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_authentica...
[ "0.75927603", "0.7586105", "0.7586105", "0.7586105", "0.7586105", "0.7586105", "0.7586105", "0.7586105", "0.75764245", "0.7414089", "0.7366755", "0.73579496", "0.7321217", "0.7316182", "0.7307878", "0.7291488", "0.7278097", "0.724544", "0.72392786", "0.72392786", "0.7200607",...
0.7962994
0
Sets up for the test cases. Submits an invalid signup case.
def setUp(self): url = reverse('signup') self.response = self.client.post(url, {}) # submit an empty dictionary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case2(self):\n\n valid_email = \"test2@email.com\"\n valid_password = \"asdasdasd\"\n valid_firstname = \"name1\"\n valid_familyname = \"name2\"\n valid_gender = \"Female\"\n valid_city = \"Testcity\"\n valid_country = \"Testcountry\"\n\n # Valid sig...
[ "0.7036157", "0.69662416", "0.6837648", "0.66937834", "0.6665576", "0.66359437", "0.6632694", "0.65957934", "0.65611583", "0.6511017", "0.65013313", "0.64702934", "0.64514214", "0.64413255", "0.6430968", "0.64222896", "0.6377234", "0.6326385", "0.6310239", "0.6286813", "0.627...
0.72698075
0
Tests that a user has not been created.
def test_dont_create_user(self): self.assertFalse(User.objects.exists())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dont_save_new_user(self):\n self.assertEqual(get_user_model().objects.exists(), 1)", "def test_08_create_user_not_exists(self):\n\n _, user = self.get_random_item(models.User)\n utils.create_user(user, session=self.session)\n success, error = utils.create_user(user, session=s...
[ "0.8033915", "0.80229765", "0.79012674", "0.74907833", "0.7486946", "0.74499816", "0.741901", "0.74002093", "0.7338867", "0.7322033", "0.73120284", "0.7293342", "0.7264074", "0.71912754", "0.7185918", "0.7170694", "0.7168075", "0.71619266", "0.71419287", "0.7126933", "0.71202...
0.8664961
0
Read metainfo. Only used for internal operations.
def readMetaInfo(self): data = self._fileSystem.readMetaInfo() return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_metadata(metapath):\r\n with open(metapath) as metaFile:\r\n metadata = {}\r\n for line in metaFile.readlines():\r\n if \"=\" in line: # Get only key-value pairs\r\n l = line.split(\"=\")\r\n metadata[l[0].strip()] = l[1].strip()\r\n\r\n return...
[ "0.6776606", "0.6554656", "0.6549679", "0.6533455", "0.6431231", "0.6371021", "0.6344528", "0.6339418", "0.6327856", "0.63218814", "0.62660223", "0.62010354", "0.61847824", "0.61321795", "0.61190677", "0.60788906", "0.60738075", "0.60524833", "0.60146433", "0.5996926", "0.595...
0.7755358
0
Read groups. Returns a dict.
def readGroups(self): groups = self._fileSystem.readGroups() if groups is None: return return groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_group():\n groups = list()\n with open(current_app.config[\"GROUP_PATH\"]) as group_file:\n for line in group_file:\n (name, _, gid, members) = [e.strip() for e in line.split(\":\")]\n if members:\n members = members.split(\",\")\n else:\n ...
[ "0.7934931", "0.6899801", "0.6688321", "0.6663027", "0.66263473", "0.65819156", "0.6568593", "0.6537375", "0.6506225", "0.6501277", "0.6441004", "0.6411678", "0.6357824", "0.63283646", "0.63171613", "0.62803334", "0.624054", "0.6187581", "0.61422426", "0.613282", "0.61268896"...
0.7849078
1
Read fontinfo. It requires an object that allows setting attributes with names that follow the fontinfo version 3 specification. This will write the attributes defined in the file into the object.
def readInfo(self, info): infoDict = self._fileSystem.readFontInfo() if infoDict is None: return for attr, value in infoDict.items(): setattr(info, attr, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def font_family_info(family: str, width_correction: numbers.Real = None, mono: bool = None) -> FeatureSpec:\n return FeatureSpec('metainfo', name='font_family_info',\n family=family,\n width_correction=width_correction,\n monospaced=mono)", "de...
[ "0.60003763", "0.59794176", "0.58947295", "0.5860684", "0.57554847", "0.575426", "0.56749356", "0.5542004", "0.5470516", "0.54326993", "0.54324234", "0.5380719", "0.5364408", "0.53619736", "0.5347408", "0.53312546", "0.52485996", "0.5242108", "0.5239431", "0.5232338", "0.5209...
0.7896228
0
Read kerning. Returns a dict.
def readKerning(self): data = self._fileSystem.readKerning() if data is None: return kerning = {} for side1 in data: for side2 in data[side1]: value = data[side1][side2] kerning[side1, side2] = value return kerning
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_lig_kern_programs(self):\n\n # print 'Lig/Kern Table'\n\n # Fixme: complete special cases\n\n # Read very first instruction of the table\n (first_skip_byte,\n next_char,\n op_byte,\n remainder) = self._read_four_byte_numbers_in_table(tables.lig_kern, 0)...
[ "0.5877681", "0.54977924", "0.54645425", "0.53315735", "0.529799", "0.52232504", "0.5220938", "0.52188045", "0.5197707", "0.51825863", "0.5158964", "0.51481986", "0.51413345", "0.5129295", "0.510898", "0.5100611", "0.5060525", "0.50276786", "0.502742", "0.50108004", "0.500260...
0.8325743
0
Read lib. Returns a dict.
def readLib(self): data = self._fileSystem.readLib() if data is None: return return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(file_path: str) -> dict:\n\n if not os.path.isfile(file_path):\n raise FileNotFoundError(\"The file `%s` must exist and be a BLM file\" % file_path)\n\n file_contents = open(file_path, 'r').read()\n headers = parse_headers(file_contents)\n definitions = parse_definitions(headers, file_c...
[ "0.61229336", "0.596607", "0.58584535", "0.58176255", "0.5787408", "0.57323164", "0.57156193", "0.57136655", "0.5697481", "0.5666437", "0.56598234", "0.5648053", "0.5632673", "0.5591332", "0.55905306", "0.55903053", "0.5588685", "0.5582683", "0.55660266", "0.55592847", "0.555...
0.7349739
0
Read features. Returns a string.
def readFeatures(self): return self._fileSystem.readFeatures()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_featuretxt(self):\n return self.outputfrominput(inputformat='csv', stripextension='.csv', addextension='.features.csv')", "def get_features_from_file(self):\n f_list = []\n f = open(\"verifiability_features.txt\", \"r\")\n for line in f:\n f_list.append(line)\n ...
[ "0.67515403", "0.65995157", "0.65995157", "0.6482481", "0.64158744", "0.6415223", "0.63494426", "0.62580866", "0.62296563", "0.6158914", "0.6085905", "0.6061323", "0.60551", "0.59828717", "0.5971179", "0.595947", "0.5953194", "0.5938544", "0.5913336", "0.5892323", "0.5839014"...
0.75926185
0
Get the ordered layer names.
def getLayerNames(self): return self._fileSystem.getLayerNames()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layer_names(self):\n return self._layer_names", "def layer_names(self) -> List[str]:\n _all_layers = []\n if self.category == \"ML\":\n pass\n elif self.config['backend'] == 'tensorflow':\n for layer in self.layers:\n _all_layers.append(layer.n...
[ "0.8059183", "0.71323884", "0.70508856", "0.7015198", "0.6943308", "0.6809838", "0.6692172", "0.66792417", "0.6512082", "0.6459705", "0.64422935", "0.64258444", "0.6385555", "0.63156766", "0.63127655", "0.6309186", "0.6300838", "0.6300043", "0.6251107", "0.6182915", "0.616855...
0.81016415
0
Get the default layer name.
def getDefaultLayerName(self): return self._fileSystem.getDefaultLayerName()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layer_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"layer_name\")", "def layer_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"layer_name\")", "def layer_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"layer_name\")", "def _get_laye...
[ "0.772892", "0.7703941", "0.74682605", "0.69935966", "0.69064707", "0.6584358", "0.642517", "0.6421958", "0.63870084", "0.6386308", "0.6271223", "0.6192297", "0.61902976", "0.61866474", "0.6176093", "0.6175617", "0.6157793", "0.6087914", "0.60715795", "0.605567", "0.59688663"...
0.88233536
0
Return a list of glyph names.
def getGlyphNames(self, layerName): return self._fileSystem.getGlyphNames(layerName)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singleglyph(x):\n return [glyph(x)]", "def glyph(x):\n assert isinstance(x, str)\n return [x]", "def get_font_names(self):\n return self._parse_response(self.client.service.GetFontNames())", "def _read_glyph_names(instream):\n format, base = _read_format(instream)\n glyph_count = ba...
[ "0.74616456", "0.74348927", "0.7014985", "0.6971341", "0.68693", "0.66633564", "0.6649264", "0.654673", "0.65284866", "0.6521169", "0.65099037", "0.6505686", "0.649563", "0.64697444", "0.6417302", "0.6413562", "0.64111894", "0.6405764", "0.63996553", "0.6371257", "0.63541335"...
0.76830494
0
Read a glyph from a layer.
def readGlyph(self, layerName, glyphName, glyphObject): tree = self._fileSystem.getGlyphTree(layerName, glyphName) readGlyphFromTree(tree, glyphObject, glyphObject)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetLayer(self,layer):\n\t\tif isinstance(layer,str):\n\t\t\tindex=self.LayerNames.index(layer)\n\t\telif isinstance(layer,int):\n\t\t\tindex=layer\n\t\telse:\n\t\t\traise PycomError('Type of layer in GetLayer() is wrong')\n\t\treturn self.acad.ActiveDocument.Layers.Item(index)", "def readGlyphElement(self, g...
[ "0.53727376", "0.5272536", "0.5086913", "0.5061801", "0.505761", "0.50233465", "0.49812022", "0.49729374", "0.49696195", "0.49650785", "0.49570772", "0.49497062", "0.49260625", "0.48858982", "0.48208556", "0.4785908", "0.4780147", "0.4771324", "0.47498485", "0.47480598", "0.4...
0.7494981
0
Setup the Rotel platform, and the related transport Ask for async link as soon as transport is ready
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): _LOGGER.debug('ROTEL : starting') rotel = RotelDevice(config.get(CONF_NAME), config.get(CONF_HOST), config.get(CONF_PORT), hass.loop) async_add_devices([rotel]) coro = hass.loop.create_connection(RotelProtocol, config.get(C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setup(self):\n load_base_templates()\n uris = URI.gather()\n for uri, resource in uris.items():\n methods = resource.methods\n if \"get\" not in methods:\n methods[\"get\"] = None\n\n for method in methods.keys():\n self....
[ "0.6775953", "0.67365813", "0.6647012", "0.65575963", "0.6487727", "0.63903546", "0.6374705", "0.6295787", "0.6161369", "0.61430764", "0.61418986", "0.61163056", "0.610549", "0.6095397", "0.609323", "0.6075303", "0.60662293", "0.60500467", "0.6042374", "0.60218334", "0.601101...
0.728368
0
This function splits a text into paragraphs. It assumes paragraphs are separated by two line breaks.
def split_text_into_paragraphs(text: str) -> List[str]: text_aux = text.strip() paragraphs = text_aux.split('\n\n') # Strip any leading whitespaces for p in paragraphs: p = p.strip() return [p.strip() for p in paragraphs if len(p) > 0] # Don't count empty paragraphs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paragraphs(text):\n return [LINE_START.sub(' ', p) for p in PARAGRAPH_SEP.split(text)]", "def paragraphify(text: str) -> str:\n text = text and text.replace('\\r', '').strip('\\n')\n\n if not text:\n return ''\n\n return ''.join(f'<p>{p}</p>' for p in (\n p.replace('\\n', '<br>'...
[ "0.7900045", "0.74937797", "0.7323279", "0.7225088", "0.71461904", "0.6991293", "0.6832854", "0.68192977", "0.6792842", "0.66216666", "0.6618086", "0.66175747", "0.66080666", "0.6500202", "0.64036244", "0.6391775", "0.63550293", "0.62636006", "0.6168039", "0.6164341", "0.6132...
0.8413718
0
r"""Load dataset. This function loads graphstructured data from dgl's buildin spam review dataset and baidu's largescale website antifraud dataset. The implementation here is redundant and unnecessary, and can be handled directly using dgl's heterogeneous graph. Currently, each image is processed separately to be compa...
def load_graphs(dataset_name='amazon', raw_dir='~/.dgl/', train_size=0.4, val_size=0.1, seed=717, norm=True, force_reload=False, verbose=True) -> dict: if dataset_name in ['amazon', 'yelp', 'mimic']: fraud_data = fraud_dataset.FraudDataset(dataset_name, train_size=train_size, val_size=val_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dataset(self, dataset_dir, json_path):\n # Add classes. We have only one class to add.\n self.add_class(\"glomerulus\", 1, \"glomerulus\")\n\n \n\n # Load annotations\n # VGG Image Annotator saves each image in the form:\n # { 'filename': '28503151_5b5b7ec140_b.jp...
[ "0.6214341", "0.6142613", "0.5926932", "0.5924296", "0.5920679", "0.58030564", "0.5798502", "0.57934386", "0.5790522", "0.5784507", "0.5737343", "0.57275146", "0.57185", "0.57170683", "0.56964195", "0.5690044", "0.56856006", "0.5683638", "0.5683561", "0.56487966", "0.56467557...
0.6987302
0
Loading a subset of features for each relation as a batch.
def load_batch(batch, feat_list, device='cpu'): batch_feat_list = [] for hop_feat_list in feat_list: batch_feats = [feat[batch] for feat in hop_feat_list] batch_feat_list.append(batch_feats) batch_feat_list = [torch.stack(feat) for feat in batch_feat_list] batch_feats = torch.cat(batch_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadall(bot) :\n for feature in features :\n load(bot, feature)", "def load_features(self, features):\n pass\n # self.features = features", "def pack_features_in_dataloader(self, features, batch_size, set_type):\n all_input_ids = torch.tensor([f.input_ids for f in features], ...
[ "0.66366136", "0.65452754", "0.63713324", "0.63633865", "0.62709767", "0.62332636", "0.62003887", "0.61030906", "0.610075", "0.610075", "0.6076909", "0.5991605", "0.59334826", "0.58925045", "0.58430266", "0.57969147", "0.57901675", "0.578533", "0.57609534", "0.57177114", "0.5...
0.68299085
0
r"""Split positive and negtive nodes in array nids .
def pos_neg_split(nids, labels): pos_idx = torch.where(labels == 1)[0] neg_idx = torch.where(labels == 0)[0] # 特殊判断孤立点的情况 pos_nids = nids[pos_idx] if min(pos_idx.shape) != 0 else torch.LongTensor([]) neg_nids = nids[neg_idx] if min(neg_idx.shape) != 0 else torch.LongTensor([]) return pos_nids,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_to_nodes(self,n):\n js = self.node_to_edges(n)\n all_nodes = self.edges['nodes'][js].ravel()\n # return np.setdiff1d(all_nodes,[n]) # significantly slower than lists\n return np.array( [nbr for nbr in all_nodes if nbr!=n] )", "def partid2nids(self, partid):\n # TODO do...
[ "0.63041896", "0.6137753", "0.61089", "0.59853446", "0.5840301", "0.5840301", "0.58060116", "0.58060116", "0.57974595", "0.5743908", "0.57107353", "0.5700629", "0.5690656", "0.56787926", "0.56764317", "0.5632875", "0.5599747", "0.5561786", "0.55545074", "0.55515474", "0.55209...
0.6970645
0
Undersample the negative nodes based on scale.
def under_sample(pos_nids, neg_nids, scale=1): index = np.arange(neg_nids.shape[0]) index = np.random.RandomState().permutation(index) N = min(int(pos_nids.shape[0] * scale), neg_nids.shape[0]) index = index[0: N] neg_sampled = neg_nids[index] sampled_nids = torch.cat((pos_nids, neg_sampled)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __neg__(self):\n return self.scale(-1)", "def neg_sampling_transform(data):\n train_neg_edge_index = negative_sampling(\n edge_index=data.train_pos_edge_index, num_nodes=data.num_nodes,\n num_neg_samples=data.train_pos_edge_index.size(1))\n data.train_edge_index = torch.cat(\n ...
[ "0.632494", "0.6190571", "0.617832", "0.6001066", "0.5983446", "0.58893204", "0.5869053", "0.5867653", "0.58318377", "0.5787503", "0.57440716", "0.56506425", "0.5646914", "0.5622218", "0.5612736", "0.5593702", "0.55898374", "0.5546774", "0.5515598", "0.55037147", "0.5473728",...
0.7082842
0
Turn seed into np.random.RandomState instance
def seed_random_state(seed): if (seed is None) or (isinstance(seed, int)): return np.random.RandomState(seed) elif isinstance(seed, np.random.RandomState): return seed raise ValueError("%r can not be used to generate numpy.random.RandomState" " instance" % seed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random():\n np.random.seed(1939)", "def random_seed(seed):\n state = RandomState()\n random.seed(seed) # alter state\n np.random.seed(seed)\n torch.manual_seed(seed)\n yield\n state.set_global()", "def random():\n np.random.seed(0)", "def numpy_seed(seed):\n if seed is None:\n...
[ "0.79414845", "0.77721286", "0.77552366", "0.7622841", "0.7622318", "0.76039827", "0.7514231", "0.74869305", "0.7479636", "0.7405904", "0.7405904", "0.7404248", "0.73912746", "0.73778975", "0.73392326", "0.7330881", "0.73179996", "0.73079723", "0.73038965", "0.729188", "0.727...
0.8012018
0
Calculate the cost with given cost matrix
def calc_cost(y, yhat, cost_matrix): return np.mean(cost_matrix[list(y), list(yhat)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_costs(self):\n cost_matrix = self.make_cost_matrix()\n \n if self.greedy:\n # Riesen et al., \"Greedy Graph Edit Distance\"\n costs = []\n psi = []\n \n for row in range(self.N):\n phi = self.M\n ...
[ "0.767927", "0.74837077", "0.721757", "0.71765316", "0.71708965", "0.7170713", "0.71697587", "0.711207", "0.69753784", "0.69200283", "0.68053967", "0.679436", "0.67470616", "0.670905", "0.6700581", "0.6689784", "0.66726863", "0.6640355", "0.6636243", "0.6634451", "0.66297215"...
0.7620329
1
Unregisters a task by removing it from the task registry.
def unregister_task(cls: Type[Task]): for cls_reg in __registered_tasks: if cls_reg.cls == cls: __registered_tasks.remove(cls_reg) return raise ValueError(f"Task `{cls}` is not registered.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_task(self, tid: str):\n if tid in self.__tasks:\n task = self.__tasks.pop(tid)\n task.detach()\n self.__dump()", "def remove_task(self, task_id):\n with self.lock:\n self.task_map.pop(task_id)", "def detach_task(self, task):\n self.tasks....
[ "0.70857453", "0.7053513", "0.69916236", "0.6885086", "0.6853175", "0.67065996", "0.66595006", "0.6603596", "0.658189", "0.65089333", "0.6287245", "0.62864834", "0.6135911", "0.6085453", "0.608252", "0.5997733", "0.5967085", "0.59212506", "0.58388686", "0.5810328", "0.5809284...
0.7710948
0
Load the OCR letters dataset. This is a chain classification task. Each example consists of a word, segmented into letters. The first letter of each word is ommited from the data, as it was a capital letter (in contrast to all other letters). References
def load_letters(): module_path = dirname(__file__) data = _safe_unpickle(join(module_path, 'letters.pickle')) # we add an easy to use image representation: data['images'] = [np.hstack([l.reshape(16, 8) for l in word]) for word in data['data']] return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self) -> tuple:\n self.read_path = Path(os.environ[\"DATA_PATH\"]) / \"characters\"\n self.pretrain_path = Path(os.environ[\"FONT_DATA\"]) / \"training\"\n self.dataset_builder.build_data_set()\n X_pretrain, y_pretrain, X_train, y_train, X_dev, y_dev, X_test, y_test = tupl...
[ "0.6481189", "0.607861", "0.60574514", "0.5962134", "0.5949977", "0.5922519", "0.58208525", "0.5816595", "0.5725368", "0.5710394", "0.5707188", "0.56581825", "0.5624935", "0.5620581", "0.5614324", "0.5592038", "0.556747", "0.5554503", "0.55472016", "0.5532942", "0.55241984", ...
0.6862015
0
Get a list of numpy arrays from a npz file
def npz_to_array(npzfile): nitems = len(npzfile.keys()) return [npzfile['arr_%s' % i] for i in range(nitems)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(npz_dir):\n files = glob.glob('%s/*.npz' % npz_dir)\n data_list = []\n for f in files:\n data_list += load_npz_to_data_list(f)\n return data_list", "def load_data_from_npz(filename):\n with np.load(filename) as f:\n data = np.zeros(f[\"shape\"], np.bool_)\n data[...
[ "0.7499061", "0.7260047", "0.69889337", "0.6836749", "0.67277324", "0.6720737", "0.66964215", "0.6648915", "0.66082674", "0.6559009", "0.65101445", "0.64618176", "0.6441118", "0.6412733", "0.6387359", "0.63433146", "0.63433146", "0.63344485", "0.6310574", "0.6296764", "0.6291...
0.8242497
0
Calculate Pearson correlation coefficients and pvalues for testing noncorrelation of lon/lat/time xarray datasets for each lon/lat point. Heavily influenced by scipy.stats.pearsonr The Pearson correlation coefficient measures the linear relationship between two datasets. Strictly speaking, Pearson's correlation require...
def _pearsonr(x: xr.DataArray, y: xr.DataArray, monitor: Monitor) -> xr.Dataset: with monitor.starting("Calculate Pearson correlation", total_work=6): n = len(x['time']) xm, ym = x - x.mean(dim='time'), y - y.mean(dim='time') xm['time'] = [i for i in range(0, len(xm.time))] ym['time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pearsonCorrelation(x, y):\n\tsum_sq_x = 0\n\tsum_sq_y = 0\n\tsum_coproduct = 0\n\tmean_x = x[0]\n\tmean_y = y[0]\n\tif len(x) != len(y):\n\t\traise StatsError(\"Data sets are of different lengths.\")\n\tn = len(x)\n\tfor i in range(1,n):\n\t\tsweep = i / (i+1.0)\n\t\tdelta_x = x[i] - mean_x\n\t\tdelta_y = y[i]...
[ "0.7017894", "0.64223236", "0.63728964", "0.6310453", "0.6194867", "0.6184463", "0.61696017", "0.6138558", "0.6117348", "0.60683537", "0.6018718", "0.6016121", "0.59906226", "0.59815186", "0.5970584", "0.59453726", "0.59148186", "0.5913756", "0.585309", "0.5845082", "0.584176...
0.69312274
1
Whether the SaaS subscription will auto renew upon term end.
def auto_renew(self) -> Optional[bool]: return pulumi.get(self, "auto_renew")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_renew(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"auto_renew\")", "def auto_renew(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"auto_renew\")", "def auto_renew(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"auto_rene...
[ "0.7635799", "0.7555081", "0.7555081", "0.7060618", "0.66018945", "0.63008267", "0.6166622", "0.6105066", "0.6095437", "0.60400766", "0.6024941", "0.60069394", "0.59538114", "0.5946263", "0.5913129", "0.59094524", "0.590431", "0.5873234", "0.5791154", "0.5784895", "0.5782406"...
0.79429305
1
Whether the current term is a Free Trial term
def is_free_trial(self) -> Optional[bool]: return pulumi.get(self, "is_free_trial")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_term():\n global _STATIC_VARS\n return _STATIC_VARS.term", "def get_is_term(self):\n \n approx_Z = self.add_is_approximation()\n \n return T.sum(T.exp(approx_Z))", "def is_terminal(self):\n return self.beta.isEmpty()", "def _space_has_degrees_of_freedom(self) -> bool:\...
[ "0.64967096", "0.6354631", "0.62609994", "0.6033779", "0.60330594", "0.60330594", "0.5946291", "0.59126997", "0.5875711", "0.58473074", "0.5831228", "0.5802522", "0.57840157", "0.5768315", "0.5737471", "0.5730293", "0.5662754", "0.56583077", "0.56578684", "0.56556016", "0.565...
0.701086
1
The Payment channel for the SaasSubscription.
def payment_channel_type(self) -> Optional[str]: return pulumi.get(self, "payment_channel_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel(self):\n return Channel({'id': self.channel_id, 'connection': self.connection})", "def getChannel(self):\r\n return self.channel", "def channel(self) -> 'Channel': # stub\n return self._channel", "def channel(self):\n return self._channel", "def channel(self):\n ...
[ "0.64235836", "0.6375752", "0.63539016", "0.6338129", "0.6338129", "0.6270923", "0.62647957", "0.6255194", "0.61652064", "0.6117484", "0.5970928", "0.5964751", "0.59157217", "0.58987176", "0.58987176", "0.58987176", "0.5872529", "0.5872529", "0.5872529", "0.5861939", "0.58208...
0.6670644
1
The SaaS resource name.
def saas_resource_name(self) -> Optional[str]: return pulumi.get(self, "saas_resource_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_name(self):\n return self._resource_name", "def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")", "def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")", "def name(self):\n return self.raw_resour...
[ "0.75283563", "0.742396", "0.742396", "0.7398112", "0.7182074", "0.7104791", "0.7104791", "0.7104791", "0.7104791", "0.7104791", "0.70863575", "0.69936925", "0.69936925", "0.6841932", "0.6746869", "0.6736587", "0.6699765", "0.6691915", "0.6676494", "0.66206276", "0.66170204",...
0.8277715
0
The saas session id used for dev service migration request.
def saas_session_id(self) -> Optional[str]: return pulumi.get(self, "saas_session_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_id(self) -> str:\n return self._session_id", "def get_session_id(self):\n return self.request_data['id']", "def get_session_id(self, context: ResourceCommandContext) -> str:\n return self.handler.get_session_id()", "def get_session_id(self):\n raise NotImplementedError...
[ "0.74283105", "0.7378895", "0.6977564", "0.69628507", "0.69523305", "0.6918316", "0.6913246", "0.6913057", "0.6540128", "0.64637274", "0.6411328", "0.63787603", "0.63259757", "0.6294104", "0.6289128", "0.6260292", "0.62396425", "0.6203827", "0.6194294", "0.6188435", "0.617136...
0.80087346
0
The saas subscription id used for tenant to subscription level migration request.
def saas_subscription_id(self) -> Optional[str]: return pulumi.get(self, "saas_subscription_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscription_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"subscription_id\")", "def get_subscription_id(self):\n return self.instance_metadata.subscription_id", "def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n i...
[ "0.76610607", "0.7659743", "0.76511776", "0.73157144", "0.6970382", "0.6929516", "0.6921196", "0.64552397", "0.63065016", "0.6286226", "0.6286226", "0.6286226", "0.6286226", "0.61446583", "0.61446583", "0.6136819", "0.6031626", "0.6028634", "0.602674", "0.6017056", "0.5973829...
0.8396329
0
The current Term id.
def term_id(self) -> Optional[str]: return pulumi.get(self, "term_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self, term):\n term = term.lower() if self.lower else term\n try:\n return self.term2id[term]\n except KeyError:\n return self.term2id[self.unk_term]", "def get_term_id(self, term):\n query = self.db.execute('SELECT rowid FROM terms WHERE term = ?;', (...
[ "0.695331", "0.6933238", "0.6902128", "0.6885298", "0.6561754", "0.6549523", "0.6519543", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.64798254", "0.6...
0.7920032
0
Checks if goal is reached
def goal_reached(self, position): return position >= self.goal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reached_goal(self):\n for i in range(self.simulator_.num_agents):\n if rvo_math.abs_sq(self.simulator_.agents_[i].position_ - self.goals_[i]) > self.simulator_.agents_[i].radius_ * self.simulator_.agents_[i].radius_:\n return False\n\n return True", "def check_reached_...
[ "0.7988564", "0.796526", "0.78069806", "0.7713047", "0.7666455", "0.76577246", "0.760571", "0.7575535", "0.75570863", "0.7533124", "0.749473", "0.749473", "0.7405916", "0.73765457", "0.7334925", "0.72364444", "0.72180784", "0.72052145", "0.72035", "0.71608114", "0.71539474", ...
0.7973773
1
run a given number of games and stores the results in the Simulation object.
def run_simulation(self, num_games=10): for _ in range(num_games): self.result.append(self.single_game())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate(self, num_games):\r\n # self.runs = num_games #Initializes a tracker for the number of runs\r\n for _ in range(num_games):\r\n self.results.append(self._simulate_once())\r\n return self.results", "def run_simulation(num_players=5, strategies=None):\n players = Pla...
[ "0.83224076", "0.711195", "0.7094541", "0.6894594", "0.67614573", "0.6761287", "0.67199826", "0.6666494", "0.6628066", "0.65334725", "0.6447592", "0.6416389", "0.63822377", "0.6366313", "0.6365351", "0.63420373", "0.63275737", "0.6306525", "0.62924963", "0.62913173", "0.62903...
0.89658666
0
Returns a dictionary mapping player types to the number of wins with the key representing the player type and the value the number of wins for that specific type.
def winners_per_type(self): winners = [winner[1] for winner in self.result] # making a list of the type of winners return Counter(winners) # Using the Counter tool from the standard library to count the # types in a dictionary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_winners_per_type_num_players(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.winners_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']", "def test_winners...
[ "0.7121897", "0.67023724", "0.6653316", "0.6339918", "0.6321449", "0.62477136", "0.5958073", "0.59309036", "0.58112085", "0.57779217", "0.5767871", "0.5707464", "0.56921685", "0.5668579", "0.56408817", "0.5640531", "0.56165427", "0.5578535", "0.5533342", "0.553229", "0.550161...
0.7550985
0
Payments used on a one time purchase. Same as single_payment but returns DB record as well
def single_payment_db(*args, **kwargs): return _single_payment(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_payment(*args, **kwargs):\n return _single_payment(*args, **kwargs)[0]", "def getPayment(self):\n pass", "def get(self, payment):\n return payment", "def get_a_payment(self, payment_id):\n query = \"\"\"\n SELECT * FROM payments WHERE payment_id='{}'\n \"\...
[ "0.77667063", "0.70427686", "0.68251556", "0.67205894", "0.65434945", "0.6408306", "0.63539696", "0.62386763", "0.6208539", "0.6177798", "0.6159257", "0.6156683", "0.6141858", "0.6140116", "0.60867375", "0.6076224", "0.6003835", "0.59392214", "0.5905647", "0.5904292", "0.5899...
0.7721718
1
Appends width and height information to url
def calculate_width_and_height(url_parts, options): width = options.get("width", 0) has_width = width height = options.get("height", 0) has_height = height flip = options.get("flip", False) flop = options.get("flop", False) if flip: width = width * -1 if flop: height = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_querystring(request):\n url = request.args.get('url', settings.default_iframe_url)\n if not url.startswith('http:') and not url.startswith('https:'):\n url = \"http://\" + url\n\n try:\n width = int(request.args.get(\"width\"))\n except Exception as e:\n width = settings....
[ "0.6281751", "0.62118673", "0.5842929", "0.5794725", "0.57356554", "0.56293833", "0.5601433", "0.5595776", "0.5578843", "0.55130774", "0.5488053", "0.5457251", "0.5423539", "0.54130846", "0.5409756", "0.5364731", "0.5364731", "0.533183", "0.53303957", "0.52568704", "0.5234353...
0.6610276
0
Returns the unsafe url with the specified options
def unsafe_url(**options): return f"unsafe/{plain_image_url(**options)}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_for(**options):\n\n url_parts = get_url_parts(**options)\n image_hash = hashlib.md5(b(options[\"image_url\"])).hexdigest()\n url_parts.append(image_hash)\n\n return \"/\".join(url_parts)", "def _getURL(serviceName, options):\n system = options['System']\n port = options['Port']\n hos...
[ "0.56276965", "0.5543516", "0.5443992", "0.5410417", "0.5332573", "0.5256954", "0.5185324", "0.514859", "0.5073808", "0.5050113", "0.5022535", "0.49896252", "0.49772602", "0.4961297", "0.49121684", "0.49012214", "0.48973286", "0.4889133", "0.48608586", "0.4860748", "0.4851599...
0.86149985
0
Takes command line parser arguments and formats them to display them in TensorBoard text.
def args_to_tensorboard(writer, args): txt = "" for arg in vars(args): txt += arg + ": " + str(getattr(args, arg)) + "<br/>" writer.add_text('command_line_parameters', txt, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_parameters(args):\n\n logging.basicConfig(format='%(message)s', level=args.logging)\n\n logging.info('\\n#{0}'.format('-'*60))\n logging.info('BUILD CONFIG : {0}'.format(args.config))\n logging.info('BUNDLE FILE : {0}'.format(args.bfile))", "def report_args(args):\n\n print (\"SETTINGS:\...
[ "0.6387252", "0.62601274", "0.6191031", "0.61614037", "0.6029615", "0.58726114", "0.5857964", "0.5851427", "0.5775555", "0.5757044", "0.5757044", "0.57544684", "0.5729303", "0.57272494", "0.57127666", "0.5710441", "0.56931686", "0.56781596", "0.56476045", "0.56460625", "0.563...
0.7062153
0
Visualization of classification scores per dataset.
def visualize_classification_scores(data, other_data_dicts, dict_key, data_name, save_path): data = [y for x in data for y in x] plt.figure(figsize=(20, 20)) plt.hist(data, label=data_name, alpha=1.0, bins=20, color=colors[0]) c = 0 for other_data_name, other_data_dict in other_data_dicts.items()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualise_dataset_classifier_results(dataset_results):\n current_time = datetime.now().strftime(\"%Y-%m-%d_%H-%M-%S\")\n file_name = \"raw_dump_{0}.txt\".format(current_time)\n with open(os.path.dirname(os.path.realpath(__file__)) + \"/../results/\" + file_name, \"wb\") as output_file:\n output...
[ "0.67742646", "0.6670112", "0.6593802", "0.6496122", "0.6466233", "0.6434817", "0.6345682", "0.6258273", "0.6223671", "0.61882454", "0.6146064", "0.61371434", "0.61347526", "0.6118158", "0.60917777", "0.60817623", "0.6071282", "0.6067913", "0.6066827", "0.60449696", "0.603546...
0.6869027
0
Visualization of Weibull CDF outlier probabilites.
def visualize_weibull_outlier_probabilities(data_outlier_probs, other_data_outlier_probs_dict, data_name, save_path, tailsize): data_outlier_probs = np.concatenate(data_outlier_probs, axis=0) data_weights = np.ones_like(data_outlier_probs) / float(len(data_outlier_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_filtergaussian_distribution(dataframe, ellipse=None, confidence=0.975, *args, **kwargs):\n\n fig = pyplot.figure()\n ax = fig.add_subplot(1, 1, 1)\n ax = dataframe.plot(kind='scatter', x='coul', y='vdw',\n title='Multivariate Gaussian distribution outlier detection of delta...
[ "0.58426213", "0.58351547", "0.5712385", "0.56694555", "0.56262976", "0.5593484", "0.55853325", "0.5584248", "0.5578107", "0.5567374", "0.55369794", "0.5461083", "0.5446264", "0.54393595", "0.54382926", "0.543117", "0.54301083", "0.5422929", "0.53959244", "0.5375342", "0.5328...
0.6709738
0
Visualization of percentage of datasets considered as statistical outliers evaluated for different entropy thresholds.
def visualize_entropy_classification(data, other_data_dicts, dict_key, data_name, thresholds, save_path): lw = 10 plt.figure(figsize=(20, 20)) plt.plot(thresholds, data, label=data_name, color=colors[0], linestyle='solid', linewidth=lw) c = 0 for other_data_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_outliers(df, var):\n import pandas as pd\n import numpy as np\n import matplotlib.pyplot as plt\n \n num_var = df.groupby(var)[var].count() \n total = np.float(len(df))\n \n var_perc = num_var / total \n \n var_perc.plot.bar()\n plt.ylabel('Percentage of observations ...
[ "0.67925465", "0.63983995", "0.63806075", "0.62642866", "0.62504035", "0.60975665", "0.5994715", "0.5979693", "0.59293205", "0.58919585", "0.58346003", "0.5793353", "0.57767063", "0.5759648", "0.5737828", "0.5720428", "0.5686451", "0.5678417", "0.5649284", "0.562824", "0.5622...
0.6580839
1
Test validates that literal I/O definitions only defined in the `CWL` package as `JSON` within the deployment body generates expected `WPS` process description I/O with corresponding formats and values.
def test_literal_io_from_package(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "inputs": { "url": { "type": "string" } }, "outputs": { "values": { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_literal_io_from_package_and_offering(self):\n cwl = {\n \"cwlVersion\": \"v1.0\",\n \"class\": \"CommandLineTool\",\n \"inputs\": [\n {\n \"id\": \"literal_input_only_cwl_minimal\",\n \"type\": \"string\"\n ...
[ "0.7335839", "0.7186423", "0.709824", "0.6869373", "0.6536454", "0.63462526", "0.6162359", "0.61208475", "0.5799869", "0.5792547", "0.5771453", "0.5730999", "0.5729715", "0.5686372", "0.56545925", "0.5639889", "0.5545663", "0.5530782", "0.54642206", "0.5451557", "0.5425579", ...
0.7565196
0
Test to validates if ``builtin`` process type is explicitly blocked during deployment from API.
def test_block_builtin_processes_from_api(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "baseCommand": ["python3"], "inputs": { "stringInput": "string" }, "requirements": { CWL_REQUIREMENT_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_builtin(_):\n pass", "def ignore_builtin_verification():\n return not current_space().skip_builtin_verification", "def builtin(self) -> pulumi.Input[bool]:\n return pulumi.get(self, \"builtin\")", "def builtin(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, ...
[ "0.60932183", "0.5976051", "0.55341274", "0.5520691", "0.54396325", "0.5269317", "0.525597", "0.52419895", "0.523383", "0.5224896", "0.5206303", "0.51840186", "0.516349", "0.51398534", "0.5116212", "0.51118296", "0.5111129", "0.5090624", "0.5078191", "0.5059867", "0.5020478",...
0.67087364
0
Test validates that various merging/resolution strategies of I/O definitions are properly applied for corresponding ``minOccurs`` and ``maxOccurs`` fields across `CWL` and `WPS` payloads. Also, fields that can help infer ``minOccurs`` and ``maxOccurs`` values such as ``default`` and ``type`` are tested.
def test_resolution_io_min_max_occurs(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "inputs": [ # although types are parsed in multiple ways to compare default/null/array/minOccurs/maxOccurs # values, the original definitions...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_io_min_max_occurs_as_str_or_int(self):\n cwl = {\n \"cwlVersion\": \"v1.0\",\n \"class\": \"CommandLineTool\",\n \"inputs\": [\n {\"id\": \"io_min_int_max_int\", \"type\": \"string\"},\n {\"id\": \"io_min_int_max_str\", \"type\": ...
[ "0.655599", "0.6512555", "0.5798651", "0.579032", "0.56327814", "0.55790967", "0.5565551", "0.5552945", "0.551934", "0.55126005", "0.55065024", "0.5440626", "0.5417278", "0.5410744", "0.5398262", "0.53890204", "0.5383708", "0.5382422", "0.5353077", "0.5352635", "0.53452796", ...
0.73313653
0
Test validates that I/O definitions with ``minOccurs`` and/or ``maxOccurs`` are permitted as both integer and string definitions in order to support (1, "1", "unbounded") variations.
def test_valid_io_min_max_occurs_as_str_or_int(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "inputs": [ {"id": "io_min_int_max_int", "type": "string"}, {"id": "io_min_int_max_str", "type": "string"}, {"id": "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resolution_io_min_max_occurs(self):\n cwl = {\n \"cwlVersion\": \"v1.0\",\n \"class\": \"CommandLineTool\",\n \"inputs\": [\n # although types are parsed in multiple ways to compare default/null/array/minOccurs/maxOccurs\n # values, the...
[ "0.6599541", "0.6486432", "0.64398664", "0.6277866", "0.61278725", "0.5949838", "0.5921405", "0.5914889", "0.5864209", "0.58358943", "0.583533", "0.5799506", "0.5786039", "0.5752612", "0.56681097", "0.56043684", "0.56035846", "0.55926573", "0.5564574", "0.5528966", "0.5494014...
0.69859064
0
Test that different accept language matching supported languages all successfully execute and apply them. Invalid accept languages must be correctly reported as not supported.
def test_execute_job_with_accept_languages(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "baseCommand": "echo", "inputs": {"message": {"type": "string", "inputBinding": {"position": 1}}}, "outputs": {"output": {"type": "File", "outpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_language_fix(self):\n #TODO\n \n for lang in self.LANGUAGES:\n activate(lang)\n \n self.assertEqual(lang, get_language())", "def test_language_sensitivity(self): \n \n for lang in self.LANGUAGES:\n activate(lan...
[ "0.68788403", "0.6849638", "0.6730003", "0.6569703", "0.6491666", "0.64227474", "0.6216115", "0.61777717", "0.6164482", "0.6164482", "0.60795623", "0.60606766", "0.60331464", "0.5966085", "0.5953926", "0.59199286", "0.589874", "0.5880407", "0.57302976", "0.5727804", "0.572376...
0.69726515
0
The test validates job can receive an array as input and process it as expected.
def test_execute_job_with_array_input(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "baseCommand": ["python3", "script.py"], "inputs": { "test_int_array": {"type": {"type": "array", "items": "int"}, "inputBinding": {"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_array(self, array: ArrayData, value: List[int]):\n assert self._call is not None, f\"You must first call a function before checking its return values!\"\n \"\"\" Checks that when this function is called, we have not already assembled and run the test. \"\"\"\n assert not self._has_ex...
[ "0.633448", "0.6280933", "0.6240336", "0.6224917", "0.61937845", "0.6140309", "0.6103919", "0.60485363", "0.6030743", "0.59700453", "0.58643746", "0.5810655", "0.5802698", "0.5801958", "0.57940614", "0.57738113", "0.5736269", "0.5733101", "0.5690192", "0.564355", "0.56142503"...
0.6897454
0
Test verifies that ``minOccurs`` and/or ``maxOccurs`` definitions other than allowed formats are raised as invalid schemas.
def test_invalid_io_min_max_occurs_wrong_format(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "inputs": [{}], # updated after "outputs": {"values": {"type": "string"}} } body = { "processDescription": { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_supported_schemas(self):\n supported_schemas = modelprop.get_supported_schemas()\n\n assumed_schemas = [\n \"HAZUS_v1.0\",\n \"SARA_v1.0\",\n \"SUPPASRI2013_v2.0\",\n \"Mavrouli_et_al_2014\",\n \"Torres_Corredor_et_al_2017\",\n ...
[ "0.6614721", "0.6577441", "0.6567425", "0.6553559", "0.64648145", "0.64188457", "0.641412", "0.63875085", "0.6359459", "0.63483405", "0.6324148", "0.6290119", "0.6287649", "0.628245", "0.6272029", "0.6266671", "0.62480336", "0.62457275", "0.6243545", "0.62339765", "0.62214714...
0.6609925
1
Test validates that complex I/O definitions only defined in the `CWL` package as `JSON` within the deployment body generates expected `WPS` process description I/O with corresponding formats and values.
def test_complex_io_from_package(self): cwl = { "cwlVersion": "v1.0", "class": "CommandLineTool", "inputs": { "url": { "type": "File" } }, "outputs": { "files": { "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_complex_io_from_package_and_offering(self):\n cwl = {\n \"cwlVersion\": \"v1.0\",\n \"class\": \"CommandLineTool\",\n \"inputs\": [\n {\n \"id\": \"complex_input_only_cwl_minimal\",\n \"label\": \"Complex Input On...
[ "0.7647831", "0.72468895", "0.71009034", "0.70263916", "0.6340603", "0.6220205", "0.6157037", "0.58829856", "0.584833", "0.5788607", "0.5712027", "0.5568588", "0.5541408", "0.55201095", "0.5516527", "0.5510861", "0.5475974", "0.5451569", "0.54322344", "0.5426319", "0.54167444...
0.7730801
0
Constrained Realizations has to be initialized with parameters and the desired mask.
def __init__(self, nside, weights_map, lmax_factor=1.5, mask=None): self.params = sc.Parameters(nside, lmax_factor) self.weights_map = weights_map if mask is not None: self.mask = sc.Mask(mask, nside) else: self.mask = sc.Mask(np.ones(self.params.npix))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mask, scale, shift):\n\n super(ConditionalAffineCoupling, self).__init__()\n\n self.s = scale\n self.t = shift\n\n self.mask = nn.Parameter(mask, requires_grad=False)", "def init(self, constrain=True, rescale=True, **kwargs):\n # pylint: disable=W0201\n ...
[ "0.6197939", "0.5957834", "0.5915918", "0.5892472", "0.5890567", "0.5774324", "0.5755159", "0.5688628", "0.56803113", "0.5679439", "0.5679034", "0.5664302", "0.5613412", "0.5597397", "0.5585357", "0.5573957", "0.55566394", "0.5522521", "0.5522073", "0.5520118", "0.5519384", ...
0.60565174
1
Set signal cov from Cls and assignt quantities to .signal_cov atribute
def set_signal_cov(self, cl, fwhm = None): if fwhm is not None: bl = hp.gauss_beam(fwhm,lmax=len(cl)-1) self.signal_cov = sc.SignalCov(bl**2 * cl, self.params.lmax) else: self.signal_cov = sc.SignalCov(cl, self.params.lmax) try: self.set_delta() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cov(self):\n v_mpart = self.d_vars['MPart']\n n_mpart = len(v_mpart)\n for p in combinations_with_replacement(range(n_mpart), 2):\n self.add_parameter('Cov', p[0], p[1])\n\n m_cov = np.zeros((n_mpart, n_mpart))\n return m_cov", "def compute_cov(self):\n ...
[ "0.6556703", "0.6507247", "0.6471902", "0.626079", "0.626079", "0.59238154", "0.588319", "0.5846221", "0.5846221", "0.5846221", "0.5744607", "0.5740632", "0.56395775", "0.56366384", "0.5622778", "0.5538673", "0.5516153", "0.5501424", "0.54440135", "0.54396546", "0.5430186", ...
0.71446955
0
Generate one fluctuation field delta making use of already set parameters and covariances.
def gen_delta(self): delta = self.delta.gen_delta(self.mask.good_pix, self.mask.bad_pix, self.params.nside, self.params.npix) return delta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_ufl_equations_diff(self):\n\n # Derivatives of velocity integration equation.\n if self.f1 != 0:\n self.df1_du = dlf.derivative(self.f1, self.displacement, self.trial_vector)\n self.df1_dv = dlf.derivative(self.f1, self.velocity, self.trial_vector)\n else:\n ...
[ "0.6225345", "0.60748196", "0.59281176", "0.58535725", "0.57484716", "0.5738952", "0.571074", "0.57039315", "0.5661863", "0.5660484", "0.5617467", "0.55705225", "0.55439466", "0.5511103", "0.55089104", "0.5504739", "0.5482975", "0.54800236", "0.54766065", "0.5434949", "0.5415...
0.61824846
1
Solve for flm for a specific delta, lambda and target precision
def solve_flm(self, tlm, delta, lamb, target_precision, wf = False): flm = np.ones(len(tlm)) while True: flm_i = np.copy(flm) flm, tlm = self.do_transform(delta, tlm, lamb, wf) conv = np.linalg.norm(flm-flm_i, ord=2)\ / np.linalg.norm(flm_i, ord=2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_newton_step(lambdas, p_norm, w_norm):\n return lambdas.candidate + (p_norm / w_norm) ** 2 * (p_norm - 1)", "def test_newton():\n\n f = lambda x: x**2 + np.sin(5*x)\n df = lambda x: 2*x + 5*np.cos(5*x)\n ddf = lambda x: 2 + 0,-25*np.sin(5*x)\n\n\n print newtonsMethod(f,df,ddf, 0, niter...
[ "0.6078323", "0.58903885", "0.5821137", "0.57973653", "0.56998456", "0.56744653", "0.56627965", "0.56153303", "0.5611798", "0.55961853", "0.5567436", "0.55216795", "0.5519403", "0.5514968", "0.54986924", "0.5487097", "0.54570633", "0.5444893", "0.5441592", "0.5438825", "0.542...
0.72084004
0