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 |
|---|---|---|---|---|---|---|
Create a Postgres database for the tests, and drop it when the tests are done. | def create_database(request):
pg_user = TestConfig.DB_OPTS.get("username")
pg_host = TestConfig.DB_OPTS.get("host")
pg_port = TestConfig.DB_OPTS.get("port")
pg_db = TestConfig.DB_OPTS["database"]
pg_pass = TestConfig.DB_OPTS.get("password")
janitor = DatabaseJanitor(
pg_user, pg_host, pg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_database():\n # Depending on your local settings, you may need to specify a user and password, e.g.\n # conn = psycopg2.connect(dbname=\"postgres\", user=\"postgres\", password=\"password\")\n conn = psycopg2.connect(dbname=\"postgres\")\n conn.autocommit = True # it seems this mode is need... | [
"0.776207",
"0.7680002",
"0.76642394",
"0.757462",
"0.7534672",
"0.7435785",
"0.739832",
"0.73600656",
"0.73262256",
"0.732539",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.728773",
"0.7232359",
... | 0.7403443 | 6 |
Return Z(beta) / Z(0). | def relative_partition_function(self):
return self.overall_norm**2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeta(z, x, beta2):\n return 3 * (4* z**2 - beta2 * x**2) / 4 / beta2 / (1+x)",
"def get_beta_z(self):\n\n return np.matmul(self.sigma_zinv, self.sigma_zw)",
"def eta(z, x, beta2):\n return -6 * z / beta2 / (1+x)",
"def B(alpha: float, beta: float) -> float:\n return math.gamma(alpha) * ma... | [
"0.7207195",
"0.71908647",
"0.67439836",
"0.67266196",
"0.65687174",
"0.6522762",
"0.65185684",
"0.65185684",
"0.65185684",
"0.6507113",
"0.6436142",
"0.6432959",
"0.64171547",
"0.64145976",
"0.64072835",
"0.63866526",
"0.63737375",
"0.6356866",
"0.63502914",
"0.63470757",
"0... | 0.0 | -1 |
Inits queue with given size. | def __init__(self, size):
self.size = size
self.last_valid = 0
self.q = [None] * size
self.modder = self.ModIndex(size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, size):\n self.size = size\n self.queue = []",
"def __init__(self, size):\n self.queue = collections.deque(maxlen=size)",
"def __init__(self, size):\n self.queue = collections.deque(maxlen = size)",
"def __init__ (self, size: int):\n self.size = size\n ... | [
"0.7813",
"0.77176875",
"0.76755893",
"0.7579916",
"0.7481742",
"0.73940295",
"0.72465456",
"0.7217905",
"0.7099745",
"0.7090391",
"0.7063163",
"0.6991237",
"0.69631743",
"0.68137074",
"0.6805051",
"0.6799446",
"0.67937726",
"0.67270404",
"0.6659662",
"0.6647465",
"0.6645319"... | 0.65062517 | 35 |
Returns an int64_list from a bool / enum / int / uint. | def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result",
"def convertT... | [
"0.68822104",
"0.6595804",
"0.6461252",
"0.6448161",
"0.6367609",
"0.62926817",
"0.6269916",
"0.621823",
"0.6104528",
"0.59533274",
"0.5947467",
"0.5901199",
"0.5863832",
"0.5863832",
"0.58563983",
"0.5844792",
"0.58434534",
"0.5829844",
"0.5801042",
"0.5793561",
"0.5793561",... | 0.55193657 | 51 |
Builds an embedding layer according to specification | def embedding_layer(n_categories, embedding_dim, name=None):
input_tensor = Input(shape=(1,))
x = Embedding(n_categories, embedding_dim, name=name)(input_tensor)
x = Reshape(target_shape=(embedding_dim,))(x)
return input_tensor, x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_embedding_layer(inputs_, vocab_size, embed_size):\n embedding = tf.Variable(tf.random_uniform((vocab_size, embed_size), -1, 1))\n embed = tf.nn.embedding_lookup(embedding, inputs_)\n \n return embed",
"def embedding_layer(self):\n with tf.name_scope(\"Embedding_Layer\"):\n ... | [
"0.7847509",
"0.74038506",
"0.7232749",
"0.71730524",
"0.70281374",
"0.7011193",
"0.68792635",
"0.6869052",
"0.6842294",
"0.6838194",
"0.68053776",
"0.67777616",
"0.6740172",
"0.6727347",
"0.67109203",
"0.6710299",
"0.6694613",
"0.66663635",
"0.66533905",
"0.66500413",
"0.664... | 0.6686802 | 17 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
#print('output:',output)
#print('target:',target)
#print('maxk:',maxk)
###TOP 5 NAO EXISTE NAS MAAMAS OU NO GEO. TEM QUE TRATAR
maxk = 3 # Ignorando completamente o top5
_, pred = output.topk(maxk, 1, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Does the font have a DSIG table? | def com_google_fonts_check_dsig(ttFont):
if "DSIG" not in ttFont:
yield PASS, "ok"
else:
yield WARN,\
Message("found-DSIG",
"This font has a digital signature (DSIG table) which"
" is only required - even if only a placeholder"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def com_google_fonts_check_052(ttFont):\n REQUIRED_TABLES = {\n \"cmap\", \"head\", \"hhea\", \"hmtx\", \"maxp\", \"name\", \"OS/2\", \"post\"}\n OPTIONAL_TABLES = {\n \"cvt \", \"fpgm\", \"loca\", \"prep\", \"VORG\", \"EBDT\", \"EBLC\", \"EBSC\", \"BASE\",\n \"GPOS\", \"GSUB\", \"JSTF\", \"DSIG\"... | [
"0.59934574",
"0.59934574",
"0.5824857",
"0.5736564",
"0.5736564",
"0.5735894",
"0.569441",
"0.5688455",
"0.5677906",
"0.5677906",
"0.56572485",
"0.56278217",
"0.56196815",
"0.55831844",
"0.5579034",
"0.5579034",
"0.5538577",
"0.5521863",
"0.5506661",
"0.5506661",
"0.54903156... | 0.68253064 | 0 |
Initializer for the multi_taper_SNR object | def __init__(self, input=None, bandwidth=None, adaptive=False,
low_bias=False):
self.input = input
self.signal, self.noise = signal_noise(input)
self.bandwidth = bandwidth
self.adaptive = adaptive
self.low_bias = low_bias | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, snps, phenotype):\n self.snps = snps\n self.phenotype = phenotype",
"def __init__(self):\n\n #call super class's __init__ method\n super(TRiseSampler, self).__init__(name=\"trise\", observed=False)",
"def __init__(\r\n self,\r\n signal_to_noise_ratio... | [
"0.6361351",
"0.62873816",
"0.62516755",
"0.6224382",
"0.6122122",
"0.612157",
"0.60911614",
"0.6089674",
"0.60531944",
"0.6003193",
"0.59939253",
"0.5990127",
"0.59710664",
"0.5948857",
"0.59174925",
"0.59138083",
"0.5893346",
"0.58692956",
"0.58531463",
"0.58289856",
"0.581... | 0.0 | -1 |
Test if an already existing user tries to register | def test_existing_user_registration(self):
register_user(self, 'Some', 'Name', 'another@gmail.com', 'aaaAAA111')
with self.client:
response = register_user(
self, 'Dalin', 'Oluoch', 'another@gmail.com', 'aaaAAA111')
data = json.loads(response.data.decode())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_already_exists(self):\n User.objects.create_user(\n 'existing@example.com',\n 'existing@example.com',\n '123existing'\n )\n response = self.client.post('/o/register', {\n 'email': 'existing@example.com',\n 'password': '123exi... | [
"0.79712856",
"0.79350907",
"0.77660507",
"0.76720273",
"0.7506476",
"0.7480796",
"0.74105114",
"0.73593783",
"0.73551697",
"0.7318291",
"0.7296268",
"0.72917557",
"0.728213",
"0.7263887",
"0.72618484",
"0.72223836",
"0.72191167",
"0.72113657",
"0.7206867",
"0.7196935",
"0.71... | 0.66571075 | 95 |
Test if user enters the wrong email | def test_invalid_email(self):
with self.client:
response = register_user(
self, 'Dalin', 'Oluoch', 'anothergmail.com', 'aaaAAA111')
data = json.loads(response.data.decode())
self.assertTrue(data['status'] == 'fail')
self.assertTrue(data['message'] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_email_when_logging_in(self):\n pass",
"def validate_email(self):\n email = input(\"Email: \").strip()\n if email is None or email == \"\":\n print(self.INVALID_INPUT)\n self.display_cust_unlock()\n else:\n return email",
"def validat... | [
"0.7915598",
"0.7787377",
"0.7774535",
"0.77604157",
"0.77096564",
"0.75518966",
"0.75518966",
"0.7548443",
"0.75349414",
"0.74937814",
"0.7446299",
"0.7445429",
"0.7414767",
"0.7366799",
"0.73470056",
"0.7332964",
"0.7332288",
"0.7323587",
"0.7321922",
"0.7319019",
"0.729804... | 0.0 | -1 |
Test for login of a not registereduser | def test_unregistered_user_login(self):
with self.client:
response = login_user(self, 'another@gmail.com', 'aaaAAA111')
data = json.loads(response.data.decode())
self.assertTrue(data['status'] == 'fail')
self.assertTrue(
data['message'] ==
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_user_login(self):\n self.user.list_of_accounts = [{'username': 'Parseen',\n 'pwd': 'mypassword',\n 'email': 'david.parseen@yahoo.com'}]\n msg = self.user.login(\"nonuser@yahoo.com\", \"idontevenhaveone\")\n ... | [
"0.805826",
"0.79458356",
"0.7919867",
"0.7917346",
"0.77196324",
"0.7659807",
"0.76254034",
"0.76254034",
"0.76254034",
"0.76254034",
"0.7598764",
"0.7591861",
"0.7574496",
"0.7569983",
"0.7406102",
"0.73805517",
"0.7336406",
"0.7311062",
"0.72941387",
"0.7286501",
"0.723111... | 0.7336884 | 16 |
Test for invalid email while logging in | def test_invalid_email_login(self):
with self.client:
response = login_user(self, 'joegmail.com', 'aaaAAA111')
data = json.loads(response.data.decode())
self.assertTrue(data['status'] == 'fail')
self.assertTrue(data['message'] == 'Validation errors.')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_email_when_logging_in(self):\n pass",
"def test_invalid_email(self):\n rv = self.login('Bo_wrong@example.com', 'Bo1995')\n self.assertIn(b'Invalid email! Please try again', rv.data)",
"def test_sad_login_wrong_email(self):\n\n rv = self.login(\"wrong@email.com\")\n ... | [
"0.8879",
"0.78242165",
"0.7704486",
"0.75051355",
"0.73828447",
"0.71739274",
"0.7119462",
"0.7092057",
"0.70652634",
"0.7017356",
"0.70051026",
"0.69813544",
"0.69536006",
"0.69379807",
"0.6922429",
"0.69124645",
"0.68967354",
"0.68820167",
"0.6864128",
"0.6839974",
"0.6835... | 0.69588065 | 12 |
Generate a random string of fixed length | def randomString(stringLength=5):
letters = string.ascii_lowercase
str__ = ''.join(random.choice(letters) for i in range(stringLength)).upper()
time__ = ''.join(re.findall(r'[0-9]', str(datetime.datetime.now())))
return str__ + time__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.86790425",
"0.8572561",
"0.8547258",
"0.852836",
"0.851953",
"0.8431486",
"0.84306955",
"0.84141517",
"0.8410671",
"0.838781",
"0.8344199",
"0.8342652",
"0.8339121",
"0.83334655",
"0.8322878",
"0.82970816",
"0.8291549",
"0.8280295",
"0.82800275",
"0.82795703",
"0.8262815",... | 0.0 | -1 |
Returns the current timestamp as an ISO8601 time | def timestamp():
n = datetime.datetime.now()
return "%04d-%02d-%02dT%02d:%02d:%02d" % (
n.year, n.month, n.day, n.hour, n.minute, n.second
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def __get_timestamp() -> str:\n return str(datetime.now().astimezone())",
"def __get_timestamp() -> str:\n return str(datetime.now().astimezone())",
"def now_iso():\n return to_iso(now())",
"def timestamp():\n ... | [
"0.79599655",
"0.7882267",
"0.7882267",
"0.7643051",
"0.7611295",
"0.7544059",
"0.749689",
"0.74401885",
"0.7434092",
"0.7414801",
"0.7402058",
"0.73545414",
"0.73104",
"0.73046815",
"0.72885007",
"0.7282078",
"0.7280685",
"0.72740364",
"0.7267963",
"0.72604704",
"0.7258439",... | 0.76224047 | 4 |
Like timestamp, but just the numbers. | def timenum():
n = datetime.datetime.now()
return "%04d%02d%02d%02d%02d%02d" % (
n.year, n.month, n.day, n.hour, n.minute, n.second
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_timestamp(self, timestamp):\n return int(timestamp * 1e6)",
"def timestamp(self, t):\n if isinstance(t, datetime):\n t = time.mktime(t.timetuple())\n return t - 631065600",
"def timestamps():\n timestamps = ( # Index\n 1459516622.1, # 0\n 145951662... | [
"0.6919378",
"0.6772277",
"0.6677465",
"0.65541595",
"0.64814615",
"0.63953924",
"0.6391543",
"0.63282734",
"0.63058114",
"0.6192976",
"0.61834365",
"0.616754",
"0.6157074",
"0.61511034",
"0.6120546",
"0.6099835",
"0.6068512",
"0.6048619",
"0.6022974",
"0.60184264",
"0.601661... | 0.0 | -1 |
Returns the memory usage (between 0.0 and 1.0) on this system, which is total memory free memory cached memory. | def MemoryUsage(cls):
meminfo = cls.MemoryInfo()
return (meminfo["MemTotal"] - meminfo["MemFree"] - meminfo["Cached"]) / float(meminfo["MemTotal"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mem_usage():\n return process.memory_info().rss / 1024.**2",
"def get_current_mem_usage():\n process = psutil.Process()\n return process.memory_info().rss / float(2**20)",
"def get_total_mem(self):\n return self.total_mem",
"def memory_usage():\n\n # Handle optional psutil support\... | [
"0.8351866",
"0.80991274",
"0.80778897",
"0.80132693",
"0.7924828",
"0.7865128",
"0.7654336",
"0.7642362",
"0.763168",
"0.7580143",
"0.7578932",
"0.7561593",
"0.75514424",
"0.7491898",
"0.7461666",
"0.743066",
"0.7418507",
"0.74144953",
"0.7410928",
"0.7373577",
"0.73711276",... | 0.8610762 | 0 |
Create an instance of the Aligner. | def __init__(self, analysis: Analysis) -> None:
self.analysis = analysis
self.output_basename = os.path.join("REPORTS", self.analysis.basename)
self.only_human = True
self.max_records_str = utils.get_picard_max_records_string(
self.analysis.parameters["picard_max_records"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, params):\r\n _params = {\r\n 'Application': 'Infernal',\r\n }\r\n _params.update(params)\r\n Aligner.__init__(self, _params)",
"def __init__(self, params):\r\n _params = {\r\n 'min_pct': 75.0,\r\n 'min_len': 150,\r\n ... | [
"0.70814776",
"0.6833375",
"0.6664503",
"0.64062136",
"0.62592906",
"0.56576014",
"0.55688393",
"0.54800266",
"0.5377553",
"0.5345019",
"0.53145707",
"0.52934265",
"0.5245701",
"0.5245421",
"0.5187404",
"0.51757675",
"0.51574594",
"0.51375043",
"0.51354563",
"0.51268804",
"0.... | 0.0 | -1 |
Resample all data in the dictionary to 1 Hz data. This function recursively looks for all dataframes in the dictionary and resamples data to 1 Hz using | def resample_dict_sec(
data_dict: Dict[str, Any],
) -> Dict[str, Any]:
result_dict = {}
for key, value in data_dict.items():
if isinstance(value, (pd.DataFrame, pd.Series)):
result_dict[key] = resample_sec(value)
elif isinstance(value, dict):
result_dict[key] = resamp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resample(self, dataframes, freq='5s'):\n\n for df in dataframes:\n yield df.resample(freq, fill_method='bfill')",
"def resample(data, resample_rate=16000):\n for sample in data:\n assert \"sample_rate\" in sample\n assert \"wav\" in sample\n sample_rate = sample[\"sa... | [
"0.67451787",
"0.6404874",
"0.6007783",
"0.57603705",
"0.56952775",
"0.56782204",
"0.56607044",
"0.5642602",
"0.56016624",
"0.5583797",
"0.55751604",
"0.55430216",
"0.54909056",
"0.5460196",
"0.5451945",
"0.53688246",
"0.53585273",
"0.53539455",
"0.5352452",
"0.528387",
"0.52... | 0.6414204 | 1 |
r"""Loads pretrianed weights to model. | def load_pretrained_weights(model, weight_path):
checkpoint = load_checkpoint(weight_path)
if 'state_dict' in checkpoint:
state_dict = checkpoint['state_dict']
else:
state_dict = checkpoint
model_dict = model.state_dict()
new_state_dict = OrderedDict()
matched_layers, discarded_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n if isinstance(self.pretrained, str):\n logger = get_root_logger()\n logger.info(f'load model from: {self.pretrained}')\n load_checkpoint(self, self.pretrained, strict=False, logger=logger)\n elif self.pretrained is None:\n pass\n ... | [
"0.76692337",
"0.7443287",
"0.7316537",
"0.7286118",
"0.7229796",
"0.71891063",
"0.7157569",
"0.71416897",
"0.7127207",
"0.7119067",
"0.704319",
"0.7027611",
"0.7010938",
"0.69966173",
"0.69303477",
"0.6925683",
"0.69127953",
"0.6867772",
"0.6840399",
"0.6821841",
"0.6821207"... | 0.7080426 | 10 |
Blur the original image to achieve the requested level of blur init_sigma | def _initial_blur(self):
if self.init_sigma > self.cur_sigma:
sigma = sqrt(self.init_sigma * self.init_sigma - self.cur_sigma * self.cur_sigma)
self.data = gaussian_filter(self.raw, sigma)
else:
self.data = self.raw | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianBlur(img,ksize=(5,5),sigma=10):\n #kernel = cv2.getGaussianKernel(ksize,sigma)\n dst = np.zeros_like(img)\n cv2.GaussianBlur(src=img,dst=dst,ksize=ksize,sigmaX=0)\n return dst",
"def __gaussian_blur(self, img, kernel_size=3):\n return cv2.GaussianBlur(img, (kernel_size, kernel_size... | [
"0.751022",
"0.7463227",
"0.7286162",
"0.72624356",
"0.7252277",
"0.72099334",
"0.72099334",
"0.7175162",
"0.7166989",
"0.71255344",
"0.71129066",
"0.70982486",
"0.70982486",
"0.70982486",
"0.70982486",
"0.70982486",
"0.70982486",
"0.70982486",
"0.70982486",
"0.70982486",
"0.... | 0.7438709 | 2 |
Calculate all sigma to blur an image within an octave | def _calc_sigma(self):
if self.data is None:
self._initial_blur()
previous = self.init_sigma
incr = 0
self.sigmas = [(previous, incr)]
for i in range(1, self.scale_per_octave + 3):
sigma_abs = self.init_sigma * (self.dest_sigma / self.init_sigma) ** (1.0 *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blur_image(im, n, ny=None) :\n g = gauss_kern(n, sizey=ny)\n improc = signal.convolve(im,g, mode='same')\n return(improc)",
"def gs_blur(self,k,img):\n SIG = self.sigma\n sig = [SIG,k*SIG,k*k*SIG,k*k*k*SIG,k*k*k*k*SIG]\n gsArray = [0,1,2,3,4]\n scaleImages = [0,1,2,3,4]\n... | [
"0.7623635",
"0.7279466",
"0.7246422",
"0.72202635",
"0.7187415",
"0.71213794",
"0.7077226",
"0.70205796",
"0.7004607",
"0.7002188",
"0.69619244",
"0.6929818",
"0.6917997",
"0.6917997",
"0.68812877",
"0.68627197",
"0.6852142",
"0.6852142",
"0.6852142",
"0.6852142",
"0.6852142... | 0.65550315 | 52 |
Converts a date to a millisecond accuracy timestamp. Equivalent to Date.UTC(d.year, d.month1, d.day) in Javascript | def date_to_milliseconds(d):
return calendar.timegm(datetime.combine(d, time(0, 0, 0)).replace(tzinfo=pytz.UTC).utctimetuple()) * 1000 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unix_time_millisecond(date):\r\n return unix_time(date, float=True) * 1e3",
"def utc_millisecond_timestamp():\n return __date_to_millisecond_ts(utc())",
"def utc_timestamp(d):\n if isinstance(d, pd.tslib.Timestamp):\n # Pandas datetime timestamp whatever thing\n if d.tz != pytz.utc:\... | [
"0.728515",
"0.7048117",
"0.6665483",
"0.65586203",
"0.6473058",
"0.64467794",
"0.63545495",
"0.63019687",
"0.62854236",
"0.62761515",
"0.6258863",
"0.6236034",
"0.61951363",
"0.61670613",
"0.61646944",
"0.61426383",
"0.60565823",
"0.6056321",
"0.6024606",
"0.59626627",
"0.59... | 0.740372 | 0 |
Converts a datetime to a microsecond accuracy timestamp | def datetime_to_microseconds(dt):
seconds = calendar.timegm(dt.utctimetuple())
return seconds * 1000000 + dt.microsecond | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utc_millisecond_timestamp():\n return __date_to_millisecond_ts(utc())",
"def _from_microseconds(value):\n return _UTC_EPOCH + datetime.timedelta(microseconds=value)",
"def datetime_to_epoch_microseconds(obj: \"datetime\") -> float:\n td = datetime_to_epoch_timedelta(obj)\n return (td.days * 864... | [
"0.72529066",
"0.70968264",
"0.7032166",
"0.7006187",
"0.6993755",
"0.699352",
"0.6958667",
"0.6932001",
"0.67451006",
"0.6707826",
"0.66934925",
"0.6637661",
"0.65551037",
"0.65199524",
"0.6482659",
"0.64510804",
"0.64466745",
"0.6440227",
"0.64201826",
"0.63682145",
"0.6329... | 0.78731877 | 0 |
Converts a microsecond accuracy timestamp to a datetime | def microseconds_to_datetime(ms):
return datetime.utcfromtimestamp(ms / 1000000.0).replace(tzinfo=pytz.utc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_to_datetime(value):\n if not isinstance(value, (int, long, float)):\n raise ValueError(\n 'Expecting a number, got %s instead' % type(value).__name__)\n return EPOCH + datetime.timedelta(microseconds=value)",
"def _time_to_datetime(value):\r\n assert isinstance(value, datetime.time)\... | [
"0.72197497",
"0.72195035",
"0.72044027",
"0.7151784",
"0.69175553",
"0.6827507",
"0.67991424",
"0.67348254",
"0.67316675",
"0.6656708",
"0.662968",
"0.66295",
"0.662285",
"0.6554271",
"0.6492199",
"0.6461113",
"0.6452887",
"0.6444923",
"0.6387432",
"0.6385543",
"0.63840055",... | 0.7604913 | 0 |
Gets the UTC start and end (exclusive) of a month | def month_range(offset, now=None):
if not now:
now = timezone.now()
now = now.astimezone(pytz.UTC)
start_of_this_month = now.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
return start_of_this_month + relativedelta(months=offset), start_of_this_month + relativedelta(months=offset + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_month(year, month):\n start = datetime.datetime(year, month, 1)\n if month == 12:\n end = datetime.datetime(year+1, 1, 1)\n else:\n end = datetime.datetime(year, month+1, 1)\n print(start)\n print(end)\n return start, end",
"def get_sta... | [
"0.7382513",
"0.7311475",
"0.7045957",
"0.66243297",
"0.6563402",
"0.62430537",
"0.6215595",
"0.6173497",
"0.6137645",
"0.6006517",
"0.5968439",
"0.59126496",
"0.5894336",
"0.5866319",
"0.58337104",
"0.5827581",
"0.5768964",
"0.576167",
"0.56839186",
"0.5668931",
"0.5654958",... | 0.61849755 | 7 |
A list of monsters inside dungeon. | def MONSTERS():
list_of_monster = [
("Elfy the Elf", "A small elvin creature with a bow and arrows around its back.", 2, 1, 1),
("Bazilisk", "A long snake with piercing eyes", 3, 2, 1),
("Shrak the Ogre", "A large green ogre with a penchant for eating people", 4, 2, 2),
("Wanda the Witch", "A tall scary look... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_mobs(self):\n mobs = []\n z = 0\n while z < 10: # 10 mobs per level for now\n c = 0\n while c == 0:\n x = random.randint(0, self.map.width - 1)\n y = random.randint(0, self.map.height - 1)\n if self.map.map[x][y].... | [
"0.69287133",
"0.63263077",
"0.5886569",
"0.5824322",
"0.57758963",
"0.5768761",
"0.5732632",
"0.57172227",
"0.57103765",
"0.5675186",
"0.5659909",
"0.5647063",
"0.56430095",
"0.5635332",
"0.56214225",
"0.5607423",
"0.56003904",
"0.5582513",
"0.55810535",
"0.55605525",
"0.555... | 0.6744559 | 1 |
sets the price of the Book Object | def setPrice(self, val):
self.price = val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price(self, price):\n\n self._price = price",
"def price(self, price):\n\n self._price = price",
"def price(self, price):\n\n self._price = price",
"def price(self, price):\n\n self._price = price",
"def set_price(self, _price):\n self.price = _price\n return s... | [
"0.808748",
"0.808748",
"0.808748",
"0.808748",
"0.793506",
"0.78641707",
"0.7607287",
"0.7455669",
"0.734119",
"0.7282174",
"0.71559685",
"0.71559685",
"0.70682216",
"0.70339733",
"0.67559224",
"0.65906763",
"0.6582842",
"0.6581897",
"0.6484479",
"0.64573675",
"0.6444084",
... | 0.7991626 | 4 |
Returns list of variables without scopes that start with exclude_scopes . | def get_variables(finetune_ckpt_path, exclude_scopes=None):
if exclude_scopes is not None:
exclusions = [scope.strip() for scope in exclude_scopes]
variables_to_restore = [ var for var in slim.get_model_variables() if not np.any([var.op.name.startswith(ex) for ex in exclusions])]
else:
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variables_to_restore():\n# checkpoint_exclude_scopes=[\"distance-module\", \"InceptionV4/Logits\"]\n checkpoint_exclude_scopes=[\"DeInceptionV4\"]\n exclusions = [scope.strip() for scope in checkpoint_exclude_scopes]\n\n variables_to_restore = []\n for var in slim.get_model_variables():\n ... | [
"0.720917",
"0.69072914",
"0.66063374",
"0.6404244",
"0.6290807",
"0.6250691",
"0.6105175",
"0.6102679",
"0.6044578",
"0.6044243",
"0.5991366",
"0.59767663",
"0.59064114",
"0.5837804",
"0.57819754",
"0.5755795",
"0.5755795",
"0.5748342",
"0.57453793",
"0.5731443",
"0.571667",... | 0.72680116 | 0 |
Reflect pads input by adding pad_size to h x w dimensions | def pad(input, pad_size):
if not pad_size:
return input
return tf.pad(input, [[0,0],[pad_size, pad_size],[pad_size, pad_size],[0,0]], 'REFLECT') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_pad(input, size):\n M1 = tf.concat([input[:, :, -size[1]:, :], input, input[:, :, 0:size[1], :]], 2)\n M1 = tf.concat([M1[:, -size[0]:, :, :], M1, M1[:, 0:size[0], :, :]], 1)\n return M1",
"def pad2d_hw_shape(\n h_w: Union[int, Tuple[int, int]],\n pad_size: Union[int, Tuple[int, int], Tup... | [
"0.7233095",
"0.697727",
"0.681642",
"0.68118125",
"0.6807323",
"0.6792372",
"0.67235726",
"0.6717754",
"0.66783816",
"0.66661566",
"0.6654894",
"0.66179925",
"0.6610793",
"0.65578634",
"0.6521711",
"0.6488787",
"0.6449627",
"0.644732",
"0.64341927",
"0.6410827",
"0.63995403"... | 0.7037951 | 1 |
Return the timezone map, generating it if needed. | def get_tz_map(version=LATEST_VER):
_gen_map()
return _TZ_MAP | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tz_rmap(version=LATEST_VER):\n _gen_map()\n return _TZ_RMAP",
"def _map_timezones():\n tz_map = {}\n todo = HAYSTACK_TIMEZONES_SET.copy()\n for full_tz in pytz.all_timezones:\n # Finished case:\n if not bool(todo): # pragma: no cover\n # This is nearly impossible f... | [
"0.74370706",
"0.6570189",
"0.65298337",
"0.6491904",
"0.6434843",
"0.6367455",
"0.6088126",
"0.6056394",
"0.6036855",
"0.60350317",
"0.5913512",
"0.5857469",
"0.5765073",
"0.5715903",
"0.57140595",
"0.5703094",
"0.56877476",
"0.56223917",
"0.55516887",
"0.5518664",
"0.549725... | 0.80604345 | 0 |
Retrieve the Haystack timezone | def timezone(haystack_tz, version=LATEST_VER):
tz_map = get_tz_map(version=version)
try:
tz_name = tz_map[haystack_tz]
except KeyError:
raise ValueError('%s is not a recognised timezone on this host' \
% haystack_tz)
return pytz.timezone(tz_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezone():\n\n return time.timezone",
"def timezone():\n \n pass",
"def get_timezone():\n return dates.get_timezone(_get_tz())",
"def timezone(self):\n return self.data.get(\"timezone\")",
"def timezone(self):\n tz_data = self._router_request(\n self._make_request_d... | [
"0.77479905",
"0.7721948",
"0.75319725",
"0.7416946",
"0.740689",
"0.7368421",
"0.7307687",
"0.7137479",
"0.7072381",
"0.7056761",
"0.7053391",
"0.7005167",
"0.7005167",
"0.7005167",
"0.6946315",
"0.69427586",
"0.69363457",
"0.6882567",
"0.6851317",
"0.67188483",
"0.6709543",... | 0.7296891 | 7 |
Determine an appropriate timezone for the given date/time object | def timezone_name(dt, version=LATEST_VER):
tz_rmap = get_tz_rmap(version=version)
if dt.tzinfo is None:
raise ValueError('%r has no timezone' % dt)
# Easy case: pytz timezone.
try:
tz_name = dt.tzinfo.zone
return tz_rmap[tz_name]
except KeyError:
# Not in timezone ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezonize(tz):\n \n # Checking if somthing is a valid pytz object is hard as it seems that they are spread around the pytz package.\n #\n # Option 1): Try to convert if string or unicode, otherwise try to instantiate a datetieme object decorated\n # with the timezone in order to check if it is ... | [
"0.7208187",
"0.67281437",
"0.6471432",
"0.64455163",
"0.63459593",
"0.631303",
"0.62642616",
"0.623493",
"0.6224854",
"0.61935174",
"0.6175609",
"0.6166606",
"0.6164198",
"0.61475104",
"0.6121453",
"0.6106717",
"0.61061585",
"0.6087046",
"0.60728097",
"0.60716987",
"0.606527... | 0.0 | -1 |
Prints a confusion matrix, as returned by sklearn.metrics.confusion_matrix, as a heatmap. | def print_confusion_matrix(confusion_matrix, class_names, figsize=(10, 7), fontsize=14):
df_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_names,)
fig, ax1 = plt.subplots(1, 1, figsize=figsize)
try:
heatmap = sns.heatmap(df_cm, annot=True, fmt="d")
except ValueError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confusion_matrix_heatmap(y_test, preds, classification_labels):\n labels = list(set(y_test))\n long_labels = [ll + \" (\" + str(l) + \")\" for ll, l\n in zip(classification_labels, labels)]\n cm = confusion_matrix(y_test, preds, labels=labels)\n fig = plt.figure(figsize=(20, 20))\... | [
"0.8297264",
"0.82069093",
"0.8130575",
"0.8099851",
"0.800933",
"0.79787314",
"0.7917066",
"0.7809642",
"0.77835274",
"0.7764853",
"0.7712924",
"0.76667136",
"0.7654817",
"0.76424736",
"0.76402396",
"0.76334995",
"0.76270396",
"0.7624555",
"0.7618538",
"0.7610822",
"0.760697... | 0.8130302 | 3 |
Test creating a new product category | def test_create_product_successful(self):
ProductCategory.objects.create(name="test name", description="new name")
test_key = ProductCategory.objects.values()[0]
# print(test_key)
payload = {
'name': 'Test Tag',
'product_category_id': test_key.get('id'),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_category(self):\n pass",
"def test_create_category(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n self.assertIn('Stews', str(res.data))",
"def test_add_category_to_product(self):\n login = self.... | [
"0.8666074",
"0.8083804",
"0.80333173",
"0.8018478",
"0.80060804",
"0.79673266",
"0.7897619",
"0.7886233",
"0.7873304",
"0.7858809",
"0.76521426",
"0.75928867",
"0.75764745",
"0.74452746",
"0.7441107",
"0.73869574",
"0.7349622",
"0.73455846",
"0.73388535",
"0.72651356",
"0.72... | 0.8309495 | 1 |
Test viewing a product detail | def test_get_product_detail(self):
ProductCategory.objects.create(name='Test Product Category #1', description='Test Description #1')
ProductCategory.objects.create(name='Test Product Category #2', description='Test Description #1')
ProductCategory.objects.create(name='Test Product Category #3',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_product_detail(self):\n product = sample_product(supplier_id=self.user)\n\n url = detail_url(product.id)\n res = self.client.get(url)\n\n serializer = ProductSerializer(product)\n\n self.assertEqual(res.status_code, status.HTTP_200_OK)\n self.assertEqual(res.... | [
"0.85004866",
"0.81269187",
"0.8001429",
"0.78238064",
"0.77813274",
"0.772321",
"0.76463157",
"0.75317925",
"0.74812466",
"0.73388106",
"0.7258478",
"0.72385216",
"0.723755",
"0.7053988",
"0.70289075",
"0.7020849",
"0.6970813",
"0.69646883",
"0.69444525",
"0.69102246",
"0.68... | 0.74560344 | 9 |
Return this command's name. The name of a Django management command is nothing more than the name of the file where it sits, with the extension stripped out. | def name(self):
module_filepath = inspect.getfile(type(self))
module_filename = os.path.basename(module_filepath)
command_name, _ = os.path.splitext(module_filename)
return command_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_name(self):\n return None",
"def __getFullCommandName(self, command, type):\n return 'cmd_%s_%s' % (type, command)",
"def get_command_name(args):\n\n # First argument would always be atlas or manage.py, i.e the calling interface\n if len(args) < 2:\n CommandError.print_to... | [
"0.7221757",
"0.68458074",
"0.6797556",
"0.6686816",
"0.6499827",
"0.6428203",
"0.64199543",
"0.6405688",
"0.639326",
"0.6377145",
"0.62805665",
"0.6224193",
"0.6212611",
"0.62076145",
"0.62063813",
"0.6203215",
"0.6191002",
"0.6135667",
"0.6128957",
"0.6126173",
"0.609243",
... | 0.7605796 | 0 |
Tokenize and Lemmatize text | def tokenize_lemmatize(column, min_word_len=2):
nlp = spacy.load('en', disable=['tagger', 'parser', 'ner'])
docs = column.tolist()
def token_filter(token):
return not (token.is_punct | token.is_space) and (len(token.text) >= min_word_len)
filtered_tokens = []
for doc in nlp.pipe(docs):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n tokens=word_tokenize(text)\n lemmatizer=WordNetLemmatizer()\n \n clean_tokens=[]\n for tok in tokens:\n clean_tok = lemmatizer.lemmatize(tok).lower().strip()\n clean_tokens.append(clean_tok)\n return clean_tokens\n pass",
"def tokenize(text):\n tokens =... | [
"0.7661149",
"0.75969845",
"0.75545335",
"0.7543559",
"0.75218743",
"0.7449707",
"0.7449498",
"0.74465096",
"0.74316734",
"0.7404093",
"0.7404067",
"0.73993343",
"0.732467",
"0.7315226",
"0.73007417",
"0.7290746",
"0.7244986",
"0.71804565",
"0.71688104",
"0.71072215",
"0.7086... | 0.0 | -1 |
Get and update cluster name from cookiecutter.json. | def get_cluster_name():
cookiecutter_path = Path("cookiecutter.json")
cookiecutter_dict = json.loads(cookiecutter_path.read_text())
cluster_name = ""
try:
cluster_name = cookiecutter_dict["cluster_name"]
except KeyError:
while not cluster_name:
cluster_name = input("Pleas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> pulumi.Input[s... | [
"0.6458336",
"0.6458336",
"0.6439198",
"0.6439198",
"0.6339771",
"0.6323489",
"0.6309117",
"0.62971157",
"0.62971157",
"0.62971157",
"0.62971157",
"0.62971157",
"0.6198518",
"0.5919496",
"0.58436006",
"0.5747788",
"0.57337683",
"0.5638161",
"0.5595323",
"0.55599266",
"0.55261... | 0.8430586 | 0 |
Find free ipv4 subnet with the given prefix length in the freifunk range (10.0.0.0/8) | def find_subnet(allocated, prefix_len):
def is_colliding(network, allocations):
"""
Check if given network is colliding with an
already allocated networks
"""
for allocation in allocations:
if network.overlaps(allocation):
return True
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_netmask(prefix):\n try:\n prefix_str = unicode(prefix)\n except NameError as ex:\n prefix_str = str(prefix)\n return IPv4Network(\"1.0.0.0/\"+prefix_str).netmask",
"def get_nets_and_highest_prefix(ip, net_group, db):\n highest_prefix_length = 0\n networks = []\n ip = nacaddr.... | [
"0.7031105",
"0.628563",
"0.6167392",
"0.6117675",
"0.6071933",
"0.6042414",
"0.60167956",
"0.5985993",
"0.59358686",
"0.5917043",
"0.5829789",
"0.5783567",
"0.5774751",
"0.576267",
"0.57365376",
"0.5706467",
"0.56903154",
"0.56880146",
"0.56600106",
"0.5620678",
"0.5558388",... | 0.7617754 | 0 |
Returns True if this category contains 0 ebuilds. | def empty ( self ):
return (
len ( self._subdirs ) == 0 or
all ( d.empty() for d in self._subdirs.values() )
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return ch.prod(ch.tensor(self.x.shape)).item() == 0",
"def is_empty(self):\n return self._sum() == 0",
"def is_empty(self):\n return not bool(self.categories)",
"def isZero(self):\n return self.count == 0",
"def __nonzero__(self):\n for e in self:\n ... | [
"0.6983546",
"0.68920785",
"0.6848093",
"0.67854583",
"0.67258286",
"0.6676877",
"0.6667772",
"0.66578114",
"0.66559225",
"0.66371566",
"0.66371566",
"0.66349393",
"0.65957147",
"0.65957147",
"0.65798116",
"0.65798116",
"0.6561025",
"0.65476406",
"0.6545098",
"0.65422285",
"0... | 0.0 | -1 |
Validates whether or not the password is equal to password confirmation | def password_confirmation(field, value, error):
if self.params['password'] != value:
error(field, 'does not match the password') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_pass(self):\n if self.validated_data['new_password'] != self.validated_data['confirm_password']:\n raise serializers.ValidationError({\"error\":\"Please enter matching passwords\"})\n return True",
"def password_confirm(self, password, confirm_password):\n return passwor... | [
"0.8019631",
"0.79434407",
"0.7710261",
"0.74721235",
"0.7388005",
"0.73307633",
"0.73180133",
"0.7315029",
"0.7309858",
"0.72781426",
"0.7277938",
"0.7271391",
"0.72655904",
"0.7261927",
"0.72463167",
"0.7189866",
"0.71847016",
"0.71724015",
"0.71440816",
"0.71399295",
"0.71... | 0.7847406 | 2 |
given a sklearn confusion matrix (cm), make a nice plot Arguments | def plot_confusion_matrix(cm,
target_names,
title='Confusion matrix',
cmap=None,
normalize=True):
import matplotlib.pyplot as plt
import numpy as np
import itertools
accuracy = np.trace(cm) / float(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.79997694",
"0.79955804",
"0.7947871",
"0.79360676",
"0.79129595",
"0.7897813",
"0.7879448",
"0.786082",
"0.786082",
"0.78540397",
"0.78501374",
"0.78499055",
"0.78404397",
"0.7835427",
"0.7828328",
"0.78253037",
"0.78049725",
"0.78017557",
"0.77822274",
"0.77789044",
"0.77... | 0.0 | -1 |
Return hex colors as a list. | def get_colors(lines):
patt = re.compile('\#\w+')
return [
patt.search(line).group(0)
for line in lines
if patt.search(line)
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hex_colors(cls):\n return ['#{:02x}{:02x}{:02x}'.format(*cls._COLORS[s])\n for s in cls._STATES]",
"def getColors():\n return ['#8c99fc', '#cacefd', '#fff1d7', '#feda98', '#fda85a', '#fc6647']",
"def hex_list(self):\r\n return [''.join(['{:02X}'.format(b) for b in data]) for... | [
"0.79856694",
"0.783498",
"0.77486",
"0.74567974",
"0.7360376",
"0.7357425",
"0.73567826",
"0.7354677",
"0.7244235",
"0.719961",
"0.7091762",
"0.7078886",
"0.7042989",
"0.70378083",
"0.69909",
"0.69909",
"0.6985355",
"0.68711084",
"0.686212",
"0.6801104",
"0.67720383",
"0.6... | 0.66294473 | 25 |
Test reading/writing/fidelity of json. | def test_json(test_data,tmp_path):
for d in test_data:
gpm = GenotypePhenotypeMap(wildtype=d["wildtype"],
genotype=d["genotype"],
phenotype=d["phenotype"],
uncertainty=d["uncertainty"])
# Writ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_loads_a_non_object_json_file(self):\n from test.resources import simple_json\n self.assertEqual(simple_json._data, 'test')",
"def test_regular_dump(self):\n try:\n _build_test_dirs()\n dicti = {\n 'array': [1, 2, 3],\n 'string': 't... | [
"0.7217971",
"0.6938442",
"0.6835149",
"0.68225974",
"0.68042815",
"0.6765999",
"0.67454845",
"0.6681335",
"0.6678542",
"0.6670595",
"0.66417533",
"0.66327286",
"0.66059375",
"0.6555721",
"0.6533295",
"0.65258557",
"0.65028566",
"0.65018135",
"0.6497468",
"0.6446527",
"0.6428... | 0.0 | -1 |
1. At a new node at the end of the list 2. Heapify up the new node | def push(self, new_node):
# Add a new node into the data list
self.data.append(new_node)
# Maintain the min heap
self.heapify_up(len(self.data) - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _heapify(self):\n start = self._parent(len(self) - 1)\n for i in range(start, -1, -1):\n self._down_heap(i)",
"def heapify(self):\r\n if self._size:\r\n start = self._parent(len(self._data)-1) # who'se the last parent?\r\n for index in range(start, -1, -... | [
"0.74264336",
"0.73963284",
"0.7290254",
"0.72568786",
"0.72482026",
"0.7244978",
"0.7069481",
"0.6995931",
"0.6968657",
"0.6963902",
"0.69190514",
"0.6899713",
"0.68756896",
"0.68756896",
"0.68658453",
"0.68619037",
"0.68616194",
"0.68428886",
"0.68379295",
"0.68222404",
"0.... | 0.6533837 | 37 |
Universal bucket name for use throughout testing | def test_bucket():
return 'test_bucket' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucket_name(self) -> str:\n ...",
"def bucket_name(self) -> str:\n return pulumi.get(self, \"bucket_name\")",
"def get_bucket_name(self, tag) -> str:\n region = self.node.try_get_context(\"region\")\n account = self.node.try_get_context(\"account\")\n bucket_tag = f\"{reg... | [
"0.8432413",
"0.7825941",
"0.78217864",
"0.76706684",
"0.76706684",
"0.74040335",
"0.74040335",
"0.74040335",
"0.74040335",
"0.74040335",
"0.73684615",
"0.733012",
"0.733012",
"0.733012",
"0.733012",
"0.733012",
"0.733012",
"0.733012",
"0.733012",
"0.733012",
"0.733012",
"0... | 0.7646228 | 5 |
Sets up a bucket with no contents. | def setup_bucket_wo_contents(mock_s3_client, test_bucket):
s3 = boto3.client('s3')
s3.create_bucket(Bucket=test_bucket)
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_bucket(self):\n self.s3_handle = boto.connect_s3()\n EmrProcessing.bucket_name = self.generate_unique_name()\n EmrProcessing.bucket = \\\n self.s3_handle.create_bucket(EmrProcessing.bucket_name)\n EmrProcessing.bucket.delete_keys([key.name \\\n for key in... | [
"0.7592298",
"0.7092944",
"0.6925842",
"0.68444556",
"0.6762064",
"0.6678218",
"0.6617833",
"0.6469845",
"0.64586926",
"0.6428456",
"0.6376333",
"0.6369308",
"0.6365494",
"0.6349191",
"0.63306063",
"0.63299114",
"0.61904687",
"0.614448",
"0.6139349",
"0.61301214",
"0.6112814"... | 0.58068466 | 41 |
Sets up a bucket with no contents. | def setup_bucket_w_contents(mock_s3_client, test_bucket, test_df_key, test_df):
s3 = boto3.client('s3')
s3.create_bucket(Bucket=test_bucket)
with NamedTemporaryFile() as tmpfile:
test_df.to_csv(tmpfile.name, index=False, header=False)
s3.upload_file(tmpfile.name, test_bucket, test_df_key)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_bucket(self):\n self.s3_handle = boto.connect_s3()\n EmrProcessing.bucket_name = self.generate_unique_name()\n EmrProcessing.bucket = \\\n self.s3_handle.create_bucket(EmrProcessing.bucket_name)\n EmrProcessing.bucket.delete_keys([key.name \\\n for key in... | [
"0.7592222",
"0.7092216",
"0.69243556",
"0.68434757",
"0.6761147",
"0.6677206",
"0.6616504",
"0.647066",
"0.6458352",
"0.64281553",
"0.63751495",
"0.63697803",
"0.63649005",
"0.63492256",
"0.6329824",
"0.6329308",
"0.6190852",
"0.6144858",
"0.61389583",
"0.6129301",
"0.611247... | 0.0 | -1 |
Reset the ratings and counts of a user. | def user_reset(user_id):
con = connect()
cursor = con.cursor()
cursor.execute(f"""
START TRANSACTION;
DELETE FROM ratings
WHERE user_id = {user_id};
DELETE FROM counts_by_rating_type
WHERE user_id = {user_id};
{_count_reset_quer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_user_module_score(self, user):\r\n self.set_user_module_score(user, None, None)",
"def resetUsers():\n global pollResults\n pollResults = dict()\n emitResults()",
"def reset(self):\n self.correct_count = 0\n self.total_count = 0",
"def resetUser(self):\n\t\turl = \"htt... | [
"0.65553725",
"0.6545137",
"0.6491719",
"0.63327324",
"0.6324312",
"0.63229364",
"0.6307174",
"0.6305125",
"0.6279662",
"0.62600213",
"0.62177336",
"0.62018025",
"0.612058",
"0.60814464",
"0.6065281",
"0.60376483",
"0.6017353",
"0.596416",
"0.59252435",
"0.59211504",
"0.59151... | 0.7341955 | 0 |
The set of arguments for constructing a SyntheticsPrivateLocation resource. | def __init__(__self__, *,
name: pulumi.Input[str],
description: Optional[pulumi.Input[str]] = None,
metadata: Optional[pulumi.Input['SyntheticsPrivateLocationMetadataArgs']] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: SyntheticsPrivateLocationArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOption... | [
"0.7672276",
"0.6676975",
"0.63364583",
"0.58349913",
"0.5595418",
"0.5591775",
"0.5519098",
"0.54712766",
"0.5462107",
"0.5459883",
"0.5437219",
"0.5403041",
"0.5386545",
"0.53785187",
"0.5370117",
"0.5313365",
"0.53130496",
"0.52866066",
"0.5285694",
"0.5283026",
"0.5276887... | 0.6529915 | 2 |
Return a random character between ASCII 32 and 126 (i.e. spaces, symbols, letters, and digits). All characters returned will be nicely printable. | def random_char():
return chr(random.randrange(32, 126, 1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_charachter() -> chr:\r\n return chr(int(random.randrange(32, 126, 1)))",
"def get_random_char():\n return chr(randint(97, 122))",
"def RandomAlphaNumChar():\n num = random.randint(0, 26 + 26 + 10)\n if num < 26:\n return chr(num + 65)\n num -= 26\n if num < 26:\n return chr(num + 97)... | [
"0.8830268",
"0.83026904",
"0.812296",
"0.789522",
"0.7702148",
"0.741143",
"0.7320534",
"0.7207496",
"0.7204395",
"0.71742284",
"0.7081044",
"0.6991104",
"0.6858148",
"0.68478876",
"0.6807224",
"0.67977804",
"0.6793784",
"0.6784956",
"0.67772675",
"0.6769406",
"0.6760741",
... | 0.87171346 | 1 |
Return a list of POP_SIZE individuals, each randomly generated via iterating DNA_SIZE times to generate a string of random characters with random_char(). | def random_population():
pop = []
for i in range(POP_SIZE):
dna = ""
for c in range(DNA_SIZE):
dna += random_char()
pop.append(dna)
return pop | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_population() -> List:\r\n pop = []\r\n for _ in range(POPULATION_SIZE):\r\n dna = \"\"\r\n for c in range(DNA_SIZE):\r\n dna += random_charachter()\r\n pop.append(dna)\r\n return pop",
"def generate_random_population(pop_size):\n\n random_population = []\n ... | [
"0.8334825",
"0.7507812",
"0.7216187",
"0.70892304",
"0.70369464",
"0.6994599",
"0.6967262",
"0.6770745",
"0.6711861",
"0.66882414",
"0.6684687",
"0.6656384",
"0.6647211",
"0.6642518",
"0.6612839",
"0.6530116",
"0.6445024",
"0.644333",
"0.63814443",
"0.6314523",
"0.6274228",
... | 0.8597554 | 0 |
For each gene in the DNA, this function calculates the difference between it and the character in the same position in the OPTIMAL string. These values are summed and then returned. | def fitness(dna):
fitness = 0
for c in range(DNA_SIZE):
if dna[c] == OPTIMAL[c]:
fitness += 1
return fitness | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_distance_from_aln_strings(str1, str2):\n assert len(str1) == len(str2)\n edit_distance = 0\n in_gap = False\n\n for i, char1 in enumerate(str1):\n if char1 == \"-\" or str2[i] == \"-\":\n if not in_gap:\n in_gap = True\n edit_distance += 1\n ... | [
"0.5892284",
"0.58377594",
"0.58111554",
"0.5802616",
"0.5717742",
"0.5716548",
"0.57153755",
"0.56435704",
"0.551983",
"0.5448549",
"0.5402146",
"0.54016054",
"0.539039",
"0.537256",
"0.53583044",
"0.5353069",
"0.5352566",
"0.53354",
"0.5329248",
"0.53220797",
"0.5319295",
... | 0.5015547 | 67 |
Slices both dna1 and dna2 into two parts at a random index within their length and merges them. Both keep their initial sublist up to the crossover index, but their ends are swapped. | def crossover(dna1, dna2):
pos = int(random.random() * DNA_SIZE)
new_dna1 = dna1[:pos] + dna2[pos:]
return new_dna1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crossover(self, dna1, dna2):\n pos = int(random.random()*self.DNA_SIZE)\n return (dna1[:pos]+dna2[pos:], dna2[:pos]+dna1[pos:])",
"def cross_over(ind1, ind2):\n \n network1 = ind1.network\n network2 = ind2.network\n \n size = min(len(network1.index), len(network2.index))\n cx ... | [
"0.79468405",
"0.64652693",
"0.6431925",
"0.63530046",
"0.63031685",
"0.6258021",
"0.6250199",
"0.61653215",
"0.61324793",
"0.611977",
"0.6083309",
"0.6076303",
"0.6054012",
"0.603311",
"0.60196644",
"0.60068965",
"0.59649265",
"0.5931624",
"0.58927554",
"0.58507705",
"0.5846... | 0.7660745 | 1 |
Exclude from the map any items matching the supplied `keys` | def exclude(m, keys):
return {k: v for k, v in m.items() if k not in keys} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Exclude(*keys):\n\n def exclude(row):\n res = dict(row)\n for k in keys:\n if k in res:\n del res[k]\n return res\n\n return \"Exclude\" >> beam.Map(exclude)",
"def without_keys(keys):\n keys = frozenset(keys) # frozenset has efficient membership looku... | [
"0.832762",
"0.8284591",
"0.7660164",
"0.763909",
"0.7577073",
"0.7575485",
"0.75332195",
"0.74556494",
"0.74054796",
"0.7190924",
"0.71356505",
"0.711559",
"0.69812787",
"0.69447625",
"0.6933798",
"0.6836416",
"0.68151444",
"0.67578346",
"0.67199636",
"0.670535",
"0.6682315"... | 0.82236594 | 2 |
Compute the logistic loss between two 1dimensional tensors | def __call__(self, y1: torch.Tensor, y2: torch.Tensor) -> torch.Tensor:
return torch.log(1 + torch.exp(-y1 * y2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logistic_loss(x, y):\n N = x.shape[0]\n x_flat = np.squeeze(x)\n ex = np.exp(x_flat)\n loss = np.sum(-y*x_flat+np.log(1+ex))/N\n dx = (-y+ex/(1+ex))/N\n # dx = np.reshape(dx,(len(dx),1))\n return loss, dx",
"def loss_func(self, logits, targets):\r\n return -np.sum(targets * np.log(logits)) / lo... | [
"0.73667127",
"0.7276115",
"0.72511435",
"0.72035146",
"0.7087668",
"0.70256746",
"0.70013016",
"0.69948107",
"0.6942272",
"0.694043",
"0.6900394",
"0.6890458",
"0.6888869",
"0.68474",
"0.6840868",
"0.67284733",
"0.67221576",
"0.6688829",
"0.6672678",
"0.6661949",
"0.66361964... | 0.67374295 | 15 |
Sets the account_holder of this AggregationAccount. | def account_holder(self, account_holder):
self._account_holder = account_holder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account(self, account):\n\n self._account = account",
"def account(self, account):\n\n self._account = account",
"def account(self, account):\n\n self._account = account",
"def account(self, account):\n\n self._account = account",
"def account(self, account: str):\n s... | [
"0.6924906",
"0.6924906",
"0.6924906",
"0.6924906",
"0.6671255",
"0.62825865",
"0.6206143",
"0.6206143",
"0.61406523",
"0.6094236",
"0.59822476",
"0.5938164",
"0.5938164",
"0.5938164",
"0.5938164",
"0.5938164",
"0.5938164",
"0.5930323",
"0.5860685",
"0.58295083",
"0.5732997",... | 0.84885687 | 0 |
Sets the account_name of this AggregationAccount. | def account_name(self, account_name):
if account_name is None:
raise ValueError("Invalid value for `account_name`, must not be `None`") # noqa: E501
self._account_name = account_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_name(self, account_name):\n\n self._account_name = account_name",
"def account_name(self, account_name):\n\n self._account_name = account_name",
"def funding_account_account_name(self, funding_account_account_name):\n\n self._funding_account_account_name = funding_account_accou... | [
"0.8531283",
"0.8531283",
"0.73625",
"0.6907245",
"0.66520196",
"0.6651609",
"0.6612716",
"0.6612716",
"0.6612716",
"0.6612716",
"0.6532169",
"0.64073396",
"0.64073396",
"0.64073396",
"0.64073396",
"0.64073396",
"0.64073396",
"0.6365183",
"0.6246568",
"0.62052125",
"0.5977221... | 0.80760205 | 2 |
Sets the account_number of this AggregationAccount. | def account_number(self, account_number):
self._account_number = account_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def funding_account_account_number(self, funding_account_account_number):\n\n self._funding_account_account_number = funding_account_account_number",
"def account_amount(self, account_amount):\n\n self._account_amount = account_amount",
"def account_id(self, account_id):\n\n self._account_... | [
"0.71602434",
"0.69586164",
"0.6714518",
"0.6714518",
"0.6714518",
"0.6714518",
"0.6714518",
"0.6714518",
"0.6713965",
"0.66300505",
"0.66222477",
"0.65513325",
"0.65513325",
"0.65513325",
"0.65513325",
"0.65343106",
"0.6525909",
"0.6525909",
"0.6513819",
"0.651157",
"0.65115... | 0.8458874 | 0 |
Sets the category of this AggregationAccount. | def category(self, category):
if category is None:
raise ValueError("Invalid value for `category`, must not be `None`") # noqa: E501
self._category = category | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category... | [
"0.72488546",
"0.72488546",
"0.72488546",
"0.72488546",
"0.72488546",
"0.7141554",
"0.6977312",
"0.6924974",
"0.64782375",
"0.62679183",
"0.62516356",
"0.5956036",
"0.5926578",
"0.5888262",
"0.57670707",
"0.5694292",
"0.5654999",
"0.5566089",
"0.5539788",
"0.55187076",
"0.549... | 0.6543072 | 8 |
Sets the currency_code of this AggregationAccount. | def currency_code(self, currency_code):
self._currency_code = currency_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction_currency_code(self, transaction_currency_code):\n\n self._transaction_currency_code = transaction_currency_code",
"def card_currency(self, card_currency):\n\n self._card_currency = card_currency",
"def currency(self, currency):\n\n self._currency = currency",
"def currenc... | [
"0.71388793",
"0.652888",
"0.6388667",
"0.6388667",
"0.6388667",
"0.6388667",
"0.6275365",
"0.6244496",
"0.6107394",
"0.59897774",
"0.5983945",
"0.5983945",
"0.5983945",
"0.591998",
"0.59195846",
"0.58713216",
"0.58154637",
"0.58140785",
"0.5690212",
"0.5608463",
"0.5608463",... | 0.8090148 | 1 |
Sets the financial_offer_id of this AggregationAccount. | def financial_offer_id(self, financial_offer_id):
self._financial_offer_id = financial_offer_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marketplace_id(self, marketplace_id):\n\n self._marketplace_id = marketplace_id",
"def account_id(self, account_id):\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id... | [
"0.5447066",
"0.54168266",
"0.5382723",
"0.5382723",
"0.5382723",
"0.5382723",
"0.5382723",
"0.5382723",
"0.53303015",
"0.5329313",
"0.5329313",
"0.53122294",
"0.52502966",
"0.52336097",
"0.5228167",
"0.52234524",
"0.5196071",
"0.5146304",
"0.5146304",
"0.5140973",
"0.5139524... | 0.8436625 | 0 |
Sets the id of this AggregationAccount. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def account_id(self, account_id):\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id",
... | [
"0.70221865",
"0.7015892",
"0.6934906",
"0.6927255",
"0.6884149",
"0.6884149",
"0.6884149",
"0.6884149",
"0.6884149",
"0.6884149",
"0.68659735",
"0.67952436",
"0.66813457",
"0.6565205",
"0.6565205",
"0.6565205",
"0.6565205",
"0.6565205",
"0.65563506",
"0.65563506",
"0.6556350... | 0.0 | -1 |
Sets the institution_name of this AggregationAccount. | def institution_name(self, institution_name):
if institution_name is None:
raise ValueError("Invalid value for `institution_name`, must not be `None`") # noqa: E501
self._institution_name = institution_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bank_name(self, bank_name):\n\n self._bank_name = bank_name",
"def instrumentName(self, instrumentName):\n\n self._instrumentName = instrumentName",
"def facility_name(self, facility_name):\n\n self._facility_name = facility_name",
"def account_name(self, account_name):\n\n se... | [
"0.5938996",
"0.56928295",
"0.5605794",
"0.55565816",
"0.55565816",
"0.5502676",
"0.5432991",
"0.5284322",
"0.5204407",
"0.5204407",
"0.5195806",
"0.5135655",
"0.5091485",
"0.50777316",
"0.50777316",
"0.5073244",
"0.5073244",
"0.5067159",
"0.5032579",
"0.50145525",
"0.5014552... | 0.8017624 | 0 |
Sets the is_active of this AggregationAccount. | def is_active(self, is_active):
self._is_active = is_active | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_active(self, is_active):\n \n self._is_active = is_active",
"def is_active(self, is_active: bool):\n if is_active is None:\n raise ValueError(\"Invalid value for `is_active`, must not be `None`\")\n\n self._is_active = is_active",
"def set_active(self, active):\n ... | [
"0.7454107",
"0.71265876",
"0.69811344",
"0.6859411",
"0.68504834",
"0.6791862",
"0.6791862",
"0.6791862",
"0.6791862",
"0.6702404",
"0.66094273",
"0.6598806",
"0.6562007",
"0.6370421",
"0.63038766",
"0.62582433",
"0.62325966",
"0.62325966",
"0.62325966",
"0.62325966",
"0.610... | 0.7450062 | 4 |
Sets the is_investment of this AggregationAccount. | def is_investment(self, is_investment):
self._is_investment = is_investment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_mitigated(self, is_mitigated):\n\n self._is_mitigated = is_mitigated",
"def principal_investigator(self, principal_investigator):\n\n self._principal_investigator = principal_investigator",
"def amendment_indicator(self, amendment_indicator):\n\n self._amendment_indicator = amendmen... | [
"0.5097351",
"0.5068996",
"0.50063145",
"0.48730448",
"0.47092852",
"0.46525034",
"0.46502492",
"0.4646032",
"0.46318653",
"0.46020898",
"0.45735154",
"0.45568922",
"0.4538752",
"0.4471161",
"0.44599771",
"0.4458245",
"0.440301",
"0.4402626",
"0.43737462",
"0.43727973",
"0.43... | 0.84728205 | 0 |
Sets the secondary_id of this AggregationAccount. | def secondary_id(self, secondary_id):
self._secondary_id = secondary_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secondary_ids(self, secondary_ids):\n\n self._secondary_ids = secondary_ids",
"def secondary_id(self, value):\n self._write(MX_SECONDARY_ID, value)",
"def secondary_endpoint(self, secondary_endpoint):\n\n self._secondary_endpoint = secondary_endpoint",
"def secondary_id(self):\n ... | [
"0.6860491",
"0.65105164",
"0.5838739",
"0.5646",
"0.5629142",
"0.5629142",
"0.5517279",
"0.5298134",
"0.524187",
"0.524187",
"0.524187",
"0.524187",
"0.524187",
"0.524187",
"0.5192299",
"0.5170567",
"0.5134338",
"0.51300097",
"0.50660044",
"0.50495285",
"0.50088453",
"0.49... | 0.7990619 | 0 |
Sets the subcategory of this AggregationAccount. | def subcategory(self, subcategory):
self._subcategory = subcategory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sub_category(self, name, category_id, parent_category_id, **kwargs):\n kwargs[\"parent_category_id\"] = parent_category_id\n self.client._put(f\"/categories/{category_id}.json\", **kwargs)",
"def subgroup(self, subgroup):\n if subgroup is None:\n raise ValueError(\"Invalid... | [
"0.6567586",
"0.6106146",
"0.6010167",
"0.5866044",
"0.5787018",
"0.55635303",
"0.55635303",
"0.55635303",
"0.55635303",
"0.55635303",
"0.5546346",
"0.5489791",
"0.53721625",
"0.5330354",
"0.53196156",
"0.53196156",
"0.5306686",
"0.52605003",
"0.5117423",
"0.50916606",
"0.508... | 0.8087874 | 0 |
Sets the update_date of this AggregationAccount. | def update_date(self, update_date):
self._update_date = update_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_date(self, updated_date):\n\n self._updated_date = updated_date",
"def updated_date(self, updated_date):\n\n self._updated_date = updated_date",
"def updated_date(self, updated_date):\n self._updated_date = updated_date",
"def updated_date(self, updated_date):\n if upd... | [
"0.7028067",
"0.7028067",
"0.69888735",
"0.6127192",
"0.5768496",
"0.5695969",
"0.56914717",
"0.5615422",
"0.54885596",
"0.54544485",
"0.54544485",
"0.54544485",
"0.54544485",
"0.54544485",
"0.54544485",
"0.54544485",
"0.54544485",
"0.54544485",
"0.54544485",
"0.5358629",
"0.... | 0.7637999 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, AggregationAccount):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Compute the propellers' RPMs for the target state, given the current state. | def compute_control(self,
current_position,
current_quaternion,
current_velocity,
current_angular_velocity,
target_position,
target_velocity=np.zeros(3),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recalculateBPT(self) -> None:\n # First do all calculations that are relating to the generators\n generators = self.getGenerators()\n\n new_bpt = 0\n for generator in generators:\n bpt = generator[\"BPT\"]\n amount = generator[\"amount\"]\n new_bpt =... | [
"0.5776805",
"0.56187654",
"0.5562017",
"0.5546919",
"0.54127926",
"0.53492814",
"0.53231275",
"0.5300642",
"0.5271428",
"0.5269524",
"0.52555203",
"0.5238739",
"0.5231703",
"0.5211316",
"0.5209404",
"0.5194866",
"0.51925224",
"0.51744086",
"0.5174335",
"0.5152968",
"0.513542... | 0.0 | -1 |
Return True if subscribed to this medium/source combination. | def is_subscribed(self, source, medium, entity, subentity_kind=None):
if subentity_kind is None:
return self._is_subscribed_individual(source, medium, entity)
else:
return self._is_subscribed_group(source, medium, entity, subentity_kind) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_subscribed(self) -> bool:\n return bool(self._subscriptions)",
"def _is_subscribed_individual(self, source, medium, entity):\n super_entities = entity.super_relationships.all().values_list('super_entity')\n entity_is_subscribed = Q(subentity_kind__isnull=True, entity=entity)\n ... | [
"0.73627967",
"0.69143784",
"0.68922627",
"0.67649895",
"0.65634066",
"0.65466535",
"0.65386415",
"0.65123314",
"0.6453093",
"0.6344606",
"0.6293652",
"0.6268312",
"0.62414736",
"0.61606604",
"0.61563706",
"0.61312485",
"0.60808045",
"0.5965283",
"0.5951208",
"0.5920487",
"0.... | 0.64922965 | 8 |
Return true if an entity is subscribed to that source/medium combo. | def _is_subscribed_individual(self, source, medium, entity):
super_entities = entity.super_relationships.all().values_list('super_entity')
entity_is_subscribed = Q(subentity_kind__isnull=True, entity=entity)
super_entity_is_subscribed = Q(subentity_kind=entity.entity_kind, entity__in=super_entit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_subscribed_group(self, source, medium, entity, subentity_kind):\n all_group_sub_entities = entity.sub_relationships.select_related('sub_entity').filter(\n sub_entity__entity_kind=subentity_kind\n ).values_list('sub_entity')\n related_super_entities = EntityRelationship.objec... | [
"0.7469926",
"0.72573686",
"0.7074537",
"0.6418469",
"0.6417108",
"0.6218657",
"0.60834473",
"0.6046867",
"0.6036681",
"0.60346395",
"0.6033711",
"0.60305303",
"0.59133565",
"0.59072524",
"0.59002316",
"0.58361083",
"0.58039796",
"0.5787606",
"0.5756602",
"0.5723546",
"0.5703... | 0.7970441 | 0 |
Utility function to convert dict to a list object | def dictToList(dict):
return map(lambda x: x[0], dict.iterkeys())
# [x[0] for x in dict.iterkeys()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_to_list(dict: Dict, name_key: str = \"name\", value_key: str = \"value\"):\n if not is_dict(dict):\n raise AttributeError(\n \"Argument must be a dictionary, invalid argument received '{}'.\".format(\n dict\n )\n )\n\n list = []\n\n for key, val ... | [
"0.79184854",
"0.78315353",
"0.77300966",
"0.76776123",
"0.7634673",
"0.73632056",
"0.73497635",
"0.72802705",
"0.7248395",
"0.7179507",
"0.7135971",
"0.71098083",
"0.71098083",
"0.71079075",
"0.70322603",
"0.69594324",
"0.68989635",
"0.6843161",
"0.6761351",
"0.6738432",
"0.... | 0.69449604 | 16 |
Instantiates Selenium WebDriver and Chrome instance. Chrome is headless or not | def __init__(self):
# instantiates class logger
self.m_logger = logging.getLogger('BrowserDriver')
# create members so that they exist in __init__. In fact their real instantiation is in login_as_scrape()
self.m_creationDate = datetime.datetime.now(tz=pytz.utc)
self.m_expiration... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_chrome_driver(headless):\n #initialise chrome options\n options = ChromeOptions()\n #set headless option on driver\n options.headless = headless\n #initialise driver\n driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)\n return driver",
"def load_chrome_d... | [
"0.81668353",
"0.7849356",
"0.77846044",
"0.77780116",
"0.77614725",
"0.7665669",
"0.7638293",
"0.75628316",
"0.75537574",
"0.75337976",
"0.7520328",
"0.7505075",
"0.7442266",
"0.72529954",
"0.72291136",
"0.7180246",
"0.715662",
"0.7136139",
"0.7109921",
"0.7098185",
"0.70526... | 0.6067454 | 78 |
Change player of the game. | def change_player(value: Tuple[Any, int], player: str) -> None:
selected, index = value
print(f'Selected player: "{selected}" ({player}) at index {index}')
PLAYER[0] = player | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_player(self, new_player):\n self.player = new_player",
"def switch_player(self):\n self.player = Nim.other_player(self.player)",
"def switchPlayer(self):\n self.player = Nim.otherPlayer(self.player)",
"def change_player(self):\n if self.__root.children is None:\n ... | [
"0.85088545",
"0.8482292",
"0.82166225",
"0.80544436",
"0.779732",
"0.77649176",
"0.7410997",
"0.7406438",
"0.7184081",
"0.71748734",
"0.71748734",
"0.71107703",
"0.6973077",
"0.6962489",
"0.6952246",
"0.6902073",
"0.68362105",
"0.6783613",
"0.6781193",
"0.6693374",
"0.664540... | 0.6971278 | 13 |
Returns a list of unspent transaction inputs in the wallet | def list_unspent(litecoinaddress, min_conf=1, max_conf=99999999):
min_conf = str(min_conf)
max_conf = str(max_conf)
a = [litecoinaddress]
try:
stdout = subprocess.check_output(["litecoin-cli", "listunspent", min_conf, max_conf, json.dumps(a)])
unspent = json.loads(stdout.decode())
ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listunspent(self, minconf=1, maxconf=999999):\n return [TransactionInfo(**tx) for tx in\n self.proxy.listunspent(minconf, maxconf)]",
"def get_wallet_utxos(rpc_user, rpc_pwd):\n data = '{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"method\":\"listunspentcoins\"}'\n return call_rpc(rpc_user,... | [
"0.7140887",
"0.6816929",
"0.6552434",
"0.6360092",
"0.63267684",
"0.6296591",
"0.6198887",
"0.61820614",
"0.6140737",
"0.6122582",
"0.6118104",
"0.6111352",
"0.5980861",
"0.58738786",
"0.5858009",
"0.5787929",
"0.57647544",
"0.56986237",
"0.56699467",
"0.55791104",
"0.554443... | 0.61405736 | 9 |
Returns the balance for litecoinaddress | def get_address_balance(litecoinaddress):
total_balance = 0
unspent = list_unspent(litecoinaddress)
for block in unspent:
total_balance += float(block["amount"])
return total_balance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(self, address):\n balance = 0\n for block in self.chain:\n for t in block['transactions']:\n if t['recipient'] == address:\n balance += t['amount']\n elif t['sender'] == address:\n balance -= t['amount']\n ... | [
"0.7711186",
"0.7699477",
"0.7616533",
"0.72856987",
"0.7274785",
"0.7060863",
"0.6971426",
"0.6923127",
"0.6680456",
"0.6627595",
"0.66212493",
"0.6599131",
"0.659477",
"0.6551434",
"0.65255404",
"0.65177476",
"0.6513604",
"0.65034276",
"0.64847016",
"0.6483719",
"0.63952076... | 0.8466337 | 0 |
Returns the balance in the account. | def get_account_balance(account):
balance = 0
for address in get_addresses_by_account(account):
balance += get_address_balance(address)
return float(balance) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(self):\n return self._call_account_method(\n 'getBalance'\n )",
"def get_account_balance(self):\n return int(self.request('get', 'fort/accounts')['balance'])",
"def balance(self):\n return self.selectedAccount.balance",
"def account_balance(self):\n ... | [
"0.9109696",
"0.8955735",
"0.8783172",
"0.873993",
"0.8614841",
"0.8614841",
"0.85886765",
"0.85573524",
"0.85556316",
"0.8521406",
"0.8441863",
"0.8417558",
"0.83927006",
"0.8383246",
"0.83819866",
"0.83375466",
"0.8330962",
"0.8283836",
"0.82716376",
"0.82374823",
"0.812889... | 0.78636056 | 31 |
Remove the parentheses and hyphens from a song name. | def remove_extra(name):
return re.sub(r"-[\S\s]*", "", re.sub(r"\([\w\W]*\)", "", name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_name(name):\n return PUNCT_RE.sub('-', name.lower()).strip('-')",
"def sanitize_name(name: str) -> str:\n return re.sub(r\"[^A-Za-z0-9_-]\", \"-\", name)[0:128]",
"def sanitize_name(name):\n # For now just change dashes to underscores. Fix this more in the future\n return name.replace... | [
"0.70703393",
"0.70367986",
"0.7035329",
"0.70162845",
"0.6974878",
"0.6958907",
"0.684572",
"0.6767284",
"0.67154896",
"0.66887105",
"0.6685595",
"0.6648311",
"0.658791",
"0.6556827",
"0.6536671",
"0.65230227",
"0.65006196",
"0.64723617",
"0.64384997",
"0.6431085",
"0.642351... | 0.7115448 | 0 |
A `input_fn` returning features and labels. | def _input_fn(params):
# Retrieves the batch size for the current shard. The # of shards is
# computed according to the input pipeline deployment. See
# `tf.contrib.tpu.RunConfig` for details.
batch_size = params['batch_size']
inputs, labels, lengths = sequence_example_lib.get_padded_batch(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_input_fn(self) -> types.FeatureAndLabelTensors:\n return self._input_fn_from_file(self._train_path)",
"def _input_fn(params):\n batch_size = params['batch_size']\n inputs, labels, lengths = sequence_example_lib.get_fake_data_batch(\n batch_size, input_size, padding_length)\n\n featur... | [
"0.754075",
"0.7477171",
"0.74368423",
"0.742067",
"0.71742415",
"0.7124143",
"0.7107588",
"0.7039249",
"0.7015979",
"0.7001931",
"0.7000006",
"0.6968949",
"0.68859965",
"0.68649995",
"0.6848503",
"0.6828859",
"0.6823528",
"0.68101823",
"0.67985994",
"0.67934674",
"0.67358327... | 0.69833744 | 11 |
A `input_fn` returning features and labels. | def _input_fn(params):
batch_size = params['batch_size']
inputs, labels, lengths = sequence_example_lib.get_fake_data_batch(
batch_size, input_size, padding_length)
features = {
'inputs': inputs,
'lengths': lengths
}
return features, labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_input_fn(self) -> types.FeatureAndLabelTensors:\n return self._input_fn_from_file(self._train_path)",
"def input_fn(params, is_training):\n features = tf.constant(0)\n labels = tf.constant(0)\n\n return features, labels",
"def input_fn():\n features = {\n feature_name: t... | [
"0.754075",
"0.74368423",
"0.742067",
"0.71742415",
"0.7124143",
"0.7107588",
"0.7039249",
"0.7015979",
"0.7001931",
"0.7000006",
"0.69833744",
"0.6968949",
"0.68859965",
"0.68649995",
"0.6848503",
"0.6828859",
"0.6823528",
"0.68101823",
"0.67985994",
"0.67934674",
"0.6735832... | 0.7477171 | 1 |
Normalizes X into the 0.5, 0.5 range. | def minmax_normalize(X):
# X -= X.min()
# X /= X.max()
# X -= 0.5
X = (X-X.min()) / (X.max() - X.min())
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(x):\n # TODO: Implement Function\n data_max = np.max(x)\n data_min = np.min(x)\n x = (x - data_min) / (data_max - data_min)\n return x",
"def normalization(x, x_min=-5.12, x_max=5.12):\n for i in range(len(x.vect)):\n x.vect[i] = x_min + x.vect[i]*(x_max-x_min)\n return ... | [
"0.7771135",
"0.75992376",
"0.7551736",
"0.7547507",
"0.7512404",
"0.74885225",
"0.7394593",
"0.7393532",
"0.724465",
"0.724465",
"0.72432923",
"0.7223587",
"0.7214084",
"0.72109354",
"0.718745",
"0.7170745",
"0.71423274",
"0.71203613",
"0.70543194",
"0.70311123",
"0.70311123... | 0.75293523 | 4 |
Does Non Max Suppression given bboxes | def nms(bboxes, iou_threshold, threshold, box_format="corners"):
assert type(bboxes) == list
bboxes = [box for box in bboxes if box[1] > threshold]
bboxes = sorted(bboxes, key=lambda x: x[1], reverse=True)
bboxes_after_nms = []
while bboxes:
chosen_box = bboxes.pop(index=0)
bboxes = [box for box in bboxes
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_max_suppression(bboxes, iou_threshold, threshold, box_format=\"corners\"):\n\n # 49 x 6 \n assert type(bboxes) == list\n # print(bboxes)\n bboxes = [box for box in bboxes if box[1] > threshold]\n bboxes = sorted(bboxes, key=lambda x: x[1], reverse=True)\n bboxes_after_nms = []\n # prin... | [
"0.7529383",
"0.71505386",
"0.7068207",
"0.68700755",
"0.66532415",
"0.6589723",
"0.6535061",
"0.64538574",
"0.6422521",
"0.6403534",
"0.6393737",
"0.6314318",
"0.63047516",
"0.6272402",
"0.62160397",
"0.61747664",
"0.6077163",
"0.6019672",
"0.5983947",
"0.59781563",
"0.59757... | 0.634647 | 11 |
Pad text with character, treating ANSI escape sequences as zero width | def pad_ansi(text, width, char, left=False):
current_width = len(ANSI_PATTERN.sub('', text))
parts = [text, (width - current_width) * char]
if left:
parts = reversed(parts)
return ''.join(parts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(text, width, pad_character=\" \"):\n\n length = len(text)\n if width < 0 and length < -width:\n return text + (-width - length) * pad_character\n elif width > 0 and length < width:\n return (width - length) * pad_character + text\n else:\n return text",
"def add_padding(s... | [
"0.73150593",
"0.7059062",
"0.6732868",
"0.67187804",
"0.6615262",
"0.6600697",
"0.6529842",
"0.65296227",
"0.6500602",
"0.6477309",
"0.64648044",
"0.6409835",
"0.624386",
"0.6237719",
"0.6234958",
"0.6218235",
"0.6185038",
"0.61723506",
"0.615966",
"0.6159123",
"0.6120037",
... | 0.82812154 | 0 |
What happens if ~/.azure is empty | def test_empty_azure_config_dir():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_azure_cloud_config(mp_config_file):\n with custom_mp_config(mp_config_file):\n az_config = AzureCloudConfig()\n check.equal(az_config.cloud, \"global\")\n check.is_in(\"env\", az_config.auth_methods)\n check.is_in(\"msi\", az_config.auth_methods)\n check.is_in(\"cli\", az_config.auth... | [
"0.56525844",
"0.55135584",
"0.5395982",
"0.53500265",
"0.53271735",
"0.5318726",
"0.5263498",
"0.5259756",
"0.5251716",
"0.52478904",
"0.5229304",
"0.5199787",
"0.51650083",
"0.5117374",
"0.51080805",
"0.5083474",
"0.5016934",
"0.5015275",
"0.49819854",
"0.49533382",
"0.4944... | 0.72771066 | 0 |
Initiate weights and biases of a twolayer NN model. | def init_benchmark_model(
input_size, hidden_size, num_classes, rand_seed=None,
**kwargs
):
rs = np.random.RandomState(seed=rand_seed)
model = {}
D, H, C = input_size, hidden_size, num_classes
model['W1'] = rs.rand(D, H)
model['b1'] = rs.rand(H)
model['W2'] = rs.rand(H, C)
model['b2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weight(self):\n init_layer(self.conv1)\n init_layer(self.conv2)\n init_bn(self.norm1)\n init_bn(self.norm2)",
"def init_weights(model):\n ...",
"def init_two_layer_model(input_size, hidden_size, output_size):\n # initialize a model\n model = {}\n model['W1']... | [
"0.73397094",
"0.72905093",
"0.71707326",
"0.7106496",
"0.7020638",
"0.70197505",
"0.69642586",
"0.6882098",
"0.68305355",
"0.68139184",
"0.6799241",
"0.67788005",
"0.6765046",
"0.6742682",
"0.67080957",
"0.67036754",
"0.6689718",
"0.6672929",
"0.6672302",
"0.66707325",
"0.66... | 0.0 | -1 |
The content of the rc_file. | def rc_file_text(rc_file_args):
return yaml.dump(rc_file_args, Dumper=Dumper) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_content(self):\n return self.file.read()",
"def _get_file_content(self):\n with open(self.file_name, mode='rb') as file:\n self.file_content = file.read()",
"def get_contents(self):\n with closing(self.open()) as handle:\n return handle.read()",
"def conten... | [
"0.72386634",
"0.6774665",
"0.67209566",
"0.6697371",
"0.66879237",
"0.6669324",
"0.65156746",
"0.63755214",
"0.6356878",
"0.6340705",
"0.6326233",
"0.6320554",
"0.6294522",
"0.6279988",
"0.62730396",
"0.6269665",
"0.6256518",
"0.6238862",
"0.6225016",
"0.6215008",
"0.6207343... | 0.60009426 | 32 |
Given a partially filled np array (valid column count, but less than 22 rows), this utility method fills the state the rest of the way. | def generate_valid_state(state):
height, width = state.shape
assert width == Field.WIDTH
return np.vstack([
np.full((Field.HEIGHT - height, width), 0, dtype=np.uint8),
state,
]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fillingrid(self):\n\n if self.imagearray is None:\n if self.gs.isfixed:\n for n in range(0, self.numcols):\n self.vspins[n].setValue(self.currentvalues[n])\n elif self.gs.isperc:\n for n in range(0, self.numcols):\n ... | [
"0.5919509",
"0.59103376",
"0.57226",
"0.5703246",
"0.5658327",
"0.5596019",
"0.55945796",
"0.55218744",
"0.54737306",
"0.5458633",
"0.54267544",
"0.5423887",
"0.537788",
"0.53699356",
"0.5342563",
"0.53341424",
"0.5295545",
"0.5292082",
"0.52698135",
"0.5268607",
"0.5260933"... | 0.5169968 | 28 |
Uses action to obtain next state, reward, done. | def step(self, rotor_speeds):
reward = 0
pose_all = []
for _ in range(self.action_repeat):
previous_pos=self.sim.pose[:3] # pose of the copter before applying the rotor_speeds; We will only use the x,y,z coordinates
done = self.sim.next_timestep(rotor_speeds) # update the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, action):\n possible_states, probs = zip(*self.get_next_states(self._current_state, action).items())\n next_state = weighted_choice(possible_states, p=probs)\n reward = self.get_reward(self._current_state, action, next_state)\n is_done = self.is_terminal(next_state)\n ... | [
"0.8107008",
"0.80822814",
"0.79322904",
"0.7890215",
"0.7873637",
"0.78711975",
"0.7752803",
"0.7744573",
"0.7679886",
"0.76718366",
"0.76401633",
"0.7632102",
"0.76127946",
"0.76031494",
"0.7581104",
"0.75581264",
"0.75561917",
"0.753357",
"0.75242126",
"0.7513636",
"0.7492... | 0.0 | -1 |
r""" Returns a dictionary containing ALL pore data from all netowrk and/or phase objects received as arguments | def amalgamate_data(objs=[], delimiter='_'):
if type(objs) is not list:
objs = list(objs)
data_amalgamated = {}
dlim = delimiter
exclusion_list = ['pore.centroid', 'pore.vertices', 'throat.centroid',
'throat.offset_vertices', 'throat.vertices', 'throat.normal',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variables():\n policer_data = {\n \"policer_data\": {\n \"name\": \"policy1\",\n \"cir\": 450,\n \"cb\": 50000,\n \"rate-type\": \"kbps\",\n \"round-type\": \"closest\",\n \"type\": \"1r2c\",\n \"conform-action\": {\n ... | [
"0.5974678",
"0.5821198",
"0.5745917",
"0.5739407",
"0.5672095",
"0.5581523",
"0.5578456",
"0.55391955",
"0.5414546",
"0.5410114",
"0.5405513",
"0.5392099",
"0.5380054",
"0.53719944",
"0.5358579",
"0.535784",
"0.5347108",
"0.5339806",
"0.5322268",
"0.53221494",
"0.5301466",
... | 0.0 | -1 |
Get null Boolean value. | async def get_null(self, **kwargs: Any) -> Optional[bool]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_null(self):\n return self.value is None",
"def allow_null_values(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"allow_null_values\")",
"def allow_null_values(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"allow_null_values\")",
"def get_boo... | [
"0.74350286",
"0.71980995",
"0.71458703",
"0.705052",
"0.7013555",
"0.69958496",
"0.6968041",
"0.6968041",
"0.6968041",
"0.6968041",
"0.6968041",
"0.6959913",
"0.6933754",
"0.6911359",
"0.6847203",
"0.67280614",
"0.6721219",
"0.6706624",
"0.66830575",
"0.66720784",
"0.664851"... | 0.0 | -1 |
Returns a string representation of a message. | def __unicode__(self):
return "'" + self.text + "' logged on " + log_date.strftime('%a, %d, %B, %Y at %X') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return self.message.as_string()",
"def message(self) -> str:\n return typing.cast(\n str,\n self._properties.get(\"message\"),\n )",
"def message(self) -> str:\n return self.fields.get('msg', self.raw_string)",
"def __str__ (self):\n\n ... | [
"0.7643055",
"0.760663",
"0.75257295",
"0.7401041",
"0.7224426",
"0.7207394",
"0.7197409",
"0.7174652",
"0.7174652",
"0.7141438",
"0.7141438",
"0.7141438",
"0.7141438",
"0.7141438",
"0.7141438",
"0.7136344",
"0.71200395",
"0.71200395",
"0.71200395",
"0.71200395",
"0.71200395"... | 0.0 | -1 |
Filter Description based on description keyword. | def description(self, operator: Enum, description: list | str):
if isinstance(description, list) and operator not in self.list_types:
raise RuntimeError(
'Operator must be CONTAINS, NOT_CONTAINS, IN'
'or NOT_IN when filtering on a list of values.'
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_by_description(cls, description):\n api = BuslineAPI()\n try:\n objects = api.filter_by_description(description)\n except ApiException:\n objects = cls.objects.filter(description__startswith=description)\n\n return objects",
"def _description_filter(se... | [
"0.72910744",
"0.6737357",
"0.6421571",
"0.6058544",
"0.5966701",
"0.56998295",
"0.56963193",
"0.56778526",
"0.56636345",
"0.56406564",
"0.55873966",
"0.5537824",
"0.55292904",
"0.55285573",
"0.5493067",
"0.54706013",
"0.5447359",
"0.54468805",
"0.54079825",
"0.53593236",
"0.... | 0.635064 | 4 |
Filter Associated Group based on hasGroupAttribute keyword. | def has_group_attribute(self, operator: Enum, has_group_attribute: int | list):
if isinstance(has_group_attribute, list) and operator not in self.list_types:
raise RuntimeError(
'Operator must be CONTAINS, NOT_CONTAINS, IN'
'or NOT_IN when filtering on a list of value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self):\n new = self.copy()\n new._filter = [\"groups\"]\n return new",
"def groupfilter(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"groupfilter\")",
"def groupfilter(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"groupfilter... | [
"0.6293052",
"0.61592096",
"0.61592096",
"0.5857845",
"0.5853963",
"0.583097",
"0.58033013",
"0.5696321",
"0.5584365",
"0.55672073",
"0.5535851",
"0.5465301",
"0.5465269",
"0.54211557",
"0.5398379",
"0.5343377",
"0.5271181",
"0.5253097",
"0.52527404",
"0.52527404",
"0.5233976... | 0.6256147 | 1 |
Copies the first n items from q. | def copydeck(self, q, n):
tmp = q.copy()
return deque(reversed([tmp.pop() for _ in range(n)])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take(self, n): # noqa: N805\n return List(_islice(self, n))",
"def take(n, seq):\n return itertools.islice(seq, n)",
"def take(n, iterable):\n return list(islice(iterable, n))",
"def take(n, iterable):\n return list(islice(iterable, n))",
"def take(iterable, n):\n return list(iterto... | [
"0.64387465",
"0.6300363",
"0.6298109",
"0.6298109",
"0.6225375",
"0.619442",
"0.61891025",
"0.61891025",
"0.59269166",
"0.5898483",
"0.5890745",
"0.5890017",
"0.58869463",
"0.5769344",
"0.5731915",
"0.5716537",
"0.5715462",
"0.5715462",
"0.568876",
"0.5663788",
"0.5588568",
... | 0.72947156 | 0 |
Find a group for val and add it there. A group key is calculated by group_by. If no such key exists, a new group is created. If a formatting key was not found for val, | def update(self, val):
try:
key = self._group_by(val)
except lena.core.LenaKeyError:
raise lena.core.LenaValueError(
"could not find a key for {}".format(val)
)
if key in self.groups:
self.groups[key].append(val)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_group(self, _groupby):\n # forces a `__getitem__`, which in turn calls `__missing__`\n # the first time we try to insert a value\n def do_append(key, group):\n self[key].send(group)\n appender = yield from starmap(do_append, _groupby)",
"def add_group(self, key):... | [
"0.62460804",
"0.5931766",
"0.5929217",
"0.5738482",
"0.55488914",
"0.5493878",
"0.53995466",
"0.53692806",
"0.5329505",
"0.524783",
"0.5219613",
"0.51948535",
"0.51936805",
"0.5187539",
"0.5174229",
"0.5158574",
"0.51375973",
"0.5133945",
"0.51203275",
"0.5119256",
"0.508099... | 0.72430766 | 0 |
Performs ResNetstyle weight initialization. | def init_weights(m):
if isinstance(m, nn.Conv2d):
# Note that there is no bias due to BN
fan_out = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(mean=0.0, std=math.sqrt(2.0 / fan_out))
elif isinstance(m, nn.BatchNorm2d):
zero_init_gamma = cfg.BN.ZERO_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weight(self):\n init_layer(self.conv1)\n init_layer(self.conv2)\n init_bn(self.norm1)\n init_bn(self.norm2)",
"def init_weight(self):\n init_bn(self.norm0)",
"def _initialize_weights(self):\n pass",
"def init_weights(model):\n ...",
"def init_weight... | [
"0.79430866",
"0.7930602",
"0.78607583",
"0.7798889",
"0.77401495",
"0.76641744",
"0.7662896",
"0.7567101",
"0.74287575",
"0.7413079",
"0.73909485",
"0.7377951",
"0.73493147",
"0.73207176",
"0.7318793",
"0.72907203",
"0.726746",
"0.7248521",
"0.7204027",
"0.7199431",
"0.71977... | 0.0 | -1 |
Sets all model weights from a single flat vector. | def set_flat_weights(model, flat_weights):
k = 0
for p in model.parameters():
n = p.data.numel()
p.data.copy_(flat_weights[k : (k + n)].view_as(p.data))
k += n
assert k == flat_weights.numel() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_weights(self, weights):\r\n self.weights = weights.reshape(self.output_size, self.input_size+1)",
"def set_weights(self, weights):\n self.forcing_term.weights_[:, :] = weights.reshape(*self.forcing_term.shape)",
"def set_weights(self, weights):\n tuples = []\n for layer in self.lay... | [
"0.7298198",
"0.72855574",
"0.7152028",
"0.71171165",
"0.7112108",
"0.7080838",
"0.70481706",
"0.70481706",
"0.70098025",
"0.6777375",
"0.6718739",
"0.67022854",
"0.6671261",
"0.6660021",
"0.66521096",
"0.66359806",
"0.6623057",
"0.6608641",
"0.6599572",
"0.6599149",
"0.65855... | 0.7406195 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.