query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Plots the free energy change computed using the equilibrated snapshots between the proper target time frames (f_ts and r_ts) in both forward (data points are stored in F_df and F_ddf) and reverse (data points are stored in R_df and R_ddf) directions. | def plotdFvsTime(f_ts, r_ts, F_df, R_df, F_ddf, R_ddf):
fig = pl.figure(figsize=(8,6))
ax = fig.add_subplot(111)
pl.setp(ax.spines['bottom'], color='#D2B9D3', lw=3, zorder=-2)
pl.setp(ax.spines['left'], color='#D2B9D3', lw=3, zorder=-2)
for dire in ['top', 'right']:
ax.spines[dire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_vis():\n dataroot = 'solar_data.txt'\n debug = False \n diff = False\n X, y = read_data(dataroot, debug, diff)\n\n # First plot the original timeseries\n fig = plt.figure(figsize=(40,40))\n\n fig.add_subplot(3,3,1)\n plt.plot(y)\n plt.title('Avg Global PSP (vent/cor) [W/m^2]')... | [
"0.6313317",
"0.6141398",
"0.6133596",
"0.61213934",
"0.58762604",
"0.5865189",
"0.5831045",
"0.5801431",
"0.57747483",
"0.5743009",
"0.57139415",
"0.56994927",
"0.56850445",
"0.5679581",
"0.5657056",
"0.5632359",
"0.56177044",
"0.5578176",
"0.5577838",
"0.55500615",
"0.55456... | 0.65924156 | 0 |
Plots the free energy differences evaluated for each pair of adjacent states for all methods. The layout is approximately 'nb' bars per subplot. | def plotdFvsLambda2(nb=10):
x = numpy.arange(len(df_allk))
if len(x) < nb:
return
xs = numpy.array_split(x, len(x)/nb+1)
mnb = max([len(i) for i in xs])
fig = pl.figure(figsize = (8,6))
width = 1./(len(P.methods)+1)
elw = 30*width
colors = {'TI':'#C45AEC', 'TI-CU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results_plot_fuel_reactor(self):\n \n import matplotlib.pyplot as plt \n\n # Total pressure profile\n P = []\n for z in self.MB_fuel.z:\n P.append(value(self.MB_fuel.P[z]))\n fig_P = plt.figure(1)\n plt.plot(self.MB_fuel.z, P)\n plt.grid()\n plt.xlabel(\"Bed height [-]\")\n... | [
"0.6250733",
"0.6131744",
"0.61037934",
"0.6092076",
"0.60732573",
"0.59801644",
"0.59770113",
"0.5963969",
"0.59115875",
"0.58646387",
"0.5833313",
"0.58220226",
"0.5787901",
"0.57865995",
"0.5741407",
"0.5739193",
"0.57294893",
"0.57286334",
"0.5718547",
"0.57135636",
"0.56... | 0.62457854 | 1 |
Plots the ave_dhdl array as a function of the lambda value. If (TI and TICUBIC in methods) plots the TI integration area and the TICUBIC interpolation curve, elif (only one of them in methods) plots the integration area of the method. | def plotTI():
min_dl = dlam[dlam != 0].min()
S = int(0.4/min_dl)
fig = pl.figure(figsize = (8,6))
ax = fig.add_subplot(1,1,1)
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none')
ax.xaxis.set_ticks_position('bott... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotdFvsLambda1():\n x = numpy.arange(len(df_allk))\n if x[-1]<8:\n fig = pl.figure(figsize = (8,6))\n else:\n fig = pl.figure(figsize = (len(x),6))\n width = 1./(len(P.methods)+1)\n elw = 30*width\n colors = {'TI':'#C45AEC', 'TI-CUBIC':'#33CC33', 'DEXP':'#F87431',... | [
"0.5631575",
"0.56224716",
"0.55810195",
"0.5569204",
"0.544854",
"0.54324406",
"0.5401097",
"0.5397317",
"0.53738916",
"0.53561234",
"0.5292456",
"0.52792794",
"0.52540356",
"0.52267444",
"0.5214065",
"0.52021885",
"0.5194347",
"0.5180309",
"0.5170628",
"0.51551074",
"0.5147... | 0.5738737 | 0 |
Searches for winning sequence in columns. | def check_columns(self, win: list) -> bool:
for row in range(self.size):
column = [self.tags[x][row] for x in range(self.size)]
for j in range(len(column) - len(win) + 1):
if win == column[j:j+self.win_condition]:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def col_win(board, player):\n for row in board.T:\n if check_row(row, player):\n return True\n return False",
"def check_columns():\n global game_still_going\n # Check if any of the rows have all the same value.\n column1 = board[0] == board[3] == board[6] != '_'\n column2 = b... | [
"0.6576831",
"0.6555307",
"0.64840585",
"0.6481743",
"0.6447641",
"0.63892657",
"0.6347227",
"0.63392514",
"0.629483",
"0.62593347",
"0.6223977",
"0.6137701",
"0.60959685",
"0.6069051",
"0.60535437",
"0.6050567",
"0.60471857",
"0.603175",
"0.59898293",
"0.5885481",
"0.5832774... | 0.6735366 | 0 |
Check for winning sequence in all possible diagonals that are at least as long as winning condition. | def check_diagonals(self, win: list) -> bool:
for i in range(self.size - self.win_condition + 1):
# [x x ]
# [ x x ]
# [ x x]
# [ x]
diagonal = []
x = i
y = 0
for j in range(self.size - i):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_winning(self, curr_state):\n rows = [[0,1,2], [3,4,5], [6,7,8]]\n columns = [[0,3,6], [1,4,7], [2,5,8]]\n diagonal = [[0,4,8], [2,4,6]]\n total_checks = rows + columns + diagonal\n for row in total_checks:\n sum = 0\n count = 0\n for pos in... | [
"0.69447654",
"0.68922657",
"0.6877511",
"0.6859907",
"0.6785897",
"0.6660476",
"0.66416174",
"0.66363674",
"0.6619749",
"0.6578498",
"0.65732425",
"0.65712273",
"0.653169",
"0.6508",
"0.6497785",
"0.64893246",
"0.64755654",
"0.6452486",
"0.6433075",
"0.64247596",
"0.64144456... | 0.73726594 | 0 |
Checks if the board is fully packed with figures, which in practice means => if the tags array is full. | def full_board(self) -> bool:
counter = 0
for column in self.tags:
if None in column:
counter += 1
return counter == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _board_is_full(self):\n return (self.get_counts()[0] + self.get_counts()[1] == self._num_rows * self._num_cols)",
"def is_full(board):\r\n return False",
"def is_full(board):\n return False",
"def check_grid_full(self):\n for row in self.game_state:\n for e in row:\n ... | [
"0.6820874",
"0.676673",
"0.6736874",
"0.6717051",
"0.6591668",
"0.65669096",
"0.6556075",
"0.6527779",
"0.6506026",
"0.6469064",
"0.64647114",
"0.6442245",
"0.6417079",
"0.6390676",
"0.63876194",
"0.637983",
"0.6371609",
"0.6350671",
"0.6347817",
"0.6293271",
"0.62686855",
... | 0.74219203 | 0 |
Checks for empty spaces in the tags list. If the empty space is found it's coordinates are being packed into tuple and into new list. | def check_for_moves(self) -> list:
avail_moves = []
for x in range(self.size):
for y in range(self.size):
if self.tags[x][y] is None:
avail_moves.append((x, y))
return avail_moves | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _preprocess(self, tagged: List[Tuple]) -> Tuple:\n ori = \" \".join([tag[0] for tag in tagged])\n tags = [tag[1] for tag in tagged]\n # Mapping into general tagset\n tags = [self._map[tag] if tag in self._map else \"X\" for tag in tags]\n return \" \".join(tags), ori",
"def... | [
"0.56815004",
"0.5611002",
"0.54052174",
"0.5345678",
"0.53289914",
"0.5290784",
"0.5282728",
"0.52795637",
"0.52427185",
"0.5172312",
"0.5162299",
"0.5155179",
"0.5121523",
"0.5118857",
"0.5089582",
"0.50675386",
"0.5064925",
"0.506162",
"0.50472486",
"0.50319785",
"0.500313... | 0.56864506 | 0 |
Function mashes together classes functionality and performs the AI's move. It recursively calls the minimax algorithm and after finding the best move it adds tag into the tags list. | def bot_handle_move(self) -> None:
best_value = -INFINITY # default best value for maximizing player (bot in this app is a maximizing player)
available_moves = self.check_for_moves() # for more info check the minimax algorithm theory
depth = int(1.4*self.size - self.win_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_move(self):\n\n # get relavent information\n affinity = self.get_affinity()\n sample_space = self.get_game_space()\n depth_limit = self.__search_depth\n\n # run a minimax search and get the best value\n bestval = MinimaxTree.alphabeta(self, sample_space, affinity,... | [
"0.55172825",
"0.53830636",
"0.537255",
"0.53636533",
"0.53437847",
"0.53437847",
"0.52932066",
"0.5251569",
"0.5240633",
"0.5203933",
"0.51793545",
"0.5154717",
"0.50856817",
"0.5070792",
"0.50352716",
"0.50260264",
"0.4998866",
"0.49944788",
"0.4988436",
"0.4984612",
"0.497... | 0.62191063 | 0 |
Workqueue element site restriction check (same as workRestrictions) | def testPassesSiteRestriction(self):
# test element ala MonteCarlo
ele = WorkQueueElement(SiteWhitelist=["T1_IT_CNAF", "T2_DE_DESY"], SiteBlacklist=["T1_US_FNAL"])
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPassesSiteRestrictionLocationFlags(self):\n # test element ala MonteCarlo\n ele = WorkQueueElement(SiteWhitelist=[\"T1_IT_CNAF\", \"T2_DE_DESY\"], SiteBlacklist=[\"T1_US_FNAL\"])\n self.assertFalse(ele.passesSiteRestriction(\"T1_US_FNAL\"))\n self.assertFalse(ele.passesSiteRestr... | [
"0.6806962",
"0.5811562",
"0.5728457",
"0.53757226",
"0.5239149",
"0.52173674",
"0.5165484",
"0.51420397",
"0.51234454",
"0.5076183",
"0.5031014",
"0.50261384",
"0.5019831",
"0.5010309",
"0.50060636",
"0.49717343",
"0.4966067",
"0.49175805",
"0.49115157",
"0.49010026",
"0.489... | 0.7161033 | 0 |
Workqueue element site restriction check (same as workRestrictions) | def testPassesSiteRestrictionLocationFlags(self):
# test element ala MonteCarlo
ele = WorkQueueElement(SiteWhitelist=["T1_IT_CNAF", "T2_DE_DESY"], SiteBlacklist=["T1_US_FNAL"])
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPassesSiteRestriction(self):\n # test element ala MonteCarlo\n ele = WorkQueueElement(SiteWhitelist=[\"T1_IT_CNAF\", \"T2_DE_DESY\"], SiteBlacklist=[\"T1_US_FNAL\"])\n self.assertFalse(ele.passesSiteRestriction(\"T1_US_FNAL\"))\n self.assertFalse(ele.passesSiteRestriction(\"T2_C... | [
"0.71603197",
"0.58114254",
"0.5727928",
"0.53752995",
"0.5239392",
"0.5217931",
"0.5166661",
"0.5141289",
"0.51245993",
"0.50754255",
"0.5030956",
"0.50263387",
"0.5020246",
"0.50115657",
"0.5005242",
"0.49711114",
"0.49657822",
"0.49160054",
"0.49109706",
"0.4902486",
"0.48... | 0.68061155 | 1 |
Workqueue element data location check, using the input and PU data location flags | def testPossibleSitesLocationFlags(self):
ele = WorkQueueElement(SiteWhitelist=["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset and no location, but input flag on
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": []}
ele['NoInputUpdate'] = True
self.assertItemsEqual(poss... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPassesSiteRestrictionLocationFlags(self):\n # test element ala MonteCarlo\n ele = WorkQueueElement(SiteWhitelist=[\"T1_IT_CNAF\", \"T2_DE_DESY\"], SiteBlacklist=[\"T1_US_FNAL\"])\n self.assertFalse(ele.passesSiteRestriction(\"T1_US_FNAL\"))\n self.assertFalse(ele.passesSiteRestr... | [
"0.5973574",
"0.5559499",
"0.5359043",
"0.53462744",
"0.5329235",
"0.5259342",
"0.5239512",
"0.5232094",
"0.50799614",
"0.50530607",
"0.50330347",
"0.5014102",
"0.5005369",
"0.49977046",
"0.49977046",
"0.498443",
"0.49674127",
"0.49529317",
"0.4934858",
"0.4912697",
"0.490666... | 0.5818764 | 1 |
Test run get_most_volatile() with stock prices from a file. | def test_run(filename='prices.csv'):
prices = pd.read_csv(filename, parse_dates=['date'])
print("Most volatile stock: {}".format(get_most_volatile(prices))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_stock(db, openfile):\n pass",
"def get_most_volatile(prices):\n \n prices = prices.set_index('date')\n\n stock_return_volatility = []\n\n for ticker in prices.ticker.unique():\n prices_for_ticker = prices[prices['ticker'] == ticker]['price']\n log_return = np.log(prices_for_... | [
"0.5832539",
"0.57833153",
"0.56723505",
"0.54061973",
"0.53237814",
"0.5318612",
"0.5297799",
"0.52888286",
"0.5231948",
"0.5163269",
"0.5150431",
"0.50361997",
"0.49637398",
"0.49448463",
"0.4941156",
"0.4928857",
"0.48964813",
"0.4896082",
"0.4889873",
"0.48582286",
"0.484... | 0.7938999 | 1 |
True if expires is not equal to orig_expires. | def updated(self):
return self.expires != self.orig_expires | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_expires(self):\n # We aren't bother going to test the actual time in expires, that\n # way lies pain with broken tests later.\n up = self.get(self.good_data)\n hdrs = dict(up.get_headers(1))\n lm = datetime(*utils.parsedate_tz(hdrs['Last-Modified'])[:7])\n exp = d... | [
"0.7073698",
"0.69195384",
"0.6914716",
"0.69129467",
"0.67846453",
"0.6679914",
"0.660565",
"0.65767676",
"0.6557804",
"0.6405459",
"0.638651",
"0.63783026",
"0.6330744",
"0.6310361",
"0.6259558",
"0.6224024",
"0.6209609",
"0.6207446",
"0.61312985",
"0.61132365",
"0.609304",... | 0.76405764 | 0 |
Called to move/remove one item. Returns True if the item was purged, False if it was moved to self.new_expiry. | def remove_one(self):
item = self.expiry.pop(0)
if item.updated:
self.new_expiry.append(item)
return
del self.index[item.target]
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self,item):\r\n raise AbstractError\r\n return False",
"def drop(self, item: Item) -> bool:\n if item in self.bag:\n self.__bag.remove(item)\n self.room._add_item(item)\n return True\n return False",
"def is_expired(self, key, now=None, re... | [
"0.6366809",
"0.63568",
"0.60818267",
"0.6010963",
"0.5990624",
"0.5990624",
"0.5898597",
"0.58695376",
"0.58585554",
"0.5826926",
"0.58192736",
"0.58165",
"0.57956797",
"0.5775258",
"0.574607",
"0.56877345",
"0.5676406",
"0.5663184",
"0.56496775",
"0.563791",
"0.5600733",
... | 0.696654 | 0 |
Purge stuff from the cache which is expired/oldest. Stuff is purged which is older than TTL or if the total number of entries is in excess of MAX_ASSOCS. | def purge(self):
if not self.index:
return
now = time()
while self.expiry[0].orig_expires <= now or len(self.index) > MAX_ASSOCS:
self.remove_one()
if not self.expiry:
if not self.index:
return
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _purge_expired_items():\n now = time.time()\n keys = data_table.keys()\n\n for key in keys:\n num_unique_vals = len(data_table[key])\n\n # We iterate through in reverse, because otherwise deleting an \n # entry will cause frivolous edge cases.\n iteration_scheme = range(num_unique_vals)\n ite... | [
"0.7540263",
"0.7274658",
"0.7212392",
"0.71395636",
"0.6828041",
"0.6794092",
"0.6781577",
"0.6743768",
"0.6684985",
"0.66247",
"0.65925604",
"0.6568118",
"0.647569",
"0.64700687",
"0.64508235",
"0.64348704",
"0.64143634",
"0.6377659",
"0.62273985",
"0.62217367",
"0.622053",... | 0.77597445 | 0 |
Get common letters of two words | def get_common_letters(word1: str, word2: str) -> str:
common = ''
for x, y in zip(word1, word2):
if x == y:
common += x
return common | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_shared_prefix(word1: str, word2: str) -> str:\n shared_prefix = \"\"\n for char1, char2 in zip(word1, word2):\n if char1 == char2:\n shared_prefix += char1\n else:\n break\n return shared_prefix",
"def shared_words(text1, text2):\r\n\r\n list1 = tokenize(te... | [
"0.7009229",
"0.6888572",
"0.68849295",
"0.6847381",
"0.68469286",
"0.6775948",
"0.67034924",
"0.6648536",
"0.6633855",
"0.6592176",
"0.6583248",
"0.6566062",
"0.6548944",
"0.6540705",
"0.6511979",
"0.6449228",
"0.644169",
"0.64145076",
"0.6395596",
"0.637349",
"0.63393426",
... | 0.88774985 | 0 |
Tests the filtering for a plan by its metal level to only match silver level plans. | def test_filtering_plans_by_metal_level_matches_only_silver(self):
silver_plan_inputs = [
{
'plan_id': '05276NA2900195',
'state': 'MI',
'metal_level': 'Silver',
'rate': '283.39',
'rate_area': '1'
},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_instrument_inventory_filtering():\n filt = 'GR150R'\n data = mm.instrument_inventory('niriss',\n add_filters={'filter': filt},\n return_data=True)\n\n filters = [row['filter'] for row in data['data']]\n\n assert all([i == filt... | [
"0.537246",
"0.53307503",
"0.529262",
"0.51645184",
"0.51426303",
"0.50996315",
"0.5073268",
"0.5032784",
"0.50168383",
"0.49994883",
"0.485873",
"0.48476052",
"0.48407164",
"0.4840311",
"0.48165542",
"0.48065767",
"0.47913322",
"0.47656873",
"0.47651768",
"0.47596028",
"0.47... | 0.84512395 | 0 |
Test that the zipcode data is cleaned properly and contains only unique rate areas. | def test_clean_zipcode_data_is_unique(self):
input = {
'11111': [('NY', '5')],
'22222': [('WI', '2')],
'33333': [('WI', '2'), ('NY', '5')],
'44444': [('WI', '2'), ('WI', '2')],
'55555': [('WI', '2'), ('WI', '2'), ('NY', '5')],
'66666': [('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_only_five_digit_zipcodes_match(self):\n\n incorrect_zipcodes = ['1', 'abcdef', '123ab', '12345-6789', 'abc-def']\n non_string_zipcodes = [1, [123, 143], {'test': '123'}, 344.234, True]\n cleaned_zipcode_data_input = {'11111': [('NY', '5')]}\n cleaned_plan_data_input = {('NY', '... | [
"0.64460033",
"0.62175375",
"0.61588347",
"0.60202265",
"0.60172653",
"0.5865516",
"0.58646524",
"0.5859416",
"0.57990336",
"0.57793456",
"0.5748033",
"0.57366174",
"0.57348245",
"0.5724401",
"0.57015634",
"0.55580825",
"0.5512242",
"0.5489846",
"0.54823476",
"0.54728675",
"0... | 0.85351896 | 0 |
Tests the plan ratea data is cleaned properly and is returned with sorted unique values for each rate area. | def test_clean_plan_rates_sorts_and_makes_data_unique(self):
input = {
('IN', '1'): [
'304.5',
'422.28',
'386.79',
'382.7',
'332.21',
'422.28',
'382.7'
],
('SD', '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_clean_zipcode_data_is_unique(self):\n\n input = {\n '11111': [('NY', '5')],\n '22222': [('WI', '2')],\n '33333': [('WI', '2'), ('NY', '5')],\n '44444': [('WI', '2'), ('WI', '2')],\n '55555': [('WI', '2'), ('WI', '2'), ('NY', '5')],\n ... | [
"0.6119881",
"0.56413275",
"0.5277127",
"0.5233631",
"0.52200216",
"0.5073727",
"0.506989",
"0.4968094",
"0.49477315",
"0.49471563",
"0.4938029",
"0.49331796",
"0.49196985",
"0.49146998",
"0.48825213",
"0.48451757",
"0.48303533",
"0.48172814",
"0.4804989",
"0.47885492",
"0.47... | 0.7310434 | 0 |
Tests that when the conditions are right, a zipcode is properly mapped to a rate. | def test_zipcode_is_successfully_mapped(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('NY', '5')]}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = '294.87'
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_only_five_digit_zipcodes_match(self):\n\n incorrect_zipcodes = ['1', 'abcdef', '123ab', '12345-6789', 'abc-def']\n non_string_zipcodes = [1, [123, 143], {'test': '123'}, 344.234, True]\n cleaned_zipcode_data_input = {'11111': [('NY', '5')]}\n cleaned_plan_data_input = {('NY', '... | [
"0.66684675",
"0.60333157",
"0.5978363",
"0.58802783",
"0.5841937",
"0.5741159",
"0.5704098",
"0.565133",
"0.55974364",
"0.5566235",
"0.54648787",
"0.5458494",
"0.5457171",
"0.5455862",
"0.5448905",
"0.544727",
"0.5438281",
"0.5421464",
"0.5415892",
"0.5403968",
"0.5398028",
... | 0.69216657 | 0 |
Tests that if no matching rate is found for a zipcode, an empty string is returned instead per the exercise instructions. | def test_no_rate_found_is_empty_string(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'22222': [('NH', '12')]}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_no_plans_are_found(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': [('WI', '9')]}\n cleaned_plan_data_input = {('WI', '9'): []}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp_for_zipcode(\n zipcode,\n ... | [
"0.6593722",
"0.65769804",
"0.6516567",
"0.64187825",
"0.640926",
"0.6383783",
"0.6159052",
"0.60808915",
"0.5918545",
"0.5846181",
"0.5840774",
"0.57913196",
"0.57867366",
"0.57632065",
"0.57513416",
"0.57177305",
"0.5681527",
"0.5549766",
"0.5544274",
"0.552554",
"0.5523862... | 0.7299004 | 0 |
Tests that a rate is not returned when a zipcode is given in a format that is not 5 digits. | def test_only_five_digit_zipcodes_match(self):
incorrect_zipcodes = ['1', 'abcdef', '123ab', '12345-6789', 'abc-def']
non_string_zipcodes = [1, [123, 143], {'test': '123'}, 344.234, True]
cleaned_zipcode_data_input = {'11111': [('NY', '5')]}
cleaned_plan_data_input = {('NY', '5'): ['294... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CheckZipCode(zipcode):\n # see if there are enough digits\n if (len(zipcode) >= 5):\n # check if numerical\n try:\n int(zipcode)\n return True\n except:\n return False\n else:\n return False",
"def zip_code(self, value):\n regex = c... | [
"0.69980687",
"0.6726815",
"0.6431161",
"0.6381496",
"0.60074365",
"0.59789",
"0.5864694",
"0.5857582",
"0.58574224",
"0.57995015",
"0.56933093",
"0.5647003",
"0.55855864",
"0.5554181",
"0.55517066",
"0.554926",
"0.5535344",
"0.5522636",
"0.5497078",
"0.5466229",
"0.54006547"... | 0.72417444 | 0 |
Tests that an empty string is returned if no plan areas exist for a given zipcode. | def test_empty_string_returned_if_no_plan_areas_exist(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': []}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_too_many_plan_areas_exist(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': [('WI', '9'), ('NY', '5')]}\n cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp... | [
"0.70404387",
"0.60167426",
"0.5886546",
"0.57227695",
"0.5487004",
"0.51963043",
"0.51898575",
"0.518254",
"0.51716274",
"0.51694894",
"0.51153564",
"0.5086501",
"0.50733477",
"0.50481135",
"0.50416213",
"0.501723",
"0.49452177",
"0.49212265",
"0.49157584",
"0.4908836",
"0.4... | 0.7164315 | 0 |
Tests that an empty string is returned if more than one plan area exists for a given zipcode. | def test_empty_string_returned_if_too_many_plan_areas_exist(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('WI', '9'), ('NY', '5')]}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_no_plan_areas_exist(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': []}\n cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp_for_zipcode(\n zip... | [
"0.6895567",
"0.58014107",
"0.5796688",
"0.5711699",
"0.5480371",
"0.5380354",
"0.53440535",
"0.53259677",
"0.52647734",
"0.5237509",
"0.52233595",
"0.5210759",
"0.51686174",
"0.5094478",
"0.5078834",
"0.507732",
"0.50009465",
"0.4994607",
"0.49879083",
"0.49855915",
"0.49532... | 0.7240199 | 0 |
Tests that if a rate can be returned, it is always formatted to two decimal places. | def test_rate_always_formatted_to_two_decimal_places(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('NY', '5')]}
cleaned_plan_data_inputs = [
{('NY', '5'): ['294.24', '294']},
{('NY', '5'): ['294.24', '294.7']},
{('NY', '5'): ['294.24', '29... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_rating(instance, args):\r\n raw_rating = instance.rating(args)\r\n # Do string conversion here\r\n if not raw_rating:\r\n str_rating = 'N/A'\r\n else:\r\n str_rating = \"{0:.2f}\".format(raw_rating)\r\n return str_rating",
"def _exchange_amount(amount, rate):\n return ... | [
"0.635572",
"0.62793225",
"0.61580366",
"0.59902906",
"0.59895074",
"0.59418416",
"0.59058857",
"0.5860149",
"0.58415556",
"0.57754457",
"0.57288945",
"0.57193255",
"0.5702747",
"0.5680467",
"0.56775796",
"0.56678134",
"0.5606319",
"0.56051075",
"0.5598586",
"0.5582338",
"0.5... | 0.6863517 | 0 |
list all hangouts, supply keywords to filter by title | def hangouts(bot, event, *args):
text_search = " ".join(args)
lines = []
for convid, convdata in bot.conversations.get(filter="text:" + text_search).items():
lines.append("<b>{}</b>: <em>`{}`</em>".format(convdata["title"], convid))
lines.append(_('<b>Total: {}</b>').format(len(lines)))
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hangouts(bot, event, *args):\n\n text_search = \" \".join(args)\n line = \"<b>List of hangouts with keyword:</b> \\\"{}\\\"<br />\".format(text_search)\n\n for conv in bot.list_conversations():\n conv_name = get_conv_name(conv)\n if text_search.lower() in conv_name.lower(): # For blank k... | [
"0.73923945",
"0.569828",
"0.5560075",
"0.5533528",
"0.55277205",
"0.5525617",
"0.54996574",
"0.5444355",
"0.5396228",
"0.5325632",
"0.5320193",
"0.5297989",
"0.52948684",
"0.52716166",
"0.525805",
"0.5255838",
"0.5218868",
"0.5202857",
"0.5202308",
"0.51878214",
"0.5180707",... | 0.7244985 | 1 |
reload config and memory, useful if manually edited on running bot | def reload(bot, event, *args):
yield from bot.coro_send_message(event.conv, "<b>reloading config.json</b>")
bot.config.load()
yield from bot.coro_send_message(event.conv, "<b>reloading memory.json</b>")
bot.memory.load() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload(bot, event, *args):\n bot.config.load()\n bot.memory.load()",
"def reload_config(self):\n pass",
"def rehash(self):\n logging.info(\"Rehashing started\")\n modules = self.cmd_plugins.get_modules()\n CommandBot.pause(self)\n PlugBot.stop(self)\n\n loggi... | [
"0.82988477",
"0.7730746",
"0.7237101",
"0.7000755",
"0.6990611",
"0.69861",
"0.69167477",
"0.69043493",
"0.68545073",
"0.68489516",
"0.67825955",
"0.6778113",
"0.67457616",
"0.6589509",
"0.65724033",
"0.6516148",
"0.6433054",
"0.6433054",
"0.6330398",
"0.62764126",
"0.623042... | 0.7807844 | 1 |
Initializes a Map with the given number of buckets. | def new(num_buckets=256):
aMap = [] #creating empty list aMap
for i in range(0, num_buckets):
aMap.append([]) #append num_buckets into aMap
return aMap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(num_buckets=256):\n\t#sets aMap variable to an empty list\n\t#then fills that list with the specified number of other empty lists ('buckets') \n\t#returns the new aMap\n\taMap = []\n\tfor i in range(0, num_buckets):\n\t\taMap.append([])\n\treturn aMap",
"def new(num_buckets=256):\n aMap=[]",
"def ne... | [
"0.8146247",
"0.8119073",
"0.7875877",
"0.7073408",
"0.67659897",
"0.6762607",
"0.6628239",
"0.66029876",
"0.6587286",
"0.6574333",
"0.65716136",
"0.6556335",
"0.64881253",
"0.6487887",
"0.64756536",
"0.64513785",
"0.64458674",
"0.637114",
"0.6361271",
"0.6350683",
"0.6333639... | 0.82026 | 0 |
Returns the index, key, and value of a slot found in a bucket. Returns 1, key, and default (none if not set) when not found. | def get_slot(aMap, key, default=None):
bucket = get_bucket(aMap, key)
for i, kv in enumerate(bucket):
k, v = kv
if key == k:
return i, k, v
return -1, key, default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_slot(aMap, key, default=None):\n\t#now that we know which bucket the key could be in\n\t#we iterate through all the elements of that bucket until it finds the key\n\t\n\tbucket = get_bucket(aMap, key)\n\t\n\tfor i, kv in enumerate(bucket):\n\t#enumerate returns a tuple containing the count (starting at 0) ... | [
"0.79758656",
"0.773949",
"0.6553314",
"0.64808375",
"0.6404719",
"0.62866116",
"0.62866116",
"0.62585574",
"0.6220723",
"0.6191381",
"0.6135561",
"0.61248016",
"0.61166006",
"0.6086522",
"0.5985429",
"0.5919926",
"0.5919475",
"0.5899041",
"0.5883153",
"0.58819985",
"0.586089... | 0.79655206 | 1 |
this keyword is used to grep keywords in a file, then return matching lines.\n filePath is the full path of the file.\n searchKeyWord is the keyword filter.\n isPattern is the flag indicate if searchKeyword is a normal search string or regular expression pattern.\n isCaseSensitive is the flag indicate if searchKeyword ... | def grep_local_file(filePath, searchKeyWord, isPattern=True, isCaseSensitive=True, Fromline=0, timeout=0, retry_interval=0):
returnMatchLines = []
current = time.time()
timout_value = float(timeout)
maxtime = current + timout_value
while (current <= maxtime):
fileObj = open(filePath, "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dictionary_file_lines_for_keywords(self):\n keywords_iter = iter(self.keywords)\n next_keyword = keywords_iter.next()\n print(\"Searching for keyword {}\".format(next_keyword))\n\n self.dictionary_file.open_handle()\n result_lines = list()\n while next_keyword:\n ... | [
"0.620735",
"0.61173135",
"0.6065361",
"0.6045502",
"0.5981804",
"0.5717122",
"0.57109797",
"0.5688",
"0.56368005",
"0.5602805",
"0.5584422",
"0.55832374",
"0.5575134",
"0.5572834",
"0.5553349",
"0.5479438",
"0.5465954",
"0.54646385",
"0.541022",
"0.536871",
"0.53384507",
"... | 0.76741695 | 0 |
Modify the old contents to new contents.\n oldFile is the original file fullpath.\n newFile is the output file fullpath.\n case_insensitive is True or false.\n | def Modify_lines_matching_pattern(oldFile, newFile, modifydic, case_insensitive):
fd = open(oldFile, "r")
lines = fd.readlines()
fd.close()
for key in modifydic.keys():
if case_insensitive == True:
pattern = re.compile(key, re.I)
else:
pattern = re.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replaceLine(oldFile, string1, string2, newString, newFile = \"TempFile\", mvFile = True):\n with open(oldFile, \"r\") as oldfile, open(newFile, \"w\") as newfile:\n oldfile_read = oldfile.readlines()\n for line in oldfile_read:\n line_number = oldfile_read.index(line)\n i... | [
"0.6301766",
"0.6221288",
"0.61109865",
"0.6051536",
"0.6004594",
"0.59841347",
"0.59138376",
"0.58587974",
"0.58379644",
"0.5784545",
"0.57423884",
"0.57423884",
"0.57224125",
"0.5713668",
"0.5694037",
"0.5662745",
"0.56497025",
"0.5639031",
"0.56102854",
"0.5609075",
"0.559... | 0.66408944 | 0 |
Override this method to respond to the mouse not being over the element. Called AFTER mouse_out if that method gets called. | def mouse_not_over(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_out(self):\n pass",
"def mouse_over(self):\n pass",
"def on_unhover(self) -> None:",
"def mouse_out(self, event):\r\n self['background'] = self.defaultBackground",
"def MouseOverItem(self,item):\r\n pass",
"def OnMouse(self,event):\r\n if event.Moving():\r\n ... | [
"0.82283014",
"0.7914597",
"0.7469889",
"0.7266409",
"0.69720304",
"0.67417073",
"0.6612279",
"0.65831256",
"0.6578622",
"0.6568934",
"0.6539237",
"0.65102863",
"0.6490017",
"0.63950545",
"0.6386635",
"0.633578",
"0.6321943",
"0.6312482",
"0.6304269",
"0.62664276",
"0.6236682... | 0.8337129 | 0 |
Override this method to respond to the mouse entering the element. | def mouse_enter(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_over(self):\n pass",
"def enterEvent(self, ev):\n self.setFocus(Qt.MouseFocusReason)\n self.__pointerLeftWidget = False\n self.setCursor(self.defaultCursor)\n QGraphicsView.enterEvent(self, ev)",
"def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):\n ... | [
"0.72074497",
"0.7113512",
"0.7032834",
"0.7032834",
"0.69916975",
"0.69322693",
"0.6845052",
"0.6836298",
"0.6764046",
"0.6755759",
"0.6748612",
"0.65055966",
"0.649724",
"0.64849204",
"0.6443039",
"0.64336354",
"0.64145774",
"0.64126825",
"0.6396133",
"0.6368497",
"0.633384... | 0.85851264 | 0 |
Override this method if to respond to the mouse leaving the element. | def mouse_out(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mouse_leave (self, event):\n\n\t\tif not self.clicked:\n\n\t\t\tself.cursor_position = [-1,-1]\n\t\t\tself.redraw_canvas()\n\t\t\tself.hide_tip()#self.timer1 = gobject.timeout_add(2000, self.hide_tip)",
"def hoverLeaveEvent(self, event: 'QGraphicsSceneHoverEvent'):\n QApplication.instance().restore... | [
"0.7270982",
"0.71157235",
"0.704455",
"0.7016063",
"0.67757094",
"0.6765137",
"0.67564774",
"0.6679935",
"0.6604109",
"0.6557472",
"0.6523289",
"0.6511427",
"0.6496346",
"0.641088",
"0.64010245",
"0.62832344",
"0.62736565",
"0.6220964",
"0.62058276",
"0.6200299",
"0.6186985"... | 0.7645027 | 0 |
Override this method to respond to the left mouse button being held down over the element. | def mouse_left_down(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leftButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.LEFT_BUTTON)",
"def mouse_left_up(self):\n pass",
"def mouse_right_down(self):\n pass",
"def OnLeftDown(self, event): # ANDY some PAN ideas from http://code.google.com/p/pyslip/\n if event.ShiftDown():\n eve... | [
"0.7982013",
"0.7962645",
"0.77094394",
"0.7422216",
"0.7344164",
"0.73293656",
"0.7312629",
"0.72654736",
"0.72546726",
"0.72282684",
"0.72147775",
"0.71788275",
"0.717061",
"0.7139647",
"0.70763767",
"0.7069452",
"0.7060475",
"0.70085615",
"0.6988899",
"0.6951568",
"0.69106... | 0.8459492 | 0 |
Override this method to respond to the right mouse button being held down over the element. | def mouse_right_down(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_right_up(self):\n pass",
"def rightButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.RIGHT_BUTTON)",
"def onRightDown(self, event):\n\n pass",
"def rightButtonUp(self):\n\t\tautopy.mouse.toggle(False,autopy.mouse.RIGHT_BUTTON)",
"def RightClick(self):\n self._PressRigh... | [
"0.7990627",
"0.7949314",
"0.7513452",
"0.73088235",
"0.7308333",
"0.7301941",
"0.7238975",
"0.7186552",
"0.7162225",
"0.7041994",
"0.69716364",
"0.69352114",
"0.69093263",
"0.6895724",
"0.6866687",
"0.6828164",
"0.6804783",
"0.6775382",
"0.6756245",
"0.67409694",
"0.67354745... | 0.85940593 | 0 |
Override this method to respond to the right mouse button being released on the element. | def mouse_right_up(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_right_down(self):\n pass",
"def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass",
"def mouse_release_event(self, x: int, y: int, button: int):\n pass",
"def on_mouse_release(self, x, y, button):\n pass",
"def rightButtonDown(self):\n\t\tautopy.mouse.toggl... | [
"0.7984992",
"0.7669759",
"0.7560166",
"0.745702",
"0.73336405",
"0.7120719",
"0.7056546",
"0.7043819",
"0.70383954",
"0.68456197",
"0.6824234",
"0.68107015",
"0.67931944",
"0.6708472",
"0.6638119",
"0.6634257",
"0.6535301",
"0.6518771",
"0.6508248",
"0.6502479",
"0.6477549",... | 0.7677217 | 1 |
Override this method to respond to the middle mouse button being held down over the element. | def mouse_middle_down(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_middle_up(self):\n pass",
"def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass",
"def mouse_right_up(self):\n pass",
"def on_mouse_release(self, x, y, button):\n pass",
"def ev_mousebuttonup(self, event: MouseButtonUp) -> None:",
"def ev_mousebuttondown... | [
"0.7794178",
"0.73346615",
"0.7278942",
"0.7235611",
"0.71748966",
"0.71505445",
"0.7085906",
"0.70397234",
"0.7038093",
"0.69910294",
"0.69589084",
"0.69151455",
"0.69036335",
"0.68575525",
"0.6837659",
"0.6815109",
"0.68076855",
"0.67690843",
"0.6741163",
"0.67272973",
"0.6... | 0.8144935 | 0 |
Override this method to respond to the mouse wheel spinning when the mouse is being held down over the element. | def mouse_wheel_down(self):
if not self.scroll_element is None:
self.scroll_element.mouse_wheel_down() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mouse_wheel(self, e): # pragma: no cover\n super(TraceView, self).on_mouse_wheel(e)\n if e.modifiers == ('Alt',):\n start, end = self._interval\n delay = e.delta * (end - start) * .1\n self.shift(-delay)",
"def on_mouse_press(self, event):\n self.on_m... | [
"0.71962875",
"0.71476215",
"0.7129475",
"0.69585156",
"0.6720184",
"0.6612791",
"0.6487933",
"0.642528",
"0.6412528",
"0.64030284",
"0.6369889",
"0.6330504",
"0.6318762",
"0.6288254",
"0.62793976",
"0.6234082",
"0.62089163",
"0.6207074",
"0.6181349",
"0.61734873",
"0.6170471... | 0.7533816 | 0 |
Returns the pointer to the GUI object that is under the screen coordinates passed in to the coordinates parameter. current_best should be None unless called from this method. | def handle_input(self, coordinates, current_best = None):
if self.disable:
return current_best
if self.is_coords_in_bounds(coordinates):
if current_best is None or self.z <= current_best.z:
current_best = self
else:
if self._currently_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_gui(self):\n return self._current_gui",
"def getlocalbestcoordinate(self):\n return self.localbest.coordinate",
"def get_below(self):\n current_index = ALL_WINDOWS.index(self)\n if current_index == 0:\n return BASE_SCREEN\n\n return ALL_WINDOWS[current_... | [
"0.6390522",
"0.58366036",
"0.56894904",
"0.54773855",
"0.5454908",
"0.5454908",
"0.5435594",
"0.53845",
"0.53640234",
"0.5357284",
"0.53187394",
"0.53144544",
"0.53096515",
"0.5299734",
"0.52627397",
"0.5261838",
"0.52561283",
"0.52342606",
"0.52289695",
"0.52089494",
"0.520... | 0.6283108 | 1 |
Must be called at the start of the execute method. Make sure that image has been set before calling this. A None image will draw a generic button. | def gui_init(self):
GUI_element.gui_init(self)
self.hover_sound = False
if not self.image is None:
self.generic_button = False
self.width = self.image.width if self.width == 0 else self.width
self.height = self.image.height if self.height == 0 else s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_image(self):\n button = self.buttons.checkedButton()\n if button is None:\n return\n\n button.click()",
"def boutton(self,img1,x,y):\r\n self.button.append(self.creat_image(img1,x,y))",
"def showBtnImg(*args, **kwargs):\n\targs[0].get_image().show()",
"def s... | [
"0.70161515",
"0.70027477",
"0.6839604",
"0.677396",
"0.67521006",
"0.6693708",
"0.6679425",
"0.66226333",
"0.63661647",
"0.6363211",
"0.6360723",
"0.63584304",
"0.6267832",
"0.624993",
"0.6242955",
"0.62371415",
"0.62187743",
"0.62062895",
"0.6200216",
"0.61864775",
"0.61708... | 0.70079434 | 1 |
Called when the slider is dragged. Designed to be overridden to add custom behaviour. | def slider_dragged(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_slider(self, instance, value):\n self.slider.bind(value=self.update_proxy)\n self.bind(pos=self.hack_position)\n self.slider.bind(pos=self.hack_position)",
"def mouseDragged(self, point, delta):\n pass",
"def dragEnterEvent(self, event):",
"def drag(self, event):\n s... | [
"0.71016735",
"0.6670154",
"0.65497184",
"0.6326585",
"0.6050225",
"0.6031739",
"0.6006089",
"0.6001614",
"0.5967166",
"0.5907364",
"0.5884901",
"0.5763239",
"0.57620794",
"0.576003",
"0.57411623",
"0.56494236",
"0.56295526",
"0.56161594",
"0.56027746",
"0.56000704",
"0.56000... | 0.882381 | 0 |
function that ensures that the anime in user choosen listbox isn't in all anime listbox | def update_libox_all_anime():
## print("update_libox_all_anime is runnig")
a = libox_all_anime.get(0, END)
## print("the contents or a :", a)
b = []
for x in a:
## print("this is x: ", x)
b.append(x)
## print(x)
for x in updated_your_anime():
if x in b:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(*args):\n\n search_term = search_var.get()\n all_anime = load(open(Save_file_dir.joinpath(\"anime_save.p\"), \"rb\"))\n\n all_anime_list = []\n for key, value in all_anime.items():\n all_anime_list.append(key)\n\n libox_all_anime.delete(0, END)\n\n for item in all_anime_lis... | [
"0.5358605",
"0.5259478",
"0.5149276",
"0.51280844",
"0.51028097",
"0.50867",
"0.50787604",
"0.5066245",
"0.5039338",
"0.5033899",
"0.50224185",
"0.5019272",
"0.49440777",
"0.49417982",
"0.4912668",
"0.49124354",
"0.49081933",
"0.4905151",
"0.49043363",
"0.48986632",
"0.48858... | 0.58440846 | 0 |
Set up GenericRelations for a given actionable model. Needed because actstream's generic relationship setup functionality is brittle and unreliable. | def actstream_register_model(model):
for field in ('actor', 'target', 'action_object'):
generic.GenericRelation(Action,
content_type_field='%s_content_type' % field,
object_id_field='%s_object_id' % field,
relate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_relation_types(self):\n pass",
"def test_add_relation_type(self):\n pass",
"def test_change_relation_types(self):\n pass",
"def init_model(connection):\n db = connection\n\n for obj in common.__dict__.itervalues():\n if type(obj) == type and issubclass(obj, comm... | [
"0.5983358",
"0.5731366",
"0.5586986",
"0.5551285",
"0.5508221",
"0.54468006",
"0.53996897",
"0.53723776",
"0.5369516",
"0.53591746",
"0.53363955",
"0.53126204",
"0.52928793",
"0.5236608",
"0.52262175",
"0.5187518",
"0.5169628",
"0.5126868",
"0.5075861",
"0.5060441",
"0.50516... | 0.6793783 | 0 |
Return the name of the Subreddit. | def getSubredditName(self):
return self.nameOfSubreddit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sub_name(self):\n return self.sub_name",
"def get_subreddit(self):\r\n from pylons import g\r\n from r2.models import Subreddit, Sub, NotFound, Default\r\n try:\r\n if not self.hostname or self.hostname.startswith(g.domain):\r\n if self.path.startswit... | [
"0.7218869",
"0.68938684",
"0.65898365",
"0.64519304",
"0.6427484",
"0.6427484",
"0.63539076",
"0.61308515",
"0.61308515",
"0.61308515",
"0.6120958",
"0.60964257",
"0.6078476",
"0.6078476",
"0.6071652",
"0.6050746",
"0.60496366",
"0.60496366",
"0.60496366",
"0.6042231",
"0.60... | 0.8894763 | 0 |
Changes the subreddit name. Name of the subreddit you want to change to. | def setSubreddit(self, subredditName):
self.nameOfSubreddit = subredditName
self.subreddit = self.praw.subreddit(nameOfSubreddit) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_name(self, new_name):\r\n self.__name = new_name",
"def update_name(self, new_name):\r\n self.__name = new_name",
"def ChangeName(self, newName):\n if newName != \"\":\n newPath = self.format + os.sep + \"playlists\" + os.sep + newName + \".txt\"\n os.repla... | [
"0.6665063",
"0.6665063",
"0.6544932",
"0.6535344",
"0.638324",
"0.63765067",
"0.63743895",
"0.636293",
"0.6334866",
"0.612783",
"0.612274",
"0.612274",
"0.6089802",
"0.6071336",
"0.60371286",
"0.6034261",
"0.6018913",
"0.6016731",
"0.6003661",
"0.59978575",
"0.591629",
"0.... | 0.77809405 | 0 |
Returns a lists of integers of scores of the posts. | def getScore(self):
self.scoreList = [submissionsss.score for submissionsss in self.subreddit.top(time_filter = 'day', limit = self.limits)]
return self.scoreList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scores(self) -> List[float]:\n if not self.prediction:\n return []\n return [sentence.score for sentence in self.prediction.sentences]",
"def get_scores(self):\n return self.score",
"def scores_(self):\n return self.predictor.scores_",
"def get_scores(self) -> tuple... | [
"0.71532154",
"0.7128279",
"0.69161886",
"0.6607638",
"0.6482073",
"0.64766103",
"0.6364357",
"0.634786",
"0.6333597",
"0.63325065",
"0.62894195",
"0.6277977",
"0.6263328",
"0.6218913",
"0.62156534",
"0.6215061",
"0.6183405",
"0.61831903",
"0.6175631",
"0.6165583",
"0.6138198... | 0.75239307 | 0 |
Buffer some data to a stream to a node's input. Whenever the node is available to read a value from the matching input, this will send the next value. | def buffer_input(self, node, direction, values):
self.num_buffered_inputs += len(values)
self.buffered_input.setdefault(node, {}).setdefault(direction,
[]).extend(values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onRecv(self, data):\n self.stream += data\n while self.handleStream(): pass",
"def process(self, data):\n if self.__head:\n self.__head.send(Element(\n stream_id=self.id,\n data=data))",
"def fillBuffer():\n buff[bufferCounter].ne... | [
"0.64942396",
"0.633012",
"0.6143053",
"0.60902137",
"0.6055283",
"0.59665143",
"0.579951",
"0.57874286",
"0.57657534",
"0.575062",
"0.574913",
"0.57437265",
"0.5728528",
"0.5725628",
"0.57216823",
"0.5718914",
"0.57108384",
"0.57058454",
"0.56562674",
"0.56273276",
"0.560687... | 0.690997 | 0 |
Return whether there are any buffered inputs remaining. | def has_buffered_inputs(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bufferIsFull(self):\n return len(self.buffer) == self.bufferSize",
"def has_next(self):\n # type: () -> bool\n return len(self.buffer) > 0",
"def full(self):\n return len(self.future_buffer) == self.CAPACITY",
"def are_buffers_empty(self): \n i = 0\n for i... | [
"0.73473984",
"0.7152609",
"0.69882053",
"0.6975826",
"0.69175136",
"0.6868512",
"0.6840837",
"0.68094856",
"0.6788063",
"0.6750303",
"0.6736553",
"0.6732254",
"0.6728499",
"0.6708489",
"0.6695467",
"0.6695467",
"0.6695467",
"0.6695467",
"0.6689184",
"0.66471004",
"0.6631454"... | 0.77823186 | 0 |
Takes in and returns hyperparameters as an array of the same length. The elements of are pairs [lower, upper], and the corresponding hyperparameter is sampled from a uniform distribution in the interval [lower, upper]. If instead of a pair we have a number in , then we assign that value as the appropriate hyperparamete... | def initBoundedParams(bounds, sn=[]):
hypinit = {
'cov': np.zeros(len(bounds)),
'lik': np.atleast_1d(np.log(sn)),
'mean': np.array([])
}
# Sample from a uniform distribution
for idx, pair in enumerate(bounds):
# Randomize only if bounds are specified
if isinst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hyperparameter_values(hyper):\n import ConfigSpace.hyperparameters as CSH\n\n if isinstance(hyper, CSH.CategoricalHyperparameter):\n return hyper.choices, False\n\n if isinstance(hyper, CSH.NumericalHyperparameter):\n return [hyper.lower, hyper.upper], True\n \n if isinstan... | [
"0.56640446",
"0.55604845",
"0.54990536",
"0.5466633",
"0.545822",
"0.5446241",
"0.54428786",
"0.5440141",
"0.5407368",
"0.54070425",
"0.5364159",
"0.5364159",
"0.5360082",
"0.5337372",
"0.53170127",
"0.53168845",
"0.53137463",
"0.5287289",
"0.52689487",
"0.52573603",
"0.5253... | 0.57418513 | 0 |
Returns number of coordinates in string. | def counting_coordinates(string):
num_of_commas = string.count(',')
num_of_cords = num_of_commas + 1
return num_of_cords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_string_info(string):\n line_count = 1\n column_count = 1\n for char in string:\n if char == '\\n':\n column_count = 1\n line_count += 1\n else:\n column_count += 1\n return Coords(line_count, column_count, len(string))",
"def length(s: str) -> in... | [
"0.6940831",
"0.6308547",
"0.62703896",
"0.60827315",
"0.6065635",
"0.6045179",
"0.60267836",
"0.5949909",
"0.59459907",
"0.5829819",
"0.57608765",
"0.5755629",
"0.57515347",
"0.57390684",
"0.57338333",
"0.5683465",
"0.56755596",
"0.5655975",
"0.5646916",
"0.56432575",
"0.558... | 0.82952464 | 0 |
Copy contents of arr1 to arr2. | def copy_arr1_to_arr2(arr1, arr2, k, num_of_cords):
for i in range(k):
for j in range(num_of_cords):
arr2[i][j] = arr1[i][j] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign(array1, array2):\n for i in range(len(array1)):\n array2[i] = array1[i]",
"def cat_arrays(arr1, arr2):\n newarr = [0 for i in range(len(arr1) + len(arr2))]\n for i in range(len(arr1)):\n newarr[i] = arr1[i]\n for i in range(len(arr2)):\n newarr[i + len(arr1)] = arr2[i]... | [
"0.73633987",
"0.67356104",
"0.6724997",
"0.6570111",
"0.65166664",
"0.6294176",
"0.6041236",
"0.60094804",
"0.5956681",
"0.5945453",
"0.5928697",
"0.5916138",
"0.59127474",
"0.5909704",
"0.5871539",
"0.5759969",
"0.5749519",
"0.57420987",
"0.57081336",
"0.56879663",
"0.56604... | 0.7642252 | 0 |
Turn all slots of currClusters to zero. | def make_all_zero(curr_clusters, k, num_of_cords):
for i in range(k):
for j in range(num_of_cords):
curr_clusters[i][j] = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _empty_clusters(clusters):\n for clst in clusters:\n clst.points = []",
"def reset(self):\n self._clusters = {}\n self._clusters_val = {}\n self._centroids = {}\n self.store()",
"def zero_cluster():\n if _TRAFFICCTL:\n cmd = _traffic_ctl(\"metric\", \"clear\"... | [
"0.6796202",
"0.64024293",
"0.63158333",
"0.62675047",
"0.6168588",
"0.6164785",
"0.6119265",
"0.60707",
"0.6068551",
"0.6046783",
"0.595144",
"0.5930416",
"0.59281564",
"0.5927291",
"0.59178776",
"0.5910214",
"0.5910083",
"0.5907188",
"0.5899487",
"0.58834374",
"0.585963",
... | 0.74820185 | 0 |
Check if clusters1 equals to clusters2, return True if so, or False if not. | def is_converged(clusters1, clusters2, k, num_of_cords):
for i in range(k):
for j in range(num_of_cords):
if clusters1[i][j] != clusters2[i][j]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identical_cds(sc1,sc2):\n # Input 2 identical segment chains, return True if cds the same\n if sc1.covers(sc2) and sc2.covers(sc1):\n return True\n else:\n return False",
"def are_clusters_similar(cls, c1, c2, proportion=0.8):\n if len(c1.indices) > len(c2.indices):\n ... | [
"0.6819774",
"0.67053854",
"0.6577482",
"0.6567598",
"0.6566153",
"0.6465101",
"0.6442963",
"0.6380351",
"0.6379164",
"0.6357021",
"0.63215804",
"0.6296718",
"0.62854797",
"0.6203128",
"0.62005913",
"0.61896455",
"0.6144872",
"0.61378944",
"0.6137696",
"0.61299753",
"0.610979... | 0.8044068 | 0 |
Retrieve an exchange from database by id | def get_exchange(self, id):
return self.exch_repo.get(id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getbyid(self, id):\n\n return esd.retrieve(id)",
"def get(self, _id):",
"def read_item(id: str, request: Request):\n obj = db.get(id, kind=endpoint_model)\n return obj",
"def get(cls, id):\n\n return cls.query.get(id)",
"def get(cls, id):\n\n return cls.query.get(id)"... | [
"0.67121446",
"0.657574",
"0.6478656",
"0.64241445",
"0.64241445",
"0.6390948",
"0.6356077",
"0.63458675",
"0.6295548",
"0.6249574",
"0.6248896",
"0.62442577",
"0.61988556",
"0.61408186",
"0.6100281",
"0.6074537",
"0.6065128",
"0.606222",
"0.6061581",
"0.6003485",
"0.5983606"... | 0.80811805 | 0 |
Create a new exchange in the database | def create_exchange(self, exchangename, public_key, private_key, user_id, uid = None, pw = None):
if not exchangename or not public_key or not private_key:
raise Exception("Exchangename, public key and private key must be given")
else:
return self.exch_repo.create(exchangename, p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_exchange(self, exchange_name, exchange_type, internal=None):\n self._channel.exchange_declare(\n exchange=exchange_name,\n durable=True, # Survive reboot\n passive=False, # Perform a declare or just to see if it exists\n internal=internal, # Can only... | [
"0.6696044",
"0.6593915",
"0.6464137",
"0.6299332",
"0.6108338",
"0.6079601",
"0.605643",
"0.60084194",
"0.5968516",
"0.5955321",
"0.5955321",
"0.5921751",
"0.58424836",
"0.579992",
"0.57557315",
"0.57557315",
"0.57557315",
"0.57540107",
"0.569132",
"0.56544197",
"0.5631779",... | 0.7036039 | 0 |
Delete an existing exchange from the database | def delete_exchange(self, exchange_id):
if exchange_id:
self.exch_repo.delete(exchange_id=exchange_id)
else:
raise Exception("No exchange_id found for deleting exchange.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_exchange(self):\n new_exchange = self.app.add_exchange(\"test\", \"test\", \"test\")\n ret = self.app.delete_exchange(new_exchange.id)\n self.assertIn(ret[0], \"success\")",
"def test_delete_exchange_not_exists(self):\n ret = self.app.delete_exchange(20)\n self.... | [
"0.77815914",
"0.6905101",
"0.6586099",
"0.62237895",
"0.61273843",
"0.6105402",
"0.6093326",
"0.60743785",
"0.607348",
"0.6057913",
"0.6057913",
"0.60360014",
"0.60360014",
"0.60360014",
"0.60360014",
"0.60360014",
"0.60360014",
"0.60360014",
"0.60360014",
"0.60360014",
"0.6... | 0.74982965 | 1 |
Checks if an input pair is a valid one for given exchange | def is_valid_pair(self, pair, exchange):
pairs = self.ccxt.get_pairs(exchange)
print(pairs)
return pair in pairs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_pairs(pairs, historical_pairs):\n if pairs is None:\n return False\n for p in pairs:\n if p in historical_pairs:\n return False\n return True",
"def is_exchange_information_valid(exchange_info: Dict[str, Any]) -> bool:\n return exchange_info.get(\"status\", None)... | [
"0.6861681",
"0.6571933",
"0.6249077",
"0.6183069",
"0.6036506",
"0.5871636",
"0.5846162",
"0.5783997",
"0.5700833",
"0.56721383",
"0.5660363",
"0.5637686",
"0.5573187",
"0.5572298",
"0.5558149",
"0.5551392",
"0.55479705",
"0.55122805",
"0.5481704",
"0.5452177",
"0.53962547",... | 0.8063874 | 0 |
Fetches balance for a pair on an exchange through CCXT | def fetch_balance(self, exchange, pair):
return self.ccxt.fetch_balance(exchange, pair) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def fetch_balance(self, params={}):\n await self.load_markets()\n request = {\n 'currency': 'all',\n }\n response = await self.privateGetUserMargin(self.extend(request, params))\n #\n # [\n # {\n # \"account\":1455728,... | [
"0.7030547",
"0.68978024",
"0.68687195",
"0.67780674",
"0.6721376",
"0.64743924",
"0.64189506",
"0.6408955",
"0.63560534",
"0.6347745",
"0.63321614",
"0.6328665",
"0.6324221",
"0.6236682",
"0.6235676",
"0.6205206",
"0.61926544",
"0.61854434",
"0.6158296",
"0.6154335",
"0.6130... | 0.85180926 | 0 |
Retrieves the trading fee for a certain pair on a certain exchange | def get_exchange_trading_fee(self, exchange, pair, type):
return self.ccxt.get_exchange_trading_fee(exchange, pair, type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fee(self, pair, order_type):\n fees = self.p_state._getvalue()['fees']\n if fees:\n\n return float(fees[self._handler[order_type]][pair]['fee'])\n\n else:\n\n return 0.0",
"def get_price(self, pair='XBTZAR'):\n data = {'pair': pair}\n query_string ... | [
"0.72088563",
"0.6718482",
"0.6621101",
"0.64627856",
"0.6384671",
"0.630662",
"0.6283862",
"0.6246754",
"0.62267923",
"0.6090204",
"0.59220403",
"0.59198195",
"0.58899343",
"0.58853585",
"0.58453304",
"0.58343554",
"0.5809528",
"0.5797195",
"0.5788672",
"0.5771605",
"0.57653... | 0.8056572 | 0 |
Retrieves the market price for a certain pair on a certain exchange for a certain type(maker or taker) | def get_market_price(self, exchange, pair, type):
return self.ccxt.get_market_price(exchange, pair, type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_price(self, pair='XBTZAR'):\n data = {'pair': pair}\n query_string = build_query_string(data)\n\n r = requests.get(build_api_call(self.base_url, None, 'ticker', query_string))\n if r.status_code == 200:\n return r.json()",
"def get_price(horizon_host, pair):\n pr... | [
"0.7793075",
"0.69196445",
"0.67033094",
"0.6688754",
"0.6671473",
"0.66665936",
"0.6616699",
"0.6557316",
"0.6485801",
"0.6459023",
"0.6424058",
"0.6368259",
"0.633056",
"0.63264066",
"0.6295311",
"0.62687165",
"0.626795",
"0.62592244",
"0.6171922",
"0.6159443",
"0.60960245"... | 0.8632258 | 0 |
Place an order through the ccxt library for a certain exchange, for a certain pair (BTC/USD), type as buy/sell, and amount in currency (if BTC/USD will be BTC) | def place_order(self, exchange, pair, type, amount, price = None):
return self.ccxt.place_order(exchange, pair, type, amount, price) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy(self, trading_pair: str, amount: Decimal, order_type: OrderType, price: Decimal) -> str:\n return self.place_order(True, trading_pair, amount, price)",
"async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):\n await self.load_markets()\n ... | [
"0.71927655",
"0.7107266",
"0.7054423",
"0.6819442",
"0.6688734",
"0.66799307",
"0.66651535",
"0.6650478",
"0.6600853",
"0.6514789",
"0.65064514",
"0.64885443",
"0.6481737",
"0.6471577",
"0.6377945",
"0.6365583",
"0.6359703",
"0.63556045",
"0.6327038",
"0.6295299",
"0.6267949... | 0.76989853 | 0 |
Cancel the order through ccxt library for a certain exchange | def cancel_order(self, exchange, order_id):
return self.ccxt.cancel_order(exchange, order_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_cancel(order):\r\n self.gox.cancel(order.oid)",
"def cancelOrder(self, order_number):\n pass",
"def _order_cancel(self, bo):\n log.info(\"bo_blotter: order_cancel bracket order bo#%s\" % bo.ticket) \n cancelled = bo.cancel()\n return(cancelled)",
"def canc... | [
"0.7706166",
"0.744995",
"0.7211225",
"0.70317745",
"0.6936221",
"0.6923826",
"0.6887567",
"0.68759936",
"0.6835702",
"0.6832168",
"0.68217963",
"0.6820352",
"0.68094903",
"0.67458665",
"0.6741805",
"0.67316127",
"0.6710419",
"0.67094696",
"0.66826385",
"0.6623428",
"0.65751"... | 0.75702757 | 1 |
Get the the data for a certain exchange for a given pair for the last 700 hours | def get_history_data(self, exchange, pair, timedelta):
return self.ccxt.get_history_data(exchange, pair, timedelta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(pair, other):\n days_ago = 7\n endtime = int(time())\n starttime = endtime - 60 * 60 * 24 * days_ago\n\n geckourl = '%s/markets?vs_currency=%s&ids=%s' % (API, pair[\"currency\"],\n pair[\"coin\"])\n liveprice = requests.get(geckourl).j... | [
"0.6836399",
"0.627741",
"0.6234868",
"0.62244236",
"0.61926",
"0.6124068",
"0.605874",
"0.60258263",
"0.5984681",
"0.5967804",
"0.57844293",
"0.5726083",
"0.57112515",
"0.5710812",
"0.5707336",
"0.5707336",
"0.569271",
"0.56634426",
"0.5589972",
"0.5550989",
"0.55486476",
... | 0.68828434 | 0 |
Used for loading in model and word2vec files from disk. Returns their objects. | def LoadSavedModels(main_model_path="main_model.pkl",
cler_model_path="cler_model.pkl",
word2vec_path='GoogleNews-vectors-negative300.bin'):
model_main = joblib.load(main_model_path)
model_cler = joblib.load(cler_model_path)
word2vec = gensim.models.KeyedVector... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_vectors(path, to_train=False):\n model = Word2Vec.load(path)\n\n if to_train:\n return model\n\n # In case it doesn't need to be trained, delete train code to free up ram\n word_vectors = model.wv\n\n context_vectors = dict()\n if hasattr(model, \"syn1\... | [
"0.69597363",
"0.6947155",
"0.6811197",
"0.6807579",
"0.6805793",
"0.6797359",
"0.6768113",
"0.6706945",
"0.65690553",
"0.6520081",
"0.6514057",
"0.6461425",
"0.6448351",
"0.64457756",
"0.64116144",
"0.64102066",
"0.6408863",
"0.63833255",
"0.63704264",
"0.6347624",
"0.634755... | 0.7026279 | 0 |
Predict a label using the main model (clinical, clerical or other). Input is a sentence, along w/ model object and word2vec object. These objects can either be loaded from disk using the LoadSavedModels function, or, if you have just completed training, they can be passed in from the Train.Trainer class. May also adjus... | def PredictLabel(sentence, model_main, word2vec, boundary=0.5):
tokenized_sample = word_tokenize(re.sub("-"," ",sentence))
features = np.mean([word2vec.word_vec(w) for w in tokenized_sample if w in word2vec],axis=0)
prediction = model_main.predict_proba(features.reshape(1,-1))[0]
if model_main.clas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PredictClerLabel(sentence, model_cler, word2vec):\n \n tokenized_sample = word_tokenize(re.sub(\"-\",\" \",sentence))\n features = np.mean([word2vec.word_vec(w) for w in tokenized_sample if w in word2vec],axis=0)\n prediction = model_cler.predict_proba(features.reshape(1,-1))[0]\n return model_c... | [
"0.6959012",
"0.65132445",
"0.65114045",
"0.6501456",
"0.6449135",
"0.6394472",
"0.6369494",
"0.6363786",
"0.63258064",
"0.63060385",
"0.62783635",
"0.62781966",
"0.6276569",
"0.6266087",
"0.62624",
"0.61981785",
"0.61941963",
"0.61721903",
"0.6151807",
"0.6150158",
"0.613657... | 0.7438309 | 0 |
Predict a label use the clerical model. Input is a sentence, along w/ model object and word2vec object. These objects can either be loaded from disk using the LoadSavedModels function, or, if you have just completed training, they can be passed in from the Train.Trainer class. | def PredictClerLabel(sentence, model_cler, word2vec):
tokenized_sample = word_tokenize(re.sub("-"," ",sentence))
features = np.mean([word2vec.word_vec(w) for w in tokenized_sample if w in word2vec],axis=0)
prediction = model_cler.predict_proba(features.reshape(1,-1))[0]
return model_cler.classes_[p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PredictLabel(sentence, model_main, word2vec, boundary=0.5):\n \n tokenized_sample = word_tokenize(re.sub(\"-\",\" \",sentence))\n features = np.mean([word2vec.word_vec(w) for w in tokenized_sample if w in word2vec],axis=0)\n prediction = model_main.predict_proba(features.reshape(1,-1))[0]\n if m... | [
"0.6949452",
"0.6697954",
"0.6614793",
"0.65763474",
"0.6551022",
"0.65021735",
"0.6459889",
"0.6424772",
"0.64095986",
"0.63946915",
"0.6354461",
"0.6343086",
"0.6327474",
"0.62942815",
"0.62706435",
"0.6258738",
"0.6226277",
"0.62202674",
"0.62170017",
"0.62144226",
"0.6206... | 0.7439432 | 0 |
plots the fenics mesh as it is | def plot_fenics_mesh(mesh, new_fig=True):
if(new_fig):
plt.figure()
plot(mesh)
#plt.title("FEniCS mesh")
plt.show(block=False)
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_plot_mesh(self):\n plt.close('all')\n\n #\n # Initialize\n #\n fig, ax = plt.subplots(3,3)\n plot = Plot()\n #\n # Define mesh\n # \n mesh = Mesh.newmesh(grid_size=(2,2))\n mesh.refine() \n mesh.root_node().children[1... | [
"0.7348052",
"0.7272838",
"0.7201923",
"0.71683663",
"0.6932882",
"0.6908609",
"0.68675065",
"0.6819857",
"0.67012626",
"0.66765225",
"0.66062456",
"0.6585177",
"0.65265316",
"0.6516479",
"0.6515228",
"0.6511229",
"0.6509004",
"0.643969",
"0.64123374",
"0.6407074",
"0.6393894... | 0.7717216 | 0 |
plots the mesh/centroids of mesh as is expected in peridynamics either mesh or cell_cent is to be provided by user neither provinding mesh nor providing cell_cent is wrong | def plot_peridym_mesh(mesh=None, struct_grd=True, cell_cent=None, disp_cent=None, annotate=False):
if struct_grd:
cell_centroid_function = structured_cell_centroids
else:
cell_centroid_function = get_cell_centroids
if mesh == None and len(np.shape(cell_cent)) == 0 and len(np.shape(disp_cent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_plot_mesh(self):\n plt.close('all')\n\n #\n # Initialize\n #\n fig, ax = plt.subplots(3,3)\n plot = Plot()\n #\n # Define mesh\n # \n mesh = Mesh.newmesh(grid_size=(2,2))\n mesh.refine() \n mesh.root_node().children[1... | [
"0.6864378",
"0.6407954",
"0.6205415",
"0.61812276",
"0.61798674",
"0.60916793",
"0.609019",
"0.60803694",
"0.60406137",
"0.59588164",
"0.59557277",
"0.59142935",
"0.58919984",
"0.58745694",
"0.58541936",
"0.5786406",
"0.57543874",
"0.5720695",
"0.5686189",
"0.5673838",
"0.56... | 0.7505498 | 0 |
plots the displaced cell centroids after a solution step. Additionally retrns the final cell centroid after additon of displacement field in the orginal configuration | def get_displaced_soln(cell_cent, u_disp, horizon, dim, data_dir=None, plot_=False, save_fig=False, zoom=40):
disp_cent = cell_cent + u_disp
if plot_ or save_fig:
dpi = 2
legend_size = {'size': str(6*dpi)}
fig = plt.figure()
if dim == 2:
ax = fig.add_subplot(111)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotcenterrange():\n plist1 = np.arange(0.02,0.1,0.02)\n plist = np.arange(0.1,1,0.1)\n infectlist = []\n for i in plist1:\n infectlist.append(checkinfectb(0.5,20000,30,200,p = i,q = np.sqrt(2/(20000*math.pi)),startcenter=True)[0])\n for i in plist:\n infectlist.append(checkinfectb... | [
"0.61388534",
"0.6034441",
"0.58881974",
"0.5873742",
"0.58667403",
"0.58461356",
"0.5768717",
"0.5750362",
"0.56975144",
"0.5666557",
"0.5653945",
"0.56459886",
"0.5611346",
"0.558924",
"0.55840623",
"0.5583146",
"0.55808353",
"0.5573108",
"0.5564739",
"0.5562984",
"0.553712... | 0.63715124 | 0 |
creates a structured cell centroids and cell volumes of square or cubic lattice using the fenics mesh by averaging appropriate number of 2D/3D triangles | def structured_cell_centroids(mesh):
dim = mesh.topology().dim()
stride = fact(dim)
cents = get_cell_centroids(mesh)
num_cells = int(mesh.num_cells()/stride)
cell_cents_struct = np.zeros((num_cells,dim),dtype=float)
for i in range(num_cells):
start = int(stride*i)
end = int(st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cfdProcessGeometry(self):\r\n \r\n # self.faceCentroids']= [[] for i in range(self.numberOfFaces'])]\r\n # self.faceSf']= [[] for i in range(self.numberOfFaces'])]\r\n # self.faceAreas']= [[] for i in range(self.numberOfFaces'])]\r\n \r\n ## Linear weight of distance from cel... | [
"0.7054485",
"0.6528232",
"0.64348644",
"0.6230865",
"0.61347985",
"0.61224085",
"0.60659236",
"0.6059065",
"0.59654796",
"0.5924792",
"0.5886461",
"0.587063",
"0.58324575",
"0.5809455",
"0.5807334",
"0.5799182",
"0.57891464",
"0.5780056",
"0.5752148",
"0.5748409",
"0.5745303... | 0.68255717 | 1 |
generates a 3D box mesh with tetrahedral elements with a cylindrical hole in it input | def box_mesh_with_hole(point1=Point(0,0,0), point2=Point(2,1,1), cyl_cent1 = Point(1, -10, 0.5),
cyl_cent2= Point(1, 10, 0.5), cyl_rad=0.25, numpts=15):
Router = mshr.Box(point1, point2)
Rinner = mshr.Cylinder(cyl_cent1, cyl_cent2, cyl_rad, cyl_rad)
domain = Router - Rinner
mesh ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_lattice(box):\n from quippy.atoms import make_lattice\n if box.shape == (3, 3):\n\t# http://lammps.sandia.gov/doc/Section_howto.html#howto-12 Describes the\n\t# methodology (look for the section entitled \"6.12. Triclinic\n\t# (non-orthogonal) simulation boxes\") The [a, b, c, alpha, beta, gamma]\n\... | [
"0.63809776",
"0.62516385",
"0.6212014",
"0.61972636",
"0.6192103",
"0.6190166",
"0.6146428",
"0.60585725",
"0.604773",
"0.6045741",
"0.6044307",
"0.5990217",
"0.59825504",
"0.59320945",
"0.59280205",
"0.5914633",
"0.59137803",
"0.5881047",
"0.5878436",
"0.58624035",
"0.58605... | 0.6957271 | 0 |
returns the cell centroids lying within given geometric extents | def get_cell_centroid2(cents, extents):
cells_in_ee = np.empty(0,int)
for i in range(len(cents)):
c = cents[i]
if( (c > extents[0]).all() and (c <= extents[1]).all() ):
cells_in_ee = np.append(cells_in_ee, [i], axis=0)
return cells_in_ee | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_centroid_cell(self):\n\n x_min, y_min = self.find_min()\n x_max, y_max = self.find_max()\n x_centroid = int((x_max+x_min)/2)\n y_centroid = int((y_max+y_min)/2)\n centroide = x_centroid, y_centroid\n return centroide",
"def cells_centroid_py(self):\n A=se... | [
"0.6934343",
"0.688382",
"0.672464",
"0.66895455",
"0.6638991",
"0.65940636",
"0.65940636",
"0.6519114",
"0.6447519",
"0.63558304",
"0.6343967",
"0.62743145",
"0.6219808",
"0.6177495",
"0.6171115",
"0.6169734",
"0.6126709",
"0.6084704",
"0.60784847",
"0.60754013",
"0.6071603"... | 0.79571277 | 0 |
given a fenics mesh/mshr.mesh as argument, returns the centroid of the cells in the mesh input | def get_cell_centroids(mesh):
num_els = mesh.num_cells()
coords = mesh.coordinates()
cells = mesh.cells()
dim = len(coords[0])
cell_cent = np.zeros((num_els, dim), dtype=float, order='c')
for i in range(num_els):
pts = [coords[idx] for idx in cells[i]]
cell_cent[i] = (1/(dim+1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def structured_cell_centroids(mesh):\n dim = mesh.topology().dim()\n stride = fact(dim)\n cents = get_cell_centroids(mesh)\n num_cells = int(mesh.num_cells()/stride)\n cell_cents_struct = np.zeros((num_cells,dim),dtype=float)\n\n for i in range(num_cells):\n start = int(stride*i)\n ... | [
"0.7213677",
"0.68678993",
"0.68678993",
"0.68211424",
"0.67176604",
"0.6685038",
"0.6652162",
"0.6585276",
"0.65823853",
"0.6560574",
"0.65416116",
"0.65348834",
"0.64790154",
"0.64459264",
"0.6443465",
"0.6432527",
"0.64168453",
"0.63676035",
"0.63556105",
"0.6349497",
"0.6... | 0.7951323 | 0 |
given a fenics mesh, this function returns the bounding_box that fits around the domain | def get_domain_bounding_box(mesh=None, cell_cent=None):
def local_bbox_method(coords):
dim = len(coords[0])
corner_min = np.zeros(dim ,float)
corner_max = np.zeros(dim, float)
for d in range(dim):
corner_min[d] = min(coords[:,d])
corner_max[d] = max... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounds(self):\n return self._bboxes[0][0] #TODO: merge all coverages",
"def get_bounding_box(self):\n return self._domain.get_bounding_box()",
"def get_boundingbox(face, width, height, scale=1.3, minsize=None):\n x1 = face.left()\n y1 = face.top()\n x2 = face.right()\n y2 = face.bottom... | [
"0.68726236",
"0.6643377",
"0.66258126",
"0.6624291",
"0.66229665",
"0.6602934",
"0.659407",
"0.6578977",
"0.6496308",
"0.6475542",
"0.63955826",
"0.6387074",
"0.6363856",
"0.63531804",
"0.63405913",
"0.6319945",
"0.6304606",
"0.62939525",
"0.6264529",
"0.62618446",
"0.625956... | 0.7623161 | 0 |
given a set of cell centroid beloning to regular (Square/Tri) discretization in 2D/3D, the method returns the edge length | def get_peridym_edge_length(cell_cent, struct_grd=False):
dim = len(cell_cent[0])
el = np.zeros(dim, dtype = float)
if(struct_grd):
el_fact = 1.0
else:
el_fact = 3.0
for d in range(dim):
xx = np.unique(cell_cent[:,d])
el[d] = el_fact*np.max(np.abs(np.diff(xx[0:2])))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_centroids_original(crd, con):\n \n nele = con.shape[0]\n dim = crd.shape[1]\n centroid_xy = np.zeros((nele, dim))\n for i in range(len(con)):\n el_crds = crd[con[i, :], :] # (4, 2)\n centroid_xy[i, :] = (el_crds).mean(axis=0)\n return centroid_xy",
"def cell_edges(self):",
... | [
"0.6159054",
"0.610381",
"0.6095435",
"0.6027462",
"0.6002276",
"0.59965074",
"0.5987988",
"0.58697575",
"0.58489704",
"0.5763668",
"0.574332",
"0.5738635",
"0.57146585",
"0.5661359",
"0.5644903",
"0.56421226",
"0.5631822",
"0.5622291",
"0.55991775",
"0.55730665",
"0.5567386"... | 0.6498209 | 0 |
returns list of markers to be used for plt functions; max markers allowed = 18 | def get_markers(num_markers):
markers = ['^','o','P','X','*', 'd','<', '>', ',','|', '1','2','3','4','s','p','*','h','+']
if(num_markers>18):
sys.exit("cannot create more than 18 markers, refactor your code; force exiting")
return markers[0:num_markers] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_markerstyles(n=None):\n all_markers = ['o', 'D', 's', '2', '*', 'h', '8', 'v', 'x', '+', 5, 'd', '>', 7, '.', '1', 'p', '3',\n 6, 0, 1, 2, 3, 4, '4', '<', 'H', '^']\n # Note: 0: 'tickleft', 1: 'tickright', 2: 'tickup', 3: 'tickdown', 4: 'caretleft', 'D': 'diamond', 6: 'caretup',\n ... | [
"0.65396273",
"0.6017809",
"0.5980015",
"0.5968961",
"0.5907878",
"0.5887821",
"0.5838874",
"0.5838874",
"0.5829966",
"0.58082724",
"0.5748896",
"0.5732162",
"0.5673139",
"0.5570676",
"0.5556668",
"0.5437964",
"0.5424193",
"0.5405786",
"0.53380895",
"0.53265303",
"0.5313803",... | 0.74688494 | 0 |
Basic attach/detach IPv6 test with single UE | def test_attach_detach_ipv6(self):
num_ues = 2
detach_type = [
s1ap_types.ueDetachType_t.UE_NORMAL_DETACH.value,
s1ap_types.ueDetachType_t.UE_SWITCHOFF_DETACH.value,
]
wait_for_s1 = [True, False]
self._s1ap_wrapper.configUEDevice(num_ues)
# Defaul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mgre6(self):\n\n self.pg0.config_ip6()\n self.pg0.resolve_ndp()\n\n e = VppEnum.vl_api_tunnel_encap_decap_flags_t\n\n for itf in self.pg_interfaces[3:]:\n #\n # one underlay nh for each overlay/tunnel peer\n #\n itf.config_ip6()\n ... | [
"0.6983675",
"0.6860099",
"0.6674686",
"0.6540398",
"0.6405422",
"0.63681173",
"0.6198082",
"0.61734575",
"0.6095474",
"0.6050625",
"0.602617",
"0.6024223",
"0.59982115",
"0.59627396",
"0.59101856",
"0.58795923",
"0.5868089",
"0.58631897",
"0.5853766",
"0.5821142",
"0.5754354... | 0.83120114 | 0 |
Create a Pandas DataFrame out of a .yaml file. Examples | def yaml_to_pandas(filename: str) -> Tuple[pd.DataFrame, Optional[str]]:
# Read the yaml file
with open(filename, 'r') as f:
dict_ = yaml.load(f, Loader=yaml.SafeLoader)
project = dict_.pop("__project__", None)
# Convert the yaml dictionary into a dataframe
data: Dict[str, Dict[Tuple[Hashab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_to_dataframe(\n filename: Union[Path, str],\n marker: str = \"---\",\n csv_options: Optional[Dict[str, Any]] = None,\n yaml_options: Optional[Dict[str, Any]] = None,\n) -> Tuple[DataFrame, Dict[str, Any]]:\n if DataFrame is None:\n raise ModuleNotFoundError(\n \"Module pan... | [
"0.6223266",
"0.6129303",
"0.6100554",
"0.60840815",
"0.6082889",
"0.5902778",
"0.5898788",
"0.5859711",
"0.5854862",
"0.5829673",
"0.5819154",
"0.58064884",
"0.58064884",
"0.5772481",
"0.5768575",
"0.57589835",
"0.5717933",
"0.5713953",
"0.5706922",
"0.5706922",
"0.5701406",... | 0.6970648 | 0 |
Validate that all users belonging to an account are available in the .yaml input file. Raises a KeyError If one or more usernames printed by the ``accinfo`` comand are absent from df. | def validate_usernames(df: pd.DataFrame) -> None:
_usage = check_output(['accinfo'], encoding='utf8')
iterator = filter(None, _usage.splitlines())
for i in iterator:
if i == "# Users linked to this account":
usage = np.array(list(iterator), dtype=np.str_)
break
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_user_data(user_data):\n return 'account_ids' in user_data and 'monthly_expenses' in user_data",
"def load_users():\n try:\n # json file should be in the same file location as the function\n base_dir = os.path.dirname(__file__)\n abs_file = os.path.join(base_dir, 'users.json')... | [
"0.5713202",
"0.5615229",
"0.56124175",
"0.556478",
"0.5467763",
"0.5272703",
"0.5202546",
"0.52003455",
"0.5149381",
"0.5146254",
"0.51337475",
"0.5124031",
"0.509678",
"0.5084452",
"0.5061947",
"0.5024947",
"0.5024677",
"0.49984267",
"0.49967858",
"0.4986641",
"0.49853197",... | 0.76862663 | 0 |
This is our handler for the menu item. Our inItemRef is the refcon we registered in our XPLMAppendMenuItem calls. It is either +1000 or 1000 depending on which menu item is picked. | def MyMenuHandlerCallback(self, inMenuRef, inItemRef):
if (self.DataRef != 0):
"""
We read the data ref, add the increment and set it again.
This changes the nav frequency.
"""
X... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_menu ( self, menu_item ):\r\n pass",
"def on_menu_item(self, e):\n if e.Id == ids.RESTORE:\n wx.PostEvent(self.app.roster, ev.ShowRoster())\n elif e.Id == ids.HIDE:\n wx.PostEvent(self.app.roster, ev.HideRoster())\n elif e.Id == ids.EXIT:\n ... | [
"0.61091536",
"0.57265496",
"0.55302376",
"0.5491266",
"0.5436538",
"0.5421155",
"0.54151934",
"0.54015744",
"0.53766143",
"0.5230789",
"0.5225447",
"0.522308",
"0.5221148",
"0.5216817",
"0.5182499",
"0.5182356",
"0.51636726",
"0.5154699",
"0.51006156",
"0.5060227",
"0.505950... | 0.7293928 | 0 |
Normalize the batch data, use coordinates of the block centered at origin, | def normalize_data(batch_data):
B, N, C = batch_data.shape
normal_data = np.zeros((B, N, C))
for b in range(B):
pc = batch_data[b]
centroid = np.mean(pc, axis=0)
pc = pc - centroid
m = np.max(np.sqrt(np.sum(pc ** 2, axis=1)))
pc = pc / m
normal_data[b] = pc
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize(self, dataset):\n if self.max is None: # if we are normalizing the training set\n self.max, self.min = dataset.max(), dataset.min() # find max, min value for each columns\n for row in dataset.index: # for each row in dataset\n for c... | [
"0.69384634",
"0.68707067",
"0.6639805",
"0.6637574",
"0.65870476",
"0.647955",
"0.644119",
"0.63818425",
"0.6363857",
"0.626459",
"0.62471074",
"0.62398934",
"0.62313163",
"0.6193541",
"0.6191717",
"0.61898583",
"0.618904",
"0.61679614",
"0.6146879",
"0.61388755",
"0.6138875... | 0.7281029 | 0 |
Shuffle orders of points in each point cloud changes FPS behavior. Use the same shuffling idx for the entire batch. | def shuffle_points(batch_data):
idx = np.arange(batch_data.shape[1])
np.random.shuffle(idx)
return batch_data[:,idx,:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle_points(batch_data):\n idx = np.arange(batch_data.shape[1])\n np.random.shuffle(idx)\n return batch_data[:, idx, :]",
"def shuffle_points(mutated_genome,index):\n random.shuffle(mutated_genome[index][2])",
"def _shuffle_roidb_idx(self):\n self.perm = np.random.permutation(np.arange... | [
"0.72801876",
"0.72373664",
"0.6753397",
"0.6724248",
"0.65495604",
"0.6484776",
"0.6474384",
"0.6474384",
"0.6457585",
"0.64205366",
"0.6403728",
"0.6389177",
"0.63853645",
"0.6350583",
"0.6297481",
"0.62960184",
"0.62893575",
"0.62821025",
"0.6237439",
"0.62186027",
"0.6217... | 0.725899 | 1 |
Randomly shift point cloud. Shift is per point cloud. | def shift_point_cloud(batch_data, shift_range=0.1):
B, N, C = batch_data.shape
shifts = np.random.uniform(-shift_range, shift_range, (B,3))
for batch_index in range(B):
batch_data[batch_index,:,:] += shifts[batch_index,:]
return batch_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift(self):\n \"\"\"\n shift cluster randomly within bounds of im\n \"\"\"\n r = self.std\n mid = self.mid_pixel #center pixel index of 384x384 image\n delta = self.im_size - self.mid_pixel - r - 10\n \n x = np.random.randint(low=-1*delta,high=delta,size... | [
"0.72441024",
"0.6811636",
"0.64971095",
"0.61066484",
"0.60589975",
"0.5939156",
"0.593459",
"0.5932551",
"0.5909121",
"0.57994634",
"0.57626474",
"0.5751564",
"0.57320094",
"0.57160926",
"0.5685124",
"0.56692094",
"0.56554824",
"0.564319",
"0.56338567",
"0.5614417",
"0.5607... | 0.7352118 | 0 |
Randomly scale the point cloud. Scale is per point cloud. | def random_scale_point_cloud(batch_data, scale_low=0.8, scale_high=1.25):
B, N, C = batch_data.shape
scales = np.random.uniform(scale_low, scale_high, B)
for batch_index in range(B):
batch_data[batch_index,:,:] *= scales[batch_index]
return batch_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_point_cloud(batch_data, scale_ratio=0.8):\n B, N, C = batch_data.shape\n scale = np.random.uniform(scale_ratio,1/scale_ratio,(B,1,1))\n scaled_data = batch_data*scale\n return scaled_data",
"def ScalePoints(points, sigma = 0.02):\n assert(points.shape[1]==3)\n\n scale = np.random.unif... | [
"0.76311445",
"0.6895509",
"0.67543155",
"0.64973104",
"0.63981426",
"0.62324494",
"0.6162519",
"0.6148883",
"0.6085778",
"0.60736156",
"0.59713405",
"0.5954016",
"0.5944525",
"0.5929756",
"0.58707345",
"0.5869925",
"0.58671856",
"0.58244807",
"0.5817822",
"0.57851666",
"0.57... | 0.76930815 | 0 |
return list of id of unread emails | def get_unread_email_ids(gmail_client):
response = gmail_client.users().messages().list(userId='me',q='is:unread').execute()
if 'messages' in response: # messages key only exists if there are unread messages
return [message['id'] for message in response['messages']]
else:
print("No unread m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_unread_emails(self):\n try:\n query = 'is:unread from:scholaralerts-noreply@google.com'\n page_token = None\n p_emails = []\n while True:\n request = self.service.users().messages().list(userId='me',\n ... | [
"0.7194147",
"0.70722127",
"0.70129013",
"0.69660854",
"0.6963227",
"0.6954459",
"0.69394183",
"0.69240445",
"0.691629",
"0.68746626",
"0.68267304",
"0.67761564",
"0.67230296",
"0.6694524",
"0.6601468",
"0.6559419",
"0.6427694",
"0.6418745",
"0.6417917",
"0.63268363",
"0.6284... | 0.8231231 | 0 |
Create a k cluster data set with required separation. For the purposes of validating a proof, generate each cluster center such that it is at least 4 delta away from any other cluster for some value of delta > 0. | def gen_k_centers(k, dim):
delta = abs(np.random.normal(0.0, 5.0))
eps = 0.001
centers = []
for i in range(k):
c = np.random.multivariate_normal(np.zeros(dim), np.identity(dim))
if len(centers):
c1 = centers[0]
x = np.random.multivariate_normal(c1, np.identity(c1.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_clusters(self):\n ex = 0\n print 'Iter - Purity Gini Index'\n while ex < self.MAX_ITERATION:\n new_clusters = np.zeros(self.centroids.shape)\n distances = euclidean_distances(self.vectors, self.centroids).argmin(axis=1)\n for i in ran... | [
"0.7273148",
"0.7161901",
"0.71461064",
"0.70277727",
"0.6989481",
"0.6961698",
"0.69509083",
"0.6936706",
"0.69362247",
"0.68879706",
"0.68621993",
"0.67435825",
"0.6723467",
"0.67071426",
"0.67059225",
"0.66942155",
"0.66667116",
"0.6627539",
"0.6592454",
"0.6569137",
"0.65... | 0.73497814 | 0 |
Create a deltaseparated dataset. For each of the centers draw size number of points. No two points may be farther than delta away form each other. Thus, to generate each point, choosea random direction and random distance from the center (of up to 0.5 delta). | def _create_constrained_dataset(centers, delta, size):
dataset = []
count = 0
for i, c in enumerate(centers):
for j in range(size):
x = np.random.multivariate_normal(c, np.identity(np.size(c))) - c
direction = x / np.linalg.norm(x)
magnitude = np.random.uniform(0.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_point_cloud(n:int, d:int = 2, seed=1234) -> np.ndarray:\n initial_seed = np.random.get_state()\n np.random.seed(seed)\n points = np.random.rand(n, d)\n np.random.set_state(initial_seed)\n return points",
"def generate(self, n, d, seperation=4.0, pos_fraction=0.5):\n self.n = n\... | [
"0.6200814",
"0.60125065",
"0.6008298",
"0.58964354",
"0.5652766",
"0.5627772",
"0.56074226",
"0.55708045",
"0.55676484",
"0.54426163",
"0.54371774",
"0.5432757",
"0.54286873",
"0.5412957",
"0.53979236",
"0.53931975",
"0.53886104",
"0.5388139",
"0.5384613",
"0.53822875",
"0.5... | 0.70498824 | 0 |
Create a 5x5 grid of cluster centers. Create 25 cluster centers on the grid I^{[0, 4] x [0,4]}. Each center is a gaussian with standard covariance | def _5x5_grid_clusters():
return [mn(mean=np.array([i, j]), cov=np.array([[1.0, 0.0],
[0.0, 1.0]]))
for i in range(5)
for j in range(5)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _5x5_grid_clusters_spread():\n return [mn(mean=np.array([i * 25, j * 25]), cov=np.array([[1.0, 0.0],\n [0.0, 1.0]]))\n for i in range(5)\n for j in range(5)]",
"def _10x10_grid_clusters_spread():\n return [mn(mean=np.array([i * 25... | [
"0.76212066",
"0.7217054",
"0.71860254",
"0.69142705",
"0.68518704",
"0.68461156",
"0.66278195",
"0.66259587",
"0.6578559",
"0.63746804",
"0.63681006",
"0.63251126",
"0.6259267",
"0.62513924",
"0.6211149",
"0.62032765",
"0.61599225",
"0.6159027",
"0.6151934",
"0.6151934",
"0.... | 0.8075378 | 0 |
Create a 5x5 grid of cluster centers. Create 25 cluster centers on the grid I^{[0, 4] x [0,4]}. Each center is a gaussian with standard covariance | def _5x5_grid_clusters_spread():
return [mn(mean=np.array([i * 25, j * 25]), cov=np.array([[1.0, 0.0],
[0.0, 1.0]]))
for i in range(5)
for j in range(5)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _5x5_grid_clusters():\n return [mn(mean=np.array([i, j]), cov=np.array([[1.0, 0.0],\n [0.0, 1.0]]))\n for i in range(5)\n for j in range(5)]",
"def _10x10_grid_clusters_spread():\n return [mn(mean=np.array([i * 25, j * 25]), cov=np.array([[... | [
"0.8075657",
"0.7216367",
"0.7186302",
"0.691356",
"0.68508494",
"0.6845249",
"0.66261995",
"0.6625447",
"0.6577691",
"0.6374363",
"0.63676125",
"0.6322932",
"0.625821",
"0.6250707",
"0.6211498",
"0.6203698",
"0.6160035",
"0.6157637",
"0.6151316",
"0.6151316",
"0.6094953",
... | 0.762155 | 1 |
Create random cluster centers. Create n cluster centers randomly. Each cluster center is a draw from a gaussian distribution centered at (0,0) with standard covariance. | def _random_standard_centers(n=100):
generator = mn(mean=np.array([0, 0]),
cov=np.array([[1.0, 0.0], [0.0, 1.0]]))
return [mn(mean=pt, cov=np.array([[1.0, 0.0], [0.0, 1.0]]))
for pt in generator.rvs(size=n)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_sample_clusters(n_clusters, n_points, n_features=2, std=2, seed=1, limits=(-10, 10)):\n points_per_cluster = n_points // n_clusters\n np.random.seed(seed=seed)\n centroids = []\n for _ in range(n_features):\n centroids.append(np.random.randint(limits[0], limits[1], size=n_clusters))\n\n... | [
"0.76822317",
"0.76259226",
"0.73836875",
"0.7335838",
"0.7241687",
"0.7094557",
"0.7092686",
"0.7072594",
"0.7042424",
"0.6994134",
"0.6977371",
"0.69499964",
"0.6929814",
"0.6919069",
"0.6892269",
"0.6817309",
"0.6758312",
"0.6726237",
"0.6718225",
"0.66974187",
"0.6696951"... | 0.7926905 | 0 |
Returns the path for userspecific blender scripts for all major platforms | def getScriptsPath(blenderversion):
if sys.platform == 'linux':
scriptspath = os.path.normpath(
os.path.expanduser('~/.config/blender/{0}/scripts'.format(blenderversion))
)
elif sys.platform == 'darwin':
scriptspath = os.path.normpath(
os.path.expanduser(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBlenderConfigPath(blenderversion):\n if sys.platform == 'linux':\n scriptspath = os.path.normpath(\n os.path.expanduser('~/.config/blender/{0}/config'.format(blenderversion))\n )\n elif sys.platform == 'darwin':\n scriptspath = os.path.normpath(\n os.path.exp... | [
"0.6769609",
"0.62371445",
"0.60271466",
"0.590203",
"0.5760948",
"0.5753",
"0.57450694",
"0.57419586",
"0.57419586",
"0.5724369",
"0.5693562",
"0.5689543",
"0.56795627",
"0.5673507",
"0.5627154",
"0.5591305",
"0.55765843",
"0.55733895",
"0.55558956",
"0.5554302",
"0.55541027... | 0.72838265 | 0 |
Returns the path for configuration data for all major platforms | def getConfigPath():
if sys.platform == 'linux':
configpath = os.path.normpath(os.path.expanduser('~/.config/phobos'))
elif sys.platform == 'darwin':
configpath = os.path.normpath(os.path.expanduser('~/Library/Application Support/phobos'))
elif sys.platform == 'win32':
configpath = o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform_config_dir():\n if POSIX: # nocover\n dpath_ = os.environ.get('XDG_CONFIG_HOME', '~/.config')\n elif DARWIN: # nocover\n dpath_ = '~/Library/Application Support'\n elif WIN32: # nocover\n dpath_ = os.environ.get('APPDATA', '~/AppData/Roaming')\n else: # nocover\n ... | [
"0.7201866",
"0.67362136",
"0.6644315",
"0.66377807",
"0.6636949",
"0.66022515",
"0.65694153",
"0.65639627",
"0.65615714",
"0.64916116",
"0.64902836",
"0.64741963",
"0.6470176",
"0.6469606",
"0.6384029",
"0.6373276",
"0.63566935",
"0.63498926",
"0.63385725",
"0.6334437",
"0.6... | 0.72742504 | 0 |
Returns the configuration path for userspecific blender data. | def getBlenderConfigPath(blenderversion):
if sys.platform == 'linux':
scriptspath = os.path.normpath(
os.path.expanduser('~/.config/blender/{0}/config'.format(blenderversion))
)
elif sys.platform == 'darwin':
scriptspath = os.path.normpath(
os.path.expanduser(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cfg_path(self):\n return self._cfg_path",
"def config_file_and_path():\n return str(rmfriend_dir() / 'config.cfg')",
"def configPath(self):\n return os.path.dirname(__file__)",
"def get_config_file_location():\n\n return './' + CONFIG_FILE_NAME",
"def get_data_path(name):\n js = ... | [
"0.72044575",
"0.6985214",
"0.6869317",
"0.68644977",
"0.67701125",
"0.6757046",
"0.67386943",
"0.6731083",
"0.66863096",
"0.66134137",
"0.6526606",
"0.650571",
"0.65033567",
"0.65007305",
"0.64274645",
"0.6427291",
"0.64223856",
"0.64209414",
"0.6402593",
"0.6392462",
"0.634... | 0.7370779 | 0 |
Calculate the area of each grid cell for a userprovided grid cell resolution. Area is in square meters, but resolution is given in decimal degrees. | def do_grid (resolution):
# Calculations needs to be in radians
lats = np.deg2rad(np.arange(-57,84, resolution))
r_sq = 6371000**2
n_lats = int(360./resolution)
area = r_sq*np.ones(n_lats)[:, None]*np.deg2rad(resolution)*(
np.sin(lats[1:]) - np.sin(lats[:-1]))
return area.T | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid_area(ulon,ulat):\n R = 6371. * 1000. # radius of Earth in meters\n dlon = N.diff(ulon)\n dlat = N.diff(ulat)\n dx = N.outer(deg2rad * R * N.cos(deg2rad * ulat),dlon) # dx (meters)\n dy = 60. * 1852. * dlat # dy (meters)\n area = (dx[1:] + dx[:-1])... | [
"0.6939898",
"0.6827993",
"0.6783789",
"0.6774796",
"0.6750549",
"0.67404014",
"0.6659824",
"0.6657721",
"0.66374826",
"0.66325015",
"0.6627994",
"0.6614619",
"0.65675646",
"0.653298",
"0.6518739",
"0.64830256",
"0.6461933",
"0.6324823",
"0.63124484",
"0.6302911",
"0.6300791"... | 0.743558 | 0 |
Integrate dy/dt = rhs_func from t=0 to t=num_days with y(0) = y0. Returns a list of state vectors, one for each day. | def integrate(rhs_func, y0, num_days, iterations_per_day):
out = [y0.clone()]
y = y0.clone()
t = 0
dt = 1 / iterations_per_day
for day in range(num_days):
for it in range(iterations_per_day):
y += dt * rhs_func(y, t)
t += dt
# y, t = RK4_step(rhs_func,y,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integrateTransients(self, numdays=500):\n tend = numdays * 24.0\n\n r = sp.integrate.solve_ivp(self.derv, (0, tend), [0.7, 0.0, 0.0], t_eval=[tend], method='Radau')\n results_trans = np.transpose(r.y)\n\n return (results_trans[-1, :])",
"def integrate_explicit(self, y, derivative,... | [
"0.650054",
"0.5741845",
"0.5683879",
"0.54373115",
"0.54229563",
"0.53735167",
"0.5365727",
"0.5364101",
"0.53461295",
"0.5233571",
"0.5200717",
"0.518434",
"0.5144111",
"0.513495",
"0.51227826",
"0.5083833",
"0.5077746",
"0.5073881",
"0.5071325",
"0.504791",
"0.5043892",
... | 0.78576934 | 0 |
This function takes a SOM or SO and goes through the individual spectra adjusting the bin contents by either multiplying or dividing by the bin widths or the bin centers taken from the individual spectra. | def fix_bin_contents(obj, **kwargs):
import hlr_utils
# set up for working through data
(result, res_descr) = hlr_utils.empty_result(obj)
o_descr = hlr_utils.get_descr(obj)
# Setup keyword arguments
try:
scale = kwargs["scale"]
except KeyError:
scale = False
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binspecdat( wavelength, flux, fluxerr=[], binwidth=10, sigclip=0, sumerrs=False,\n wstart=0, wend=0 ):\n\n w,f = wavelength, flux\n wbinned, fbinned = [], []\n wbin,fbin,dfbin = np.array([]), np.array([]), np.array([])\n dw, df = [], []\n if wstart : istart = np.where( w>wstart )[... | [
"0.5740556",
"0.5733101",
"0.57284594",
"0.5622216",
"0.55848444",
"0.5580762",
"0.5569622",
"0.55688787",
"0.5552011",
"0.5551858",
"0.5550779",
"0.5461542",
"0.5432613",
"0.5347965",
"0.528338",
"0.52451",
"0.5242152",
"0.5237068",
"0.5206165",
"0.52003783",
"0.5179254",
... | 0.63741106 | 0 |
Returns a feature vector for features given a certain task, model and similarity strategy | def _get_features(task, features, model, similarity_strategy=None):
X = []
langs = analysis_utils.get_langs_for_task(task)
for feature in features:
if feature != "size":
# this is a nested array
X_feature = analysis_utils.load_lang2vec_vectors(task=task, features=feature)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def features(self, img, tasks):\n ensemble_probs = []\n\n model_iterable = self.tasks2models[tasks]\n ensemble_results = []\n for model in model_iterable():\n individual_feats = model.module.features2(img)\n ensemble_results.append(individual_feats)\n\n retu... | [
"0.6269173",
"0.60586506",
"0.6025307",
"0.60061306",
"0.5941046",
"0.58661604",
"0.58194387",
"0.5813026",
"0.58017576",
"0.5770882",
"0.5751222",
"0.572277",
"0.56830263",
"0.56766546",
"0.56654996",
"0.5664544",
"0.5647656",
"0.5646675",
"0.56205535",
"0.55783176",
"0.5547... | 0.76417094 | 0 |
Check that using a in filter with an empty list provided as input returns no objects. | def test_in_filter_with_empty_list(query):
Pet.objects.create(name="Brutus", age=12)
Pet.objects.create(name="Mimi", age=8)
Pet.objects.create(name="Picotin", age=5)
schema = Schema(query=query)
query = """
query {
pets (name_In: []) {
edges {
node {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_filter(item, *args, **kwargs):\n return True",
"def is_empty(self):\n return not list(self._filtered_items)",
"def is_empty(self):\n\n return self.some().map(lambda b: not b)",
"def test_empty_list_error(self):\n with self.assertRaises(ValueError):\n function_incl... | [
"0.6915782",
"0.68769324",
"0.6442358",
"0.64264005",
"0.6415718",
"0.63710684",
"0.62980837",
"0.6274831",
"0.6274831",
"0.62719107",
"0.6263292",
"0.62174505",
"0.61688304",
"0.61556524",
"0.6136472",
"0.6135395",
"0.61337715",
"0.6123703",
"0.61021626",
"0.60987234",
"0.60... | 0.70211446 | 0 |
Test in filter o an choice field not using an enum (Film.genre). | def test_choice_in_filter_without_enum(query):
john_doe = Reporter.objects.create(
first_name="John", last_name="Doe", email="john@doe.com"
)
jean_bon = Reporter.objects.create(
first_name="Jean", last_name="Bon", email="jean@bon.com"
)
documentary_film = Film.objects.create(genre="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_filterval(filterval):\n if filterval != 'description' and filterval != 'fulldescription' and filterval != 'completed':\n return False\n else:\n return True",
"def filter_generation_type(self, what):\n return self.form.set_value('generation type', what)",
... | [
"0.54397243",
"0.53808635",
"0.5250568",
"0.5232108",
"0.52033514",
"0.51955026",
"0.51942164",
"0.5174951",
"0.5173452",
"0.5173218",
"0.516942",
"0.5157201",
"0.5134928",
"0.50926733",
"0.50899726",
"0.5082016",
"0.50662625",
"0.5031735",
"0.5031735",
"0.5029781",
"0.501617... | 0.6587683 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.