query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns eigenvalues of the adjacency matrix of G.
def adjacency_spectrum(G, weight="weight"): import scipy as sp return sp.linalg.eigvals(nx.adjacency_matrix(G, weight=weight).todense())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjacency_spectrum(G,weight='weight'):\n try:\n import numpy as np\n except ImportError:\n raise ImportError(\n \"adjacency_spectrum() requires NumPy: http://scipy.org/ \")\n return np.linalg.eigvals(adj_matrix(G,weight=weight))", "def analytical_eig(A):\n n = len(A)\n h...
[ "0.6891642", "0.6423288", "0.63983595", "0.63027686", "0.6252841", "0.62505156", "0.62104166", "0.6199966", "0.6188516", "0.61684835", "0.6147283", "0.6067081", "0.60523146", "0.60511893", "0.604462", "0.6037283", "0.60262215", "0.5980188", "0.59671223", "0.59646595", "0.5949...
0.68891317
1
Returns eigenvalues of the modularity matrix of G.
def modularity_spectrum(G): import scipy as sp if G.is_directed(): return sp.linalg.eigvals(nx.directed_modularity_matrix(G)) else: return sp.linalg.eigvals(nx.modularity_matrix(G))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigenvalues(self) -> ndarray:\n return self._vals", "def get_E(J,k):\n E = -2 * J * np.cos(k) # energyeigenvalue \n return E", "def GetEigenvalues(self, eigenvalues):\n return _hypre.HypreLOBPCG_GetEigenvalues(self, eigenvalues)", "def eigensystem(mat):\n e, v = numpy....
[ "0.6733166", "0.6702884", "0.66992486", "0.642786", "0.6406916", "0.639992", "0.6356925", "0.63515425", "0.63438994", "0.6328765", "0.63085186", "0.627732", "0.6240069", "0.62371206", "0.6185818", "0.61492646", "0.6118799", "0.6094602", "0.60107183", "0.60083413", "0.60064334...
0.72664213
0
Create the element for the given octant. This callback provides the global indices for the filter mesh and the weights applied to each nodal density value to obtain the element density. The local octant is also provided (but not used here).
def createElement(self, order, octant, index, weights): return self.element
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createNodeElement(_session, _segment, _const):\n return createNode(_session, _segment, _const, \"element\")", "def _createVetor(cls, elem):\n return cls(elem)", "def _create(self, creation_type: str = \"Uniform\"):\n if creation_type == \"Uniform\":\n number_of_vectors = comb(\n...
[ "0.51621693", "0.48073286", "0.46622384", "0.45329916", "0.4529173", "0.44532076", "0.44458538", "0.4413116", "0.44013977", "0.43910643", "0.4382894", "0.4368806", "0.43577817", "0.43466914", "0.42872855", "0.42810267", "0.42793715", "0.42689186", "0.42629996", "0.4261509", "...
0.6639912
0
Create the creator class and filter for the provided OctForest object. This is called for every mesh level when the topology optimization problem is created.
def creator_callback(self, forest): creator = OctCreator(self.bcs, forest, props=self.props) return creator, forest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build(self, prefilt=None):\n self.make_filiation()\n if prefilt is not None:\n self.prefilter(filt=prefilt)\n self.make_trees()\n return", "def create_forest(comm, depth, htarget=5.0, filename=\"cantilever.stp\"):\n # Load the geometry model\n geo = TMR.LoadModel...
[ "0.5907212", "0.58128744", "0.5548508", "0.54969114", "0.5438149", "0.5436613", "0.5411292", "0.5390005", "0.5380561", "0.53719646", "0.5296009", "0.5213716", "0.5103126", "0.50868624", "0.50765324", "0.5011517", "0.50012755", "0.49834257", "0.49831927", "0.49813673", "0.4980...
0.60544777
0
Create an initial forest for analysis and optimization This code loads in the model, sets names, meshes the geometry and creates a QuadForest from the mesh. The forest is populated with quadtrees with the specified depth.
def create_forest(comm, depth, htarget=5.0, filename="cantilever.stp"): # Load the geometry model geo = TMR.LoadModel(filename) # Mark the boundary condition faces verts = geo.getVertices() faces = geo.getFaces() volumes = geo.getVolumes() # Set source and target faces faces[3].setName...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_forest(self, verbose):\n _antecessors = []\n for key, cluster in self.clusters.items():\n if cluster.leaf_cluster is True:\n _antecessors.append(cluster.antecessor)\n _antecessors = remdup_preserve_order(_antecessors)\n _antecessors = sorted(_antecessors, key=get_cluster_idx, ...
[ "0.5743726", "0.55672914", "0.5471897", "0.53624874", "0.53486174", "0.5271481", "0.5220773", "0.5185084", "0.51685864", "0.5139653", "0.5102182", "0.5085573", "0.50668144", "0.50427955", "0.5023448", "0.502102", "0.5018734", "0.49619636", "0.49612683", "0.49424347", "0.49385...
0.6790161
0
Create and initialize a filter with the specified parameters
def filter_callback(self, assemblers, filters): # Find the characteristic length of the domain and set the filter length scale r0 = self.r0_frac * self.a mfilter = TopOptUtils.Mfilter(self.N, assemblers, filters, dim=3, r=r0) mfilter.initialize() return mfilter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_filter(self):\n shape = self.filter_size + (self.input_shape[-1], self.channels)\n self.filter = self.filter_initializer(shape)", "def __init__(self, image, filter_name, cutoff, order = 0):\n self.filter_name = filter_name\n self.image = image\n if filter_name ==...
[ "0.7619996", "0.7296555", "0.72150415", "0.71926135", "0.7178363", "0.71684676", "0.70550984", "0.7019159", "0.70097876", "0.68981886", "0.68484634", "0.6839295", "0.6837514", "0.6819797", "0.68132067", "0.67807394", "0.6696578", "0.66827375", "0.66290325", "0.6625982", "0.66...
0.58345157
96
Create the TMRTopoProblem object and set up the topology optimization problem. This code is given the forest, boundary conditions, material properties and the number of multigrid levels. Based on this info, it creates the TMRTopoProblem and sets up the massconstrained compliance minimization problem. Before the problem...
def create_problem( forest, bcs, props, nlevels, vol_frac=0.25, density=2600.0, iter_offset=0 ): # Characteristic length of the domain len0 = 10.0 r0_frac = 0.05 N = 20 # Create the problem and filter object mfilter = MFilterCreator(r0_frac, N, a=len0) filter_type = mfilter.filter_call...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, para, ini_cond):\n\n # grid\n self.z = np.linspace(0, para['grid']['zmax'], para['grid']['Nlayers']) # grid [m] above ground\n self.dz = self.z[1] - self.z[0] # gridsize [m]\n self.ones = np.ones(len(self.z)) # dummy\n self.zref = para['zref'] # height of fo...
[ "0.561233", "0.5598695", "0.5516206", "0.55082023", "0.54308045", "0.5411817", "0.5386293", "0.5379348", "0.53286433", "0.5291673", "0.5284003", "0.5240421", "0.51778615", "0.5159496", "0.5159075", "0.51514286", "0.5132344", "0.5131389", "0.51095265", "0.5104428", "0.510223",...
0.63748044
0
Add a column of ones to a matrix and return
def _add_bias(self, X): return np.c_[np.ones(X.shape[0]), X]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addOnes(x,m):\n n = x.size/m\n one = np.ones((m,1))\n x = x.reshape((m,n))\n judge = np.sum(x[:,0] == one.flatten())\n if judge != m:\n x = np.hstack((one,x))\n return x", "def add_column(matrix):\n import numpy as np\n shape = np.shape(matrix)\n if matrix is np.zeros(shape)...
[ "0.7745228", "0.70619845", "0.6882059", "0.6752428", "0.6559616", "0.63691795", "0.6249357", "0.6122071", "0.6092992", "0.60215044", "0.60086954", "0.5957885", "0.5809141", "0.5800081", "0.57735604", "0.5742544", "0.57277817", "0.57112956", "0.5709096", "0.5684767", "0.566928...
0.0
-1
Implement ordinary least square using linear algebra
def _ols(self, X, y): # add bias X = self._add_bias(X) # optimise coefficients xTx = np.dot(X.T, X) inverse_xTx = np.linalg.inv(xTx) xTy = np.dot(X.T, y) bhat = np.dot(inverse_xTx, xTy) # pull out weights and bias b = bhat[0] w = bhat[1:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_least_squares(train_feat, res_feat):\n\n training = train_feat\n\n result_training = res_feat\n\n trans = get_transpose(training)\n\n mat_mul_trans = matrix_mul(trans, training)\n\n mat_mul_trans = get_inverse(mat_mul_trans)\n\n second_prod = matrix_mul(mat_mul_trans, trans)\n\n retu...
[ "0.66616625", "0.6550392", "0.64495015", "0.6401943", "0.6369113", "0.633602", "0.6292869", "0.62586945", "0.62396157", "0.62209505", "0.6166053", "0.60449725", "0.6013064", "0.59378016", "0.59088635", "0.5892524", "0.5884529", "0.58825916", "0.58766556", "0.58487684", "0.584...
0.0
-1
Plots the difference in unemployment between Norway and USA.
def plot_relative_unemployment(norway, usa): # Use the dates from Norway as x-axis x = norway[0] # Calculate the difference between Norway and USA y = [usa[1][i] - norway[1][i] for i in range(len(norway[1]))] # Create the plot fig = go.Figure(layout=layout) fig.add_trace(go.Scatter(x=x, y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_unemployment():\n\n # Create the plot\n fig = go.Figure(layout=layout)\n\n # Plot the data from Norway\n norway = get_norway()\n fig.add_trace(go.Scatter(x=norway[0], y=norway[1], mode=\"lines+markers\", name=\"Norway\"))\n\n # Plot the data from USA\n usa = get_usa()\n fig.add_tra...
[ "0.7226451", "0.5727417", "0.5417691", "0.5404283", "0.5337053", "0.5313546", "0.52084684", "0.51725113", "0.5169662", "0.51440084", "0.5119941", "0.51021814", "0.5099616", "0.5067583", "0.5065785", "0.5057951", "0.5056406", "0.504999", "0.50293845", "0.50276244", "0.4997353"...
0.7231196
0
Plots the unemployment rate of Norway and USA. The result is an html file with the plot.
def plot_unemployment(): # Create the plot fig = go.Figure(layout=layout) # Plot the data from Norway norway = get_norway() fig.add_trace(go.Scatter(x=norway[0], y=norway[1], mode="lines+markers", name="Norway")) # Plot the data from USA usa = get_usa() fig.add_trace(go.Scatter(x=usa[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_relative_unemployment(norway, usa):\n\n # Use the dates from Norway as x-axis\n x = norway[0]\n\n # Calculate the difference between Norway and USA\n y = [usa[1][i] - norway[1][i] for i in range(len(norway[1]))]\n\n # Create the plot\n fig = go.Figure(layout=layout)\n fig.add_trace(go...
[ "0.7380092", "0.5902878", "0.58946776", "0.57200336", "0.5568791", "0.5477208", "0.5449444", "0.54090005", "0.53779197", "0.5367056", "0.5335279", "0.5317123", "0.527646", "0.52451736", "0.52193046", "0.5216275", "0.5206476", "0.5199765", "0.51784766", "0.5172489", "0.5152362...
0.8006811
0
Plots the covid cases in Norway and USA per 100 000 citizen.
def plot_relative_covid(norway, usa): pop_norway = get_norway_population() pop_usa = get_usa_population() # Calculate the number of cases per 100 000 citizen for i, val in enumerate(norway[1]): norway[1][i] = (val * 100000) / pop_norway for i, val in enumerate(usa[1]): usa[1][i] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_covid():\n\n norway, usa = get_covid()\n _plot_covid(norway[0], norway[1], \"Norway\", \"12 Mar 2020\", \"#636efa\", \"#ef553b\")\n _plot_covid(usa[0], usa[1], \"USA\", \"22 Mar 2020\", \"#ef553b\", \"#636efa\")\n\n plot_relative_covid(norway, usa)", "def plotCaliCoverage(constants, data, ou...
[ "0.69711107", "0.6399468", "0.62426513", "0.6178845", "0.61452097", "0.613694", "0.6128832", "0.61033636", "0.6096911", "0.60663915", "0.6007003", "0.598395", "0.5964565", "0.5954614", "0.5911071", "0.5860643", "0.57960933", "0.5762149", "0.5749039", "0.570125", "0.57004666",...
0.6726965
1
Helper function for plot_covid. Creates the plots for the given data, and saves it as an html file.
def _plot_covid(x, y, country, lockdown, color1, color2): # Create the plot fig = go.Figure(layout=layout) # Plot the given data fig.add_trace(go.Bar(x=x, y=y, marker_color=color1)) # Add a vertical line representing the lockdown fig.add_vline(x=lockdown, line_color=color2) fig.add_annota...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(data, layout, file_name):\n offline.plot({'data': data,\n 'layout': layout},\n filename='{}-{}_{}-{}.html'.format(file_name,\n todays_day,\n todays_month,\n ...
[ "0.6832546", "0.6646795", "0.6531454", "0.6502214", "0.64706", "0.64398223", "0.64378625", "0.6360196", "0.63215834", "0.63079906", "0.6290923", "0.626317", "0.62471074", "0.62468773", "0.62319213", "0.6223436", "0.62180704", "0.6205718", "0.61957455", "0.61900383", "0.616152...
0.0
-1
Plots the number of Covid cases per day for Norway and USA.
def plot_covid(): norway, usa = get_covid() _plot_covid(norway[0], norway[1], "Norway", "12 Mar 2020", "#636efa", "#ef553b") _plot_covid(usa[0], usa[1], "USA", "22 Mar 2020", "#ef553b", "#636efa") plot_relative_covid(norway, usa)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_new_cases(data, case_type, country, province):\n # Copy the identifying columns on geography\n identifier = data[case_type][[\n 'province/state', 'country/region', 'lat', 'long']]\n\n # Insert first column\n col = data[case_type].iloc[:, 4]\n daily_new = col.to_frame()\...
[ "0.684806", "0.671814", "0.63959306", "0.6374826", "0.6363994", "0.6356796", "0.6186294", "0.6184675", "0.6169266", "0.60575324", "0.60035706", "0.58864385", "0.58654237", "0.57761854", "0.57707185", "0.57450664", "0.5744827", "0.5701265", "0.56952673", "0.5684716", "0.568297...
0.68396235
1
Combines template.html with the plots. The resulting file (document.html) is the finished report.
def update_template(): # Open, and read, the template file with open("template.html", "r") as f: soup = BeautifulSoup(f.read(), features="html5lib") # Add the plots in the correct places for div in soup.find_all("div", class_="plot"): with open(div["src"], "r") as f: plot =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_html(self, workdir, templatePath, imgFormat):\n plot_tables = []\n plot_set = [ self._expectedPlots_globalAvg, self._expectedPlots_Nino, self._expectedPlots_transportDiags ]\n\n # build up the plot_tables array\n for k in range(len(plot_set)):\n plot_table = []\n ...
[ "0.6883802", "0.6878068", "0.66666186", "0.64968467", "0.64968467", "0.64845616", "0.64245784", "0.640758", "0.61694556", "0.61353934", "0.6066713", "0.6010698", "0.5984748", "0.59806466", "0.5980271", "0.59713936", "0.59706545", "0.5967902", "0.5935875", "0.59337777", "0.592...
0.7910929
0
Get last 100 received thread invitations as current user {GET} /threads/invitations
def get(self): # Send request response = self._get( url="/threads/invitations" ) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_inbox(request):\n threads = models.MessageThread.objects.filter(clients=request.user).annotate(\n unread_count=Count('receipts',filter=Q(receipts__recipient=request.user))\n )\n thread_data = serializers.MessageThreadListSerializer(threads).data\n #user = userauth_models.User.objects.fi...
[ "0.57735765", "0.5764456", "0.5692115", "0.56652117", "0.5647309", "0.563999", "0.559273", "0.554745", "0.5526691", "0.54903305", "0.5490243", "0.5473487", "0.540215", "0.5381637", "0.5314287", "0.5308518", "0.52921236", "0.527585", "0.52751327", "0.5251491", "0.5239493", "...
0.7255056
0
Will generate an integer of b bits that is prime using the gmpy2 library
def generate_prime(bits): while True: possible = mpz(2)**(bits-1) + mpz_urandomb(rand, bits-1) if is_prime(possible): return possible
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_prime(self, n_bits):\n n = gmpy2.mpz(prng.getrandbits(n_bits))\n return gmpy2.next_prime(n)", "def generate_large_prime(bit_size=1024):\n while True:\n p = random.randint(2**(bit_size-1), 2**bit_size)\n if is_prime(p):\n return p", "def find_good_prime(num_bit...
[ "0.7434641", "0.73719186", "0.7083952", "0.7048109", "0.6993049", "0.6963312", "0.69612396", "0.679207", "0.6680183", "0.66209155", "0.6614226", "0.6609335", "0.65991074", "0.6544097", "0.65286964", "0.64697576", "0.64530945", "0.6387802", "0.6376414", "0.63258827", "0.631751...
0.72606546
2
Will generate a pair of paillier keys bits>5
def generate_keypair(bits): p = generate_prime(bits // 2) #print(p) q = generate_prime(bits // 2) #print(q) n = p * q return PrivateKey(p, q, n), PublicKey(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyGen(key):\n def leftShift(keyBitList):\n \"\"\"Perform a circular left shift on the first and second five bits\"\"\"\n shiftedKey = [None] * KeyLength\n shiftedKey[0:9] = keyBitList[1:10]\n shiftedKey[4] = keyBitList[0]\n shiftedKey[9] = keyBitList[5]\n return sh...
[ "0.6590828", "0.6445614", "0.63969773", "0.6334846", "0.62564373", "0.6255874", "0.6244861", "0.62422985", "0.62344897", "0.6178638", "0.61746866", "0.61475027", "0.6132954", "0.6094661", "0.60662895", "0.6065656", "0.59602463", "0.595464", "0.5920666", "0.59159654", "0.59086...
0.70014495
0
Add one encrypted integer to another
def enc_add(pub, m1, m2): add_result = m1 * m2 % pub.n_sq return add_result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_encrypted(self, other):\n if self.public_key != other.public_key:\n raise ValueError(\"Attempted to add numbers encrypted against \"\n \"different public keys!\")\n\n a, b = self, other\n\n sum_ciphertext = a._raw_add(a.ciphertext(False), b.ciphe...
[ "0.73814803", "0.66655034", "0.6606656", "0.6523633", "0.6491614", "0.64623505", "0.6437948", "0.62727547", "0.62593126", "0.62188596", "0.6163947", "0.6162426", "0.6131625", "0.60852593", "0.6046513", "0.6040051", "0.6039743", "0.60212135", "0.59412444", "0.5920384", "0.5897...
0.63338584
7
Add constant n to an encrypted integer
def enc_add_const(pub, m, c): # Similiar to enc add add_const_result = m * powmod(pub.g, c, pub.n_sq) % pub.n_sq return add_const_result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(n, plaintext):\r\n res = ''\r\n\r\n for l in plaintext:\r\n try:\r\n i = (key.index(l) + n) % len(key)\r\n res += key[i]\r\n except ValueError:\r\n res += 1\r\n return res", "def calculateCrypt(asci: int, e: int, n: int) -> int:\n return pow(...
[ "0.66851616", "0.6424988", "0.640019", "0.6399379", "0.6289924", "0.62483853", "0.6116754", "0.61022204", "0.604824", "0.60315555", "0.60186744", "0.60115147", "0.59839845", "0.59474236", "0.59435374", "0.5915253", "0.590615", "0.58883715", "0.58786994", "0.58732617", "0.5857...
0.5827742
23
Multiplies an encrypted integer by a constant
def enc_mul_const(pub, m, c): mul_result = powmod(m, c, pub.n_sq) return mul_result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateCrypt(asci: int, e: int, n: int) -> int:\n return pow(int(asci),e,n)", "def multiply(number, word):\n return int(number) * word", "def __mul__(self, other):\n if isinstance(other, EncryptedNumber):\n raise NotImplementedError('Good luck with that...')\n if other < 0:...
[ "0.65029836", "0.64592296", "0.6372637", "0.6315182", "0.6280013", "0.6276835", "0.62599325", "0.6153875", "0.61174214", "0.60960615", "0.60558856", "0.6050294", "0.6037608", "0.6001841", "0.5989072", "0.59175265", "0.59151715", "0.5910307", "0.5877904", "0.58693033", "0.5810...
0.69548327
0
If text is of the form {A}B, return {A},B. Otherwise, return "",text.
def first_bracketed_string(text, depth=0, lbrack="{", rbrack="}"): thetext = text.strip() if not thetext: logger.error("empty string sent to first_bracketed_string()") return "" previouschar = "" # we need to keep track of the previous character becaause \{ does not # count ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __clean_string(cls, text):\n if text.startswith(\"(\"):\n text = text[1:]\n if text.endswith(\")\"):\n text = text[:-1]\n if text.endswith(\",\"):\n text = text[:-1]\n if len(text) > 2 and cls.__is_quote(text[0]) and \\\n cls.__is_quot...
[ "0.55917764", "0.55787957", "0.5572234", "0.5508007", "0.54399586", "0.5434133", "0.541738", "0.5401779", "0.53611827", "0.5313244", "0.5285114", "0.52371067", "0.52223605", "0.51721287", "0.50835145", "0.50834614", "0.50833213", "0.5073389", "0.50686413", "0.50640947", "0.50...
0.48392788
52
Convert citations to links In a future version the bibliographic entry will be downloaded and saved.
def ref_to_link(txt): text = txt.group(1) # because it was a match in a regular expression thecite, everythingelse = first_bracketed_string(text) thecite = thecite[1:-1] # strip curly brackets thecite = thecite.replace("\\","") # \href --> href refs = thecite.split(",") ans = "" # pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_bibtex(self):\n\n\t\t# bib = requests.request('GET', 'http://dx.doi.org/' + self.doi, ", "def to_citation(self, type):\n acs_authors = \"; \".join(self.format_authors(\"acs\"))\n # Some articles don't come with pages. :-(\n pages_with_endash = (self.pages.replace(\"-\", \"\\u2013\")...
[ "0.6388779", "0.63134277", "0.59361786", "0.58933353", "0.58061475", "0.5756777", "0.5704472", "0.5702535", "0.5688624", "0.56513476", "0.55857277", "0.55815214", "0.5556193", "0.55531496", "0.54867435", "0.5480971", "0.54668486", "0.5464017", "0.5444744", "0.54407483", "0.54...
0.60972965
2
Convert \"o to ö and similar TeXstyle markup.
def md_latex_accents(text): knowl_content = text knowl_content = re.sub(r'\\"([a-zA-Z])',r"&\1uml;",knowl_content) knowl_content = re.sub(r'\\"{([a-zA-Z])}',r"&\1uml;",knowl_content) knowl_content = re.sub(r"\\'([a-zA-Z])",r"&\1acute;",knowl_content) knowl_content = re.sub(r"\\'{([a-zA-Z])}",r"&\1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unicode2html(_unicrap):\n xlate = {u'\\u0022': '&quot;',\nu'\\u0026': '&amp;',\nu'\\u0027': '&apos;',\nu'\\u003C': '&lt;',\nu'\\u003E': '&gt;',\nu'\\u00A0': '&nbsp;',\nu'\\u00A1': '&iexcl;',\nu'\\u00A2': '&cent;',\nu'\\u00A3': '&pound;',\nu'\\u00A4': '&curren;',\nu'\\u00A5': '&yen;',\nu'\\u00A6': '&brvbar;'...
[ "0.66131294", "0.59901345", "0.5892817", "0.5775515", "0.57392156", "0.5667236", "0.56623304", "0.5650474", "0.5587488", "0.55701274", "0.5556374", "0.55477434", "0.5540923", "0.5537394", "0.55004275", "0.5470638", "0.545566", "0.54410934", "0.5439658", "0.54359055", "0.53884...
0.0
-1
This function does the actual rendering, for render and the template_filter render_knowl_in_template (ultimately for KNOWL_INC)
def render_knowl_in_template(knowl_content, **kwargs): render_me = u"""\ {%% include "knowl-defs.html" %%} {%% from "knowl-defs.html" import KNOWL with context %%} {%% from "knowl-defs.html" import KNOWL_LINK with context %%} {%% from "knowl-defs.html" import KNOWL_INC with context %%} {%% from "knowl-def...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(request, *args, **kw):", "def render_knowl(ID, footer=None, kwargs=None,\n raw=False, k=None, allow_deleted=False, timestamp=None):\n # logger.debug(\"kwargs: %s\", request.args)\n kwargs = kwargs or dict(((k, v) for k, v in request.args.items()))\n # logger.debug(\"kwargs: %s\" , kwar...
[ "0.62964994", "0.6087797", "0.6017588", "0.60043824", "0.59678346", "0.5926979", "0.59199613", "0.5917015", "0.5874543", "0.5777651", "0.57690376", "0.5651171", "0.56243455", "0.56133586", "0.5611126", "0.56095123", "0.5598745", "0.5584766", "0.55800945", "0.5577091", "0.5568...
0.6635778
0
just a test page
def test(): logger.info("test") return render_template("knowl-test.html", bread=get_bread([("Test", url_for(".test"))]), title="Knowledge Test", k1=Knowl("k1"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_homepage(self):\n\n with self.client as client:\n response = client.get('/')\n html = response.get_data(as_text=True)\n self.assertEqual(response.status_code, 200)\n self.assertIn('<table class=\"board\">', html)\n self.assertIn('<table', html)...
[ "0.77097625", "0.76581484", "0.7502895", "0.749648", "0.74505234", "0.74410677", "0.7398749", "0.73748755", "0.7365911", "0.73585975", "0.7266071", "0.7244068", "0.721993", "0.7217695", "0.7214824", "0.7191304", "0.7182607", "0.7182607", "0.7133404", "0.7125553", "0.7102403",...
0.71358484
18
this method renders the given Knowl (ID) to insert it dynamically in a website. It is intended to be used by an AJAX call, but should do a similar job serverside only, too. Note, that the used knowlrender.html template is not based on any globally defined website and just creates a small and simple html snippet! the ke...
def render_knowl(ID, footer=None, kwargs=None, raw=False, k=None, allow_deleted=False, timestamp=None): # logger.debug("kwargs: %s", request.args) kwargs = kwargs or dict(((k, v) for k, v in request.args.items())) # logger.debug("kwargs: %s" , kwargs) if timestamp is None: # fetch and co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_knowl_in_template(knowl_content, **kwargs):\n render_me = u\"\"\"\\\n {%% include \"knowl-defs.html\" %%}\n {%% from \"knowl-defs.html\" import KNOWL with context %%}\n {%% from \"knowl-defs.html\" import KNOWL_LINK with context %%}\n {%% from \"knowl-defs.html\" import KNOWL_INC with context %%}...
[ "0.6210805", "0.55757034", "0.54341483", "0.53861177", "0.5347136", "0.5274865", "0.52664876", "0.5237727", "0.5203966", "0.51898915", "0.5178765", "0.5157696", "0.51237744", "0.51210696", "0.51108015", "0.5103956", "0.5098594", "0.5065835", "0.5062791", "0.5060782", "0.50483...
0.7056656
0
Set the dataset meta info to the metric.
def dataset_meta(self, dataset_meta: dict) -> None: self._dataset_meta = dataset_meta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_metadata(self, data):\r\n pass", "def meta_data(self, meta_data):\n\n self._meta_data = meta_data", "def meta(self, meta):\n\n self._meta = meta", "def meta(self, meta):\n\n self._meta = meta", "def set_metadata(self, attribute, value):\n self.metadata[attribute] ...
[ "0.7113873", "0.6959133", "0.6804629", "0.6804629", "0.6615271", "0.65601104", "0.65385044", "0.6381809", "0.63681597", "0.63217694", "0.62548214", "0.6202046", "0.6186504", "0.6185495", "0.61761415", "0.61761415", "0.61761415", "0.61761415", "0.61761415", "0.61761415", "0.61...
0.7728363
0
Process one batch of data samples and predictions. The processed results should be stored in ``self.results``, which will be used to compute the metrics when all batches have been processed.
def process(self, data_batch: Any, data_samples: Sequence[dict]) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, data_batch: Any, predictions: Sequence[dict]) -> None:\n self.results.extend(_to_cpu(predictions))", "def process(self, data_batch: Sequence[Dict],\n data_samples: Sequence[Dict]) -> None:\n for data_sample in data_samples:\n pred_labels = data_sample.get...
[ "0.80908287", "0.7446487", "0.71155214", "0.63974357", "0.62900275", "0.62895614", "0.6247568", "0.62211806", "0.6132521", "0.61125374", "0.6100059", "0.6099298", "0.6091143", "0.608626", "0.6072162", "0.60710275", "0.6062186", "0.60483956", "0.60420924", "0.6035081", "0.6033...
0.7129678
2
Compute the metrics from processed results.
def compute_metrics(self, results: list) -> dict:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_metrics(self):\n pass", "def compute_metrics(self, results: list) -> dict:\n dump(results, self.out_file_path)\n print_log(\n f'Results has been saved to {self.out_file_path}.',\n logger='current')\n return {}", "def compute_metrics(self):\n ...
[ "0.78212637", "0.75160414", "0.74581647", "0.73755676", "0.7322359", "0.7322359", "0.71207654", "0.70953584", "0.7016177", "0.6922528", "0.68572897", "0.68020445", "0.67422473", "0.6734681", "0.6723987", "0.6684012", "0.6667367", "0.6637155", "0.6622409", "0.6586669", "0.6579...
0.8416106
0
Evaluate the model performance of the whole dataset after processing all batches.
def evaluate(self, size: int) -> dict: if len(self.results) == 0: print_log( f'{self.__class__.__name__} got empty `self.results`. Please ' 'ensure that the processed results are properly added into ' '`self.results` in `process` method.', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self) -> None:\n \n self.model.eval()\n \n with torch.no_grad():\n for (input, target, _) in self.loader:\n\n # self.model = self.model.train(False) # TEST @lacoupe\n output, _ = self.model(input)\n \n ou...
[ "0.7077714", "0.70258796", "0.69719356", "0.693921", "0.69382584", "0.6937178", "0.6936296", "0.69161814", "0.6908975", "0.6886934", "0.6880519", "0.6878574", "0.6863194", "0.6834374", "0.68251073", "0.6814966", "0.681107", "0.68095195", "0.67692065", "0.67341244", "0.6732223...
0.0
-1
transfer tensors in predictions to CPU.
def process(self, data_batch: Any, predictions: Sequence[dict]) -> None: self.results.extend(_to_cpu(predictions))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_prediction(self):\r\n self.get_prediction_indices()\r\n self.walk_forward_prediction()", "def eval_cpu(prediction_dataloader, model):\n # Put model in evaluation mode\n model.eval() \n\n predictions = []\n\n # Predict \n for batch in prediction_dataloader:\n batc...
[ "0.65521014", "0.64465463", "0.63249093", "0.63161856", "0.62496567", "0.6223502", "0.613773", "0.61376125", "0.6113582", "0.60915965", "0.6058114", "0.60571307", "0.603195", "0.6005879", "0.599654", "0.59947586", "0.59946436", "0.5993679", "0.59894407", "0.5977644", "0.59651...
0.66616493
0
dump the prediction results to a pickle file.
def compute_metrics(self, results: list) -> dict: dump(results, self.out_file_path) print_log( f'Results has been saved to {self.out_file_path}.', logger='current') return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_outputs(self):\n write_pickled(join(self.output_folder, \"results.pkl\"), self.get_results())", "def save(self):\n pickle_save(self.results, 'results', self.main_dir)", "def save_predicted_results(predicted_results):\n # Save the model\n with open(\"predicted_results\", \"w...
[ "0.7767477", "0.7611477", "0.7562195", "0.73823893", "0.72043246", "0.706519", "0.70529723", "0.7019898", "0.7000115", "0.6922725", "0.68797106", "0.68610024", "0.67092896", "0.6681986", "0.65481555", "0.6543208", "0.65309155", "0.6521187", "0.65104586", "0.6495073", "0.64897...
0.0
-1
transfer all tensors and BaseDataElement to cpu.
def _to_cpu(data: Any) -> Any: if isinstance(data, (Tensor, BaseDataElement)): return data.to('cpu') elif isinstance(data, list): return [_to_cpu(d) for d in data] elif isinstance(data, tuple): return tuple(_to_cpu(d) for d in data) elif isinstance(data, dict): return {k:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_to_gpu(self):\n self.dispatch('on_texture')", "def module_transfer_to_device(self) -> None:\n for name, module in self.modules.items():\n module.to(self.device)\n if self.device.type == 'cuda':\n self.modules[name] = torch.nn.DataParallel(module, self....
[ "0.6268041", "0.6257399", "0.6160196", "0.60098326", "0.5926676", "0.58778656", "0.5783492", "0.57612604", "0.57612604", "0.5717611", "0.5717611", "0.5706177", "0.56818783", "0.56609565", "0.56496245", "0.5621173", "0.5526923", "0.5526923", "0.55158395", "0.5499441", "0.54815...
0.57793295
7
To correct for chemical perception issues with possible resonance states of arginine, remove all charge from the guanidinium group, and set all bond orders to 4. This will mark the resonant bonds with a unique "$" character in the SMARTS, which we can later replace.
def remove_charge_and_bond_order_from_guanidinium(offmol): for atom in offmol.atoms: if atom.element.symbol != "C": continue nitrogen_neighbors = 0 for neighbor in atom.bonded_atoms: if neighbor.element.symbol == "N": nitrogen_neighbors += 1 if nitrogen_neighbors != 3: contin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_charge_and_bond_order_from_imidazole(offmol):\n matches = offmol.chemical_environment_matches('[C:1]1~[C:2]~[N:3]~[C:4]~[N:5]1')\n all_imidazole_atoms = set()\n for match in matches:\n for idx in match:\n all_imidazole_atoms.add(idx)\n\n for atom in offmol.atoms:\n if atom.molecule_atom_i...
[ "0.60058707", "0.5936393", "0.55313337", "0.5474705", "0.5327461", "0.5131094", "0.512167", "0.5119501", "0.50199974", "0.49962187", "0.49056014", "0.49054185", "0.48918006", "0.48838916", "0.4854412", "0.4842166", "0.48315072", "0.48311853", "0.4814759", "0.47966436", "0.479...
0.6787749
0
To correct for chemical perception issues with possible resonance states of histidine, remove all charge from the imidazole group, and set all bond orders to 4. This will mark the resonant bonds with a unique "$" character in the SMARTS, which we can later replace.
def remove_charge_and_bond_order_from_imidazole(offmol): matches = offmol.chemical_environment_matches('[C:1]1~[C:2]~[N:3]~[C:4]~[N:5]1') all_imidazole_atoms = set() for match in matches: for idx in match: all_imidazole_atoms.add(idx) for atom in offmol.atoms: if atom.molecule_atom_index in all_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_charge_and_bond_order_from_guanidinium(offmol):\n for atom in offmol.atoms:\n if atom.element.symbol != \"C\":\n continue\n nitrogen_neighbors = 0\n for neighbor in atom.bonded_atoms:\n if neighbor.element.symbol == \"N\":\n nitrogen_neighbors += 1\n if nitrogen_neighbors !...
[ "0.6607051", "0.61745477", "0.59384525", "0.5661288", "0.5392464", "0.5363626", "0.5275415", "0.5261481", "0.52120835", "0.52036256", "0.5198679", "0.5152463", "0.5132513", "0.5093022", "0.5080391", "0.50160897", "0.4995986", "0.49599898", "0.49497703", "0.49257922", "0.48355...
0.6892059
0
Get the SMARTS corresponding to a list of atom indices
def get_smarts(prefix, atom_idxs): offmol = Molecule.from_file(prefix + '.mol2') fix_carboxylate_bond_orders(offmol) remove_charge_and_bond_order_from_guanidinium(offmol) remove_charge_and_bond_order_from_imidazole(offmol) if prefix in prefix2pmd_struct: pmd_struct = prefix2pmd_struct[prefix] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSpectraFromIndexList(all_wl,all_spectra,idx_list):\n NBSPEC=len(all_spectra)\n \n \n all_wl_sel=[]\n all_spectra_sel=[]\n \n for idx in np.arange(0,NBSPEC):\n if idx in idx_list:\n all_wl_sel.append(all_wl[idx])\n all_spectra_sel.append(all_spectra[idx])\n ...
[ "0.6344887", "0.59205484", "0.57140833", "0.57140833", "0.55560106", "0.5451238", "0.5425908", "0.5410789", "0.53920984", "0.53697795", "0.5368882", "0.535143", "0.5306481", "0.5296508", "0.5222064", "0.5216659", "0.5172254", "0.51720744", "0.5169743", "0.51569635", "0.513482...
0.66229403
0
Returns True if this exact dihedral (periodicity, k, phase, idivf) is already defined under this SMIRKS. This is useful in cases where we might see the same dihedral term multiple times and want to check whether a particular periodicity term is already known and shouldn't be repeated (for example, the two CYX residues ...
def dihedral_term_already_defined(dihe_dict, k, phase, periodicity, idivf): existing_index = 1 while f'k{existing_index}' in dihe_dict.keys(): if ((dihe_dict[f'k{existing_index}'] == k) and (dihe_dict[f'phase{existing_index}'] == phase) and (dihe_dict[f'periodicity{existing_index}'] == periodici...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dihedral(self):\n if self._is_dihedral is not None:\n return self._is_dihedral\n\n order = self.order()\n\n if order % 2 == 1:\n self._is_dihedral = False\n return False\n if order == 2:\n self._is_dihedral = True\n return Tr...
[ "0.6675791", "0.6134677", "0.59773755", "0.57644665", "0.56748974", "0.564646", "0.5628849", "0.556478", "0.55057836", "0.5488828", "0.53959185", "0.532975", "0.52963567", "0.52935517", "0.5288566", "0.5284165", "0.5278328", "0.52768433", "0.5243487", "0.52430713", "0.5231521...
0.8116332
0
Resolve the variable, or return the value passed to it in the first place
def resolve(var, context): try: return var.resolve(context) except template.VariableDoesNotExist: return var.var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(self, var, context):\n if var[0] in ('\"', \"'\") and var[-1] == var[0]:\n return var[1:-1]\n else:\n return Variable(var).resolve(context)", "def resolve(self, var, context):\n if var[0] in ('\"', \"'\") and var[-1] == var[0]:\n return var[1:-1]\...
[ "0.73858976", "0.73858976", "0.6914317", "0.68937397", "0.6877633", "0.67908216", "0.64995795", "0.64905995", "0.6349942", "0.6220589", "0.61456454", "0.60508025", "0.60163707", "0.60101354", "0.59987104", "0.59772396", "0.58101857", "0.57931876", "0.57739353", "0.5772209", "...
0.7448513
0
Shortcut to transmogrify thumbnail
def no_param_shortcut(parser, token): bits = smart_split(token.contents) tagname = bits.next() try: imageurl = bits.next() except StopIteration: raise template.TemplateSyntaxError("%r tag requires at least the image url" % tagname) return MogrifyNode(imageurl, [(tagname, ), ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setThumbnailImage(*args):", "def create_thumbnail(self, target, format=None):", "def get_thumbnail(format):", "def thumbnail(im, config):\n\n im.thumbnail(\n (config['width'], config['height']),\n ANTIALIAS,\n )\n\n return im", "def get_thumbnail_name(self, thumbnail_name, with_s...
[ "0.6557861", "0.65003043", "0.6361055", "0.6351053", "0.61442465", "0.6074727", "0.60305816", "0.58542484", "0.5851061", "0.58039445", "0.57789236", "0.57046556", "0.5694906", "0.56473446", "0.5627652", "0.56216556", "0.56210065", "0.56209916", "0.5605047", "0.5582668", "0.55...
0.0
-1
Shortcut to transmogrify thumbnail
def one_param_shortcut(parser, token): bits = smart_split(token.contents) tagname = bits.next() try: imageurl = bits.next() param1 = bits.next() except StopIteration: raise template.TemplateSyntaxError("%r tag requires at least the image url" % tagname) return MogrifyNode(im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setThumbnailImage(*args):", "def create_thumbnail(self, target, format=None):", "def get_thumbnail(format):", "def thumbnail(im, config):\n\n im.thumbnail(\n (config['width'], config['height']),\n ANTIALIAS,\n )\n\n return im", "def get_thumbnail_name(self, thumbnail_name, with_s...
[ "0.6557861", "0.65003043", "0.6361055", "0.6351053", "0.61442465", "0.6074727", "0.60305816", "0.58542484", "0.5851061", "0.58039445", "0.57789236", "0.57046556", "0.5694906", "0.56473446", "0.5627652", "0.56216556", "0.56210065", "0.56209916", "0.5605047", "0.5582668", "0.55...
0.0
-1
Shortcut to transmogrify thumbnail
def two_param_shortcut(parser, token): bits = smart_split(token.contents) tagname = bits.next() try: imageurl = bits.next() param1 = bits.next() param2 = bits.next() param2 = param2.lstrip("#") except StopIteration: raise template.TemplateSyntaxError("%r tag requi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setThumbnailImage(*args):", "def create_thumbnail(self, target, format=None):", "def get_thumbnail(format):", "def thumbnail(im, config):\n\n im.thumbnail(\n (config['width'], config['height']),\n ANTIALIAS,\n )\n\n return im", "def get_thumbnail_name(self, thumbnail_name, with_s...
[ "0.6557861", "0.65003043", "0.6361055", "0.6351053", "0.61442465", "0.6074727", "0.60305816", "0.58542484", "0.5851061", "0.58039445", "0.57789236", "0.57046556", "0.5694906", "0.56473446", "0.5627652", "0.56216556", "0.56210065", "0.56209916", "0.5605047", "0.5582668", "0.55...
0.0
-1
Initialize a GridMapper compiler engine.
def __init__( # pylint: disable=too-many-arguments self, num_rows, num_columns, mapped_ids_to_backend_ids=None, storage=1000, optimization_function=return_swap_depth, num_optimization_steps=50, ): super().__init__() self.num_rows = num_rows ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self):\n self._compile_started = True\n self.do_init()\n self._compile_finished = True", "def __init__(\r\n self,\r\n mapper_grids: MapperGrids,\r\n regularization: Optional[AbstractRegularization],\r\n run_time_dict: Optional[Dict] = None,\r\n ):\r\n ...
[ "0.5832904", "0.5817284", "0.575536", "0.5702643", "0.56137884", "0.56027424", "0.5591344", "0.55774033", "0.5566896", "0.55517125", "0.5520863", "0.55001915", "0.54715323", "0.54600847", "0.54055744", "0.5401147", "0.53763217", "0.5367807", "0.5345475", "0.533996", "0.533375...
0.0
-1
Access to the mapping stored inside the mapper engine.
def current_mapping(self): return deepcopy(self._current_mapping)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMapping(self):\n self._process()\n return self._mapping", "def mapping(self):\n return self._mapping", "def map( self ) :\n\n self.readMap( )\n\n return( self.__map )", "def get_mapping(self):\n if self.role:\n return self.role.get_mapping(self.mapp...
[ "0.7734583", "0.7728802", "0.72344106", "0.71896243", "0.7095226", "0.7050966", "0.6878116", "0.6745366", "0.6727953", "0.66672426", "0.6632824", "0.66221774", "0.6510355", "0.6509101", "0.63767076", "0.6371599", "0.6361078", "0.633167", "0.63298", "0.6324922", "0.62078625", ...
0.61091095
25
Only allow 1 or two qubit gates.
def is_available(self, cmd): num_qubits = 0 for qureg in cmd.all_qubits: num_qubits += len(qureg) return num_qubits <= 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_native_single_qubit_gates(self, valkmusa, gate):\n\n QB1, QB2 = valkmusa.qubits\n\n with pytest.raises(ValueError, match='Unsupported gate type'):\n valkmusa.validate_operation(gate(QB2))\n\n with pytest.raises(ValueError, match='Unsupported gate type'):\n va...
[ "0.63988936", "0.63747394", "0.6283611", "0.62113893", "0.6181488", "0.5752315", "0.5668174", "0.55788684", "0.5466475", "0.5324622", "0.5301878", "0.52103204", "0.520335", "0.51980376", "0.5168078", "0.51525617", "0.51468235", "0.5137818", "0.51245064", "0.51222306", "0.5109...
0.4838367
60
Return a new mapping of the qubits. It goes through self._saved_commands and tries to find a mapping to apply these gates on a first come first served basis. It reuses the function of a 1D mapper and creates a mapping for a 1D linear chain and then wraps it like a snake onto the square grid. One might create better map...
def _return_new_mapping(self): # Change old mapping to 1D in order to use LinearChain heuristic if self._current_row_major_mapping: old_mapping_1d = {} for logical_id, mapped_id in self._current_row_major_mapping.items(): old_mapping_1d[logical_id] = self._map_2d_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run(self): # pylint: disable=too-many-locals.too-many-branches,too-many-statements\n num_of_stored_commands_before = len(self._stored_commands)\n if not self.current_mapping:\n self.current_mapping = {}\n else:\n self._send_possible_commands()\n if len(se...
[ "0.5775415", "0.5472546", "0.5457559", "0.5442311", "0.53370285", "0.521329", "0.52080417", "0.5194102", "0.5163259", "0.51357317", "0.5117319", "0.5102718", "0.51001257", "0.50929075", "0.50659585", "0.5053862", "0.50113875", "0.49969497", "0.49958226", "0.49663627", "0.4965...
0.6828302
0
If swapped (inplace), then return swap operation so that key(element0) < key(element1).
def _compare_and_swap(self, element0, element1, key): if key(element0) > key(element1): mapped_id0 = element0.current_column + element0.current_row * self.num_columns mapped_id1 = element1.current_column + element1.current_row * self.num_columns swap_operation = (mapped_id0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap(self):\n return _coconut_tail_call(Eq, self.b, self.a)", "def swap((u, v)):\n return (v, u)", "def __elementSwap(self,\n index1: int,\n index2: int):\n self.__ordered_holder[index1], self.__ordered_holder[index2] = self.__ordered_holder[index2...
[ "0.5953973", "0.5920716", "0.5891269", "0.57867384", "0.57297826", "0.5721775", "0.5698104", "0.5666503", "0.56626624", "0.5658265", "0.56564546", "0.5646911", "0.56094223", "0.5571082", "0.55625135", "0.55528694", "0.55442584", "0.5543415", "0.55414706", "0.55372673", "0.553...
0.7868407
0
Return the swap operation to change mapping.
def return_swaps( # pylint: disable=too-many-locals,too-many-branches,too-many-statements self, old_mapping, new_mapping, permutation=None ): if permutation is None: permutation = list(range(self.num_rows)) swap_operations = [] class Position: # pylint: disable=too-few...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirror(op: OperatorType) -> OperatorType:\n return _mirror.get(op, op)", "def swap(self, *args, **kwargs):\n return self.switch(*args, **kwargs)", "def trans_op(self):\n\n return self._trans_op", "def swap(self, *args):\n return _osgAnimation.BoneMap_swap(self, *args)", "def swa...
[ "0.64199024", "0.6233336", "0.61286056", "0.57419056", "0.57254565", "0.56906134", "0.56701034", "0.5657872", "0.565546", "0.56532115", "0.5651244", "0.5643843", "0.564342", "0.55687636", "0.5550672", "0.5550373", "0.5478526", "0.5474517", "0.5438815", "0.5425537", "0.5419017...
0.57756495
3
Send the stored commands possible without changing the mapping.
def _send_possible_commands(self): # pylint: disable=too-many-branches active_ids = deepcopy(self._currently_allocated_ids) for logical_id in self._current_row_major_mapping: # So that loop doesn't stop before AllocateGate applied active_ids.add(logical_id) new_stored_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_command(self, commands):\n action_space = self.action_space\n commands = np.clip(commands, action_space.low, action_space.high)\n i = 0\n joint_commands = {}\n for joint in self._used_joints:\n joint_commands[joint] = commands[i]\n i += 1\n\n ...
[ "0.69433117", "0.6786136", "0.6724367", "0.65342885", "0.65274376", "0.6501102", "0.64962757", "0.6452933", "0.64433986", "0.63641334", "0.6269014", "0.6264307", "0.6246121", "0.6176289", "0.6171755", "0.61665565", "0.6115516", "0.61027396", "0.6061256", "0.603324", "0.602872...
0.6936952
1
Create a new mapping and executes possible gates. It first allocates all 0, ..., self.num_qubits1 mapped qubit ids, if they are not already used because we might need them all for the swaps. Then it creates a new map, swaps all the qubits to the new map, executes all possible gates, and finally deallocates mapped qubit...
def _run(self): # pylint: disable=too-many-locals.too-many-branches,too-many-statements num_of_stored_commands_before = len(self._stored_commands) if not self.current_mapping: self.current_mapping = {} else: self._send_possible_commands() if len(self._stored_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_queries_qrels_new_ids(self):\n self.dict_mapper_old_to_new_qid = {}\n self.count_subtasks = {}\n self.dict_missingqueries = {}\n self.dict_assessed_queries = self.get_queries_assessed()\n self.map_old_qid_to_new()\n self.map_qrels_to_newqids()\n exit()...
[ "0.5897", "0.5667038", "0.55281574", "0.5508988", "0.538626", "0.51828766", "0.5163915", "0.5136017", "0.51119363", "0.51073563", "0.50950164", "0.5085504", "0.5080595", "0.508058", "0.5068446", "0.5056068", "0.50365084", "0.49873877", "0.4965752", "0.4964577", "0.49474922", ...
0.62740016
0
Receive a list of commands. Receive a command list and, for each command, stores it until we do a mapping (FlushGate or Cache of stored commands is full).
def receive(self, command_list): for cmd in command_list: if isinstance(cmd.gate, FlushGate): while self._stored_commands: self._run() self.send([cmd]) else: self._stored_commands.append(cmd) # Storage is ful...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self, command_list):\n for cmd in command_list:\n self._send_cmd_with_mapped_ids(cmd)", "def receive(self, command_list):\n for cmd in command_list:\n self._handle_command(cmd)", "def receive(self, command_list):\n for cmd in command_list:\n if ...
[ "0.8027519", "0.77966726", "0.76843834", "0.6712189", "0.6083511", "0.5970459", "0.59575194", "0.59414506", "0.58542866", "0.58185494", "0.58040476", "0.5798971", "0.57877177", "0.57834053", "0.57743245", "0.57696056", "0.5751746", "0.5740803", "0.5719902", "0.5718472", "0.56...
0.83096355
0
distance returns the calculated distance (in kms) between two points defined in the UTM coordinate system
def distance(UTM_ini, UTM_fin): UTM_ini_x = UTM_ini[0] UTM_ini_y = UTM_ini[1] UTM_ini_zone = UTM_ini[2] UTM_fin_x = UTM_fin[0] UTM_fin_y = UTM_fin[1] UTM_fin_zone = UTM_fin[2] [LAT_INI, LONG_INI] = utm.to_latlon(UTM_ini_x, UTM_ini_y, int(UTM_ini_zone[0:2]), str(UTM_ini_zone[3]))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']", "def distance_tt_point(a, b):\n return math.sqrt((b.lat-a.lat)**2 + (b.lon-a.lon)**2)", "def distance(a, b):\n return vincenty((float(a.longitude), float(a.latitude)),\n ...
[ "0.71442676", "0.7067441", "0.70357704", "0.7020667", "0.6974348", "0.69501024", "0.6902782", "0.6887025", "0.68833697", "0.6856308", "0.68517333", "0.6833586", "0.6822111", "0.6811233", "0.6811233", "0.6811233", "0.6811233", "0.6811233", "0.6805015", "0.68042636", "0.6803612...
0.66380346
38
Only use this for handlers where the user is trying to access a URL they shouldn't because they will get redirected to the first page with no warning if they aren't logged in
def check_logged_in(function): @wraps(function) def wrapper(*args, **kwargs): if 'username' in login_session: return function(*args, **kwargs) else: return redirect(url_for('category_list_handler')) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_forbidden_for_homepage(self, request):\n\n login_url = request.link(Auth.from_request_path(request), name='login')\n\n if URL(request.url).path() == '/':\n return morepath.redirect(login_url)\n\n return handle_forbidden(self, request)", "def process_request(self, request):\n try...
[ "0.7698153", "0.7638657", "0.761836", "0.720499", "0.7082519", "0.70819", "0.70811445", "0.70512325", "0.70094514", "0.6939337", "0.6934467", "0.69045395", "0.6849634", "0.6829456", "0.6829456", "0.6829456", "0.6803813", "0.6782697", "0.6746022", "0.6746022", "0.6746022", "...
0.0
-1
Returns JSON of the whole catalogue
def rest_get_catalogue_handler(): cats = category.get_all_categories() items = item.get_all_items() result = {} result['categories'] = [c.serialize for c in cats] result['items'] = [i.serialize for i in items] return jsonify(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def catalog_json():\n catalog_json = []\n try:\n all_categories = session.query(Category).all()\n for category in all_categories:\n items_for_category = session.query(\n Item).filter_by(\n category_id=category.id).all()\n items = []\n ...
[ "0.81359273", "0.8113486", "0.8097259", "0.74107915", "0.6950644", "0.6857114", "0.68209106", "0.67635036", "0.67243016", "0.67143345", "0.67041796", "0.6694496", "0.6693155", "0.66202116", "0.66067195", "0.6599673", "0.6572814", "0.65559745", "0.6464819", "0.6446383", "0.643...
0.7904307
3
SGD with Momentum (and Langevin Dynamics)
def sgd(cost, params, lr=1.0, alpha=0.1): grads = T.grad(cost=cost, wrt=params) updates = [] for p, g in zip(params, grads): v = shared(p.get_value() * 0.) v_new = v * (1.0 - alpha) - alpha * lr * g updates.append((v, v_new)) updates.append((p, p + v_new )) #+ T.sqrt(lr) / 6...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _second_moment(R, sig_l, sig_m, lum, mass, Mbh, beta, tensor,\n sigmaPsf, normPsf, step, nrad, surf_l, pixSize):\n if (max(sigmaPsf) > 0) and (pixSize > 0): # PSF convolution\n\n # Kernel step is 1/4 of largest value between sigma(min) and 1/2 pixel side.\n # Kernel half si...
[ "0.6452516", "0.639383", "0.61565405", "0.61291134", "0.5997735", "0.5973655", "0.59486485", "0.5931885", "0.5923693", "0.5873606", "0.58635145", "0.5858815", "0.5853918", "0.58078533", "0.58023876", "0.5798641", "0.57944995", "0.5794249", "0.5766101", "0.5740988", "0.5729833...
0.0
-1
SGD with gradient clipping
def sgdgc(cost, params, lr=1.0, max_magnitude=5.0, infDecay=0.1): grads = T.grad(cost=cost, wrt=params) updates = [] norm = norm_gs(params, grads) sqrtnorm = T.sqrt(norm) #not_finite = T.or_(T.isnan(sqrtnorm), T.isinf(sqrtnorm)) adj_norm_gs = T.switch(T.ge(sqrtnorm, max_magnitude), max_magnitud...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip_gradient(self, grad_clip):\n for group in self.optimizer.param_groups:\n for param in group['params']:\n if param.grad is not None:\n param.grad.data.clamp_(-grad_clip, grad_clip)", "def clip_gradient(optimizer, grad_clip):\r\n for group in optimize...
[ "0.68683976", "0.68539464", "0.68374103", "0.68374103", "0.68374103", "0.68374103", "0.68374103", "0.6730734", "0.6707196", "0.66225994", "0.6582015", "0.6550212", "0.6418198", "0.64175516", "0.6376763", "0.63707644", "0.6207059", "0.61892843", "0.6188527", "0.61860704", "0.6...
0.5754697
43
SGD with momentum and gradient clipping
def sgdmgc(cost, params, lr=1.0, alpha=0.1, max_magnitude=5.0, infDecay=0.1): grads = T.grad(cost=cost, wrt=params) updates = [] norm = norm_gs(params, grads) sqrtnorm = T.sqrt(norm) not_finite = T.or_(T.isnan(sqrtnorm), T.isinf(sqrtnorm)) adj_norm_gs = T.switch(T.ge(sqrtnorm, max_magnitude), m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sgd(cost, params, lr=1.0, alpha=0.1):\n grads = T.grad(cost=cost, wrt=params)\n updates = []\n for p, g in zip(params, grads):\n v = shared(p.get_value() * 0.)\n v_new = v * (1.0 - alpha) - alpha * lr * g\n updates.append((v, v_new))\n updates.append((p, p + v_new )) #+ T....
[ "0.6515423", "0.6467896", "0.6360838", "0.63439536", "0.6194156", "0.6018094", "0.59948224", "0.59542906", "0.59356433", "0.5926075", "0.5922897", "0.5922328", "0.5892434", "0.58728117", "0.58543175", "0.58291054", "0.5824617", "0.5823849", "0.581078", "0.57923365", "0.579233...
0.6483405
1
Scales all values in the ndarray ndar to be between 0 and 1
def scale_to_unit_interval(ndar, eps=1e-8): ndar = ndar.copy() ndar -= ndar.min() ndar *= 1.0 / (ndar.max() + eps) return ndar
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale01(arr):\r\n walk_arr_01 = numpy.interp(arr, (numpy.amin(arr), numpy.amax(arr)), (-1, +1)) # linear scaling\r\n return walk_arr_01 #return the scaled array\r", "def normalize(arr):\n arr = arr.astype('float')\n # Do not touch the alpha channel\n for i in range(1):\n minval ...
[ "0.70470804", "0.70212144", "0.6990821", "0.69275033", "0.68491334", "0.6827389", "0.6647145", "0.66360843", "0.6527475", "0.64946496", "0.64774555", "0.6464035", "0.6439701", "0.6419339", "0.64086926", "0.6405669", "0.637146", "0.6354517", "0.63362557", "0.6334365", "0.63079...
0.0
-1
split \in {'train', 'valid'}
def _init_dataset(self, data_config, split='train'): assert split in {'train', 'valid'} # load datasets print(f'Load {split} dataset') if data_config['type'] == 'npy': dataset = MSDMelDataset( data_config['mel_root'], data_config[f'{split}_tids_fn'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separate_train_valid(positives, validation_split):\n val_set = []\n shuffled_positives = shuffle_annotations(positives)\n upper = int(round(len(shuffled_positives)*validation_split))\n subset = shuffled_positives[0:upper]\n for each in subset:\n val_set.append(each)\n shuffled_pos...
[ "0.69135565", "0.68534917", "0.6759432", "0.6724169", "0.67077535", "0.66944796", "0.6665047", "0.6556334", "0.65530443", "0.65233886", "0.6499054", "0.64943826", "0.6471824", "0.64580566", "0.64397043", "0.6389182", "0.6363752", "0.6351248", "0.6340043", "0.6307576", "0.6287...
0.0
-1
Constructs a new ForwardModelConfig object. melt_time_assumption [string] Standard, Justin, Nicolas, Brodan surface_absorption_method [string] Standard, SurfaceRay %%% TODO ADD SURFACE ABSOPRTION OPTIONS
def __init__(self, melt_time_assumption='standard', surface_absorption_method='standard', show_code_settings=False, show_material_properties=False, show_general_figures=False, show_debugging_figures=False, show_console_output=False): self.melt_time_assumption = melt_time_assumpt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_from_pytorch_model(\n model,\n granularity='model',\n backend=None,\n default_precision='ap_fixed<16,6>',\n default_reuse_factor=1,\n inputs_channel_last=False,\n transpose_outputs=True,\n):\n\n config = {}\n\n model_config = {}\n model_config['Precision'] = default_precisi...
[ "0.55748653", "0.55468255", "0.5516905", "0.5361332", "0.53580886", "0.5343956", "0.53185076", "0.5280618", "0.5267336", "0.5253649", "0.5222042", "0.5199192", "0.5198464", "0.5180985", "0.51743776", "0.5171447", "0.5146382", "0.51347345", "0.51333064", "0.5097539", "0.509253...
0.5753696
0
Random extracting samples under path
def Sampling(self, path, number): allfiles = os.listdir(path) for image_name in allfiles: number_label = image_name.split('.')[0].split('_')[0] self.label_file_map[number_label].append(os.path.join(path, image_name)) # 将样本均匀随机抽样切割成训练集合和测试集合 training_set =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_image_paths(path:str, samples:int) -> List[str]:\r\n source_images = FileStorage.load_multiple_files_multiple_keys(path, retrieve_merged=['paths'])['paths']\r\n unique_source_images = set(source_images)\r\n\r\n sampled_paths = random.sample(unique_source_images, samples)\r\n return sampled_p...
[ "0.72021735", "0.6992499", "0.6805664", "0.64747924", "0.64245373", "0.6373913", "0.63287324", "0.6314277", "0.6270558", "0.62206864", "0.6195235", "0.6169775", "0.6165369", "0.61581534", "0.6140579", "0.61398494", "0.6136643", "0.6128076", "0.6112715", "0.61097294", "0.61097...
0.61758196
11
Takes date of form mm/dd/yyyy and writes it in form June 17, 2016
def problem3_3(month, day, year): month_list=("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") month_input=int(month)-1 print(month_list[month_input], str(day) + ",", year)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_operate_format(self, date):\n date = date.replace(\" \", \"\")\n date = date.split(',')\n day = date[1]\n month = date[2]\n\n day = self.check_and_repair_right_format(day)\n month = self.check_and_repair_right_format(month)\n\n right_format = date[0] + m...
[ "0.7165257", "0.71461666", "0.69551176", "0.6932253", "0.69055986", "0.680913", "0.6802828", "0.6769288", "0.66667736", "0.6615432", "0.66135955", "0.66036797", "0.65638196", "0.6548464", "0.65022683", "0.64938414", "0.649016", "0.6450672", "0.6447305", "0.6364563", "0.635923...
0.0
-1
Standard API response for simple cases of executing a filter against a single database table.
def std_response(db_table,db_cols,field_to_cols=None,return_json=True,return_format=None): # Object that converts filter strings into safe SQL statements sql_compiler = SQLCompiler() # GET request parameters filter_str = request.args.get("filter") fields_str = request.args.get("fields") sort_str = request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter():\n return get_filter_data(db, MyTable)", "def query_table(table_name, filter_key=None, filter_value=None):\n table = dynamodb.Table(table_name)\n\n if filter_key and filter_value:\n filtering_exp = Key(filter_key).eq(filter_value)\n response = table.query(KeyConditionExpression...
[ "0.732261", "0.6509101", "0.6052229", "0.6034702", "0.6020299", "0.59605074", "0.5865229", "0.5809882", "0.5787768", "0.5722642", "0.56721747", "0.56721747", "0.5626048", "0.56250787", "0.5586694", "0.5551065", "0.5524172", "0.5502016", "0.54922926", "0.54899347", "0.5487279"...
0.6217455
2
Calculate edit distance from a to b
def distances(a, b): # 1. Set up a list of lists matrix = [[None for i in range(len(b)+1)] for j in range(len(a)+1)] # 2. Add value for base cases (1st row/column) ## First position is always None matrix[0][0] = (0, None) ## 1st row and column for i in range(1, len(b) + 1): matrix[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_distance(self, other):\r\n union = len(self) + len(other)\r\n return 1.0 - 2.0*(self.intersection(other)/union)", "def edit_distance(self, other):\n union = len(self) + len(other)\n return 1.0 - 2.0*(self.intersection(other)/union)", "def _get_distance(a, b):\n retur...
[ "0.7997528", "0.7969463", "0.7270518", "0.72343045", "0.71553516", "0.71438146", "0.70831263", "0.70411885", "0.70343494", "0.69797957", "0.6959876", "0.69522536", "0.69479066", "0.68987805", "0.6896589", "0.68497497", "0.68414205", "0.6824409", "0.6816136", "0.6799586", "0.6...
0.0
-1
will search through the memcache plugins looking for the value
def get_underhanded(self,key): for plugin in self.server.plugins: if isinstance(plugin,MemcachedPlugin) and not plugin is self: v = plugin._get_data(key) if v: return v return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_get(self, metric_name):\n pass", "def __getitem__(self, key):\n if key in self.plugin:\n return self.plugin[key]\n else:\n log.warning(\"\"\"Plugin \"%s\" is not loaded.\"\"\" % key)\n return False", "def _cache_has(self, metric_name):\n p...
[ "0.5861849", "0.5824819", "0.582168", "0.56680787", "0.5588516", "0.55791724", "0.5575592", "0.5492284", "0.5480194", "0.5414675", "0.53459626", "0.5293929", "0.5278885", "0.5275149", "0.52654344", "0.5207049", "0.5197373", "0.5163468", "0.51460314", "0.51380885", "0.51380885...
0.6807539
0
Will set the value in all the memcache plugins
def set_underhanded(self,key,v): for plugin in self.server.plugins: if isinstance(plugin,MemcachedPlugin) and not plugin is self: plugin._set_data(key,v) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cache(self, val):\n pass", "def set(key, value):\n instance_cache.set(key, value, expiry=CacheLayers.INSTANCE_SECONDS)\n memcache.set(key, CacheLayers.compress(value))\n\n logging.info(\"Set BingoCache in instance cache and memcache\")", "def _cache_set(self, metric_name, me...
[ "0.72271734", "0.63500375", "0.6253346", "0.6222583", "0.61493415", "0.6139049", "0.6078674", "0.6062992", "0.6054272", "0.6045957", "0.6044916", "0.59507203", "0.5915748", "0.5901811", "0.583196", "0.58220387", "0.5818306", "0.58072776", "0.5781747", "0.5775088", "0.57301795...
0.7425552
0
Delete the value in al lthe memcache plugins
def delete_underhanded(self,key): for plugin in self.server.plugins: if isinstance(plugin,MemcachedPlugin) and not plugin is self: plugin._delete_data(key) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_plugin_data(self):", "def delete(self, cache_key):\r\n pass", "def decache(self):", "def _delete_plugin_data(self):\n try:\n self.delete_plugin_data()\n except Exception as err:\n logging.debug(str(err))", "def testDeletingUnknownKey(self):\n\n memca...
[ "0.7513134", "0.7339926", "0.68085206", "0.6630918", "0.6611989", "0.6529924", "0.6529922", "0.6477321", "0.647323", "0.6468222", "0.64322233", "0.64023226", "0.6391645", "0.63765115", "0.63270897", "0.6305412", "0.6296409", "0.6240359", "0.62381005", "0.6233016", "0.62304616...
0.7244249
2
incr hte value in all the memcache plugins
def incr_underhanded(self, key, value): for plugin in self.server.plugins: if isinstance(plugin,MemcachedPlugin) and not plugin is self: v = plugin._incr_data(key,value) if v is False: return False return v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _increment_counter(metric: str):\n if metric not in db:\n db[metric] = 0\n db[metric] += 1", "def increment_metric_counter(metric_name, redis_db):\n if TEST_MODE:\n print 'Simulate redis incremet, key is %s' % metric_name\n return\n if redis_db:\n try:\n red...
[ "0.6108457", "0.60304403", "0.5916617", "0.58441824", "0.57996726", "0.5761565", "0.5700244", "0.569412", "0.56885254", "0.56528026", "0.5644458", "0.5640885", "0.5638863", "0.5619427", "0.55992365", "0.5591836", "0.5558801", "0.5550321", "0.5547342", "0.55319196", "0.5492971...
0.7399691
0
A loaded model is accessible through the models attribute self.models['WelcomeModel'].get_users() self.models['WelcomeModel'].add_message() 'messages = self.models['WelcomeModel'].grab_messages()' 'user = self.models['WelcomeModel'].get_user()' 'to pass information on to a view it's the same as it was with Flask' 'retu...
def index(self): print "Starting Wall" print "Retrieving name" print session['user_id'] full_name = self.models['Wall_m'].full_name(session['user_id']) # Grab user'sname print full_name full_name = full_name[0]['full_name'] print full_name messages = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome():\n result = WelcomeModel()\n return WelcomeSchema().dump(result), 200", "def load_model(self):\n pass", "def user():\n user = UserModel()\n user.email = \"lemmy@imotorhead.com\"\n user.first_name = \"Ian\"\n user.last_name = \"Kilmister\"\n user.phone = \"800.333.7680\...
[ "0.5819913", "0.5800606", "0.57768744", "0.5657488", "0.5607867", "0.5570077", "0.5519755", "0.54735416", "0.5472467", "0.53654766", "0.5363623", "0.5337791", "0.5308452", "0.5305975", "0.5303038", "0.5247501", "0.5243935", "0.52371436", "0.52057004", "0.51946175", "0.5193104...
0.64910567
0
Displays profile image in list view
def display_image(obj): # Hard code 30x30 due to Django admin template list size. return format_html( '<img src=%s alt="Profile picture" width="30" height="30" />' % (obj.image.url if obj.image else static("images/users/default-profile.jpg")) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_thumb_tag(self):\n u = self.user\n uf = self.app.url_for\n image = None\n if u.image is not None and u.image!=\"\":\n try:\n image = uf(\"asset\", asset_id = self.app.module_map.uploader.get(u.image).variants['userlist']._id)\n except Asse...
[ "0.7129653", "0.6621689", "0.65483373", "0.64459544", "0.64231795", "0.6406237", "0.61998725", "0.6183474", "0.6164791", "0.6151082", "0.61323947", "0.61049163", "0.6097735", "0.60965633", "0.60905015", "0.608497", "0.60434407", "0.6034201", "0.5944758", "0.59322846", "0.5925...
0.7441247
0
Displays group image in list view
def display_image(obj): # Hard code 30x30 due to Django admin template list size. return format_html( '<img src=%s alt="Group image" width="30" height="30" />' % (obj.image.url if obj.image else static("images/groups/default-group_image.jpg")) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateImageGroups(self):\n self.img_grps = self.splitImages()\n grps = self.img_grps\n self.detail.clear()\n detail = \"Available Groups : \\n\"\n if len(grps) >= 1:\n for i in range(len(grps)):\n detail += \"Group \"+ str(i+1)+ \" : \" + str(grps[i]...
[ "0.67873013", "0.61053944", "0.5827434", "0.58180577", "0.58005536", "0.5799835", "0.5786416", "0.57812566", "0.5739298", "0.56683576", "0.56477755", "0.5643974", "0.5611059", "0.5608953", "0.5590662", "0.55623174", "0.5552397", "0.55360246", "0.5502761", "0.5491897", "0.5491...
0.74690145
0
Easy and effective tooling for FIX Repository data. FIX2dict greatly simplifies working with FIX Repository data by leveraging open and combatproven web technologies. The ultimate goal is to provide users with a consistent, authoritative and highquality FIX reference in an accessible way. JSON is the preferred choice o...
def cli(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # AVAILABLE for implementation:\n # 'go_terms', 'member_databases', 'integrated', 'entry_annotations', ''\n #\n # USED:\n # basics: 'accession', 'type', 'description', 'counters', 'entry_id', 'source_database', 'name'\n # hierarchy\n # wikipedia\n # literature\n # cross_ref...
[ "0.5573734", "0.5261161", "0.50817823", "0.49955085", "0.49725446", "0.4931813", "0.4892985", "0.48669615", "0.48416054", "0.48291576", "0.48167774", "0.4741671", "0.4736442", "0.472885", "0.4701774", "0.4701556", "0.46857506", "0.46840113", "0.4673911", "0.46658066", "0.4665...
0.0
-1
run all tests q quite s no capture x stop when fail
def test(opt="qsx"): if opt: opt = "-" + opt local("py.test %s tests/*.py" % opt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RunTestAll(ss):\n ss.StopNow = False\n ss.TestAll()\n ss.Stopped()", "def RunTest(self):\n self.TestLs()\n self.TestTerminate()\n self.TestMultipleProcesses()", "def run_tests():\n fail = []\n okay = []\n for i in os.listdir(\".\"):\n if i.find(\"_test_\") > -1...
[ "0.71276647", "0.69985914", "0.68125904", "0.6812119", "0.67473054", "0.6734189", "0.6723247", "0.67169005", "0.66936886", "0.66834325", "0.6665569", "0.6656021", "0.66536826", "0.65821266", "0.6548329", "0.6530439", "0.6529191", "0.65270305", "0.6521601", "0.64790636", "0.64...
0.0
-1
Gets some basic account information
def get_summary(self): mask = """mask[ nextInvoiceTotalAmount, pendingInvoice[invoiceTotalAmount], blockDeviceTemplateGroupCount, dedicatedHostCount, domainCount, hardwareCount, networkStorageCount, openTicketCount, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_info(self):\n url, params, headers = self.request(\"/account/info\", method='GET')\n\n return self.rest_client.GET(url, headers)", "def get_account_info(self):\n resource = self.domain + \"/account\"\n self.logger.debug(\"Pulling data from {0}\".format(resource))\n ...
[ "0.80207175", "0.8008394", "0.80013347", "0.79624224", "0.7557419", "0.7532861", "0.7392653", "0.7223382", "0.7127929", "0.70590883", "0.7051748", "0.70241547", "0.7010425", "0.6991622", "0.6866381", "0.6792606", "0.6779128", "0.66713566", "0.6668678", "0.66648436", "0.665179...
0.0
-1
Retrieves a list of Notification_Occurrence_Events that have not ended yet
def get_upcoming_events(self, event_type, date_min=None): mask = "mask[id, subject, startDate, endDate, modifyDate, statusCode, acknowledgedFlag, " \ "impactedResourceCount, updateCount, systemTicketId, notificationOccurrenceEventType[keyName]]" _filter = { 'notificationOccur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPendingEvents(self):\n return self.getCalendar().getPendingEvents(event_id=self.id)", "def get_events(self):\n disallowed = [ident(self.add_event.__func__), ident(ident)]\n self.frames = None\n\n return [item for item in self.events if item[2] not in disallowed]", "def get_ev...
[ "0.6612203", "0.6352995", "0.6148449", "0.6107195", "0.6076136", "0.6012787", "0.5948758", "0.5882056", "0.587746", "0.58487004", "0.58480126", "0.5793527", "0.5780062", "0.57241255", "0.57038504", "0.5695538", "0.56624943", "0.5651638", "0.5651638", "0.564017", "0.5635629", ...
0.5221111
66
Add data to the object filter.
def add_event_filter(_filter, event_type, date_min=None): if event_type == 'PLANNED': if date_min: _filter['endDate'] = { 'operation': 'greaterThanDate', 'options': [{ 'name': 'date', 'value': [d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_post_filter_object(self, data_obj):\n self._description = data_obj.description\n self._filter = data_obj.filter\n self._method = data_obj.method\n self._operator = data_obj.operator\n self._type = 'pfo'", "def add_filter(self, filter):\n self._filters.append(filt...
[ "0.76143926", "0.6937767", "0.6559075", "0.6471263", "0.6314838", "0.6308459", "0.6300623", "0.628457", "0.6275807", "0.623945", "0.62044275", "0.61825126", "0.61545336", "0.61251503", "0.611969", "0.6118763", "0.60693955", "0.6028608", "0.59464073", "0.5900423", "0.58807", ...
0.0
-1
Acknowledge an event. This mostly prevents it from appearing as a notification in the control portal.
def ack_event(self, event_id): return self.client.call('Notification_Occurrence_Event', 'acknowledgeNotification', id=event_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def acknowledge(self, *event_messages, bus_client: \"BusClient\"):\n pass", "async def ack_event(self, envelope: Envelope, multiple: bool = False) -> None:\n await self.channel.basic_client_ack(\n delivery_tag=envelope.delivery_tag, multiple=multiple\n )", "def consume_ack...
[ "0.71408135", "0.6650102", "0.6531436", "0.6373774", "0.6107316", "0.59808743", "0.5902426", "0.5897589", "0.587971", "0.5873229", "0.5840613", "0.5838206", "0.58347017", "0.5802624", "0.5793075", "0.57760483", "0.57705283", "0.57547593", "0.5724207", "0.5721719", "0.5696814"...
0.75321144
0
Gets details about a maintenance event
def get_event(self, event_id): mask = """mask[ acknowledgedFlag, attachments, impactedResources, statusCode, updates, notificationOccurrenceEventType] """ return self.client.call('Notification_Occurrence_Event', 'getObject',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eventdetails(http_request, event_id=0):\n\te = get_object_or_404(Event, pk=event_id)\n\tweather = list(Weather.objects.filter(day=e.edate).filter(zip=e.zip))\n\tif len(weather) == 0:\n\t\tw = None\n\telse:\n\t\tw = weather[0]\n\treturn render_to_response('event_detail.html', {'event': e,\n\t\t\t\t\t\t\t'w': w ...
[ "0.61838895", "0.59086704", "0.58912134", "0.58602536", "0.5846109", "0.57574683", "0.56941026", "0.56917405", "0.56489086", "0.56416297", "0.5593745", "0.55396134", "0.5526715", "0.5494374", "0.5463855", "0.5429879", "0.5417089", "0.53201723", "0.5306297", "0.52828634", "0.5...
0.5373435
17
Gets an accounts invoices.
def get_invoices(self, limit=50, closed=False, get_all=False): mask = "mask[invoiceTotalAmount, itemCount]" _filter = { 'invoices': { 'createDate': { 'operation': 'orderBy', 'options': [{ 'name': 'sort', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoices(self):\r\n return inv.AccountInvoices(self)", "def invoices(self,org_id=None,invoice_id=''):\n if org_id is None:\n org_id = self.org_id\n return self.get('{}/orgs/{}/invoices/{}'.format(ApiVersion.A1.value,org_id,invoice_id))", "def invoices(self):\r\n return inv.Invoices...
[ "0.8471047", "0.82079166", "0.79237074", "0.75614506", "0.75114036", "0.74581236", "0.73180515", "0.71502334", "0.71378696", "0.69037163", "0.68805707", "0.6656995", "0.6637709", "0.6584674", "0.6475813", "0.636837", "0.6321946", "0.63218963", "0.6173312", "0.6051595", "0.601...
0.7560708
4
Gets all topLevelBillingItems from a specific invoice
def get_billing_items(self, identifier): mask = """mask[ id, description, hostName, domainName, oneTimeAfterTaxAmount, recurringAfterTaxAmount, createDate, categoryCode, category[name], location[name], children[id, category[name], description, oneTime...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_invoices(self, limit=50, closed=False, get_all=False):\n mask = \"mask[invoiceTotalAmount, itemCount]\"\n _filter = {\n 'invoices': {\n 'createDate': {\n 'operation': 'orderBy',\n 'options': [{\n 'name': 's...
[ "0.6152694", "0.5945346", "0.5934046", "0.5782881", "0.5729265", "0.56248087", "0.55893815", "0.5585731", "0.55699754", "0.55301505", "0.54623544", "0.5224209", "0.51400495", "0.5106192", "0.50598925", "0.5006302", "0.4988618", "0.49616304", "0.49364957", "0.49304697", "0.490...
0.76552004
0
Gets all the topLevelBillingItems currently active on the account
def get_account_billing_items(self, create=None, category=None, mask=None): if mask is None: mask = """mask[ orderItem[id,order[id,userRecord[id,email,displayName,userStatus]]], nextInvoiceTotalRecurringAmount, location, hourlyFlag ]""" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_billing_items(self, identifier):\n\n mask = \"\"\"mask[\n id, description, hostName, domainName, oneTimeAfterTaxAmount, recurringAfterTaxAmount, createDate,\n categoryCode,\n category[name],\n location[name],\n children[id, category[name], descr...
[ "0.6923196", "0.59697765", "0.575805", "0.55222267", "0.54914856", "0.54847604", "0.5479203", "0.5464327", "0.5416195", "0.5392103", "0.5338329", "0.5332863", "0.5317097", "0.5314769", "0.530184", "0.52650356", "0.52415794", "0.5230439", "0.52152693", "0.52067727", "0.5179667...
0.6207125
1
Gets details about a billing item
def get_billing_item(self, identifier, mask=None): if mask is None: mask = self._DEFAULT_BILLING_ITEM_MASK return self.client.call('Billing_Item', 'getObject', id=identifier, mask=mask)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_detail(self, identifier):\n\n try:\n return self.get_billing_item(identifier)\n except SoftLayerAPIError as exception:\n if exception.faultCode == 404:\n return self.get_billing_item_from_invoice(identifier)\n raise", "def billing_info(se...
[ "0.73750615", "0.71415", "0.7107744", "0.6803434", "0.6749558", "0.659843", "0.643434", "0.63999027", "0.6279766", "0.6278677", "0.62494195", "0.6229148", "0.607944", "0.6023624", "0.59558743", "0.58664674", "0.5841172", "0.5824495", "0.5813543", "0.5807874", "0.5747145", "...
0.659465
6
Gets details about a billing item of a billing invoice item
def get_billing_item_from_invoice(self, identifier, mask=None): if mask is None: mask = self._DEFAULT_BILLING_ITEM_MASK return self.client.call('Billing_Invoice_Item', 'getBillingItem', id=identifier, mask=mask)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_detail(self, identifier):\n\n try:\n return self.get_billing_item(identifier)\n except SoftLayerAPIError as exception:\n if exception.faultCode == 404:\n return self.get_billing_item_from_invoice(identifier)\n raise", "def billing_info(se...
[ "0.747619", "0.6612933", "0.65272003", "0.6444234", "0.6372723", "0.63039535", "0.62579304", "0.61760277", "0.6146966", "0.61223006", "0.6106007", "0.60972404", "0.6024911", "0.5936995", "0.591735", "0.58626056", "0.584625", "0.5836164", "0.57351714", "0.5716773", "0.564585",...
0.6754242
1
Gets details about a billing item
def get_item_detail(self, identifier): try: return self.get_billing_item(identifier) except SoftLayerAPIError as exception: if exception.faultCode == 404: return self.get_billing_item_from_invoice(identifier) raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def billing_info(self):\r\n return BillingInfo(self)", "def billing_info(self):\n return self._billing_info", "def get_item_detail(item_id):\n pass", "def test_get_item_details(self, mock_requests_get):\n details = resources.get_item_details(21787)\n\n item = details.item\n ...
[ "0.71415", "0.7107744", "0.6803434", "0.6749558", "0.659843", "0.659465", "0.643434", "0.63999027", "0.6279766", "0.6278677", "0.62494195", "0.6229148", "0.607944", "0.6023624", "0.59558743", "0.58664674", "0.5841172", "0.5824495", "0.5813543", "0.5807874", "0.5747145", "0....
0.73750615
0
Cancels a specific billing item with a reason
def cancel_item(self, identifier, reason="No longer needed", note=None): if note is None: user = self.client.call('Account', 'getCurrentUser', mask="mask[id,displayName,email,username]") note = f"Cancelled by {user.get('username')} with the SLCLI" return self.client.call('Billi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_iscsi(self, volume_id, reason='unNeeded', immediate=False):\r\n iscsi = self.get_iscsi(\r\n volume_id,\r\n mask='mask[id,capacityGb,username,password,billingItem[id]]')\r\n billingitemid = iscsi['billingItem']['id']\r\n self.client['Billing_Item'].cancelItem(\r...
[ "0.64898145", "0.6267665", "0.62393314", "0.613966", "0.60649246", "0.60628843", "0.605218", "0.6040305", "0.60325646", "0.60303295", "0.6017538", "0.5957014", "0.59519744", "0.5944692", "0.5911409", "0.5907279", "0.589325", "0.58856344", "0.5848772", "0.5805888", "0.5784104"...
0.7135717
0
Gets all the topLevelBillingItems currently active on the account
def get_account_all_billing_orders(self, limit=100, mask=None): if mask is None: mask = """ orderTotalAmount, userRecord, initialInvoice[id,amount,invoiceTotalAmount], items[description] """ return self.client.call('Billin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_billing_items(self, identifier):\n\n mask = \"\"\"mask[\n id, description, hostName, domainName, oneTimeAfterTaxAmount, recurringAfterTaxAmount, createDate,\n categoryCode,\n category[name],\n location[name],\n children[id, category[name], descr...
[ "0.6923196", "0.6207125", "0.59697765", "0.575805", "0.55222267", "0.54914856", "0.54847604", "0.5479203", "0.5464327", "0.5416195", "0.5392103", "0.5338329", "0.5332863", "0.5317097", "0.530184", "0.52650356", "0.52415794", "0.5230439", "0.52152693", "0.52067727", "0.5179667...
0.5314769
14
Gets all the routers currently active on the account
def get_routers(self, location=None, mask=None): if mask is None: mask = """ topLevelLocation """ object_filter = '' if location: object_filter = { 'routers': { 'topLevelLocation': {'name': {'operation':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_routers(self):\n import network\n sta_if = network.WLAN(network.STA_IF)\n sta_if.active(True)\n all_routers = sta_if.scan()\n\n routers = []\n for router_tuple in all_routers:\n router = Router(router_tuple[0], router_tuple[1], router_tuple[3])\n ...
[ "0.71724653", "0.66651136", "0.66018796", "0.6383157", "0.63802356", "0.6306341", "0.6053401", "0.60463196", "0.60176224", "0.5900979", "0.5807975", "0.5797161", "0.5747796", "0.57002175", "0.5684695", "0.56148434", "0.55869275", "0.5583468", "0.5561942", "0.55468595", "0.554...
0.6251158
6
Gets all Network Message delivery accounts.
def get_network_message_delivery_accounts(self): _mask = """vendor,type""" return self.client['SoftLayer_Account'].getNetworkMessageDeliveryAccounts(mask=_mask)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_accounts(self, **kwargs):\r\n if 'mask' not in kwargs:\r\n items = [\r\n 'id',\r\n 'name',\r\n 'status',\r\n 'nodes',\r\n ]\r\n kwargs['mask'] = \"mask[%s]\" % ','.join(items)\r\n\r\n return self.cli...
[ "0.6393254", "0.6058889", "0.5955604", "0.59420675", "0.5911932", "0.5811731", "0.5708601", "0.5696645", "0.5667549", "0.56392014", "0.5572698", "0.55056137", "0.5470599", "0.5457768", "0.5435201", "0.5434758", "0.54334044", "0.54284346", "0.54216", "0.53893256", "0.53873765"...
0.7625109
0
Gets all active virtual licenses account.
def get_active_virtual_licenses(self): _mask = """billingItem[categoryCode,createDate,description], key,id,ipAddress, softwareDescription[longDescription,name,manufacturer], subnet""" return self.client['SoftLayer_Account'].getActiveVirtualLi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_active_account_licenses(self):\n\n _mask = \"\"\"billingItem,softwareDescription\"\"\"\n\n return self.client['SoftLayer_Account'].getActiveAccountLicenses(mask=_mask)", "def getLicenseList(self):\n\n res = self.getRequest('licenses')\n licenses = list()\n if res:\n ...
[ "0.70768636", "0.7066329", "0.67577124", "0.6587934", "0.6521783", "0.6378101", "0.62645566", "0.6172615", "0.6158004", "0.61289406", "0.61268145", "0.60705614", "0.59099764", "0.5833182", "0.575935", "0.57415587", "0.5683667", "0.56785446", "0.5653936", "0.55529094", "0.5528...
0.7763799
0
Gets all active account licenses.
def get_active_account_licenses(self): _mask = """billingItem,softwareDescription""" return self.client['SoftLayer_Account'].getActiveAccountLicenses(mask=_mask)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLicenseList(self):\n\n res = self.getRequest('licenses')\n licenses = list()\n if res:\n for item in iter(res['items']):\n lic = vsdModels.License(**item)\n licenses.append(lic)\n\n return licenses", "def licenses(self) -> Sequence[str]:...
[ "0.7861078", "0.71985483", "0.69386154", "0.6938354", "0.683766", "0.68374085", "0.67376196", "0.6720445", "0.6710225", "0.66815954", "0.6480126", "0.6431303", "0.6139715", "0.6136153", "0.6113095", "0.5931691", "0.5891424", "0.58749723", "0.57937604", "0.5751224", "0.5697592...
0.77403265
1
Gets all the bandwidth pools on an account
def get_bandwidth_pools(self, mask=None): if mask is None: mask = """mask[totalBandwidthAllocated,locationGroup, id, name, projectedPublicBandwidthUsage, billingCyclePublicBandwidthUsage[amountOut,amountIn], billingItem[id,nextInvoiceTotalRecurringAmount]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPools(self):\n data = self.connect('get','pools',None)\n return data", "async def get_pools(self) -> List[CachingPool]:\n return await self._pool_fetcher.get_pools()", "def _get_pools(self, settings):\n available_pools = []\n pool_names = []\n connections_settin...
[ "0.67564046", "0.62494147", "0.61360097", "0.60639644", "0.6058265", "0.59158266", "0.5863608", "0.5797169", "0.57879007", "0.57614666", "0.5639632", "0.5638623", "0.560408", "0.5593524", "0.55859154", "0.55794644", "0.55160934", "0.55071217", "0.5502424", "0.54691947", "0.54...
0.7169589
0
Gets a count of all servers in a bandwidth pool Getting the server counts individually is significantly faster than pulling them in with the get_bandwidth_pools api call.
def get_bandwidth_pool_counts(self, identifier): mask = "mask[id, bareMetalInstanceCount, hardwareCount, virtualGuestCount]" counts = self.client.call('SoftLayer_Network_Bandwidth_Version1_Allotment', 'getObject', id=identifier, mask=mask) total = counts.get('ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\r\n return sum(pool.size() for pool in self.host_to_pool.values())", "def GetCount(self):\n return self._server.get_count()", "def pool_size(self):\n if self.options.pool_size == 0:\n return 2 * len(self._server_list)\n return self.options.pool_size", "d...
[ "0.6395078", "0.639499", "0.62641287", "0.5990051", "0.5832889", "0.57936007", "0.57703495", "0.57055616", "0.5694063", "0.56690514", "0.5653518", "0.55464286", "0.55361897", "0.55235845", "0.5510581", "0.55027544", "0.54552627", "0.5423698", "0.54092693", "0.54071426", "0.54...
0.70085955
0
Gets bandwidth pool detail.
def getBandwidthDetail(self, identifier): _mask = """activeDetails[allocation],projectedPublicBandwidthUsage, billingCyclePublicBandwidthUsage, hardware[outboundBandwidthUsage,bandwidthAllotmentDetail[allocation]],inboundPublicBandwidthUsage, virtualGuests[outboundPublicBandwidthUsage,bandwidthA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bandwidth(self):\r\n return self._bandwidth", "def show_pool(self, pool, **_params):\r\n return self.get(self.pool_path % (pool), params=_params)", "def retrieve_pool_stats(self, pool, **_params):\r\n return self.get(self.pool_path_stats % (pool), params=_params)", "def pool(self):\n...
[ "0.6619829", "0.64612865", "0.63209736", "0.62663203", "0.61032623", "0.59774375", "0.59591454", "0.5951671", "0.5920715", "0.58287334", "0.57569903", "0.57501507", "0.57359993", "0.56756264", "0.5624712", "0.56225085", "0.56003064", "0.5583351", "0.55751437", "0.5569709", "0...
0.6263089
4
Gets a provisioning hooks.
def get_provisioning_scripts(self): return self.client.call('Account', 'getPostProvisioningHooks')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHooks(self):\n return self.__hooks", "def get_hooks(name):\n register_all_hooks()\n return _hooks.get(name, [])", "def hooks(self):\n return tuple(self.__hooks.keys())", "def get_hooks(self, hook: str) -> List[Callable]:\n return [getattr(self, name) for name in self.__plugi...
[ "0.7128997", "0.6813157", "0.68028045", "0.6693627", "0.6646672", "0.6605815", "0.6558671", "0.64401966", "0.62955916", "0.62785494", "0.6213821", "0.6204111", "0.61900604", "0.61900604", "0.61534446", "0.6140655", "0.6011057", "0.600348", "0.59504527", "0.5949015", "0.582567...
0.7333691
0
create a provisioning script
def create_provisioning(self, name, uri): template = { 'name': name, 'uri': uri } return self.client.call('SoftLayer_Provisioning_Hook', 'createObject', template)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provision(args):\n cfg_file = os.path.join(xbow.XBOW_CONFIGDIR, \"settings.yml\")\n\n with open(cfg_file, 'r') as ymlfile:\n cfg = yaml.safe_load(ymlfile)\n\n scheduler = get_by_name(cfg['scheduler_name'])\n if len(scheduler) == 0:\n raise ValueError('Error - cannot find the scheduler...
[ "0.6270925", "0.62628365", "0.6210748", "0.60938823", "0.60914814", "0.60434055", "0.5948755", "0.58737415", "0.581449", "0.5785006", "0.57703835", "0.57675827", "0.5702017", "0.5656934", "0.56526375", "0.5622418", "0.5620081", "0.559805", "0.55633897", "0.55407995", "0.55051...
0.5748057
12
Delete a provisioning script
def delete_provisioning(self, identifier): return self.client.call("SoftLayer_Provisioning_Hook", "deleteObject", id=identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_script(script_id):\n return _u2i(_pigpio_command(_control, _PI_CMD_PROCD, script_id, 0))", "def script_delete(ctx: click.Context, name):\n subcommand_script.cmd_delete(ctx.obj, name)", "def remove_kill_script():\n try:\n os.unlink('kill_script.sh')\n except:\n pass", "def ...
[ "0.7502023", "0.712325", "0.65269476", "0.6308377", "0.6279139", "0.626822", "0.6226785", "0.61090696", "0.60919625", "0.6076574", "0.6069449", "0.6055844", "0.60202146", "0.6009752", "0.5948171", "0.5908273", "0.5901136", "0.5884167", "0.58835006", "0.5876543", "0.58748245",...
0.6942916
2
Gets upgrade order list
def get_account_upgrade_orders(self, limit=100): return self.client.call('SoftLayer_Account', 'getUpgradeRequests', limit=limit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOrderList(self):\r\n\t\treturn self.pair.orders", "def getOrderList(self):\r\n\t\treturn self.orders", "def getUpgrades(self) -> list:\n return self.state[UPGRADES]", "def getAllUpgrades(self):\n\t\tquery = ''\n\t\tconn = self.get_connection()\n\t\theaders = { 'Content-type' : 'application/json...
[ "0.7227147", "0.7178749", "0.7124902", "0.68941104", "0.68813604", "0.63994086", "0.6397755", "0.6142154", "0.6139809", "0.61378115", "0.6137696", "0.6134462", "0.6108723", "0.61074084", "0.6073315", "0.60656554", "0.5947382", "0.59394896", "0.59322613", "0.58988005", "0.5855...
0.70919317
3
Generate a list of dictionaries with different parameter settings
def generate_parameters_2_variations(x: dict): keys = tuple(x.keys()) prods = product(*[v for _, v in x.items()]) return [{keys[i]: p[i] for i in [0, 1]} for p in prods]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_params1(parameter):\n\n p = parameter['p']\n q = parameter['q']\n d = parameter['d']\n m = parameter['m']\n pdq_m = list(itertools.product(p, d, q,m)) #Generate all different combinations of p, q and q triplets\n params = [[(x[0], x[1], x[2]),(x[0], x[1], x[2], x[3])] for x in pdq...
[ "0.68837404", "0.683432", "0.6778036", "0.6775572", "0.674715", "0.671072", "0.66690063", "0.65731657", "0.65680873", "0.6531442", "0.64944524", "0.64641833", "0.64613765", "0.6415097", "0.6415097", "0.6409976", "0.6391314", "0.63855726", "0.63790363", "0.6376419", "0.6373866...
0.58344686
97
Shortcut to get cache_manager addon preferences
def addon_prefs_get(context: bpy.types.Context) -> bpy.types.AddonPreferences: return context.preferences.addons["anim_setup"].preferences
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPreferences():\n prefs = bpy.context.preferences.addons[NAME].preferences\n return prefs", "def preference():\n preference = bpy.context.preferences.addons[name].preferences\n return preference", "def cm(cache=[]):\n if not cache:\n cache.append(ConfigurationManager())\n return ...
[ "0.6643568", "0.6164972", "0.6081864", "0.58676964", "0.5818826", "0.57918006", "0.5773904", "0.57635087", "0.5757454", "0.57280153", "0.57192975", "0.57166415", "0.5701409", "0.5689562", "0.56641775", "0.56282645", "0.56282645", "0.5623923", "0.55973434", "0.55694", "0.55190...
0.66311264
1
state1 Original state of the system action1 Action taken by the agent at state1 reward2 Reward obtained for taking action1 at state1 state2 State reached by taking action1 at state1
def observe_step(self, state1, action1, reward2, state2, terminal=False): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observe_step(self, state1, action1, reward2, state2, terminal=False):\n alpha = self.learning_rate\n gamma = self.discount_factor\n lam = self.trace_factor\n sigma = self.sigma\n if self.prev_sars is not None:\n state0, action0, reward1, _ = self.prev_sars\n\n ...
[ "0.7599031", "0.7082144", "0.70422566", "0.70221967", "0.70176077", "0.6952827", "0.69272584", "0.69113785", "0.68983155", "0.6867355", "0.6822913", "0.6810868", "0.67721754", "0.6743803", "0.6739418", "0.6727495", "0.6724892", "0.67237836", "0.66985273", "0.666029", "0.66436...
0.69982845
5