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 |
|---|---|---|---|---|---|---|
r""" Residual block feedforward function. | def forward(self, x, y=None):
if y is None:
return self._residual(x) + self._shortcut(x)
else:
return self._residual_conditional(x, y) + self._shortcut(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residual_block(blockInput, nf, strides=1, batch_activate=False):\n x = BatchActivate(blockInput)\n x = res_conv_block(x, nf)\n x = res_conv_block(x, nf, activation=False)\n x = Add()([x, blockInput])\n if batch_activate:\n x = BatchActivate(x)\n return x",
"def _residual_block(block_... | [
"0.69615436",
"0.67793983",
"0.67770344",
"0.6583952",
"0.6431967",
"0.6422031",
"0.6375946",
"0.63339376",
"0.63120043",
"0.6294257",
"0.6290082",
"0.62768304",
"0.6256055",
"0.6236031",
"0.61448026",
"0.6122398",
"0.6102006",
"0.60651815",
"0.60376287",
"0.6029394",
"0.5989... | 0.0 | -1 |
Return the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '%s' % (self.name)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.83421856",
"0.82273436",
"0.80990887",
"0.8067676",
"0.80525744",
"0.8043721",
"0.7993416",
"0.7992513",
"0.7992513",
"0.7992513",
"0.7978309",
"0.7963202",
"0.7957057",
"0.79399455",
"0.7936728",
"0.79338795",
"0.79154027",
"0.7901051",
"0.7892942",
"0.787005",
"0.7855431... | 0.0 | -1 |
perm_check() > Check if the user who as executed a command have authorization. | async def perm_check(ctx,roles_list: List[int]):
for n,role in enumerate(ctx.author.roles):
# If authorized
if role.id in roles_list:
return "pass"
# Not authorized
if n == len(ctx.author.roles) - 1:
return await ctx.send(embed=Embe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perms_check(self, ctx):\r\n\t\tcommand = ctx.invoked_with\r\n\t\ttry:\r\n\t\t\tif config.cfg[\"main\"][\"perms\"][command] in [x.id for x in ctx.author.roles]:\r\n\t\t\t\treturn True\r\n\t\t\treturn False\r\n\t\texcept KeyError:\r\n\t\t\tif config.cfg[\"main\"][\"perms\"][\"global\"] in [x.id for x in ctx.auth... | [
"0.8110612",
"0.75949496",
"0.7384209",
"0.7299251",
"0.72473043",
"0.7178368",
"0.7146501",
"0.7146501",
"0.702873",
"0.702873",
"0.70260715",
"0.6977172",
"0.69418925",
"0.6894713",
"0.685206",
"0.6832087",
"0.67590684",
"0.6751482",
"0.6751482",
"0.67503476",
"0.67470944",... | 0.0 | -1 |
Best and Worst of every month based on the index. | def stats_of_the_month() -> None:
def plot(winners: dict, losers: dict):
win = [(name, len(winners[name])) for name in winners]
win.sort(key=lambda x: x[1], reverse=True)
names, n_win = zip(*win)
lose = [(name, len(losers[name])) for name in names]
_, n_lose = zip(*lose)
plot_height = max(max(n_win), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def six_best_months():\n if not monthly_averages:\n return [('', 0.0), ('', 0.0), ('', 0.0), ('', 0.0), ('', 0.0), ('', 0.0)]\n monthly_averages.sort(key=operator.itemgetter(1),reverse=True)\n return monthly_averages[:6]",
"def hottest_summer(df) -> int:\n df['summer_max'] = df[['JUN', 'JUL', ... | [
"0.6027857",
"0.57697767",
"0.57555354",
"0.5699591",
"0.5654285",
"0.56463224",
"0.5612218",
"0.56066173",
"0.5551553",
"0.5522675",
"0.54617965",
"0.5420659",
"0.53914595",
"0.5364434",
"0.5318282",
"0.5314205",
"0.52997357",
"0.5294333",
"0.5258946",
"0.5245796",
"0.521957... | 0.0 | -1 |
return an array with the potential energy of each vibrational mode | def potential_energy_per_mode(proj_displ,eigvals): #,hess=None,check=False):
return 0.5 * ( np.square(proj_displ).T * eigvals ).T #, 0.5 * proj_displ * omega_sqr @ proj_displ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_energies(self):\n N = len(self.particles)\n\n # Use C++ version if cppenabled\n if(self.cppenabled):\n energies = np.zeros(3) # Initialises Energy output array\n accelerate_lib.c_getenergies(self.get_positions(), self.get_velocities(), \\\n energi... | [
"0.6695905",
"0.6671114",
"0.6595116",
"0.65595806",
"0.6420484",
"0.6365195",
"0.63646233",
"0.6232684",
"0.6195662",
"0.61785346",
"0.6174897",
"0.6168648",
"0.61465585",
"0.61130744",
"0.611123",
"0.61097294",
"0.6092819",
"0.60926557",
"0.6084695",
"0.60779285",
"0.607791... | 0.6295748 | 7 |
This context processor injects django settings to the template | def settings(request):
return {"SETTINGS": django_settings, "GLOBAL_DEFINITIONS": global_definitions} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_context(request):\n context = {\n 'application_version': settings.APPLICATION_VERSION,\n }\n context.update(settings.STATIC_CONTEXT_VARS)\n return context",
"def settings_context(_request):\n # Note: we intentionally do NOT expose the entire settings\n # to prevent accidenta... | [
"0.7122978",
"0.7052695",
"0.68775123",
"0.6744211",
"0.65725315",
"0.64357424",
"0.64346075",
"0.64346075",
"0.64346075",
"0.6382995",
"0.63815904",
"0.62982184",
"0.623793",
"0.62288404",
"0.62156856",
"0.6212769",
"0.6185692",
"0.61812425",
"0.61459804",
"0.61198366",
"0.6... | 0.67348707 | 4 |
Get details of Networks. | def getNetworksDetails(network_id):
logger.debug('Start.')
code, res = rest_requests.get(networks_url + "/" + network_id)
if code != requests.codes.ok:
logger.error((code, res))
return None
return res["network"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_networks(self):\n url = '%s/v2.0/networks' % self.catalog['network']\n res = self.get(url)\n if res['status'] == 200:\n return json.loads(res['body'])['networks']\n else:\n LOG.error('Get networks failed: %s %s %s' %\n (res['status'], r... | [
"0.79475105",
"0.7771547",
"0.77406645",
"0.7674905",
"0.74859476",
"0.7374023",
"0.72700226",
"0.6985122",
"0.6958722",
"0.6953681",
"0.6927945",
"0.68963015",
"0.68831235",
"0.68009484",
"0.67908955",
"0.67834264",
"0.67418176",
"0.6720521",
"0.6691564",
"0.66847247",
"0.66... | 0.71055424 | 7 |
true if the logged in user is a barcamp admin | def is_admin(self):
if self.user is None:
return False
if unicode(self.user._id) in self.barcamp.admins:
return True
if self.user.is_admin:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self):\n if self.is_main_admin:\n return True\n if self.user is not None and self.barcamp is not None:\n if unicode(self.user._id) in self.barcamp.admins:\n return True\n return False",
"def is_admin(self):\n if not self.current_user:\... | [
"0.83883846",
"0.79494977",
"0.7751907",
"0.7716503",
"0.7696871",
"0.7695911",
"0.76617527",
"0.7600467",
"0.75899273",
"0.75611526",
"0.75224066",
"0.748795",
"0.7478665",
"0.7475087",
"0.7439486",
"0.743928",
"0.74124193",
"0.7380807",
"0.73783004",
"0.73772204",
"0.730812... | 0.8392431 | 0 |
this is True if the user is an admin and there are less than 3 pages for the menu slot | def can_add_menu_page(self):
if not self.is_admin:
return False
return self.config.dbs.pages.for_slot("menu", barcamp=self.barcamp).count() < 3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_admin():\n\tif not current_user.is_admin:\n\t\tabort(403)",
"def allowed(self):\n may = self.request.user.may\n return (not self.__class__.__name__ in self.request.cfg.actions_excluded and\n may.write(self.pagename))",
"def check_admin():\r\n if not current_user.is_adm... | [
"0.63259757",
"0.6275597",
"0.6174168",
"0.61596054",
"0.6156467",
"0.60907745",
"0.6077263",
"0.6077263",
"0.6069751",
"0.60680157",
"0.60671127",
"0.6050176",
"0.60369974",
"0.6024235",
"0.6023522",
"0.59934914",
"0.59766316",
"0.5964952",
"0.5964752",
"0.5963825",
"0.59573... | 0.7944941 | 0 |
true if the logged in user is a main admin | def is_main_admin(self):
if self.user is None:
return False
return self.user.has_permission("admin") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self):\n if not self.current_user:\n return False\n else:\n return self.current_user in [\"1\"]",
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"def is_current_user_admin():\n return (os.environ.get('USER_IS... | [
"0.85164595",
"0.82871264",
"0.8235407",
"0.82319146",
"0.8216897",
"0.8151709",
"0.8142257",
"0.81410295",
"0.81280077",
"0.80545837",
"0.8048427",
"0.8015066",
"0.8005023",
"0.79673415",
"0.7958993",
"0.79073346",
"0.7896765",
"0.7865162",
"0.7865162",
"0.784732",
"0.783932... | 0.8916181 | 0 |
check if the given user is a barcamp admin | def is_admin(self):
if self.is_main_admin:
return True
if self.user is not None and self.barcamp is not None:
if unicode(self.user._id) in self.barcamp.admins:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self):\n if self.user is None:\n return False\n if unicode(self.user._id) in self.barcamp.admins:\n return True\n if self.user.is_admin:\n return True\n return False",
"def user_is_admin(user):\n return user in admins",
"def is_admin(... | [
"0.8017001",
"0.78052306",
"0.7767001",
"0.77324444",
"0.7699661",
"0.76618487",
"0.76551867",
"0.756769",
"0.75313574",
"0.7387065",
"0.738372",
"0.7382385",
"0.7361565",
"0.7352563",
"0.7345461",
"0.7327134",
"0.7292621",
"0.7283152",
"0.7274014",
"0.72688115",
"0.72538525"... | 0.7920938 | 1 |
strip all html tags from the html string | def strip_tags(self, html):
s = MLStripper()
s.feed(html)
return s.get_data() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_html_tags(self,text):\n #https://medium.com/@jorlugaqui/how-to-strip-html-tags-from-a-string-in-python-7cb81a2bbf44\n clean = re.compile('<.*?>')\n return re.sub(clean, '', text)",
"def strip_html(inputString):\r\n return BeautifulSoup(inputString, \"html.parser\").text",
"de... | [
"0.85204816",
"0.8494942",
"0.84743106",
"0.844098",
"0.8320041",
"0.8319546",
"0.8276465",
"0.82684237",
"0.82522714",
"0.8208457",
"0.81831646",
"0.8160966",
"0.8160966",
"0.81129164",
"0.81021744",
"0.8095251",
"0.8075149",
"0.80552006",
"0.80552006",
"0.80522966",
"0.8038... | 0.78929955 | 31 |
Returns value of the Hamiltonian in a given state. | def __call__(self, q: Tensor, p: Tensor, *args, **kwargs) -> Tensor:
return self.potential(q) + self.kinetic(p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hamiltonian(self):\n return self.hamiltonian()",
"def Hamiltonian(self):\n return None",
"def h(self, state):\n loc = dict((val, (i, j)) for i, row in enumerate(self.goal_state)\n for j, val in enumerate(row))\n\n def calculate_cost(i, j):\n val ... | [
"0.6911303",
"0.675507",
"0.6488567",
"0.63543177",
"0.62887895",
"0.6250313",
"0.6132155",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6129814",
"0.6108715",
"0.61043817",
... | 0.0 | -1 |
Formatted 'repr'style representation of record (optionally with prefix and/or sorted RRs) | def format(self, prefix="", sort=False):
s = sorted if sort else lambda x: x
sections = [repr(self.header)]
sections.extend(s([repr(q) for q in self.questions]))
sections.extend(s([repr(rr) for rr in self.rr]))
sections.extend(s([repr(rr) for rr in self.auth]))
sections.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n\n return '%s(%s)' % (self, self._format_entries(),)",
"def __str__(self):\n txt = ''\n if self.PrintHeader:\n txt = \" |\" + \"|\".join(sorted(self.rows[0].keys())).expandtabs() + \"|\"\n txt += \"\\n\"\n txt += \"|-\"\n for r in self.ro... | [
"0.67557865",
"0.6695922",
"0.65245026",
"0.6517333",
"0.6469517",
"0.646618",
"0.64444053",
"0.6387554",
"0.63863015",
"0.6380566",
"0.63708043",
"0.6363295",
"0.6348989",
"0.63442385",
"0.6344004",
"0.6318723",
"0.62986195",
"0.6298393",
"0.62863266",
"0.62753546",
"0.62727... | 0.67554444 | 1 |
get activation module from pytorch | def get_act(name: str, inplace: bool = True, params: Optional[dict] = None) -> nn.Module:
if name.lower() == 'relu':
act = nn.ReLU(inplace=inplace)
elif name.lower() == 'lrelu':
act = nn.LeakyReLU(inplace=inplace) if params is None else nn.LeakyReLU(inplace=inplace, **params)
elif name.lower... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_activation_function(activation: str) -> nn.Module:\n if activation == \"ReLU\":\n return nn.ReLU()\n elif activation == \"LeakyReLU\":\n return nn.LeakyReLU(0.1)\n elif activation == \"PReLU\":\n return nn.PReLU()\n elif activation == \"tanh\":\n return nn.Tanh()\n ... | [
"0.75266004",
"0.7061002",
"0.70460385",
"0.68030167",
"0.6781505",
"0.6677042",
"0.6665354",
"0.66601527",
"0.6612074",
"0.6610388",
"0.6600653",
"0.65295064",
"0.6467455",
"0.6453282",
"0.6450375",
"0.6430896",
"0.64183223",
"0.6292224",
"0.6291165",
"0.6251079",
"0.6200904... | 0.6453984 | 13 |
Test that a new country is created if it does not exist in TolaData | def test_new_country_created(self):
idaa_index = 8
upload_program = program.ProgramUpload(
idaa_program=self.idaa_json['value'][idaa_index]['fields'], msr_country_codes_list=msr_country_codes_list,
msr_gaitid_list=msr_gaitid_list, duplicated_gaitids=self.duplicated_gaitids
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testNormalCreate(self):\n\n canada = self.Country(\n {\"name\": \"Canada\", \"abbreviation\": \"CA\", \"languages\": [\"english\", \"french\"]}\n )\n\n canada.save()\n\n self.assertEqual(\"Canada\", canada.name)\n self.assertEqual(\"CA\", canada.abbreviation)\n ... | [
"0.7098525",
"0.6750823",
"0.6355941",
"0.6332127",
"0.62644494",
"0.62448096",
"0.62199616",
"0.6205874",
"0.61141664",
"0.60871804",
"0.606446",
"0.6051653",
"0.6023745",
"0.6006853",
"0.6005214",
"0.59654975",
"0.5952343",
"0.59480816",
"0.59347963",
"0.5934028",
"0.592658... | 0.72239536 | 0 |
Test that a new program is created if it does not exist in Tola. This test includes email notifications. In order for the test to work, the "django.core.mail.backends.smtp.EmailBackend" has to be enabled and SKIP_USER_EMAILS has to be set to FALSE in settings! | def test_program_create(self):
external_program_id = self.idaa_json['value'][self.new_idaa_program_index]['fields']['id']
expected_program_name = self.idaa_json['value'][self.new_idaa_program_index]['fields']['ProgramName']
gaitidvalue = self.idaa_json['value'][self.new_idaa_program_index]['fie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skip_blank_emails(self):\n appt_date = datetime.date.today() + datetime.timedelta(days=7) # Default for email\n confirmed = self.create_confirmed_notification(self.test_patient, appt_date)\n\n blank_contact = self.create_contact(data={'email': ''})\n self.group.contacts.add(bla... | [
"0.63658994",
"0.6280007",
"0.62030303",
"0.61768866",
"0.6104353",
"0.6099893",
"0.6085732",
"0.60736954",
"0.60383135",
"0.5981701",
"0.59731656",
"0.5964271",
"0.5900917",
"0.5890281",
"0.58891207",
"0.58872426",
"0.5876204",
"0.5876105",
"0.5873545",
"0.58613443",
"0.5860... | 0.6428187 | 0 |
Symmetrically normalize adjacency matrix. | def normalize_adj(adj):
adj = sp.coo_matrix(adj)
rowsum = np.array(adj.sum(1))
d_inv_sqrt = np.power(rowsum, -0.5).flatten()
d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.
d_mat_inv_sqrt = sp.diags(d_inv_sqrt)
return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)",
"def normalize_adj(adj):\r\n adj = sp.coo_m... | [
"0.7883924",
"0.7690492",
"0.75935084",
"0.75646526",
"0.7334669",
"0.7302951",
"0.7268444",
"0.68846583",
"0.6862564",
"0.6860126",
"0.6830389",
"0.68272996",
"0.67497927",
"0.67490155",
"0.672762",
"0.6627367",
"0.66162753",
"0.64865",
"0.6485813",
"0.63617563",
"0.63617563... | 0.7697055 | 3 |
Convert a scipy sparse matrix to a torch sparse tensor. | def sparse_mx_to_torch_sparse_tensor(sparse_mx):
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
return torch.sparse.FloatTen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.8299787",
"0.8148542",
"0.8045949",
"0.80325705",
"0.80134654",
"0.79973555",
"0.79973555",
"0.7985302",
"0.7985302",
"0.7985302",
"0.7977018",
"0.79650825",
"0.7754673",
"0.7713117",
"0.7429514",
"0.7429514",
"0.735423",
"0.71969247",
"0.7156927",
"0.69882196",
"0.6969645... | 0.80300856 | 8 |
Returns a new FrozenDict with keys from iterable and values equal to value. | def fromkeys(iterable, value=None):
return FrozenDict(dict.fromkeys(iterable, value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze(xs: Mapping[Any, Any]) -> FrozenDict[Any, Any]:\n return FrozenDict(xs)",
"def fromkeys(cls, iterable, value=None, callback=(lambda: None)):\r\n new_csvd = cls(callback)\r\n for key in iterable:\r\n new_csvd[key] = value\r\n return new_csvd",
"def dedup(iterable):\n ... | [
"0.6418699",
"0.58564746",
"0.56773466",
"0.5652446",
"0.55607826",
"0.5427696",
"0.5413364",
"0.53514874",
"0.5304149",
"0.52510005",
"0.51757365",
"0.5152398",
"0.5122361",
"0.51208925",
"0.50635445",
"0.50432175",
"0.5033712",
"0.50023425",
"0.49923775",
"0.49399322",
"0.4... | 0.87007105 | 0 |
getquerydict returns a mutable copy of the querydict with exclude values removed. | def exclude_keys(value, *exclude):
if not isinstance(value, QueryDict):
raise RuntimeError("getquerydict should be used with QueryDict instances only (e.g. request.GET)")
value = value.copy()
for key in exclude:
if key in value: del value[key]
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_dict(self):\r\n if self._query_dict is None:\r\n def _split(param):\r\n p = param.split('=')\r\n return (unquote_plus(p[0]),\r\n unquote_plus('='.join(p[1:])))\r\n self._query_dict = dict(_split(p) for p in self.query.split... | [
"0.64614964",
"0.6105909",
"0.6084653",
"0.60080016",
"0.5978525",
"0.5949719",
"0.5899048",
"0.582931",
"0.58133054",
"0.57969296",
"0.57734036",
"0.5747309",
"0.57272726",
"0.57094604",
"0.56549114",
"0.5646493",
"0.56302047",
"0.5574521",
"0.556382",
"0.5547581",
"0.548258... | 0.68574476 | 0 |
Creates a new setting container for saving to the file. | def gather_default():
def fill_header_section():
"""Fills up "Header" section."""
section = _SectionData("Header")
section.props.append(("FormatVersion", 1))
section.props.append(("Source", get_combined_ver_str()))
section.props.append(("Type", "Configuration"))
sect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_settings(self):\n #Check if file exists. If not, try to create it. Will handle permission error.\n if os.path.exists(self.file[\"file_name\"]):\n log.debug(\"'\"+ self.file[\"file_name\"] + \"' found.\")\n self.file[\"exists\"] = True\n else:\n log.d... | [
"0.6576158",
"0.63321984",
"0.6225528",
"0.61790895",
"0.6098168",
"0.60141504",
"0.60078394",
"0.5921787",
"0.5914565",
"0.5914063",
"0.58556086",
"0.58493423",
"0.58321214",
"0.5832002",
"0.580823",
"0.57817286",
"0.5779094",
"0.57752687",
"0.57620156",
"0.573691",
"0.57256... | 0.0 | -1 |
Helper to render index page with custom_proc | def render_index(request, *args, **kwargs):
# add context_instance keyword
kwargs.update(
{'context_instance': RequestContext(request, processors=[custom_proc])})
return render(request, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_fn():\n page_title = \"Index\"\n \n if request.method == \"GET\":\n return render_template(\"index.html\",\n pg_title=page_title,\n )",
"def index(self):\n\t\treturn render_template('index.html')",
"def index():\n return... | [
"0.71589965",
"0.69598264",
"0.6947079",
"0.6940647",
"0.6934658",
"0.6934658",
"0.6934658",
"0.6873126",
"0.68489075",
"0.68354297",
"0.68185735",
"0.68185735",
"0.67878515",
"0.6760982",
"0.67558396",
"0.67558396",
"0.67558396",
"0.67558396",
"0.67558396",
"0.67558396",
"0.... | 0.82352185 | 0 |
Test that mineral list with no pk will redirect | def test_mineral_list_redirect(self):
resp = self.client.get(reverse('minerals:list'))
self.assertEqual(resp.status_code, 302) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_show_shoplists_without_login_redirects(self):\n tester = app.test_client(self)\n response = tester.post('/show_shoplists', follow_redirects=True)\n self.assertEqual(response.status_code, 200)",
"def test_show_activities_without_login_redirects(self):\n User.users = {}\n ... | [
"0.6804747",
"0.6639353",
"0.648068",
"0.6388541",
"0.63525784",
"0.6332835",
"0.630934",
"0.6214183",
"0.617335",
"0.61362755",
"0.6120044",
"0.60898554",
"0.6088404",
"0.6053614",
"0.6034676",
"0.6034676",
"0.6034676",
"0.6029755",
"0.6013406",
"0.60053384",
"0.60053384",
... | 0.7354163 | 0 |
Save/serialize trained model state to files. If the model uses a parallel wrapper like ``torch.nn.DataParallel``, this is automatically detected and the wrapped model is saved directly to make later deserialization easier. This can be disabled by setting ``unwrap_parallel=False``. | def save_model(self, suffix: str = '', unwrap_parallel: bool = True) -> None:
# TODO: Logging
model = self.model
# We do this awkard check because there are too many different
# parallel wrappers in PyTorch and some of them have changed names
# in different releases (DataParallel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self):\n\n # =============================================================\n # Default : pickle the trained model. Change this (and the load\n # function, below) only if the library you used does not support\n # pickling.\n # self.Model_made.save(\"Model_made.h5\")... | [
"0.7230332",
"0.7162599",
"0.7139393",
"0.70704466",
"0.7013741",
"0.6979095",
"0.6976652",
"0.69272524",
"0.69247466",
"0.69072735",
"0.6906031",
"0.6898889",
"0.6883414",
"0.68668175",
"0.6859346",
"0.6856698",
"0.68370855",
"0.6805313",
"0.68041414",
"0.6796176",
"0.675706... | 0.8036562 | 0 |
Defines ``batch2img`` function dynamically, depending on tensor shapes. ``batch2img`` slices a 4D or 5D tensor to (C, H, W) shape, moves it to host memory and converts it to a numpy array. By arbitrary choice, the first element of a batch is always taken here. In the 5D case, the D (depth) dimension is sliced at z_plan... | def _get_batch2img_function(
batch: torch.Tensor,
z_plane: Optional[int] = None
) -> Callable[[torch.Tensor], np.ndarray]:
if batch.dim() == 5: # (N, C, D, H, W)
if z_plane is None:
z_plane = batch.shape[2] // 2
assert z_plane in range(batch.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_batch():\n return np.zeros((2, 1, 4, 4))",
"def get_batches_fn(batch_size):\n image_paths = glob(os.path.join(data_folder, 'image_2', '*.png'))\n label_paths = {\n re.sub(r'_(lane|road)_', '_', os.path.basename(path)): path\n for path in glob(os.path.join(data_fol... | [
"0.5889001",
"0.5834307",
"0.5763898",
"0.5548405",
"0.54911685",
"0.5404486",
"0.5354863",
"0.53391266",
"0.52845913",
"0.52194244",
"0.50857246",
"0.5081543",
"0.50766444",
"0.50407875",
"0.50406784",
"0.5035221",
"0.5017781",
"0.5017628",
"0.50161916",
"0.50143474",
"0.501... | 0.7126705 | 0 |
Calculated the maximum value in the data. | def peak(data, fft_data=None):
return np.max(np.abs(data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Max(data):\n return data.max()",
"def max(self):\n return numpy.ma.max(self.data)",
"def max(self):\r\n return np.max(self.data_array)",
"def get_max(cls, data: tuple or list) -> float:\n cls._data_validation(data)\n return max(data)",
"def get_max_value(self):\n m... | [
"0.859802",
"0.84755695",
"0.83870363",
"0.821967",
"0.8165011",
"0.81448174",
"0.78242344",
"0.7778672",
"0.7764939",
"0.774481",
"0.7737507",
"0.7719651",
"0.7719479",
"0.7692017",
"0.7664166",
"0.7642848",
"0.76029134",
"0.76005256",
"0.7599367",
"0.756927",
"0.75295204",
... | 0.0 | -1 |
Calculates the ratio of peak to rms of the data. | def crest_factor(data, fft_data=None):
peak_val = peak(data)
rms_val = rms(data)
if peak_val == 0:
return 1
return peak_val/rms_val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalizedpeakerror():\r\n peak_simulation = max(hydrograph)\r\n peak_observation = max(obs_data)\r\n peak_error = abs(peak_simulation - peak_observation)/(peak_observation + peak_simulation)\r\n return peak_error",
"def getPeakValue( self ):\n nCurrentMax = max( self.data.max(), -self.dat... | [
"0.6631738",
"0.6575606",
"0.6180358",
"0.6140057",
"0.603678",
"0.5995715",
"0.59330577",
"0.5901132",
"0.5896199",
"0.5887279",
"0.5869741",
"0.5843677",
"0.5778012",
"0.57712466",
"0.57672375",
"0.576395",
"0.57630235",
"0.5728869",
"0.57155704",
"0.5702161",
"0.569761",
... | 0.5951643 | 6 |
Calculate the skewness of the spectrum. | def spectral_skewness(data, fft_data):
return scipy.stats.skew(np.abs(fft_data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skewness(self):\n self._finalize()\n return self.vskewness",
"def spectral_skewness(sign, fs):\n f, ff = plotfft(sign, fs)\n spect_centr = spectral_centroid(sign, fs)\n if not spectral_spread(sign, fs):\n return 0\n else:\n skew = ((f - spect_centr) ** 3) * (ff / np.su... | [
"0.79790175",
"0.7622297",
"0.75499445",
"0.74275786",
"0.7356237",
"0.69568706",
"0.66155034",
"0.66151226",
"0.6565566",
"0.65512294",
"0.6200791",
"0.60718316",
"0.5972047",
"0.5872354",
"0.5837397",
"0.58353823",
"0.5832275",
"0.5814251",
"0.5724178",
"0.57171047",
"0.569... | 0.79276204 | 1 |
Gets the active_member_count of this Context17. | def active_member_count(self):
return self._active_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumActive(self):\n return self._get_active( )",
"def bounced_member_count(self):\n return self._bounced_member_count",
"def member_count(self):\n return len(self.members)",
"def member_count(self) -> int:\n return sum([g.member_count for g in self.guilds])",
"def active_m... | [
"0.6896081",
"0.640346",
"0.61951387",
"0.61759603",
"0.61616695",
"0.60395855",
"0.6013379",
"0.6006747",
"0.6006747",
"0.59408104",
"0.5931322",
"0.58700466",
"0.5865242",
"0.5846405",
"0.58382374",
"0.5832671",
"0.5832671",
"0.5832671",
"0.5832671",
"0.5832671",
"0.5832671... | 0.8488191 | 0 |
Sets the active_member_count of this Context17. | def active_member_count(self, active_member_count):
self._active_member_count = active_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_member_count(self):\n return self._active_member_count",
"def bounced_member_count(self, bounced_member_count):\n\n self._bounced_member_count = bounced_member_count",
"def set_activeLedCount(self, newval):\n rest_val = str(newval)\n return self._setAttr(\"activeLedCount\... | [
"0.64063823",
"0.5860484",
"0.58239967",
"0.5772565",
"0.57543284",
"0.57226",
"0.5673672",
"0.56626874",
"0.56626874",
"0.56626874",
"0.56626874",
"0.56626874",
"0.5575489",
"0.55588037",
"0.55588037",
"0.5521708",
"0.5521708",
"0.5521708",
"0.5521708",
"0.54948616",
"0.5442... | 0.83144844 | 0 |
Gets the bounced_member_count of this Context17. | def bounced_member_count(self):
return self._bounced_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_member_count(self):\n return self._active_member_count",
"def member_count(self) -> int:\n return sum([g.member_count for g in self.guilds])",
"def get_count(self):\n return self._count",
"def get_count(self):\n return self.count",
"def get_count(self):\n retur... | [
"0.7381187",
"0.63977176",
"0.63508046",
"0.63348234",
"0.63348234",
"0.630128",
"0.62972474",
"0.6285729",
"0.6238138",
"0.6193707",
"0.61564",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
... | 0.8398334 | 0 |
Gets the created_by of this Context17. | def created_by(self):
return self._created_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_by(self) -> str:\n return pulumi.get(self, \"created_by\")",
"def created_by(self):\n url = self._data.get('related', {}).get('created_by')\n return self._tower._get_object_by_url('User', url) # pylint: disable=protected-access",
"def created_by(self) -> Optional[str]:\n ... | [
"0.7789317",
"0.7770012",
"0.757339",
"0.757339",
"0.757339",
"0.757339",
"0.757339",
"0.757339",
"0.756759",
"0.7545281",
"0.7522512",
"0.7440229",
"0.7440229",
"0.7440229",
"0.7440229",
"0.7343571",
"0.73141575",
"0.72036463",
"0.7189899",
"0.71786857",
"0.6838154",
"0.66... | 0.81725967 | 0 |
Sets the created_by of this Context17. | def created_by(self, created_by):
self._created_by = created_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, cre... | [
"0.7572309",
"0.7572309",
"0.7572309",
"0.7572309",
"0.69436747",
"0.68896055",
"0.6828929",
"0.6477116",
"0.64744514",
"0.64393854",
"0.64208853",
"0.64208853",
"0.64208853",
"0.64208853",
"0.63663167",
"0.63447416",
"0.6332632",
"0.630783",
"0.630783",
"0.630783",
"0.630783... | 0.77650815 | 3 |
Gets the custom_fields_definition of this Context17. | def custom_fields_definition(self):
return self._custom_fields_definition | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_fields(self):\n return custom_fields.CustomFields(self)",
"def custom_fields(self):\r\n return custom_fields.CustomFields(self)",
"def custom_fields_definition(self, custom_fields_definition):\n\n self._custom_fields_definition = custom_fields_definition",
"def field(self) -> ... | [
"0.6732822",
"0.6684957",
"0.5955038",
"0.5517716",
"0.5398259",
"0.5376668",
"0.52525747",
"0.5214191",
"0.51776576",
"0.5158833",
"0.512581",
"0.512581",
"0.51108223",
"0.5084462",
"0.5083847",
"0.5002417",
"0.49952582",
"0.49952582",
"0.49414942",
"0.49301967",
"0.4929908"... | 0.83008784 | 0 |
Sets the custom_fields_definition of this Context17. | def custom_fields_definition(self, custom_fields_definition):
self._custom_fields_definition = custom_fields_definition | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_fields_definition(self):\n return self._custom_fields_definition",
"def custom_fields(self, custom_fields):\n\n self._custom_fields = custom_fields",
"def custom_fields(self, custom_fields):\n\n self._custom_fields = custom_fields",
"def custom_fields(self, custom_fields):\n\n... | [
"0.6642042",
"0.64079607",
"0.64079607",
"0.64079607",
"0.64079607",
"0.64079607",
"0.5507524",
"0.5432757",
"0.5380791",
"0.5177665",
"0.5114241",
"0.50425124",
"0.49577433",
"0.4888433",
"0.4846477",
"0.4803468",
"0.47680637",
"0.47590303",
"0.47508407",
"0.47330523",
"0.46... | 0.83766735 | 0 |
Gets the id of this Context17. | def id(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context_id(self) -> str | None:\n return bytes_to_ulid_or_none(self.context_id_bin)",
"def get_id(self):\n return self.__id",
"def get_id(self):\n return self.__id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n ... | [
"0.6960636",
"0.69558775",
"0.69558775",
"0.69375557",
"0.69375557",
"0.69375557",
"0.69375557",
"0.69375557",
"0.69375557",
"0.6937153",
"0.6927459",
"0.6892105",
"0.6892105",
"0.6892105",
"0.6892105",
"0.6892105",
"0.6892105",
"0.6892105",
"0.6892105",
"0.6892105",
"0.68921... | 0.6714648 | 80 |
Sets the id of this Context17. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.data['id'] = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n self.id = id\n print(\"self id = \" + str(self.id))",
"def i... | [
"0.7327777",
"0.72765005",
"0.7211333",
"0.71316636",
"0.70473367",
"0.6988169",
"0.6988169",
"0.6988169",
"0.6988169",
"0.6988169",
"0.69757485",
"0.69757485",
"0.69757485",
"0.69757485",
"0.69757485",
"0.69757485",
"0.69757485",
"0.69757485",
"0.69757485",
"0.69757485",
"0.... | 0.68993175 | 78 |
Gets the name of this Context17. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getName(self):\n return self.__name__",
"def get_context_template_name(self):\n return getattr(self, 'context_template_name', None)",
"def get_name(self):\n\n\t\treturn self.__name",
"def get_name(self):\n\t\treturn self.__name",
"def get_name(self):\n return self.__name",
"def g... | [
"0.71633345",
"0.71083546",
"0.70724344",
"0.7071403",
"0.7068837",
"0.7068837",
"0.7068837",
"0.7068455",
"0.70609367",
"0.7054966",
"0.70501083",
"0.70501083",
"0.70501083",
"0.70501083",
"0.7019011",
"0.7019011",
"0.7019011",
"0.7019011",
"0.7019011",
"0.7019011",
"0.70190... | 0.0 | -1 |
Sets the name of this Context17. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\r\n self.__name = name",
"def set_name(self,name):\r\n self._name = __name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self,... | [
"0.7595141",
"0.7574442",
"0.7564328",
"0.7564328",
"0.75567836",
"0.75567836",
"0.75567836",
"0.75567836",
"0.75567836",
"0.75486255",
"0.75196666",
"0.75063616",
"0.7500887",
"0.7424189",
"0.7424189",
"0.7420812",
"0.7331472",
"0.7331052",
"0.7330919",
"0.7330919",
"0.73309... | 0.7193097 | 78 |
Gets the removed_member_count of this Context17. | def removed_member_count(self):
return self._removed_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed_member_count(self):\n return self._unsubscribed_member_count",
"def get_total_words_removed(self):\n return self.total_words_removed",
"def removed_member_count(self, removed_member_count):\n\n self._removed_member_count = removed_member_count",
"def question_count_remov... | [
"0.7013696",
"0.6821845",
"0.6383696",
"0.63803935",
"0.5906242",
"0.5767794",
"0.57416683",
"0.5624927",
"0.55618656",
"0.5561286",
"0.5558821",
"0.55301356",
"0.55023795",
"0.55023795",
"0.5490844",
"0.5486998",
"0.5480672",
"0.54591745",
"0.53917253",
"0.53878504",
"0.5376... | 0.8549048 | 0 |
Gets the status of this Context17. | def status(self):
return self._status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n return self.status",
"def get_status(self):\n return self.status",
"def get_status(self):\n return self.status",
"def get_status(self):\n return self._status",
"def getstatus(self):\n return self.__status",
"def getStatus(self):\n return s... | [
"0.75402653",
"0.75402653",
"0.75402653",
"0.7520351",
"0.75024074",
"0.7477099",
"0.747509",
"0.7463894",
"0.7289555",
"0.7275613",
"0.7262081",
"0.7262081",
"0.72547084",
"0.7253304",
"0.72392386",
"0.7227404",
"0.7227404",
"0.7217347",
"0.72008955",
"0.71857893",
"0.718355... | 0.72319156 | 30 |
Gets the unsubscribed_member_count of this Context17. | def unsubscribed_member_count(self):
return self._unsubscribed_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed_member_count(self, unsubscribed_member_count):\n\n self._unsubscribed_member_count = unsubscribed_member_count",
"def removed_member_count(self):\n return self._removed_member_count",
"def get_subscribed_users(self, obj):\n return obj.subscribed_users.count()",
"def acti... | [
"0.71419156",
"0.70558476",
"0.5919587",
"0.5731225",
"0.5730982",
"0.5687569",
"0.5586158",
"0.55647856",
"0.55323863",
"0.5452427",
"0.54399496",
"0.5360487",
"0.53492814",
"0.534088",
"0.5291912",
"0.5260404",
"0.52590173",
"0.52475226",
"0.5246356",
"0.5244646",
"0.524391... | 0.8775167 | 0 |
Gets the updated_by of this Context17. | def updated_by(self):
return self._updated_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_by(self) -> Optional[pulumi.Input['UserInfoArgs']]:\n return pulumi.get(self, \"updated_by\")",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_by(self) -> \"s... | [
"0.77070093",
"0.7586538",
"0.7586538",
"0.7586538",
"0.73329616",
"0.72001487",
"0.70631254",
"0.70631254",
"0.68099815",
"0.671652",
"0.6666177",
"0.6666177",
"0.6666177",
"0.65548086",
"0.65548086",
"0.65548086",
"0.6360967",
"0.63594735",
"0.6252926",
"0.6174813",
"0.6147... | 0.8346993 | 0 |
Sets the updated_by of this Context17. | def updated_by(self, updated_by):
self._updated_by = updated_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(self):\n ... | [
"0.76505786",
"0.76505786",
"0.76505786",
"0.68549126",
"0.6627744",
"0.64946896",
"0.64946896",
"0.64946896",
"0.64742637",
"0.61784595",
"0.6080924",
"0.6007099",
"0.6007099",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908... | 0.786663 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Context17):
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 |
Returns a string containing a link to the user's profile page | def user_link( username ):
user = User.get_by_name(username)
if user and user.last_seen:
cls = ""
delta = (datetime.now() - user.last_seen).seconds
if delta < 300: # 5 minutes
cls = 'class=recent'
if delta < 60: # 1 minute
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_url(self):\n return reverse(\"auth_profile\", args=[self.user.username])",
"def show_user_profile(username):\n\n name = USERS[username]\n return f\"<h1>Profile for {name}</h1>\"",
"def get_absolute_url(self):\n return '/profile/%s' % self.id",
"def __str__(self):\n retu... | [
"0.7901705",
"0.7270633",
"0.7162695",
"0.71075666",
"0.70590883",
"0.7011754",
"0.6995219",
"0.6918819",
"0.68804866",
"0.68478525",
"0.6836707",
"0.68165225",
"0.67816377",
"0.67514026",
"0.67317504",
"0.66626036",
"0.66452503",
"0.6640091",
"0.66204506",
"0.6597925",
"0.65... | 0.68637645 | 9 |
Convert an object to a timedelta. If the object is a timedelta, it is returned; if it is a numeric type, the value is interpreted as seconds and that is returned. | def to_timedelta(obj: "Any") -> "timedelta":
if obj is None:
raise ValueError("obj cannot be None")
if isinstance(obj, timedelta):
return obj
elif isinstance(obj, (int, float)):
return timedelta(seconds=obj)
elif isinstance(obj, Decimal):
return timedelta(seconds=float(ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timedelta_to_duration(obj: \"timedelta\") -> \"Duration\":\n d = Duration()\n d.seconds = int(obj.total_seconds())\n d.nanos = obj.microseconds * 1000\n return d",
"def _convert_to_timedelta(time_diff):\n return timedelta(seconds=time_diff)",
"def to_timedelta(value) -> timedelta:\n\n ... | [
"0.7549371",
"0.7208493",
"0.71895224",
"0.7143933",
"0.698645",
"0.6935266",
"0.6830268",
"0.6667241",
"0.6469093",
"0.6459836",
"0.6394731",
"0.633544",
"0.6323539",
"0.63086367",
"0.6242395",
"0.62389344",
"0.6208127",
"0.61857295",
"0.6101693",
"0.60412055",
"0.60073674",... | 0.8216954 | 0 |
Return the Python ``datetime.date`` as the number of days since 1970 Jan 1. | def date_to_int(obj: "date") -> int:
return (obj - date(1970, 1, 1)).days | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DAY(date):\n return _make_datetime(date).day",
"def date_in_days(date):\n delta = delta_from_now(date)\n return (delta.days) + delta.seconds / 86400",
"def date_to_number(d):\n return (date.fromisoformat(d) - date.fromisoformat(\"2019-12-31\")).days",
"def pdate_to_days_since_1970(pdate):\n ... | [
"0.73467916",
"0.73301876",
"0.6962966",
"0.67831016",
"0.6722125",
"0.67125994",
"0.6711416",
"0.65579784",
"0.6479266",
"0.6306097",
"0.627266",
"0.6264777",
"0.62228537",
"0.6222312",
"0.62185365",
"0.62043566",
"0.61952215",
"0.61598307",
"0.61598307",
"0.6118753",
"0.605... | 0.7265426 | 2 |
Convert a date to a JSON string that represents a date. | def date_to_str(obj: "date") -> str:
return obj.isoformat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_py_to_json(a_date):\n\n return a_date.isoformat() if isinstance(a_date, date) else 'null'",
"def test_date_to_json(self):\n now = datetime.now()\n the_date = datetime(2018, 10, 13, 12, 12, 12)\n assert ct.date_to_json(the_date) == \"2018-10-13 12:12:12\"\n assert isinstanc... | [
"0.7660455",
"0.7235915",
"0.7111458",
"0.69200695",
"0.6783963",
"0.673118",
"0.66485214",
"0.66380525",
"0.6596395",
"0.65529346",
"0.65017563",
"0.63985735",
"0.63639927",
"0.6277258",
"0.6187868",
"0.6126272",
"0.6118207",
"0.60801417",
"0.6076473",
"0.60518974",
"0.60050... | 0.6343817 | 13 |
Converts the object to an ISO8601 datetime string. | def datetime_to_str(obj: "datetime") -> str:
if obj.tzinfo is not None and obj.tzinfo.utcoffset(obj) is not None:
# aware time; translate to UTC
obj = obj.astimezone(timezone.utc)
obj = obj.replace(tzinfo=None)
return obj.isoformat() + "Z" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_iso8601(obj):\n return obj.strftime('%Y-%m-%dT%H:%M:%SZ')",
"def serialize_datetime(self, obj):\r\n if isinstance(obj, datetime.datetime):\r\n return obj.isoformat()\r\n raise TypeError(\"Type not serializable\")",
"def ISO8601(self):\n if self.timezoneNaive():\n ... | [
"0.81283116",
"0.8027625",
"0.77758455",
"0.7765985",
"0.76257104",
"0.74486893",
"0.7435646",
"0.7409274",
"0.737513",
"0.7304287",
"0.72866786",
"0.72717196",
"0.71964234",
"0.7186217",
"0.7043044",
"0.7030248",
"0.70119256",
"0.7004775",
"0.69821566",
"0.69523877",
"0.6882... | 0.75944793 | 5 |
Convert the ``datetime`` to a Protobuf ``google.protobuf.Timestamp``. | def datetime_to_timestamp(obj: "datetime") -> "Timestamp":
td = datetime_to_epoch_timedelta(obj)
ts = Timestamp()
ts.seconds = td.seconds + td.days * _SECONDS_PER_DAY
ts.nanos = td.microseconds * _NANOS_PER_MICROSECOND
return ts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pb_timestamp_to_datetime(timestamp_pb):\n return (\n _EPOCH +\n datetime.timedelta(\n seconds=timestamp_pb.seconds,\n microseconds=(timestamp_pb.nanos / 1000.0),\n )\n )",
"def timestamp_pb(self):\n inst = (\n self\n ... | [
"0.7639783",
"0.7044",
"0.7003",
"0.68683267",
"0.68223804",
"0.65336674",
"0.6287155",
"0.6101606",
"0.6097337",
"0.606677",
"0.60444725",
"0.60205543",
"0.59777683",
"0.59684634",
"0.5956987",
"0.5944024",
"0.58452946",
"0.58374757",
"0.5789286",
"0.5712425",
"0.5655668",
... | 0.62047744 | 7 |
Return the Python ``datetime.datetime`` as number of microseconds since 1970 Jan 1 midnight, UTC. | def datetime_to_epoch_microseconds(obj: "datetime") -> float:
td = datetime_to_epoch_timedelta(obj)
return (td.days * 86400 + td.seconds) * 10**6 + td.microseconds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _time_ms(self, dt):\n if dt.tzinfo is None:\n dt = dt.replace(tzinfo=pytz.utc)\n return int((dt - self._EPOCH).total_seconds() * 1000)",
"def utctime(self) -> datetime:\n return datetime.utcfromtimestamp(float(self.ns_since_epoch) / 1e9)",
"def timestamp(self):\n if s... | [
"0.72224337",
"0.7147286",
"0.7086355",
"0.7022373",
"0.6964532",
"0.68920386",
"0.67589664",
"0.6740478",
"0.667022",
"0.6555965",
"0.6555965",
"0.650154",
"0.6481856",
"0.64692354",
"0.64433986",
"0.6427409",
"0.6403986",
"0.6403566",
"0.63995355",
"0.639276",
"0.6382027",
... | 0.65648794 | 9 |
Return the Python ``timestamp`` as a Protobuf ``google.protobuf.Duration``. | def timedelta_to_duration(obj: "timedelta") -> "Duration":
d = Duration()
d.seconds = int(obj.total_seconds())
d.nanos = obj.microseconds * 1000
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_Timestamp(timestamp):\n # type: (timestamp_pb2.Timestamp) -> float\n return timestamp.seconds + float(timestamp.nanos) / 10**9",
"def duration(self):\n return total_seconds(self.timestamp - self.start_timestamp)",
"def decode(self, data):\r\n return Duration.from_sec(float(data))",
"... | [
"0.6185251",
"0.6068815",
"0.5936995",
"0.59165883",
"0.5889137",
"0.5868869",
"0.584717",
"0.5779639",
"0.57345295",
"0.5682757",
"0.56735516",
"0.56724614",
"0.56336695",
"0.5609171",
"0.55775326",
"0.55641437",
"0.55411524",
"0.55359024",
"0.5501609",
"0.5501609",
"0.54929... | 0.5616116 | 13 |
if alien at the edge of screen | def check_edges(self):
screen_rect = self.screen.get_rect()
if self.rect.right >= screen_rect.right:
return True
elif self.rect.left <= screen_rect.left:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_edges(self):\n if self.rect.right >= self.screen_rect.right or self.rect.left <= 0:\n return True",
"def check_edges(self):\r\n screen_rect = self.screen.get_rect()\r\n if self.rect.right >= screen_rect.right:\r\n return True\r\n elif self.rect.left <= ... | [
"0.7032969",
"0.6956036",
"0.68846214",
"0.6844887",
"0.67842793",
"0.6772903",
"0.67100257",
"0.6676588",
"0.66136575",
"0.64995706",
"0.6458972",
"0.6429469",
"0.6312469",
"0.6279509",
"0.6253208",
"0.62484795",
"0.62363386",
"0.62336886",
"0.6120487",
"0.6114965",
"0.60912... | 0.6777179 | 5 |
Returns a list of tool names, specifying the order in which they should appear in the FSLeyes ortho panel settings menu. | def toolOrder():
return ['CropImageAction',
'EditTransformAction',
'SampleLineAction',
'LoadAnnotationsAction',
'SaveAnnotationsAction',
'PearsonCorrelateAction'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controlOrder():\n return ['OverlayListPanel',\n 'LocationPanel',\n 'OverlayInfoPanel',\n 'OverlayDisplayPanel',\n 'CanvasSettingsPanel',\n 'AtlasPanel',\n 'OverlayDisplayToolBar',\n 'OrthoToolBar',\n... | [
"0.676183",
"0.6499401",
"0.62972677",
"0.6249077",
"0.5970247",
"0.5940185",
"0.58990747",
"0.57945955",
"0.5769095",
"0.5735396",
"0.56998837",
"0.5694195",
"0.5657685",
"0.56296474",
"0.5604566",
"0.55864596",
"0.5580212",
"0.55689025",
"0.55604416",
"0.55479664",
"0.55206... | 0.6583391 | 1 |
Check if two `DomainParam` are equal by comparing all attributes defined in `get_field_names()`. | def __eq__(self, other):
if not isinstance(other, DomainParam):
raise pyrado.TypeErr(given=other, expected_type=DomainParam)
for fn in self.get_field_names():
if getattr(self, fn) != getattr(other, fn):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return np.all([\n self.__getattribute__(name) == other.__getattribute__(name)\n for name in self._fields\n ])",
"def check_params_equal(param1, param2):\n for key, val in param1.items():\n if np.any(param1[key] != param2[key]):\n ... | [
"0.7002829",
"0.66476244",
"0.6631622",
"0.6536995",
"0.65236616",
"0.6493726",
"0.6433476",
"0.6410068",
"0.63820744",
"0.6351537",
"0.6334997",
"0.62845343",
"0.62749666",
"0.6233371",
"0.62293303",
"0.62159556",
"0.61955047",
"0.6181133",
"0.6106232",
"0.6080795",
"0.60746... | 0.7762589 | 0 |
Get loaded files that have NOT been used in console command | def get_untouched(self, cmd: str = None, force: bool = False):
_r = []
if cmd is not None:
for _f, _d in self.inputs['files'].items():
if not _d[cmd] or force:
_r.append(_f)
else:
for _f in self.inputs['files'].keys():
_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def missing_in_gyp_by_file(self):\n return self._missing_gyp_files",
"def missing_in_gn_by_file(self):\n return self._missing_gn_files",
"def loaded_modules() -> List[str]:\n return PYSTAC_IO.keys()",
"def _unload_generated_files(self):\n sql = \"SELECT path FROM stl_unload_log \" \"WHERE que... | [
"0.66443914",
"0.65971285",
"0.6379596",
"0.6369584",
"0.6356777",
"0.6258674",
"0.6147488",
"0.61335516",
"0.6131436",
"0.6045447",
"0.603615",
"0.6002661",
"0.59094507",
"0.590319",
"0.5896242",
"0.5851206",
"0.5841682",
"0.58397585",
"0.58283997",
"0.582059",
"0.57702523",... | 0.54962707 | 40 |
Returns a string with the given datetime in iso format. If no datetime is given as parameter, it uses datetime.utcnow(). | def create_timestamp(dt=None):
if dt is None:
dt = datetime.datetime.utcnow()
return dt.isoformat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isoformat_now():\n return datetime_isoformat(datetime.datetime.utcnow())",
"def format_iso_now():\n return datetime.datetime.utcnow().isoformat()+'Z'",
"def iso_date(self, t=None):\n if t is None:\n t = time.time()\n time_str = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localt... | [
"0.8375897",
"0.7729902",
"0.7693298",
"0.7538797",
"0.7502681",
"0.7400192",
"0.70775247",
"0.7038683",
"0.7032034",
"0.6983478",
"0.6957993",
"0.68082595",
"0.6731931",
"0.67295164",
"0.6717227",
"0.67078257",
"0.6659716",
"0.66523796",
"0.6650686",
"0.66255003",
"0.6607867... | 0.6432849 | 29 |
Returns a string with the given datetime formatted as a timestamp for the agent's history folder | def create_history_timestamp(dt=None):
if dt is None:
dt = datetime.datetime.utcnow()
return dt.strftime('%Y-%m-%dT%H-%M-%S') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stamper() :\n\treturn datetime.now().strftime(\"%Y-%m-%d-%H-%M-%S\")",
"def get_git_timestamp(path):\n return int(_run_command(path, 'git log -1 --format=%ct'))",
"def timestamp():\n return datetime.now().strftime('%H:%M:%S %m-%d')",
"def log_timestamp():\n now = time.localtime()\n times... | [
"0.62167615",
"0.6157197",
"0.6116242",
"0.60908395",
"0.60371304",
"0.6034678",
"0.598345",
"0.5981551",
"0.5960698",
"0.5942786",
"0.591269",
"0.59055346",
"0.59042066",
"0.58993036",
"0.58993036",
"0.5898477",
"0.58732146",
"0.5872645",
"0.5860633",
"0.58602196",
"0.583133... | 0.7140919 | 0 |
Compute the total_seconds for timedelta 'td'. Used instead timedelta.total_seconds() because 2.6 does not implement total_seconds. | def total_seconds(dt):
return ((24.0 * 60 * 60 * dt.days + dt.seconds) * 10 ** 6 + dt.microseconds) / 10 ** 6 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_seconds(td):\n if hasattr(td, 'total_seconds'):\n return td.total_seconds()\n else:\n return (\n lag.microseconds +\n (lag.seconds + lag.days * 24 * 3600) * 10**6\n ) / 10.0**6",
"def total_seconds(... | [
"0.88219774",
"0.8637884",
"0.8620896",
"0.7743131",
"0.7661122",
"0.72978914",
"0.7128213",
"0.6877056",
"0.68628824",
"0.68514854",
"0.66197574",
"0.66119426",
"0.65225124",
"0.6515761",
"0.6391301",
"0.6378238",
"0.63683355",
"0.6363338",
"0.634643",
"0.632962",
"0.6318723... | 0.74437886 | 5 |
split the word by some separators | def word_split_by_char(s):
old_words = []
old_words.append(s)
result = []
while len(old_words) > 0:
new_words = []
for s in old_words:
if '-' in s: # Case: ab-cd-ef
new_words+=s.split('-')
elif '.' in s: # Case: ab.cd.ef
new_words... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_word(word):\n return [(word[:i], word[i:]) for i in range(len(word) + 1)]",
"def mysplit(s,delims):\r\n for c in delims:\r\n s = s.replace(c,' ')\r\n return s.split()",
"def word_split(self, sentence):\n return re.split(self.word_split_pattern, sentence)",
"def my_spl... | [
"0.75098103",
"0.73247385",
"0.72968286",
"0.7262581",
"0.7164567",
"0.7154872",
"0.712924",
"0.7105916",
"0.7040668",
"0.70326304",
"0.68934566",
"0.68934566",
"0.68914485",
"0.68914485",
"0.68914485",
"0.68914485",
"0.68914485",
"0.6878237",
"0.68574214",
"0.6823552",
"0.68... | 0.6601598 | 38 |
Returns the latest version of the asset with the given name. Latest is defined as the most recently created, not the most recently updated. | def _get_latest_version(self, name: str) -> Environment:
result = _get_latest(
name,
self._version_operations,
self._resource_group_name,
self._workspace_name,
self._registry_name,
)
return Environment._from_rest_object(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_version(self, name):\n return self.filter(name=name).order_by('schema_version').last()",
"def get_latest(self, name):\n return self._scalar_history.get_latest(name)",
"def get_latest(self, name):\n return self._scalar_history.get_latest(name)[1]",
"def latest(cls):\n ... | [
"0.76041687",
"0.7418771",
"0.73677105",
"0.6458231",
"0.6448493",
"0.6298078",
"0.61594224",
"0.61448956",
"0.6129677",
"0.6071424",
"0.60682005",
"0.6067076",
"0.6059845",
"0.60455865",
"0.6031516",
"0.6020238",
"0.6005096",
"0.6004529",
"0.5999867",
"0.5954393",
"0.5948425... | 0.6863632 | 3 |
Visualization function to create heat maps for prediction, ground truth and attention (if any) probabilities | def visualize_attention(wts,words, filename, maps, viz_type='scores'):
wts_add = wts.cpu()
wts_add_np = wts_add.data.numpy()
wts_add_list = wts_add_np.tolist()
new_wts = []
for s_id in range(len(maps)):
new_wts.append([wts_add_list[s_id][i] for i in maps[s_id]])
text= []
for index, t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decision_heatmaps(obs):\n global model\n assert obs > 4 and obs < 1788, \"Chosen observation is outside the range of the demonstration episode.\"\n saved_observations = np.load('saved_observations.npy')\n state = saved_observations[obs-3:obs+1]\n state_batch = np.expand_dims(state, axis=0)\n ... | [
"0.67549825",
"0.6752729",
"0.66857064",
"0.65147364",
"0.6485667",
"0.6438871",
"0.64273906",
"0.64184636",
"0.64113307",
"0.6405079",
"0.6375704",
"0.636622",
"0.6362065",
"0.63404304",
"0.63238454",
"0.6306971",
"0.62900937",
"0.627162",
"0.62634414",
"0.6247691",
"0.62432... | 0.0 | -1 |
True if element is \\s or \n | def is_sentence_end(mystem_element):
word = mystem_element.get('text', '')
return word == '\\s' or word == '\n' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_whitespace(char):\n # \\t, \\n, and \\r are technically contorl characters but we treat them\n # as whitespace since they are generally considered as such.\n if char == \" \" or char == \"\\t\" or char == \"\\n\" or char == \"\\r\":\n return True\n cat = unicodedata.c... | [
"0.6634618",
"0.65383315",
"0.65339756",
"0.6481999",
"0.63937706",
"0.6269705",
"0.6221383",
"0.59168893",
"0.5899913",
"0.5853028",
"0.5779206",
"0.5760287",
"0.57525533",
"0.56327254",
"0.56196755",
"0.5581376",
"0.5564806",
"0.5559176",
"0.5556629",
"0.5535566",
"0.550236... | 0.683654 | 0 |
sigmoid for every value of array x | def sigmoid_array(x):
for l in range(len(x)):
x[l] = 1/(1 + math.exp(-x[l]))
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x: np.ndarray \n ) -> np.ndarray:\n return 1/(1+np.exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\n S = np.ones((np.size(x),))\n for i in range(len(x)):\n S[i] = 1/(1+np.exp(-x[i]))\n return S",
"def sigmoid(X):\n if isinst... | [
"0.855918",
"0.83445925",
"0.8308991",
"0.8300278",
"0.82980376",
"0.8267586",
"0.8267586",
"0.8267586",
"0.8267586",
"0.8267586",
"0.8267586",
"0.8263312",
"0.8179828",
"0.8179828",
"0.8171647",
"0.8170802",
"0.81627613",
"0.8140558",
"0.8127495",
"0.8123879",
"0.8111907",
... | 0.84037894 | 1 |
sigmoid for value x | def sigmoid(x):
return 1/(1 + math.exp(-x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(self, x):\n return 1 / (1 + np.exp(-4.9 * x))",
"def sigmoid(x):\r\n\r\n return 1 ... | [
"0.90094995",
"0.9005399",
"0.9005399",
"0.89923376",
"0.89825416",
"0.89820486",
"0.8938599",
"0.89340085",
"0.8917355",
"0.8912285",
"0.8912285",
"0.89091325",
"0.89091325",
"0.89091325",
"0.89091325",
"0.89091325",
"0.89091325",
"0.8906582",
"0.8896471",
"0.8894103",
"0.88... | 0.8862034 | 26 |
Converts datetime.datetime to timestamp. | def datetime_to_timestamp(dt):
return calendar.timegm(dt.timetuple()) * 1000 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _datetime_to_timestamp(self, dt):\n return time.mktime(dt.timetuple())",
"def to_stamp(datetime_):\r\n try:\r\n return datetime_.timestamp()\r\n except AttributeError:\r\n return time.mktime(datetime_.timetuple()) + datetime_.microsecond / 1e6",
"def dateToTimeStamp(dt):\n tim... | [
"0.8076539",
"0.78277814",
"0.7797454",
"0.76684695",
"0.7463921",
"0.74276423",
"0.73607266",
"0.7308691",
"0.72502464",
"0.7238647",
"0.7138861",
"0.71251184",
"0.70923865",
"0.70835966",
"0.6995773",
"0.6985411",
"0.6960585",
"0.68805313",
"0.6875217",
"0.6806082",
"0.6804... | 0.7572248 | 4 |
Get type of quotes to use. | def get_quotes(self):
# However ignore the 'true' autodetection setting.
jscs_quotes = self.jscs_options.get('validateQuoteMarks')
if isinstance(jscs_quotes, dict):
jscs_quotes = jscs_quotes.get('mark')
if jscs_quotes and jscs_quotes is not True:
return jscs_quote... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type(self):\n if self.data[\"is_script\"]:\n return self.data[\"script\"]\n elif self.data[\"is_qt\"]:\n return \"qt\"\n else:\n return \"normal\"",
"def get_type(self) -> str:\n # Note: this name conflicts with existing python builtins\n ... | [
"0.6076279",
"0.60122496",
"0.5968294",
"0.59570783",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
"0.5889422",
... | 0.68239087 | 0 |
Create and save a User with the given email and password. | def create_user(self, username, password,cpf, **extra_fields):
user = self.model(username=username, cpf=cpf, **extra_fields)
user.set_password(password)
user.save()
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user",
"def... | [
"0.85445017",
"0.8511888",
"0.850827",
"0.85025996",
"0.8502548",
"0.84896004",
"0.84896004",
"0.84888655",
"0.84888655",
"0.84888655",
"0.8486028",
"0.84772795",
"0.84767693",
"0.8475504",
"0.8475504",
"0.8475504",
"0.8475504",
"0.8475504",
"0.8475504",
"0.8475504",
"0.84755... | 0.0 | -1 |
The set of arguments for constructing a IdentityPoolProviderPrincipalTag resource. | def __init__(__self__, *,
identity_pool_id: pulumi.Input[str],
identity_provider_name: pulumi.Input[str],
principal_tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
use_defaults: Optional[pulumi.Input[bool]] = None):
pulumi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: IdentityPoolProviderPrincipalTagArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.Resourc... | [
"0.7856163",
"0.64542943",
"0.6376276",
"0.5968333",
"0.5625083",
"0.5487669",
"0.5449511",
"0.5414559",
"0.54109836",
"0.5339899",
"0.53381735",
"0.53368294",
"0.5325394",
"0.53140837",
"0.52848655",
"0.52398705",
"0.52252465",
"0.52150136",
"0.51871485",
"0.5153368",
"0.514... | 0.6546987 | 1 |
The name of the identity provider. | def identity_provider_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "identity_provider_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_provider_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"identity_provider_name\")",
"def identity_provider_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"identity_provider_name\")",
"def provider_name(self):\n raise NotImplementedError",
... | [
"0.9126659",
"0.8877346",
"0.8368294",
"0.8306505",
"0.8110782",
"0.80312",
"0.7812182",
"0.7812182",
"0.7771749",
"0.754476",
"0.754476",
"0.75150007",
"0.7478888",
"0.74466497",
"0.73160523",
"0.73160523",
"0.7292682",
"0.7079154",
"0.6827711",
"0.6733854",
"0.66272384",
... | 0.8995868 | 1 |
The name of the identity provider. | def identity_provider_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "identity_provider_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_provider_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"identity_provider_name\")",
"def identity_provider_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"identity_provider_name\")",
"def provider_name(self):\n raise NotImplementedError",
"def pro... | [
"0.9126659",
"0.8995868",
"0.8368294",
"0.8306505",
"0.8110782",
"0.80312",
"0.7812182",
"0.7812182",
"0.7771749",
"0.754476",
"0.754476",
"0.75150007",
"0.7478888",
"0.74466497",
"0.73160523",
"0.73160523",
"0.7292682",
"0.7079154",
"0.6827711",
"0.6733854",
"0.66272384",
... | 0.8877346 | 2 |
The name of the identity provider. | def identity_provider_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "identity_provider_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_provider_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"identity_provider_name\")",
"def identity_provider_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"identity_provider_name\")",
"def provider_name(self):\n raise NotImplementedError",
... | [
"0.8995868",
"0.8877346",
"0.8368294",
"0.8306505",
"0.8110782",
"0.80312",
"0.7812182",
"0.7812182",
"0.7771749",
"0.754476",
"0.754476",
"0.75150007",
"0.7478888",
"0.74466497",
"0.73160523",
"0.73160523",
"0.7292682",
"0.7079154",
"0.6827711",
"0.6733854",
"0.66272384",
... | 0.9126659 | 0 |
Returns the basename of the file/directory path in an _extremely_ robust way. For example, pathLeaf('/hame/saheel/git_repos/szz/abc.c/') will return 'abc.c'. | def pathLeaf(path):
head, tail = ntpath.split(path)
return tail or ntpath.basename(head) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_leaf(path):\n head, tail = ntpath.split(path)\n return tail or ntpath.basename(head)",
"def path_leaf(path):\n\thead, tail = ntpath.split(path)\n\treturn tail or ntpath.basename(head)",
"def get_leafname(path):\n\n\tpos = string.rfind(path, os.sep)\n\tif pos != -1:\n\t\treturn path[pos+1:]\n\tel... | [
"0.8202049",
"0.81125677",
"0.77742285",
"0.75503045",
"0.7526012",
"0.73413885",
"0.7088789",
"0.6984967",
"0.6955897",
"0.68906826",
"0.68379354",
"0.6827969",
"0.6780256",
"0.67511636",
"0.6678975",
"0.6597504",
"0.65930575",
"0.65369546",
"0.65035325",
"0.6499314",
"0.648... | 0.84374326 | 0 |
The set of arguments for constructing a ZoneRecord resource. | def __init__(__self__, *,
name: pulumi.Input[str],
type: pulumi.Input[str],
value: pulumi.Input[str],
zone_name: pulumi.Input[str],
priority: Optional[pulumi.Input[str]] = None,
ttl: Optional[pulumi.Input[str]] = None)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: ZoneRecordArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: ZoneArgs,\n opts: Optional[pu... | [
"0.79474014",
"0.70792985",
"0.68267864",
"0.61910474",
"0.61910474",
"0.6018199",
"0.59495425",
"0.5877239",
"0.58642316",
"0.57127786",
"0.566689",
"0.5586038",
"0.55822587",
"0.55686414",
"0.5559386",
"0.5530039",
"0.54872674",
"0.5478282",
"0.54638374",
"0.54526305",
"0.5... | 0.51337516 | 42 |
It returns the maximum of the realizations of the process at time timeIndex | def getMaximumAtGivenTime(self, timeIndex):
realizationsAtTimeIndex = self.getRealizationsAtGivenTime(timeIndex)
return np.max(realizationsAtTimeIndex) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEvolutionMax(self):\n \n return [self.getMaximumAtGivenTime(timeIndex) for timeIndex in range(self.numberOfTimes - 1)]",
"def max_time(self):\n return self.time[np.argmax(self.flux)]",
"def max(self):\n\n return time_stat(self, stat=\"max\")",
"def max_time(self) -> float:\r\n ... | [
"0.7338751",
"0.71580356",
"0.6704653",
"0.6664134",
"0.6621409",
"0.6446359",
"0.63972676",
"0.6210386",
"0.608417",
"0.6026619",
"0.60082227",
"0.5994343",
"0.5993893",
"0.5967766",
"0.5956552",
"0.5921046",
"0.5900468",
"0.58589935",
"0.5795851",
"0.5795324",
"0.5782808",
... | 0.76386476 | 0 |
Draw a rounded rectangle around an image | def draw_rounded_rectangle(
img: PilImage, color: PilColor, arc_size: int = 20
) -> PilImage:
x0, y0, x1, y1 = img.getbbox()
x1 -= 1
y1 -= 1
copy = img.copy()
draw = ImageDraw.Draw(copy)
arc_size_half = arc_size // 2
draw.arc((x0, y0, arc_size, arc_size), start=180, end=270, fill=color)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_rounded_rectangle(\n img: PilImage, color: PilColor, arc_size: int = 20\n) -> PilImage:\n # pylint: disable=invalid-name\n x0, y0, x1, y1 = img.getbbox()\n x1 -= 1\n y1 -= 1\n copy = img.copy()\n draw = ImageDraw.Draw(copy)\n arc_size_half = arc_size // 2\n draw.arc((x0, y0, arc... | [
"0.7510413",
"0.72969645",
"0.7181461",
"0.6953991",
"0.6858651",
"0.68553674",
"0.6835767",
"0.68216497",
"0.6786222",
"0.67735654",
"0.6771525",
"0.6707417",
"0.66786045",
"0.6653492",
"0.66526777",
"0.66202426",
"0.6594753",
"0.6554674",
"0.6513422",
"0.6496861",
"0.646856... | 0.77442485 | 0 |
Return minimum policy action value for a state | def min_value(policy_lookup, state, player):
action_values = list(get_policy_actions(policy_lookup, state, player).values())
if action_values:
return np.min(action_values)
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n possibleActions = self.mdp.getPossibleActions(state)\n if len(possibleActions) == 0: return None\n results = []\n for action in possibleActions:\n total = 0\n for (nextState, prob) in self.mdp.getTra... | [
"0.7423119",
"0.741661",
"0.737838",
"0.72380596",
"0.72140557",
"0.7211273",
"0.71713763",
"0.71495",
"0.7147739",
"0.7118717",
"0.70819044",
"0.7045204",
"0.70225585",
"0.7010276",
"0.7000682",
"0.6985005",
"0.69514984",
"0.69384867",
"0.69344324",
"0.68877256",
"0.6883074"... | 0.8106444 | 0 |
Returns the reward for the given action and observation. | def get_reward_dict(
self,
action: np.ndarray,
obs_dict: Dict[str, np.ndarray],
) -> Dict[str, np.ndarray]:
pose_mean_error = np.abs(obs_dict['pose_error']).mean(axis=1)
upright = obs_dict[self._upright_obs_key]
center_dist = np.linalg.norm(obs_dict['root_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_reward(self, action):\n HIRE_COST = 1 # TODO 7/29/20 - Determine significance of this value\n\n # Lookup the state representation using the cur_state index. Then we\n # can get the candidate productivity score.\n obs = self.observation_function[self.cur_state]\n prod_sc... | [
"0.7533448",
"0.74208605",
"0.73254144",
"0.73105955",
"0.72739947",
"0.72213364",
"0.71720135",
"0.71208405",
"0.70812225",
"0.70812225",
"0.70812225",
"0.69682133",
"0.69488806",
"0.6940732",
"0.6933153",
"0.68504405",
"0.68037796",
"0.67748386",
"0.67460334",
"0.6745014",
... | 0.6693198 | 23 |
generate a random filename | def random_filename():
return ''.join(random.choices(string.ascii_uppercase + string.digits, k=5)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_random_file_name():\n\n def random_file_name_factory():\n length = random.randint(10, 15)\n chars = string.ascii_letters + string.digits + \"-_\"\n return f\"{''.join(random.choice(chars) for _ in range(length))}.jpg\"\n\n return random_file_name_factory",
"def generate_file... | [
"0.85415816",
"0.80759776",
"0.7940292",
"0.7855972",
"0.78502667",
"0.7841351",
"0.77415335",
"0.77123237",
"0.7674128",
"0.74968827",
"0.7459299",
"0.7438276",
"0.7380692",
"0.7274986",
"0.7238404",
"0.7179149",
"0.714998",
"0.71346515",
"0.71212363",
"0.71189535",
"0.71006... | 0.8476896 | 1 |
returns boolean describing if stack is empty | def is_empty(self) -> bool:
return self.top is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self):\r\n return len(self.stack) == 0",
... | [
"0.9195409",
"0.9139437",
"0.9138761",
"0.91130227",
"0.9081705",
"0.9078823",
"0.9078823",
"0.90420336",
"0.9039945",
"0.8910066",
"0.88842684",
"0.88689715",
"0.8860931",
"0.8858098",
"0.8858098",
"0.88506955",
"0.8843455",
"0.88232195",
"0.88037634",
"0.8796764",
"0.875101... | 0.823481 | 30 |
Return the number of columns for the shape. | def get_shape_columns(shape):
try:
return shape[1]
except (IndexError, TypeError):
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_cols(self):\n return (len(self.rows[0]))",
"def num_cols(self):\n return len(self.rows[0])",
"def getNbColumns(self):\n return self.data.shape[0]",
"def ncolumns(self):\n return self.__ncols",
"def columns(self) -> int:\n return self.__squares[0].__len__()",
"de... | [
"0.8265363",
"0.82377744",
"0.8205495",
"0.82000524",
"0.81714004",
"0.79969543",
"0.7995992",
"0.7914246",
"0.78837144",
"0.78532577",
"0.78304315",
"0.7797577",
"0.77827936",
"0.77743727",
"0.77593285",
"0.7757879",
"0.7688558",
"0.76704913",
"0.7641484",
"0.7618398",
"0.76... | 0.7156592 | 52 |
Return the current size of the buffer. | def __len__(self):
return self._length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self):\n return len(self.buffer)",
"def buffer_size(self):\n if not hasattr(self, '_buffer_size'):\n self._buffer_size = 0\n return int(self._buffer_size)\n else: return int(self._buffer_size)",
"def get_buffer_size(self):\n return len(self._buffers) i... | [
"0.8666308",
"0.8481097",
"0.83880824",
"0.8089863",
"0.77311766",
"0.7679068",
"0.76216567",
"0.76216567",
"0.7616219",
"0.7591638",
"0.7582188",
"0.75450385",
"0.7543614",
"0.7536537",
"0.7536537",
"0.7520388",
"0.7520388",
"0.75113463",
"0.74997824",
"0.7489067",
"0.748721... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, DetailItem):
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 |
Gets the policy for a certificate. Requires certificates/get permission. Returns the specified certificate policy resources in the key vault. | async def get_certificate_policy(self, certificate_name: str, **kwargs) -> CertificatePolicy:
bundle = await self._client.get_certificate_policy(
vault_base_url=self.vault_url, certificate_name=certificate_name, **kwargs
)
return CertificatePolicy._from_certificate_policy_bundle(cert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_certificate_policy_request(self, vault_name: str, certificate_name: str) -> dict[str, Any]:\n url = f'https://{vault_name}{self.azure_cloud.suffixes.keyvault_dns}/certificates/{certificate_name}/policy'\n response = self.http_request(\n 'GET', full_url=url, resource=self.get_vault_... | [
"0.77671975",
"0.6953911",
"0.5839124",
"0.5742078",
"0.5690433",
"0.5651099",
"0.5582334",
"0.5481366",
"0.5472438",
"0.5401795",
"0.53769606",
"0.53623295",
"0.53264284",
"0.53199345",
"0.5318054",
"0.5287591",
"0.5262056",
"0.52577",
"0.5184184",
"0.5177227",
"0.5166596",
... | 0.7358483 | 1 |
Lists the currentlyrecoverable deleted certificates. Possible only if vault is softdelete enabled. Requires certificates/get/list permission. Retrieves the certificates in the current vault which are in a deleted state and ready for recovery or purging. This operation includes deletionspecific information. | def list_deleted_certificates(
self, *, include_pending: Optional[bool] = None, **kwargs
) -> AsyncItemPaged[DeletedCertificate]:
max_page_size = kwargs.pop("max_page_size", None)
if self.api_version == "2016-10-01":
if include_pending is not None:
raise NotImple... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def recover_deleted_certificate(self, certificate_name: str, **kwargs) -> KeyVaultCertificate:\n polling_interval = kwargs.pop(\"_polling_interval\", None)\n if polling_interval is None:\n polling_interval = 2\n recovered_cert_bundle = await self._client.recover_deleted_certif... | [
"0.5930504",
"0.5810624",
"0.5445564",
"0.5431113",
"0.5354896",
"0.5310337",
"0.5298006",
"0.5263039",
"0.52389675",
"0.5166186",
"0.51401037",
"0.5125574",
"0.5110472",
"0.5071451",
"0.5021978",
"0.50173384",
"0.49939674",
"0.49534753",
"0.49424502",
"0.4934416",
"0.4934416... | 0.6773191 | 0 |
Get the action from a potential command. | def get_action(line, _test_myid=None):
try:
line = line.strip()
if not check(line):
logging.debug('checksum failure')
return
line = line[:-8] # discard the checksum and retain the message
tmp = json.loads(line)
#print tmp['from']
#print tmp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_action(command):\n return command.split(\" \")[0]",
"def command(self):\n if self.model is self.model_action:\n return self.command_action\n else:\n return self.command_candidate",
"def get_command(self, module_name, command_name):\r\n actions = self.plugin... | [
"0.81352466",
"0.72584975",
"0.7101164",
"0.7090752",
"0.6910988",
"0.6900157",
"0.68786496",
"0.67779684",
"0.6773228",
"0.67432743",
"0.67422575",
"0.67312354",
"0.6721897",
"0.66882515",
"0.664707",
"0.6592502",
"0.6592502",
"0.65912694",
"0.6573718",
"0.65539795",
"0.6536... | 0.0 | -1 |
Checks if a namespace would normally be required. | def ShouldRequireNamespace(namespace, identifier):
return (
not self._IsPrivateIdentifier(identifier) and
namespace not in external_dependencies and
namespace not in self._provided_namespaces and
identifier not in external_dependencies and
identifier not in create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _namespace_requested(self, namespace):\r\n if namespace is None:\r\n return False\r\n namespace_tuple = self._tuplefy_namespace(namespace)\r\n if namespace_tuple[0] in IGNORE_DBS:\r\n return False\r\n elif namespace_tuple[1] in IGNORE_COLLECTIONS:\r\n ... | [
"0.73953635",
"0.7301753",
"0.65251887",
"0.6509852",
"0.64805037",
"0.64667636",
"0.6344185",
"0.6334187",
"0.61623454",
"0.6138466",
"0.61357164",
"0.60664326",
"0.6056696",
"0.60520434",
"0.6033502",
"0.5975159",
"0.58885986",
"0.5803981",
"0.5801867",
"0.5779978",
"0.5777... | 0.7544301 | 0 |
Given an identifier, returns the namespace that identifier is from. | def GetClosurizedNamespace(self, identifier):
if identifier.startswith('goog.global'):
# Ignore goog.global, since it is, by definition, global.
return None
parts = identifier.split('.')
for namespace in self._closurized_namespaces:
if not identifier.startswith(namespace + '.'):
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _FindNamespace(self, identifier, *namespaces_list):\n identifier = identifier.rsplit('.', 1)[0]\n identifier_prefix = identifier + '.'\n for namespaces in namespaces_list:\n for namespace in namespaces:\n if namespace == identifier or namespace.startswith(identifier_prefix):\n ret... | [
"0.73214567",
"0.69004667",
"0.66741085",
"0.6579265",
"0.65480053",
"0.64443076",
"0.644335",
"0.64083934",
"0.6400473",
"0.6396981",
"0.63754004",
"0.63670295",
"0.63670295",
"0.63670295",
"0.6332623",
"0.6325914",
"0.6301721",
"0.62328607",
"0.6181503",
"0.61467093",
"0.61... | 0.665334 | 3 |
Given a NumPy / OpenCV 2 image, crops it to the given width and height, around it's centre point | def crop_around_center(image, width, height):
image_size = (image.shape[1], image.shape[0])
image_center = (int(image_size[0] * 0.5), int(image_size[1] * 0.5))
if width > image_size[0]:
width = image_size[0]
if height > image_size[1]:
height = image_size[1]
x1 = int(image_center[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crop(img: 'np.ndarray', x: int, y: int, width: int, height: int) -> 'np.ndarray':\n return img[y:y+height, x:x+width]",
"def crop_around_center(image, width, height):\r\n\r\n image_size = (image.shape[1], image.shape[0])\r\n image_center = (int(image_size[0] * 0.5), int(image_size[1] * 0.5))... | [
"0.76377535",
"0.74180055",
"0.738121",
"0.738121",
"0.738121",
"0.7380922",
"0.7331407",
"0.728423",
"0.727816",
"0.7252315",
"0.72463363",
"0.72463363",
"0.7190007",
"0.7180537",
"0.7168692",
"0.7141646",
"0.71074295",
"0.70952344",
"0.70926756",
"0.7081143",
"0.7067312",
... | 0.7369841 | 6 |
Translate a /separated PATH to the local filename syntax. Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.) | def translate_path(self, path):
# abandon query parameters
path = path.split('?', 1)[0]
path = path.split('#', 1)[0]
# Don't forget explicit trailing slash when normalizing. Issue17324
trailing_slash = path.rstrip().endswith('/')
try:
path = urllib.parse.unquo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertString(path):\n if (\"win\" in sys.platform):\n return path.replace(\"/\",\"\\\\\")\n elif (\"linux\" in sys.platform):\n return path.replace(\"\\\\\",\"/\")",
"def mangle_path(path):\n # Remove assigns\n path = servers.get_file_server().manglepath( str(path) )\n # Remove ... | [
"0.6912745",
"0.68098015",
"0.67779696",
"0.6675863",
"0.6658408",
"0.6656788",
"0.66375124",
"0.6600231",
"0.6576798",
"0.6561927",
"0.653573",
"0.65168357",
"0.651413",
"0.65127575",
"0.64986885",
"0.6469423",
"0.6468906",
"0.64511365",
"0.64394665",
"0.64375925",
"0.636465... | 0.65298456 | 11 |
Sets the source index of this source. This is called by the light, as only the light knows at which position this source is in the Sources array. | def setSourceIndex(self, index):
self.sourceIndex = index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_source(self, source_name):\n self.source = source_name",
"def source_id(self, source_id):\n\n self._source_id = source_id",
"def source_id(self, source_id):\n\n self._source_id = source_id",
"def set_source(self, source):\n self.data['source'] = source",
"def source(self... | [
"0.679036",
"0.66052014",
"0.66052014",
"0.6591564",
"0.6569787",
"0.62374467",
"0.6223604",
"0.6223604",
"0.6223604",
"0.6223604",
"0.6223604",
"0.6223604",
"0.6223604",
"0.61710954",
"0.61393267",
"0.6092534",
"0.6084271",
"0.6015366",
"0.5984961",
"0.59811014",
"0.5959025"... | 0.8529315 | 0 |
Computes the modelViewProjection matrix for the lens. Actually, this is the worldViewProjection matrix, but for convenience it is called mvp. | def computeMVP(self):
projMat = self.converterYUR
modelViewMat = self.transforMat.invertCompose(
Globals.render.getTransform(self.cameraNode)).getMat()
return UnalignedLMatrix4f(modelViewMat * projMat) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modelview_matrix(self):\n camera = self.figure.scene.camera\n return camera.view_transform_matrix.to_array().astype(np.float32)",
"def projection_matrix(self):\n scene = self.figure.scene\n scene_size = tuple(scene.get_size())\n aspect_ratio = float(scene_size[0]) / float(s... | [
"0.70178586",
"0.6966919",
"0.6562363",
"0.65267247",
"0.64798117",
"0.64471877",
"0.63473505",
"0.6164686",
"0.61556834",
"0.61460024",
"0.6138456",
"0.6125117",
"0.60684174",
"0.60494584",
"0.60469806",
"0.6032966",
"0.6031657",
"0.59044665",
"0.5889228",
"0.5841249",
"0.58... | 0.7526075 | 0 |
Returns wheter this ShadowSource has already a position in the shadow atlas | def hasAtlasPos(self):
return self.doesHaveAtlasPos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_origin(self):\n return self.contains(self.ambient_space().zero())",
"def has_positions(self):\n return self.positions.exists()",
"def has_pos(self) -> object:\n return self._has_pos",
"def is_origin(self) -> bool:\n return self.x == 0 and self.y == 0",
"def has_dest... | [
"0.660991",
"0.65274745",
"0.64275694",
"0.6206538",
"0.6185759",
"0.61701924",
"0.6113514",
"0.6070053",
"0.6006791",
"0.59578675",
"0.59305793",
"0.59122664",
"0.5864909",
"0.58581674",
"0.5855908",
"0.581775",
"0.58165866",
"0.5779871",
"0.5778968",
"0.57593817",
"0.574624... | 0.6653766 | 0 |
Sets the rotation in world space | def setHpr(self, hpr):
self.cameraNode.setHpr(hpr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rotation(self, roll, yaw, pitch):\n self.cam['rotation'] = [float(roll), float(yaw), float(pitch)]\n\n roll, pitch, yaw = self._zyxEulDegree2zxyEulDegree(roll, yaw, pitch)\n\n cmd = 'vset /camera/{cam_id}/rotation {pitch:.3f} {yaw:.3f} {roll:.3f}'\n cmd = cmd.format(cam_id=self.... | [
"0.7126893",
"0.6963359",
"0.6884388",
"0.66615605",
"0.66113776",
"0.65170646",
"0.6456302",
"0.63890064",
"0.6385022",
"0.6341152",
"0.63328445",
"0.6283624",
"0.62803304",
"0.62667835",
"0.6227101",
"0.62026715",
"0.6170789",
"0.61591697",
"0.6155315",
"0.61423755",
"0.611... | 0.0 | -1 |
Returns wether the shadow map is still valid or should be refreshed | def isValid(self):
return self.valid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkMap(self):\n return True",
"def is_map_updated(self):\r\n self.old_obs_len =0\r\n if len(self.obs_ls[0])!= self.old_obs_len:\r\n self.old_obs_len =len(self.obs_ls[0])\r\n return True\r\n return False",
"def is_fresh(self):\n return not self.used... | [
"0.70872784",
"0.6331903",
"0.6285656",
"0.60959464",
"0.6073506",
"0.6061959",
"0.6011869",
"0.5988743",
"0.59820324",
"0.5943049",
"0.59332216",
"0.59209114",
"0.5894826",
"0.5890327",
"0.5858336",
"0.5857973",
"0.5849553",
"0.58447254",
"0.5814025",
"0.5811544",
"0.5801238... | 0.0 | -1 |
Returns a representative string of this instance | def __repr__(self):
return "ShadowSource[id=" + str(self.index) + "]" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())",
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())",
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.ge... | [
"0.8517496",
"0.8517496",
"0.8517496",
"0.8469982",
"0.8469982",
"0.8469982",
"0.8469982",
"0.83842945",
"0.8379893",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.83648777",
"0.8... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.