query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Move in any number of components. Play ends immediately when any one of them terminates.
def shortened_selective(G, H): if G == 0 or H == 0: return Game(0) else: left_1 = {shortened_selective(G_L, H) for G_L in G._left} left_2 = {shortened_selective(G, H_L) for H_L in H._left} left_3 = {shortened_selective(G_L, H_L) for G_L in G._left for H_L in H._left} righ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, move):", "def move(self, direction, cycles):\n\t\tpass", "def play_one_move(self):\n self.print(\"top of move\")\n # 1) grab three cups\n c1 = self.take_cup_after(self.current_cup_idx())\n c2 = self.take_cup_after(self.current_cup_idx())\n c3 = self.take_cup_af...
[ "0.6211425", "0.6173831", "0.61515653", "0.6146583", "0.6010369", "0.5992647", "0.5982725", "0.59735733", "0.5913756", "0.5895911", "0.58365816", "0.58361745", "0.5823543", "0.58000946", "0.5799006", "0.57247883", "0.5719981", "0.56969666", "0.5695416", "0.56931174", "0.56494...
0.0
-1
Move in G or H; any move on G annihilates H.
def ordinal(G, H): left_1 = {G_L for G_L in G._left} left_2 = {ordinal(G, H_L) for H_L in H._left} right_1 = {G_R for G_R in G._right} right_2 = {ordinal(G, H_R) for H_R in H._right} return Game(left_1 | left_2, right_1 | right_2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def motion(self):\n priority = {\"north\": [-1, 0], \"south\": [1, 0],\n \"east\": [0, 1], \"west\": [0, -1]}\n\n priority_list = [\"north\", \"south\", \"east\", \"west\"]\n\n critical_point = False\n while critical_point is False:\n row = self.curr_cell.r...
[ "0.62201995", "0.6193219", "0.6165103", "0.6142477", "0.6131183", "0.6131183", "0.6123463", "0.61130327", "0.6012472", "0.6008436", "0.5991805", "0.59813476", "0.5972275", "0.5968505", "0.5963034", "0.5935124", "0.5929206", "0.5914797", "0.5888824", "0.5884273", "0.5882048", ...
0.0
-1
Move in G or H; Left's moves on H annihilate G, and Right's moves on G annihilate H.
def side(G, H): left_1 = {side(G_L, H) for G_L in G._left} left_2 = {H_L for H_L in H._left} right_1 = {G_R for G_R in G._right} right_2 = {side(G, H_R) for H_R in H._right} return Game(left_1 | left_2, right_1 | right_2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, down=False, left=False, right=False):\n if down:\n self.coordinate[1] += 1\n if left:\n self.coordinate[0] -= 1\n if right:\n self.coordinate[0] += 1", "def move(self, direction):\n no_change = True\n if direction == UP or directi...
[ "0.6394155", "0.63442457", "0.63144624", "0.62927437", "0.6264041", "0.62053967", "0.62018025", "0.6189843", "0.6180043", "0.6168771", "0.61626536", "0.6146929", "0.61282694", "0.6116625", "0.61133975", "0.6102647", "0.6063666", "0.60415465", "0.6033389", "0.60310185", "0.601...
0.6058126
17
Move in G unless G has terminated; in that case move in H.
def sequential(G, H): if G == 0: return H else: left = {sequential(G_L, H) for G_L in G._left} right = {sequential(G_R, H) for G_R in G._right} return Game(left, right)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, direction):\n\n # Check if there are empty tiles available\n for row in self._grid:\n if row.count(0) != 0:\n self._game_over = False\n break\n else:\n self._game_over = True\n\n # If empty tiles are not availabl...
[ "0.61193955", "0.6106156", "0.6053537", "0.6007373", "0.6007373", "0.59468406", "0.592392", "0.5903729", "0.58486277", "0.5816572", "0.57885134", "0.5759423", "0.5719683", "0.57183707", "0.5706297", "0.56601727", "0.5640868", "0.5633844", "0.56242657", "0.56110877", "0.560880...
0.5804341
10
Fast calculation of the last digit for nth fibonacci number
def get_fibonacci_last_digit_fast(n): fibonacci = [0 for i in range(n + 1)] fibonacci[1] = 1 for i in range(2, n + 1): fibonacci[i] = (fibonacci[i - 1] + fibonacci[i - 2]) % 10 return fibonacci[n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fast_fibonacci(n):\n return _fast_fibonacci(n)[0]", "def fibonacci_iterative(nth_nmb: int) -> int:\n old, new = 0, 1\n if nth_nmb in (0, 1):\n return nth_nmb\n for __ in range(nth_nmb - 1):\n old, new = new, old + new\n return new", "def fibonacci(n):", "def last_fib_digit(n)...
[ "0.80113834", "0.7926261", "0.7902663", "0.78782165", "0.7486979", "0.74626005", "0.74536633", "0.7413848", "0.74006814", "0.7387231", "0.7384485", "0.7369879", "0.7365468", "0.7360676", "0.73546636", "0.7345966", "0.73451585", "0.73291713", "0.7324162", "0.7309868", "0.73053...
0.8372285
0
>> url_with_query_str(url2,d) >> url_with_query_str(url2,item=3)
def url_with_query_str(url, *args, **kwargs): if len(args): d = args[0] elif len(kwargs): d = kwargs else: raise Exception('not found dict') if any("%" in k for k in d.keys()): query = "&".join(["{}={}".format(k, v) for k, v in d.items()]) else: query = urlenc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(url):", "def append_to_query_string(url, key, value) -> str:\n url = list(urlparse(url))\n query = dict(parse_qsl(url[4]))\n query[key] = value\n url[4] = '&'.join(f'{p}={v}' for p, v in query.items())\n\n return urlunparse(url)", "def url_with_querystring(url, **kwargs):\n return u...
[ "0.67928225", "0.67825973", "0.6561243", "0.6552654", "0.65169346", "0.6306046", "0.6228931", "0.6158373", "0.611496", "0.611496", "0.6111448", "0.5982866", "0.59529686", "0.59064275", "0.59011614", "0.58814305", "0.5846428", "0.5833356", "0.58131963", "0.58082557", "0.578539...
0.6706186
2
find any sub dict contains pattern to list
def find_dict_to_list(target, pattern): result = [] if isinstance(target, dict): for k, v in target.items(): if k == pattern: result.append(v) if isinstance(v, dict) or isinstance(v, list): result.extend(find_dict_to_list(v, pattern)) if isinst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_pattern(d, pattern):\n\n arr = pattern.split(',')\n\n # deep first traversal\n def dfs(d, ks):\n for k, v in d.iteritems():\n deep_ks = ks + [k]\n if isinstance(v, dict):\n for x in dfs(v, deep_ks):\n yield x\n elif isinsta...
[ "0.64181477", "0.62333", "0.60661954", "0.6053393", "0.6028654", "0.5919138", "0.59016573", "0.57957387", "0.56953204", "0.5691425", "0.56884915", "0.56753486", "0.5641824", "0.5589715", "0.55569094", "0.55542064", "0.5539916", "0.5538737", "0.5517244", "0.54823405", "0.54643...
0.66776407
0
>> page_count = 1
def try_safety(): try: yield except Exception as e: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def per_page():\n return 100", "def get_num_of_pages(self):", "def pagecount(self):\r\n \r\n return len(self.results) // self.perpage + 1", "def __init__(\n self,\n page: int = 1,\n count: int = 100\n ):\n\n self.__page = page\n self.__count ...
[ "0.7716434", "0.75042117", "0.69272494", "0.6889232", "0.6838291", "0.6807002", "0.67616105", "0.66555864", "0.6643757", "0.6595023", "0.65141606", "0.64254767", "0.64211386", "0.6397808", "0.6366512", "0.63530225", "0.6330203", "0.6306304", "0.6284892", "0.62831354", "0.6261...
0.0
-1
allow lower string and ellipsis USD
def __init__(self, from_, to): r = requests.get('https://tw.rter.info/capi.php?api=HIeh22KXrDg') self.data = r.json() self.set_locations(from_, to)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_ellipsis(value: Any, annotation: Any) -> bool:\n return value == ...", "def test_unknown_lower(self):\n self.assertRaises(ParseException, self.flag.parseString, 'u')", "def not_capitalized(): # noqa: D416", "def check_suffix(custom_str: str) -> bool:\r\n\r\n if custom_str.startswith...
[ "0.59161186", "0.5861756", "0.57098544", "0.567699", "0.55550504", "0.55431426", "0.5531206", "0.55208945", "0.5520523", "0.55199224", "0.5467623", "0.54642934", "0.5460231", "0.5452652", "0.543034", "0.5401712", "0.5394865", "0.5384386", "0.5356569", "0.5353336", "0.533652",...
0.0
-1
if a value appears in all of the arrays, and they are all strictly increasing, then this value must appear exactly len(arrays) times in total. thefore, we can just use counter.
def longestCommomSubsequence(self, arrays: List[List[int]]) -> List[int]: counts = Counter(val for arr in arrays for val in arr) res = [] for val, count in counts.items(): if count == len(arrays): res.append(val) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_counts(self):\n c = array([5,0,1,1,5,5])\n obs = counts(c)\n exp = array([1,2,0,0,0,3])\n self.assertEqual(obs, exp)\n d = array([2,2,1,0])\n obs = counts(d, obs)\n exp = array([2,3,2,0,0,3])\n self.assertEqual(obs, exp)", "def test_expand_counts(s...
[ "0.64351225", "0.6377992", "0.6143563", "0.6087061", "0.6079206", "0.5938092", "0.5894608", "0.5874694", "0.5860922", "0.58520526", "0.5828922", "0.5760931", "0.57179666", "0.5716396", "0.5709742", "0.56982994", "0.5671705", "0.56269634", "0.5560963", "0.5557938", "0.5547964"...
0.5456102
28
Creates an architecture, train and saves CNN model.
def create_model(X, y, it=1, no_of_filters=32, kern_size=3, max_p_size=3, drop_perc_conv=0.3, drop_perc_dense=0.2, dens_size=128, val_split_perc=0.1, no_of_epochs=30, optimizer="adam", random_search=False, batch_size=64): y_train_cat = to_categorical(y) model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def training(self) -> None:\n self.compile_model()\n self.train_epoch()\n self.agent.save()", "def train(self):\n # Change directory to the code directory\n current_working_directory = os.getcwd()\n\n os.chdir(self.model_parameters[\"NN_code_directory\"])\n\n self...
[ "0.65566933", "0.6430984", "0.63435656", "0.63235104", "0.6310534", "0.6300286", "0.62917423", "0.62759864", "0.6256834", "0.6255446", "0.6250934", "0.6238774", "0.6236638", "0.62226385", "0.6220654", "0.62204754", "0.62131494", "0.619033", "0.61894095", "0.61800385", "0.6149...
0.0
-1
Perform random search on hyper parameters list, saves models and validation accuracies.
def run_random_search(X, y, params, no_of_searches=1): val_accs_list = [] for i in range(no_of_searches): # Creating a tuple for each iteration of random search with selected parameters params_dict = {"iteration": i + 1, "no_of_filters": rd.choice(params["no_of_filters"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_search(x_train, y_train, class_weights, iterations):\n # convert to dict\n class_weights = dict(enumerate(class_weights))\n model = KerasClassifier(build_fn=create_model)\n search = RandomizedSearchCV(estimator=model, param_distributions=get_param_grid(), n_jobs=-1,\n ...
[ "0.69401574", "0.69086534", "0.6886166", "0.6811497", "0.6625235", "0.6580007", "0.65565014", "0.6550856", "0.6543451", "0.6388397", "0.63488215", "0.63394517", "0.6330335", "0.6284484", "0.6281461", "0.6221932", "0.6217799", "0.6199469", "0.6148033", "0.6145245", "0.6135914"...
0.728307
0
Initialisation before each test
def setUp(self): self.user = User('lornatumuhairwe@gmail.com') self.bucketlists = bucketlists
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_run_tests(cls):\n pass", "def test_01_Init(self):\n pass", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "def setUp(self):\r\n pass # nothing used by all\r", "def testInit(self):\n self.globalInit()\n self.test....
[ "0.78963685", "0.7837676", "0.78089184", "0.7675184", "0.76734257", "0.76603454", "0.7562407", "0.75478095", "0.7500837", "0.74986845", "0.74986845", "0.7475696", "0.7475696", "0.747055", "0.7463248", "0.7460662", "0.7458466", "0.74370116", "0.74370116", "0.74370116", "0.7437...
0.0
-1
Open the given filepath as new document
def open_document(filepath, show=True): k = krita.Krita.instance() print('Debug: opening %s' % filepath) doc = k.openDocument(filepath) if show: Application.activeWindow().addView(doc) return doc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OpenFile(self,path):\n\t\tself.acad.Documents.Open(path)", "def open( self, filename ):\r\n #http://www.oooforum.org/forum/viewtopic.phtml?t=35344\r\n properties = []\r\n properties.append( OpenOfficeDocument._makeProperty( 'Hidden', True ) ) \r\n properties = tuple( properties )\...
[ "0.71345687", "0.7077146", "0.6891692", "0.6803087", "0.6435113", "0.6405236", "0.6325574", "0.6319938", "0.63061064", "0.62936294", "0.62163293", "0.6183678", "0.6156022", "0.613546", "0.6112902", "0.6065005", "0.6061486", "0.60015565", "0.599104", "0.59909385", "0.59620774"...
0.74578357
0
Return layers for given document
def get_layers(doc): nodes = [] root = doc.rootNode() for node in root.childNodes(): print('Debug: found node of type %s: %s' % (node.type(), node.name())) if node.type() == "paintlayer": nodes.append(node) return nodes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetLayers(self, *args):\n return _XCAFDoc.XCAFDoc_LayerTool_GetLayers(self, *args)", "def layers(self):\n return self['layers']", "def layers(self):\r\n return self._flc.layers", "def get_layers(self):\n layers = set()\n for element in itertools.chain(self.polygons, sel...
[ "0.6520093", "0.62724316", "0.6226186", "0.6219585", "0.6184488", "0.617257", "0.6022751", "0.5999213", "0.5996449", "0.59911495", "0.59911495", "0.59885573", "0.5977705", "0.5920823", "0.59155387", "0.5907288", "0.578981", "0.577481", "0.5718451", "0.57168806", "0.5716836", ...
0.7382613
0
Takes a folderpath, scans it for images and produces a layered image
def make_layered_psd_from_images(): doc = open_document(FILEPATHS[0], show=False) doc_root = doc.rootNode() docs = [] docs.append(doc) all_layers = get_layers(doc) for i in range(1, len(FILEPATHS)): docx = open_document(FILEPATHS[i], show=False) docs.append(docx) docx_layers = get_layers(docx) for l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_images():\n create_dirs()\n for root, dirs, files in os.walk(IN):\n for name in files:\n if name[0] == '.':\n continue\n process_image(name)", "def preprocess_images(file_path, new_file_path):\n if not os.path.isdir(new_file_path):\n os.mkdir(new_file_path)\n i = 0\...
[ "0.6705441", "0.66606784", "0.66355693", "0.6630097", "0.6620231", "0.65235883", "0.6487854", "0.6470951", "0.64556366", "0.6452505", "0.64215374", "0.64165586", "0.6411759", "0.64103657", "0.63933814", "0.63886434", "0.6387175", "0.6370868", "0.6368167", "0.63649637", "0.634...
0.5880972
86
r"""Linear Buckling Analysis It can also be used for more general eigenvalue analyzes if `K` is the tangent stiffness matrix of a given load state.
def lb(K, KG, tol=0, sparse_solver=True, silent=False, num_eigvalues=25, num_eigvalues_print=5): msg('Running linear buckling analysis...', silent=silent) msg('Eigenvalue solver... ', level=2, silent=silent) k = min(num_eigvalues, KG.shape[0]-2) if sparse_solver: mode = 'cayley' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kl(self):\n weights_logvar = self.weights_logvar\n kld_weights = self.prior_stdv.log() - weights_logvar.mul(0.5) + \\\n (weights_logvar.exp() + (self.weights.pow(2) - self.prior_mean)) / (\n 2 * self.prior_stdv.pow(2)) - 0.5\n kld_bias ...
[ "0.6005177", "0.59679455", "0.5812458", "0.56899565", "0.5655882", "0.56436425", "0.56320107", "0.56068176", "0.5601498", "0.5588093", "0.5575658", "0.5563244", "0.5541758", "0.5533754", "0.5525226", "0.55245745", "0.5521456", "0.5518431", "0.5517133", "0.5510947", "0.5510646...
0.6743835
0
Returns the last char in str and puts it in the start of the string
def rotate(str): return str[-1] + str[0:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFinal(endstr):\n if not endstr:\n return ''\n if endstr.endswith('ng'):\n return 'ng'\n lastchar = endstr[-1]\n if lastchar in ['m', 'b', 'n', \"x\", 'r', 'l', 't', 'x']:\n return lastchar\n return ''", "def without_end(s):\n string = ...
[ "0.70187014", "0.68761116", "0.67105657", "0.6151148", "0.60970205", "0.60693", "0.6025523", "0.5986093", "0.5985997", "0.5924223", "0.58663505", "0.5831064", "0.57959837", "0.57954246", "0.5769548", "0.5768758", "0.56947994", "0.5628521", "0.56253284", "0.5597253", "0.559370...
0.62549967
3
Tests that the shape exceptions are not raised.
def test_blend_exception_not_raised(self, *shapes): self.assert_exception_is_not_raised(linear_blend_skinning.blend, shapes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_filter_shape(self):\r\n self.assertRaises(AssertionError, self.validate,\r\n (3, 2, 8, 8), (4, 3, 5, 5),\r\n 'valid')", "def test_invalid_input_shape(self):\r\n seed_rng()\r\n verbose = 0\r\n random = True\r\n p...
[ "0.6945418", "0.6755534", "0.67414993", "0.6694937", "0.6694023", "0.66600835", "0.66173315", "0.6591706", "0.6588925", "0.6570135", "0.655559", "0.6552962", "0.6538423", "0.6515649", "0.6501363", "0.6500557", "0.6499036", "0.6486666", "0.6479138", "0.64725447", "0.6472377", ...
0.7027076
0
Tests that the shape exceptions are properly raised.
def test_blend_exception_raised(self, error_msg, *shapes): self.assert_exception_is_raised(linear_blend_skinning.blend, error_msg, shapes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raising_exceptions(self):\n with self.assertRaises(TypeError):\n r = Rectangle(10, \"2\")\n with self.assertRaises(TypeError):\n r = Rectangle(10, 2.1)\n with self.assertRaises(TypeError):\n r = Rectangle(10, True, \"\")\n with self.assertRaises...
[ "0.70977134", "0.699835", "0.69818157", "0.6931605", "0.68863946", "0.68632114", "0.67924774", "0.6786244", "0.67704517", "0.6718586", "0.66997606", "0.6689557", "0.66806877", "0.66716015", "0.6666777", "0.66590065", "0.6651967", "0.6648164", "0.66442925", "0.66421306", "0.66...
0.6719766
9
Test the Jacobian of the blend function.
def test_blend_jacobian_random(self): (x_points_init, x_weights_init, x_rotations_init, x_translations_init) = test_helpers.generate_random_test_lbs_blend() self.assert_jacobian_is_correct_fn( linear_blend_skinning.blend, [x_points_init, x_weights_init, x_rotations_init, x_translations_ini...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jacobian(self, x):\n pass", "def test_gradable_funcs(self):\n self.jit_grad_wrap(self.basic_lindblad.evaluate_rhs)(\n 1.0, Array(np.array([[0.2, 0.4], [0.6, 0.8]]))\n )\n\n self.basic_lindblad.rotating_frame = Array(np.array([[3j, 2j], [2j, 0]]))\n\n self.jit_gra...
[ "0.6469237", "0.6433962", "0.63694566", "0.60735285", "0.6070178", "0.6053421", "0.60161763", "0.6014657", "0.6007361", "0.59562653", "0.5943752", "0.58451694", "0.5841551", "0.5827975", "0.5810254", "0.57658637", "0.5765021", "0.5762377", "0.5761058", "0.5746416", "0.5742485...
0.7760398
0
Checks that blend returns the expected value.
def test_blend_preset(self): (x_points_init, x_weights_init, x_rotations_init, x_translations_init, y_blended_points_init) = test_helpers.generate_preset_test_lbs_blend() x_points = tf.convert_to_tensor(value=x_points_init) x_weights = tf.convert_to_tensor(value=x_weights_init) x_rotations = tf.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_blend_exception_not_raised(self, *shapes):\n self.assert_exception_is_not_raised(linear_blend_skinning.blend, shapes)", "def test_blend_exception_raised(self, error_msg, *shapes):\n self.assert_exception_is_raised(linear_blend_skinning.blend, error_msg,\n shapes)...
[ "0.6952455", "0.68123406", "0.66431445", "0.6207528", "0.5921364", "0.5576899", "0.5568129", "0.5498027", "0.54684174", "0.5457789", "0.5445635", "0.5384314", "0.53661835", "0.5361988", "0.53306603", "0.5323655", "0.5310901", "0.53062236", "0.53022057", "0.52813405", "0.52615...
0.61548996
4
GCP Demo for getting kubeconfig
def __init__(self, cluster_name: str, zone: str, sa_credentials_file_path: str): self.cluster_name = cluster_name self._credentials, self.project_id = load_credentials_from_file( sa_credentials_file_path, scopes=["https://www.googleapis.com/auth/cloud-platform"]) self.zone = zone ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kubeconfig(self):\n if not hasattr(self, \"_kubeconfig\"):\n result = self._client.get(\n \"{}/kubeconfig\".format(LKECluster.api_endpoint), model=self\n )\n\n self._kubeconfig = result[\"kubeconfig\"]\n\n return self._kubeconfig", "def get_kubeco...
[ "0.69225764", "0.6823009", "0.66998553", "0.6491604", "0.64744633", "0.6424243", "0.64148533", "0.6287709", "0.62613416", "0.6105515", "0.60799414", "0.6052628", "0.59891486", "0.5886678", "0.5679118", "0.5655762", "0.564688", "0.5644053", "0.5639444", "0.5615319", "0.559645"...
0.0
-1
This method is starting the GameContainer and therefore the application.
def main(): # Create logging file, rotate if filesize exceeds 1MB logger.add("logs/{time}.log", rotation="1 MB") GameContainer() logger.info("Started the game launcher. Make sure to support pygame!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_game(self):\n\n\t\tpass", "def game_start(self):\r\n\t\tself._comm_server.broadcast_message(\"game-start\")\r\n\t\tself._is_game_started = True\r\n\t\tself._handlers[\"game-start\"].invoke()\r\n\t\t_logger.info(\"Game is started.\")", "def startGame(self):\n\n\t\tfor name in self.players.keys():\n\t\...
[ "0.807372", "0.74237585", "0.72612226", "0.7219969", "0.72032", "0.7154529", "0.69690233", "0.6956275", "0.6946349", "0.69273055", "0.69193417", "0.6907522", "0.6899035", "0.68894184", "0.68699855", "0.6834413", "0.68263656", "0.67819047", "0.6769982", "0.67478347", "0.668809...
0.6935328
9
Module fixture for the IrisDataset class
def iris(): return IrisDataset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.dataset = self.dataset_cls()", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def test_get_iris_setosa_data(self):\n iris = get_iris_setosa_data()\n self.assertEqual(len(iris.data), 150)\n self.assertEqual(len(iris.labels), 150)", ...
[ "0.7222384", "0.71654016", "0.6917572", "0.68906116", "0.6813696", "0.68106896", "0.6733908", "0.6733908", "0.6693054", "0.6673248", "0.6665914", "0.66434", "0.6637773", "0.6597069", "0.6580226", "0.6575524", "0.65625507", "0.65582585", "0.6514318", "0.64990556", "0.6495193",...
0.8066619
0
Test that the dataset exposes features correctly
def test_features(iris): assert iris.num_features == 4 assert iris.feature_names == [ "sepal length (cm)", "sepal width (cm)", "petal length (cm)", "petal width (cm)", ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_all_features_with_data(self):\n feature1 = Feature('looktest1')\n feature1.set_percentage(5)\n\n feature2 = Feature('looktest2')\n feature2.activate()\n feature2.add_to_whitelist(3)\n\n feature3 = Feature('looktest3')\n feature3.activate()\n feature3...
[ "0.78587687", "0.71364605", "0.7094765", "0.69733465", "0.69565916", "0.68933004", "0.6886788", "0.68324894", "0.66474664", "0.6644134", "0.6628947", "0.65567976", "0.6553603", "0.6534997", "0.6520395", "0.65046775", "0.64937705", "0.64824164", "0.64187455", "0.6407952", "0.6...
0.74759233
1
Test that the dataset exposes targets correctly
def test_targets(iris): assert iris.num_targets == 3 np.testing.assert_array_equal( iris.target_names, ["setosa", "versicolor", "virginica"] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_which_targets():\n num_multi_targets = 0\n for which_targets_day in which_targets:\n # All inputs have a label\n assert np.all(which_targets_day.sum(axis=1) > 0)\n # No inputs have more than 3 targets\n assert np.all(which_targets_day.sum(axis=1) < 4)\n\n num_multi...
[ "0.69623315", "0.67906576", "0.6738044", "0.6517456", "0.64846396", "0.6483993", "0.6368017", "0.6326693", "0.6194556", "0.61361384", "0.61305344", "0.60743195", "0.60652053", "0.60409486", "0.6014033", "0.6007334", "0.5987667", "0.5984631", "0.5972297", "0.5966366", "0.59359...
0.7648803
0
Test that the setting of feature values works as expected
def test_feature_values(iris, name, x_feature, y_feature, x_vals, y_vals): iris.x_feature = x_feature iris.y_feature = y_feature assert iris.title == "{} x {}".format(x_feature, y_feature) data = iris.sources[name].data np.testing.assert_array_almost_equal(data["x"][:2], x_vals) np.testing.asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_feature(feature, value, good_features):\r\n\tbase_write(good_features,\"bin/stanford-ner-2015-04-20/base.prop\")\r\n\tbase_prop = open(\"bin/stanford-ner-2015-04-20/base.prop\", \"a\")\r\n\tbase_prop.write(feature.strip() + \"=\" + str(value) + \"\\n\")\r\n\tbase_prop.close()\r\n\r\n\t#Test read base.prop...
[ "0.68222433", "0.67018443", "0.6689757", "0.6671468", "0.6527837", "0.6522304", "0.64916915", "0.63647443", "0.6364705", "0.63577926", "0.6188192", "0.61652994", "0.615353", "0.6115886", "0.60559314", "0.6019748", "0.6010639", "0.5998711", "0.5995934", "0.598738", "0.59807867...
0.72363967
0
The program entry point.
def main(args):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n return", "def main():\n pass", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "...
[ "0.86532634", "0.85191697", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104", "0.84557104"...
0.79091686
67
Should return True when items are equal.
def test_01_is_equal_true(self): dict1 = {"a": "1", "b": "2"} dict2 = {"a": "1", "b": "2"} items_equal = utils.is_equal(dict1, dict2) self.assertTrue(items_equal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_same(items):\n \n return all(x == items[0] for x in items)", "def equals_items(self, item1, item2):\n if isinstance(item1, (text_type, binary_type)) is True:\n return self.equals_strings(item1, item2)\n\n if type(item1) is float or type(item2) is float:\n if roun...
[ "0.80973804", "0.7768255", "0.7298438", "0.7204734", "0.7126017", "0.7102517", "0.7054702", "0.7045769", "0.7039899", "0.6985084", "0.69060147", "0.6903465", "0.689714", "0.68567044", "0.6800983", "0.6790471", "0.6788774", "0.6777188", "0.6776918", "0.6775166", "0.67622024", ...
0.7132409
4
Should return False when items are not equal.
def test_02_is_equal_false(self): dict1 = {"a": "1", "b": "2"} dict2 = {"a": "1", "b": "3"} items_equal = utils.is_equal(dict1, dict2) self.assertFalse(items_equal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_same(items):\n \n return all(x == items[0] for x in items)", "def equals_items(self, item1, item2):\n if isinstance(item1, (text_type, binary_type)) is True:\n return self.equals_strings(item1, item2)\n\n if type(item1) is float or type(item2) is float:\n if roun...
[ "0.7665714", "0.75213164", "0.74384546", "0.7282808", "0.7047533", "0.6996447", "0.69448024", "0.69394666", "0.6926117", "0.6918105", "0.69017947", "0.6847999", "0.68369865", "0.68105114", "0.68093526", "0.68068016", "0.67957634", "0.6791244", "0.6786502", "0.67542267", "0.67...
0.71557575
4
Should return False when items are not equal.
def test_03_is_equal_with_ignore(self): dict1 = {"a": "1", "b": "2"} dict2 = {"a": "1", "b": "3"} items_equal = utils.is_equal(dict1, dict2, ignore_fileds=["b"]) self.assertTrue(items_equal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_same(items):\n \n return all(x == items[0] for x in items)", "def equals_items(self, item1, item2):\n if isinstance(item1, (text_type, binary_type)) is True:\n return self.equals_strings(item1, item2)\n\n if type(item1) is float or type(item2) is float:\n if roun...
[ "0.7665714", "0.75213164", "0.74384546", "0.7282808", "0.71557575", "0.7047533", "0.6996447", "0.69448024", "0.69394666", "0.6926117", "0.6918105", "0.69017947", "0.6847999", "0.68369865", "0.68105114", "0.68093526", "0.68068016", "0.67957634", "0.6791244", "0.6786502", "0.67...
0.6317714
85
Should return False when items are not equal.
def test_04_is_equal_with_ignore_default(self): dict1 = {"a": "1", "created": "2"} dict2 = {"a": "1", "created": "3"} items_equal = utils.is_equal(dict1, dict2) self.assertTrue(items_equal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_same(items):\n \n return all(x == items[0] for x in items)", "def equals_items(self, item1, item2):\n if isinstance(item1, (text_type, binary_type)) is True:\n return self.equals_strings(item1, item2)\n\n if type(item1) is float or type(item2) is float:\n if roun...
[ "0.7665714", "0.75213164", "0.74384546", "0.7282808", "0.71557575", "0.7047533", "0.6996447", "0.69448024", "0.69394666", "0.6926117", "0.6918105", "0.69017947", "0.6847999", "0.68369865", "0.68105114", "0.68093526", "0.68068016", "0.67957634", "0.6791244", "0.6786502", "0.67...
0.6468282
48
Should return Python datetime object.
def test_05_timestamp_to_dt(self): ts = int(datetime.datetime.utcnow().strftime("%s")) ts_object = utils.timestamp_to_dt(ts) self.assertIsInstance(ts_object, datetime.datetime)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_object(__date):\n if isinstance(__date, datetime.datetime):\n return datetime.datetime(__date.year, __date.month, __date.day, __date.hour, __date.minute, __date.second)\n return None", "def get_date():\n return datetime(2000, 1, 1, 0, 0, 0, FLOOD_TIMEOUT+1)", "def datetime(self):\n...
[ "0.7408596", "0.7294976", "0.72383404", "0.71433383", "0.7142016", "0.69741046", "0.69586354", "0.6931627", "0.6906186", "0.6895379", "0.68899834", "0.6757469", "0.67479825", "0.67431307", "0.66738623", "0.6662003", "0.66589", "0.6646561", "0.66239697", "0.66212165", "0.66062...
0.64827394
28
Should return Python datetime object.
def test_06_dt_to_milliseconds_str(self): dt = datetime.datetime.utcnow() ts = utils.dt_to_milliseconds_str(dt) self.assertIsInstance(ts, str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_object(__date):\n if isinstance(__date, datetime.datetime):\n return datetime.datetime(__date.year, __date.month, __date.day, __date.hour, __date.minute, __date.second)\n return None", "def get_date():\n return datetime(2000, 1, 1, 0, 0, 0, FLOOD_TIMEOUT+1)", "def datetime(self):\n...
[ "0.7408596", "0.7294976", "0.72383404", "0.71433383", "0.7142016", "0.69741046", "0.69586354", "0.6931627", "0.6906186", "0.6895379", "0.68899834", "0.6757469", "0.67479825", "0.67431307", "0.66738623", "0.6662003", "0.66589", "0.6646561", "0.66239697", "0.66212165", "0.66062...
0.0
-1
Should return True if user doesn't exist in the database.
def test_07_create_user_exists(self): _, user = self.get_random_item(models.User) success, error = utils.create_user(user, session=self.session) db_user = db_utils.get_item( models.User, filters={"id": user["id"]}, session=self.session ) user["password"] = db_user.pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_in_db(self) -> bool:\n query = \"\"\"SELECT * \n FROM Users \n WHERE Username=?;\"\"\"\n return len(self.db.fetchall(query, values=(self.username,))) > 0", "def _user_exists(self, username):\n return self.db.query(User).filter_by(name=username)....
[ "0.7982304", "0.7971117", "0.7908427", "0.7712121", "0.7698147", "0.7692355", "0.7524247", "0.7513099", "0.75097823", "0.7476226", "0.74680376", "0.74510795", "0.7441411", "0.7386055", "0.73417705", "0.73329973", "0.73245955", "0.73189604", "0.7311224", "0.7311224", "0.730178...
0.71196365
34
Should return False if user already exists in the database.
def test_08_create_user_not_exists(self): _, user = self.get_random_item(models.User) utils.create_user(user, session=self.session) success, error = utils.create_user(user, session=self.session) self.assertFalse(success) self.assertTrue(error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_in_db(self) -> bool:\n query = \"\"\"SELECT * \n FROM Users \n WHERE Username=?;\"\"\"\n return len(self.db.fetchall(query, values=(self.username,))) > 0", "def userExists(self, username):\n data = db.session.query(User.id).filter_by(username = ...
[ "0.8068171", "0.8008202", "0.7929028", "0.7638672", "0.76068664", "0.7578647", "0.7555978", "0.7538741", "0.7532686", "0.75156915", "0.7512538", "0.7492501", "0.7490015", "0.745492", "0.74516106", "0.74504006", "0.74087286", "0.7361137", "0.73531204", "0.73510104", "0.7321086...
0.6981333
41
Should return False when filename doesn't have extension.
def test_09_is_allowed_file_no_ext(self): filename = "somename" is_allowed = utils.is_allowed_file(filename) self.assertFalse(is_allowed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_good_file(filename):\n for e in extensions:\n if filename.endswith(e):\n return True\n return False", "def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extensions", ...
[ "0.86114055", "0.8488944", "0.8337902", "0.8333528", "0.8282026", "0.8244654", "0.82361555", "0.8206642", "0.81754893", "0.81569153", "0.81452125", "0.81301445", "0.81301445", "0.81301445", "0.81301445", "0.81301445", "0.81301445", "0.8106526", "0.8106526", "0.8100288", "0.81...
0.7480339
71
Should return False when extension is wrong.
def test_10_is_allowed_file_wrong_ext(self): filename = "somename.pdf" is_allowed = utils.is_allowed_file(filename) self.assertFalse(is_allowed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_extension(self):\n if self.extension in Config.override_ext:\n expected_mimetype = Config.override_ext[self.extension]\n else:\n expected_mimetype, encoding = mimetypes.guess_type(self.src_path,\n strict=Fa...
[ "0.78682864", "0.7636583", "0.75805396", "0.7447488", "0.7372058", "0.73181254", "0.73056614", "0.72817487", "0.7213286", "0.71674335", "0.71122247", "0.7064684", "0.70434576", "0.704098", "0.7030455", "0.70092624", "0.69981223", "0.6977568", "0.69588166", "0.693524", "0.6798...
0.7191555
9
Should return False when extension is wrong.
def test_11_is_allowed_file_correct_ext(self): for ext in list(ALLOWED_EXTENSIONS): filename = f"somename.{ext}" is_allowed = utils.is_allowed_file(filename) self.assertTrue(is_allowed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_extension(self):\n if self.extension in Config.override_ext:\n expected_mimetype = Config.override_ext[self.extension]\n else:\n expected_mimetype, encoding = mimetypes.guess_type(self.src_path,\n strict=Fa...
[ "0.78682864", "0.7636583", "0.75805396", "0.7447488", "0.7372058", "0.73181254", "0.73056614", "0.72817487", "0.7213286", "0.7191555", "0.71674335", "0.71122247", "0.7064684", "0.70434576", "0.704098", "0.7030455", "0.70092624", "0.6977568", "0.69588166", "0.693524", "0.67986...
0.69981223
17
Find the user with the given username and return their id, or None if no such user exists.
def find_user_by_username(db, username): users = db.tables.users return db.load_scalar( table=users, value={'username': username}, column='id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self, username):\n\n users_list = self.get_list()\n for user_info in users_list:\n if user_info['username'] == username:\n return user_info['id']\n # return None\n raise UserNotFoundException(\"User {0} not found\".format(username))", "def get_user...
[ "0.8486151", "0.80184686", "0.79970026", "0.79675525", "0.79675525", "0.79675525", "0.7963933", "0.78752303", "0.78251565", "0.7797994", "0.7698019", "0.76610345", "0.76260227", "0.7535281", "0.7433802", "0.7422124", "0.7410001", "0.7361342", "0.73353136", "0.7326193", "0.731...
0.77940357
10
Find the user with the given foreign_id and return their id, or None if no such user exists.
def find_user_by_foreign_id(db, foreign_id): users = db.tables.users return db.load_scalar( table=users, value={'foreign_id': foreign_id}, column='id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_by_id(self, _id):\n user_resp = self._db.Users(database_pb2.UsersRequest(\n request_type=database_pb2.UsersRequest.FIND,\n match=database_pb2.UsersEntry(global_id=_id)))\n if user_resp.result_type != database_pb2.UsersResponse.OK:\n self._logger.warning(...
[ "0.70395887", "0.6893945", "0.68748236", "0.6826718", "0.6506314", "0.64983785", "0.63102484", "0.62940043", "0.62502694", "0.62369335", "0.6227704", "0.6204206", "0.6147459", "0.6142715", "0.6100349", "0.6096249", "0.6082242", "0.6069531", "0.6063481", "0.6041236", "0.604002...
0.8142203
0
Test for graph thresholding based on the mean degree.
def test_graphs_threshold_mean_degree(): # Groundtruth expected = np.load("groundtruth/graphs_threshold/mean_degree.npy") # Data graph = np.load("sample_data/graphs_threshold/graph.npy") # Run mean_degree_threshold = 5 binary_mask = threshold_mean_degree(graph, mean_degree_threshold) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_graphs_threshold_mst_mean_degree():\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/mst_mean_degree.npy\")\n\n # Data\n graph = np.load(\"sample_data/graphs_threshold/graph.npy\")\n\n # Run\n tree = threshold_mst_mean_degree(graph, 3.6)\n\n # Test\n np.testing...
[ "0.7343063", "0.6230984", "0.6227097", "0.59750366", "0.592538", "0.5885326", "0.58132714", "0.5791767", "0.57543737", "0.5753648", "0.57160234", "0.56842065", "0.5601132", "0.55997413", "0.559663", "0.55863345", "0.55824107", "0.5575837", "0.55386645", "0.54688543", "0.54656...
0.77867466
0
Test for graph thresholding based in the MST's mean degree.
def test_graphs_threshold_mst_mean_degree(): # Groundtruth expected = np.load("groundtruth/graphs_threshold/mst_mean_degree.npy") # Data graph = np.load("sample_data/graphs_threshold/graph.npy") # Run tree = threshold_mst_mean_degree(graph, 3.6) # Test np.testing.assert_array_equal(e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_graphs_threshold_mean_degree():\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/mean_degree.npy\")\n\n # Data\n graph = np.load(\"sample_data/graphs_threshold/graph.npy\")\n\n # Run\n mean_degree_threshold = 5\n binary_mask = threshold_mean_degree(graph, mean_deg...
[ "0.7577464", "0.6088447", "0.59741616", "0.5968032", "0.5943267", "0.59310496", "0.58874136", "0.5818282", "0.57937276", "0.57740355", "0.575114", "0.5746745", "0.56150544", "0.56090194", "0.5577418", "0.5543613", "0.5527074", "0.5510839", "0.550282", "0.5501128", "0.5493747"...
0.7683516
0
Test the kcore decomposition algorithm.
def test_graphs_k_core_decomposition(): # Groundtruth expected = np.load("groundtruth/graphs_threshold/k_cores.npy") # Data graph = np.load("sample_data/graphs_threshold/graph_binary.npy") # Run kcores = k_core_decomposition(graph, 10) # Test np.testing.assert_array_equal(expected, k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_determine_k(self):\n test_dir_name = os.path.dirname(__file__)\n feat_array_fn = os.path.join(\n test_dir_name, \"data\", \"four_clusters.csv\")\n df = pd.read_csv(feat_array_fn)\n feat_array = df[[\"x\", \"y\"]].values\n\n clusterer = Clusterer(feat_array_fn,...
[ "0.65353006", "0.6201982", "0.61541474", "0.59206885", "0.5893882", "0.5891255", "0.58582777", "0.58117867", "0.5787755", "0.5753176", "0.5752086", "0.5741526", "0.57332134", "0.57115597", "0.57095844", "0.56855834", "0.56358075", "0.561449", "0.5607308", "0.56061035", "0.559...
0.78939664
0
Test for graph thresholding base on shortest paths.
def test_graphs_threshold_shortest_paths(): # Groundtruth expected = np.load("groundtruth/graphs_threshold/shortest_paths.npy") # Data graph = np.load("sample_data/graphs_threshold/graph.npy") # Run binary_mask = threshold_shortest_paths(graph, treatment=False) # Test np.testing.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _importance_based_graph_cut(self, graph, threshold):\n for node, data in graph.nodes_iter(data=True):\n if float(data['importance']) < threshold:\n graph.remove_node(node)\n return", "def test_soft_threshold():\n assert snet.soft_threshold(10, 100) == 0\n assert ...
[ "0.6131582", "0.60717225", "0.6015632", "0.59195125", "0.58422256", "0.5766306", "0.5730042", "0.5726501", "0.56735456", "0.56374514", "0.5626174", "0.558326", "0.5571611", "0.5564247", "0.5563607", "0.55588573", "0.5531529", "0.55283445", "0.5512286", "0.5507463", "0.5498243...
0.68768716
0
Test for graph threshlding using global cost efficiency (GCE).
def test_graphs_threshold_global_cost_efficiency(): # Groundtruth expected = np.load("groundtruth/graphs_threshold/gce.npy") # Data graph = np.load("sample_data/graphs_threshold/graph.npy") # Run iterations = 50 binary_mask, _, _, _, _ = threshold_global_cost_efficiency(graph, iterations)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_graphs_threshold_omst_global_cost_efficiency2():\n # the function is optmized at the 3rd OMST, so it is going to yeild the same results\n # as the exhaustive search\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/omst_gce.npy\")\n\n # Data\n graph = np.load(\"sample...
[ "0.7292351", "0.7188489", "0.6268269", "0.62489986", "0.6099057", "0.60639197", "0.6047734", "0.5858285", "0.58377826", "0.58192337", "0.5765622", "0.57653415", "0.5758362", "0.5695797", "0.5664252", "0.5663531", "0.5658476", "0.5658476", "0.5658476", "0.56560165", "0.5646739...
0.7786456
0
Test for graph threshlding using global cost efficiency (GCE) on OMSTs (extract all MSTs).
def test_graphs_threshold_omst_global_cost_efficiency(): # the function is optmized at the 3rd OMST. # Groundtruth expected = np.load("groundtruth/graphs_threshold/omst_gce.npy") # Data graph = np.load("sample_data/graphs_threshold/graph.npy") # Run _, CIJtree, _, _, _, _, _, _ = threshol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_graphs_threshold_omst_global_cost_efficiency2():\n # the function is optmized at the 3rd OMST, so it is going to yeild the same results\n # as the exhaustive search\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/omst_gce.npy\")\n\n # Data\n graph = np.load(\"sample...
[ "0.79985285", "0.7497226", "0.62382823", "0.5841657", "0.5809271", "0.58082795", "0.57625425", "0.5664338", "0.5620274", "0.56043947", "0.5597901", "0.55592453", "0.5536385", "0.55205554", "0.55058116", "0.5488807", "0.5447505", "0.5446787", "0.5415955", "0.5395625", "0.53925...
0.7873814
1
Test for graph threshlding using global cost efficiency (GCE) on OMSTs (extract the first five MSTs).
def test_graphs_threshold_omst_global_cost_efficiency2(): # the function is optmized at the 3rd OMST, so it is going to yeild the same results # as the exhaustive search # Groundtruth expected = np.load("groundtruth/graphs_threshold/omst_gce.npy") # Data graph = np.load("sample_data/graphs_thr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_graphs_threshold_omst_global_cost_efficiency():\n # the function is optmized at the 3rd OMST.\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/omst_gce.npy\")\n\n # Data\n graph = np.load(\"sample_data/graphs_threshold/graph.npy\")\n\n # Run\n _, CIJtree, _, _, _,...
[ "0.7837865", "0.7225295", "0.60356164", "0.58807117", "0.58703625", "0.5838802", "0.58160937", "0.572131", "0.5690975", "0.56728786", "0.5653771", "0.5638937", "0.55792546", "0.55695164", "0.5542509", "0.55252403", "0.5513242", "0.5506854", "0.54791296", "0.54750746", "0.5465...
0.79966146
0
Test for graph thresholding based on the economical method.
def test_graphs_threshold_eco(): # Groundtruth expected_filt = np.load("groundtruth/graphs_threshold/eco_filtered.npy") expected_bin = np.load("groundtruth/graphs_threshold/eco_binary.npy") # Data graph = np.load("sample_data/graphs_threshold/graph2.npy") # Run filterted, binary, _ = thre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, threshold=0.5):\n pass", "def apply_thresholding(x):\n return x > threshold_otsu(x)", "def test_graphs_threshold_global_cost_efficiency():\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/gce.npy\")\n\n # Data\n graph = np.load(\"sample_data/graphs_...
[ "0.6416092", "0.63370824", "0.62137026", "0.6199239", "0.6188419", "0.6137018", "0.6124308", "0.6087063", "0.6036492", "0.6019357", "0.60054135", "0.59911543", "0.5983166", "0.59308624", "0.59052336", "0.59034336", "0.5896829", "0.588666", "0.58629286", "0.5836026", "0.580677...
0.657838
0
Loads all transacion data provided in the csv file target variable class is included in the dataframe
def load_all_transactions(filename): transacions = pd.read_csv(join(DATA_DIR, filename)) print('\nTher are a toral of {} transactions and {} features \n'.format(transacions.shape[0],transacions.columns)) return transacions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def load_data(filepath=None, target_columns=-1):\n class Data:\n \"\"\"\n The history data class\n \"\"\"\n\n def __init__(self):\n self.data = None\n self.target = None\n\n if filepath is None:\n raise ValueError(\"The fi...
[ "0.6467424", "0.6426589", "0.6368801", "0.6356532", "0.6304163", "0.6222621", "0.6213266", "0.61349916", "0.6110383", "0.6103717", "0.6077463", "0.60624975", "0.6046108", "0.6044002", "0.60160404", "0.5970393", "0.5925899", "0.59109366", "0.59100616", "0.59058166", "0.5901785...
0.6043259
14
Splits the data into independent(X) and dependent(Y) variables.
def features_target_split(): transactions = load_all_transactions('creditcard.csv') features = transactions.drop('Class', axis=1) target = transactions['Class'] print('\nCreation of feature set dataframe and target seiries successful \n') return features, target
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_data(self):\n X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=7)\n\n return X_train, X_test, y_train, y_test", "def split_data(X:np.ndarray, y:np.ndarray) -> (np.ndarray, np.ndarray, np.ndarray, np.ndarray):\n \n X_train, X_val, y_train, y_val = train_test_spl...
[ "0.6890698", "0.67921144", "0.66132694", "0.6501373", "0.6344863", "0.62907517", "0.62778395", "0.6276862", "0.6235511", "0.6223114", "0.6182094", "0.61095816", "0.6100798", "0.6072326", "0.60583675", "0.60072935", "0.5988174", "0.5976105", "0.5958388", "0.5951388", "0.594600...
0.0
-1
Loads all the train transactions data based on threshold balue. taget variable class is returned as seperate padnas series
def load_train_test_transactions(train_size=0.7): X, y = features_target_split() X_train, X_test, y_train, y_test = train_test_split(X,y,train_size=train_size, random_state=7) print('\nTraining and testing data creation successful\n') return X_train, X_test, y_train,y_test
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_process(db):\n conn = sqlite3.connect(db)\n data = pd.read_sql_query(\"Select Delta_T, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27, V28, Amount , Class from transactions;\", conn)\n train_split = int(0.8*len(data))\n ...
[ "0.60452974", "0.5981635", "0.58107805", "0.57480687", "0.57185936", "0.5711728", "0.57116044", "0.569451", "0.56919813", "0.5658128", "0.5641524", "0.5619527", "0.5594669", "0.55827564", "0.55674434", "0.55538243", "0.55219364", "0.55194813", "0.5504637", "0.5498387", "0.547...
0.5977794
2
Apply stochastic binarization on input tensor.
def forward(ctx, input): ctx.save_for_backward(input) return safeSign(input)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binarize(x):\n return tf.math.round(tf.clip_by_value(\n x, clip_value_min=0, clip_value_max=1))", "def __call__(self,pred,target,x_biased,weights=None):\n if self.backonly:\n mask = target==self.background_label\n x_biased = x_biased[mask]\n pred = pred[mask]...
[ "0.62445045", "0.60860616", "0.5629997", "0.5605603", "0.55673", "0.55065364", "0.54189783", "0.54000986", "0.5367809", "0.53186446", "0.5298598", "0.5270944", "0.52290714", "0.52236074", "0.5216857", "0.5204429", "0.51992834", "0.5187367", "0.51624405", "0.5161593", "0.51595...
0.0
-1
Compute the back propagation of the binarization op.
def backward(ctx, grad_output): input, = ctx.saved_tensors grad_input = grad_output.clone() grad_input[torch.abs(input) > 1.001] = 0 return grad_input
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backPropagate(self):\n\n # application of the chain rule to find derivative of the loss function with respect to weights2 and weights1\n d_weights2 = np.dot(self.layer1.T, (2*(self.y - self.output) * sigmoid_derivative(self.output)))\n d_weights1 = np.dot(self.input.T, (np.dot(2*(...
[ "0.6664856", "0.6659722", "0.6595139", "0.65133697", "0.64479315", "0.6389616", "0.63420415", "0.6320845", "0.6306268", "0.6293619", "0.6270401", "0.6258821", "0.62494284", "0.62426406", "0.62381005", "0.62366056", "0.6235993", "0.623001", "0.62290615", "0.6225411", "0.621464...
0.0
-1
Apply stochastic binarization on input tensor.
def forward(ctx, input): ctx.save_for_backward(input) # z ~ uniform([0,1]) z = torch.rand_like(input, requires_grad=False) # p = hard sigmoid(input) p = ((torch.clamp(input, -1, 1) + 1) / 2) # z<p = 1 with a probability of p return -1.0 + 2.0 * (z<p).float()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binarize(x):\n return tf.math.round(tf.clip_by_value(\n x, clip_value_min=0, clip_value_max=1))", "def __call__(self,pred,target,x_biased,weights=None):\n if self.backonly:\n mask = target==self.background_label\n x_biased = x_biased[mask]\n pred = pred[mask]...
[ "0.62445045", "0.60860616", "0.5629997", "0.5605603", "0.55673", "0.55065364", "0.54189783", "0.54000986", "0.5367809", "0.53186446", "0.5298598", "0.5270944", "0.52290714", "0.52236074", "0.5216857", "0.5204429", "0.51992834", "0.5187367", "0.51624405", "0.5161593", "0.51595...
0.0
-1
Compute the back propagation of the binarization op.
def backward(ctx, grad_output): input, = ctx.saved_tensors grad_input = grad_output.clone() grad_input[torch.abs(input) > 1.001] = 0 return grad_input
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backPropagate(self):\n\n # application of the chain rule to find derivative of the loss function with respect to weights2 and weights1\n d_weights2 = np.dot(self.layer1.T, (2*(self.y - self.output) * sigmoid_derivative(self.output)))\n d_weights1 = np.dot(self.input.T, (np.dot(2*(...
[ "0.6664856", "0.6659722", "0.6595139", "0.65133697", "0.64479315", "0.6389616", "0.63420415", "0.6320845", "0.6306268", "0.6293619", "0.6270401", "0.6258821", "0.62494284", "0.62426406", "0.62381005", "0.62366056", "0.6235993", "0.623001", "0.62290615", "0.6225411", "0.621464...
0.0
-1
A torch.nn.Module is return with a Binarization op inside. Usefull on Sequencial instanciation.
def BinaryConnect(stochastic=False): act = BinaryConnectStochastic if stochastic else BinaryConnectDeterministic return front(act)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backbone(self) -> nn.Module:\n raise NotImplementedError()", "def _block(args: ClusterArgs, input_dim: int) -> layers.Bijector:\n _chain: List[layers.Bijector] = []\n\n if args.inn_idf:\n _chain += [\n layers.IntegerDiscreteFlow(input_dim, hidden_channels=args.inn_coupling_chan...
[ "0.6195831", "0.6028067", "0.5984085", "0.5977603", "0.5933567", "0.577126", "0.563872", "0.56152946", "0.5602039", "0.5588794", "0.5583806", "0.55589455", "0.5541637", "0.553707", "0.5502502", "0.5497476", "0.54557115", "0.5453031", "0.54503006", "0.5436571", "0.5436571", ...
0.0
-1
Returns True if and only if `expr` contains only correctly matched delimiters, else returns False.
def check_delimiters(expr): delim_openers = '{([<' delim_closers = '})]>' ### BEGIN SOLUTION s = Stack() for c in expr: if c in delim_openers: s.push(c) elif c in delim_closers: try: t = s.pop() if delim_openers.fin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_delimiters(expr):\n s = Stack()\n newExpr = expr.replace(\" \", \"\")\n if len(newExpr) ==1:\n return False\n else:\n for c in newExpr:\n if c in delim_openers:\n s.push(c)\n elif c in delim_closers:\n toCheck = delim_openers[d...
[ "0.7133583", "0.6683183", "0.62793124", "0.6187382", "0.6016125", "0.5943181", "0.582906", "0.5734482", "0.572137", "0.57109636", "0.5685574", "0.56454945", "0.56169343", "0.55317014", "0.5522385", "0.55221826", "0.5514102", "0.54350483", "0.5418066", "0.5408045", "0.53892976...
0.7151421
0
Returns the postfix form of the infix expression found in `expr`
def infix_to_postfix(expr): # you may find the following precedence dictionary useful prec = {'*': 2, '/': 2, '+': 1, '-': 1} ops = Stack() postfix = [] toks = expr.split() ### BEGIN SOLUTION opp = {'*', '/','+', '-'} for x in toks: if str.isdigit(x): post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infix_to_postfix(expr):\n ops = Stack()\n postfix = []\n toks = expr.split()\n def tests(chr):\n if chr.isdigit():\n postfix.append(chr)\n\n elif chr == '(':\n ops.push('(')\n\n elif ops.peek() == '(' or ops.empty():\n ops.push(chr)\n\n e...
[ "0.81900203", "0.7801753", "0.76920533", "0.7429643", "0.7404279", "0.7347274", "0.7156811", "0.7048756", "0.6956311", "0.6874034", "0.68503463", "0.67862564", "0.67233485", "0.6722634", "0.6648669", "0.6607104", "0.65920854", "0.6575015", "0.65612596", "0.65422934", "0.64984...
0.7979371
1
Determines whether or not a project exists at the specified path
def project_exists(response: 'environ.Response', path: str) -> bool: if os.path.exists(path): return True response.fail( code='PROJECT_NOT_FOUND', message='The project path does not exist', path=path ).console( """ [ERROR]: Unable to open project. The specif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(repo_path):\n\n if not ProjectRepo.existing_git_repository(repo_path):\n cprint(' - Project is missing', 'red')", "def is_project_created(path):\n project_id = None\n try:\n with open(\"%s%sproject\"\n % (path, os.sep)) as project_file:\n proj...
[ "0.781922", "0.77002376", "0.6944617", "0.6784362", "0.66010505", "0.65764564", "0.65411824", "0.6539585", "0.65192175", "0.64994127", "0.6494861", "0.6490263", "0.6452931", "0.64370346", "0.6418735", "0.6405294", "0.63952315", "0.63933635", "0.63204074", "0.62900877", "0.628...
0.85413456
0
Convert phrase to a vector by aggregating it's word embeddings. Just take an average of vectors for all tokens in the phrase with some weights.
def get_phrase_embedding(phrase): vector = np.zeros([model.vector_size], dtype='float32') # 1. lowercase phrase phrase = phrase.lower() # 2. tokenize phrase phrase_tokens = tokenizer.tokenize(phrase) # 3. average word vectors for all words in tokenized phrase, skip ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sentence_average_w2v(sent, word_to_vec, embedding_dim):\n sum_vec = np.zeros((embedding_dim,))\n known_tokens = 0\n for token in sent.text:\n if (token in word_to_vec.dict):\n known_tokens += 1\n sum_vec += word_to_vec[token]\n if (known_tokens != 0):\n retur...
[ "0.7514688", "0.72182834", "0.7089494", "0.702476", "0.69361097", "0.6867072", "0.6737069", "0.6620378", "0.6577739", "0.6555899", "0.6496128", "0.6492713", "0.63574034", "0.6309373", "0.6279589", "0.62726533", "0.62423867", "0.62186897", "0.62141794", "0.62009865", "0.618895...
0.76256436
0
.iso639 | .iso639 Search ISO 6391, 2 and 3 for a language code.
def iso639(phenny, input): response = "" thisCode = str(input.group(1)).lower() if thisCode == "None": thisCode = random.choice(list(phenny.iso_data.keys())) #ISOcodes[random.randint(0,len(ISOcodes)-1)] #random.choice(ISOcodes) else: if len(thisCode) > 3: # so that w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_name(iso_code):\n if iso_code not in LANGUAGES_BY_CODE:\n try:\n lang = iso639.languages.get(part3=iso_code)\n except KeyError:\n lang = None\n\n if lang:\n # we only show up to the first semi or paren\n lang = re.split(r\";|\\(\"...
[ "0.70005405", "0.66463333", "0.6645652", "0.6610556", "0.6142019", "0.60717714", "0.6025807", "0.59968865", "0.5969312", "0.5852153", "0.5746316", "0.5722876", "0.5703971", "0.56456345", "0.5644901", "0.5622933", "0.558205", "0.5573778", "0.5565431", "0.55480707", "0.55263364...
0.6822768
1
Load the dataset into memory
def get_pointcloud(dataset, NUM_POINT=2048, shuffle=True): if dataset == 'modelnet': train_file_idxs = np.arange(0, len(TRAIN_FILES_MODELNET)) data_train = [] label_train = [] for fn in range(len(TRAIN_FILES_MODELNET)): print('----' + str(fn) + '-----') curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self) -> None:", "def load_data(self):", "def load_data(self):\n raise NotImplementedError()", "def _load_dataset(self, path):\n\t\twhile True:\n\t\t\t\n\t\t\ttry:\n\t\t\t\tX_test = np.load(\"data/X_test.npy\")\n\t\t\t\tY_test = np.load(\"data/Y_test.npy\")\n\t\t\t\tbreak\n\n\t\t\texcept...
[ "0.7768949", "0.7462694", "0.7097959", "0.70811975", "0.7035975", "0.69852835", "0.6967015", "0.6927658", "0.6905999", "0.69029385", "0.6873271", "0.68343407", "0.6787323", "0.6759947", "0.6753025", "0.6743001", "0.6698337", "0.66867", "0.6628004", "0.6625307", "0.66247994", ...
0.0
-1
Computes 2D convolution Inputs
def conv2D(x,shape,name,stride=[1,2,2,1],padding='SAME',reuse=None): #get final shape input_channels = x.shape[-1] shape.append(shape[-1]) shape[2]=input_channels #compute convolution with tf.variable_scope('conv2d_'+name,reuse=reuse): kernel = tf.get_variable(name='kernel', shape=shape, init...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv2d(args):\n inp_ = args[0]\n kernel = args[1]\n stride = args[2]\n padding = args[3]\n (batch_size, in_channels, H, W) = inp_.shape\n (out_channels, in_channels_t, Hk, Wk) = kernel.shape\n Hc = int((H - Hk)/stride)+1\n Wc = int((W - Wk)/stride)+1\n conv_layer = np.zeros((batch_s...
[ "0.78438425", "0.7579891", "0.75233954", "0.74854684", "0.73455644", "0.725629", "0.7220196", "0.7175648", "0.71749884", "0.71132326", "0.70915574", "0.70915574", "0.70842665", "0.7080834", "0.70767766", "0.70767444", "0.70715725", "0.70214367", "0.70151377", "0.7007873", "0....
0.6627466
77
Dense fully connected layer y = activation(xW+b) Inputs
def dense(x,num_nodes,activation='relu',name='',bias_init_val=0,reuse=None): input_shape = x.get_shape() with tf.variable_scope('dense',reuse=reuse): W=tf.get_variable('W'+name,initializer=tf.random_normal(stddev=.01,shape=[int(input_shape[-1]),num_nodes])) b=tf.get_variable('b'+name,initializer=tf.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_layer_activation(x):\n return x", "def fully_connected(self, input_layer, num_outputs, activation=None):\n num_inputs = input_layer.get_shape().as_list()[1]\n kernel_size = [num_inputs, num_outputs]\n with tf.variable_scope(self._count_layer('fully_connected')):\n ke...
[ "0.71220016", "0.70550996", "0.70465106", "0.696707", "0.6812504", "0.67482674", "0.6702094", "0.6655496", "0.6612444", "0.66045415", "0.66025394", "0.65659267", "0.6562132", "0.65542877", "0.6543631", "0.6535824", "0.6509545", "0.65049547", "0.64721197", "0.6409524", "0.6382...
0.61338794
53
Print last `n` lines of file
def file_tail(filename, n): result = '' with open(filename, 'r') as f: for line in (f.readlines()[-n:]): result += line return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tail(filepath, n):\n with open(filepath) as file_fd:\n lines = ''.join(file_fd.readlines())\n lines = lines.splitlines()[-n:]\n return lines", "def tail(fname, n):\n try:\n f = open(fname, 'r')\n except IOError:\n print \"IOError: No such file or directory: '\" + f...
[ "0.7867674", "0.75946647", "0.75466275", "0.75340295", "0.749208", "0.7458377", "0.74379706", "0.73325574", "0.7127996", "0.7094037", "0.7092303", "0.703745", "0.6764117", "0.67202204", "0.6649864", "0.6596833", "0.6591324", "0.6550445", "0.6541051", "0.6526451", "0.64327246"...
0.822962
0
Get the disks file names from the domain XML description.
def GetFilesToBackup(domainXml): disks = root.findall("./devices/disk/source") files = [] for disk in disks: files.append(disk.get("file")) return files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disks(self):\n # root node\n root = ElementTree.fromstring(self.libvirt_domain.XMLDesc())\n\n # search <disk type='file' device='disk'> entries\n disks = root.findall(\"./devices/disk[@device='disk']\")\n\n # for every disk get drivers, sources and targets\n driver...
[ "0.70366144", "0.60827386", "0.6071412", "0.60200167", "0.58255386", "0.57854563", "0.5739114", "0.5662612", "0.5511752", "0.55094075", "0.5422538", "0.54208255", "0.5409883", "0.53792715", "0.53779566", "0.5372456", "0.5366111", "0.5341019", "0.53092587", "0.52980816", "0.52...
0.6748915
1
Reads a CSV file for a catalog into a long format Python dictionary. The first line is assumed to be the header line, and must contain the field 'item_name'.
def _read_csv_to_dictionary_list(file_name): catalog_list = [] with open(file_name) as csvfile: reader = csv.DictReader(csvfile) for item in reader: catalog_list.append(item) return catalog_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(file):\n \n dictionary = {}\n csv_fp = csv.reader(file)\n #L[46] = manufacturer, L[63] = year\n #L[4]= city mileage, L[34]=highway mileage\n for line in csv_fp:\n #Skip the headings and the year 2017\n if (not (line[46] == 'make')) and (not (line[63] == '2017')):\n ...
[ "0.63216645", "0.62248164", "0.62061137", "0.6192558", "0.6182252", "0.6102906", "0.60775477", "0.60724336", "0.6050117", "0.60413975", "0.6032285", "0.6017968", "0.5999429", "0.59157795", "0.5901393", "0.5890702", "0.58753383", "0.5854863", "0.58544135", "0.5853177", "0.5830...
0.6988612
0
Retrieve a list of requested resources to be picked from the shelf in Alma for a specific library/circ_desk.
def get(self, library_id, circ_desk, limit=10, offset=0, all_records=False, q_params={}, raw=False): args = q_params.copy() args['apikey'] = self.cnxn_params['api_key'] url = self.cnxn_params['api_uri_full'] if int(limit) > 100: limit = 100 elif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCatalogs():", "def ResourceList(self):\n url = AddToUrl(self, 'https://api.spiget.org/v2/resources?')\n return ApiSearch(url)", "def get_resources(resource_client) -> list:\n resource_list = []\n paginator = resource_client.get_paginator(BOTO3_LIST_FUNCTION)\n pages = paginator.pa...
[ "0.602522", "0.59416413", "0.5895754", "0.58446383", "0.57876194", "0.57627434", "0.5726769", "0.57157725", "0.5699628", "0.56878376", "0.5633471", "0.5520542", "0.5494244", "0.5491932", "0.54432327", "0.5437622", "0.5370751", "0.5322713", "0.53148496", "0.5311199", "0.530724...
0.515711
37
Retrieve list of lending requests in Alma.
def get(self, library_id, q_params={}, raw=False): args = q_params.copy() args['apikey'] = self.cnxn_params['api_key'] args['library'] = str(library_id) url = self.cnxn_params['api_uri_full'] response = self.read(url, args, raw=raw) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_requesters():\n from mephisto.core.local_database import LocalMephistoDB\n from tabulate import tabulate\n\n db = LocalMephistoDB()\n requesters = db.find_requesters()\n dict_requesters = [r.to_dict() for r in requesters]\n click.echo(tabulate(dict_requesters, headers=\"keys\"))", "def...
[ "0.6040457", "0.5955607", "0.58180857", "0.5787489", "0.57837325", "0.576755", "0.5657119", "0.5593387", "0.55743015", "0.5559228", "0.553012", "0.5527205", "0.5499191", "0.5457418", "0.5445605", "0.5431204", "0.53873026", "0.53873026", "0.53873026", "0.53873026", "0.53873026...
0.0
-1
This function will return Grid size of UI based on difficulty level.
def get_grid_size(game_level): grid_length = 0 grid_width = 0 minecount = 0 if game_level == DifficultyLevel.BeginnerLevel: grid_length = GridSize.BeginnerLength grid_width = GridSize.BeginnerWidth minecount = 10 elif game_level == DifficultyLevel.IntermediateLevel: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grid_width(self):\n # replace with your code\n return 0", "def get_grid_width(self):\r\n # replace with your code\r\n return self._grid_width", "def get_grid_width(self):\r\n # replace with your code\r\n return self._grid_width", "def get_grid_width(self):\n ...
[ "0.7599145", "0.7387938", "0.7387938", "0.73785955", "0.73785955", "0.73658544", "0.7362196", "0.7362196", "0.73549694", "0.73397446", "0.7320358", "0.7320358", "0.7248299", "0.71656466", "0.7147601", "0.7137378", "0.70814574", "0.7061186", "0.70521265", "0.7037405", "0.70374...
0.7612548
0
This function updates the timer lcd
def timer_change(self): if self.time < 999: self.time += 1 self.time_lcd.display(self.time) else: self.timer.stop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_timer(self):\r\n frmt_time = \"%d:%02d\" % (self.time_minutes, self.time_seconds)\r\n self.time_seconds += 1\r\n if self.time_seconds == 60:\r\n self.time_seconds = 0\r\n self.time_minutes += 1\r\n\r\n self.mainWidget.statusLabel.setText(\"{} {} --- {} {...
[ "0.76056844", "0.71149886", "0.70156574", "0.69157463", "0.68125004", "0.6781015", "0.67532974", "0.67068124", "0.6642209", "0.66009486", "0.65852726", "0.658475", "0.6575836", "0.65547466", "0.6551715", "0.65476876", "0.6518006", "0.64748704", "0.64519894", "0.6446896", "0.6...
0.76348394
0
This function resets the grid for a fresh instance of game.
def resetgrid(self): self.remainingminecount = self.minecount self.board.reset() self.button_array = [[QtGui.QPushButton() \ for col in range(self.cols)] for row in range(self.rows)] self.game_in_progress = True self.first_click = True for row in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n\n #Create a grid of zeros\n self._grid = [[0 for dummy_col in range(self._grid_width)] for dummy_row in range(self._grid_height)]\n # _available_new_tiles will be refilled every 10 moves\n self._available_new_tiles = TOTAL_AVAILABLE_MOVES[:]\n for dummy_i in ra...
[ "0.8461371", "0.8363986", "0.8325564", "0.83227384", "0.8315143", "0.8250263", "0.8241031", "0.82253766", "0.8201378", "0.81990904", "0.8160982", "0.81448346", "0.81087816", "0.8101179", "0.80338085", "0.80141175", "0.8009469", "0.79362434", "0.7912586", "0.782195", "0.778665...
0.76457274
28
This function handles the left click action on each of the grid cell. It will also handle the actions required
def handle_left_click(self): if not self.game_in_progress: return if self.first_click: self.first_click = False self.timer.start(1000) sender = self.sender() row = 0 col = 0 for row in range(self.rows): for col in range(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events(self):\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n self.running = False\n if event.type == pygame.MOUSEBUTTONDOWN:\n self.set_selected(self.mouse_on_grid())\n if self.get_selected() is not None and event.type ...
[ "0.68467045", "0.6845051", "0.67083263", "0.66543925", "0.66423655", "0.6475575", "0.6378554", "0.6321787", "0.62958163", "0.6274282", "0.6253774", "0.6249839", "0.6205736", "0.6193917", "0.61531395", "0.61405647", "0.61154956", "0.610005", "0.6096469", "0.6071234", "0.605045...
0.70425814
0
This function handles the right click action on grid cell.
def handle_right_click(self): if not self.game_in_progress: return if self.first_click: self.first_click = False self.timer.start(1000) sender = self.sender() row = 0 col = 0 for row in range(self.rows): for col in range(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_right_click(self, pixel):\n position = self.pixel_to_position(pixel)\n index = self.position_to_index(position, self._grid_size)\n\n self._board.flag_cell(index)\n self.draw_board(self._board)", "def OnLabelRightClick(self, evt):\n \n self.actRow = evt.Row\n ...
[ "0.7525203", "0.6962284", "0.6924462", "0.6863856", "0.68567437", "0.6788664", "0.6637235", "0.66249645", "0.65822953", "0.65635735", "0.65635735", "0.65568894", "0.65074617", "0.64916843", "0.6483928", "0.6479727", "0.6405769", "0.6323705", "0.6301398", "0.6299117", "0.62538...
0.7056489
1
This function displays information about game. This function just displays game version and basic info about game.
def about(self): QtGui.QMessageBox.about(self, "About Menu", "MineSweeper 1.0 \n" "This is python implementation of famous Minesweeper Game \n\n" "For Source code, check following link:\n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info():\n print(\"Made using the OOP RPG game creator (c) Claire.\\n\")", "def display_get_game():\n title = input(\"Please give me a title searched game: \")\n info_about_game = reports.get_game(filename, title)\n print(\"Properties of the game: {}\\n\".format(info_about_game))", "def info...
[ "0.77558345", "0.7457472", "0.6627975", "0.66077304", "0.6514645", "0.65090835", "0.64660317", "0.64008105", "0.6379258", "0.63201123", "0.6170471", "0.6167761", "0.6155141", "0.61541414", "0.61135435", "0.60967094", "0.60945964", "0.60907614", "0.6090585", "0.6062068", "0.60...
0.0
-1
This function displays help about game This function will pop up message box to user
def game_help(self): QtGui.QMessageBox.about(self, "How to Play game", "<b>How to Play</b><br>" "The rules in Minesweeper are simple:<br><br>" "<b>1.</b> Uncover a mine and that's end of game <br>" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_help():\n messagebox.showinfo(title='How to Use', message=\"It's really easy.\")", "def help():\n print \"Help comes to those who ask\"", "def helpHelp(self):\r\n QtGui.QMessageBox.about(self, \"Help me!\",\"\"\"\r\n <p> Program sucks and you need help?\r\n <p>Email: \r\...
[ "0.789727", "0.7568061", "0.7517027", "0.7386369", "0.7310226", "0.7303696", "0.72714776", "0.71972084", "0.71936107", "0.71525615", "0.7152087", "0.7150587", "0.7049491", "0.7043867", "0.7041325", "0.7036719", "0.70153403", "0.70116055", "0.69836533", "0.69385743", "0.690119...
0.87623113
0
This function handles the event of user asking for leaderboard.
def showtopscores(self): top_scores = LeaderBoard.gettopscorerslist(CURRENT_GAME_LEVEL) level_string = "" if CURRENT_GAME_LEVEL == DifficultyLevel.ExpertLevel: level_string = "Expert level" elif CURRENT_GAME_LEVEL == DifficultyLevel.BeginnerLevel: level_string = "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def post_leaderboard(\n self,\n ctx: commands.Context,\n leaderboard_type: Literal[\n \"season\",\n \"weekly\",\n \"worst\",\n \"playoffs\",\n \"playoffs_weekly\",\n \"pre-season\",\n \"pre-season_weekly\",\n ...
[ "0.689861", "0.6789166", "0.65970176", "0.6565226", "0.65231425", "0.6461521", "0.645583", "0.6448854", "0.6377661", "0.6376367", "0.63502955", "0.6288127", "0.6239606", "0.6157662", "0.6157662", "0.6156583", "0.6069536", "0.6046384", "0.6033234", "0.60200727", "0.5969968", ...
0.0
-1
This function will add menu bar to the GUI. First we'll define all the actions which are required inside menu. Then we'll create menu bar and add menu's and actions.
def add_menu_bar(self): # File menu option to change difficulty level beginner_level_action = QtGui.QAction(QtGui.QIcon(""), '&Beginner', self) beginner_level_action.setShortcut('Ctrl+B') beginner_level_action.setStatusTip('Set difficulty level to "Beginner" ') beginner_level_act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_menubar(self):\n extractAction = QtGui.QAction(\"&Exit\", self)\n #extractAction.setShortcut(\"Ctrl+Q\")\n #extractAction.setStatusTip('Leave The App')\n extractAction.triggered.connect(self.close_application)\n\n self.mainMenu = self.menuBar()\n self.fileMenu = se...
[ "0.7966938", "0.78997296", "0.78701997", "0.7682248", "0.76450664", "0.75874615", "0.7529646", "0.7509645", "0.7443951", "0.7361484", "0.7360082", "0.734735", "0.7318996", "0.7315248", "0.7280853", "0.7242723", "0.72172004", "0.72127116", "0.7168719", "0.7128899", "0.7103434"...
0.77938396
3
This function helps in changing game level When user clicks on change game level from File menu this function will change height and width of grid.
def change_game_level(self, change_level): global CURRENT_GAME_LEVEL file_object = open("Level.txt", "w") file_object.write(str(change_level)) file_object.close() CURRENT_GAME_LEVEL = change_level if change_level == DifficultyLevel.BeginnerLevel: grid_length ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupLevel(self):\n\n self.state = GameState.SETUP\n\n # vado a leggere il dizionario corrispondente\n # al numero di livello corrente facendo in modo\n # che se il numero di livello richiesto non esiste\n # carico quello più vicino a quello richiesto\n if self.levelIn...
[ "0.6549542", "0.65455246", "0.5846803", "0.5705636", "0.56784075", "0.56639093", "0.56557", "0.5648059", "0.56119126", "0.55274254", "0.5508719", "0.54641163", "0.54441774", "0.5439524", "0.54059404", "0.5385119", "0.53591174", "0.5351808", "0.5346402", "0.5331341", "0.532824...
0.70741254
0
This is the main function.
def main(): global CURRENT_GAME_LEVEL app = QtGui.QApplication(sys.argv) file_existence = os.path.exists("Level.txt") # If file exist read level from file to restore previous level. if file_existence is True: file_object = open("Level.txt", "r") level = int(file_object.read()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main(...
[ "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "0.9125712", "...
0.0
-1
Unwraps an IntEnum type into a C type.
def as_ctype(type): return getattr(type, "as_ctype", lambda: type)()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_python(self, value):\n if isinstance(value, self.enum_class):\n return value\n value = super(self.__class__, self).to_python(value)\n if isinstance(value, int):\n return self.enum_class(value)\n assert value is None\n return None", "def convertToEnu...
[ "0.60084146", "0.6002765", "0.5761176", "0.57588375", "0.574338", "0.56938255", "0.56852454", "0.565927", "0.5474732", "0.545906", "0.53661764", "0.5318806", "0.5288625", "0.52577174", "0.5246035", "0.5230769", "0.52294695", "0.51609963", "0.5139474", "0.5110943", "0.5089114"...
0.45861113
64
Export a parse to a module's global dict.
def export_for_pydoc(self, module_globals): module_all = module_globals.setdefault("__all__", []) for k, v in sorted(self.constants.items()): module_globals[k] = v module_all.append(k) for k, v in sorted(self.enums.items()): module_globals[k] = v m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exports():", "def test_global_parser():\n global_test_str = ('global coord=B1950_VLA, frame=BARY, corr=[I, Q], '\n 'color=blue')\n global_parser = _CRTFParser(global_test_str)\n expected = {'coord': 'B1950_VLA', 'frame': 'BARY',\n 'corr': ['I', 'Q'], 'color': 'bl...
[ "0.5171371", "0.5164983", "0.51492983", "0.5098026", "0.5070959", "0.50644064", "0.49917898", "0.4967141", "0.48953292", "0.48437035", "0.48046973", "0.4756985", "0.47518238", "0.47412223", "0.47298408", "0.47273082", "0.47185355", "0.4717066", "0.47156605", "0.4708122", "0.4...
0.4467528
48
Parse the header file.
def parse(self): return Parse(constants=self.parse_defines(), enums=self.parse_enums(), structs=self.parse_structs(), fundecls=self.parse_functions())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parseFileHeader(self):\n self.fileheader = FileHeader()\n self.fileheader.parse(self.f)\n #print('Parsed fileheader')", "def parse_header(self):", "def _parse_header(self):\n # read the first bytes from the file\n header = self._stream_handle.read(HEADER_BYTES)\n ...
[ "0.8594291", "0.8134366", "0.8040281", "0.77151465", "0.77026993", "0.75790334", "0.7419022", "0.7393171", "0.72007906", "0.71891177", "0.71719617", "0.7118266", "0.70150644", "0.6994578", "0.69443184", "0.69044703", "0.68406093", "0.68324554", "0.6819109", "0.6800248", "0.67...
0.0
-1
Parse ``define``'s of constants and of types.
def parse_defines(self): for line in self.header.splitlines(): if line.lower().startswith("#define"): _, line = line.strip().split(None, 1) # remove #define if " " in line: symbol, value = line.split(None, 1) if value.isdigit():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_define_variable(self):\n self.assertEqual(['define', 'test', '\"test\"'],\n grammar._DEFINE_VAR.parseString(\"#define test \\\"test\\\"\").asList())\n\n self.assertEqual(['define', 'test', \"f(w,x)\"],\n grammar._DEFINE_VAR.parseString(\"#defin...
[ "0.636398", "0.57366693", "0.5598086", "0.55355525", "0.53910017", "0.53386915", "0.5338318", "0.53181356", "0.52843934", "0.51965386", "0.5190159", "0.5169622", "0.51104206", "0.504494", "0.50343925", "0.50150555", "0.5005637", "0.49932948", "0.49319997", "0.4893059", "0.489...
0.7308531
0
Cast a ctypes object or byref into a Python object.
def deref(obj): try: return obj._obj.value # byref except AttributeError: try: return obj.value # plain ctypes except AttributeError: return obj # plain python
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_pyobj(space, w_obj, w_userdata=None, immortal=False):\n assert not is_pyobj(w_obj)\n if w_obj is not None:\n py_obj = w_obj._cpyext_as_pyobj(space)\n if not py_obj:\n py_obj = create_ref(space, w_obj, w_userdata, immortal=immortal)\n #\n # Try to crash here, inst...
[ "0.6561695", "0.6400061", "0.6284424", "0.6150552", "0.6112126", "0.5926656", "0.58083993", "0.58023477", "0.57096577", "0.56859213", "0.56555754", "0.55901396", "0.5577375", "0.5572786", "0.55587715", "0.55309314", "0.5499725", "0.54556036", "0.5441602", "0.54098374", "0.539...
0.7112424
0
Add a method with specific success codes.
def _set_success_codes(self, fname, success_codes): func = getattr(self._dll, fname) argtypes, func.argtuple_t, restype = self._fundecls[fname] argtypes = [argtype if not (isinstance(argtype, type(ctypes.POINTER(ctypes.c_int))) and argtype._type_.__module__ != "ct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_status_code(runner, return_value):\n if isinstance(return_value, Mapping):\n status_code = return_value.get('statusCode')\n if status_code:\n runner.resource['metadata']['status_code'] = status_code", "def add_status_code(code):\n def class_decorator(cls):\n cls.sta...
[ "0.6259414", "0.6249232", "0.61892796", "0.6104332", "0.60523224", "0.60154104", "0.5901302", "0.58486927", "0.5820936", "0.5702256", "0.56624115", "0.56536525", "0.562311", "0.55835485", "0.5566436", "0.554873", "0.5535785", "0.5483932", "0.54706943", "0.54671884", "0.546718...
0.6456779
0
Hide a DLL function.
def _prohibit(self, fname): @functools.wraps(getattr(cls, fname)) def prohibited(*args, **kwargs): raise AttributeError( "{} is not a public function of the DLL".format(fname)) setattr(self, fname, prohibited)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n raise NotImplementedError", "def do_hf_unhide(self, arg):\n self.show_hidden_frames = True\n self.refresh_stack()", "def hidden():\n return False", "def disable(func):\n return func", "def hide_gui():\n pass", "def do_hf_hide(self, arg):\n se...
[ "0.6301674", "0.60477537", "0.60280937", "0.59768236", "0.5971939", "0.59075075", "0.5817386", "0.57986", "0.5764656", "0.57285553", "0.5725818", "0.57060546", "0.5704686", "0.56854", "0.5649857", "0.56369823", "0.55817014", "0.5533546", "0.5519958", "0.5513072", "0.5513072",...
0.60058
3
Return all (deref'ed) arguments on success, raise exception on failure.
def errcheck(retcode, func, args): if retcode in func.success_codes: return func.argtuple_t(*[deref(arg) for arg in args]) else: raise DLLError(type(func.success_codes[0])(retcode))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_arguments(self):\n args, varargs, keyword, defaults = inspect.getargspec(self.exec_obj)\n if args.count('self') > 0:\n args.remove('self')\n return args", "def GetMissingArguments(self):\n return []", "def _validate_from_args(self, fget=None, fset=None, fdel=None,...
[ "0.6397031", "0.61253744", "0.60937583", "0.59841496", "0.59270066", "0.5857818", "0.5841817", "0.5820394", "0.5811422", "0.5785889", "0.5782351", "0.57743406", "0.5724139", "0.57156646", "0.5715326", "0.56607187", "0.5654867", "0.5625824", "0.5625288", "0.5614725", "0.561470...
0.0
-1
Blit all the high score related text to the screen
def show_scores(self): for text in self.score_text: text.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text(self):\n surface_score = pygame.font.SysFont('Helvetic', 100).render(str(self.score), False, BLACK)\n screen.blit(surface_score, (50, 50))", "def see_score(score_):\r\n pygame.font.init()\r\n myfont = pygame.font.SysFont('Comic Sans MS', 20)\r\n\r\n textsurface_score = myfont.rend...
[ "0.82245725", "0.78239125", "0.76545644", "0.76290226", "0.7564251", "0.7438759", "0.7430073", "0.7410058", "0.7290597", "0.7256169", "0.72067904", "0.72033733", "0.7193303", "0.7192436", "0.71730494", "0.71401155", "0.7125147", "0.71155417", "0.7099325", "0.7095581", "0.7069...
0.76495516
3
Returns ui entity for `obj_type`
def get_cls_for(obj_type): return { "workflow": Workflow }[obj_type]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_item(type_, obj, autogen_context):\n\n if type_ == 'type' and isinstance(obj, sqlalchemy_utils.types.uuid.UUIDType):\n # add import for this type\n autogen_context.imports.add(\"import sqlalchemy_utils\")\n autogen_context.imports.add(\"import uuid\")\n return \"sqlalchemy...
[ "0.6647817", "0.6435144", "0.62939215", "0.62257814", "0.6221191", "0.6221191", "0.6100702", "0.6099007", "0.6019677", "0.5956331", "0.5919361", "0.5900237", "0.58783996", "0.58783996", "0.58783996", "0.58783996", "0.58783996", "0.58783996", "0.58783996", "0.58783996", "0.587...
0.5649897
59
Return nth value of the modified Tribonnaci sequence Expand the sequence if necessary
def get_tribonnaci(self, n): if n not in self.numbers: current_n = max(self.numbers) while current_n < n: current_n += 1 self.numbers[current_n] = self.numbers[current_n - 1] + \ self.numbers[current_n - 2] + \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lucas(n):\n if n == 0:\n return 2\n elif n == 1:\n return 1\n else:\n nth = lucas(n-1) + lucas(n-2)\n return nth", "def solve(n, seq):\n\n return sum(seq) - (n-1) * (n-2) / 2", "def nth(n, seq):\n try:\n return seq[n]\n except TypeError:\n return ...
[ "0.6478033", "0.6209465", "0.6194479", "0.6160907", "0.61453307", "0.61131483", "0.6061283", "0.5964612", "0.59022593", "0.58862644", "0.5838626", "0.5835178", "0.5829389", "0.582663", "0.5818929", "0.5817166", "0.58149713", "0.58006334", "0.57880753", "0.5778549", "0.577671"...
0.68224144
0
Returns unique elements from a list of permutations.
def permutations(config): return list(set(itertools.permutations(config)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_permutations(items):\n return set(permutations(items))", "def listUnique(self,permutations=True):\n ind,ok = self.testDuplicate(permutations)\n return ind[ok]", "def uniq(elements):\n us = set()\n ret = []\n for e in elements:\n if e not in us:\n ret.appen...
[ "0.8177064", "0.7411001", "0.6802766", "0.6653996", "0.66447264", "0.65575033", "0.6525947", "0.64785385", "0.64524955", "0.6374415", "0.6337084", "0.6331694", "0.63158125", "0.6297816", "0.6290124", "0.6272724", "0.6271203", "0.627059", "0.6264411", "0.6260488", "0.6235243",...
0.6415549
9
on entry, config is a tuple of length 4 booleans, e.g. (False, True, False, True)
def getSpies(self, config): assert len(config) == 4 assert all([type(c) is bool for c in config]) """ returns the subset of others who config says are spies""" return [player for player, spy in zip(self.others(), config) if spy]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testConfigC(self):\n assert type(self.config['debug']) == bool, \"Not parsing string to boolean correctly\"", "def check_config(cfg):", "def check_config(config):\n pass", "def _read_bool_from_config(key, default):\n if config.has_option('docker', key):\n return config.getboolean(...
[ "0.6190122", "0.601944", "0.58038557", "0.57449275", "0.5738686", "0.57220095", "0.56952447", "0.5693192", "0.5691993", "0.5665316", "0.56647676", "0.5663635", "0.5557517", "0.5455695", "0.5429822", "0.5429822", "0.542828", "0.5423687", "0.5414882", "0.5414882", "0.53726035",...
0.0
-1
find which members of "team" are labelled as spies according to the config (boolean, boolean, boolean, boolean)
def _validateSpies(self, config, team, sabotaged): spies = [s for s in team if s in self.getSpies(config)] """If there are more spies in our config than the number of sabotages made then return True, because this config is compatible with the sabotages made. Otherwise it is not co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_teams():", "def getSpies(self, config):\r\n assert len(config) == 4\r\n assert all([type(c) is bool for c in config])\r\n \"\"\" returns the subset of others who config says are spies\"\"\"\r\n return [player for player, spy in zip(self.others(), config) if spy]", "def get_p...
[ "0.6432302", "0.6408649", "0.6381583", "0.5885125", "0.5742375", "0.57341427", "0.5595591", "0.5593143", "0.5548696", "0.5520055", "0.5505677", "0.5505677", "0.5468758", "0.5444971", "0.5438358", "0.54024196", "0.53829783", "0.5346248", "0.5335073", "0.52880466", "0.52763814"...
0.5128865
31
Determine if this team is an acceptable one to vote for...
def _acceptable(self, team): current = [c for c in self.configurations if self._validateNoSpies(c, team)] return bool(len(current) > 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vote(self, team):\r\n return True", "def can_vote(age):\n return age >= 18", "def check_winner(self):\n pass", "def vote_result(self) -> bool:\n token_score = self.create_interface_score(self._token_score.get(), TokenInterface)\n yes = 0\n no = 0\n for addres...
[ "0.7902322", "0.6449424", "0.6306171", "0.6104335", "0.6072077", "0.6009855", "0.59994316", "0.5998816", "0.5997234", "0.5995144", "0.59560204", "0.5943541", "0.5934073", "0.5930967", "0.5918397", "0.58876115", "0.5849657", "0.5838723", "0.58257514", "0.58124757", "0.57971776...
0.5478879
48
This is a hook for providing more complex voting once logical reasoning has been performed.
def _vote(self, team): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opinion_vote(mode, verbose, revision):\n judge = VotingJudge(mode, revision)\n flags = judge.vote()\n if verbose is True:\n click.echo(\"Vote resulted in %i flags:\" % len(flags))\n for f in flags:\n format_flag(f)", "def process_VOTED(self, msg):\n\n result = parseYe...
[ "0.6289021", "0.5948813", "0.58756876", "0.5792382", "0.5758893", "0.5732524", "0.57292676", "0.5664396", "0.5635303", "0.5612909", "0.5588355", "0.55865514", "0.5553387", "0.5463278", "0.5462347", "0.54601604", "0.5458112", "0.54575557", "0.54467076", "0.5443048", "0.5429653...
0.6151692
1
Insert value at index k
def __setitem__(self, k, value): if k < 0: k += len(self) if value is not None: self.store_array.add_list_item(ListNode(value , k))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setitem__(self,k,v):\n self.insert(k,v)", "def insert(self, k: int, v: int) -> None:\n i = k % self.capacity\n if not self.data[i]:\n self.data[i] = ListNode(k, v)\n else:\n cur = self.data[i]\n while True:\n if cur.pair[0] == k:\n...
[ "0.77019125", "0.7627747", "0.74772215", "0.7229901", "0.7198082", "0.6954016", "0.6874141", "0.6824919", "0.6617062", "0.66130084", "0.64938253", "0.648273", "0.64766896", "0.6475448", "0.64466083", "0.6428774", "0.64268345", "0.6418416", "0.6408187", "0.63482594", "0.633443...
0.68265134
7
Return element at index k.
def __getitem__(self, k): if k < 0: k += len(self) if not 0 <= k < self._n: raise IndexError('invalid index') return self.store_array[k]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, k):\n if not 0 <= k < self._size:\n raise IndexError( 'invalid index' )\n return self._Array[k] # retrieve from array", "def __getitem__(self, k):\r\n if not 0 <= k < self.n:\r\n return IndexError('It is out of bounds!')\r\...
[ "0.7940829", "0.7856086", "0.7607196", "0.7590514", "0.7377373", "0.72474056", "0.71926814", "0.7138396", "0.6892919", "0.68894875", "0.6784589", "0.67538214", "0.67097384", "0.6671265", "0.66235566", "0.6570893", "0.65552133", "0.6549814", "0.6482227", "0.6421488", "0.639836...
0.75259453
4