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
Test quantitative equivalence with emergent on the neuron tutorial.
def test_emergent_neuron(self): check = True for adapt_on in [False, True]: neuron_data = data.parse_unit('neuron_adapt.dat' if adapt_on else 'neuron.dat') spec = leabra.UnitSpec(adapt_on=adapt_on, noisy_act=True, g_bar_e=0.3, g_bar_l=0.3, g_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_neuron(self):\r\n # crear una lista 1-D (Horizontal, Entradas).\r\n Z = [1, 2, 3]\r\n # crear una lista 1-D (Vertical, Pesos de la red).\r\n W = [10, 20, 30]\r\n # Inicializamos la neurona, y obtenemos el valor que toma dado W * Z\r\n # X(k) = W * Z\r\n res...
[ "0.6686928", "0.6533093", "0.6525016", "0.64122593", "0.6292761", "0.62885284", "0.622003", "0.62067026", "0.61581796", "0.6143428", "0.61156917", "0.61012167", "0.6086759", "0.6082188", "0.6054977", "0.6037327", "0.60279274", "0.6006935", "0.60018116", "0.59948033", "0.59834...
0.6972024
0
Add a list of excluded participants based on a set of usernames. Can't base on user_id because there are duplicate user_id's with the same user name
def add_excl_parts(db, usernames): desc = "Replicating the effect " + \ "of priming with common vs rare ideas in individual " + \ "brainstorming with revised interface" exp_id= 'tN33ATDiCukWfj5G7' # exps = db.experiments.find() exp = db.experiments.find_one({'_id': exp_id}) db.experiments...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_usernames(self, usernames):\n\t\tself.usernames += self._coerce_list(usernames)", "def get_ingred_exclusions(user_id):\n\n exclusions = ExcludedIngredient.query.filter_by(user_id=user_id).all()\n if exclusions:\n exclusion_list = []\n for exclusion in exclusions:\n exclu...
[ "0.60056657", "0.58411485", "0.5776767", "0.57505184", "0.57505184", "0.57290083", "0.5695878", "0.5579431", "0.5529767", "0.5501804", "0.549265", "0.5400099", "0.53770614", "0.5350103", "0.5335042", "0.53326446", "0.52876663", "0.52876663", "0.52825737", "0.52825737", "0.528...
0.69511336
0
Constructor that sets the data root directory of the utility and the parameters of the database to operate on
def __init__(self, data_path='data', db_params=ideagens): my_path = path.abspath(data_path) self.path = my_path self.db_params = db_params self.db = get_db(self.db_params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.filepath = os.path.dirname(__file__)\n self.filepath = os.path.join(self.filepath, \"Datenbank\")\n self.filepath_render_database = os.path.join(self.filepath, self.render_database)\n self.filepath_object_database = os.path.join(self.filepath, self.object_data...
[ "0.7692113", "0.7485547", "0.7096281", "0.70213985", "0.6860665", "0.68553454", "0.6828117", "0.6802415", "0.67979676", "0.6768281", "0.6652036", "0.6593271", "0.65823466", "0.65577674", "0.65354234", "0.6481026", "0.6476851", "0.64603406", "0.6454555", "0.6447259", "0.644643...
0.78404117
0
Get a list of documents from the db collection for specified fields only. fields is list of field names for each document.
def get_data(self, collection, fields=None, filters=None): data = self.db[collection].find(filters) if fields is None: return data else: filtered_data = [] for doc in data: rowDict = {} for field in fields: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only(self, *fields):\n for field in fields:\n path = \".\".join(self.document._meta.resolve_subfield_hierarchy(field.split(\".\")))\n self._only_fields.add(path)\n if self.query._Cursor__fields is None:\n # Identifier and version fields must always be included\n self.query._Curs...
[ "0.6406087", "0.6140172", "0.6130618", "0.6042337", "0.60035366", "0.5963449", "0.5830266", "0.57392967", "0.57133764", "0.5711136", "0.56971174", "0.56897503", "0.56877464", "0.56624216", "0.5639431", "0.5594121", "0.5571269", "0.55386645", "0.55327886", "0.552651", "0.55089...
0.6569988
0
Perform a similar operation to a sql join for 2 sets of data. base_data list of fields to extend with joined data join_data dictionary of data, indexed by base_field value base_field value to use as key in lookup in join_data dictionary join_fields list of field data to replace the base_field id The modified base_data ...
def join_data(self, base_data, join_data, base_field, join_fields): for data in base_data: extra = join_data[data[base_field]] for field in join_fields: data[field] = extra[field] return base_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_join(data: JoinedQueryData, verbose: bool) -> str:\n # The collection (sometimes referred to as \"type\" in the docs) to join\n string = 'type:' if verbose else ''\n string += str(data.collection)\n # The fields used to link the two collections\n if (parent := data.field_on) is not None:...
[ "0.63011765", "0.6102088", "0.6041325", "0.58504885", "0.58337146", "0.5824748", "0.5823174", "0.5774815", "0.5771162", "0.5677486", "0.5626348", "0.5621308", "0.5617843", "0.55927736", "0.55664855", "0.54893863", "0.5447424", "0.5423097", "0.5384637", "0.5383763", "0.5378737...
0.8677487
0
Get a list of all the ideas
def get_ideas(self): fields = ['content', 'clusterIDs', 'isGamechanger', 'userID', 'promptID'] return self.get_data("ideas", fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_meals():", "def get_queryset(self):\n return Objective.objects.filter(perspective__description='Learning and Capacity').order_by('code')", "def get_assay_solutions(self):\n vocabs = []\n assay = self.get_assay()\n if not assay:\n return vocabs\n for sol...
[ "0.6047027", "0.596079", "0.5894852", "0.5878744", "0.5878744", "0.58675534", "0.5793577", "0.57694536", "0.57275474", "0.57194996", "0.5701384", "0.5672025", "0.56617755", "0.56588876", "0.56406057", "0.56047946", "0.5599134", "0.5578972", "0.5569903", "0.5548997", "0.554799...
0.6485765
0
This function creates 2 csv files (m_GreenPiece.csv and m_RedPiece.csv) based on the chess piece list data
def genDataFiles(self, pieceList): b_list, r_list = list(), list() for i in range(len(pieceList)): eval("{}.append((pieceList[i]['Name'], pieceList[i]['Pos']))".format('b_list' if pieceList[i]['Team'] == -1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file(self):\n result = []\n completePath = CompletePath(self.path, self.filename) \n with open(completePath.path(), 'w', newline='') as csvfile:\n fieldnames = ['Activity', 'Points']\n writer = csv.DictWriter(csvfile, fieldnames = fieldnames)\n writer.writ...
[ "0.577005", "0.56117916", "0.54306716", "0.5400523", "0.53685206", "0.5366225", "0.5328159", "0.53274345", "0.53264546", "0.5310038", "0.52820057", "0.52732444", "0.52692014", "0.52437043", "0.52368194", "0.522381", "0.5191414", "0.5183072", "0.5179588", "0.5169188", "0.51512...
0.78872997
0
This function checks whether the BoardData_update.csv is still open to avoid problem when writing to that file
def checkOpenStatus(self): xl = win32.gencache.EnsureDispatch('Excel.Application') update_file = "BoardData_update.csv" update_file_pth = os.path.join(self.current_dir, 'src', update_file) if xl.Workbooks.Count > 0: print("opened: ", xl.Workbooks.Count) # if non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check_write_success(self, update_data, path, method):\n #Initiate line-counter\n current_line = 1\n #Calculate what line will have the row we are looking for.\n looking_for_line = self.__row_id_in_file(list(update_data)[0])\n row_id = list(update_data)[0]\n #open fil...
[ "0.5843392", "0.58275557", "0.5788735", "0.57246226", "0.5717325", "0.56745094", "0.56287354", "0.5576904", "0.55670744", "0.55064464", "0.54561514", "0.54476815", "0.5400796", "0.5398325", "0.53946525", "0.53489804", "0.5316601", "0.53152823", "0.53104585", "0.52899975", "0....
0.675971
0
This function give the index of a key in the dictionary in a list that match the input value
def find(self, list, key, value): for i, dic in enumerate(list): if dic[key] == value: return i return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findIndex(lst, key, value):\r\n\r\n for i, dic in enumerate(lst):\r\n if dic['properties'][key] == value:\r\n return i\r\n return -1", "def find(lst, key, value):\n\n for i, dic in enumerate(lst):\n if dic[key] == value:\n return i\n return None", "def linear...
[ "0.80608493", "0.7877168", "0.7741012", "0.75335795", "0.73866296", "0.7343798", "0.725151", "0.69240844", "0.6870099", "0.68550146", "0.6810738", "0.68026084", "0.6739354", "0.6683892", "0.666758", "0.66640234", "0.66579", "0.6631289", "0.6626184", "0.66238743", "0.66025114"...
0.84405464
0
This function calls the Minimax algorithm with AlphaBeta pruning and update the Board data with its result and pass that result to the SCARA arm
def setNextMove_AB(self): print("Player {} depth = 2".format(self.player.getCurrentPlayer())) # Set timer start here: black_start = time.time() # Call Alpha Beta algorithm. Result is a dict: (score, piece, pos) result = self.alphabeta(2, False, -9999, 9999, 2) # Set time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_ai():\n print(\"Minimax AI\") # First line is the name of this AI \n color = int(input()) # Then we read the color: 1 for dark (goes first), \n # 2 for light. \n\n while True: # This is the main loop \n # Read in the current game status, for example:\n # \"SC...
[ "0.6739058", "0.66835195", "0.66799206", "0.6660185", "0.6656803", "0.6656803", "0.6570939", "0.6370557", "0.6370331", "0.6335045", "0.6319892", "0.62688786", "0.6221413", "0.622117", "0.6218329", "0.61801255", "0.6123658", "0.61101794", "0.6104088", "0.61020035", "0.6071752"...
0.6949715
0
This function calls the isGeneralExist() function to check if the game has ended
def EndGame(self): check_endgame = not self.player.getPlayer().isGeneralExist() return check_endgame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_game_end(self):\r\n\r\n if np.all(self.remaining == -1): # end of game\r\n self.show_results() # show the final results\r\n sys.exit() # exit the program\r", "def check_game_over(self):\n for piece in self.pieces:\n if not piece.destroyed:\n ...
[ "0.655188", "0.6521891", "0.6394489", "0.6333242", "0.6310302", "0.6310302", "0.62986654", "0.62562", "0.62385774", "0.6233926", "0.6220784", "0.6182156", "0.61446255", "0.6126335", "0.6113239", "0.60957617", "0.60863745", "0.60460824", "0.59908366", "0.5977668", "0.59536237"...
0.7835693
0
Convert price string to int.
def convert_prices(price): return int(price.replace("$", "").replace(",", ""))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_integer_price(decimal_price):\n return int(float(decimal_price) * 100)", "def format_price(self, price_text):\n return int(re.sub(r\"\\D\", \"\", price_text))", "def dec2int(r: str) -> int:", "def _str_to_int(in_str):\n if in_str == '':\n return 0\n return int(in_str, 1...
[ "0.7487968", "0.70949787", "0.7048899", "0.7001138", "0.6740254", "0.6589532", "0.65539086", "0.65201676", "0.6513394", "0.6505703", "0.64942455", "0.64933985", "0.64712745", "0.64681584", "0.6453859", "0.64247787", "0.6400984", "0.6392125", "0.637679", "0.63657695", "0.63581...
0.7599279
0
Function to load rates from Norges Bank.
def run_load_fx(): from integrations.norges_bank.utils.fx import load_fx load_fx() logger.info('Loaded FX-rates from Norges Bank')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_currency_rates(url=\"http://www.nbrb.by/API/ExRates/Rates?Periodicity=0\") -> dict:\n data = {}\n response = requests.get(url)\n if response.status_code == 200:\n data = get_json(response)\n return data", "def getData(self):\n\n url = 'https://www.ecb.europa.eu/stats/eurofxref...
[ "0.6234643", "0.5868967", "0.58248913", "0.58198726", "0.57753855", "0.5621314", "0.55591446", "0.55049", "0.5376426", "0.5365806", "0.5357714", "0.53376746", "0.53337437", "0.5299859", "0.52955884", "0.5285284", "0.5275836", "0.5268934", "0.5255301", "0.52466327", "0.5239159...
0.63152975
0
Computes policy with a weight of a matrix
def policy(matrix, weight): # for each column of weights, sum (matrix[i] * weight[i]) using dot product dot_product = matrix.dot(weight) # find the exponent of the calculated dot product exp = np.exp(dot_product) # policy is exp / sum(exp) policy = exp / np.sum(exp) return policy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcMaxEntPolicy(trans_mat, horizon, r_weights, state_features):\n\tn_states = np.shape(trans_mat)[0]\n\tn_actions = np.shape(trans_mat)[1]\n\n\tpartition = np.zeros((n_states, 1))\n\tpolicy = np.zeros((n_states, n_actions))\n\n\tpartition[n_states-1] = 1\n\treward = np.exp(np.dot(r_weights, state_features.T))...
[ "0.645586", "0.63133764", "0.63012934", "0.60636747", "0.60606676", "0.605857", "0.60234654", "0.5999505", "0.59799826", "0.5944463", "0.5941373", "0.59219086", "0.592158", "0.58848405", "0.5873565", "0.58386296", "0.58148813", "0.58018655", "0.5767474", "0.5761609", "0.57509...
0.86566025
0
Computes the Monte Carlo policy gradient based on the policy calculated from the above policy() function
def policy_gradient(state, weight): # first calculate policy using the policy function above Policy = policy(state, weight) # get action from policy action = np.random.choice(len(Policy[0]), p=Policy[0]) # reshape single feature from policy s = Policy.reshape(-1, 1) # apply softmax function ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_gradient(self, loader):\n\n net = nn.DataParallel(self.agent, device_ids=self.gpus)\n total_steps = len(loader)\n \n for step_idx, src in enumerate(tqdm(loader, desc='Calculating policy gradient...', leave=False)):\n\n # Decode fragments and smiles, and get loss\n ...
[ "0.7161173", "0.7032053", "0.68745005", "0.68698114", "0.6776028", "0.6714242", "0.65616333", "0.6516723", "0.64023477", "0.6382716", "0.6294712", "0.62807685", "0.6279373", "0.62744296", "0.62561136", "0.6107736", "0.61047393", "0.606276", "0.6048897", "0.60471356", "0.60091...
0.7108714
1
Backtest the model against the given features. Output a DataFrame that
def backtest(features: str, model: str, output: str): # Load model from data store with open(model, "rb") as f: mdl = joblib.load(f) # Load feature data. In a true pipeline there would be a split between # training and testing data, but this was omitted for clarity. # # ** Never run a r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_forest_test_Data(strat_test_set):\n logging.info(\"Random forest.....\")\n X_test = strat_test_set.drop(\"median_house_value\", axis=1)\n y_test = strat_test_set[\"median_house_value\"].copy()\n X_test_num = X_test.drop(\"ocean_proximity\", axis=1)\n imputer = SimpleImputer(strategy=\"med...
[ "0.6345319", "0.63277817", "0.6277333", "0.6158429", "0.61521703", "0.61427313", "0.6100492", "0.6037001", "0.6009598", "0.60037315", "0.59914774", "0.5963398", "0.59282446", "0.5915352", "0.5909637", "0.5890372", "0.588733", "0.5859227", "0.5789517", "0.57549775", "0.5742304...
0.7583552
0
Pop the topmost item off the stack. Returns the item.
def pop(self): item = self.stack[-1] self.stack = self.stack[:-1] return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n raise IndexError('Cannot pop item, stack is empty.')\n except IndexError as err:\n print(err)\n ...
[ "0.9038657", "0.89699066", "0.8646669", "0.8436965", "0.8425731", "0.8394855", "0.8379378", "0.83787584", "0.8376376", "0.836779", "0.8341289", "0.83400613", "0.83147097", "0.8313943", "0.8297329", "0.8291556", "0.8232232", "0.82071257", "0.82069063", "0.81836283", "0.8150139...
0.9046111
0
Peek at the topmost item of the stack without popping. Returns the item, or None on underflow.
def peek(self): try: return self.stack[-1] except IndexError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self):\n if self.isEmpty():\n raise Exception(\"Stack underflow\") # Nothing to peek at\n return self.first.Item # most recently added item", "def peek(self):\n if not self.is_empty():\n return self._stack_items[-1]\n else:\n raise StackException('Peek oper...
[ "0.7854999", "0.7848019", "0.77432376", "0.7725692", "0.7712781", "0.7672322", "0.76620185", "0.7641305", "0.7610284", "0.76081336", "0.7587791", "0.7587791", "0.75744694", "0.7550017", "0.75288725", "0.7514343", "0.75083995", "0.7495166", "0.74850506", "0.7464874", "0.745950...
0.80332464
0
Returns whether or not the stack is empty.
def is_empty(self): return len(self.stack) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_stack) == 0", "def empty(self) -> bool:\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "def empty(self):\r\n return len(self.stack) == 0", "def...
[ "0.92969453", "0.90845764", "0.9067046", "0.9067046", "0.9049475", "0.9040509", "0.90028155", "0.8970693", "0.8958459", "0.894402", "0.8918213", "0.89048815", "0.88327855", "0.8823499", "0.8811676", "0.87955076", "0.87955076", "0.8791064", "0.87125903", "0.8611502", "0.859849...
0.92230463
1
String representation of the stack.
def __repr__(self): return str(self.stack)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStackString(self):\n return \"\".join(self.stack[:0:-1])", "def __repr__(self):\n return str(self._stack_items)", "def __str__(self):\n return \"The stack contains: \" + str(self.the_stack)", "def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"ST...
[ "0.85406256", "0.8412833", "0.8216093", "0.8198461", "0.8198461", "0.818666", "0.8168011", "0.81232345", "0.7814737", "0.7814737", "0.76956904", "0.76956904", "0.76956904", "0.76956904", "0.7628415", "0.7368872", "0.715802", "0.7069953", "0.67405593", "0.67273206", "0.6695258...
0.87551796
0
Validates that the string is a correct infix expression. Also, replaces unary minus operators with a 'u'. Returns a valid, tokenized string on success; raises ExpressionError if the input is erroneous.
def validate(string): tokens = string.split() # Remembers if the previous token was an operator opflag = True ## Highly inefficient validity checking begins here ## # List of operators as they would appear in the infix expression operators = ['+', '-', '*', '/', '^', 'sqrt'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_infix(string):\n return postfix(infix_to_postfix(string))", "def parse_infix(input: str) -> Node:\n parsed = ParsedString(input).tokenize()\n ans = parse_e(parsed)\n return ans", "def infix_to_postfix(string):\n \n # Validate and tokenize the string\n tokens = validate(string)...
[ "0.67217284", "0.66280156", "0.66256684", "0.6390146", "0.63846296", "0.6309319", "0.63021815", "0.6235218", "0.61009157", "0.60545176", "0.60317606", "0.60182995", "0.5994529", "0.5970374", "0.59688133", "0.5967874", "0.59608865", "0.59466004", "0.5895652", "0.5879398", "0.5...
0.75027424
0
Take in as input a list The function multiply_list() will multiply all of the numbers in the list. If any item in the list is invalid return False.
def multiply_list(input): result = 1 #if there is no numbers in list return False if not input: return False #if the list contains strings or 0 return False else: for x in input: if type(x) == str or x == 0: return False else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mul():\n l = [1, 2, 3, 4]\n assert s7.mul(*l) == 1 * 2 * 3 * 4\n assert s7.mul(10, 20) == 200\n assert s7.mul(1.0, 2.0, 100.0) == 200.0", "def multiply_list(lst):\n if lst == []:\n return 1\n else:\n return lst[0] * multiply_list(lst[1:])", "def listMul(l):\n \n #...
[ "0.6760711", "0.6697329", "0.64938724", "0.64613146", "0.63816386", "0.6319394", "0.63060385", "0.6242373", "0.62085116", "0.6153073", "0.6107456", "0.6038584", "0.602507", "0.600547", "0.5875371", "0.5868004", "0.5868004", "0.58225316", "0.5819411", "0.5819411", "0.579956", ...
0.80064815
0
Returns config for tf.session
def get_config(): config = tf.ConfigProto(allow_soft_placement=True) config.gpu_options.allow_growth=True return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_session(self):\n config = tf.ConfigProto()\n config.gpu_options.allow_growth = True\n config.gpu_options.visible_device_list = str(self.device_num)\n return tf.Session(config=config)", "def get_config():\n config = tf.ConfigProto(allow_soft_placement=True)\n config.g...
[ "0.7999958", "0.7535755", "0.72901034", "0.7119736", "0.6969369", "0.6781894", "0.65969217", "0.64716965", "0.6348045", "0.6322737", "0.631881", "0.62444156", "0.6241746", "0.6201172", "0.61908853", "0.61729336", "0.6153548", "0.6133191", "0.6101502", "0.6080999", "0.6076644"...
0.75894344
1
Load checkpoint from the ckpt_dir (if unspecified, this is train dir) and restore it to saver and sess, waiting 10 secs in the case of failure. Also returns checkpoint name.
def load_ckpt(saver, sess, ckpt_dir="train"): while True: try: latest_filename = "checkpoint_best" if ckpt_dir=="eval" else None ckpt_dir = os.path.join(FLAGS.log_root, ckpt_dir) ckpt_state = tf.train.get_checkpoint_state(ckpt_dir, latest_filename=latest_filename) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_ckpt(saver, sess, ckpt_dir=\"train\"):\n while True:\n try:\n latest_filename = \"checkpoint_best\" if ckpt_dir == \"eval\" else None\n ckpt_dir = os.path.join(FLAGS.log_root, ckpt_dir)\n ckpt_state = tf.train.get_checkpoint_state(ckpt_dir, latest_filename=latest...
[ "0.8223236", "0.78587455", "0.77297467", "0.7691358", "0.7526772", "0.7455489", "0.7162959", "0.7072553", "0.7010319", "0.69536954", "0.6937316", "0.6916923", "0.68400085", "0.6833414", "0.6830013", "0.68147194", "0.6802229", "0.67763555", "0.67456764", "0.6729885", "0.669250...
0.8222074
1
Constructs word2idx dict from Glove pretrained embeddings and writes it to word2idx.txt file in data directory of the project.
def construct_dict(self): i = 0 self.word2idx = dict() fi = open(self.config.word_vec_fi_glove, 'r') for line in fi: self.word2idx[line.split(" ")[0]] = i i += 1 self.vocab_size = i self.write_dict() fi.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_idx2word():\n idx2word = {}\n d = train_data.shared['word2idx']\n for word, idx in d.items():\n print(word)\n idx2word[idx] = word\n if config.use_glove_for_unk:\n d2 = train_data.shared['new_word2idx']\n for word, idx in d2.items():\...
[ "0.7383777", "0.71597224", "0.6914332", "0.6700071", "0.66937166", "0.6675268", "0.6658766", "0.6642013", "0.65650064", "0.6545669", "0.6526046", "0.6516871", "0.65157616", "0.6507262", "0.6481229", "0.6472119", "0.6454776", "0.6420657", "0.6418853", "0.64167535", "0.64134", ...
0.7407205
0
Creates embedding matrix from input file and writes to binary file Considering numpy rowmajor order stores word vector rowwise.
def construct_embedding(self): i = 0 self.load_dicts() embedding_shape = (max(self.word2idx.values()) + 1, self.embedding_size) self.embedding = np.zeros(embedding_shape) with open(self.config.word_vec_fi_glove, 'r') as fi: for line in fi: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_embedding_matrix(filepath, word_index, embedding_dim):\n vocab_size = len(word_index) + 1 # Adding again 1 because of reserved 0 index\n embedding_matrix = np.zeros((vocab_size, embedding_dim))\n\n with open(filepath) as f:\n for line in f:\n word, *vector = line.split()\n ...
[ "0.71148777", "0.6811717", "0.66535574", "0.6645278", "0.6578764", "0.65542287", "0.65381473", "0.6517769", "0.65073204", "0.6506877", "0.6471639", "0.64159757", "0.6356227", "0.6192997", "0.6183885", "0.61746114", "0.6166684", "0.61592853", "0.6129667", "0.6122645", "0.60884...
0.69728744
1
Helper function to add new token to self.word2idx and embedding to self.embeddings
def add_embedding(self, token, embedding): self.word2idx[token] = self.vocab_size self.vocab_size += 1 self.embedding = np.vstack((self.embedding, embedding))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_dict(self, tokens):\n# TODO: ?add normalization of a token?\n for token in tokens:\n if self.embedding_words and (token not in self.embedding_words):\n continue\n self.freq[token] += 1\n if token not in self.tok2ind:\n index = len(sel...
[ "0.6996325", "0.6894177", "0.6658061", "0.65426093", "0.6435544", "0.6401983", "0.6349686", "0.63282156", "0.6324981", "0.6320355", "0.6309303", "0.6281128", "0.6220901", "0.62193155", "0.61735755", "0.61483675", "0.6124767", "0.61123055", "0.61009485", "0.6099443", "0.605398...
0.77013934
0
Averages word vectors that occur in both glove and paragram and creates union of two embeddings
def add_paragram(self): num_new_words = 720000 new_embeddings = np.empty((num_new_words, self.embedding_size)) concat_emb = np.zeros((2, self.embedding_size)) new_word2idx = dict() new_words_count = 0 self.load_all() fi = open(self.config.word_vec_fi_paragram, "r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_averaging(wv, words):\n all_words, mean = set(), []\n \n for word in words:\n if isinstance(word, np.ndarray):\n mean.append(word)\n elif word in wv.vocab:\n mean.append(wv.vectors_norm[wv.vocab[word].index])\n all_words.add(wv.vocab[word].index)\n\n...
[ "0.70063585", "0.65691555", "0.655092", "0.65492266", "0.64220226", "0.63821906", "0.6352523", "0.63278", "0.6304237", "0.63029516", "0.6285422", "0.6161037", "0.61082405", "0.60827434", "0.6066551", "0.605643", "0.60406655", "0.6036333", "0.6034815", "0.60307336", "0.6029545...
0.68158096
1
Adds unknown token to word2idx dictionary and computes vector as an average of random sample as suggested by Pennington
def add_unknown_token(self): self.load_all() sample_idxs = np.random.randint(0, self.embedding.shape[0], self.config.embedding_sample_size) unknown_vector = np.mean(self.embedding[sample_idxs, :], axis=0) self.add_embedding(self.config.unknown_tok...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_vec(tokens_list, vector, generate_missing=False, k=300):\r\n if len(tokens_list)<1:\r\n return np.zeros(k)\r\n \r\n if generate_missing:\r\n vectorized = [vector[word] if word in vector else np.random.rand(k) for word in tokens_list]\r\n else:\r\n vectorized = [vect...
[ "0.6838759", "0.65651834", "0.6410613", "0.6106581", "0.6086365", "0.6085573", "0.6080259", "0.6050455", "0.6035664", "0.5996665", "0.59961116", "0.5990178", "0.5940137", "0.5930811", "0.59277254", "0.5890196", "0.588386", "0.58830386", "0.58822876", "0.58559144", "0.5849721"...
0.69098496
0
Splits data into train, dev, and test sets and saves these into separate directories.
def split_train_test_dev(self): for dir_name in (self.config.train_dir, self.config.dev_dir, self.config.test_dir): create_dir(dir_name) self.split_helper(self.config.parsed_train_file_pos, 'pos') self.split_helper(self.config.parsed_train_file_neg, 'neg')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MakeDataSetFiles(dirname):\n\n\n if not os.path.exists(dirname):\n os.mkdir(dirname)\n if not os.path.exists(os.path.join(dirname, 'train')):\n os.mkdir(os.path.join(dirname, 'train'))\n if not os.path.exists(os.path.join(dirname, 'test')):\n os.mkdir(os.path.join(dirname, 'test'))\n data_train = ...
[ "0.7316146", "0.71866006", "0.7114873", "0.7022753", "0.68888664", "0.6882073", "0.6838386", "0.6802326", "0.67861754", "0.6763696", "0.6753951", "0.6730403", "0.6691835", "0.6685175", "0.66725105", "0.6671246", "0.6665487", "0.66565126", "0.6647751", "0.660803", "0.66024566"...
0.80809546
0
Adds ops for the cross entropy loss to the computational graph. The loss is averaged over all examples in the current minibatch.
def add_loss_op(self, pred): loss = tf.nn.sparse_softmax_cross_entropy_with_logits( labels=self.labels_placeholder, logits=pred, name="loss" ) loss = tf.reduce_mean(loss) return loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_loss_op(self, pred):\n ### YOUR CODE HERE\n loss = cross_entropy_loss(self.labels_placeholder,pred)\n ### END YOUR CODE\n return loss", "def loss_op(logits, labels):\n cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels, name='xentropy_eval')\n...
[ "0.7201984", "0.6916799", "0.6771412", "0.67244655", "0.66884035", "0.66647446", "0.6586543", "0.6573803", "0.6466889", "0.6453262", "0.64367396", "0.6422562", "0.64079267", "0.6380531", "0.63719505", "0.6367178", "0.63509816", "0.63509816", "0.63411987", "0.6335173", "0.6322...
0.70479894
1
If active is true, only return active potholes. If active is false, return all potholes. If date is set, then return potholes with ledger information up to the specified date
def get_geojson_potholes(active=True, date=None): potholes = VwPothole.objects.all() if date is None \ else VwPothole.objects.raw(vw_pothole_by_date, {'datetime': '{} 23:59:59'.format(date)}) pothole_features = [Feature( geometry=Point((float(pothole.lon), float(pothole.lat)), precision=8), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active (self, after = None, before = None):\n\n active = ActivityList()\n active.list = [actor for actor in self.list\n if (after == None or\n actor[\"period\"].end >= after) and\n (before == None or\n ...
[ "0.50194657", "0.49823934", "0.4923843", "0.48555967", "0.48555368", "0.47429028", "0.47279143", "0.46891028", "0.4629333", "0.46156973", "0.4614425", "0.45901078", "0.45899412", "0.45639297", "0.45589805", "0.45522225", "0.45316374", "0.4529043", "0.4516528", "0.45120677", "...
0.6141142
0
Test that list works on old keys with no metadata
def test_list_no_metadata(self): key = Key(self.bucket) name, version = 'mypkg', '1.2' filename = '%s-%s.tar.gz' % (name, version) key.key = name + '/' + filename key.set_contents_from_string('foobar') package = list(self.storage.list(Package))[0] self.assertEqual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ls(self):\n fake_key = namedtuple('Key', ['name', 'last_modified', 'size'])\n num_items = 10\n items = []\n for i in range(num_items):\n items.append({'name': 'item_%d' % i, 'last_modified': 'fake_date', 'size': 100})\n\n backend = self.test_init_valid()\n\n ...
[ "0.7025229", "0.63540006", "0.63520336", "0.62515557", "0.6204083", "0.61587137", "0.61037785", "0.60956293", "0.60297567", "0.6005905", "0.600304", "0.59855175", "0.5985121", "0.59804595", "0.5962854", "0.59540826", "0.59345037", "0.58855706", "0.5871708", "0.5871708", "0.58...
0.66902786
1
Raise a 'bucket not found' exception
def raise_not_found(*_, **__): e = boto.exception.S3ResponseError(400, 'missing') e.error_code = 'NoSuchBucket' raise e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_empty(empty_bucket): # pylint: disable=redefined-outer-name\n with pytest.raises(KeyError):\n empty_bucket.get(\"key 1\")", "def test_get_bucket(self):\n pass", "def test_api_get_bucketlist_by_id_not_exist(self):\n res = self.client().get(f\"/bucketlist/99\")\n self...
[ "0.7205869", "0.71065015", "0.7096352", "0.7038852", "0.6997341", "0.6958753", "0.6955459", "0.6913117", "0.6909686", "0.6773827", "0.6682321", "0.6665191", "0.6648655", "0.6552224", "0.6528791", "0.64729685", "0.6464192", "0.6383199", "0.63815653", "0.63114816", "0.62645215"...
0.8030355
0
delete() should remove package from storage
def test_delete(self): package = make_package() path = self.storage.get_path(package) os.makedirs(os.path.dirname(path)) with open(path, 'w') as ofile: ofile.write('foobar') self.storage.delete(package) self.assertFalse(os.path.exists(path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n self.package = None", "def test_delete(self):\n package = make_package()\n self.storage.upload(package, StringIO())\n self.storage.delete(package)\n keys = list(self.bucket.list())\n self.assertEqual(len(keys), 0)", "def test_delete_package(self):\n...
[ "0.79596126", "0.75034857", "0.74405926", "0.74049443", "0.73858505", "0.735797", "0.72527796", "0.7154662", "0.703437", "0.6974038", "0.6930558", "0.68803126", "0.6863968", "0.6856768", "0.6781866", "0.67654777", "0.67367566", "0.6721418", "0.6714018", "0.66926026", "0.66661...
0.79171205
1
Returns the "user base" directory path. The "user base" directory can be used to store data. If the global variable ``USER_BASE`` is not initialized yet, this function will also set it.
def getuserbase(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_home(self):\n return os.environ['HOME']", "def get_user_home(self):\n return os.environ['HOME']", "def user_home_path(self):\n return path.join(env.user_home, self._user_home_path)", "def getUserDir() -> str:\n\n if os.name == \"nt\": # Windows system, try to return docu...
[ "0.72320074", "0.72320074", "0.7169158", "0.71514034", "0.7037741", "0.6934056", "0.691502", "0.6901557", "0.6891382", "0.6862563", "0.68151444", "0.6769605", "0.6735248", "0.66909224", "0.6690817", "0.65635455", "0.65374714", "0.6530841", "0.65104234", "0.6503841", "0.649601...
0.79859984
0
Read API key from /data/credential.txt
def read_key(): path = os.path.join(os.path.dirname(__file__), 'data') f = open(os.path.join(path, 'credential.txt'), 'r') key = f.read() f.close() return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_key ():\n PROJECT_PATH = os.path.abspath(os.path.dirname(__name__))\n key_file = open(PROJECT_PATH + \"/key_api.txt\", \"r\")\n return (key_file.read()).rstrip('\\n')", "def read_api_key():\n script_path = os.path.dirname(os.path.realpath(__file__)) \n config = open(script_path + '/...
[ "0.77033496", "0.76855683", "0.75721073", "0.75271016", "0.7320017", "0.72772956", "0.72321165", "0.7134715", "0.71150076", "0.7113407", "0.69248843", "0.68938637", "0.6853688", "0.67965347", "0.675196", "0.67040294", "0.6643031", "0.6438197", "0.6428389", "0.6417984", "0.634...
0.8547963
0
get champion name by its id
def get_champion_name(champion_id, api_key=read_key(), region='na'): response = urllib2.urlopen('https://global.api.pvp.net/api/lol/static-data/'+region+'/v1.2/champion/' + str(champion_id)+'?api_key=' + api_key) champion = json.load(response) return champion['name']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self, id):\n\t\treturn self.name_by_index[id]", "def champion_key_from_id(champion_id):\n return champions[\"data\"][str(champion_id)][\"key\"]", "def getPlayerCardName(self, playerid):\n with open('./data/players_database.csv', 'r', encoding=\"utf8\") as read_obj:\n csv_reade...
[ "0.70235884", "0.701553", "0.66856205", "0.6443642", "0.6425609", "0.6255943", "0.621068", "0.6080701", "0.6069413", "0.60660994", "0.60368574", "0.60175383", "0.5974954", "0.5973603", "0.59718186", "0.5946285", "0.59321064", "0.5921488", "0.5900459", "0.5856542", "0.5848437"...
0.81229717
0
Create a parser from a given lexicon.
def __init__(self, lexicon, flags=0): import sre_parse import sre_compile from sre_constants import BRANCH, SUBPATTERN self.lexicon = lexicon # combine phrases into a compound pattern p = [] s = sre_parse.Pattern() s.flags = flags for phrase, ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_parser():\n pass", "def make_minilang_parser():\n gramm = Grammar.from_string(GRAMMAR)\n return parser_from_grammar(gramm, 'program')", "def make_parser(data):\n # type: (str) -> RelayParser\n input_stream = InputStream(data)\n lexer = RelayLexer(input_stream)\n token_stream = C...
[ "0.6069957", "0.6066554", "0.60480183", "0.5750524", "0.5577068", "0.55530554", "0.55429524", "0.5505798", "0.5487193", "0.5439394", "0.5416125", "0.541545", "0.5408069", "0.5406951", "0.5396058", "0.537577", "0.5354577", "0.52744836", "0.5261595", "0.5259573", "0.52374434", ...
0.621701
0
Test dummpy molecule for 90 degree rotations on global zaxis
def test_diatomic_dummy_molecule_rotation_around_global_axis(): mol = Molecule() mol.atoms = ['C'] * 2 mol.coordinates = np.array([[1, 0, 0], [0, 1, 0]]) mol.rotate(([0, 0, 0], [0, 0, 1]), np.pi / 2, center=False) assert np.allclose(mol.coordinates, [[0, 1, 0], [-1, 0, 0]]) mol.rotate(([0, 0, 0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_diatomic_dummy_molecule_rotation_around_molecule_axis():\n mol = Molecule()\n mol.atoms = ['C'] * 2\n mol.coordinates = np.array([[1, 0, 0], [0, 1, 0]])\n mol.rotate(([0, 0, 0], [0, 0, 1]), np.pi / 2, center=True)\n assert np.allclose(mol.coordinates, [[1, 1, 0], [0, 0, 0]])\n mol.rotate...
[ "0.68779147", "0.6699214", "0.6467635", "0.6058268", "0.59421706", "0.5833135", "0.5812672", "0.5786473", "0.5781003", "0.57146466", "0.5709731", "0.5701399", "0.5697652", "0.5675569", "0.56018823", "0.5592052", "0.5585152", "0.55424553", "0.55419815", "0.55203927", "0.549647...
0.72263396
0
Test dummpy molecule for 90 degree rotations on zaxis of the molecule
def test_diatomic_dummy_molecule_rotation_around_molecule_axis(): mol = Molecule() mol.atoms = ['C'] * 2 mol.coordinates = np.array([[1, 0, 0], [0, 1, 0]]) mol.rotate(([0, 0, 0], [0, 0, 1]), np.pi / 2, center=True) assert np.allclose(mol.coordinates, [[1, 1, 0], [0, 0, 0]]) mol.rotate(([0, 0, 0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_z_rot(self):\n\n # Create a Matrix representing 90 deg z rot.\n mat = Matrix44.from_rot_z(90)\n # Use from_matrix44()\n quat = Quat.from_matrix44(mat)\n\n # Ensure the quat matches a 90 degree x rotation.\n expected = Quat.from_axis_angle_deg(Vec3(0, 0, 1), 90)\n ...
[ "0.70797455", "0.68893856", "0.6713505", "0.6137352", "0.60241646", "0.6014459", "0.59592366", "0.5933176", "0.5881573", "0.58782434", "0.58767945", "0.5848994", "0.584663", "0.583147", "0.58155316", "0.5810699", "0.58072495", "0.57150024", "0.568535", "0.56782866", "0.567333...
0.70375586
1
Call recursive glob iff is in the pattern.
def recursive_glob(path): if "*" not in path: # Glob isn't needed. return [path] elif "**" not in path: # Recursive glob isn't needed. return path_utils.glob(path) else: return path_utils.glob(path, recursive=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_glob(stem, file_pattern):\n\n if sys.version_info >= (3, 5):\n return glob(stem + \"/**/\" + file_pattern, recursive=True)\n else:\n # gh-316: this will avoid invalid unicode comparisons in Python 2.x\n if stem == str(\"*\"):\n stem = \".\"\n matches = []\...
[ "0.751194", "0.6974341", "0.68034536", "0.6758196", "0.67542297", "0.65902424", "0.6563652", "0.6520523", "0.64885634", "0.6402769", "0.6326716", "0.6301645", "0.6283898", "0.6252692", "0.6246691", "0.62367874", "0.6196066", "0.61890477", "0.6177601", "0.6141388", "0.6139274"...
0.7050668
1
Checks if a pyi file is path/to/dir/__init__.pyi.
def is_pyi_directory_init(filename): if filename is None: return False return path_utils.splitext(path_utils.basename(filename))[0] == "__init__"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsPackage(path):\n init_base_path = os.path.join(path, '__init__.py')\n return (os.path.isfile(init_base_path) or\n os.path.isfile(init_base_path + 'c') or\n os.path.isfile(init_base_path + 'o'))", "def is_pkg(cls, path):\n return exists(join(path, '__init__.py'))", "def ...
[ "0.7422277", "0.7233876", "0.7077706", "0.70653397", "0.6987086", "0.6987086", "0.6595339", "0.6401514", "0.6298225", "0.62583286", "0.6258052", "0.6250494", "0.61958045", "0.60404485", "0.6009115", "0.60048294", "0.58957773", "0.5888118", "0.58545226", "0.58261836", "0.58251...
0.79479814
0
Checks if the filename is a pickle file.
def is_pickle(filename): return path_utils.splitext(filename)[1].startswith(PICKLE_EXT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pickleExists(name):\n fileNames = [f for f in os.listdir(PICKLE_DIR) if name in f]\n return not len(fileNames) == 0", "def verify_filename(filename):\n\n if is_fileobj(filename):\n raise ValueError(\"%r not a filename\" % filename)", "def is_mp3_file(filename):\n ext = str(os.path.splite...
[ "0.643423", "0.6430957", "0.6344804", "0.6319534", "0.62992567", "0.6294618", "0.6250568", "0.62361664", "0.6185609", "0.61671084", "0.61487937", "0.61480135", "0.61176413", "0.6105346", "0.6073736", "0.6073736", "0.6023189", "0.60059375", "0.6004802", "0.5994341", "0.5991949...
0.8553102
0
Fully expand a path, optionally with an explicit cwd.
def expand_path(path, cwd=None): expand = lambda path: path_utils.realpath(path_utils.expanduser(path)) with cd(cwd): return expand(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expandpath(path):\n return os.path.abspath(os.path.expanduser(path))", "def expand_path(path):\n return expanduser(expandvars(path))", "def ExpandPath(path):\n return os.path.realpath(os.path.expanduser(path))", "def expand_path(path):\n\n return os.path.abspath(os.path.expanduser(os.path.expan...
[ "0.74701923", "0.73939276", "0.73707473", "0.7219343", "0.7219343", "0.71664995", "0.7078088", "0.6832545", "0.6721617", "0.6641923", "0.6560282", "0.655823", "0.65138286", "0.65120006", "0.6336295", "0.62854826", "0.62736595", "0.62604237", "0.61930496", "0.6163498", "0.6128...
0.85340816
0
Fully expand a list of paths, optionally with an explicit cwd.
def expand_paths(paths, cwd=None): return [expand_path(x, cwd) for x in paths]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_globpaths(globpaths, cwd=None):\n with cd(cwd):\n paths = sum((recursive_glob(p) for p in globpaths), [])\n return expand_paths(paths, cwd)", "def expand_paths(__file__, paths_with_globs):\n if isinstance(paths_with_globs, str):\n return expand_path(__file__, paths_with_globs)\n else...
[ "0.7456049", "0.70066786", "0.6774307", "0.66487193", "0.65742046", "0.624558", "0.61956173", "0.59257555", "0.56479543", "0.5538372", "0.55290365", "0.54953575", "0.54544365", "0.5436541", "0.5423522", "0.5376047", "0.5348702", "0.5323587", "0.53146243", "0.5308345", "0.5304...
0.8460689
0
Expand a spaceseparated string of filenames passed in as sources. This is a helper function for handling command line arguments that specify a list of source files and directories. Any directories in filenames will be scanned recursively for .py files. Any files that do not end with ".py" will be dropped.
def expand_source_files(filenames, cwd=None): out = [] for f in expand_globpaths(filenames.split(), cwd): if path_utils.isdir(f): # If we have a directory, collect all the .py files within it.... out += recursive_glob(path_utils.join(f, "**", "*.py")) elif f.endswith(".py"): out.append(f) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(\n self,\n source: str,\n name: t.Optional[str] = None,\n filename: t.Optional[str] = None,\n ) -> str:\n return reduce(\n lambda s, e: e.preprocess(s, name, filename),\n self.iter_extensions(),\n str(source),\n )", "def...
[ "0.57943326", "0.56623256", "0.56462324", "0.56194705", "0.56137234", "0.55241853", "0.54940057", "0.5488685", "0.54875094", "0.5447087", "0.5410495", "0.5335001", "0.5287344", "0.5250983", "0.5189532", "0.5180171", "0.5116171", "0.5083184", "0.5078157", "0.506521", "0.505824...
0.689316
0
Fixes the problem where the mover method infinetly recurses due to the computer trying to capture a piece while in check. self.recursive_move is a list of blacklisted moves
def recurse_fix(self, recurse): #Removes the recursive moves from <piece>.possible_moves if recurse == True: # print(self.recursive_move) for i in self.recursive_move: select = self.recursive_move[self.recursive_move.index(i)][0] move = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_valid_moves(self):\r\n # castling and en-passant rights are stored, because move affects these values\r\n temp_enpassant_possible = self.enpas_pos\r\n temp_castle = CastleRights(self.cr_castle_r.wks, self.cr_castle_r.bks,\r\n self.cr_castle_r.wqs, self...
[ "0.6435797", "0.6278216", "0.6252017", "0.61592704", "0.61344117", "0.61085063", "0.6066249", "0.60613513", "0.60312474", "0.60108995", "0.6007377", "0.6001272", "0.59988976", "0.5975665", "0.597399", "0.5933734", "0.592724", "0.5924062", "0.59091336", "0.5909046", "0.5904532...
0.75138515
0
Populates the board with piece objects
def populate(self): counter = 0 placers = [piece_class.Rook, piece_class.Knight, piece_class.Bishop, piece_class.Queen, piece_class.King, piece_class.Bishop, piece_class.Knight, piece_class.Rook, piece_class.Pawn, piece_class.Pawn, piece_class....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_board(self):\n for key, value in self.game.white_pieces.items():\n x_pos = self.width * value.x_pos\n y_pos = self.width * value.y_pos\n img = self.load_image(\"images/\" + value.image, value.starting_position)\n self.place_image_on_canvas(x_pos, y_po...
[ "0.76593214", "0.75936663", "0.7367415", "0.72926337", "0.7115361", "0.7082727", "0.70713323", "0.7070828", "0.7015153", "0.69468915", "0.6837631", "0.68237364", "0.68121535", "0.6800702", "0.66739005", "0.6650878", "0.6610713", "0.659756", "0.6571999", "0.6550281", "0.651255...
0.8106084
0
Checks piece(s) are pinned to the king, and can't prevent checkmate
def mate_pinned(self, turn): pinned_list = [] opposite_colour = next_turn(turn) opp_king_index = (piece_class.KING_LOCATION[opposite_colour][0] + piece_class.KING_LOCATION[opposite_colour][1] * 8) opp_poss_moves = {tuple(i) for i in self.poss_dict[opposite_colour]} check...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move_knight_legally_blocked(self):\n for piece in [('N', True), ('N', False)]:\n self.c.board = \\\n [[('K', piece[1]) for i in range(8)] for i in range(8)]\n self.c.turn = piece[1]\n self.c.board[4][4] = piece\n for dest in ['d6', 'f6', 'c...
[ "0.68501544", "0.66945", "0.6639427", "0.64998174", "0.64502615", "0.644943", "0.64347035", "0.64299804", "0.6413221", "0.6408485", "0.6388782", "0.63560796", "0.6353194", "0.63430786", "0.6337254", "0.63203883", "0.6306646", "0.6304615", "0.62882274", "0.6250088", "0.6243981...
0.7173512
0
Adjusts the king moves to take into account opponent paths
def king_adjust(self, turn): opposite_turn = next_turn(turn) original_location_index = (piece_class.KING_LOCATION[turn][0] + piece_class.KING_LOCATION[turn][1] * 8) # if self.board[original_location_index] == self.empty: # print("yo") self.board[original_loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_king_moves(self, state):\n #king_moves = []\n possible_moves = []\n if self.color == cc.WHITE_ACTIVE:\n enemy_color = cc.BLACK_ACTIVE\n enemy_pieces = cc.BLACK_PIECES\n elif self.color == cc.BLACK_ACTIVE:\n enemy_color = cc.WHITE_ACTIVE\n ...
[ "0.65922093", "0.6517307", "0.6433317", "0.642922", "0.63771147", "0.63771147", "0.63771147", "0.63081336", "0.6298383", "0.6261358", "0.6192195", "0.6176605", "0.6164589", "0.6163104", "0.6143453", "0.61155224", "0.6101044", "0.6099099", "0.6098332", "0.6097228", "0.60883033...
0.85099286
0
Appends the possible move of the king if castling is possible
def castling(self, turn, ai): if self.board[self.coords.index(piece_class.KING_LOCATION[turn])].move_track == True: return None castling_queenside = [self.coords.index(piece_class.KING_LOCATION[turn]), self.coords.index(piece_class.KING_LOCATION[turn]) - 1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def king_adjust(self, turn):\n\n opposite_turn = next_turn(turn)\n\n original_location_index = (piece_class.KING_LOCATION[turn][0] + piece_class.KING_LOCATION[turn][1] * 8)\n \n# if self.board[original_location_index] == self.empty:\n# print(\"yo\")\n \n self.bo...
[ "0.7224072", "0.6627195", "0.65229857", "0.6470024", "0.6182009", "0.6177418", "0.61430883", "0.6139011", "0.61076343", "0.6091473", "0.6086108", "0.60822123", "0.6072754", "0.6068784", "0.6068784", "0.6068784", "0.60567504", "0.60416263", "0.6029341", "0.6026139", "0.6018981...
0.72807145
0
Resets all attributes after a game has been played by AIvAI
def resets_attributes(self): self.path_dict = None self.poss_dict = None self.check_dict = None self.long_dict = None self.rep_counter = 0 self.cap_counter = 0 self.board = [] self.coords = [] self.chess_coords = [] self.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_game_fields(self):\n self.player = None\n self.event_status = 0 # set accordingly for player achievments\n self.event_status_list = [False, False, False, False, False, False, False, False]\n self.spaces = []\n self.characters = []\n self.exits = []\n self....
[ "0.7516117", "0.73008484", "0.7209318", "0.71248615", "0.70516896", "0.70516896", "0.7050974", "0.7039916", "0.70002186", "0.69693255", "0.69182575", "0.6885031", "0.6839155", "0.68244755", "0.676734", "0.67489743", "0.67342496", "0.67195565", "0.6716343", "0.66865003", "0.66...
0.73064816
1
some metrics on the whole profile text
def profile_text_stats( doc: BeautifulSoup ): text = doc.find('main', {'class': 'core-rail'}).text.strip() words = text.split() eng_ratio = sum(1 for word in words if word in COMMON_ENGLISH) * 10/ (len(words) + 0.001) return { 'length': len( text ), 'eng_ratio': np.round( eng_ratio, 2)} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _profile(self, text):\n prof = zeros(len(self.alph)**self.N)\n ngs = ngrams(text, self.N)\n for tup in ngs:\n loc = 0\n for i in range(len(tup)):\n loc += (len(self.alph)**i) * self.alph.index(tup[i])\n prof[loc] += 1\n return prof", ...
[ "0.6908674", "0.64373267", "0.61230284", "0.60225594", "0.6013804", "0.5936111", "0.5932316", "0.5845712", "0.58176684", "0.57707936", "0.576293", "0.5743936", "0.57346797", "0.5728267", "0.5687166", "0.56419724", "0.56302047", "0.5594292", "0.55903494", "0.5582322", "0.55770...
0.72970635
0
process one employment summary and extract info from it
def proc_employment_summary(summary: Tag) -> Dict: xp_record = dict() xp_record['position'] = summary.find('h3').text.strip() company = summary.find_all('p', {'class': 'pv-entity__secondary-title'})[0] xp_record['company'] = "; ".join( [ line.strip() for line in company.text.split('\n') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proc_education_summary( summary: Tag ) -> Dict[str, str]:\n edu_record = dict()\n edu_record['school'] = summary.find('h3').text.strip()\n edu_record['is_abroad_school'] = _is_abroad_school( edu_record['school'] )\n\n for parag in summary.find_all('p'):\n spans = [span.text.strip() for span ...
[ "0.647423", "0.61216635", "0.59458005", "0.56278527", "0.5343209", "0.53211635", "0.52993035", "0.52750313", "0.5241437", "0.5197236", "0.51397026", "0.5090858", "0.5073519", "0.50543827", "0.5022594", "0.5021494", "0.5021494", "0.5011691", "0.4984092", "0.49774346", "0.49728...
0.81081915
0
Process one education summary and generate a record
def proc_education_summary( summary: Tag ) -> Dict[str, str]: edu_record = dict() edu_record['school'] = summary.find('h3').text.strip() edu_record['is_abroad_school'] = _is_abroad_school( edu_record['school'] ) for parag in summary.find_all('p'): spans = [span.text.strip() for span in parag.fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_edu_data( api, district_data = {}, categories = {'Education': { }}, \r\n state=48, district=7, leg_body='US-REP', year='2015' ):\r\n category='Education'\r\n\r\n district_key='district'\r\n blockgroup_key='bg'\r\n precinct_key='precinct'\r\n tract_key='tract'\r\n\r\n edu_table = ...
[ "0.6131321", "0.6071274", "0.57574546", "0.57188594", "0.5628388", "0.5616263", "0.5484156", "0.5319141", "0.53092843", "0.52988136", "0.52154684", "0.5209973", "0.52016425", "0.51190305", "0.51043224", "0.50922275", "0.5088542", "0.5073056", "0.5030911", "0.50198203", "0.499...
0.763279
0
Confirm that Mz does not reingest the entire snapshot on restart by revoking its SELECT privileges
def verify_no_snapshot_reingestion(c: Composition) -> None: c.run("testdrive", "wait-for-snapshot.td", "postgres-disable-select-permission.td") restart_mz(c) c.run( "testdrive", "delete-rows-t1.td", "delete-rows-t2.td", "alter-table.td", "alter-mz.td", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_backup_can_use_snapshots(self):\n use_snaps = self.driver.backup_use_temp_snapshot()\n self.assertTrue(use_snaps)", "def test_base_replica_repair_with_contention(self):\n self._base_replica_repair_test(fail_mv_lock=True)", "def test_clone_delete_snap(self):\n\n # pylint: di...
[ "0.5921977", "0.5906115", "0.56129384", "0.55432796", "0.55244553", "0.5494747", "0.543905", "0.54100126", "0.54093075", "0.538874", "0.5343703", "0.5319883", "0.5312346", "0.53067654", "0.5303087", "0.5273802", "0.5273196", "0.5273007", "0.5248124", "0.5243732", "0.52304816"...
0.7708593
0
Extract the text content from lines.
def _extract_content(lines: list[Strip]) -> list[str]: content = ["".join(segment.text for segment in line) for line in lines] return content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_text_lines(instText):\n\n # Find out which part this is\n part = instText.part\n # Get the necessary parameters: lng, ext, dir\n sLng = part.corpus.get_lng_display()\n sDir = part.dir\n sName = instText.fileName\n sFormat = instText.get_format_display()\n # Now try to get the inform...
[ "0.62102735", "0.61233324", "0.6056201", "0.60443735", "0.5982941", "0.5918472", "0.589934", "0.5866649", "0.5844836", "0.58414966", "0.5823281", "0.5823281", "0.58078074", "0.5782247", "0.57648635", "0.57648635", "0.5750798", "0.57348955", "0.5727085", "0.5703013", "0.569214...
0.7722922
0
Test that empty style returns the content unaltered
def test_no_styles(): content = [ Strip([Segment("foo")]), Strip([Segment("bar")]), Strip([Segment("baz")]), ] styles = Styles() cache = StylesCache() lines = cache.render( styles, Size(3, 3), Color.parse("blue"), Color.parse("green"), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_noop(self):\n html = '<div class=\"pink\">test</div>'\n css = ''\n self.assertEqual(html, inline_css(html, css, pretty_print=False))", "def test_format_empty(self) -> None:\n CSSFormatter._format_str(self._file_read(\"empty.css\"))", "def test_style_hang():\n style = [\n...
[ "0.7511037", "0.7037144", "0.67473537", "0.6714339", "0.65121347", "0.6503912", "0.6401926", "0.63792145", "0.62622905", "0.62292373", "0.6104016", "0.608578", "0.59841275", "0.5979896", "0.5944915", "0.5905404", "0.58714443", "0.5856866", "0.5797256", "0.5770223", "0.5743431...
0.77536297
0
Remaps the value `x` (ranging from `min_x` to `max_x`) to a value ranging from `min_y` to `max_y`.
def remap(x: float, min_x: float, max_x: float, min_y: float, max_y: float) -> float: return min_y + (max_y - min_y) * ((x - min_x) / (max_x - min_x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map(self, x, y):\n if near(x[0], xmax) and near(x[1], ymax):\n y[0] = x[0] - xmax\n y[1] = x[1] - ymax\n elif near(x[0], xmax):\n y[0] = x[0] - xmax\n y[1] = x[1]\n elif near(x[1], ymax):\n y[0] = x[0]\n y[1] = x[1] - ymax\n else...
[ "0.7707648", "0.7002668", "0.68580097", "0.68068284", "0.67506784", "0.6469885", "0.6415944", "0.6360299", "0.6295195", "0.62137926", "0.6204135", "0.62009853", "0.6177768", "0.6166108", "0.6118882", "0.6101499", "0.60898423", "0.60738873", "0.60470515", "0.6046584", "0.60197...
0.82469887
0
Clamps `x` to `min_x` on the bottom and `max_x` on the top.
def clamp(x: float, min_x: float, max_x: float) -> float: if x < min_x: return min_x elif x > max_x: return max_x return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip(x, min, max):\r\n # see decorator for function body\r\n # for grep: clamp, bound\r", "def clip(self, x):\n return self.min_value if x<self.min_value else self.max_value if x > self.max_value else x", "def clamp(min_value: float, max_value: float, value: float):\n\t\tvalue = min(value, max_v...
[ "0.69083524", "0.6883851", "0.66299367", "0.66258687", "0.66229886", "0.6594466", "0.6592013", "0.65834683", "0.6582262", "0.65337896", "0.6510339", "0.65084815", "0.65054435", "0.64963937", "0.6481131", "0.6470808", "0.6464931", "0.6427873", "0.64172363", "0.641455", "0.6394...
0.7616848
0
Get an existing Application resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, application_name: Optional[pulumi.Input[str]] = None, description: Optional[pulumi.Input[str]] = None, resource_group_id: Optional[pulumi.Input[str]] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n app_name: Optional[pulumi.Input[str]] = None,\n bundle_id: Optional[pulumi.Input[str]] = None,\n encoded_icon: Optional[pulumi.Input[str]] = None,\n ...
[ "0.630705", "0.62093353", "0.5937807", "0.5906766", "0.58660024", "0.5842525", "0.5815528", "0.5810119", "0.57605904", "0.5707702", "0.56638414", "0.5595551", "0.5584274", "0.5507556", "0.54897803", "0.54602087", "0.545936", "0.5440434", "0.5406404", "0.53876024", "0.5386581"...
0.6578928
0
Get stored username if available.
def get_stored_username(): filename = "username.json" try: with open(filename) as f_obj: username = json.load(f_obj) except FileNotFoundError: return None else: return username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stored_username():\n\tfilename = \"username.json\"\n\ttry:\n\t\twith open(filename) as f_obj:\n\t\t\tusername = json.load(f_obj)\n\texcept FileNotFoundError:\n\t\treturn None \n\telse:\n\t\treturn username", "def get_stored_username():\r\n filename = 'username.json'\r\n try:\r\n with open(fi...
[ "0.80084234", "0.7860824", "0.7860824", "0.77337587", "0.7692235", "0.7661099", "0.7614534", "0.7614534", "0.7606338", "0.76051843", "0.7582414", "0.7569334", "0.7553831", "0.7550343", "0.7530772", "0.75279033", "0.75176704", "0.7506862", "0.74946254", "0.7452427", "0.7451952...
0.8053478
0
Get stored username if available.
def get_stored_username(): filename = "username.json" try: with open(filename) as f_obj: username = json.load(f_obj) except FileNotFoundError: return None else: return username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stored_username():\n\tfilename = \"username.json\"\n\ttry:\n\t\twith open(filename) as f_obj:\n\t\t\tusername = json.load(f_obj)\n\texcept FileNotFoundError:\n\t\treturn None \n\n\telse:\n\t\treturn username", "def get_stored_username():\r\n filename = 'username.json'\r\n try:\r\n with open(...
[ "0.8051945", "0.78594524", "0.78594524", "0.77323157", "0.76917595", "0.7660222", "0.7613819", "0.7613819", "0.760575", "0.7604611", "0.75829405", "0.7569313", "0.75526786", "0.7548911", "0.7530948", "0.7527688", "0.75176305", "0.7505123", "0.74932265", "0.74517757", "0.74511...
0.800696
1
returns a list of paragraphs contained in the text
def get_paragraphs(text): return [LINE_START.sub(' ', p) for p in PARAGRAPH_SEP.split(text)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paragraph(self, text):\n return [text]", "def split_text_into_paragraphs(text: str) -> List[str]:\n text_aux = text.strip()\n paragraphs = text_aux.split('\\n\\n') # Strip any leading whitespaces\n\n for p in paragraphs:\n p = p.strip()\n\n return [p.strip() for p in paragraphs if l...
[ "0.83955187", "0.8125166", "0.73720586", "0.73144215", "0.72213405", "0.72148705", "0.7213667", "0.71561956", "0.7006088", "0.69887197", "0.6966877", "0.6940387", "0.6864319", "0.67950994", "0.6791216", "0.6780613", "0.67112476", "0.6685332", "0.66705334", "0.6630639", "0.656...
0.84038633
0
Returns the summary description for this Extension, which, by convention, is the first paragraph of the description.
def summary(self): return get_paragraphs(self.description)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description(self):\n if hasattr(self.ext, 'description'):\n return self.ext.description.strip()\n elif self.ext.__class__.__doc__:\n return self.ext.__class__.__doc__.strip()\n else:\n return ''", "def get_description(self):\n return IntrospectorHe...
[ "0.78256536", "0.7639952", "0.7486263", "0.7451264", "0.7446568", "0.74452317", "0.74394786", "0.7426617", "0.74184203", "0.73955905", "0.7391044", "0.7347202", "0.7347202", "0.7345788", "0.7345788", "0.73437405", "0.73416024", "0.73233247", "0.7322152", "0.73155564", "0.7305...
0.8215133
0
The description for an extension is specified in the ``description`` attribute, or (legacy) as a docstring for the extension's class. If neither method is used in the Extension, an empty string is returned. Description is assumed to be formed as reStructuredText. Leading and trailing whitespace will be stripped away.
def description(self): if hasattr(self.ext, 'description'): return self.ext.description.strip() elif self.ext.__class__.__doc__: return self.ext.__class__.__doc__.strip() else: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_description(cls) -> str:\n return cls.__doc__ or \"\"", "def get_description(self):\n class_docs = self._clean_docs(get_view_description(self.callback))\n method_docs = self._clean_docs(formatting.dedent(smart_text(self.get_docs())))\n\n if self.yaml_parser.get_param('replace_...
[ "0.77743053", "0.7568844", "0.751977", "0.7513608", "0.7374288", "0.71934885", "0.7123118", "0.7123118", "0.7105097", "0.70527655", "0.70462865", "0.70462865", "0.70462865", "0.70075434", "0.6994637", "0.69777375", "0.6932944", "0.6932944", "0.6932944", "0.6896635", "0.689663...
0.8140012
0
Parse the definition of a lambda function in to a readable string.
def _parse_lambda(text): text = text.split('lambda')[1] param, rest = text.split(':') param = param.strip() # There are three things that could terminate a lambda: an (unparenthesized) # comma, a new line and an (unmatched) close paren. term_chars = [',', '\n', ')'] func_text = '' inside...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_func_dict(self):\n\t\tindex = 0\n\t\twhile index < len(self.tokens):\n\t\t\tif self.tokens[index] == '\\\\': #Lambda\n\t\t\t\t#Every lambda looks like this:\n\t\t\t\t#(\\ (param1:type1, ...) : return_type\n\t\t\t\t# expression)\n\n\t\t\t\t#That expression can then be used as a function\n\t\t\t\t#i.e. ( ...
[ "0.6225172", "0.59550136", "0.5897792", "0.5850685", "0.562561", "0.5619098", "0.5595857", "0.5573676", "0.5565101", "0.5544661", "0.5513691", "0.54889256", "0.5487526", "0.54580456", "0.5446128", "0.54205024", "0.5382486", "0.5373196", "0.5371395", "0.5340549", "0.5324547", ...
0.74260104
0
Create a new Currency dict and add it to the CurrencyHandler.
def add(self, key, name, value, amount): if key in self.attr_dict: raise CurrencyException("Currency '{}' already exists.".format(key)) currency = dict(name=name, value=value, amount=amount) self.attr_dict[key] = currency
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, currency, display_currency):\n self.currency = currency\n self.display_currency = display_currency\n self.values = None", "def map_to_currency(self, raw_currency: HitbtcRawCurrencyModel) -> HitbtcCurrencyModel:\n\n id_ = raw_currency[\"id\"]\n full_name = raw...
[ "0.5917275", "0.570883", "0.5634314", "0.56333137", "0.55009085", "0.5496", "0.5457588", "0.5425929", "0.53408206", "0.5267455", "0.5263783", "0.52430415", "0.5228132", "0.5224954", "0.51914513", "0.51243484", "0.5094641", "0.5089338", "0.50723237", "0.5067563", "0.50572497",...
0.63672763
0
Remove a Currency type from the handler's parent object.
def remove(self, currency): if currency not in self.attr_dict: raise CurrencyException("Currency not found: {}".format(currency)) if currency in self.cache: del self.cache[currency] del self.attr_dict[currency]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\r\n # Remove all Currency from the handler's parent object.\r\n for currency in self.all:\r\n self.remove(currency)", "def remove_type(self, name):\n del self.types[name]", "def remove_type(self, ):\n if self.AttributeNames.TYPE in self.attrs:\n ...
[ "0.6193116", "0.55905527", "0.549678", "0.5357405", "0.51942194", "0.51325464", "0.51260585", "0.5102608", "0.50955", "0.5081388", "0.5029094", "0.50187397", "0.49982652", "0.49570727", "0.4936209", "0.4920673", "0.49129695", "0.49034035", "0.4890635", "0.48889416", "0.487815...
0.5936809
1
Remove all Currency dicts from the handler's parent object.
def clear(self): # Remove all Currency from the handler's parent object. for currency in self.all: self.remove(currency)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n for key in list(self.__dict__.keys()):\n delattr(self, key)", "def cleanup(child):\n children = child.get('children', [])\n for childchild in children:\n cleanup(childchild)\n cleaned = {u'title': child['Title'], u'name': child['id'],\n ...
[ "0.57909", "0.5746782", "0.56116277", "0.55796325", "0.54936713", "0.5380487", "0.5332281", "0.5308741", "0.53043014", "0.52858925", "0.52858526", "0.5236914", "0.522649", "0.51926285", "0.51492065", "0.5148016", "0.5147857", "0.5141735", "0.5112459", "0.5112424", "0.509728",...
0.79079336
0
Support equality comparison Currency or Currency and numeric
def __eq__(self, other): if type(other) == Currency: return self.amount == other.amount elif type(other) in (float, int): return self.amount == other else: return NotImplemented
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_same(from_currency, to_currency):\n return from_currency == to_currency", "def test_no_decimals_01(self):\n self.assertEqual(currency(188.01, False), \"$188.01\")", "def almost_equals(self, other, decimal=...): # -> bool:\n ...", "def test_cast_non_numeric_true():\n assert _curren...
[ "0.6794627", "0.64148045", "0.62916714", "0.6287303", "0.60861164", "0.60342294", "0.6019424", "0.5987673", "0.59783924", "0.59031796", "0.58725405", "0.58359087", "0.58123523", "0.5782787", "0.574468", "0.5706439", "0.56989497", "0.5686803", "0.5669239", "0.5667254", "0.5640...
0.71312416
0
Return a function to evaluate the discrete Morse homotopy associated with an acyclic partial matching
def MorseMatchingHomotopy(M, cellcomplex): # Semantic sugar def bd(chain): return cellcomplex.boundary(chain) def dim(chain_or_cell): return chain_or_cell.dimension() def isAce(cell): return dim(cell) == dim(M(cell)) def isKing(cell): return dim(cell) > dim(M(cell)) def isQueen(cell): return dim(cell) < dim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n long_sequence = input(\"Please give ne a DNA sequence to search: \")\n short_sequence = input(\"What DNA sequence would you like to match? \")\n\n # converts characters to uppercase\n new_long_sequence = long_sequence.upper()\n new_short_sequence = short_sequence.upper()\n\n ans = h...
[ "0.568604", "0.5550278", "0.55182356", "0.5509188", "0.55079424", "0.545774", "0.5452866", "0.5362582", "0.5347199", "0.53404784", "0.5319574", "0.5285013", "0.52706766", "0.5214127", "0.52138937", "0.52030486", "0.5202635", "0.51983035", "0.51891065", "0.5171054", "0.5169706...
0.6065373
0
Iterate over buckets of data in ANI HDF5 file. Yields dicts with atomic numbers (shape [Na,]) coordinated (shape [Nc, Na, 3]) and other available properties specified by `keys` list, w/o NaN values.
def iter_data_buckets(h5filename, keys=['wb97x_dz.energy']): keys = set(keys) keys.discard('atomic_numbers') keys.discard('coordinates') with h5py.File(h5filename, 'r') as f: for grp in f.values(): Nc = grp['coordinates'].shape[0] mask = np.ones(Nc, dtype=np.bool) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterkeys(self):\n\n for bucket in self.buckets.itervalues():\n for key in bucket.iterkeys():\n yield key", "def htable(nbuckets):", "def __iter__(self):\n for bucket in self._table:\n if bucket is not None:\n for key in bucket:\n ...
[ "0.5657797", "0.5585814", "0.53900796", "0.5333531", "0.5257857", "0.5257857", "0.52129817", "0.51868516", "0.50570804", "0.5018617", "0.50166976", "0.49701107", "0.4946062", "0.49454343", "0.484364", "0.4842193", "0.4812853", "0.47965416", "0.47817302", "0.47817302", "0.4780...
0.79150766
0
Count the number of upper case characters in a given message `message` is the piece of text to be checked Returns the number of uppercase characters in a message
def count_upper_case(message): return sum([1 for c in message if c.isupper()])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLength(message):\r\n length = 0\r\n for char in message:\r\n if char in alphaUpper or alphaLower:\r\n length += 1\r\n return length", "def case_count(in_string):\n uppercase_count = 0\n lowercase_count = 0\n\n for letter in in_string:\n if letter != \" \":\n ...
[ "0.76881474", "0.66344357", "0.64046204", "0.6375004", "0.6359969", "0.63339776", "0.62310714", "0.62267077", "0.61728984", "0.6039535", "0.6034788", "0.603373", "0.5897213", "0.58886296", "0.5847596", "0.58371395", "0.5793622", "0.5778446", "0.576237", "0.572816", "0.5728015...
0.92106265
0
Check if Stack Exchange API is reachable.
def stack_exchange_is_reachable(context): try: requests.get(context.platform_url, timeout=context.request_timeout) except requests.ConnectionError: raise requests.ConnectionError('Unable to connect to the test URL {} -' ' please ensure that Stack Exchange API is reachable' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_internet_connection():\n logging.debug('Checking internet connection')\n try:\n urlopen(config.api_base_url,\n timeout=config.timeout_internet_connection)\n logging.debug('Connected to the internet')\n return True\n except URLError ...
[ "0.66989774", "0.66208327", "0.6614344", "0.6565945", "0.65571225", "0.65221137", "0.65119606", "0.65000445", "0.645827", "0.6399361", "0.6377966", "0.63600194", "0.632734", "0.6323393", "0.62960714", "0.6262202", "0.62426513", "0.62426513", "0.6221098", "0.6217657", "0.62105...
0.8277769
0
Get activity feed for a specific term. Will save the response to the context.response.
def get_activity_feed(context, term): if not term: raise ValueError('You have to provide a search term!') url = '{}{}'.format(context.test_url, term) response = requests.get(url, timeout=context.request_timeout) context.response = response logging.debug('Request URL: %s', response.request.ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, term=None):\r\n params = base.get_params(None, locals())\r\n\r\n return http.Request('GET', self.get_url(), params), parsers.parse_json", "def get_timeline_feed(self):\n return self.send_request('feed/timeline/')", "def find(self, term, org_id=None, start=None, limit=None):\r...
[ "0.56197536", "0.5552734", "0.54598755", "0.537812", "0.5318107", "0.5318107", "0.5227282", "0.52052367", "0.5178025", "0.5172108", "0.5171409", "0.5165473", "0.5093184", "0.50673497", "0.50450003", "0.5041239", "0.502026", "0.49861795", "0.49600667", "0.4909415", "0.4890173"...
0.8386549
0
Check whether response contain an array of items of a given name.
def response_contains_array_named(context, array_name): assert context.response response = context.response.json() assert array_name in response assert isinstance(response[array_name], list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_should_contain_array_of_tags(context):\n items = context.response.json()['items']\n for item in items:\n assert 'tags' in item\n assert isinstance(item['tags'], list)\n assert len(item['tags']) > 0", "def assertContains(self, response, item):\n self.assertTrue(item in ...
[ "0.6806014", "0.6544438", "0.63810015", "0.6246651", "0.62384456", "0.6114904", "0.6087918", "0.5934501", "0.5888366", "0.5861772", "0.5813326", "0.57487196", "0.5719626", "0.57110256", "0.5709076", "0.57081497", "0.56947345", "0.5662339", "0.56485534", "0.56288683", "0.56015...
0.7968945
0
Check whether response contains all expected meta fields.
def response_contains_meta_data(context): meta_fields = ['has_more', 'quota_max', 'quota_remaining'] assert context.response response = context.response.json() all(field in response for field in meta_fields) logging.debug( 'Response contains all expected meta fields: %s', ', '.join(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_response_with_requested_fields(self, response):\n self.verify_response_block_dict(response)\n for block_key_string, block_data in response.data['blocks'].items():\n block_key = deserialize_usage_key(block_key_string, self.course_key)\n xblock = self.store.get_item(blo...
[ "0.6693891", "0.6663167", "0.6655489", "0.66543275", "0.66095656", "0.6575519", "0.65531754", "0.65499854", "0.64771754", "0.6439268", "0.6378267", "0.6323601", "0.6306553", "0.630628", "0.630395", "0.6283602", "0.62788475", "0.627194", "0.62715685", "0.626346", "0.6247732", ...
0.8509814
0
Ensure that every item in the response contains an array of tags.
def items_should_contain_array_of_tags(context): items = context.response.json()['items'] for item in items: assert 'tags' in item assert isinstance(item['tags'], list) assert len(item['tags']) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_badge_should_have_tags(self):\n\n badge = self.get_sample_badge()\n # It's a string, even though it is used as a URL\n self.assertIsInstance(badge.tags, list)", "def tags(self, val: list):\n self._tags = []\n if val is not None:\n for item in val:\n ...
[ "0.65274763", "0.6096695", "0.60390615", "0.6012579", "0.59465754", "0.5924211", "0.5851703", "0.58414054", "0.58393604", "0.574799", "0.5740444", "0.57277584", "0.57275933", "0.5697522", "0.568074", "0.56763333", "0.5671604", "0.56634396", "0.56573635", "0.5625177", "0.56193...
0.8310971
0
Ensure that every item in the response contains a valid Owner object.
def items_should_contain_owner_object(context): items = context.response.json()['items'] existing_owner_fields = [ 'accept_rate', 'display_name', 'link', 'profile_image', 'reputation', 'user_id', 'user_type' ] non_existing_owner_fields = ['display_name', 'user_type'] for item in ite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_owner(self):\n self.business_item_class.businesses_list = [{\"owner\": \"chairman\", \"business_name\":\"Maendeleo\", \"category\":\"Backaend\", \"location\":\"myhomecity\"},\n {\"owner\": \"chairmanwe\", \"business_name\":\"NshMaendeleo\", \"category...
[ "0.67120254", "0.628647", "0.626169", "0.6243804", "0.6208822", "0.62073964", "0.61624324", "0.6073476", "0.58263224", "0.5776256", "0.5770972", "0.5699032", "0.56948596", "0.56849164", "0.568436", "0.5622189", "0.5601501", "0.55977744", "0.55893403", "0.5566115", "0.5523703"...
0.746889
0
Ensure that every item in the response has all required fields.
def items_should_contain_required_values(context): items = context.response.json()['items'] item_fields = [ 'answer_count', 'creation_date', 'is_answered', 'last_activity_date', 'last_edit_date', 'link', 'question_id', 'score', 'title', 'view_count' ] for item in items: all(field...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_required_fields(self):\n assert self.title\n assert self.format", "def validate_get_openings_result(self, result):\n\n\n requiredFields = {'company', 'title', 'url', 'locations'}\n #optionalFields = {'department', 'description'}\n\n for r in result:\n if not requiredField...
[ "0.68737304", "0.68655205", "0.66592115", "0.6587089", "0.64782315", "0.64589465", "0.64533013", "0.6435127", "0.64257926", "0.64171165", "0.63953066", "0.6352463", "0.6342748", "0.62600017", "0.6251869", "0.62157905", "0.61955905", "0.6174185", "0.6167766", "0.6143471", "0.6...
0.7643728
0
Ensure that every existing owner has a valid profile link.
def every_existing_owner_should_have_valid_profile_link(context): items = context.response.json()['items'] for item in items: owner = item['owner'] if owner['user_type'] == 'does_not_exist': continue link = owner['link'] assert validators.url(link), ( 'Own...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_existing_owner_should_have_valid_profile_image_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if owner['user_type'] == 'does_not_exist':\n continue\n link = owner['profile_image']\n assert validators.ur...
[ "0.81346124", "0.7327867", "0.70217496", "0.57078815", "0.56042165", "0.5574404", "0.5555378", "0.5555031", "0.5531482", "0.55212975", "0.54598325", "0.5458646", "0.54356337", "0.5423258", "0.54028314", "0.53994626", "0.5353369", "0.5349723", "0.5343116", "0.5318732", "0.5305...
0.8567939
0
Ensure that every nonexisting owner does not have a profile link.
def every_non_existing_owner_should_not_have_profile_link(context): items = context.response.json()['items'] for item in items: owner = item['owner'] if not owner['user_type'] == 'does_not_exist': continue assert 'link' not in owner logging.debug( 'Not exi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_non_existing_owner_should_not_have_profile_image_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if not owner['user_type'] == 'does_not_exist':\n continue\n assert 'profile_image' not in owner\n logging....
[ "0.7915558", "0.7725596", "0.732559", "0.5984721", "0.5927636", "0.5710254", "0.56239164", "0.561968", "0.55680996", "0.5519447", "0.5508988", "0.55037135", "0.5468769", "0.54237384", "0.5405099", "0.5354824", "0.5347382", "0.5337534", "0.5323421", "0.5308325", "0.5308029", ...
0.8253403
0
Ensure that every existing owner has a valid profile image link.
def every_existing_owner_should_have_valid_profile_image_link(context): items = context.response.json()['items'] for item in items: owner = item['owner'] if owner['user_type'] == 'does_not_exist': continue link = owner['profile_image'] assert validators.url(link), ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_existing_owner_should_have_valid_profile_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if owner['user_type'] == 'does_not_exist':\n continue\n link = owner['link']\n assert validators.url(link), (\n ...
[ "0.79280406", "0.7527706", "0.6885025", "0.60402876", "0.6003037", "0.59512144", "0.5904009", "0.56071186", "0.5574767", "0.5533807", "0.5490869", "0.5467004", "0.54500294", "0.5436294", "0.5308155", "0.530222", "0.5301662", "0.52993053", "0.5294203", "0.5291245", "0.52869546...
0.8664172
0
Ensure that every nonexisting owner does not have a profile image link.
def every_non_existing_owner_should_not_have_profile_image_link(context): items = context.response.json()['items'] for item in items: owner = item['owner'] if not owner['user_type'] == 'does_not_exist': continue assert 'profile_image' not in owner logging.debug( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_existing_owner_should_have_valid_profile_image_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if owner['user_type'] == 'does_not_exist':\n continue\n link = owner['profile_image']\n assert validators.ur...
[ "0.7888664", "0.7846485", "0.7278047", "0.5966033", "0.577156", "0.56805646", "0.5594332", "0.55319285", "0.55122435", "0.55100256", "0.54839927", "0.54645336", "0.5443735", "0.5442845", "0.5432065", "0.5430972", "0.54200304", "0.5411189", "0.538969", "0.53602254", "0.5352974...
0.8378017
0
Save all the tags from the response to a list and remove the duplicates.
def save_tags(context): items = context.response.json()['items'] tags = set() for item in items: for tag in item['tags']: tags.add(tag) context.tags = list(tags) logging.debug('Saved all tags in context.tags:\n%s', pformat(sorted(context.tags)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags_list_should_have_no_duplicates(context):\n assert context.tags\n # converting a list to a set will remove all the duplicates\n # then we need to:\n # * convert it back to a list\n # * sort both lists\n # and finally compare both lists\n unique_tags = list(set(context.tags))\n asser...
[ "0.6612473", "0.65779996", "0.6445509", "0.6408463", "0.6118125", "0.60956115", "0.6088668", "0.6061069", "0.6054814", "0.60351187", "0.60292125", "0.60233366", "0.5952991", "0.5945566", "0.5942648", "0.59026796", "0.5902645", "0.5877944", "0.583801", "0.5835275", "0.5810574"...
0.69064724
0
Ensure that we have a list of tags without duplicates.
def tags_list_should_have_no_duplicates(context): assert context.tags # converting a list to a set will remove all the duplicates # then we need to: # * convert it back to a list # * sort both lists # and finally compare both lists unique_tags = list(set(context.tags)) assert sorted(cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_duplicate(self):\r\n self.elements = list(set(self.elements))\r\n self.elements = [e for e in self.elements if e != '']", "def remove_duplicates_badSolution( li ):\n newli=[]\n seen = set()\n for item in li:\n if item not in seen:\n seen.add( item )\n ...
[ "0.66453546", "0.6560592", "0.6466691", "0.64423674", "0.6351733", "0.6341819", "0.6310374", "0.6308325", "0.6288973", "0.6214205", "0.6203075", "0.6181489", "0.6177429", "0.61650187", "0.61602896", "0.61400074", "0.61346847", "0.61290574", "0.61288965", "0.6081481", "0.60346...
0.8150041
0
Save a copy of the response JSON in context.response_copy
def copy_response(context): context.response_copy = context.response.json() logging.debug('Successfully copied the response')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_response(self, response):\n\n self._tmp_request_args = {}\n self.cache_response(response)", "def process_response(self, request, response):\n return response", "def process_response(self, request, response):\n return response", "def adapt_response(self, response):\n ...
[ "0.61301494", "0.6077249", "0.6077249", "0.6065612", "0.6065612", "0.6027532", "0.6017143", "0.6011364", "0.5959202", "0.5923965", "0.59199226", "0.5805134", "0.58009046", "0.5782035", "0.57615286", "0.5734818", "0.57223654", "0.56809473", "0.5680268", "0.56554216", "0.563393...
0.8781387
0
Remove selected field from all items created by existing owners.
def remove_field_from_every_item_in_response_copy(context, name): items = context.response_copy['items'] for item in items: print(item) if item['owner']['user_type'] == 'does_not_exist': continue if name in item: del(item[name]) logging.debug( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_remove_field(self, item, field_name):\n\t\treturn self._modify_object(item=item, field_name=field_name, new_value=None, new_field_name=None)", "def clear_removed_items(self, doctype, items):\n\t\tif items:\n\t\t\tfrappe.db.delete(doctype, dict(parent=self.doc_type, custom=1, name=(\"not in\", items)))\n...
[ "0.62011784", "0.5961859", "0.59229326", "0.58401084", "0.5837176", "0.58022887", "0.57983875", "0.5730194", "0.56140786", "0.5594127", "0.5592921", "0.5575774", "0.5530778", "0.5521096", "0.55118966", "0.55083996", "0.54819924", "0.5477148", "0.5472141", "0.54695934", "0.546...
0.59960264
1
Replace value of selected field in all items with provided value. It will skip items created by nonexisting owners.
def replace_field_value_in_every_item_in_response_copy(context, name, value): items = context.response_copy['items'] for item in items: print(item) if item['owner']['user_type'] == 'does_not_exist': continue if name in item: item[name] = value logging....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_all_item_field_value(**kwargs):\n\n # Filters\n filters = {\n 'disabled': 0,\n 'name': ('like', '%{0}%'.format(kwargs['keyword']))\n }\n\n # Get all Item fields based from the filters\n items = frappe.get_all('Item', filters=filters, fields=['name'])\n\n # Counters\n cur_...
[ "0.6645392", "0.6219248", "0.5475644", "0.54732466", "0.5421802", "0.54202026", "0.53525484", "0.53490883", "0.52693343", "0.5268808", "0.5259692", "0.5259692", "0.52306306", "0.5225818", "0.5224571", "0.52180886", "0.51984584", "0.51984584", "0.51893437", "0.5163014", "0.515...
0.6334869
1
Finds all objects containing the subject_id and returns them
def find_all_by_id(self, subject_id) -> any: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_id(self, subject_id: str) -> any:\n pass", "def get_by_subject(subject_name):\n return filter_by_prefix(Subscription.all(), subject_name + ':')", "def subject_tag_get_all(context, subject_id, session=None):\n _check_subject_id(subject_id)\n session = session or get_session()\n ...
[ "0.7556286", "0.6888728", "0.6579627", "0.6536872", "0.64493823", "0.6445906", "0.632408", "0.6205879", "0.6202196", "0.6156358", "0.6086483", "0.60020995", "0.59908074", "0.5937208", "0.59239584", "0.5871959", "0.5849564", "0.5790128", "0.57615757", "0.57059926", "0.5698278"...
0.81462866
0
Finds an object containing the subject_id and returns it
def find_by_id(self, subject_id: str) -> any: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_subject(subject_id: SubjectID) -> Optional[Subject]:\n subject = DbSubject.query.get(subject_id)\n\n if subject is None:\n return None\n\n return _db_entity_to_subject(subject)", "def get_by_subject(subject):\n return MinimalSubject.all().ancestor(subject).get()", "def _subject_...
[ "0.78996885", "0.7125832", "0.7050861", "0.6940713", "0.6925259", "0.6538362", "0.6424567", "0.6345011", "0.62792736", "0.6265822", "0.61672187", "0.6031679", "0.602013", "0.6006688", "0.59961396", "0.59424037", "0.5910332", "0.59004784", "0.5890035", "0.58306265", "0.5798813...
0.8395928
0
Updates an object containing the subject_id and returns it
def update_by_id(self, subject_id: str, new_subject_data: any) -> any: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, subject: Subject) -> None:\n pass", "def update(self, subject: Subject) -> None:\n pass", "def subject_update(context, subject_id, values, purge_props=False,\n from_state=None):\n return _subject_update(context, values, subject_id, purge_props,\n ...
[ "0.73226655", "0.73226655", "0.72892255", "0.675578", "0.659356", "0.64588344", "0.6458803", "0.6387519", "0.6223908", "0.5985143", "0.59724844", "0.59556586", "0.5807392", "0.579997", "0.579997", "0.579997", "0.57938385", "0.57718307", "0.5745582", "0.57401335", "0.5733652",...
0.7856727
0
Deletes an object containing the subject_id and returns whether the operation was successful or not
def delete_by_id(self, subject_id: str) -> any: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, subject: str, predicate: str, obj: str):\n self._connector.delete(subject, predicate, obj)", "def deleteSubject(request, run_uuid):\n if request.method == 'POST':\n subject_data = get_object_or_404(SubjectData, pk=run_uuid)\n subject_data.delete()\n logger.info('Su...
[ "0.72939754", "0.70899653", "0.7075572", "0.70754683", "0.67888206", "0.67685735", "0.66285473", "0.6461525", "0.64063144", "0.6379194", "0.6373855", "0.63733524", "0.6321114", "0.6313565", "0.6271722", "0.6264547", "0.6259215", "0.62446636", "0.62331057", "0.62281626", "0.62...
0.7706765
0
Processes the command used to run Wumpus from the command line.
def readCommand( argv ): from optparse import OptionParser usageStr = """ USAGE: python wumpus.py <options> EXAMPLES: python wumpus.py --agent DummyAgent OR python wumpus.py -a DummyAgent - run wumpus with the dummy agent """ parser = OptionParser(usag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readCommand( argv ):\n from optparse import OptionParser\n usageStr = \"\"\"\n USAGE: python wumpus.py <options>\n EXAMPLES: (1) python wumpus.py\n - starts simple manual Hunt The Wumpus game\n (2) python wumpus.py -k OR python wumpus.py --kb\n ...
[ "0.635491", "0.59744203", "0.593825", "0.5796646", "0.57032573", "0.5658802", "0.5641519", "0.56319475", "0.56145334", "0.55581576", "0.55523694", "0.5529276", "0.5514777", "0.5502347", "0.54955745", "0.54887116", "0.546968", "0.54638857", "0.5458613", "0.5437348", "0.5431120...
0.6152857
1
Return str of the Question text.
def __str__(self): return self.question_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"question_text: \" + self.question_text \\\n + \"\\npub_date:\" + self.pub_date.__str__()", "def get_text(self):\n text_complet = \"\"\n rez_dict = self.__results\n for i in range(0, len(rez_dict[\"text\"])):\n text = rez_dict[\"...
[ "0.6952599", "0.6809651", "0.6728687", "0.6648696", "0.66370183", "0.6636884", "0.6636884", "0.6626152", "0.6611225", "0.653698", "0.64683396", "0.63943976", "0.63455355", "0.6336619", "0.62959063", "0.629548", "0.62926376", "0.6262842", "0.62339336", "0.62285537", "0.6215401...
0.7432616
0
Check The question is published.
def is_published(self): now = timezone.now() return now >= self.pub_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_published(self) -> bool:\n return self.published and self.published <= timezone.now()", "def test_waspublished_recently_with_future_question(self):\n time = timezone.now() + datetime.timedelta(days=30)\n future_question = Question(pub_date=time)\n self.assertIs(future_question....
[ "0.71493137", "0.7063946", "0.6903579", "0.68560255", "0.684703", "0.683168", "0.683168", "0.67990464", "0.6755138", "0.6693469", "0.661171", "0.6581404", "0.6526466", "0.6474297", "0.646864", "0.6438965", "0.642411", "0.6422557", "0.641191", "0.63997775", "0.6394392", "0.6...
0.74736017
0
Return str of choice text.
def __str__(self): return self.choice_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"choice_text: \" + self.choice_text", "def __str__(self):\n return gettext('One of %s') % self._get_choices_str()", "def GetStringSelection(self):\n \n return self.choices[self.selected].GetLabel()", "def GetString(self, index):\n \n retu...
[ "0.7722265", "0.732926", "0.7012607", "0.6919962", "0.6744218", "0.6717672", "0.6714625", "0.66818357", "0.6642152", "0.65575504", "0.6554381", "0.6462773", "0.6462773", "0.6441141", "0.64289695", "0.6358801", "0.63565093", "0.6310224", "0.63069963", "0.6293395", "0.62826407"...
0.7704613
1
log in to drive
def login():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):\n\t\treturn", "def login(self):", "def login(self):\n self.driver.get(self.login)\n PAUSE = 2\n time.sleep(PAUSE)\n user_input = self.driver.find_element_by_name('username')\n pass_input = self.driver.find_element_by_name('password')\n login_button = s...
[ "0.74581724", "0.7158189", "0.7104258", "0.70794123", "0.7079039", "0.70618725", "0.7040776", "0.6952491", "0.6865552", "0.6833988", "0.68089366", "0.67485416", "0.67315876", "0.6722878", "0.6720476", "0.67203325", "0.6719856", "0.67019886", "0.6689592", "0.66611564", "0.6658...
0.75863075
1