query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This is a helper function to turn the values of the keys of a python dictionary into a string. This is utilized for cleaning the swipes dataframe.
def str_list(d): d_new = {} for key, value in d.items(): d_new[key] = str(value) return d_new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_keys_into_str(d):\n return { str(k) : v for k,v in d.items() }", "def keys2string(dictionary):\r\n if not isinstance(dictionary, dict):\r\n return dictionary\r\n return dict((str(k), keys2string(v)) \r\n for k, v in dictionary.items())", "def convert_keys_to_string(dictionary):\...
[ "0.77008075", "0.7463135", "0.73454076", "0.73070514", "0.7253955", "0.71603686", "0.71259487", "0.7066297", "0.70552695", "0.7034173", "0.6974902", "0.69219834", "0.6862053", "0.6799316", "0.6796374", "0.6788022", "0.672934", "0.6727243", "0.6701444", "0.6661141", "0.6645962...
0.60535806
46
Initialize the fake dataset.
def __init__(self, reps_batches, feats_batches): assert len(reps_batches) == len(feats_batches) self.reps_batches = reps_batches self.feats_batches = feats_batches
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.dataset = self.dataset_cls()", "def setUp(self):\n self.dataset = get_test_dataset()", "def __init__(self):\n self.__dataset = None", "def __init__(self, dataset):\n self._dataset = dataset", "def __init__(self, dataset: Dataset):\n self.dataset = ...
[ "0.7854854", "0.7644687", "0.7560155", "0.7505176", "0.74379903", "0.7395882", "0.729152", "0.72197926", "0.70108587", "0.6961162", "0.6961162", "0.6961162", "0.6961162", "0.6912438", "0.69077843", "0.6864246", "0.68624324", "0.6847528", "0.6818014", "0.6760041", "0.67426294"...
0.0
-1
Returns batches of fake feature tensors for testing.
def features(): return tuple( torch.randint(N_UNIQUE_FEATS, size=(seq_length,)) for seq_length in SEQ_LENGTHS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fake_data_batch(batch_size, input_size,\n padding_length):\n def _one_hot(i):\n a = np.zeros(input_size, 'uint8')\n a[i] = 1\n return a.tolist()\n\n # Two fake data, with two frames and one frame, respectively.\n inputs_data = [[_one_hot(2), _one_hot(20)], [_one_hot(5)]]\...
[ "0.6421488", "0.6393712", "0.638047", "0.61864674", "0.618429", "0.61762345", "0.61470693", "0.6135591", "0.6072262", "0.5994537", "0.59875", "0.59683275", "0.5942359", "0.59387666", "0.59304696", "0.58740455", "0.5843243", "0.5838933", "0.5832894", "0.5822024", "0.5821198", ...
0.0
-1
Test the PUT and GET methods for ratings.
def test_assign_and_read_ratings(self): self.signup('user@example.com', 'user') self.login('user@example.com') csrf_token = self.get_csrf_token_from_response( self.testapp.get('/explore/%s' % self.EXP_ID)) # User checks rating ratings = self.get_json('/explorehandle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_rating(self):\n\n rating_data = {\n 'user': self.user.pk,\n 'book': self.book.pk,\n 'rating': random.randint(1, 5)\n }\n\n self.client.post(self.list_url, data=rating_data)\n\n self.book.refresh_from_db()\n\n assert self.book.ratings...
[ "0.7492016", "0.7311704", "0.70145845", "0.69894004", "0.685951", "0.6665553", "0.6469139", "0.63895595", "0.6316338", "0.6277417", "0.6271246", "0.6263864", "0.62464947", "0.6229114", "0.62232953", "0.6206158", "0.6195368", "0.61885506", "0.61521053", "0.61303055", "0.609022...
0.81327856
0
test to see if invalid file raises an error
def test_invalidFile(self): self.assertRaises(cesmEnvLib.checkFile("blah", "write"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_file_raises():\n with pytest.raises(ValueError):\n cli._valid_file(__file__)", "def _check_valid_file(self, file):\n\n try:\n _ = open(f\"{file}\")\n except FileNotFoundError:\n raise ValueError", "def test_error(file_path):\n assert check...
[ "0.81236607", "0.7607157", "0.7492643", "0.7416563", "0.7364817", "0.73632103", "0.73626834", "0.7345573", "0.72771174", "0.7237749", "0.7233718", "0.7233718", "0.7232252", "0.72104526", "0.7196611", "0.7165781", "0.71577656", "0.71485966", "0.7146494", "0.713752", "0.7123104...
0.79525465
1
Hide widgets used to replace
def hide_replace_widgets(self): self.ui.replaceLabel.setVisible(False) self.ui.textToReplace.setVisible(False) self.ui.replaceButton.setVisible(False) self.ui.replaceAllButton.setVisible(False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n self.row_box.grid_remove()\n self.field_name_box.grid_remove()\n self.field_name_label.grid_remove()\n self.value_box.grid_remove()\n self.active_value_widget.grid_remove()", "def hide(self):\n self.visible = False", "def unHide(self):\n self.v...
[ "0.74319285", "0.7316716", "0.7252604", "0.72415304", "0.7231562", "0.7176774", "0.71270937", "0.7087486", "0.703734", "0.70190805", "0.70034736", "0.6990393", "0.69851243", "0.6911782", "0.6890413", "0.6885022", "0.6860507", "0.68448097", "0.6836431", "0.68210477", "0.680342...
0.8568544
0
Error handler for all 404 not found errors
def not_found_404(error): return jsonify({ 'success': False, 'message': 'Resource not found', 'error': 404 }), 404
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found_error_handler(error):\r\n return render_template('error.404.html')", "def handleStatus_404(self):\n log.err('HTTP Error 404')", "def handle_notfound( environ ):\n return 404, [], make_error( 'Not Found', environ[ 'PATH_INFO' ] )", "def handler404(request):\n response = render_to...
[ "0.8089497", "0.78269464", "0.77300256", "0.77166814", "0.77091134", "0.7680059", "0.7672964", "0.7623633", "0.7596676", "0.75720745", "0.7541706", "0.7536495", "0.75059175", "0.747122", "0.7401486", "0.73624086", "0.7351865", "0.7324612", "0.73184705", "0.73124677", "0.72939...
0.67667943
79
Specifies rate from total number of points on grid, which should be refined.
def withAdaptRate(self, value): self._refinement.setAdaptRate(value) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_rate(self):\r\n interval = self.data.iloc[2, 0] - self.data.iloc[1, 0]\r\n self.rate = int(1 / interval)", "def update_recruiting(self, rate):\n self.recruit = int(np.ceil(self.INITIAL_POPULATION*rate))", "def rate(self, rate):\n\n self._rate = rate", "def rate(self, rate...
[ "0.7054117", "0.6552802", "0.6418355", "0.6418355", "0.6328499", "0.611493", "0.6067628", "0.60670006", "0.60062164", "0.59988433", "0.59878546", "0.5920879", "0.591833", "0.5895778", "0.5889928", "0.5859504", "0.5846122", "0.5800671", "0.5792975", "0.57916087", "0.5785541", ...
0.5349811
81
Function that applies normalization to the data by subtracting the mean and dividing by the std for every observation in each column
def scale_and_separate(df, labels=True): df.columns = df.columns.str.lstrip() y = None if labels: y = df['ATT_FLAG'] # separate the target values df.drop(['ATT_FLAG'], axis=1, inplace=True) # apply scaling scaled_df = pd.DataFrame(StandardScaler().fit_transform(df.values), index=df...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_feature(df):\n return df.apply(lambda column: (column - column.mean()) / column.std())", "def standardize(data):\r\n mean = data.mean(axis=0)\r\n std = data.std(axis=0)\r\n return (data - mean)/std", "def standardize(X):\n X_std = X\n mean = X.mean(axis=0)\n std = X.std(axis...
[ "0.8147484", "0.814717", "0.8068044", "0.7960649", "0.7960649", "0.7911893", "0.78902406", "0.7857458", "0.784475", "0.7807569", "0.7793336", "0.7769386", "0.77469194", "0.7719458", "0.7718339", "0.7573229", "0.75375575", "0.7471872", "0.74626684", "0.7452656", "0.74139076", ...
0.0
-1
Return the bin width to use for normalizing bin contents. returns The bin width to use as the denominator for plotting bin contents. If 'None', bin contents should be displayed without normalizing to a fixed bin width.
def _getNormalBinWidth(self, style): bin_size = style.get("normalize_bin_size", "auto") if bin_size == "auto": # Use the size of the first bin. x0, x1 = self.histogram.axis.getBinRange(0) bin_size = x1 - x0 return bin_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_width(self):\n return self.bins[2] - self.bins[1]", "def computeBinWidth(self):\n self.binWidth = (self.data[-1] - self.data[0]) / self.numBins\n # Fill the frequencies array with zero\n for i in range(self.numBins):\n self.frequencies.append(0)", "def _getNormalB...
[ "0.78802156", "0.7723355", "0.7381942", "0.7069086", "0.70071006", "0.6869877", "0.66121763", "0.6534182", "0.62684083", "0.62300706", "0.6190163", "0.6182235", "0.6143632", "0.6112729", "0.5990901", "0.59051055", "0.59008485", "0.5886812", "0.5852261", "0.5842295", "0.582263...
0.79796773
0
Return the bin widths to use for normalizing bin contents. returns The two bin widths to use as the denominator for plotting bin contents. If 'None', bin contents should be displayed without normalizing to a fixed bin width.
def _getNormalBinWidths(self, style): bin_size = style.get("normalize_bin_size", "auto") if bin_size == "auto": # Use the size of the first bins. x0, x1 = self.histogram.axes[0].getBinRange(0) y0, y1 = self.histogram.axes[1].getBinRange(0) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetBinWidths(self):\n binwidths = [\n self._lowbinedges[i + 1] - self._lowbinedges[i]\n for i in range(len(self._lowbinedges) - 1)\n ]\n return binwidths", "def _getNormalBinWidth(self, style):\n \n bin_size = style.get(\"normalize_bin_size\", \"auto\"...
[ "0.7677445", "0.7472313", "0.736145", "0.7269431", "0.72542816", "0.71608865", "0.7037428", "0.66407084", "0.6169346", "0.6142871", "0.60611624", "0.5948143", "0.59319663", "0.5915866", "0.5915866", "0.5770978", "0.57363", "0.57347083", "0.57191324", "0.56850314", "0.5680741"...
0.7792254
0
Load an image from file into a numpy array. Puts image into numpy array to feed into tensorflow graph. Note that by convention we put it into a numpy array with shape (height, width, channels), where channels=3 for RGB.
def load_image_into_numpy_array(self, path): return np.array(Image.open(path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image_into_numpy_array(path):\n img_data = tf.io.gfile.GFile(path, 'rb').read()\n image = Image.open(BytesIO(img_data))\n (im_width, im_height) = image.size\n return np.array(image.getdata()).reshape(\n (im_height, im_width, 3)).astype(np.uint8)", "def load_image_into_numpy_array(path...
[ "0.78665286", "0.77754813", "0.77754813", "0.7717838", "0.7716612", "0.77052444", "0.770156", "0.7623063", "0.76111406", "0.7500111", "0.74317414", "0.7402159", "0.7348851", "0.73125565", "0.7294386", "0.72750413", "0.7240601", "0.7219427", "0.7202111", "0.7185911", "0.718137...
0.74526995
10
return NGramsSequence object from dict
def from_json(cls, sequence_name: str, data: Dict[str, Any]): sequence = cls(sequence_name) sequence.total_count = data['total_count'] sequence.next_count = data['next_count'] return sequence
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(cls, data: Dict[str, Any]) -> NGramsModel:\n n_grams: int = data['n_grams']\n complete_model = cls(n_grams)\n\n model: Dict[str, NGramsSequence] = {}\n for sequence, sequence_obj in data['model'].items():\n model[sequence] = NGramsSequence.from_json(sequence, se...
[ "0.5980302", "0.5829396", "0.57926756", "0.54370123", "0.5435297", "0.53666174", "0.536562", "0.5347345", "0.52914196", "0.5288009", "0.5184858", "0.516624", "0.5155609", "0.5145033", "0.51327556", "0.51326644", "0.51249367", "0.5122596", "0.5116368", "0.51152927", "0.5110895...
0.0
-1
dict with string keys to int
def dict_str_to_int(obj: Dict[str, Any]) -> Dict[int, Any]: res: Dict[str, Any] = {} for key, val in obj.items(): res[int(key)] = val return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_int(data):\n return {int(k): data[k] for k in sorted(data.keys())}", "def to_num_dict (dict):\n output = {}\n for key, value in dict.items():\n output[int(key)] = value\n return output", "def _kv_to_int(kv, keys):\n for k, v in kv.items():\n if k in keys:\n ...
[ "0.79824007", "0.71892446", "0.71380085", "0.7126491", "0.70278645", "0.6609454", "0.65651965", "0.6549052", "0.65419114", "0.649324", "0.6477879", "0.6453551", "0.64230794", "0.63829917", "0.63057864", "0.62804836", "0.6260816", "0.6231681", "0.6182311", "0.61225575", "0.609...
0.7465834
1
return NGramsSequence object from dict
def from_json(cls, data: Dict[str, Any]) -> NGramsModel: n_grams: int = data['n_grams'] complete_model = cls(n_grams) model: Dict[str, NGramsSequence] = {} for sequence, sequence_obj in data['model'].items(): model[sequence] = NGramsSequence.from_json(sequence, sequence_obj)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nmer_dictionary(self,n,dic={}):\n if self.sequence == \"\":\n self.fetchSequence()\n self.sequence = self.sequence.upper()\n for i in range(0,len(self.sequence)-n):\n subseq = self.sequence[i:][:n]\n dic[subseq]=1+dic.get(subseq,0)\n del subseq\n...
[ "0.5829396", "0.57926756", "0.54370123", "0.5435297", "0.53666174", "0.536562", "0.5347345", "0.52914196", "0.5288009", "0.5184858", "0.516624", "0.5155609", "0.5145033", "0.51327556", "0.51326644", "0.51249367", "0.5122596", "0.5116368", "0.51152927", "0.5110895", "0.5110315...
0.5980302
0
Renders the home page.
def home(): return render_template( 'index.html', title='Home Page', year=datetime.now().year, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def ...
[ "0.85574406", "0.853399", "0.8351404", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.827363", "...
0.8061255
43
Initilizes the whole event loop with a seperated thread, where the event loop is running.
def start(self): if self.thread is None: self.thread = threading.Thread( target=self.__run__, daemon=True, ) self.thread.start() LOGGER.debug( "Starting thread `%s` for event loop `%s`.", self.ident...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startLoop(self):\n if(self.loop is not None):\n raise Exception(\"Event loop is already started!\")\n self.loop = asyncio.new_event_loop()\n self.thread = Thread(target=start_thread_loop, args=(self.loop,))\n self.thread.setDaemon(True)\n self.thread.start()", "d...
[ "0.7944864", "0.78450817", "0.76813805", "0.7136728", "0.7033592", "0.70063716", "0.69827086", "0.6961245", "0.69509304", "0.69415987", "0.6894436", "0.6876219", "0.6876219", "0.6876219", "0.6876219", "0.68324876", "0.6806173", "0.6727917", "0.6713544", "0.6713544", "0.662690...
0.7894374
1
Get an environment variable safely, tries to load it from file if not found.
def safe_getenv(key: str) -> str: # pylint: disable=import-outside-toplevel try: return environ[key] except KeyError as exc: env_file = Path(constants.ENV_FILE_DEFAULT_PATH.value) if env_file.exists() and env_file.is_file(): try: load_envs_from_file() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_get_var_value(var_name, allow_missing=False):\n if allow_missing:\n if var_name not in os.environ.keys():\n return None\n assert var_name in os.environ.keys(), \"Please supply %s in environment\" % var_name\n return os.environ[var_name]", "def get_env_variable(self, var_name, o...
[ "0.737349", "0.73287576", "0.7326425", "0.7326145", "0.7195848", "0.7175811", "0.71706396", "0.71382815", "0.7109022", "0.7074804", "0.70155084", "0.7013515", "0.70077306", "0.69910717", "0.69632024", "0.6936707", "0.6902253", "0.68668413", "0.67869276", "0.6769845", "0.67567...
0.7102582
9
Responsible for displaying user's fridge. Note that form to add an ingredient is also shown here, as there is no need for a separate page for such a small form.
def fridge_detail(request): user = request.user fridge = Fridge.objects.get_or_create(user=user)[0] ingredients = FridgeIngredient.objects.filter(fridge=fridge) recipes = fridge.recipes.all() if request.method == 'POST': form = FridgeIngredientForm(request.POST) if form.is_valid():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fridge_recipes(request):\n\n user = request.user\n fridge = Fridge.objects.get_or_create(user=user)[0]\n fridge_ingredients = fridge.ingredients.all()\n ingredient_names = [ingredient.name for ingredient in fridge_ingredients]\n recipes = recipes_containing(ingredient_names, fridge=fridge)\n\n ...
[ "0.71831393", "0.67995745", "0.67022413", "0.60869473", "0.6061109", "0.5985206", "0.58212996", "0.5779938", "0.576676", "0.57642764", "0.5740424", "0.5723733", "0.56843567", "0.566176", "0.563532", "0.55935574", "0.5491119", "0.5479765", "0.544285", "0.5428146", "0.5427262",...
0.7832167
0
Render website's home page.
def home(key): results = [] resp = requests.get(gdoc_template.format(key)) if resp.ok: sio = StringIO.StringIO(resp.content) dr = csv.DictReader(sio) for row in dr: results.append(row) return Response(response=json.dumps(results), status=200, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n return render_template('homepage.html')", "def home():\n\n return render_template('home_page.html')", "def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")", "...
[ "0.8724249", "0.85791856", "0.850329", "0.84860355", "0.84612614", "0.84362435", "0.8429879", "0.8419578", "0.8396612", "0.8396612", "0.8374868", "0.8356488", "0.8350785", "0.8340763", "0.8340763", "0.83374727", "0.83374727", "0.83374727", "0.83374727", "0.83374727", "0.83374...
0.0
-1
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(response): response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1' response.headers['Cache-Control'] = 'public, max-age=600' return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\r\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\r\n response.headers['Cache-Control'] = 'publi...
[ "0.82236516", "0.81961995", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", "0.8163723", ...
0.8222848
4
Get botocore package version.
def get_botocore_version() -> str: return botocore_version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_aiobotocore_version() -> str:\n try:\n from aiobotocore import __version__ as version # type: ignore\n except ImportError:\n raise RuntimeError(\"aiobotocore is not installed\")\n return version", "def get_boto3_version() -> str:\n return boto3_version", "def get_aioboto3_ver...
[ "0.78680444", "0.765513", "0.71913964", "0.715537", "0.7147764", "0.7147764", "0.7147764", "0.70105004", "0.6968503", "0.6928803", "0.692623", "0.6907918", "0.6907567", "0.6907567", "0.6891363", "0.68780994", "0.68743736", "0.6862947", "0.683245", "0.68177754", "0.68081677", ...
0.8543725
0
Get boto3 package version.
def get_boto3_version() -> str: return boto3_version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_aioboto3_version() -> str:\n try:\n from aioboto3 import __version__ as version # type: ignore\n except ImportError:\n raise RuntimeError(\"aioboto3 is not installed\")\n\n return version", "def get_botocore_version() -> str:\n return botocore_version", "def get_aiobotocore_v...
[ "0.8140883", "0.7582766", "0.71447617", "0.6887908", "0.6887908", "0.6887908", "0.68872106", "0.6879318", "0.68086505", "0.68086505", "0.6804615", "0.67819107", "0.6779405", "0.67780316", "0.67723364", "0.67608714", "0.6757582", "0.6746531", "0.67390364", "0.672341", "0.67187...
0.871558
0
Converts binary (l, 1) array to onehot (l, 2) array
def binary_to_one_hot(arr: np.ndarray) -> np.ndarray: res = np.zeros((arr.shape[0], 2)) res[np.where(arr == 1)[0], 0] = 1 res[np.where(arr == 0)[0], 1] = 1 return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output", "def one_hot_encode(x):\n # TODO: Implement Function\n x_l = list(x)\n for index in np.arange(len(x_l)):\n x_...
[ "0.8280845", "0.80964357", "0.80849147", "0.8008895", "0.79582685", "0.78934133", "0.78606147", "0.78175247", "0.77903146", "0.7769803", "0.776282", "0.7757748", "0.77461106", "0.77360934", "0.77356505", "0.77163607", "0.7714669", "0.76704556", "0.76672757", "0.7661375", "0.7...
0.82738936
1
Converts likelihood array back to one hot depending on highest value
def max_arg_one_hot(arr: np.ndarray) -> np.ndarray: # using argmin because inverted indices in binary_to_one_hot return binary_to_one_hot(np.argmin(arr, axis=1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot_argmax(logits):\n return T.extra_ops.to_one_hot(T.argmax(logits,-1),logits.shape[-1])", "def reverse_one_hot(image):\n x = np.argmax(image, axis = -1)\n return x", "def unhot(one_hot_labels):\n return np.argmax(one_hot_labels, axis=1)", "def reverse_one_hot(image):\r\n # w = image.s...
[ "0.72739863", "0.7112829", "0.7071621", "0.7028016", "0.654678", "0.6461915", "0.64383554", "0.6425988", "0.6425061", "0.64052826", "0.6384727", "0.63543844", "0.6338996", "0.62720567", "0.62135184", "0.6200054", "0.61939496", "0.6177994", "0.6171241", "0.61653167", "0.616386...
0.69912195
4
Save a checkpoint file to `checkpoint_dir`.
def save_checkpoint(model, epoch, checkpoint_dir, stats): state = { "epoch": epoch, "state_dict": model.state_dict(), "stats": stats, } filename = os.path.join(checkpoint_dir, "epoch={}.checkpoint.pth.tar".format(epoch)) torch.save(state, filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_checkpoint(self, checkpoint_dir):\r\n\r\n if not os.path.exists(checkpoint_dir):\r\n os.makedirs(checkpoint_dir)\r\n\r\n path = os.path.join(checkpoint_dir, 'model.pt')\r\n torch.save(self.model.state_dict(), path)", "def save(self, checkpoint_path: str):\r\n raise...
[ "0.80452263", "0.800499", "0.78747916", "0.77815384", "0.76896876", "0.7574583", "0.7534235", "0.75064737", "0.7501034", "0.7466035", "0.7462241", "0.745421", "0.7392644", "0.7365168", "0.7340274", "0.7302462", "0.72531676", "0.72474486", "0.7244837", "0.72426933", "0.7215009...
0.7233075
20
Restore model from checkpoint if it exists. Returns the model and the current epoch.
def restore_checkpoint(model, checkpoint_dir, cuda=False, force=False, pretrain=False): try: cp_files = [ file_ for file_ in os.listdir(checkpoint_dir) if file_.startswith("epoch=") and file_.endswith(".checkpoint.pth.tar") ] except FileNotFoundError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self):\n if self._restored_model:\n return\n with self.eval_graph.graph.as_default():\n last_checkpoint = self._find_last_checkpoint()\n # TODO(rbharath): Is setting train=False right here?\n saver = tf.train.Saver()\n saver.restore(self._get_shared_session(train=False), ...
[ "0.77573466", "0.7590565", "0.75367033", "0.7495357", "0.7446445", "0.7435409", "0.72213614", "0.716913", "0.71452117", "0.7120259", "0.7120259", "0.7112676", "0.70710856", "0.7037954", "0.70236856", "0.70143163", "0.7003166", "0.69157535", "0.68999827", "0.6879434", "0.68791...
0.77778536
0
Draw a single pixel wide line starting at x0, y0 and ending at x1, y1.
def line(self, x0, y0, x1, y1, color): steep = abs(y1 - y0) > abs(x1 - x0) if steep: x0, y0 = y0, x0 x1, y1 = y1, x1 if x0 > x1: x0, x1 = x1, x0 y0, y1 = y1, y0 dx = x1 - x0 dy = abs(y1 - y0) err = dx // 2 ystep = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paint_line(canvas, x0, y0, x1, y1, color):\n num_points = max(abs(x0-x1), abs(y0-y1))\n #create the points at every pixel between each coordinate\n xs = np.linspace(x0, x1, num_points)\n ys = np.linspace(y0, y1, num_points)\n\n #do splatter\n for i in range(len(xs) - 1):\n canvas[int(m...
[ "0.74158645", "0.7394731", "0.7148242", "0.7095709", "0.70662713", "0.6953858", "0.6814485", "0.68017435", "0.67833173", "0.67407763", "0.6734903", "0.6726154", "0.67147684", "0.66671616", "0.6559366", "0.6558718", "0.6539604", "0.65368116", "0.65349036", "0.650588", "0.64964...
0.70972323
3
Closes this session in the database.
def Close(self): sql = ''' UPDATE sessions SET end_time = ?, duration = ? - start_time WHERE id == ?; ''' ts = unix.GetTime() util.Database().Execute(sql, (ts, ts, unix.GetEnvInt('ASH_SESSION_ID'),))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_session(self, session):\r\n session.close()", "def close(self):\n self.__session.close()", "def close(self):\n self.__session.close()", "def close(self):\n self.__session.close()", "def close(self):\n self.__session.close()", "def close(self):\n self...
[ "0.82106435", "0.77334374", "0.77334374", "0.77334374", "0.77334374", "0.77334374", "0.77334374", "0.768885", "0.762851", "0.7587804", "0.7587804", "0.7587804", "0.7584962", "0.7573747", "0.7569822", "0.7353879", "0.7330498", "0.7329504", "0.73101395", "0.72975266", "0.728678...
0.67199004
56
before we pass x to next conv, we apply batch normalization
def bn(x, e=1e-7): mu = np.mean(x) sigma2 = np.var(x) x_ = (x - mu) / np.sqrt(sigma2 + e) return x_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n\n x = F.max_pool2d(F.relu(self.batch_norm1(self.conv1(x))), 3, stride=2, padding=1)\n x = F.max_pool2d(F.relu(self.batch_norm2(self.conv2(x))), 3, stride=2, padding=1)\n x = F.max_pool2d(F.relu(self.batch_norm3_b(self.conv3_b(F.relu(self.batch_norm3_a(self.conv3_a(x)))))), 3, strid...
[ "0.68538624", "0.682618", "0.6822019", "0.68064326", "0.674407", "0.6742077", "0.67335135", "0.6729097", "0.6716522", "0.6674791", "0.66210794", "0.65989494", "0.6594042", "0.65796685", "0.65714985", "0.6562576", "0.6558288", "0.6516352", "0.65058446", "0.64991534", "0.649632...
0.0
-1
Given width, kernel size and slide, compute how to pad to make output same as input
def pad_same(width, kernel, slide): res = (width - kernel) / slide + 1 pad = (width - res) / 2 return pad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_padding(kernel_size, stride, dilation):\n return -((-kernel_size - (kernel_size - 1) * (dilation - 1)) // stride + 1) // 2", "def pad_to_width(kernel, width):\n current_width = len(kernel)\n delta = (width - current_width) / 2\n\n pad0 = tf.cast(delta, tf.int32)\n pad1 = tf.cast(tf.math.c...
[ "0.75854933", "0.7139086", "0.7016609", "0.67164576", "0.6670249", "0.6651689", "0.664683", "0.6644851", "0.6589808", "0.6585164", "0.6561296", "0.65253985", "0.6513961", "0.65131944", "0.6512792", "0.65065634", "0.64974165", "0.64952624", "0.64903253", "0.64390147", "0.64382...
0.83880424
0
Construct the layer in tensorflow
def build(self, input_layer, trainable=True): with tf.variable_scope(self.name): # Get the number of input channels input_shape = input_layer.get_shape() num_input_channels = input_shape[-1].value # Create the weights and convolutional layer weight_shape = [self.kern...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_layer(prev, n, activation):\n\n kernel_ini = tf.contrib.layers.variance_scaling_initializer(mode=\"FAN_AVG\")\n layer = tf.layers.Dense(units=n, activation=activation,\n kernel_initializer=kernel_ini, name='layer')\n\n return layer(prev)", "def __init__(self, incomi...
[ "0.74185485", "0.73529774", "0.7272762", "0.72462964", "0.711412", "0.70790905", "0.70484775", "0.7017083", "0.7007014", "0.69657415", "0.6953619", "0.6940279", "0.69260556", "0.6925511", "0.69183576", "0.69041395", "0.6902256", "0.6889688", "0.6889339", "0.68756807", "0.6850...
0.71078867
5
Construct the layer in tensorflow
def build(self, input_layer, trainable=True): with tf.variable_scope(self.name): # Create a weight matrix input_size = input_layer.get_shape()[-1].value self.weights = weight_variable([input_size, self.output_size], 'weights', trainable, False) self.bias = bias_variable([sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_layer(prev, n, activation):\n\n kernel_ini = tf.contrib.layers.variance_scaling_initializer(mode=\"FAN_AVG\")\n layer = tf.layers.Dense(units=n, activation=activation,\n kernel_initializer=kernel_ini, name='layer')\n\n return layer(prev)", "def __init__(self, incomi...
[ "0.74185485", "0.73529774", "0.7272762", "0.72462964", "0.711412", "0.71078867", "0.70790905", "0.70484775", "0.7017083", "0.7007014", "0.69657415", "0.6953619", "0.6940279", "0.69260556", "0.6925511", "0.69183576", "0.69041395", "0.6902256", "0.6889688", "0.6889339", "0.6875...
0.67509955
36
Construct the layer in tensorflow
def build(self, input_layer, trainable=True): with tf.variable_scope(self.name): # Determine the size of the input when flattened input_layer_shape = input_layer.get_shape()[1:].dims flattened_dimension = reduce(lambda x,y: x*y, input_layer_shape, tf.Dimension(1)) # Create th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_layer(prev, n, activation):\n\n kernel_ini = tf.contrib.layers.variance_scaling_initializer(mode=\"FAN_AVG\")\n layer = tf.layers.Dense(units=n, activation=activation,\n kernel_initializer=kernel_ini, name='layer')\n\n return layer(prev)", "def __init__(self, incomi...
[ "0.74185485", "0.73529774", "0.7272762", "0.72462964", "0.71078867", "0.70790905", "0.70484775", "0.7017083", "0.7007014", "0.69657415", "0.6953619", "0.6940279", "0.69260556", "0.6925511", "0.69183576", "0.69041395", "0.6902256", "0.6889688", "0.6889339", "0.68756807", "0.68...
0.711412
4
Converts a boolean array to a blackandwhite uint8 array (0 and 255).
def bool_2_uint8(bool_arr): assert (bool_arr.dtype == 'bool'), \ 'improc.bool_2_uint8() only accepts boolean arrays.' return (255*bool_arr).astype('uint8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_mask(y):\n y[y <= 255./2] = 0 # Needs to be in this order, otherwise 1 gets overwritten\n y[y > 255./2] = 1\n binary_mask = y.astype(np.uint8)\n\n return binary_mask", "def test_convert_boolarray_to_bytearray_1_byte(self):\n input_lists = [ #Recall that these are in LSB on the l...
[ "0.70000464", "0.67567515", "0.6691188", "0.66493595", "0.6503561", "0.6437251", "0.6343648", "0.6343648", "0.63272667", "0.6257117", "0.6148952", "0.60243195", "0.5986081", "0.5973253", "0.5969509", "0.5947595", "0.5940527", "0.59184945", "0.5917785", "0.5871754", "0.5858442...
0.7936691
0
Gets the frames per second from the path of the video.
def get_fps(vid_path, prefix): _, name = os.path.split(vid_path) i1 = name.find(prefix) + len(prefix) i2 = name[i1:].find('_') fps = int(name[i1:i1+i2]) return fps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_video_frame_rate(filename):\n clip = VideoFileClip(filename)\n frame_rate = clip.fps\n clip.close()\n return frame_rate", "def get_fps(self):\n return self._num_frames / (datetime.now() - self._start).total_seconds()", "def get_frame_rate(video):\n\n video = cv2.VideoCapture(video...
[ "0.682971", "0.6742381", "0.6571456", "0.65680206", "0.6548314", "0.647691", "0.6395355", "0.638466", "0.63700545", "0.6337529", "0.6279134", "0.6269005", "0.62289846", "0.62284875", "0.61991984", "0.6185409", "0.61828214", "0.61795723", "0.6169377", "0.6138065", "0.61221766"...
0.7152967
0
get blob by name
def get_blob_by_name(self, name): df_selected = self.index.df[(self.index.df[Data.SDATA_NAME] == name)] print("df_selected", len(df_selected)) datas = [] for uid, row in self.index.df[(self.index.df[Data.SDATA_NAME] == name)].iterrows(): logging.debug("get_blob_by_name: load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_blob(self, blob_name):\n return self.bucket.get_blob(blob_name)", "def get_blob(self, download_meta):\n blob_id = download_meta['blob_id']\n if isinstance(blob_id, str):\n blob_id = uuid.UUID(blob_id)\n session = self.DBSession()\n blob = session.get(Blob, blob_i...
[ "0.8583244", "0.6953601", "0.67586577", "0.6631318", "0.6628308", "0.6619851", "0.661244", "0.6508382", "0.64547384", "0.64527833", "0.64366126", "0.64326876", "0.6331034", "0.62562263", "0.62432146", "0.62357354", "0.622683", "0.62171483", "0.6169855", "0.61662745", "0.61598...
0.7327133
1
Takes input from the user to add an entry to the database of donors and adds a contribution value
def thanks(): while True: response = input("\nPlease enter the name of the person donating or type 'List' for a list of donors: ") amount = 0 nl = "\n" if response.lower() == "list": print_donor_list() else: normalized_response = response.title() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_donor():\n logger.info('+++ Adding/Updating Donors')\n Main.connect_db()\n database.execute_sql('PRAGMA foreign_keys = ON;')\n name = input(\"Type donor first and last name: \")\n location = input(\"Type donor location (optional): \")\n try:\n don = floa...
[ "0.7516698", "0.7397058", "0.7342615", "0.7121032", "0.67970127", "0.679675", "0.6650254", "0.6474992", "0.6350873", "0.6305209", "0.6271407", "0.6241869", "0.6203297", "0.6188504", "0.61658436", "0.6158504", "0.6145111", "0.6103586", "0.6087066", "0.6084738", "0.606843", "...
0.6427393
8
displays the list of donor objects by name
def print_donor_list(): print(data_base.donor_names)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printdonorlist():\n for name in donor_db:\n print(name)", "def display_list(d):\n print(\"\\nOur generous donors: \\n\")\n for donor_name in iter(d.donors):\n print(donor_name)\n print(\"\\n\")", "def print_donors_names():\n update_lists()\n print(\"\\nDonors\")\n print(\...
[ "0.7952669", "0.7942223", "0.7774109", "0.77006596", "0.76222634", "0.7202344", "0.7029816", "0.6894928", "0.6893581", "0.6838041", "0.67764795", "0.6755879", "0.6601801", "0.6550669", "0.64183605", "0.63900656", "0.6368784", "0.6354311", "0.63281417", "0.6042331", "0.6002365...
0.7640701
4
Verifiy that the values entered into the two password fields match. Note that an error here will end up in ``non_field_errors()`` because it doesn't apply to a single field.
def clean(self): if 'password1' in self.cleaned_data and 'password' in self.cleaned_data: if self.cleaned_data['password1'] != self.cleaned_data['password']: raise forms.ValidationError(_(u'You must type the same password each time')) return self.cleaned_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_password(self):\n password1 = self.cleaned_data.get('password1')\n password2 = self.cleaned_data.get('password2')\n if password1 and password2 and password1 != password2:\n raise forms.ValidationError('Passwords do not match')\n return password2", "def clean(self)...
[ "0.7938596", "0.78743976", "0.7868922", "0.7839647", "0.7839647", "0.77343154", "0.76528925", "0.76365894", "0.7626773", "0.7620667", "0.76096493", "0.75964826", "0.75890887", "0.7567576", "0.75642955", "0.75642955", "0.7562649", "0.7547011", "0.7527047", "0.7463841", "0.7376...
0.7362963
22
Verifiy that the values entered into the two password fields match. Note that an error here will end up in ``non_field_errors()`` because it doesn't apply to a single field.
def clean(self): if 'password1' in self.cleaned_data and 'password' in self.cleaned_data: if self.cleaned_data['password1'] != self.cleaned_data['password']: raise forms.ValidationError(_(u'You must type the same password each time')) return self.cleaned_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_password(self):\n password1 = self.cleaned_data.get('password1')\n password2 = self.cleaned_data.get('password2')\n if password1 and password2 and password1 != password2:\n raise forms.ValidationError('Passwords do not match')\n return password2", "def clean(self)...
[ "0.79393995", "0.78751373", "0.7869208", "0.7840083", "0.7840083", "0.7735661", "0.7653578", "0.76377136", "0.76262844", "0.7619865", "0.76103294", "0.75963074", "0.7589395", "0.7565969", "0.75650203", "0.75650203", "0.756335", "0.7547981", "0.7527759", "0.74647665", "0.73782...
0.73637694
23
Returns a specific Load Balancer Type.
def get_by_id(self, id: int) -> BoundLoadBalancerType: response = self._client.request( url=f"/load_balancer_types/{id}", method="GET", ) return BoundLoadBalancerType(self, response["load_balancer_type"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_balancer_type(self) -> Optional[pulumi.Input['CloudRunConfigLoadBalancerType']]:\n return pulumi.get(self, \"load_balancer_type\")", "def get_by_name(self, name: str) -> BoundLoadBalancerType | None:\n return self._get_first_by(name=name)", "def get_type_label(type_url):\n return type...
[ "0.7697015", "0.7048308", "0.64723015", "0.6184815", "0.61697686", "0.5986609", "0.5942168", "0.5854504", "0.58489555", "0.58068526", "0.5801489", "0.57934284", "0.5766882", "0.5757444", "0.5738254", "0.5703507", "0.5632313", "0.56231433", "0.5622337", "0.5597706", "0.5592917...
0.73384243
1
Get all Load Balancer types
def get_all(self, name: str | None = None) -> list[BoundLoadBalancerType]: return self._iter_pages(self.get_list, name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_routing_types(self):\r\n svc = self.client['Network_Application_Delivery_Controller_'\r\n 'LoadBalancer_Routing_Type']\r\n return svc.getAllObjects()", "def get_hc_types(self):\r\n svc = self.client['Network_Application_Delivery_Controller_'\r\n ...
[ "0.67840147", "0.6777749", "0.67510355", "0.65186286", "0.60493803", "0.6040032", "0.5934778", "0.5848135", "0.5802933", "0.57381284", "0.57212526", "0.5698644", "0.568985", "0.5668318", "0.56618404", "0.5596496", "0.55843914", "0.55799466", "0.5430556", "0.5428883", "0.54186...
0.66892415
3
returns an integer that represents the number of days between self and other
def diff(self, other): self_copy = self.copy() other_copy = other.copy() count = 0 if self_copy.is_before(other_copy): while self_copy != other_copy: self_copy.tomorrow() count += 1 return -1 * count elif self_copy.is_after(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_between(self, other):\n new_self = self.copy()\n new_other = other.copy()\n count=0\n if self.is_before(other):\n while(True):\n if new_self == new_other:\n break\n count-=1\n new_self.advance_one()\n ...
[ "0.82386976", "0.70530134", "0.67978424", "0.6775341", "0.6709735", "0.6676344", "0.65471363", "0.6511809", "0.6486291", "0.6408992", "0.6377475", "0.6338442", "0.62765944", "0.6248925", "0.6202768", "0.6182246", "0.6177284", "0.6140237", "0.6139887", "0.6131793", "0.61233735...
0.7145879
1
This view should return a list of all students. In addition, there should be only good marks.
def list(self, request): marks = Marks.objects.all() mark_id_5 = marks.filter(name='5') mark_id_4 = marks.filter(name='4') mark_id_pass = marks.filter(name='Зачтено') records = filter_against_records(request) students = Students.objects.all() students_to_ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, request):\n\n marks = Marks.objects.all()\n\n mark_id_not_appointed = marks.filter(name='Неявка')\n\n records = filter_against_records(request)\n \n students = Students.objects.all()\n students_to_return = []\n \n for student in students:\n ...
[ "0.7704175", "0.76867867", "0.75906557", "0.7530616", "0.75230175", "0.7489456", "0.7480893", "0.7480148", "0.74564373", "0.7452671", "0.7437693", "0.736777", "0.73336023", "0.7310782", "0.7275589", "0.7222147", "0.7193991", "0.71782666", "0.7060949", "0.70577484", "0.7046231...
0.75417066
3
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, SharedConditions): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, SharedConditions): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Add word given a root node.
def add_word(root, input_word): cNode = root for char in list(input_word): does_exist_in_cNode_children = False for node in cNode.nodes: if node.char == char: does_exist_in_cNode_children = True cNode.num_words_at_letter += 1 cNode =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addWord(self, word):\n node = self.root\n for ch in word:\n node = node.children[ch]\n node.isWord = True", "def addWord(self, word: str) -> None:\n node = self.root\n \n for c in word:\n node = node.children[c]\n \n node.word ...
[ "0.83533823", "0.8351877", "0.8149061", "0.80621004", "0.8037361", "0.8030805", "0.7984513", "0.79783726", "0.7957425", "0.79151547", "0.7880366", "0.7765811", "0.7745045", "0.7738159", "0.7724717", "0.7721523", "0.77167696", "0.76098984", "0.7597129", "0.7584415", "0.7547717...
0.78166264
11
Check if word is in the Trie and return True/False.
def contains_word(root, input_word): cNode = root for char in list(input_word): found_match = False for node in cNode.nodes: if node.char == char: found_match = True cNode = node break if not found_match: print("E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_word(trie, string: str) -> bool:\n return any(w == string for w in trie)", "def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return Fa...
[ "0.78279203", "0.78150284", "0.7639355", "0.7597991", "0.7583713", "0.7550558", "0.7488371", "0.746716", "0.74369377", "0.7392812", "0.73679054", "0.7359811", "0.73518616", "0.7349344", "0.7289214", "0.7264449", "0.725595", "0.7247846", "0.7246868", "0.72430587", "0.7224231",...
0.6662107
69
Magic repr method for SSH2NetResponse class
def __repr__(self) -> str: return f"Scrape <Success: {str(not self.failed)}>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n result = \"%s (%s):\\n\" % (self.host, self.status)\n for port in self.ports:\n result += \"\\t%s %s %s %s %s\\n\" % (port[0], port[1], port[2], port[3], port[4])\n result += \"\\n\"\n return result", "def _repr_remote(self):\n return \"%s:%d\" ...
[ "0.66276807", "0.63989747", "0.6329773", "0.6314293", "0.62837774", "0.62481976", "0.62478364", "0.6216609", "0.6209437", "0.6209437", "0.6209437", "0.61855537", "0.61855537", "0.6158552", "0.6145132", "0.60990405", "0.6094247", "0.60862947", "0.6075949", "0.60723454", "0.604...
0.0
-1
Returns job end time.
def getEndTime(self): assert self.isFinished(), "Too early to tell: %s" % self return "%s" % self.__jobInfo.endTime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return...
[ "0.8111544", "0.8111544", "0.8111544", "0.8111544", "0.8111544", "0.8111544", "0.8037826", "0.80237937", "0.8018209", "0.80113596", "0.7996403", "0.78806096", "0.77789956", "0.77435184", "0.77417636", "0.7739532", "0.7675434", "0.76678777", "0.7655654", "0.7646786", "0.764678...
0.8536573
0
Returns the worker state field.
def getWorkerState(self): if self.__jobInfo.engWorkerState is not None: return json.loads(self.__jobInfo.engWorkerState) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\n return self.state", "def get_state(self):\n return self.state", "def state(self):\n\t\tif self._state in JOB_PS:\n\t\t\treturn JOB_PS[self._state]\n\t\telse:\n\t\t\treturn str(self._state)", "def get_state(self):\n return self._state", "def get_state(self):\n ...
[ "0.72628546", "0.72628546", "0.71927243", "0.7162981", "0.7162981", "0.7162981", "0.7162981", "0.7162981", "0.7157988", "0.7102734", "0.7063946", "0.7063946", "0.7063946", "0.7063946", "0.7063946", "0.7063946", "0.7063946", "0.7063946", "0.7063946", "0.7063946", "0.7063946", ...
0.8094049
0
Returns the model milestones field.
def getModelMilestones(self): if self.__jobInfo.engModelMilestones is not None: return json.loads(self.__jobInfo.engModelMilestones) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def milestones(self):\r\n return milestones.Milestones(self)", "def milestones(self):\r\n return IssueMilestones(self)", "def test_issue_get_milestones_list(self):\n pass", "def milestones(self, predicate=None):\n \n if predicate is None:\n return self._get(\"mil...
[ "0.7469835", "0.72463524", "0.66949993", "0.6528074", "0.6370817", "0.622086", "0.6164753", "0.6148986", "0.5797363", "0.5729991", "0.56449383", "0.55825627", "0.551658", "0.5498727", "0.5471341", "0.5460314", "0.53906316", "0.53802806", "0.5335208", "0.5262265", "0.5227346",...
0.7750251
0
Returns the engine status field used for progress messages
def getEngStatus(self): return self.__jobInfo.engStatus
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):\n return STATUS[self.fields['status']]", "def get_status(self):\n return self.msg", "def status(self):\n\t\treturn self._status", "def GetStatus(self):\r\n return self.status", "def _get_status(self):\n return self.__status", "def getstatus(self):\n return sel...
[ "0.734921", "0.7318182", "0.7284048", "0.72439176", "0.7236883", "0.71345514", "0.7127194", "0.7127194", "0.7127194", "0.711014", "0.70938134", "0.70938134", "0.7077344", "0.7063186", "0.7063186", "0.70607", "0.7059274", "0.7042555", "0.70139337", "0.70110583", "0.7009274", ...
0.7318947
1
Returns mode evaluation end time.
def getEndTime(self): assert self.isFinished(), "Too early to tell: %s" % self return "%s" % self.__rawInfo.endTime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return...
[ "0.6871513", "0.6871513", "0.6871513", "0.6871513", "0.6871513", "0.6871513", "0.6847472", "0.68212", "0.6789769", "0.67512214", "0.6719372", "0.65398186", "0.6523274", "0.652276", "0.652276", "0.6471463", "0.6464866", "0.6460032", "0.6425014", "0.642498", "0.6410677", "0.6...
0.65939265
11
Create an instance of UpdateEnvironmentVariableRequest from a JSON string
def from_json(cls, json_str: str) -> UpdateEnvironmentVariableRequest: return cls.from_dict(json.loads(json_str))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, obj: dict) -> UpdateEnvironmentVariableRequest:\n if obj is None:\n return None\n\n if not isinstance(obj, dict):\n return UpdateEnvironmentVariableRequest.parse_obj(obj)\n\n _obj = UpdateEnvironmentVariableRequest.parse_obj({\n \"value\": ob...
[ "0.78420097", "0.6015838", "0.58913106", "0.5780866", "0.54473996", "0.5341671", "0.5335344", "0.5240499", "0.5231903", "0.51314425", "0.5115087", "0.50613713", "0.49942768", "0.4991524", "0.49260193", "0.4918025", "0.49011448", "0.48712215", "0.48394608", "0.4784052", "0.478...
0.9128517
0
Create an instance of UpdateEnvironmentVariableRequest from a dict
def from_dict(cls, obj: dict) -> UpdateEnvironmentVariableRequest: if obj is None: return None if not isinstance(obj, dict): return UpdateEnvironmentVariableRequest.parse_obj(obj) _obj = UpdateEnvironmentVariableRequest.parse_obj({ "value": obj.get("value") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(cls, json_str: str) -> UpdateEnvironmentVariableRequest:\n return cls.from_dict(json.loads(json_str))", "def update_from_env(d: dict, variables: List[str], inplace: bool = False):\n new_keys = {}\n for var in variables:\n new_keys[var] = os.environ[var]\n\n if inplace:\n d.update(ne...
[ "0.8053762", "0.60907316", "0.56004316", "0.5599761", "0.55824286", "0.5463682", "0.5453835", "0.5403641", "0.53862965", "0.53660077", "0.52896136", "0.52467716", "0.52072847", "0.52046406", "0.5177021", "0.5173695", "0.5161458", "0.515281", "0.5150338", "0.5149689", "0.51433...
0.81470627
0
Find leftmost index that contains a value greater than x
def find_gt_index(a, x): i = bisect_right(a, x) if i < len(a): return i raise ValueError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findFirstElementGreaterThan(self, array, index):\n l, r = 0, len(array) - 1\n ans = -1;\n while (l <= r):\n mid = l + (r - l) // 2;\n # Move to right side if target is greater\n if (array[mid] <= index):\n l = mid + 1;\n # Move lef...
[ "0.71488917", "0.70495975", "0.6960628", "0.69586027", "0.69337624", "0.6920742", "0.69124764", "0.6719617", "0.6716822", "0.6703825", "0.66295373", "0.6544341", "0.65367997", "0.65367997", "0.64331937", "0.6385439", "0.63720375", "0.6357101", "0.6350155", "0.63230723", "0.63...
0.7796241
0
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!') # TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs city =input("Which city do you want? please choose a city by typing (c) for chicago or (n) for new york or (w) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): # load datafile into a dataframe df=pd.read_csv(CITY_DATA[city]) # convert the Start Time column to datetime df['Start Time'] = pd.to_datetime(df['Start Time']) # extract month and day of week from Start Time to create new columns df['month'] = df['Start Time']....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.740803
95
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # TO DO: display the most common month most_common_month=df['month'].value_counts().idxmax() print('The most common month is: {} '.format(most_common_month)) # TO DO: display the most co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.74281055
43
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station most_common_start_station= df['Start Station'].value_counts().idxmax() print('The most common start station is: {} '.format(most_common_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.7083453
68
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # TO DO: display total travel time total_travel =df['Trip Duration'].sum() print('Total travel time :',total_travel) # TO DO: display mean travel time mean_travel =df['Trip Duration'].mean() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.754587
97
Create a Match object.
async def make_match(register=False, update=False, **kwargs) -> Optional[Match]: # noinspection PyIncorrectDocstring if 'match_id' in kwargs and kwargs['match_id'] is not None: cached_match = await get_match_from_id(kwargs['match_id']) if update and cached_match is not None: cached_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMatch(self, tournament, player1, player2):\n match = Match(tournament, player1, player2)\n self.db.execute(\"INSERT INTO MATCH VALUES (%s,%s,%s,null,%s,null);\",\n (match.tournament, match.round, match.p1, match.p2,))\n return match", "def createMatch(self, _...
[ "0.7278967", "0.7267012", "0.7112327", "0.7067215", "0.7045645", "0.6722733", "0.6594269", "0.6515744", "0.6483527", "0.6274965", "0.62431604", "0.6183739", "0.6183594", "0.61627644", "0.60679156", "0.5971559", "0.59684986", "0.59127575", "0.5882531", "0.57972544", "0.5793921...
0.6591878
7
Normalises words to lowercase and stems and lemmatizes it.
def normalise(word): word = word.lower() word = lemmatizer.lemmatize(word) # word = stemmer.stem_word(word) return word
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalise(word):\n word = word.lower()\n word = stemmer.stem_word(word)\n word = lemmatizer.lemmatize(word)\n return word", "def _normalize(self, word):\n return self.lemmatize(word.lower())", "def normalise(word):\n\tword = word.lower()\n\t# word = stemmer.stem_word(word) #if we conside...
[ "0.7970904", "0.7810673", "0.751768", "0.7473084", "0.7466711", "0.72114766", "0.72114766", "0.71895856", "0.71399814", "0.7126659", "0.70802057", "0.7058855", "0.6884069", "0.6880759", "0.6839107", "0.6807959", "0.6766981", "0.6766872", "0.6756455", "0.6753187", "0.673803", ...
0.80520403
0
Validate a username Return True if username is valid, False otherwise.
def validate_username(self, username: str) -> bool: if '/' in username: # / is not allowed in usernames return False if not username: # empty usernames are not allowed return False if not self.username_regex: return True return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_is_valid(username: str) -> bool:\n pattern = re.compile(r'^[A-Za-z]+[A-Za-z0-9]*$')\n return pattern.match(username)", "def is_valid_username(self, username):\n rex = \"^[a-zA-Z]{3,}$\"\n return re.match(rex, username)", "def validate_usr(username: str) -> bool:\n if...
[ "0.8811856", "0.86236155", "0.8575717", "0.84850246", "0.8468672", "0.840418", "0.8333429", "0.83305794", "0.8314878", "0.8291812", "0.82422143", "0.82138175", "0.81280553", "0.8114554", "0.81036395", "0.8068309", "0.80683035", "0.7972643", "0.7934942", "0.7882645", "0.784881...
0.8713345
1
Input n>=6, Returns a array of primes, 2 <= p < n
def primesfrom2to(n): # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188 sieve = np.ones(n/3 + (n%6==2), dtype=np.bool) sieve[0] = False for i in xrange(int(n**0.5)/3+1): if sieve[i]: k=3*i+1|1 sieve[ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_probable_prime(n: int) -> [int]:\n return [6*n-1, 6*n+1]", "def get_primes(n):\n\n return list(primes_sieve(n))", "def prime_array(number_of_primes) -> array:\n p = array('i',list(primes(number_of_primes)))\n return p", "def make_primes(n):\n out_list = []\n for i in range(2, n):\n ...
[ "0.78810406", "0.78444964", "0.77933097", "0.7650548", "0.7626844", "0.75202084", "0.75010294", "0.7486007", "0.74678427", "0.74572444", "0.7429019", "0.74092805", "0.73962444", "0.73798555", "0.7366298", "0.7364451", "0.7356198", "0.7351732", "0.73305947", "0.7302029", "0.72...
0.7249863
26
Will show users all their friends posts
def news_feed(request): all_friends = get_all_friends(request) news_feed = get_news_feed(request) user_profile = get_users_profile(request.user.id) context = { 'news_feed': news_feed, 'user_profile': user_profile, 'status_form': StatusForm, } return render(request, 'st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed(request):\n followers = request.user.profile.followers.values_list('pk', flat=True)\n posts = Post.objects.filter(author_id__in=followers)\n\n return render(request,\n 'posts/feed.html',\n {'posts': posts})", "def posts_for_feed():\n user_id = session.get('u...
[ "0.7125192", "0.70658857", "0.7034748", "0.6823669", "0.66174895", "0.6555519", "0.6415663", "0.6290897", "0.62776536", "0.6208367", "0.61907196", "0.6180155", "0.61784595", "0.6170124", "0.61567014", "0.61384284", "0.61375713", "0.6134775", "0.6131179", "0.60234916", "0.6008...
0.5773725
45
XY normal to each point
def pathNormals(pts, smooth=1): points = np.array(pts) normDirs = np.zeros(points.shape) for idx in range(1, len(points)-1): pdir = normalize(points[idx+1] - points[idx-1]) updir = np.array([0., 0., 1.]) ndir = normalize(np.cross(pdir, updir)) normDirs[idx] = ndir normDirs[0] = normDirs[1] nor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(self,points):\n ez=np.array([[0,0,1]])\n v=((points-self.pos()*ez)*self.C-ez)\n return (v/np.linalg.norm(v,axis=1)[:,np.newaxis])#*np.sign(self.C)", "def normal(self) -> Vec:\n # The three points are in clockwise order, so compute differences\n # in the clockwise dir...
[ "0.76818764", "0.75678325", "0.7465488", "0.7200837", "0.71959573", "0.7132862", "0.70886123", "0.69784385", "0.69351876", "0.6926986", "0.6893272", "0.6862748", "0.68409956", "0.6830747", "0.67921174", "0.67429256", "0.67371815", "0.67248917", "0.6707516", "0.6693952", "0.66...
0.0
-1
Validates if input base domain url is valid or not. When base domain url is as below,
def validate_base_domain_url(base_domain_url) -> bool: url_components = urlparse(base_domain_url) return True if all([url_components.scheme, url_components.netloc]) else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_base_url(url: str) -> None:\n parse_result = urlparse(url)\n if parse_result.scheme not in ('http', 'https'):\n raise ValueError(\n f'Only HTTP[S] URLs are permitted. Actual URL: {url!r}')\n if url.endswith('/'):\n raise ValueError('Base (DICOMweb service) URL cannot...
[ "0.82622397", "0.8051212", "0.7563928", "0.73428303", "0.72552854", "0.7243861", "0.7190538", "0.6972963", "0.68810725", "0.68802017", "0.6878582", "0.68414766", "0.68033135", "0.67836744", "0.67651474", "0.6760566", "0.6737333", "0.6736706", "0.6722989", "0.67102164", "0.670...
0.8470519
0
non parametrized Maxout activation function
def maxout(x, W, b=None): if b is None: return MaxoutFunction()(x, W) else: return MaxoutFunction()(x, W, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activation(x):\n # return np.tanh(x)\n return np.maximum(0,x)", "def output_layer_activation(x):\n return x", "def activation_func(x):\r\n a = -1\r\n return 1/(1+np.exp(-a*x))", "def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))", "def activation_function(self, z...
[ "0.79006284", "0.71687245", "0.6802542", "0.6707076", "0.6648482", "0.66483694", "0.66483694", "0.6608942", "0.6579475", "0.6552926", "0.6481756", "0.6456798", "0.64282477", "0.640685", "0.6349475", "0.6294701", "0.6294621", "0.62904185", "0.62651837", "0.62651837", "0.626456...
0.6790125
3
Opens a new database connection if there is none yet for the current application context.
def get_db(): top = _app_ctx_stack.top if not hasattr(top, 'sqlite_db'): sqlite_db = sqlite3.connect(app.config['DATABASE']) sqlite_db.row_factory = sqlite3.Row top.sqlite_db = sqlite_db return top.sqlite_db
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db", "def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)", "def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec...
[ "0.7737639", "0.7582971", "0.73180443", "0.71693045", "0.70220166", "0.6966687", "0.6954785", "0.69486743", "0.6897534", "0.6842663", "0.68292314", "0.68191963", "0.680592", "0.67950195", "0.67697805", "0.6762173", "0.6751266", "0.6746273", "0.67316663", "0.670031", "0.668866...
0.66801256
23
Parses and returns the CLI arguments.
def get_args() -> Namespace: parser = ArgumentParser(description='A Minecraft RCON client.') parser.add_argument('server', help='the server to connect to') parser.add_argument( '-t', '--timeout', type=float, help='connection timeout in seconds') parser.add_argument( '-d', '--debug', act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_cli():\n parser = OptionParser()\n return parser.parse_args()", "def parse_cli():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"ENV\", help=\"Enviorment SCANNER, PC, REMOMTE\")\n args = parser.parse_args()\n\n return args", "def process_command_line_arguments() -> Nam...
[ "0.81047094", "0.7992189", "0.7911029", "0.7781474", "0.76845586", "0.7631972", "0.7598254", "0.755523", "0.75498956", "0.7540424", "0.75258577", "0.74695265", "0.7463572", "0.74630207", "0.7389721", "0.7389663", "0.73843396", "0.73570395", "0.7331802", "0.73315644", "0.73206...
0.0
-1
Constructor of Node object Takes two int values representing node's location on grid. Terrain is initially set to regular unblocked
def __init__(self, column_pos, row_pos, type='1'): self.column_pos = column_pos self.row_pos = row_pos self.terrain_type = type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, node_num, x, y, z):\r\n Node.number_of_nodes += 1\r\n self.node_num = int(node_num)\r\n self.x = float(x)\r\n self.y = float(y)\r\n self.z = float(z)\r\n self.coords = (self.x,self.y,self.z)\r\n self.ux = None # assign an empty value for now, fil...
[ "0.6802516", "0.6479612", "0.63621426", "0.6361217", "0.63526535", "0.6346478", "0.63329417", "0.62767774", "0.6255036", "0.622559", "0.6206693", "0.6195798", "0.6175756", "0.61594975", "0.61533475", "0.6138487", "0.61096054", "0.60924697", "0.607669", "0.60698164", "0.603621...
0.645317
2
Create train/test split of data.
def train_test_split_data(data, test_size=0.25): y = data['fraud'].values X = data.drop(columns=['fraud','description','name','org_desc','org_name','payee_name']).values return train_test_split(X, y, test_size=test_size, stratify=y, shuffle=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_split(raw_training_data, test_size=0.2, random_state=42)\n return train_set, test_set", "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n ...
[ "0.834073", "0.8159496", "0.80857575", "0.80185705", "0.79812026", "0.7917847", "0.785271", "0.78495353", "0.77984136", "0.77579045", "0.75940084", "0.7547821", "0.75050133", "0.75045913", "0.74999416", "0.74996966", "0.7471788", "0.74677473", "0.7464823", "0.74551773", "0.74...
0.71590966
55
r"""Saves the FluView data to a csv file.
def save_csv(self, save_path=''): if not save_path: time = datetime.now() time = datetime.strftime(time, '%Y-%m-%d_%H:%M:%S') filename = time + '.csv' save_path = os.path.join(os.path.abspath(os.curdir), filename) data = self._get_data() with open(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_csv(self, filename): # DONE\n self.data.to_csv(filename)", "def write_csv(self):\n self.tableView.df.to_csv('Data export.csv', index=False)\n print('CSV file exported')", "def _save_data(self):\n self.data.to_csv('data/c&le/{}'.format(self.name))", "def save(self, data, o...
[ "0.8161714", "0.7605331", "0.7593002", "0.75481236", "0.73539597", "0.73438215", "0.7325988", "0.7291074", "0.7286425", "0.72844994", "0.72449815", "0.7233741", "0.7223009", "0.720938", "0.71992403", "0.7101992", "0.7055687", "0.70231277", "0.7020289", "0.6999421", "0.6988875...
0.6895601
25
Set the target where the pioneer should go to. format = (speed, angle) speed in range 0 to 1 positive values are to the right angle in range 180 to 180, where +180 is backwards and 0 is forward This is the function behaviors should call when they want the robot to go to some direction.
def head_direction(self, target, useAvoidance=False, verbose=False, turnSpeed=1, door = False): endVector = target speedLeft, speedRight = self.target_to_left_right_speeds(endVector) self.logger.debug("endVector: %s" % repr(endVector)) self.logger.debug("Wheel speeds: %d, %d" % (speed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_motor_speed(self, speed=0.0):\r\n self.target_speed = speed", "def set_target(self, target, useAvoidance=False, verbose=False):\n self.logger.info(\"Deprecated function set_target called. Please call head_direction.\")\n self.head_direction(self, target, useAvoidance, verbose)", "d...
[ "0.7218563", "0.7005362", "0.68461096", "0.68447584", "0.68369645", "0.674346", "0.6703164", "0.6644767", "0.66020375", "0.65391976", "0.6483005", "0.6463844", "0.6460567", "0.6455835", "0.6381777", "0.634165", "0.63214177", "0.6290165", "0.6269597", "0.62401617", "0.6229454"...
0.6327713
16
Returns missing output path definitions. Returns List[StringInputDefinition] List of missing output path configurations that should be generated
def get_missing_output_path_definitions( self, ) -> List[StringInputDefinition]: return [ input_definition for input_definition in self.input_definitions if self.input_definition_is_a_missing_output_path(input_definition) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_missing_output_directory_definition(\n self,\n ) -> List[DirectoryInputDefinition]:\n\n return [\n input_definition\n for input_definition in self.input_definitions\n if self.input_definition_is_a_missing_output_directory(\n input_definition\...
[ "0.8126535", "0.6882914", "0.619403", "0.6131936", "0.60928166", "0.5913624", "0.58075553", "0.5790286", "0.5721315", "0.56983703", "0.5691175", "0.5664256", "0.56525165", "0.5572411", "0.5490895", "0.5422516", "0.5400101", "0.539198", "0.5360286", "0.53019834", "0.53015035",...
0.91761845
0
Projects x_adv into the l_norm ball around x Assumes x and x_adv are 4D Tensors representing batches of images
def project(x: torch.Tensor, x_adv: torch.Tensor, norm: Union[str, int], eps: float) -> torch.Tensor: if x.shape != x_adv.shape: raise ValueError('Input Tensors must have the same shape') if norm == 'inf': # Workaround as PyTorch doesn't have elementwise clip x_adv = torch.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projected_gradient_descent(self, x, y):\n x_adv = x.clone().detach().requires_grad_(True).to(x.device)\n targeted = self.y_target is not None\n num_channels = x.shape[1]\n\n if self.random:\n x_adv = random_perturbation(x_adv, self.norm, self.eps)\n\n for i in rang...
[ "0.6010313", "0.5764632", "0.57455456", "0.5686472", "0.5639733", "0.56184214", "0.5607059", "0.54946554", "0.5483953", "0.5472571", "0.54118526", "0.5399653", "0.5355483", "0.5339555", "0.5324876", "0.53185195", "0.5263014", "0.52543664", "0.52485275", "0.5239181", "0.520049...
0.5851757
1
Reconstruct complete string starting at the given leaf node. Return [string] + markers, separated by newline characters string = complete string markers = list of sequence markers, a list of indices of word positions for each sequence
def walk_results(leaf): def zip_and_line(x): return '\n'.join([''.join(y) for y in zip(*x)]) chars = [[n.newchars] + [n.mrkchars if not (n.lvl+s) % _nseqs \ else n.blkchars \ for s in xrange(_nseqs)] for n in leaf.walk()] return zip_and_line(chars)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_words(node):\n wordlist = []\n ncount = 1\n string = node.newchars\n current = node\n while current.parent:\n ncount += 1\n current = current.parent\n string += current.newchars\n if not ncount % _nseqs:\n wordlist.append(string)\n string...
[ "0.5817577", "0.57523584", "0.56255406", "0.561789", "0.55956167", "0.5458605", "0.54539764", "0.5437394", "0.54178405", "0.5409667", "0.5337532", "0.53276205", "0.52995473", "0.5289498", "0.5280274", "0.52424437", "0.52116287", "0.52086776", "0.52019626", "0.5162287", "0.512...
0.63192785
0
Yield successive nsized chunks from lst.
def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]", "def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "de...
[ "0.83071756", "0.81939614", "0.81910837", "0.81910837", "0.8190213", "0.81267184", "0.80773693", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457",...
0.81218547
6
function to write JSON objects to file.
def writeToFile(jsonList): file = open("data.json", "w") file.write(json.dumps(jsonList, sort_keys=True, indent=4, separators=(',', ': '))) print("File written")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_json(obj_to_write: Any, filename: str):\n \n with open(filename, 'w') as json_file:\n json.dump(obj_to_write, json_file, indent=4)", "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)", "def wri...
[ "0.84070903", "0.8079656", "0.80556744", "0.80358475", "0.80358475", "0.7992646", "0.7988177", "0.7950244", "0.7942161", "0.7940754", "0.7940444", "0.7928388", "0.7895177", "0.78731847", "0.7860227", "0.7851541", "0.7841824", "0.78380555", "0.7828391", "0.77942973", "0.778653...
0.7313542
68
Test for GET / (health endpoint)
def test_health(self): res = self.client().get('/') data = json.loads(res.data) self.assertEqual(res.status_code, 200) self.assertIn('health', data) self.assertEqual(data['health'], 'Running!!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_health(self):\n self.assert_request('get', '/_health')", "def test_health(self) -> None:\n self._response = self._app.get('/health')\n\n self.assertEqual(self._response.status, '200 OK')", "def test_health_endpoint(self):\n url = f\"{BASE_URL}/health\"\n response = r...
[ "0.8251945", "0.80668825", "0.80259746", "0.791631", "0.7642327", "0.7626863", "0.74548656", "0.7326561", "0.7280934", "0.7209201", "0.71579635", "0.7087214", "0.7059149", "0.70518994", "0.7038417", "0.6939561", "0.6903391", "0.6882012", "0.68737626", "0.68729866", "0.6862952...
0.73830485
7
Failing Test trying to make a call without token
def test_api_call_without_token(self): res = self.client().get('/actors') data = json.loads(res.data) self.assertEqual(res.status_code, 401) self.assertFalse(data["success"]) self.assertEqual(data["message"], "Authentication error.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_token_request_fails(hass: HomeAssistant) -> None:\n flow = config_flow.EcobeeFlowHandler()\n flow.hass = hass\n flow.hass.data[DATA_ECOBEE_CONFIG] = {}\n\n with patch(\"homeassistant.components.ecobee.config_flow.Ecobee\") as mock_ecobee:\n mock_ecobee = mock_ecobee.return_value\n...
[ "0.72698295", "0.7194623", "0.70600694", "0.6862822", "0.6857448", "0.68524134", "0.6845458", "0.6835685", "0.68316644", "0.6822409", "0.6814288", "0.6798466", "0.6767201", "0.6730683", "0.67017066", "0.6692944", "0.6692449", "0.66837025", "0.66750854", "0.6673969", "0.664081...
0.6812332
11
Passing Test for PATCH /actors/
def test_update_actor_info(self): # insert a record before updating the record res = self.client().post('/actors', headers={ 'Authorization': "Bearer {}".format(self.casting_director_token) }, json=self.VALID_NEW_ACTOR) # patch method on the actor recrod just inserted ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_actor(self): # executive can patch actors\r\n res = self.client().patch('/actors/2', json=new_actor, headers=executive_producer)\r\n data = json.loads(res.data)\r\n\r\n #self.assertEqual(res.status_code, 200)\r\n #self.assertTrue(data[\"success\"])\r\n #self.asser...
[ "0.8398941", "0.81463003", "0.7860032", "0.7607362", "0.7517165", "0.71381193", "0.71378934", "0.7120896", "0.7106048", "0.68080217", "0.67421913", "0.6513809", "0.6464629", "0.6430521", "0.64204746", "0.63613564", "0.63567466", "0.6335496", "0.6332567", "0.63321215", "0.6327...
0.7405627
5
Failing Test for PATCH /actors/
def test_422_update_actor_info(self): # insert a record before updating the record res = self.client().post('/actors', headers={ 'Authorization': "Bearer {}".format(self.casting_director_token) }, json=self.VALID_NEW_ACTOR) res = self.client().patch('/actors/1', headers={ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_actors_422(self):\n actor_id = random.choice(Actor.query.all()).id\n\n res = self.client().patch(\n '/api/actors/' +\n str(actor_id),\n json={\n 'movies': [9000]})\n self.assertEqual(res.status_code, 422)", "def test_patch_actor...
[ "0.8155448", "0.8154448", "0.7919237", "0.7873413", "0.7536734", "0.72329193", "0.70393634", "0.7033134", "0.6944088", "0.68332404", "0.67514133", "0.67509943", "0.67076075", "0.6704728", "0.6698768", "0.66561097", "0.6607798", "0.65855294", "0.6574192", "0.65741485", "0.6484...
0.75916505
4
Failing Test for DELETE /actors/
def test_delete_actor_with_casting_assistant_token(self): # insert a record before deleting the record res = self.client().post('/actors', headers={ 'Authorization': "Bearer {}".format(self.casting_director_token) }, json=self.VALID_NEW_ACTOR) # this should fail -- assistant ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_actor_404(self):\r\n res = self.client().delete('/actors/2/delete', headers=executive_producer)\r\n data = json.loads(res.data)\r\n\r\n #self.assertEqual(res.status_code, 404)\r\n #self.assertFalse(data[\"success\"])\r\n #self.assertEqual(data[\"message\"], \"reso...
[ "0.8515708", "0.84060234", "0.83009595", "0.82764095", "0.82305604", "0.7850222", "0.7192429", "0.7166413", "0.7031176", "0.69918895", "0.69705707", "0.6963958", "0.6899954", "0.6896889", "0.6893751", "0.68756676", "0.6852871", "0.68255246", "0.6825454", "0.68230754", "0.6804...
0.7465022
6
Failing Test for DELETE /actors/
def test_404_delete_actor(self): # this actor does not exist in db this should produce a 404 status code res = self.client().delete('/actors/100', headers={ 'Authorization': "Bearer {}".format(self.executive_producer_token) }) data = json.loads(res.data) self.assertE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_actor_404(self):\r\n res = self.client().delete('/actors/2/delete', headers=executive_producer)\r\n data = json.loads(res.data)\r\n\r\n #self.assertEqual(res.status_code, 404)\r\n #self.assertFalse(data[\"success\"])\r\n #self.assertEqual(data[\"message\"], \"reso...
[ "0.8515708", "0.84060234", "0.83009595", "0.82764095", "0.7850222", "0.7465022", "0.7192429", "0.7166413", "0.7031176", "0.69918895", "0.69705707", "0.6963958", "0.6899954", "0.6896889", "0.6893751", "0.68756676", "0.6852871", "0.68255246", "0.6825454", "0.68230754", "0.68040...
0.82305604
4
Passing Test for GET /movies
def test_get_movies(self): # insert a movie so there is one to be found -- need executive producer # token res = self.client().post('/movies', headers={ 'Authorization': "Bearer {}".format(self.executive_producer_token) }, json=self.VALID_NEW_MOVIE) # find all movies ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_movie_detail(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, status.HTTP_200_OK)", "def test_get_movies_404(self):\n res = self.client().get('/api/movies?page=9000')\n self.assertEqual(res.status_code, 404)", "def test_get_movie_404(se...
[ "0.75681794", "0.7447046", "0.7371268", "0.72619987", "0.7251278", "0.7162897", "0.7108152", "0.7104886", "0.7052178", "0.7010938", "0.69762075", "0.69005466", "0.68050385", "0.6666411", "0.6638633", "0.6591838", "0.6581041", "0.6564964", "0.65397155", "0.65233713", "0.652152...
0.7545144
1
Passing Test for GET /movies/
def test_get_movie_by_id(self): # insert a movie so there is one to be found -- need executive producer # token res = self.client().post('/movies', headers={ 'Authorization': "Bearer {}".format(self.executive_producer_token) }, json=self.VALID_NEW_MOVIE) # find movie ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_movie_detail(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, status.HTTP_200_OK)", "def test_get_movies(self):\n # insert a movie so there is one to be found -- need executive producer\n # token\n res = self.client().post('/movies...
[ "0.7826686", "0.76404965", "0.7579268", "0.74985737", "0.74398667", "0.74196446", "0.74160683", "0.73658085", "0.72294664", "0.72230697", "0.71414554", "0.70558065", "0.6959048", "0.6915027", "0.6823108", "0.6763487", "0.6758742", "0.6755376", "0.6583582", "0.6570524", "0.650...
0.67004037
18
Failing Test for GET /movies/
def test_404_get_movie_by_id(self): # movie with id of 100 does not exist res = self.client().get('/movies/100', headers={ 'Authorization': "Bearer {}".format(self.casting_assistant_token) }) data = json.loads(res.data) self.assertEqual(res.status_code, 404) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_movies_404(self):\n res = self.client().get('/api/movies?page=9000')\n self.assertEqual(res.status_code, 404)", "def test_get_movie_404(self):\n res = self.client().get('/api/movies/9000')\n self.assertEqual(res.status_code, 404)", "def test_get_movies_404(self):\r\n ...
[ "0.87375647", "0.8698605", "0.8510944", "0.8193842", "0.80282557", "0.768131", "0.76552606", "0.7446751", "0.7428576", "0.7427963", "0.7328333", "0.7291098", "0.72378427", "0.7211664", "0.7202105", "0.7175501", "0.7166001", "0.7133243", "0.7126452", "0.7044128", "0.6986399", ...
0.77664185
5
Failing Test for POST /movies
def test_create_movie_with_user_token(self): # this functionality requires the executive producer token res = self.client().post('/movies', headers={ 'Authorization': "Bearer {}".format(self.casting_assistant_token) }, json=self.VALID_NEW_MOVIE) data = json.loads(res.data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_movie_without_data(self):\n\n r = self.client.post(reverse('movieapi:movies'))\n self.assertJSONEqual(\n r.content,\n '{\"error\": \"Please provide a movie title\"}'\n )\n self.assertEqual(r.status_code, 400)", "def test_post_movie(self):\r\n ...
[ "0.8371155", "0.8038133", "0.80133086", "0.77943146", "0.7757783", "0.7719608", "0.7671089", "0.7578243", "0.7557744", "0.75315154", "0.75018644", "0.74732554", "0.74630344", "0.7441814", "0.7404335", "0.7402587", "0.7347975", "0.7307684", "0.7298438", "0.7255972", "0.7253126...
0.6955713
25
Passing Test for POST /movies
def test_create_movie(self): # this functionality requires the executive producer token res = self.client().post('/movies', headers={ 'Authorization': "Bearer {}".format(self.executive_producer_token) }, json=self.VALID_NEW_MOVIE) data = json.loads(res.data) self.ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_movie(self):\r\n res = self.client().post('/movies/create', json=new_movie, headers=executive_producer)\r\n data = json.loads(res.data)\r\n\r\n self.assertEqual(res.status_code, 200)\r\n self.assertTrue(data[\"success\"])\r\n self.assertTrue(data[\"new movie\"])", ...
[ "0.78790075", "0.77236646", "0.7686145", "0.75400877", "0.73486745", "0.7317212", "0.72094804", "0.7135864", "0.7076869", "0.70270675", "0.6976263", "0.69618773", "0.6898901", "0.68431604", "0.6817838", "0.67827696", "0.67598355", "0.6711431", "0.6691043", "0.66896975", "0.66...
0.75174266
4
Failing Test for POST /movies
def test_422_create_movie(self): # this test should fail becuase the record to insert is invalid res = self.client().post('/movies', headers={ 'Authorization': "Bearer {}".format(self.executive_producer_token) }, json=self.INVALID_NEW_MOVIE) data = json.loads(res.data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_movie_without_data(self):\n\n r = self.client.post(reverse('movieapi:movies'))\n self.assertJSONEqual(\n r.content,\n '{\"error\": \"Please provide a movie title\"}'\n )\n self.assertEqual(r.status_code, 400)", "def test_post_movie(self):\r\n ...
[ "0.8371155", "0.8038133", "0.80133086", "0.77943146", "0.7757783", "0.7719608", "0.7671089", "0.7578243", "0.7557744", "0.75315154", "0.75018644", "0.74732554", "0.74630344", "0.7404335", "0.7402587", "0.7347975", "0.7307684", "0.7298438", "0.7255972", "0.7253126", "0.7157058...
0.7441814
13
Passing Test for PATCH /movies/
def test_update_movie_info(self): # add movie to update -- this functionality requires the executive # producer token res = self.client().post('/movies', headers={ 'Authorization': "Bearer {}".format(self.executive_producer_token) }, json=self.VALID_NEW_MOVIE) # updat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_movie(self): # director can patch movies\r\n res = self.client().patch('/movies/2', json=partial_movie, headers=casting_director)\r\n data = json.loads(res.data)\r\n\r\n #self.assertEqual(res.status_code, 200)\r\n #self.assertTrue(data[\"success\"])\r\n #self.asse...
[ "0.8359734", "0.80181515", "0.77029324", "0.7450323", "0.7336893", "0.73261225", "0.7279741", "0.7224709", "0.71743196", "0.69120044", "0.6862464", "0.6711024", "0.6707462", "0.66505367", "0.662897", "0.65439945", "0.6515825", "0.6505924", "0.6500439", "0.64689964", "0.638920...
0.6985476
9
Failing Test for PATCH /movies/
def test_422_update_movie_info(self): # add movie to update -- this functionality requires the executive # producer token res = self.client().post('/movies', headers={ 'Authorization': "Bearer {}".format(self.executive_producer_token) }, json=self.VALID_NEW_MOVIE) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_movie(self): # director can patch movies\r\n res = self.client().patch('/movies/2', json=partial_movie, headers=casting_director)\r\n data = json.loads(res.data)\r\n\r\n #self.assertEqual(res.status_code, 200)\r\n #self.assertTrue(data[\"success\"])\r\n #self.asse...
[ "0.8307092", "0.8222295", "0.81145364", "0.8045712", "0.7875036", "0.75862557", "0.73306894", "0.728995", "0.71445", "0.7033189", "0.69510734", "0.6948936", "0.6943321", "0.69264346", "0.68925536", "0.6847339", "0.68296945", "0.6814258", "0.6812384", "0.6780035", "0.6778357",...
0.7647494
5
Failing Test for DELETE /movies/
def test_delete_movie_with_casting_director_token(self): # this should fail with 401 because the executive producer only has # this priviledge res = self.client().delete('/movies/3', headers={ 'Authorization': "Bearer {}".format(self.casting_director_token) }) data = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_movie_404(self):\r\n res = self.client().delete('/movies/1/delete', headers=executive_producer)\r\n data = json.loads(res.data)\r\n\r\n #self.assertEqual(res.status_code, 404)\r\n #self.assertFalse(data[\"success\"])\r\n #self.assertEqual(data[\"message\"], \"reso...
[ "0.8744383", "0.85685897", "0.8433189", "0.8286374", "0.81845725", "0.7867165", "0.77320486", "0.76232123", "0.7515415", "0.7421281", "0.7282693", "0.72813296", "0.7234886", "0.7215988", "0.71798795", "0.71788114", "0.7138051", "0.7128132", "0.71142435", "0.70806247", "0.7064...
0.7601411
8
Instantiate a dataset object.
def __init__(self, dirs): self.dirs = dirs self.fps = self.get_filepaths()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset(opt):\n\tdata_loader = CustomDatasetDataLoader(opt)\n\tdataset = data_loader.load_data()\n\treturn dataset", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def create_dataset(opt):\n data_loader = CustomDatasetDataLoader(opt)\n dataset = data_loader.load_data...
[ "0.7481295", "0.745104", "0.7433498", "0.73673564", "0.71029025", "0.7079965", "0.7039017", "0.6927163", "0.6920064", "0.68439627", "0.6842319", "0.68168753", "0.68091935", "0.6798143", "0.67187166", "0.6712773", "0.66911787", "0.66739595", "0.6580442", "0.6551021", "0.654483...
0.0
-1
Retrieve leaf nodes Category.objects.filter(children__isnull=True) Category.objects.filter(lft=F('rght') 1)
def items(self): categories = [] for category in Category.objects.filter(level__gt=0): categories.append(('shop:product-category', {'store': 'default', 'slug': category.slug})) return categories
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leaf_nodes(self):\n return self.nodes.filter(lft=models.F('rght') - 1)", "def get_leaf_nodes(self):\n pass", "def test_get_empty_tree_with_custom_query(self):\n query = lambda x: x.filter(self.model.get_pk_column() < 0) # noqa\n tree = self.model.get_tree(self.session, query=qu...
[ "0.73577267", "0.65503293", "0.6390857", "0.63709074", "0.62199116", "0.62062895", "0.61387396", "0.61029476", "0.6086997", "0.6078367", "0.6041393", "0.5997456", "0.5974315", "0.5941335", "0.59121615", "0.58992505", "0.58544385", "0.5803178", "0.57905704", "0.5782293", "0.57...
0.0
-1
Transfers parameters of generator, discriminator and loss to GPU memory.
def CUDA(self): if helpers.CUDA: self.generator.cuda() self.discriminator.cuda() self.adv_loss.cuda()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,args):\n self.G = Generator(args).cuda()\n self.D = Discriminator(args).cuda()\n self.gen_optim = optim.Adam(self.G.parameters(),lr=args.lrG,betas=(args.Gbeta1,args.Gbeta2))\n self.dis_optim = optim.Adam(self.D.parameters(),lr=args.lrD,betas=(args.Dbeta1,args.Dbeta2))\...
[ "0.6459089", "0.63655895", "0.6279508", "0.62752277", "0.6266197", "0.6194699", "0.6143015", "0.61315554", "0.6098562", "0.60911524", "0.6077004", "0.6046039", "0.6026579", "0.60203594", "0.6010709", "0.60060513", "0.5981729", "0.5951136", "0.59388965", "0.5922772", "0.592005...
0.0
-1