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
Insert e at the back of the list
def insert_last(self, e): self._insert_between(e, self._trailer._prev, self._trailer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertBack(self, item):\n self.sentinel.prev.insertAfter(item)\n self.N += 1", "def insert_last(self, e):\n self._insert_between(e, self._tail._prev, self._tail)", "def add_last(self, e):\n self._insert_between(e, self._tail._prev, self._tail)", "def insert_last(self, e):\n ...
[ "0.7395439", "0.730395", "0.72675246", "0.69438297", "0.6870824", "0.68047094", "0.6584443", "0.65601516", "0.6547523", "0.6522527", "0.6492767", "0.6492767", "0.6476155", "0.6457664", "0.64490837", "0.64320064", "0.6428517", "0.6394428", "0.637884", "0.6340133", "0.63122827"...
0.697394
3
Create an empty table in the DynamoDB if the table does not exist.
def create_table(table_name: str, **db_kwargs) -> str: # Check if the table exists. try: client = boto3.client("dynamodb", **db_kwargs) resp = client.describe_table(TableName=table_name) log.info("Table %s exists", table_name) return resp["Table"]["TableArn"] except Exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_table_if_not_exists(self) -> bigquery.Table:\n table = self.client.create_table(\n table=bigquery.Table(table_ref=self._table_ref, schema=Schema),\n exists_ok=True,\n )\n logging.info(\"table %s already exists.\", table.full_table_id)\n return table", ...
[ "0.78332", "0.7352531", "0.71206164", "0.70685697", "0.70066714", "0.69612384", "0.6952425", "0.69356537", "0.6883996", "0.6879083", "0.682278", "0.68166715", "0.6801798", "0.6799639", "0.6779128", "0.67211145", "0.6687819", "0.66622716", "0.66529375", "0.6627198", "0.6612539...
0.64774466
27
Check if the DynamoDB table name and ARN match the one this worker can access to.
def check_table(table_name: str, table_arn: str, **db_kwargs) -> bool: try: client = boto3.client("dynamodb", **db_kwargs) resp = client.describe_table(TableName=table_name) return table_arn == resp["Table"]["TableArn"] except Exception: # pylint:disable=broad-except return Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_access_table(self, database: \"Database\", table: \"Table\") -> bool:\n\n try:\n self.raise_for_access(database=database, table=table)\n except SupersetSecurityException:\n return False\n\n return True", "def table_check(tablename, path):\n instance = arcno(p...
[ "0.6648616", "0.664646", "0.6236491", "0.61339897", "0.6014876", "0.59953076", "0.59050703", "0.590082", "0.5884405", "0.5883849", "0.58784", "0.5847266", "0.58449024", "0.5821709", "0.58160293", "0.5789704", "0.5788584", "0.578787", "0.57801837", "0.57801837", "0.5772849", ...
0.75424033
0
Creates a node_travel_data_dataset from a report file that contains node to node data.
def get_needed_node_matrices_from_emme2(self, year, cache_directory, bank_dir, node_matrix_variable_map): logger.start_block('Getting node matricies from emme2') try: node_travel_data_set = self.get_node_travel_data_from_emme2(bank_dir, node_matrix_variable_map) finally: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_travel_dataset():\n util.make_dataset_dmoz(\n n_items=600,\n seed=0,\n category_parent='Top/Recreation/Travel',\n rawdir=os.environ['DMOZ_TRAVEL_RAW'],\n webdir=os.environ['DMOZ_TRAVEL_WEB'],\n )", "def _read_node_file(self):\n self.node_df = gt.remove_col...
[ "0.6267398", "0.607452", "0.5434764", "0.5416076", "0.5387189", "0.5334922", "0.53113014", "0.5284332", "0.52575076", "0.52191347", "0.52120376", "0.5207968", "0.51628476", "0.51583487", "0.5153315", "0.5151687", "0.51512146", "0.5121939", "0.51149356", "0.5089264", "0.508576...
0.0
-1
Convert string to lowercase and split into words (ignoring punctuation), returning list of words.
def tokenize(string): # '\w+' does not work well for codes with special chars such as '.' as part of the 'word' return re.findall(r'([-0-9a-zA-Z_:.]+)', string.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(string, lowercase=False):\r\n\timport re\r\n\twords = re.findall(\"([\\w'-+]+)\", string)\r\n\tif lowercase == True:\r\n\t\tlowerwords = []\r\n\t\tfor word in words:\r\n\t\t\tlowerwords.append(word.lower())\r\n\t\twords = lowerwords\r\n\treturn words", "def separate_words(text):\n splitter = re.c...
[ "0.8042038", "0.7974325", "0.776855", "0.7766142", "0.77363193", "0.7717386", "0.76837456", "0.76837456", "0.76465976", "0.7609536", "0.7550939", "0.75411433", "0.7528677", "0.74150276", "0.7347552", "0.73395747", "0.73383474", "0.7327019", "0.72916055", "0.7281678", "0.72636...
0.6570511
80
Iterate through given lines iterator (file object or list of lines) and return ngram frequencies. The return value is a dict mapping the length of the ngram to a collections.Counter object of ngram tuple and number of times that ngram occurred. Returned dict includes ngrams of length min_length to max_length. Use this ...
def count_ngrams(lines, min_length=1, max_length=4): def add_queue(): # Helper function to add n-grams at start of current queue to dict current = tuple(queue) for length in lengths: if len(current) >= length: # count n-grams up to length those in queue ngrams[le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_ngrams(lines, min_length=2, max_length=4):\r\n lengths = range(min_length, max_length + 1)\r\n ngrams = {length: collections.Counter() for length in lengths}\r\n queue = collections.deque(maxlen=max_length)\r\n\r\n # Helper function to add n-grams at start of current queue to dict\r\n def ...
[ "0.7766693", "0.76237303", "0.7406177", "0.69358426", "0.68730116", "0.6734156", "0.67326486", "0.6726416", "0.6669463", "0.6612568", "0.6573241", "0.65125835", "0.6494842", "0.6393322", "0.63679165", "0.6347384", "0.63325644", "0.6315713", "0.62834036", "0.6272345", "0.62684...
0.7685103
1
Test writing a worksheet with a blank cell with A1 notation.
def test_assemble_xml_file_A1(self): self.maxDiff = None fh = StringIO() worksheet = Worksheet() worksheet._set_filehandle(fh) cell_format = Format({"xf_index": 1}) # No format. Should be ignored. worksheet.write_blank("A1", None) worksheet.write_blank(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_worksheet(scope=\"class\"):\n\n return worksheet.Worksheet()", "def gen_empty_excel():\n wb = xl.Workbook()\n ws = wb.active\n return (wb, ws)", "def test_write_data(workbook):\n workbook.write_data(\"example data\")\n assert workbook.get_cell(workbook.get_last_row(), 1) == \"exampl...
[ "0.65056956", "0.6023879", "0.592566", "0.5538215", "0.541661", "0.53880835", "0.53878427", "0.53778607", "0.5357264", "0.5328206", "0.53248656", "0.5322365", "0.53071344", "0.53056407", "0.52638376", "0.52209544", "0.5220292", "0.5205103", "0.51705444", "0.51509935", "0.5115...
0.5693859
3
Apply ``pattern`` (contains no path elements) to the literal directory`` in dirname``. If pattern=='', this will filter for directories. This is a special case that happens when the user's glob expression ends with a slash (in which case we only want directories). It simpler
def resolve_pattern(self, dirname, pattern, globstar_with_root): if isinstance(pattern, six.text_type) and not isinstance(dirname, six.text_type): dirname = six.u(dirname, sys.getfilesystemencoding() or sys.getdefaultencoding()) # If no magic, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def glob1(self, dirname, pattern):\n names = self.listdir(dirname)\n if pattern[0] != '.':\n names = filter(lambda x: x[0] != '.',names)\n return fnmatch.filter(names, pattern)", "def dirname_filter ( self, dirname, _fnmatch=fnmatch.fnmatch ):\n return all (\n not _fn...
[ "0.7031971", "0.63563937", "0.63221604", "0.6114686", "0.60291314", "0.586126", "0.56175154", "0.5606534", "0.55571413", "0.55419594", "0.55189985", "0.5481502", "0.54762524", "0.54157746", "0.5388686", "0.5349208", "0.53300697", "0.5323755", "0.5303234", "0.52869177", "0.526...
0.7079843
0
Make an absolute path relative to the project's settings module, which would usually be the project directory.
def _shortpath(abspath): b = os.path.dirname(os.path.normpath(sys.modules[settings.SETTINGS_MODULE].__file__)) p = os.path.normpath(abspath) return p[len(os.path.commonprefix([b, p])):]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _abs_path(rel_path):\n return os.path.join(BASE_DIR, rel_path)", "def localdir():\n root = __file__\n if os.path.islink(root):\n root = os.path.realpath(root)\n directory = os.path.dirname(os.path.abspath(root))\n return os.path.normpath(os.path.join(directory, \"../settings/\"))", "def get_proje...
[ "0.6994914", "0.6861789", "0.68206686", "0.67363554", "0.6729323", "0.66554594", "0.65929604", "0.64809805", "0.64700395", "0.6413893", "0.6410303", "0.6409275", "0.6390963", "0.63387305", "0.63240653", "0.63193893", "0.63016665", "0.6249275", "0.62399876", "0.62395746", "0.6...
0.66545975
6
Given user_id, return the associated User object.
def user_loader(user_id): return db.session.query(User).filter(User.id.__eq__(user_id)).first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(user_id):\n\n return User.query.get(user_id)", "def get(self, user_id):\n return User.get(user_id)", "def get_user_from_id(user_id):\n return Users.query.filter_by(id=user_id).first()", "def get_user(self, user_id):\n User = get_user_model()\n try:\n ...
[ "0.8471028", "0.8392188", "0.8368705", "0.82841843", "0.8246674", "0.82437944", "0.82432073", "0.8225815", "0.8178416", "0.8177145", "0.8177145", "0.8150649", "0.8150649", "0.8150649", "0.8150649", "0.7942101", "0.79078114", "0.7870632", "0.7846108", "0.78183013", "0.77843064...
0.0
-1
Computes an initial RNN `cell` state from an embedding, `z`.
def initial_cell_state_from_embedding(cell, z, batch_size, name=None): flat_state_sizes = tf_nest.flatten(cell.state_size) return tf_nest.pack_sequence_as( cell.zero_state(batch_size=batch_size, dtype=tf.float32), tf.split( tf.layers.dense( z, sum(flat_state_sizes),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_cell_state_from_embedding(cell, z, name=None):\n flat_state_sizes = nest.flatten(cell.state_size)\n return nest.pack_sequence_as(\n cell.zero_state(batch_size=z.shape[0], dtype=tf.float32),\n tf.split(\n tf.layers.dense(\n z,\n sum(flat_state_sizes),\n ...
[ "0.7778159", "0.66782403", "0.6639687", "0.6323766", "0.62861586", "0.62827575", "0.6076215", "0.6035616", "0.58656746", "0.5842477", "0.58285147", "0.57762134", "0.5755695", "0.5748854", "0.5725769", "0.5723767", "0.5715377", "0.5713987", "0.5699344", "0.5676472", "0.565383"...
0.7557485
1
Returns `sampling_probabiliy` if `sampling schedule` given or 0.
def _get_sampling_probability(hparams, is_training): if (not hasattr(hparams, 'sampling_schedule') or not hparams.sampling_schedule): return tf.convert_to_tensor(0.0, tf.float32) if not is_training: # This is likely an eval/test job associated with a training job using # scheduled sampling. t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sampling_probability(hparams, is_training):\n if (not hasattr(hparams, 'sampling_schedule') or\n not hparams.sampling_schedule or\n (hparams.sampling_schedule == 'constant' and hparams.sampling_rate == 0)):\n return tf.constant(0.0)\n\n if not is_training:\n # This is likely an eval/test ...
[ "0.75281113", "0.6158589", "0.56475234", "0.5506362", "0.5463649", "0.53641814", "0.53346133", "0.53075045", "0.529155", "0.52847636", "0.5239813", "0.52129424", "0.5210896", "0.5206099", "0.5200316", "0.51788247", "0.51734823", "0.51506543", "0.5149258", "0.5146269", "0.5130...
0.7540726
0
Returns copy of default HParams for LSTM models.
def get_default_hparams(): hparams_map = base_model.get_default_hparams().values() hparams_map.update({ 'conditional': True, 'dec_rnn_size': [512], # Decoder RNN: number of units per layer. 'dec_rnn_attn_len': 0, # Decoder RNN: length of attention vector. 'enc_rnn_size': [256], # Encoder ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_hparams():\n\n model_hparams = hparams.ModelHparams(\n model_name='imagenet_resnet_50',\n model_init='kaiming_normal',\n batchnorm_init='uniform',\n )\n\n dataset_hparams = hparams.DatasetHparams(\n dataset_name='imagenet',\n b...
[ "0.7121815", "0.6912936", "0.6796312", "0.67651266", "0.674475", "0.6689803", "0.6478555", "0.6453718", "0.6403915", "0.6392958", "0.6240745", "0.6156832", "0.61141986", "0.60967886", "0.6072733", "0.6033046", "0.59774673", "0.59519494", "0.59111404", "0.58422005", "0.5841381...
0.7443819
0
Enable default repository config dictionary to be overridden by the command before actually creating the repository. The default implementation of this method simply returns the provided repo_config dictionary without change
def repo_config(self, repo_config, args=None): return repo_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_config(self, repo):\n with repo.config_writer() as config:\n url = ('https://' + str(self.user.username) + ':' +\n str(self.get_user_token()) + '@github.com/' +\n str(self.user.username) + '/' + self.repo + '.git')\n config.set_value('remo...
[ "0.6076892", "0.5936533", "0.5933565", "0.5812144", "0.5810799", "0.5783901", "0.57687515", "0.57294947", "0.5703187", "0.5655608", "0.5631813", "0.5623236", "0.5600907", "0.5593499", "0.5577123", "0.5569572", "0.55347794", "0.552615", "0.5501082", "0.5471231", "0.54603356", ...
0.7759282
0
Crossentropy of a list of sentences. sents the sentences.
def cross_entropy(self, sents): return (-1) * self.log_prob(sents) / len(self._count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy(predictions, targets):\n likelihood = targets * np.log(predictions)\n return -np.sum(likelihood) / predictions.shape[0]", "def condentropy(truelabels, labels):\n labels=array(labels)\n truelabels=array(truelabels)\n \n condent=0.\n for l in xrange(min(labels),max(labels)+1)...
[ "0.63199884", "0.62887913", "0.62633246", "0.6248736", "0.6227841", "0.6179794", "0.6158335", "0.6143799", "0.5968919", "0.5941275", "0.59310746", "0.59228873", "0.5916907", "0.5911883", "0.5880059", "0.5879798", "0.5852944", "0.5845872", "0.5842637", "0.58146435", "0.5803625...
0.70168126
0
Size of the vocabulary.
def V(self): return self._V
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vocabulary_size(self):\n return len(self.vocab)", "def vocabularySize(self):\n return len(self.vocab.keys())", "def vocab_size(self) -> int:\n return len(self.vocabulary)", "def vocab_size(self):\n return len(self.vocab)", "def vocab_size(self):\n return self._vocab_size"...
[ "0.9080342", "0.89961356", "0.89005476", "0.87716883", "0.86572665", "0.8534608", "0.8355767", "0.8355767", "0.8272993", "0.79105496", "0.7892161", "0.7316217", "0.72474486", "0.72464186", "0.7225754", "0.72153354", "0.72153354", "0.71253175", "0.71154606", "0.7112191", "0.70...
0.0
-1
Create thank you card formatting.
def send_thank_you(): full_name = input("Enter the donor's full name > ") donors = donor_names() if full_name == 'list': #Print the donor names and restart the function for name in donors: print(name) send_thank_you() amount = float( input(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createThankYouEmail(self):\n result = (\"\\nDear {:s},\\n\\n\"\n \"\\tThank you so much for your generous donation of ${:,.2f}!\\n\\n\"\n \"\\tIt will be put to very good use.\\n\\n\"\n \"\\t\\tSincerely,\\n\\t\\t\\t- The Team\".format(self.name, self.getTotDonation())\n...
[ "0.6714933", "0.6290228", "0.6264921", "0.6252831", "0.6112954", "0.61038285", "0.5967447", "0.5930981", "0.57657087", "0.57619464", "0.57072455", "0.566569", "0.56309235", "0.56012315", "0.5592291", "0.5558542", "0.55507916", "0.55441356", "0.5475546", "0.5471788", "0.543972...
0.0
-1
the address to show as the sender of the email notification
def fromaddr(self): return self._from
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notification_sender_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"notification_sender_email\")", "def notification_sender_email(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"notification_sender_email\")", "def notification_sender_email(self) -> Optional[pu...
[ "0.7993943", "0.7658004", "0.7658004", "0.7641934", "0.74163544", "0.7232537", "0.7122202", "0.6988078", "0.6966176", "0.6899789", "0.68558", "0.68278253", "0.68007463", "0.6710892", "0.6676652", "0.66606253", "0.66553193", "0.66553193", "0.66553193", "0.65977967", "0.6568808...
0.0
-1
return a string to use as the email subject
def format_subject(self, notice): return "PDR Notice: {0}: {1}".format(notice.type, notice.title)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSubject(self):\r\n return self.msg[\"Subject\"]", "def subject(self):\n return self.mail.get('Subject')", "def subject(self):\n subject = re.sub(RE_PATTERNS, '', self.header('Subject', ''))\n subject = re.sub(FW_PATTERNS, '', subject)\n return subject.strip()", "def subj...
[ "0.77083737", "0.7681589", "0.7613188", "0.75145787", "0.739271", "0.7290039", "0.724725", "0.7246994", "0.7246994", "0.720084", "0.71955186", "0.71942306", "0.71035635", "0.7044783", "0.68648267", "0.6846961", "0.6749709", "0.6749709", "0.66384107", "0.6637172", "0.653773", ...
0.6565567
20
The index page loads properly
def test_index_loads_properly(self): response = self.client.get('localhost:8000') self.assertEqual(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\r\n return render_template('index.html')", "def index(self):\n return render_template('main/index.html')", "def index(self):\n\t\treturn render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\n\n\treturn(render_template...
[ "0.77705723", "0.77575684", "0.7744924", "0.7708801", "0.77013177", "0.76610607", "0.7607931", "0.7594131", "0.7594131", "0.7581622", "0.75676197", "0.75526613", "0.7537449", "0.7512531", "0.74702495", "0.74588037", "0.74572843", "0.74550045", "0.74550045", "0.74303985", "0.7...
0.0
-1
The index page failed to load properly
def test_index_loads_properly(self): response = self.client.get('localhost:8000') self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(request):\r\n badRequest(\"Url not found\")", "def index(request):\n\treturn render(request, 'Toeic/index.html')", "def index(request):\r\n\treturn render(request, 'templates/index.html')", "def index(request):\n\n\treturn render(request, 'index.html', {})\n\n\t# uncomment this line vvv and comm...
[ "0.7461771", "0.7218957", "0.71420294", "0.7099429", "0.70978034", "0.7021409", "0.702045", "0.6995833", "0.69725263", "0.6972494", "0.6957281", "0.6956326", "0.69275844", "0.6927515", "0.6900663", "0.6893014", "0.68795496", "0.6849336", "0.6849336", "0.6847266", "0.6846539",...
0.7007157
7
Try to load a filter that doesn't exists. Raise KeyError
def test_missing_model(): with pytest.raises(KeyError): Instafilter("xxx")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_filter(self, *args, **kwargs):\n raise NotImplementedError", "def test_non_existing_filter(self):\n res = export_filter(fid=42)\n self.assertEqual(res.status_code, 204)", "def __getitem__(self, name):\n with self as s:\n try:\n f = s._load_filter(...
[ "0.6818634", "0.6033897", "0.5970713", "0.5970713", "0.5970713", "0.59297687", "0.58732855", "0.5816788", "0.5672889", "0.5632497", "0.56148005", "0.5531605", "0.55310416", "0.55075085", "0.5498569", "0.54910934", "0.5469215", "0.5430148", "0.54194194", "0.53625864", "0.53563...
0.58019894
8
Yields list of filepaths under the subdirectories of `directory` with extension `suffix`. For all subdirectories under `directory`, yields a list of filepaths that end with the extension `suffix` in that subdirectory.
def get_filepaths(directory, suffix='.tsv'): for dir_ in Path(directory).glob('**'): if dir_.is_dir(): yield [str(f) for f in dir_.glob('*') if f.is_file() and f.suffix == suffix]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files_with_suffix(directory, suffix, pure=False):\n files = [os.path.abspath(path) for path in glob.glob(os.path.join(directory, '**', f'*{suffix}'), recursive=True)]\n if pure:\n files = [os.path.split(file)[-1] for file in files]\n return files", "def find_all_suffix_files(directory='.', su...
[ "0.791146", "0.77924263", "0.7682826", "0.7656737", "0.7576378", "0.7419918", "0.73215914", "0.72767293", "0.7255881", "0.721375", "0.72120047", "0.7191495", "0.7191495", "0.7155071", "0.7121526", "0.7116399", "0.7089022", "0.7051373", "0.70456153", "0.70300376", "0.7021236",...
0.7954649
0
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1
Return the device state attributes.
def state_attributes(self): return self._attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\r\n return self._attributes", "def device_state_attributes(self):\n return self._attrs", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self...
[ "0.93173087", "0.9245708", "0.92207897", "0.92147964", "0.92147964", "0.9210798", "0.9210798", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", ...
0.7985119
71
r"""User friendly representation of the object.
def to_string(self): return Classifier.to_string(self).format( name=self.Name, args=self._parameters_to_string(self.__multi_layer_perceptron.get_params()), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.__dict__['_obj'])", "def __str__(self):\n return str(self.obj)", "def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())", "def __str__(self):\n return str(self.__dict__)", "def __str__(self):\n return str...
[ "0.82825255", "0.81912386", "0.810611", "0.80742675", "0.80742675", "0.80413765", "0.78911436", "0.78572714", "0.78572714", "0.78572714", "0.78572714", "0.78572714", "0.7837256", "0.7837256", "0.7837256", "0.7837256", "0.7837256", "0.78282624", "0.78249973", "0.78185266", "0....
0.0
-1
Sets the value to the given default value, assuming the original value is not set or the default value is set to forced.
def default_setter(value): return value if value and not force else default_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_value_to_default(self):\n self.setValue(self.default_value)", "def default_value(self, default_value):\n\n self._default_value = default_value", "def default_value(self, default_value):\n\n self._default_value = default_value", "def default_value(self, default_value):\n\n ...
[ "0.8311482", "0.8117231", "0.8117231", "0.8117231", "0.7998342", "0.79761994", "0.7874169", "0.77663594", "0.7662838", "0.7625267", "0.75235516", "0.7425628", "0.74054205", "0.73071146", "0.72232527", "0.71844447", "0.7148473", "0.71359485", "0.7080375", "0.70489883", "0.6974...
0.8230975
1
Remove the tird dimension (i.e. sets the zaxis to zero) and thus flattens the points cloud. This does not mean the resulting point cloud is a 2dimensional vector but a 3dimensional with the last axis full of zeros
def flatten_pcd(pcd): flattened_pcd = copy.deepcopy(pcd) points = np.asarray(flattened_pcd.points) points[:,2] = 0 flattened_pcd.points = o3d.utility.Vector3dVector(points) return flattened_pcd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unsqueeze_ft(tensor):\n return tensor.unsqueeze(0).unsqueeze(-1)", "def unsqueeze_ft(tensor):\n return tensor.unsqueeze(0).unsqueeze(-1)", "def project_points_undist(self, points3d):\n pts2d, _ = cv2.projectPoints(points3d,\n self.rvec,\n ...
[ "0.5974419", "0.5905398", "0.58096266", "0.5758149", "0.57497466", "0.57208514", "0.57054377", "0.56797755", "0.55174094", "0.5481428", "0.54809904", "0.54264086", "0.54143924", "0.5393676", "0.53870916", "0.53707606", "0.53687346", "0.53685385", "0.5294432", "0.5291387", "0....
0.5753058
4
Converts center bounding boxes to axisaligned bounding boxes.
def center_to_AABB_box3d(boxes): AABBs =[] num_det = len(boxes) for i in range(num_det): box = boxes[i:i+1] corner = np.array(center_to_corner_box3d(box[:, :3], box[:, 3:6], box[:, -1])[0].tolist()) AABBs.append(o3d.geometry.AxisAlignedBoundingBox(corner.min(axis=0), corner.max(axis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_center_form(boxes):\n x_min, y_min = boxes[:, 0], boxes[:, 1]\n x_max, y_max = boxes[:, 2], boxes[:, 3]\n center_x = (x_max + x_min) / 2.\n center_y = (y_max + y_min) / 2.\n width = x_max - x_min\n height = y_max - y_min\n return np.concatenate([center_x[:, None], center_y[:, None],\n ...
[ "0.71829236", "0.6611403", "0.65913737", "0.64677095", "0.6335142", "0.6308932", "0.61048675", "0.60351735", "0.60151947", "0.6003721", "0.6003603", "0.59982824", "0.59853464", "0.5980196", "0.5978265", "0.5936955", "0.59293836", "0.5919537", "0.5886627", "0.5835288", "0.5819...
0.6872047
1
Project a PointCloud to the given mesh using ray to triangle intersections.
def project_scan_to_mesh(tmesh, source, max_dist=2.0): # Create the rays we will shoot source_points = np.asarray(source.points) source_normals = np.asarray(source.normals) ray_directions = copy.deepcopy(source_points) ray_origins = np.zeros_like(ray_directions) # run the mesh- ray query t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trimesh_from_point_cloud(cloud):\n points = np.asarray(cloud)\n hull = scipy.spatial.ConvexHull(points)\n hull = scipy.spatial.ConvexHull(points[hull.vertices])\n ru.transforms.counterclockwise_hull(hull)\n vertices = hull.points\n faces = hull.simplices\n return vertices, faces", "def _project_pointc...
[ "0.7014846", "0.6179631", "0.6064399", "0.5948731", "0.5759748", "0.57489985", "0.5709388", "0.5602244", "0.5573145", "0.55360425", "0.55358857", "0.54908615", "0.54837096", "0.5482978", "0.5412167", "0.5399386", "0.53236836", "0.5301536", "0.5293729", "0.52767736", "0.525783...
0.63287795
1
Return a board with all squares containing value as empty.
def flush_values(board: Board, value: int) -> Board: return [ [(0 if square is value else square) for square in row] for row in board ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_board():\n return [['','',''],\n ['','',''],\n ['','','']]", "def get_empty_squares(self):\n empty = []\n for row in range(self._dim):\n for col in range(self._dim):\n if self._board[row][col] == EMPTY:\n em...
[ "0.79396045", "0.78354114", "0.74031013", "0.73303336", "0.72390467", "0.722591", "0.7149222", "0.71464354", "0.71100205", "0.7065583", "0.699321", "0.6970096", "0.69450665", "0.6931441", "0.69139856", "0.69023085", "0.6821577", "0.6783795", "0.67821646", "0.67761326", "0.675...
0.7277781
4
Blocking arrays... via split and also, a reshape [(i, j, (s + (i,j) np.mod(s, (i,j)) np.mod(s, (i,j)))) for i in range(2,5) for j in range(2,5)] b0, b1 = rows, cols Blocksize x, y = b.shape padded array b.reshape((x//b0,b0,y//b1,b1)) b.reshape((x//b0,b0,y//b1,b1)).swapaxes(1,2).reshape(1,b0,b1) m,n = a.shape out = a.re...
def num_44(): def block_array(a, rows=3, cols=4, col_first=True, nodata=-1): """ a variant on array_split requires a N*m array """ s = np.array(a.shape) w = np.array([rows, cols]) m = divmod(s, w) new_shape = w*m[0] + w*(m[1]!=0) ypad, xpad = new_shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_43():\n \n def block(a, r=3, cs=3, row_order=True):\n \"\"\"Block slice an array using a window of (rs, cs) size\n \"\"\"\n lenr = a.shape[0]//rs\n lenc = a.shape[1]//cs\n if row_order:\n iter = [(i, j) for (i, j) in np.ndindex(lenr, lenc)]\n else:...
[ "0.7044555", "0.6941713", "0.68102294", "0.67792046", "0.67261463", "0.6336276", "0.6234391", "0.60712695", "0.5970377", "0.5883539", "0.5874847", "0.58068275", "0.5793492", "0.5793492", "0.5793492", "0.5772601", "0.57716197", "0.57129985", "0.570474", "0.5699241", "0.5664132...
0.68124837
2
Retreives latest package version string for PyPI.
def get_pypi_latest_version(package_name: str, only_stable_version: bool) -> str: # # reterive package data # json_response = _retreive_package_from_pypi(package_name) version = json_response.get("info").get("version") if json_response and json_response.get("info") else None if only_stable_ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package_version():\n major, minor, micro, patch, tag, relnum = __version_info__\n\n version = '%s.%s' % (major, minor)\n\n if micro or patch:\n version += '.%s' % micro\n\n if patch:\n version += '.%s' % patch\n\n if tag != 'final':\n version += '%s%s' % (\n ...
[ "0.77451783", "0.77166265", "0.7689727", "0.7634704", "0.73521453", "0.73501754", "0.731257", "0.7281777", "0.72800255", "0.72696275", "0.7181839", "0.7172458", "0.7126039", "0.70684385", "0.6930545", "0.6885785", "0.6878882", "0.68703336", "0.6849777", "0.68248194", "0.67762...
0.7421034
4
This function takes a subreddit and returns the number of subscribers if the subreddit is invalid, the function returns 0.
def number_of_subscribers(subreddit): url = "https://www.reddit.com/r/{}/about.json".format(subreddit) headers = {'user-agent': 'request'} response = requests.get(url, headers=headers, allow_redirects=False) if str(response) != '<Response [200]>': return 0 response_json = response.json() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_subscribers(subreddit):\n import requests\n headers = {'User-Agent': 'Godfather'}\n about = requests.get(\n 'https://www.reddit.com/r/{}/about.json'.format(\n subreddit), headers=headers).json()\n try:\n subscribers = about.get('data').get('subscribers')\n ...
[ "0.87195814", "0.87137395", "0.87037545", "0.86576134", "0.8643708", "0.86220384", "0.8619205", "0.8612982", "0.86001855", "0.8577579", "0.8570017", "0.85211706", "0.8500416", "0.84798086", "0.8465369", "0.84581715", "0.8415392", "0.84138894", "0.83664346", "0.82155496", "0.7...
0.827763
19
update dst_tensor_type to be compatible with src_tensor_type when dimension mismatches
def _fuse_tensor_type(self, node, out_idx, dst_type, src_type): dst_tensor_type = ( dst_type.sequence_type.elem_type.tensor_type if is_sequence(dst_type) else dst_type.tensor_type ) src_tensor_type = ( src_type.sequence_type.elem_type.tensor_type if is_sequence(src_type) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_src_dst_tensor(self, tik_instance):\n src_element_number = functools_reduce(lambda x, y: x * y,\n self.src_shape[:])\n dst_element_number = functools_reduce(lambda x, y: x * y,\n self.dst_shape[:])\n ...
[ "0.59902555", "0.59860665", "0.59860665", "0.59122276", "0.59013706", "0.59013706", "0.5831566", "0.5784696", "0.5733108", "0.56590044", "0.53470063", "0.5313553", "0.5312576", "0.5277822", "0.5256612", "0.51745135", "0.5168023", "0.51582646", "0.5114423", "0.5109479", "0.503...
0.7733749
0
Compute sigmoid of x.
def basic_sigmoid(x): ### START CODE HERE ### (≈ 1 line of code) # math.exp(x) -> e ^ x ,e 的 x 次方 s = 1.0 / (1 + 1/ math.exp(x)) ### END CODE HERE ### return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(self, x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(self, x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\r\n\r\n return 1 / (1 + np.exp(-x))", "def sigmoid(self, x):\n ...
[ "0.90725386", "0.90725386", "0.90648764", "0.90648764", "0.9055216", "0.90471625", "0.902537", "0.9017071", "0.9017071", "0.90086645", "0.8996414", "0.8985635", "0.8978176", "0.8974883", "0.8962532", "0.8959142", "0.89552665", "0.8953469", "0.89519686", "0.8939145", "0.893833...
0.8461431
51
Compute the gradient (also called the slope or derivative) of the sigmoid function with respect to its input x. You can store the output of the sigmoid function into variables and then use it to calculate the gradient.
def sigmoid_derivative(x): ### START CODE HERE ### (≈ 2 lines of code) s = 1.0 /(1 + 1/np.exp(x)) ds = s*(1-s) ### END CODE HERE ### return ds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(cls, x):\n y = Sigmoid.apply(x)\n return np.multiply(y, 1 - y)", "def sigmoid_grad(x):\n sig = sigmoid(x)\n return np.multiply(sig, 1 - sig)", "def sigmoid_grad(self, X):\n var=self.sigmoid(X)\n return var*(1-var)", "def gradient(cls, x):\n return 1 - Tan...
[ "0.8674491", "0.82187015", "0.7996314", "0.7830284", "0.780607", "0.77875787", "0.77572584", "0.7719716", "0.77135533", "0.76934177", "0.75490737", "0.7515985", "0.7515479", "0.7500251", "0.74777097", "0.74777097", "0.74744225", "0.7400065", "0.7387052", "0.73736554", "0.7322...
0.77772516
6
Saves grad on output of layer to compute covariance.
def _save_grad_output(self, mod, grad_input, grad_output): if mod.training: self.state[mod]["gy"] = grad_output[0] * grad_output[0].size(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_gradient(self, grad=None):\n if grad is None:\n grad = backend.ones_like(self.output_value)\n x, = self.input_nodes[0].output_value\n return backend.exp(x) * grad", "def compute_gradient(self, grad=None):\n input_value = self.input_nodes[0].output_value\n\n ...
[ "0.5966475", "0.5960863", "0.5942509", "0.5858322", "0.584522", "0.5807888", "0.577789", "0.57539004", "0.57503796", "0.5716084", "0.5709692", "0.56874514", "0.56691617", "0.56539345", "0.56472534", "0.56472534", "0.5627406", "0.56250185", "0.5624605", "0.5620099", "0.5617088...
0.6770716
0
Min length of the password recovery question answer.
def question_min_length(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "question_min_length")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_min_length(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"password_min_length\")", "def password_min_length(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"password_min_length\")", "def password_min_length(self) -> Optional[pulumi.Input[int]]:\n ...
[ "0.78962994", "0.7844596", "0.7844596", "0.7536869", "0.7471526", "0.71174407", "0.69288987", "0.67248994", "0.6636504", "0.6511056", "0.64749956", "0.6470365", "0.6469098", "0.6469098", "0.6468054", "0.6467145", "0.6437118", "0.6422552", "0.6415916", "0.6410899", "0.6353203"...
0.7574994
3
Min length of the password recovery question answer.
def question_min_length(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "question_min_length")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_min_length(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"password_min_length\")", "def password_min_length(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"password_min_length\")", "def password_min_length(self) -> Optional[pulumi.Input[int]]:\n ...
[ "0.78962994", "0.7844596", "0.7844596", "0.7536869", "0.7471526", "0.71174407", "0.69288987", "0.67248994", "0.6636504", "0.6511056", "0.64749956", "0.6470365", "0.6469098", "0.6469098", "0.6468054", "0.6467145", "0.6437118", "0.6422552", "0.6415916", "0.6410899", "0.6353203"...
0.7574994
4
Min length of the password recovery question answer.
def question_min_length(self) -> pulumi.Output[Optional[int]]: return pulumi.get(self, "question_min_length")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_min_length(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"password_min_length\")", "def password_min_length(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"password_min_length\")", "def password_min_length(self) -> Optional[pulumi.Input[int]]:\n ...
[ "0.7895626", "0.78438365", "0.78438365", "0.7575124", "0.7575124", "0.7470688", "0.71162", "0.6927574", "0.67236465", "0.6635173", "0.651104", "0.64766276", "0.64715344", "0.64695877", "0.64695877", "0.6466112", "0.6465993", "0.6438414", "0.6421231", "0.64174455", "0.6410547"...
0.75370866
5
Determine which other album to show and do so
def other_album(self): test = self.ask_album.currentIndex() if test: self.parent().album = self.parent().albums[test - 1] self.parent().do_detail()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def todetail(self):\n for ix, btn in enumerate(self.go_buttons):\n if self.sender() == btn:\n self.parent().album = self.parent().albums[ix]\n break\n if not self.parent().album:\n print('waaat')\n self.parent().do_detail()", "def song_albu...
[ "0.6516697", "0.64556766", "0.6376233", "0.6306249", "0.62252784", "0.61619085", "0.6018769", "0.59754944", "0.5951971", "0.59396625", "0.5870015", "0.5858398", "0.5823198", "0.5794692", "0.5775557", "0.574518", "0.5732002", "0.5726389", "0.5712765", "0.5657524", "0.5638212",...
0.8120705
0
create a horizontal line in the GUI
def newline(parent): hbox = qtw.QHBoxLayout() frm = qtw.QFrame(parent) frm.setFrameShape(qtw.QFrame.HLine) hbox.addWidget(frm) return hbox
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _createline(self):\n return self.cv.create_line(0, 0, 0, 0, fill=\"\", width=2,\n capstyle = TK.ROUND)", "def _render_horizontal(self, gc, lx, ly, rx, ry, mx, my):\n\n with gc:\n gc.set_line_width(20)\n gc.set_stroke_color(self._get_border...
[ "0.7532128", "0.74106574", "0.73367685", "0.7310195", "0.6893052", "0.68514603", "0.6803702", "0.67848283", "0.6635092", "0.65827453", "0.6571504", "0.65017474", "0.64765716", "0.64490736", "0.64359325", "0.6388449", "0.63609403", "0.6339876", "0.63207155", "0.63199294", "0.6...
0.67197096
8
convert list to np.ndarray, and get rid of the redundant dimension
def _format_batch(self, *args): result = [np.array(item) for item in args] if len(result) == 1: return result[0] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_numpy(a: List[tvm.nd.NDArray]) -> List[np.ndarray]:\n assert a is not None, \"Empty result cannot be converted to numpy\"\n return [x.numpy() for x in a]", "def listoflistToarray(l):\n max_dim=max([len(c) for c in l])\n all_array=[np.pad(c,(0,max_dim-len(c)),\"constant\",constant_value...
[ "0.7250774", "0.716986", "0.66994196", "0.6626677", "0.6611562", "0.65863806", "0.6439985", "0.6414919", "0.6411515", "0.63630134", "0.6282977", "0.6279388", "0.6253245", "0.6252695", "0.623639", "0.6215656", "0.61880934", "0.6186437", "0.6174455", "0.60949725", "0.6084188", ...
0.0
-1
Iterator that yields a dictionary of (fieldname,value) pairs. Note that the order of field_names is important!
def nndb_recs(filename, field_names=None): if not field_names: raise ValueError("No fields specified for nndb recs") # Filter for a single field in the file def filt(f): if len(f) > 1 and f[0] == '~' and f[-1] == '~': f = f[1:-1] return f # Note the encoding - the d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for name, field in self.iterate_over_fields():\n yield name, field", "def fieldsIterator(self):\n for name, field in self.fields.items():\n renderer = self.renderers.get(name)\n if renderer:\n value = renderer(self.instance)\n else:\n value ...
[ "0.76768583", "0.749205", "0.739067", "0.70374584", "0.700193", "0.6879514", "0.68233067", "0.67776036", "0.6755737", "0.6642557", "0.6623121", "0.6534925", "0.6439505", "0.6359051", "0.6329221", "0.63033336", "0.62856555", "0.6274696", "0.62669367", "0.62669367", "0.6229252"...
0.0
-1
Helper for numeric fields we accept a string, convert it using filt, and will return an empty string if there is a ValueError converting
def num(s, filt=float): if not s: return "" try: return filt(s) except ValueError: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeFilter(_filter):\n _filter = '' if _filter == None else _filter\n\n _filter = _filter.rstrip(' ')\n _filter = '%' if _filter == '' else _filter\n _filter = _filter.replace('*','%')\n _filter = _filter.replace('?','_')\n\n return _filter", "def get_search_results(self, r...
[ "0.6061323", "0.601796", "0.59811836", "0.59455", "0.5895617", "0.58516157", "0.58300596", "0.58300596", "0.58284104", "0.5781341", "0.5774522", "0.5716071", "0.5707122", "0.569037", "0.5650388", "0.5641815", "0.56386906", "0.5624196", "0.56159747", "0.5610727", "0.55907226",...
0.7619102
0
Removes common accent characters. Our goal is to brute force login mechanisms, and I work primary with companies deploying Englighlanguage systems. From my experience, user accounts tend to be created without special accented characters. This function tries to swap those out for standard Engligh alphabet.
def remove_accents(raw_text): raw_text = re.sub(u"[àáâãäå]", 'a', raw_text) raw_text = re.sub(u"[èéêë]", 'e', raw_text) raw_text = re.sub(u"[ìíîï]", 'i', raw_text) raw_text = re.sub(u"[òóôõö]", 'o', raw_text) raw_text = re.sub(u"[ùúûü]", 'u', raw_text) raw_text = re.sub(u"[ýÿ]", 'y', raw_text) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_accented_chars(text):\n text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('utf-8', 'ignore')\n return text", "def remove_accented_chars(text):\n text = unidecode.unidecode(text)\n return text", "def _replace_accented(text: str) -> str:\n return unidecode.unid...
[ "0.77535427", "0.7742565", "0.74435186", "0.73979527", "0.72370094", "0.72368246", "0.7220512", "0.721693", "0.7189707", "0.71882826", "0.71610796", "0.7051085", "0.70348877", "0.7021435", "0.6984719", "0.6885377", "0.6850878", "0.68275577", "0.679215", "0.6745978", "0.672953...
0.74035364
3
Generate a presigned URL for an Amazon S3 object. This allows anyone who receives the presigned URL to retrieve the S3 object with an HTTP GET request. For sigv4 requests the region needs to be configured explicitly.
def presign(self, s3uri, **kwargs): return self.exec_command('presign %s' % (s3uri), **kwargs)[0].strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_presigned_url(bucket_name, bucket_key, expiration=3600, signature_version=s3_signature['v4']):\n s3_client = boto3.client('s3',\n aws_access_key_id=AWS_ACCESS_KEY_ID,\n aws_secret_access_key=AWS_SECRET_ACCESS_KEY,\n c...
[ "0.7953014", "0.79265076", "0.79053384", "0.7835346", "0.7833449", "0.78153163", "0.78124297", "0.7635567", "0.75704265", "0.7564686", "0.7528726", "0.7367153", "0.735262", "0.72680277", "0.7183056", "0.70428884", "0.70288306", "0.7011211", "0.699134", "0.6941765", "0.6743638...
0.7042733
16
Return JSON formatted data of this user's disc collection.
def show_user_collection_json(user_id): this_users_discs = session.query(Disc).filter_by(user_id=user_id).all() return jsonify(users_discs=[i.serialize for i in this_users_discs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json(self):\n return {\n '_id' : self._id,\n 'name' : self.name,\n 'description' : self.description,\n }", "def json(self):\n\n this_user_detail = dict(\n arn=self.arn,\n create_date=self.create_date,\n id=self.user_id,\n ...
[ "0.64870137", "0.63441855", "0.63308936", "0.63222295", "0.6286649", "0.6267056", "0.6250742", "0.6203766", "0.6201961", "0.61703515", "0.6149133", "0.6118483", "0.61088485", "0.60965866", "0.6076712", "0.6064045", "0.60554826", "0.60545486", "0.6051538", "0.6048292", "0.6048...
0.7279737
0
Runs pending tasks continuously on a nonblocking thread
def run_continuously(self, interval: int = 1): cease_continuous_run = threading.Event() class ScheduleThread(threading.Thread): @classmethod def run(cls): while not cease_continuous_run.is_set(): schedule.run_pending() time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_queue():\n while True:\n logging.info( 'Awaiting task ' )\n yield from asyncio.sleep( 5 )\n loop.create_task( (start_background_tasks()) )", "def _run_all_pending_events(self):\n # pending = asyncio.all_tasks(self.loop)\n # self.loop.run_until_complete(asyncio.gath...
[ "0.7055759", "0.65420634", "0.64478093", "0.64171076", "0.6366644", "0.6298646", "0.6287141", "0.6284914", "0.6270252", "0.6224393", "0.61659503", "0.61559355", "0.6088446", "0.6078359", "0.60452145", "0.6033116", "0.5989196", "0.5986055", "0.5977981", "0.59719944", "0.595873...
0.0
-1
Returns True if all CoronaCaseRaw records have the same update flag
def valid_update_flags(self) -> bool: if CoronaCaseRaw.objects.all().count() < 2: return True return not CoronaCaseRaw.objects.filter(update_flag=(not self.latest_flag())).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _can_update(self):\r\n if not self._is_persisted: return False\r\n pks = self._primary_keys.keys()\r\n return all([not self._values[k].changed for k in self._primary_keys])", "def latest_flag(self) -> bool:\n if CoronaCaseRaw.objects.all().count() == 0:\n return True\n ...
[ "0.66894835", "0.6673041", "0.66590273", "0.6592305", "0.6560511", "0.6421242", "0.6257609", "0.6138031", "0.61270374", "0.6066877", "0.59502846", "0.5928542", "0.5809718", "0.58069336", "0.58002204", "0.57952124", "0.57675093", "0.5730479", "0.571626", "0.5624509", "0.561578...
0.7360598
0
Returns True if the last update is older than the update interval
def should_update(self) -> bool: if CoronaCaseRaw.objects.all().count() == 0: return True last_updated = CoronaCaseRaw.objects.latest('date_received').date_received return timezone.now() >= last_updated + timezone.timedelta(seconds=self.interval)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def needs_update(self):\n now = time.time()/60\n return (self.last_update_time_in_minutes+self.timeout) < now", "def check_if_ok_to_update(self):\n current_time = int(time.time())\n last_refresh = self.last_refresh\n if last_refresh is None:\n last_refresh = 0\n ...
[ "0.8213379", "0.7783551", "0.76966345", "0.754631", "0.71432734", "0.7136276", "0.7052958", "0.6961989", "0.6930551", "0.69217616", "0.69099915", "0.67789745", "0.6764368", "0.6760651", "0.6737701", "0.6683879", "0.6671408", "0.66707635", "0.6663597", "0.6660849", "0.66307557...
0.7572731
3
Helper to create dict of dict lookup of bodyparts where the keys are animal names, and values are the bodypart names.
def create_body_part_dictionary( self, multi_animal_status: bool, animal_id_lst: list, animal_cnt: int, x_cols: List[str], y_cols: List[str], p_cols: Optional[List[str]] = None, colors: Optional[List[List[Tuple[int, int, int]]]] = None, ) -> Dict[str, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_animal_name_from_body_part_name(self, bp_name: str, bp_dict: dict) -> str:\n\n for animal_name, animal_bps in bp_dict.items():\n if bp_name in [x[:-2] for x in animal_bps[\"X_bps\"]]:\n return animal_name", "def find_body_part(self, body_points, segmentation_image):\n ...
[ "0.5984602", "0.5896634", "0.5682988", "0.55576694", "0.5467315", "0.52992886", "0.5201111", "0.51629925", "0.51294166", "0.50887316", "0.50546557", "0.503882", "0.50180286", "0.5008302", "0.5003173", "0.49873012", "0.49000075", "0.48616034", "0.48295596", "0.47882527", "0.47...
0.6127154
0
Helper to extract poseestimation data field names (x, y, p)
def get_body_part_names(self): self.x_cols, self.y_cols, self.p_cols = [], [], [] for bp in self.body_parts_lst: self.x_cols.append(f"{bp}_x") self.y_cols.append(f"{bp}_y") self.p_cols.append(f"{bp}_p")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields(data):\n return data['train'][data['train'].keys()[0]].attrs.keys()", "def get_parameter_names(self):\n parNames = []\n # for par in self.variables: # TODO: LIKELY A BUG! DOES THE SAME AS get_variable_names()\n for par in self.parameters: # TRYING TO SOLVE THE ISSUE\n ...
[ "0.6025627", "0.5988987", "0.59218544", "0.5856788", "0.57522917", "0.562954", "0.558819", "0.5568189", "0.5453333", "0.5448768", "0.5431835", "0.53945845", "0.5388422", "0.53556734", "0.53473955", "0.5345145", "0.5311912", "0.5311605", "0.52883357", "0.52782464", "0.5267301"...
0.56039864
6
Check if hashed password matches actual password
def verify_password(self, password): return check_password_hash(self.password_hash, password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_encrypted_password(password: str, hashed: str) -> bool:\n return pwd_context.verify(password, hashed)", "def check_hashed_password(password, hashed_password):\n\n\n return sha256_crypt.verify(password,hashed_password)", "def verify_password(self, password):\n return check_password_hash(s...
[ "0.81750333", "0.81654465", "0.81029165", "0.8091229", "0.80758476", "0.8071933", "0.8042396", "0.8026053", "0.79251105", "0.7912885", "0.79124117", "0.79056114", "0.7889633", "0.78833985", "0.7860269", "0.7850504", "0.78410155", "0.7839047", "0.7839047", "0.78045964", "0.779...
0.76697767
46
Traverses tree in preorder and verifies height of each node Returns true if every node has expect height Returns false if atleast one node is incorrect
def check_heights(root): if root: check_heights(root.left) check_heights(root.right) return root.height == get_height(root) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_height_old(self):\n successes = 0\n failures = 0\n iterations = NUM_CALLS\n\n for _ in range(iterations):\n\n handler = self.new_handler()\n ret = check_heights(handler.root)\n if ret:\n successes += 1\n else:\n ...
[ "0.6680275", "0.65864444", "0.65601474", "0.6270879", "0.62389755", "0.62281585", "0.61722094", "0.61460066", "0.61392397", "0.6065554", "0.60437363", "0.6042118", "0.6026869", "0.60099787", "0.5976662", "0.5965726", "0.593939", "0.592292", "0.5920807", "0.58926094", "0.58888...
0.70629925
0
Checks if tree is balanced or not Returns true if height balanced Returns false if height imbalanced
def check_balance(root): if root is None: # base return True lHeight = get_height(root.left) # get heights of each subtree rHeight = get_height(root.right) # allowed differences are 1, -1, 0 if ((abs(lHeight - rHeight) <= 1) and check_balance(root.left) and check_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_balanced(self):\n\n def _height(node):\n \"\"\"Calculate the height of a node\"\"\"\n\n if not node:\n return 0\n\n return 1 + max(_height(node.left), _height(node.right))\n\n def _is_balanced(node):\n \"\"\"Check if the subtree at a n...
[ "0.8425228", "0.8303599", "0.8302438", "0.8217135", "0.8031821", "0.780561", "0.7685592", "0.76572603", "0.75342387", "0.7519281", "0.748162", "0.7410565", "0.73462856", "0.730783", "0.72945046", "0.72067404", "0.7027153", "0.7022535", "0.6817595", "0.6789149", "0.6781895", ...
0.74815655
11
Prove that two Notification objects with the same property values test positive for value equality.
def test_notification_eq(self) -> None: self.assertTrue(self.notification1 == self.notification1copy) # pylint: disable=unnecessary-dunder-call self.assertTrue(self.notification1.__eq__(self.notification1copy))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_notification_ne(self) -> None:\n self.assertTrue(self.notification1 != self.notification2)\n\n # pylint: disable=unnecessary-dunder-call\n self.assertTrue(self.notification1.__ne__(self.notification2))", "def __eq__(self, other):\n if not isinstance(other, Notification):\n ...
[ "0.6988211", "0.68660295", "0.6748611", "0.6716937", "0.65949726", "0.65529287", "0.6509838", "0.650151", "0.6484305", "0.64724743", "0.6457099", "0.6448794", "0.6401077", "0.6396683", "0.6276237", "0.627536", "0.62672424", "0.6239117", "0.62343514", "0.6234087", "0.6187606",...
0.75300014
0
Prove that two Notification objects with different property values test negative for value equality.
def test_notification_ne(self) -> None: self.assertTrue(self.notification1 != self.notification2) # pylint: disable=unnecessary-dunder-call self.assertTrue(self.notification1.__ne__(self.notification2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\n if not isinstance(other, ButtonChangeNotification):\n return True\n\n return self.to_dict() != other.to_dict()", "def test_notification_eq(self) -> None:\n self.assertTrue(self.notification1 == self.notification1copy)\n\n # pylint: disable=unneces...
[ "0.6934573", "0.6677259", "0.6648972", "0.6601794", "0.6574288", "0.6523762", "0.6503337", "0.64917", "0.6483832", "0.64643085", "0.6464235", "0.64552236", "0.6451011", "0.6403636", "0.6390452", "0.63723147", "0.63492185", "0.6345239", "0.63294274", "0.6302741", "0.6297948", ...
0.7507516
0
Returns a string representation of this `User`.
def __str__(self): if self.username == None: return "User does not exist" return self.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n return '<User user_id={} email={} first_name={} last_name={}>'.format(self.user_id,\n self.email,\n self.first_name,\n ...
[ "0.807587", "0.80175275", "0.801447", "0.79293287", "0.7875355", "0.78561157", "0.78483564", "0.78414685", "0.78234303", "0.78002495", "0.78002495", "0.78002495", "0.78002495", "0.78002495", "0.7788562", "0.77748036", "0.776768", "0.7739328", "0.7732555", "0.7702289", "0.7689...
0.0
-1
get a single random Color(), with Optional search filter. search='green' will return 'seagreen', 'bluegreen', etc... default to choice() of full list
def random_color(search=None): if search: c = choice(search_color(search)) else: c = choice(THECOLORS.values()) #debug: print type(c), c # returns Color() return c #todo: exception on color search fail? OR just default to white.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color():\n return random.choice(colors)", "def random_color():\n c = colors[random.randint(0, len(colors) - 1)]\n return c[1]", "def randcolor():\r\n r = random(0.0, 1.0)\r\n g = random(0.0, 1.0)\r\n b = random(0.0, 1.0)\r\n return vec(r, g, b) # A color is a three-element...
[ "0.7828161", "0.7101347", "0.6983416", "0.68592376", "0.68395984", "0.682875", "0.6788761", "0.6756461", "0.6727346", "0.66549015", "0.65790653", "0.65230834", "0.6502881", "0.6501694", "0.64567745", "0.64503694", "0.6394078", "0.63786966", "0.6367497", "0.6328744", "0.627898...
0.8793763
0
Method returns list of tensors, each padded to the maximum sizes.
def pad_tensors_to_max(tensor_list): # Get max size of tensors. max_sizes = max([t.size() for t in tensor_list]) #print("MAX = ", max_sizes) # Number of dimensions dims = len(max_sizes) # Create the list of zeros. zero_sizes = [0] * dims # Pad list of tensors to max size. padded_te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_and_cat(tensors, padding):\n n_tensors = [len(ts) for ts in tensors]\n pad_size = max(n_tensors)\n\n # pad to has same number of operands for each problem\n tensors = [ts + (pad_size - len(ts)) * [padding]\n for ts in tensors]\n\n # tensors.size() = (batch_size, pad_size, dim_h...
[ "0.6568602", "0.65321517", "0.6462504", "0.62620044", "0.6200474", "0.61139965", "0.60738915", "0.59749", "0.59554935", "0.59504473", "0.59285945", "0.5923103", "0.59209514", "0.59153044", "0.58639157", "0.5852632", "0.5851008", "0.5824605", "0.5817472", "0.5816678", "0.57965...
0.77216774
0
This functions takes in a dictionary (in the format produces by count_ngrams) and returns a list of all ngrans with only 1 occurence. That is, this function should return a list of all ngrams with a count of 1.
def single_occurences(ngram_count_dict): occurs_once = [] for key in ngram_count_dict: if ngram_count_dict[key] == 1: occurs_once.append(key) return occurs_once
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_n_1_gram_map(self) -> Dict[str, List[str]]:\n assert self.count_map is not None, 'count map is not initialized'\n # assert self.n_grams > 1, 'n-grams must be greater than 1 in order to create n_1 gram map'\n\n res: Dict[str, List[str]] = {}\n for sequence in self.model:\n ...
[ "0.6369713", "0.63470906", "0.6224723", "0.60623735", "0.5921012", "0.5906852", "0.5892622", "0.5873671", "0.5852892", "0.58415467", "0.58371246", "0.5830862", "0.58222735", "0.5820353", "0.58199775", "0.58168", "0.5812914", "0.5811192", "0.57994276", "0.5795974", "0.5786719"...
0.7746788
0
Retorna o maximo da arvore.
def maximo(self, no): if no is not None: while no.getDireito() is not None: no = no.getDireito() return no
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max(self):\n return self.max[-1]", "def max(self):\n return self.get_first()", "def _get_maximum(self):\n return self._maximum", "def max(self):\n return max(self)", "def get_max(self):\n return self._max", "def max(self):\n return self.__max", "def get...
[ "0.7582067", "0.74340934", "0.73207396", "0.7315176", "0.73005927", "0.72842276", "0.72722745", "0.72563034", "0.72509384", "0.7247525", "0.7237018", "0.7237018", "0.71889913", "0.7042969", "0.7042969", "0.7023191", "0.7015256", "0.7014414", "0.7003582", "0.69608223", "0.6926...
0.6564374
48
Calculates the recall score for the given predictions and targets
def get_recall(indices, targets, batch_wise=False): targets = targets.view(-1, 1).expand_as(indices) # (Bxk) hits = (targets == indices).nonzero() if batch_wise: return ((targets == indices) * 1.0).sum(dim=-1).view(-1, 1) else: if len(hits) == 0: return 0 recall = (targets == in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred):\n tp = true_positive(y_true, y_pred)\n fn = false_negative(y_true, y_pred)\n recall = tp / (tp + fn)\n return recall", "def recall_score(y_true, y_pred):\n return ((y_true == 1) * (y_pred == 1)).sum() / (y_true == 1).sum()", "def calculate_recall(targets, preds):\n ...
[ "0.7847959", "0.782655", "0.7775863", "0.7767832", "0.7674932", "0.7657287", "0.76307416", "0.76001775", "0.7585204", "0.7585204", "0.7585204", "0.7585204", "0.7585204", "0.7585204", "0.7576374", "0.7573859", "0.75712955", "0.75712955", "0.75712955", "0.75712955", "0.75712955...
0.0
-1
Compares experiment_protocol with a sample's existing_protocols and updates the latter if the former includes any new entry. Returns a twoelement tuple, the first is existing_protocols (which may or may not have been updated) and the second is a bool indicating whether exisiting_protocols has been updated. Note that th...
def update_sample_protocol_info(existing_protocols, experiment_protocol, protocol_url): if not "protocol" in experiment_protocol: return (existing_protocols, False) is_updated = False # Compare each entry in experiment protocol with the existing # protocols; if the entry is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_protocols_updated(self):\n assert self.skill_config.protocols == {self.new_protocol_id}", "def test_protocols_updated(self):\n assert self.connection_config.protocols == {self.new_protocol_id}", "def test_protocols_updated(self):\n assert self.agent_config.protocols == {self.new_p...
[ "0.68441445", "0.662825", "0.654732", "0.63229084", "0.59339184", "0.5549929", "0.5232425", "0.49213052", "0.48436552", "0.47408885", "0.4596059", "0.45489705", "0.45324323", "0.45182005", "0.45156923", "0.45120403", "0.44836906", "0.44828472", "0.44730458", "0.44484085", "0....
0.8691778
0
Checks if we raise for invalid file
def test_cannot_load_invalid_file(self): with self.assertRaises(urllib.error.URLError): _ = xmlschema.XMLSchema('does-not-exist.xsd')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_valid_file(self, file):\n\n try:\n _ = open(f\"{file}\")\n except FileNotFoundError:\n raise ValueError", "def test_valid_file_raises():\n with pytest.raises(ValueError):\n cli._valid_file(__file__)", "def test_invalidFile(self):\n self.as...
[ "0.7723395", "0.771441", "0.7641303", "0.7419019", "0.72511405", "0.72382116", "0.72248256", "0.7204487", "0.71709114", "0.7066717", "0.6948508", "0.6927076", "0.6906801", "0.69052106", "0.68919927", "0.6847416", "0.68408287", "0.6816975", "0.6795222", "0.67581224", "0.675617...
0.64506507
67
Returns an iterable of all existing values.
def get_existing_values(self): #DONE return (value.value for value in self.address.values() if value.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_values(self):\n values = self.values\n if (values is not None):\n yield from values", "def itervalues(self):\n return iter(kvp.value for kvp in self.keyvaluepair_set.all())", "def values(self):\n\t\treturn iter(self.data)", "def itervalues(self):\n for key in s...
[ "0.7680097", "0.7456033", "0.7353448", "0.7230936", "0.72280574", "0.7195895", "0.718528", "0.718528", "0.70745444", "0.70325255", "0.7031438", "0.7030463", "0.6954274", "0.69410163", "0.6929653", "0.6907549", "0.6886268", "0.68512386", "0.68274033", "0.6805858", "0.6783038",...
0.6399886
71
Copy, optionally modifying default value and metadata. Clones the contents of this object into a new instance of the same class, and then modifies the cloned copy using the specified ``default_value`` and ``metadata``. Returns the cloned object as the result. Note that subclasses can change the signature of this method...
def clone(self, default_value=NoDefaultSpecified, **metadata): if "parent" not in metadata: metadata["parent"] = self new = self.__class__.__new__(self.__class__) new_dict = new.__dict__ new_dict.update(self.__dict__) if "editor" in new_dict: del new_dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self, default_value=Missing, **metadata):\n if \"parent\" not in metadata:\n metadata[\"parent\"] = self\n\n new = self.__class__.__new__(self.__class__)\n new_dict = new.__dict__\n new_dict.update(self.__dict__)\n\n if \"editor\" in new_dict:\n de...
[ "0.774457", "0.68166023", "0.6498648", "0.63609046", "0.63004106", "0.6077415", "0.607255", "0.60448724", "0.6036745", "0.6031173", "0.60226095", "0.59748334", "0.5968414", "0.5945458", "0.59096646", "0.5887997", "0.58826303", "0.5873086", "0.5872704", "0.5830916", "0.5812570...
0.780865
0
Renders the about page.
def about(): return render_template( 'about.html', title='About', year=datetime.now().year, message='Your application description page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82680845", "0.8243358", "0.8239194", "0.8224137", "0.82079816", "0.8204868", "0.8173699", "0.8172736", "0.80967313", "0.80501616", "0.80501616", "0.80501616", "0.80501616", "0.80501616", "0....
0.82709616
14
Renders the about page.
def data(): return render_template( 'data.html', title='Data', year=datetime.now().year, message='Your application description page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845",...
0.0
-1
Determines if an int x is a prime number or not.
def return_prime(x): for m in range(x+1): if m!=0 and x%m==0 and m!=1 and x!=m: return 'not prime' return 'prime'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(x: int) -> bool:\n if x < 2:\n return False\n if x != 2 and x % 2 == 0:\n return False\n for i in range(3, x // 2 + 1):\n if x % i == 0:\n return False\n return True", "def is_prime(x):\n if x < 2:\n return False\n for i in range(2, x // 2 + 1...
[ "0.8480145", "0.8293388", "0.8290251", "0.82423574", "0.8180706", "0.8097356", "0.80540764", "0.78323036", "0.7805404", "0.7762871", "0.76003283", "0.75857645", "0.7568783", "0.7463921", "0.7440969", "0.7424653", "0.7423773", "0.74233747", "0.7395108", "0.7384322", "0.7377971...
0.75968647
11
Determines if an int x is a prime number or not.
def recursive_prime(x): for m in range(x+1): if m!=0 and x%m==0 and m!=1 and x!=m: return 'not prime' return 'prime'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(x: int) -> bool:\n if x < 2:\n return False\n if x != 2 and x % 2 == 0:\n return False\n for i in range(3, x // 2 + 1):\n if x % i == 0:\n return False\n return True", "def is_prime(x):\n if x < 2:\n return False\n for i in range(2, x // 2 + 1...
[ "0.8480729", "0.82941467", "0.8290313", "0.8243459", "0.81811863", "0.80978733", "0.8054325", "0.7832635", "0.7806493", "0.7763111", "0.76008236", "0.7597179", "0.7587864", "0.757078", "0.7465418", "0.7442046", "0.7425363", "0.7424314", "0.7424235", "0.73969686", "0.7385942",...
0.7138134
44
This method saves annotation into a csvfile in the same directory
def save_annotation(self): if self.mediaPlayer.state() == QMediaPlayer.PlayingState: self.play_video() # Pause the video if it is playing. if self.filename != None and self.videoOpened: with open(self.filename.replace(".mp4",".csv"), "w", newline="\n") as file: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file_ann(self) -> None:\n with open(self.output_file_path, mode='w', newline='') as csv_file:\n tweet = ['id', 'created_time', 'text']\n writer = csv.DictWriter(csv_file, fieldnames=tweet)\n writer.writeheader()\n for tweet in self.unique_tweets:\n ...
[ "0.6945995", "0.6937179", "0.68908644", "0.6860856", "0.65973026", "0.65519875", "0.65171546", "0.6457847", "0.6428661", "0.6413525", "0.6413456", "0.6391844", "0.63836735", "0.63752145", "0.6344004", "0.6326677", "0.63209873", "0.6318571", "0.6298519", "0.62709415", "0.62699...
0.6813499
4
Format a number as friendly text, using common suffixes.
def friendly_number(number, base=1000, decimals=0, suffix='', powers=['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']): from math import log, pow extend = pow(10, decimals) power_index = int(log(number * extend, base)) power = powers[power_index] if decimals: cut_off_length = base * power_index - decimals str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _num2str(self, num):\n q, mod = divmod(num, 10)\n suffix = \"th\" if q == 1 else self.SUFFIX_DICT[mod]\n return f\"{num}{suffix}\"", "def format_number(number):\r\n if number >= 1000 and number % 1000 == 0:\r\n return \"%dk\" % (number/1000)\r\n else:\r\n return str(n...
[ "0.73528206", "0.69220096", "0.6893715", "0.6804232", "0.6795552", "0.6726488", "0.67208004", "0.66632074", "0.66446525", "0.65580165", "0.6546304", "0.6543475", "0.6506433", "0.6493464", "0.6483691", "0.64778715", "0.6362081", "0.6361462", "0.63492554", "0.6343249", "0.63406...
0.6698062
7
Forward computation of GP.
def forward(self, x): mean_x = self.mean_module(x) covar_x = self.covar_module(x) return gpytorch.distributions.MultivariateNormal(mean_x, covar_x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self):\n self.img_gen, self.loss_reg, self.parsav = self.net_G(self.input_P1, self.input_P2, self.input_BP1, self.input_BP2, self.input_SPL1, self.input_SPL2)", "def get_next_gp(self):\n # Put model and likelihood into eval mode.\n self.gpf_core.eval()\n self.likelihood.ev...
[ "0.6641747", "0.6309967", "0.63030976", "0.622077", "0.61742026", "0.6147103", "0.6127859", "0.61094767", "0.6096206", "0.6092889", "0.60687995", "0.6052195", "0.60382044", "0.60378325", "0.6030578", "0.60295", "0.6021014", "0.6021014", "0.6018379", "0.60169804", "0.6001252",...
0.0
-1
Returns JSON for all categories
def showCategoriesJSON(): session = DBSession() categories = session.query(Category).all() return jsonify(Categories=[c.serialize for c in categories])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_categories():\n return jsonify({\n \"success\": True,\n \"categories\": _read_all_categories()\n })", "def all_categories_handler():\n categories = getAllCategories()\n return jsonify(categories=[i.serialize for i in categories])", "def get_categories():\n ...
[ "0.883001", "0.87606895", "0.8601942", "0.84640163", "0.84018344", "0.8397013", "0.8302538", "0.8235731", "0.81908923", "0.8152214", "0.8121078", "0.80614334", "0.8042234", "0.7812972", "0.7791831", "0.77038896", "0.7676202", "0.7607384", "0.7600428", "0.75892025", "0.7482158...
0.82008773
8
Shows JSON for all items in a category
def showCategoryItemsJSON(category_id): session = DBSession() items = session.query(Item).filter_by(category_id=category_id) return jsonify(Items=[i.serialize for i in items])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_category_json(category):\n category = (session.query(Categories)\n .filter_by(name=category.replace('-', ' '))\n .one())\n category_items = (session.query(Items)\n .filter_by(category_id=category.id)\n .order_by(Items.name)\n ...
[ "0.83080703", "0.81895965", "0.77496374", "0.76800567", "0.76319146", "0.7613438", "0.75003475", "0.7458236", "0.7440922", "0.7435839", "0.74264675", "0.74047023", "0.73924065", "0.7299701", "0.72801924", "0.7247489", "0.7237604", "0.7204417", "0.71837586", "0.71017206", "0.7...
0.81000423
2
Edit an existing category
def editCategory(category_id): if 'username' not in login_session: return redirect(url_for('showLogin')) session = DBSession() editedCategory = session.query(Category).filter_by(id=category_id).one() if editedCategory.user_id != login_session['user_id']: return "<script>function my...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def editCategory(category_id):\n editedCategory = session.query(Category). \\\n filter_by(id=category_id).one()\n if editedCategory.user_id != login_session['user_id']:\n flash('You are not authorized to edit this Category.\\\n Please create your own Category in order to edit.')\n ...
[ "0.77615225", "0.75865394", "0.7484915", "0.7453175", "0.73973197", "0.7290662", "0.7286859", "0.7284251", "0.72604495", "0.72559184", "0.7247768", "0.71632946", "0.7159087", "0.70904016", "0.7089819", "0.6985697", "0.6944363", "0.6929335", "0.6913795", "0.67967993", "0.67933...
0.6911405
19
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): e = self.experience(state, action, reward, next_state, done) self.memory.append(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71451885", "0.7106998", "0.7101183", "0.69837016", "0.68905056", "0.68842727", "0.6755663", "0.6712557", "0.6677425", "0.64961654", "0.6488678", "0.6486...
0.71984994
14
Return the current size of internal memory.
def __len__(self): return len(self.memory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self) -> int:\n return len(self.mem)", "def getSize(self):\n return self.bf.memory()", "def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024", "def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ...
[ "0.8573752", "0.82169205", "0.8200361", "0.8087402", "0.8021614", "0.7890747", "0.78219426", "0.78017354", "0.77905464", "0.7758844", "0.77559924", "0.77559924", "0.775519", "0.77544576", "0.7733221", "0.7732168", "0.7720068", "0.77145016", "0.77092093", "0.77077913", "0.7697...
0.75127405
51
A utility function for TensorFlow that maps a grayscale image to a matplotlib colormap for use with TensorBoard image summaries. By default it will normalize the input value to the range 0..1 before mapping to a grayscale colormap.
def colorize(value, vmin=None, vmax=None, cmap=None): # normalize vmin = tf.reduce_min(value) if vmin is None else vmin vmax = tf.reduce_max(value) if vmax is None else vmax value = (value - vmin) / (vmax - vmin) # vmin..vmax # squeeze last dim if it exists value = tf.squeeze(value) # qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_custom_colormap(image_gray, cmap=plt.get_cmap(\"seismic\")):\n\n assert image_gray.dtype == np.uint8, \"must be np.uint8 image\"\n if image_gray.ndim == 3:\n image_gray = image_gray.squeeze(-1)\n\n # Initialize the matplotlib color map\n sm = plt.cm.ScalarMappable(cmap=cmap)\n\n # O...
[ "0.7350804", "0.7083321", "0.6716462", "0.64663", "0.63197374", "0.62252384", "0.61969936", "0.61429065", "0.613792", "0.6119485", "0.6119485", "0.61130005", "0.6089074", "0.608681", "0.60644525", "0.6055049", "0.6055049", "0.6030544", "0.5985494", "0.59728986", "0.5951735", ...
0.66580176
3
This function prints and plots the confusion matrix.
def plot_confusion_matrix(y_val, y_val_pred, normalize=True, show_absolute_values_additionally=True, title=None, cmap=plt.cm.Blues, ax=None): if show_absolute_values_additionally: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def showConfusionMatrix(self): \r\n sn.heatmap(self.conf_matrix, annot=True)\r\n plt.plot( label=\"Accuracy\")\r\n plt.plot( label=\"Error\"...
[ "0.80894613", "0.80770946", "0.79976976", "0.7946727", "0.7921785", "0.78448296", "0.7833224", "0.7781221", "0.7775631", "0.77574563", "0.77061635", "0.77016985", "0.7692213", "0.76785815", "0.76588994", "0.7641414", "0.7622791", "0.7611233", "0.7610989", "0.7598244", "0.7587...
0.0
-1
Create and initialize a Food instance at a random location.
def __init__(self): self.size = 16 self.color = COLOR self.pos = self.spawn()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_food(self):\n self.penup()\n self.shape(\"circle\")\n self.color(\"green\")\n self.x_cordinates = random.randint(-210, 210)\n self.y_cordinates = random.randint(-210, 210)\n self.goto(self.x_cordinates, self.y_cordinates)\n print(f\"This Is Food {self.x_c...
[ "0.7258518", "0.72439694", "0.7177458", "0.6774872", "0.65232736", "0.6334905", "0.63251776", "0.6026828", "0.60096884", "0.59833336", "0.59739894", "0.59222424", "0.58326286", "0.58295906", "0.5782747", "0.57608205", "0.57145053", "0.5702807", "0.56994814", "0.56994814", "0....
0.0
-1
Checks if the snake has collided with food.
def collides(snake_object, food_object): snake_corners = snake_object.get_corners() (food_x, food_y) = food_object.pos for coord in snake_corners: if food_x <= coord[0] <= food_x + food_object.size and \ food_y <= coord[1] <= food_y + food_object.size: return True return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def death_test(snake, board):\r\n if snake.snake[-1][0] >= len(board.board[0]) or snake.snake[-1][1] >= len(board.board) or snake.snake[-1][0] < 0 or snake.snake[-1][1] < 0: \r\n return True\r\n else:\r\n for i in snake.snake[:-1]:\r\n if i[:-1] == snake.snake[-1][:-1]: ...
[ "0.673648", "0.665959", "0.655808", "0.64771265", "0.64431435", "0.6432231", "0.6321876", "0.6310432", "0.622189", "0.62033993", "0.6196929", "0.6122961", "0.61153966", "0.6104553", "0.61036026", "0.6100859", "0.60873884", "0.6083682", "0.6077472", "0.60522324", "0.6039057", ...
0.7127346
0
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your access level for that URL.\n' 'You have to login with proper credentials', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.776624", "0.7754693", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.771945", "0.7667712", "0.7664151", "0.76493174", "0.76140213", "0.76131...
0.7810746
21
return the minimum node in the current tree and its parent
def _findMin(root, parent): # we use an ugly trick: the parent node is passed in as an argument # so that eventually when the leftmost child is reached, the # call can return both the parent to the successor and the successor if root.left: return _findMin(root.left, root) else: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findMin(self):\n curr = self\n while curr.hasLeftChild():\n curr = curr.leftChild\n return curr", "def min(self) -> \"Node\":\n current = self\n while current.left is not None:\n current = current.left\n return current", "def find_min(self) ->...
[ "0.8434743", "0.8419657", "0.8370293", "0.8337083", "0.8336324", "0.81882983", "0.8024447", "0.7963267", "0.7945418", "0.7922297", "0.78959215", "0.7886263", "0.78434896", "0.7841628", "0.780715", "0.7804364", "0.7801873", "0.78014004", "0.7779413", "0.77767795", "0.7775762",...
0.7795441
18
Sets the weights of the network.
def set_weights(self, weights): self.model.set_weights(weights)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_weights(self, weights):\r\n self.weights = weights", "def set_weights(self, weights):\n self._weights = weights\n self.normalize_weights() ########################added\n #self.get_weights()", "def setWeights(self, w):\n raise NotImplementedError", "def set_weight...
[ "0.8667217", "0.83887863", "0.83845794", "0.8323693", "0.8274516", "0.8186342", "0.81543875", "0.8146573", "0.8072383", "0.7974805", "0.7818139", "0.77234143", "0.76913023", "0.76769984", "0.7662948", "0.7629317", "0.7611106", "0.750819", "0.74728924", "0.7452836", "0.7426908...
0.8471266
1
Returns the last known robot state.
def state(self): return self._state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_state(self):\n return self._simstate", "def getState(self):\n return tuple([robot.getState() for robot in self.states.robots])", "def get_current_state(self):\n return self.nextYs[-1]", "def _get_state(self):\n start = self.design.first_unassigned_site\n return sel...
[ "0.77621424", "0.6890938", "0.67844445", "0.67405826", "0.6702575", "0.6570389", "0.6570389", "0.6567205", "0.6562156", "0.6549177", "0.6381263", "0.63676935", "0.6361479", "0.6324109", "0.631558", "0.6298601", "0.628945", "0.627949", "0.6241313", "0.6239475", "0.6225606", ...
0.0
-1
The function that calculates the area of the circle.
def calculate_area(radius): area = math.pi * radius ** 2 print("Area of a circle with a radius of", radius, "is", format(area, ".3f"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n\t\t#print (self.radius*self.radius*math.pi)\n\t\tcircle_area = (self.radius*self.radius*math.pi)\n\t\treturn circle_area", "def circle_area(circle):\n return pi * circle.radius * circle.radius", "def area_of_circle(radius):\n return radius", "def area(self):\n return self.radiu...
[ "0.8587596", "0.848864", "0.8409465", "0.8229764", "0.81595844", "0.81477517", "0.81477517", "0.81258476", "0.8081637", "0.80605143", "0.8060146", "0.8006663", "0.79962665", "0.79309183", "0.7910182", "0.79089034", "0.79089034", "0.7886087", "0.78828156", "0.7881819", "0.7879...
0.75572926
31
Test posting question with a meetup that does not exist
def test_post_with_invalid_meetup(self): self.is_authenticated() response = self.post_with_invalid_meetup() self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ask_question_non_existent_meetup(self):\n access_token = self.get_access_token(USER_REGISTRATION, USER_LOGIN)\n res = self.client().post(\n '/api/v2/meetups/3/questions',\n headers=self.get_authentication_headers(access_token),\n data=json.dumps(QUESTION)\n ...
[ "0.79283535", "0.78844965", "0.7780807", "0.74110353", "0.70628846", "0.6910175", "0.68341684", "0.6688663", "0.65296674", "0.64422226", "0.6441639", "0.6358516", "0.6309955", "0.63084716", "0.630011", "0.6247281", "0.6233546", "0.618738", "0.6132114", "0.61253196", "0.611113...
0.70985174
4
Apply nametoSMILES followed by SMILEStoname in order to get the most common synonym.
def get_synonym(name: str) -> str: return s2n.get_name(n2s.get_smiles(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_similarity(name_1, name_2, nickname_2=None):\n name_similarity = string_similarity(name_1, name_2)\n nickname_similarity = 0\n if nickname_2:\n nickname_similarity = string_similarity(name_1, nickname_2)\n return max(name_similarity, nickname_similarity)", "def _canonicalize(smi):\n ...
[ "0.5567552", "0.54505587", "0.5430771", "0.5407319", "0.5357292", "0.52925265", "0.52693975", "0.5251148", "0.52120805", "0.5211241", "0.5204867", "0.5151238", "0.5089193", "0.5075725", "0.50606203", "0.5030442", "0.50104207", "0.5007268", "0.4992866", "0.49832612", "0.490626...
0.57638913
0
Given the method, returns the sparsity of individual layers as a dict. It ensures that the noncustom layers have a total parameter count as the one with uniform sparsities. In other words for the layers which are not in the custom_sparsity_map the following equation should be satisfied. eps (p_1 N_1 + p_2 N_2) = (1 def...
def googleAI_ERK(module, density, erk_power_scale: float = 1.0): # Obtain masks masks = {} total_params = 0 for e, (name, weight) in enumerate(module.named_parameters()): # Exclude first layer if e == 0: continue # Exclude bias if "bias" in name: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calc_layer_sparsity():\n test_ndarray = np.array([[0, 2, 0], [1, 0, 1]])\n assert lu.calc_layer_sparsity(test_ndarray) == 3 / 6, 'correct sparsity value'\n\n test_ndarray = np.array([[0, 0, 0], [1, 0, 1]])\n assert abs(lu.calc_layer_sparsity(test_ndarray) - 4 / 6) < 10**-8, 'correct sparsity v...
[ "0.6673358", "0.64702046", "0.61595726", "0.59427774", "0.59129184", "0.5850378", "0.5764688", "0.5719997", "0.5428686", "0.5256658", "0.5217889", "0.5098781", "0.5084118", "0.50652313", "0.5055327", "0.49596298", "0.49549872", "0.49484617", "0.49153554", "0.49078938", "0.490...
0.5546462
8
Returns True if there are no elements in the queue. Otherwise it returns False.
def is_empty(self) -> bool: bool = self.da.is_empty() return bool
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isEmpty(self):\r\n if (len(self.queue) >= 1):\r\n return False\r\n else:\r\n return True", "def is_empty(self):\n return self.queue == []", "def empty(self):\r\n return self.queue == []", "def is_empty(self):\n return len(self.the_queue) == 0", "...
[ "0.87986565", "0.8726819", "0.8704334", "0.86796826", "0.8668438", "0.8637949", "0.86193", "0.861574", "0.861574", "0.8607098", "0.86000097", "0.85499406", "0.85468006", "0.85262203", "0.8524336", "0.8516299", "0.8516299", "0.84909976", "0.84512603", "0.83862245", "0.8368072"...
0.0
-1
Returns the number of elements currently in the queue.
def size(self) -> int: size = self.da.length() return size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\r\n return len(self.queue)", "def size(self):\r\n return len(self.queue)", "def size(self):\n return len(self.__queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(self.que...
[ "0.8237019", "0.8237019", "0.82012993", "0.81914973", "0.81914973", "0.81914973", "0.81914973", "0.81080407", "0.809926", "0.8027969", "0.7825087", "0.7792135", "0.77872556", "0.76787645", "0.76511407", "0.7644449", "0.75612724", "0.7561232", "0.7561232", "0.7537529", "0.7491...
0.0
-1
The name of the ticket has to be alphanumericonly, and space allowed only if its nit the first or last character R4.1
def test_sell_ticket_name_alnum(self, *_): #logout to invalidate any logged in session self.open(base_url + '/logout') #login a user self.open(base_url + '/login') # fill email and password self.type("#email", "test_frontend@test.com") self.type("#password", "Test...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_ticket_str_prefix(self):\n str = ProxyGrantingTicket.objects.create_ticket_str(prefix='PGTIOU')\n self.assertTrue(re.search('^PGTIOU-[0-9]{10,}-[a-zA-Z0-9]{32}$', str))", "def clean_name(self):\n name = self.cleaned_data['name']\n if not re.match(r'[\\w{4}\\s*]+', name...
[ "0.6576218", "0.64795166", "0.63711756", "0.63362515", "0.63227195", "0.6286395", "0.6153223", "0.6123057", "0.60411745", "0.5988169", "0.59772235", "0.59566253", "0.5947071", "0.5926102", "0.59047323", "0.5888616", "0.58557814", "0.5835133", "0.58285314", "0.58118176", "0.58...
0.710681
0
The quantity of the tickets has to be more than 0, and less than or equal to 100. R4.3
def test_sell_ticket_valid_quantity(self, *_): # logout to invalidate any logged in session self.open(base_url + '/logout') # login a user self.open(base_url + '/login') # fill email and password self.type("#email", "test_frontend@test.com") self.type("#password",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_excess_quantity(self):\n excess = self._uncertain_demand.excess_stock\n avg_order = sum([int(item) for item in self._data_set.values()]) //len(self._data_set)\n variance = [(item - avg_order) for item in self._data_set.values()]\n stdev = pow(sum([pow(j, 2) for j in variance]) ...
[ "0.6076991", "0.5975765", "0.5935471", "0.5926505", "0.5924432", "0.585127", "0.5844957", "0.57967985", "0.5774268", "0.575084", "0.57310635", "0.57255524", "0.5691946", "0.56739944", "0.5643781", "0.56285113", "0.56178635", "0.5608882", "0.55876267", "0.55841124", "0.5579207...
0.6294424
0
The price has to be of range [10,100] R4.4
def test_sell_ticket_price_range(self, *_): # logout to invalidate any logged in session self.open(base_url + '/logout') # login a user self.open(base_url + '/login') # fill email and password self.type("#email", "test_frontend@test.com") self.type("#password", "T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_price():\n return uniform(1.0, 350.0)", "def calc_price(self):\n price = self.price\n action = self.action\n mortage = 5 # here set mortage multiplier \n\n if action == 'RESIDENTIAL_SALE':\n return price * 12 * mortage\n\n\n if price >= 10000:\n ...
[ "0.7284983", "0.69276345", "0.6759089", "0.6723851", "0.66512525", "0.66477984", "0.66477984", "0.64932793", "0.64932793", "0.6424603", "0.64102423", "0.6408866", "0.6307366", "0.628541", "0.62727803", "0.62725234", "0.62712115", "0.62647533", "0.6254314", "0.62294394", "0.62...
0.6222976
20
Convert a date or time string into an arrow object in UTC
def parse_time_string(time_str, tz="US/Pacific"): # parsedatetime doesn't handle ISO-8601 time strings (YYYY-MM-DDThh:mm:ss+zz) so # try to parse it with arrow first and then use parsedatetime as a fallback (grumble) t = None try: t = arrow.get(time_str) # If the input string didn't spe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toutc(dateobj, timezone):\n fmtdate = parser.parse(dateobj) # string to datetime object\n user_tz = pytz.timezone(timezone) # getting user's timezone\n localize_date_with_tz = user_tz.localize(fmtdate) #adding user's timezone to datetime object\n utcdate = pytz.utc.normalize(localize_date_with_tz) ...
[ "0.6379972", "0.63689584", "0.63480586", "0.6195369", "0.6145286", "0.61293244", "0.6017762", "0.60128754", "0.60054386", "0.6003779", "0.59517395", "0.5862127", "0.5833879", "0.57739145", "0.5755738", "0.57443655", "0.57159567", "0.5673042", "0.565728", "0.56556016", "0.5600...
0.60133666
7
Convert a given time interval (e.g. '5m') into the number of seconds in that interval
def parse_time_interval_seconds(time_str): cal = parsedatetime.Calendar() parse_result = cal.parseDT(time_str, sourceTime=datetime.min) if parse_result[1] == 0: raise ValueError("Could not understand time {time}".format(time=time_str)) return (parse_result[0] - datetime.min).total_seconds()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_seconds(interval):\n if type(interval) is str:\n interval_array = interval.split(' ')\n try:\n seconds = int(interval_array[0]) * TIME_SCALES[interval_array[1]]\n except KeyError:\n raise ValueError(\n \"Valid time scales are: {}\".format(list(TI...
[ "0.77735597", "0.6997003", "0.69709396", "0.6849573", "0.6816949", "0.6771826", "0.6753928", "0.67522997", "0.67239225", "0.6712131", "0.66843265", "0.6681593", "0.6676878", "0.6674106", "0.6672589", "0.66631174", "0.6643966", "0.6628711", "0.6628501", "0.6617979", "0.6617979...
0.6691363
10