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 |
|---|---|---|---|---|---|---|
Returns a new URI object with the same data as this URI, except that the path component and the query component are set to None. (If this URI is not a regular URI, the same object is returned.) | def removePath(self):
if not self.isRegularURI():
return self
return URI(self._scheme, self._host, self._port, None, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EMPTY():\n if URI._empty is None:\n URI._empty = URI(None, \"[empty]\", None, None, None)\n URI._empty._isRegularURI = False\n return URI._empty",
"def cloneURL(self, scheme, netloc, pathsegs, querysegs, fragment):\n return self.__class__(\n self.magicVal... | [
"0.6651197",
"0.6377896",
"0.6364552",
"0.62380993",
"0.61387855",
"0.60857713",
"0.59040195",
"0.58819675",
"0.5870885",
"0.5855885",
"0.5794956",
"0.56924075",
"0.5659867",
"0.5618484",
"0.55975676",
"0.5552785",
"0.5535637",
"0.5501848",
"0.54933864",
"0.5420879",
"0.54192... | 0.7208295 | 0 |
Returns a full representation of this URI. Equivalent to __str__(). | def __repr__(self):
return str(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n if self._str is None:\n # special cases\n if self == URI.INVALID():\n self._str = \"[invalid]\"\n elif self == URI.EMPTY():\n self._str = \"\"\n elif self == URI.INLINE():\n self._str = \"[inline]\"... | [
"0.7912723",
"0.7633229",
"0.75725734",
"0.74806416",
"0.7458137",
"0.7363973",
"0.7297208",
"0.7179357",
"0.7159467",
"0.7155479",
"0.7124157",
"0.7096882",
"0.7082331",
"0.7039301",
"0.70048344",
"0.6958759",
"0.69582856",
"0.69444084",
"0.6908132",
"0.69059646",
"0.6897072... | 0.0 | -1 |
Returns True if both URI objects represent the same URI (componentwise equality). | def __eq__(self, other):
if type(other) != URI:
return False
return (self._scheme == other._scheme
and self._host == other._host
and self._port == other._port
and self._path == other._path
and self._query == other._query
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other: Any) -> bool:\n return isinstance(other, URI) and str(self) == str(other)",
"def __eq__(self, other: object) -> bool:\n if not isinstance(other, URI):\n return NotImplemented\n return str(self) == str(other)",
"def equals(self, uri):\r\n return sel... | [
"0.80378115",
"0.78825074",
"0.7819555",
"0.7121348",
"0.6836446",
"0.6750079",
"0.64966226",
"0.63599986",
"0.63437074",
"0.62827814",
"0.62559074",
"0.62244",
"0.6203101",
"0.6201374",
"0.6159698",
"0.61431617",
"0.61220664",
"0.6119619",
"0.6089377",
"0.6066123",
"0.603860... | 0.84081423 | 0 |
Parses the given 'uriString' according to the parameters set in the constructor of this URIParser and returns an URI object. The URI object retains only the scheme, host, port, and path components if they are given in 'uriString', but they may be empty or None if not in the string. This implementation is mostly geared ... | def parse(self, uriString):
uriString = uriString.strip()
# empty URI
if uriString == "" or uriString.lower() == "null":
return URI.EMPTY()
# (known) scheme only, nothing else
if uriString.lower() in self.schemePortMappings:
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseURI(str):\n ret = libxml2mod.xmlParseURI(str)\n if ret is None:raise uriError('xmlParseURI() failed')\n return URI(_obj=ret)",
"def normalize_base_string_uri(uri, host=None):\n uri = to_unicode(uri)\n scheme, netloc, path, params, query, fragment = urlparse.urlparse(uri)\n\n # The sche... | [
"0.70343053",
"0.661108",
"0.6446344",
"0.5879422",
"0.58435655",
"0.58089656",
"0.5600171",
"0.54221135",
"0.5415154",
"0.5367117",
"0.53290766",
"0.52877486",
"0.523993",
"0.5197123",
"0.5185314",
"0.51809007",
"0.51359195",
"0.5078286",
"0.50015265",
"0.4990426",
"0.498312... | 0.83383083 | 0 |
Used in sort_priority function swaps item in current index with item in index of next lowest priority | def swap_values_at_indexes(todo_list, first, second):
try:
temp = todo_list[first]
todo_list[first] = todo_list[second]
todo_list[second] = temp
except first:
print("issue with first")
except second:
print("issue with second") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_priority(todo_list):\n for index in range(len(todo_list)):\n smallest_index = find_index_of_smallest_after(todo_list, index)\n swap_values_at_indexes(todo_list, index, smallest_index)",
"def change_priority(self, elem, prio):\n pos = self.pos[elem]\n currPrio = self.A[pos]... | [
"0.7187182",
"0.70874166",
"0.6895728",
"0.6778596",
"0.6658544",
"0.66086364",
"0.6575057",
"0.63404775",
"0.62299055",
"0.6204114",
"0.61384463",
"0.6137309",
"0.61122495",
"0.60962826",
"0.60932034",
"0.60932034",
"0.60664916",
"0.60623926",
"0.59791684",
"0.5974096",
"0.5... | 0.5501909 | 80 |
Returns an unused preset name based on the classname, in the form "ClassnameN", where N is an integer. | def suggest_preset_name(self, classname):
i = 1
name = classname + "-" + str(i)
while self.preset_name_exists(name):
i += 1
name = classname + "-" + str(i)
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_unique_class_name(self):\n if Project.__next_type_id > 2_000_000_000:\n raise Exception(\"Too many classes\")\n\n Project.__next_type_id += 1\n return f'Class_{Project.__next_type_id}'",
"def generate_class_name(self):\n self.class_name = self.profile_id_dict[s... | [
"0.65394455",
"0.64871633",
"0.63299143",
"0.6325319",
"0.6175612",
"0.6139567",
"0.61234415",
"0.6115569",
"0.6092011",
"0.60286057",
"0.6015198",
"0.59858036",
"0.5978707",
"0.5974902",
"0.5962151",
"0.59127384",
"0.5898261",
"0.5894459",
"0.58686745",
"0.5845049",
"0.58202... | 0.7893771 | 0 |
Retrieve time stamp string. | def get_time_stamp():
with open(TIME_STAMP_FILE_NAME, 'r') as f:
s = f.readline()
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')",
"def timeStamp():\n import time\n return str(time.strftime(\"%a %d %b %Y %I:%M:%S %p\"))",
"def _get_timestamp():\n return str(int(time.time()))",
"def getTimeString():\n\tfrom time import strftime\n\treturn strftime(\... | [
"0.81061745",
"0.80073476",
"0.7934414",
"0.7862707",
"0.78200823",
"0.7734901",
"0.77174103",
"0.7710191",
"0.76330554",
"0.75882995",
"0.75652194",
"0.7534689",
"0.749181",
"0.74885124",
"0.74885124",
"0.7481757",
"0.7476119",
"0.74550647",
"0.7385385",
"0.7367298",
"0.7363... | 0.74552846 | 17 |
Return the word for an index. | def get_word(self, word_id):
if word_id in self.id_to_word:
return self.id_to_word[word_id]
return constants.UNK_TOKEN | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word_with_index(index):\n return reverse_word_index[index-3]",
"def index2word(index_word, index_dict):\n if index_word == -1 or index_word not in index_dict.keys():\n return '_eps_'\n else:\n return index_dict[index_word]",
"def word_at(self, index, signed = False):\n return ... | [
"0.8132069",
"0.7708071",
"0.76192987",
"0.76118094",
"0.7112134",
"0.68690115",
"0.6859187",
"0.6857704",
"0.6777799",
"0.669535",
"0.6672722",
"0.6664237",
"0.6645846",
"0.6634452",
"0.65863305",
"0.65736383",
"0.649005",
"0.6467172",
"0.6464613",
"0.6460671",
"0.64569217",... | 0.5970194 | 63 |
Return words for a list of indices. | def get_words(self, indices):
return [self.get_word(index) for index in indices] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idx_to_words(ls, words):\n\n output = []\n for sub_ls in ls:\n word = words[sub_ls[0]]\n for idx in sub_ls[1:]:\n word = \" \".join([word, words[idx]])\n output.append([sub_ls, word])\n return output",
"def convert_to_word(self, ids):\n return [self.index2word[... | [
"0.70885533",
"0.6909252",
"0.67896485",
"0.6728408",
"0.6401722",
"0.62644106",
"0.6204909",
"0.6175917",
"0.6168778",
"0.6155636",
"0.61548007",
"0.6125344",
"0.6113388",
"0.60593027",
"0.6055191",
"0.6054877",
"0.6017031",
"0.59476066",
"0.59192574",
"0.5883873",
"0.587333... | 0.87396324 | 0 |
Compute learning rate at a given step. | def rate(self, step=None):
if step is None:
step = self._step
learning_rate = (
self.factor *
self.model_size ** (-0.5) *
min(step ** (-0.5), step * self.warmup ** (-1.5))
)
return learning_rate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_learning_rate(self, step):\n rate = 0\n progress = 100 * (step / self.max_steps) # expressed in percent units\n\n if self.policy == \"fixed\":\n rate = self.base_rate\n elif self.policy == \"step\":\n current_step = math.floor(step/self.step_size)\n ... | [
"0.76802695",
"0.7630453",
"0.7266324",
"0.7203113",
"0.72026855",
"0.7125982",
"0.7125982",
"0.71028453",
"0.7049395",
"0.7019204",
"0.70136595",
"0.69921494",
"0.6990945",
"0.6989268",
"0.6951238",
"0.69506973",
"0.69506973",
"0.6944442",
"0.69196355",
"0.68931216",
"0.6852... | 0.8495864 | 0 |
Test that the Story.contributor_name returns an empty string when there is no first or last name | def test_contributor_name_no_names(self):
user = User.objects.create(username='admin')
title = ('Transportation Challenges Limit Education Choices for '
'Denver Parents')
summary = """
Many families in the Denver metro area use public
transportation inste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_contributor_name_no_last_name(self):\n user = User.objects.create(username='admin', first_name='Jordan')\n \n title = ('Transportation Challenges Limit Education Choices for '\n 'Denver Parents')\n summary = \"\"\"\n Many fa... | [
"0.8306883",
"0.8306883",
"0.8115983",
"0.76629496",
"0.76629496",
"0.63395166",
"0.6284725",
"0.6255837",
"0.6192192",
"0.61484116",
"0.61393034",
"0.6116437",
"0.6059672",
"0.605707",
"0.6049296",
"0.6040935",
"0.6040935",
"0.6015136",
"0.6004368",
"0.5997357",
"0.5982062",... | 0.84791434 | 0 |
Test that an asset is also added to the assets relation when it's added to the featured_assets relation. | def test_add_assets_signal(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status='published')
asset = create_html_asset(type='text', title='Test Asset',
body='Test content')
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_already_added_asset(self):\n # assign the asset to the story\n self.story.assets.add(self.asset)\n self.story.save()\n # confirm the asset is added to the story\n self.assertTrue(self.asset in self.story.assets.select_subclasses())\n # Assign the asset to the sect... | [
"0.7884849",
"0.73127383",
"0.72699225",
"0.70208526",
"0.64075065",
"0.6393676",
"0.6215597",
"0.61853987",
"0.61622375",
"0.6142905",
"0.61407155",
"0.6093229",
"0.60141116",
"0.59871083",
"0.59747326",
"0.5950886",
"0.5947963",
"0.59105223",
"0.5904324",
"0.58502126",
"0.5... | 0.7892734 | 0 |
Test that a story has a CC BY license by default | def test_default_license(self):
# When no license is specified, the license should default to "CC BY"
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline")
self.assertEqual(story.license, 'CC BY')
# When a license is specified, it should be s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_asset_license(self):\n\n story = create_story(title=\"Test Story\", summary=\"Test Summary\",\n byline=\"Test Byline\", status='published')\n asset = create_html_asset(type='text', title='Test Asset', \n body='Test content')\n ... | [
"0.73128223",
"0.7218331",
"0.6924882",
"0.68635356",
"0.6529698",
"0.63416",
"0.6300686",
"0.5956773",
"0.5941149",
"0.59276074",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59116477",
"0.59... | 0.76216245 | 0 |
Test that author has permissions to change their story | def test_user_can_change_as_author(self):
self.assertTrue(self.story.user_can_change(self.user1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_change_not_author(self):\n self.assertFalse(self.story.user_can_change(self.user2))",
"def test_user_can_change_admin(self):\n self.assertTrue(self.story.user_can_change(self.admin_user))",
"def test_has_perm_change(self):\n perm = \"change\"\n self.assertTrue(self... | [
"0.82464886",
"0.7887912",
"0.7813446",
"0.75100374",
"0.7389116",
"0.73135835",
"0.67822766",
"0.66520625",
"0.66379285",
"0.6632067",
"0.66297996",
"0.65948147",
"0.6556005",
"0.6535502",
"0.65350807",
"0.65300095",
"0.650615",
"0.6474685",
"0.6469218",
"0.6457518",
"0.6444... | 0.8574124 | 0 |
Test that has_perm(user, 'change') calls through to user_can_change | def test_has_perm_change(self):
perm = "change"
self.assertTrue(self.story.has_perm(self.user1, perm))
self.assertFalse(self.story.has_perm(self.user2, perm)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_change_permission(self):\r\n self.assertTrue(self.creator_admin.has_change_permission(self.request))\r\n\r\n self.request.user = self.user\r\n self.assertFalse(self.creator_admin.has_change_permission(self.request))",
"def test_user_can_change_admin(self):\n self.assertTrue(s... | [
"0.77301943",
"0.7717935",
"0.7445732",
"0.7427087",
"0.7306791",
"0.7196387",
"0.70325905",
"0.6932031",
"0.68946904",
"0.6888612",
"0.68770164",
"0.6865623",
"0.68455625",
"0.6826451",
"0.67868906",
"0.6762652",
"0.6723534",
"0.6702382",
"0.66899747",
"0.66880417",
"0.66872... | 0.8471084 | 0 |
Test the set_asset_license signal handler | def test_set_asset_license(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status='published')
asset = create_html_asset(type='text', title='Test Asset',
body='Test content')
story.asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_asset_license_connected(self):\n story = create_story(title=\"Test Story\", summary=\"Test Summary\",\n byline=\"Test Byline\", status='published')\n asset = create_html_asset(type='text', title='Test Asset', \n body='Test cont... | [
"0.74698013",
"0.6590399",
"0.64775425",
"0.6421594",
"0.6367484",
"0.6177804",
"0.6147927",
"0.61099756",
"0.61050093",
"0.60823464",
"0.6004472",
"0.59712905",
"0.5954859",
"0.588487",
"0.5882762",
"0.5827288",
"0.5796454",
"0.577517",
"0.57700956",
"0.57585526",
"0.5748974... | 0.8123487 | 0 |
Test that only one asset is allowed per container | def test_unique(self):
# Assign the asset to the section
container = Container.objects.get(name='left')
section_asset = SectionAsset(section=self.section, asset=self.asset,
container=container)
section_asset.save()
# Create a new assset
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_itar_restrict_asset(self):\n pass",
"def test_itar_restrict_test_asset(self):\n pass",
"def test_container_empty_assets(self):\n context = {\n 'assets': self.section.sectionasset_set.order_by('weight')\n }\n container_name = \"left\"\n html = contai... | [
"0.6985285",
"0.69349563",
"0.6716988",
"0.66831285",
"0.6641434",
"0.65896374",
"0.6348505",
"0.6278313",
"0.6210886",
"0.6204933",
"0.613902",
"0.6040007",
"0.60316646",
"0.60180587",
"0.5982315",
"0.5940133",
"0.59138316",
"0.59028137",
"0.5879038",
"0.58742803",
"0.580894... | 0.64057547 | 6 |
Test that a user cannot create a story if they aren't logged in | def test_post_list_unauthorized(self):
self.assertHttpUnauthorized(self.api_client.post('/api/0.1/stories/', format='json')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_story_no_token(self):\n res = self.client.post('/api/stories', headers={'token': ''}, data=json.dumps(story1))\n result = json.loads(res.data.decode())\n self.assertEqual(result['message'], 'Authentication required')\n self.assertEqual(res.status_code, 401)",
"def test... | [
"0.7115135",
"0.6994135",
"0.693226",
"0.68391955",
"0.68360484",
"0.6834727",
"0.6822413",
"0.6817139",
"0.66954863",
"0.66804326",
"0.6661864",
"0.66249144",
"0.66121405",
"0.66068065",
"0.6604865",
"0.65933406",
"0.65783006",
"0.6570107",
"0.6549684",
"0.6540338",
"0.65271... | 0.6683028 | 9 |
Test that user who is not author cannot update a story | def test_patch_detail_unauthorized(self):
author = User.objects.create_user("test2", "test2@example.com", "test2")
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status='published',
author=author)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_change_not_author(self):\n self.assertFalse(self.story.user_can_change(self.user2))",
"def test_update_by_non_owner(self):\n # User 1\n saved1 = self.create_article()\n article_url = saved1[0]\n # get user2 details\n token = self.create_article_user2()\... | [
"0.8287025",
"0.7424231",
"0.7209888",
"0.7151832",
"0.70868343",
"0.6993003",
"0.6930736",
"0.68109363",
"0.6708556",
"0.6598216",
"0.65586174",
"0.65474665",
"0.6540559",
"0.65239143",
"0.6522138",
"0.65159494",
"0.65149486",
"0.65075034",
"0.64406806",
"0.6427395",
"0.6417... | 0.6800343 | 8 |
Test that an author can update her own story | def test_patch_detail(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status='published',
author=self.user)
self.api_client.client.login(username=self.username, password=self.password)
data = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_change_as_author(self):\n self.assertTrue(self.story.user_can_change(self.user1))",
"def test_user_can_change_not_author(self):\n self.assertFalse(self.story.user_can_change(self.user2))",
"def test_update_by_non_owner(self):\n # User 1\n saved1 = self.create_artic... | [
"0.7748923",
"0.73002446",
"0.68861794",
"0.688175",
"0.6821335",
"0.6712051",
"0.6597138",
"0.6565546",
"0.65253997",
"0.65075326",
"0.6464434",
"0.6418681",
"0.6405776",
"0.63676864",
"0.6325379",
"0.6276835",
"0.6261731",
"0.62508875",
"0.62479997",
"0.62479997",
"0.622595... | 0.6561486 | 8 |
Test that user who is not author cannot update a story | def test_put_detail_unauthorized(self):
author = User.objects.create_user("test2", "test2@example.com", "test2")
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status='published',
author=author)
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_change_not_author(self):\n self.assertFalse(self.story.user_can_change(self.user2))",
"def test_update_by_non_owner(self):\n # User 1\n saved1 = self.create_article()\n article_url = saved1[0]\n # get user2 details\n token = self.create_article_user2()\... | [
"0.8287025",
"0.7424231",
"0.7209888",
"0.7151832",
"0.70868343",
"0.6993003",
"0.6930736",
"0.6800343",
"0.6708556",
"0.6598216",
"0.65586174",
"0.65474665",
"0.6540559",
"0.65239143",
"0.6522138",
"0.65159494",
"0.65149486",
"0.65075034",
"0.64406806",
"0.6427395",
"0.64177... | 0.68109363 | 7 |
Test that an author can update her own story | def test_put_detail(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status='published',
author=self.user)
self.api_client.client.login(username=self.username, password=self.password)
data = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_change_as_author(self):\n self.assertTrue(self.story.user_can_change(self.user1))",
"def test_user_can_change_not_author(self):\n self.assertFalse(self.story.user_can_change(self.user2))",
"def test_update_by_non_owner(self):\n # User 1\n saved1 = self.create_artic... | [
"0.7748923",
"0.73002446",
"0.68861794",
"0.688175",
"0.6712051",
"0.6597138",
"0.6565546",
"0.6561486",
"0.65253997",
"0.65075326",
"0.6464434",
"0.6418681",
"0.6405776",
"0.63676864",
"0.6325379",
"0.6276835",
"0.6261731",
"0.62508875",
"0.62479997",
"0.62479997",
"0.622595... | 0.6821335 | 4 |
Test that a user can update the metadata of a section | def test_patch_detail(self):
story_post_data = {
'title': "Test Story",
'summary': "Test Summary",
'byline': "Test Byline",
'status': "draft",
'language': "en",
}
section_post_data = {
'title': "Test Section",
'l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_metadata(self):\n pass",
"def test_update_metadata1(self):\n pass",
"def test_vault_update_vault_section(self):\n pass",
"def test_partial_update_metadata(self):\n pass",
"def test_partial_update_metadata1(self):\n pass",
"def test_update_metadata_by_att... | [
"0.74548537",
"0.72838056",
"0.72556543",
"0.7069546",
"0.70056087",
"0.67689264",
"0.6709686",
"0.64902157",
"0.6299618",
"0.6292771",
"0.62833977",
"0.6269302",
"0.625674",
"0.62526345",
"0.6184476",
"0.6184476",
"0.6184476",
"0.6178899",
"0.61626863",
"0.61471635",
"0.6139... | 0.61609745 | 19 |
Test that a user can update the metadata of a section | def test_put_detail(self):
story_post_data = {
'title': "Test Story",
'summary': "Test Summary",
'byline': "Test Byline",
'status': "draft",
'language': "en",
}
section_post_data = {
'title': "Test Section",
'lan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_metadata(self):\n pass",
"def test_update_metadata1(self):\n pass",
"def test_vault_update_vault_section(self):\n pass",
"def test_partial_update_metadata(self):\n pass",
"def test_partial_update_metadata1(self):\n pass",
"def test_update_metadata_by_att... | [
"0.74548537",
"0.72838056",
"0.72556543",
"0.7069546",
"0.70056087",
"0.67689264",
"0.6709686",
"0.64902157",
"0.6299618",
"0.62833977",
"0.6269302",
"0.625674",
"0.62526345",
"0.6184476",
"0.6184476",
"0.6184476",
"0.6178899",
"0.61626863",
"0.61609745",
"0.61471635",
"0.613... | 0.6292771 | 9 |
Test that a user can delete a section | def test_delete_detail(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status="published",
language="en", author=self.user)
layout = SectionLayout.objects.get(sectionlayouttranslation__name="Side by S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_vault_delete_authorization_for_vault_section(self):\n pass",
"def test_vault_delete_vault_section(self):\n pass",
"def test_delete_detail_unauthorized(self):\n story = create_story(title=\"Test Story\", summary=\"Test Summary\",\n byline=\"Test Byline\"... | [
"0.7719574",
"0.763308",
"0.7626924",
"0.742833",
"0.7278885",
"0.6896364",
"0.68270606",
"0.67821777",
"0.6771957",
"0.67468274",
"0.67419004",
"0.67419004",
"0.6694134",
"0.66817015",
"0.66681206",
"0.66649604",
"0.66452205",
"0.66418904",
"0.663765",
"0.66195273",
"0.66152... | 0.71022445 | 5 |
Test that an unauthenticated user cannot delete a section | def test_delete_detail_unauthenticated(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status="published",
language="en", author=self.user)
layout = SectionLayout.objects.get(sectionlayouttranslation_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_detail_unauthorized(self):\n story = create_story(title=\"Test Story\", summary=\"Test Summary\",\n byline=\"Test Byline\", status=\"published\",\n language=\"en\", author=self.user2)\n layout = SectionLayout.objects.get(sectionl... | [
"0.7865021",
"0.77821237",
"0.74841166",
"0.7473335",
"0.7450372",
"0.72778034",
"0.72199875",
"0.7182551",
"0.7130293",
"0.7096974",
"0.705753",
"0.7037169",
"0.70210254",
"0.7017501",
"0.70006317",
"0.6989368",
"0.6973489",
"0.695288",
"0.69350183",
"0.69318634",
"0.6917615... | 0.7641236 | 2 |
Test that a user cannot delete another user's section | def test_delete_detail_unauthorized(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status="published",
language="en", author=self.user2)
layout = SectionLayout.objects.get(sectionlayouttranslation__n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative_conditions(self):\r\n outline_url = reverse_course_url('course_handler', self.course.id)\r\n # register a non-staff member and try to delete the course branch\r\n non_staff_client, _ = self.create_non_staff_authed_user_client()\r\n response = non_staff_client.delete(ou... | [
"0.72093284",
"0.7170204",
"0.70641863",
"0.7059254",
"0.7047757",
"0.69766986",
"0.69545084",
"0.6941861",
"0.6861853",
"0.6799211",
"0.6789573",
"0.6742458",
"0.67380875",
"0.6716965",
"0.6708732",
"0.67037994",
"0.66885954",
"0.66818726",
"0.6680377",
"0.66469157",
"0.6641... | 0.6979907 | 5 |
Test that a user can get a list of section assets | def test_get_list(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status="published",
language="en", author=self.user)
layout = SectionLayout.objects.get(sectionlayouttranslation__name="Side by Side")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_section_assets_json(self):\n json_data = self.view.get_section_assets_json(story=self.story)\n data = json.loads(json_data)\n self.assertEqual(len(data), len(self.story.sections.all()))\n for section in self.story.sections.all():\n self.assertIn(section.section_i... | [
"0.7440455",
"0.6803605",
"0.6683881",
"0.6667813",
"0.65966535",
"0.653804",
"0.65123904",
"0.65087",
"0.64532894",
"0.6357487",
"0.63400674",
"0.62684447",
"0.6240505",
"0.6216168",
"0.62136227",
"0.61838883",
"0.6179089",
"0.61760336",
"0.61656934",
"0.6085478",
"0.6064812... | 0.7179848 | 1 |
Test that trying to add a second asset to a section/container that already has one returns a 400 error | def test_post_list_duplicate(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status="published",
language="en", author=self.user)
layout = SectionLayout.objects.get(sectionlayouttranslation__name="Sid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_already_added_asset(self):\n # Create a story\n title = ('Transportation Challenges Limit Education Choices for '\n 'Denver Parents')\n summary = \"\"\"\n Many families in the Denver metro area use public\n transportation instead of a school bus b... | [
"0.694232",
"0.68823355",
"0.68348324",
"0.672028",
"0.64222634",
"0.63938266",
"0.6338823",
"0.63362616",
"0.63293517",
"0.6284496",
"0.62459534",
"0.62437814",
"0.62124044",
"0.61437595",
"0.61133444",
"0.6081065",
"0.6052143",
"0.6047995",
"0.6047767",
"0.60161984",
"0.600... | 0.7102051 | 0 |
Tests that a user can remove an asset from a section | def test_delete_detail(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status="published",
language="en", author=self.user)
layout = SectionLayout.objects.get(sectionlayouttranslation__name="Side by S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_asset(self):\n # Confirm that the story has no assets\n self.assertEqual(self.story.assets.count(), 0)\n # Assign the asset to the section\n container = Container.objects.get(name='left')\n section_asset = SectionAsset(section=self.section, asset=self.asset, conta... | [
"0.7861532",
"0.74701416",
"0.7135868",
"0.7132406",
"0.7101995",
"0.7035667",
"0.68787575",
"0.6567571",
"0.65357625",
"0.6535614",
"0.63532215",
"0.6336241",
"0.6320066",
"0.6283464",
"0.6282967",
"0.62744504",
"0.627352",
"0.624872",
"0.62378776",
"0.61782515",
"0.6142176"... | 0.6433184 | 10 |
Test that an anonymous user cannot remove an asset from a section | def test_delete_detail_unauthenticated(self):
story = create_story(title="Test Story", summary="Test Summary",
byline="Test Byline", status="published",
language="en", author=self.user)
layout = SectionLayout.objects.get(sectionlayouttranslation_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative_conditions(self):\r\n outline_url = reverse_course_url('course_handler', self.course.id)\r\n # register a non-staff member and try to delete the course branch\r\n non_staff_client, _ = self.create_non_staff_authed_user_client()\r\n response = non_staff_client.delete(ou... | [
"0.6782891",
"0.67414355",
"0.6639014",
"0.66065514",
"0.6594043",
"0.65865743",
"0.64999783",
"0.64776814",
"0.64582336",
"0.6446826",
"0.6418828",
"0.6409523",
"0.63989425",
"0.6384073",
"0.6376167",
"0.6343586",
"0.6343003",
"0.6336536",
"0.63327324",
"0.63167286",
"0.6290... | 0.62018484 | 25 |
Test that the categories can be replaced by a new set | def test_put_list_replace(self):
self.story.topics.add(*list(Category.objects.filter(categorytranslation__name__in=('Schools', 'Violence'))))
self.story.save()
self.assertEqual(self.story.topics.count(), 2)
put_data = [cat.id for cat in
Category.objects.filter(catego... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_categories_add(self):\n categories = [category.category for category in self.note.categories.all()]\n self.assertIn('test', categories)\n self.assertNotIn('note', categories)",
"def test_unused_categories_logic(self):\n s = ak.array([str(i) for i in range(10)])\n s12 =... | [
"0.6898566",
"0.6833884",
"0.67534506",
"0.6531339",
"0.64060974",
"0.6398985",
"0.63636816",
"0.63460016",
"0.63446015",
"0.6284051",
"0.62773585",
"0.62514514",
"0.6235179",
"0.6201223",
"0.61564267",
"0.6128131",
"0.60769325",
"0.6070012",
"0.6055091",
"0.6044439",
"0.6037... | 0.5970139 | 27 |
Test that a story's categories can be set | def test_put_list_new(self):
put_data = [cat.id for cat in
Category.objects.filter(categorytranslation__name__in=('Food', 'Healthcare'))]
self.api_client.client.login(username=self.username, password=self.password)
uri = '/api/0.1/stories/%s/topics/' % (self.story.story_id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_categories(self):\n pass",
"def test_categories_add(self):\n categories = [category.category for category in self.note.categories.all()]\n self.assertIn('test', categories)\n self.assertNotIn('note', categories)",
"def test_create_category(self):\n pass",
"def ... | [
"0.71483403",
"0.69837505",
"0.6943877",
"0.6939324",
"0.671323",
"0.6682509",
"0.66150737",
"0.6600692",
"0.65750426",
"0.6539531",
"0.6525998",
"0.65085775",
"0.6507424",
"0.648812",
"0.6480509",
"0.646588",
"0.646588",
"0.6446156",
"0.6441652",
"0.64372647",
"0.64169043",
... | 0.0 | -1 |
Test that a story's categories can be set | def test_put_list_new(self):
self.story.save()
self.assertEqual(self.story.places.count(), 0)
put_data = [place.place_id for place in
Place.objects.filter(name="Logan Square")]
self.api_client.client.login(username=self.username, password=self.password)
uri = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_categories(self):\n pass",
"def test_categories_add(self):\n categories = [category.category for category in self.note.categories.all()]\n self.assertIn('test', categories)\n self.assertNotIn('note', categories)",
"def test_create_category(self):\n pass",
"def ... | [
"0.71483403",
"0.69837505",
"0.6943877",
"0.6939324",
"0.671323",
"0.6682509",
"0.66150737",
"0.6600692",
"0.65750426",
"0.6539531",
"0.6525998",
"0.65085775",
"0.6507424",
"0.648812",
"0.6480509",
"0.646588",
"0.646588",
"0.6446156",
"0.6441652",
"0.64372647",
"0.64169043",
... | 0.0 | -1 |
Test that a story's categories can be set | def test_put_list_new(self):
for org in Organization.objects.all():
OrganizationMembership.objects.create(
user=self.user, organization=org)
self.user.save()
self.story.save()
self.assertEqual(self.story.organizations.count(), 0)
put_data = [org.or... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_categories(self):\n pass",
"def test_categories_add(self):\n categories = [category.category for category in self.note.categories.all()]\n self.assertIn('test', categories)\n self.assertNotIn('note', categories)",
"def test_create_category(self):\n pass",
"def ... | [
"0.71483403",
"0.69837505",
"0.6943877",
"0.6939324",
"0.671323",
"0.6682509",
"0.66150737",
"0.6600692",
"0.65750426",
"0.6539531",
"0.6525998",
"0.65085775",
"0.6507424",
"0.648812",
"0.6480509",
"0.646588",
"0.646588",
"0.6446156",
"0.6441652",
"0.64372647",
"0.64169043",
... | 0.0 | -1 |
Test that a user cannot add organizations to a story unless they're a member of the organization | def test_put_list_non_member(self):
self.assertEqual(self.story.organizations.count(), 0)
put_data = [organization.organization_id for organization in
Organization.objects.filter(organizationtranslation__name__in=("Mile High Connects", "Piton Foundation"))]
self.api_client.cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_from_organization_forbidden(self):\n org = Organization.create(name='foo', program_id=self.program.uid)\n org.put()\n user = User.create(name='Admin', email='foo@bar.com', user_type='user',\n owned_organizations=['Organization_foo'])\n req = Use... | [
"0.70274013",
"0.6824777",
"0.6745759",
"0.6694568",
"0.6605424",
"0.65525305",
"0.6529566",
"0.6465255",
"0.64575726",
"0.64273256",
"0.641729",
"0.6410325",
"0.6337041",
"0.632791",
"0.6307614",
"0.62967443",
"0.6275497",
"0.626924",
"0.6266331",
"0.6219692",
"0.61875474",
... | 0.6651678 | 4 |
Test that a story's categories can be set | def test_put_list_new(self):
for proj in Project.objects.all():
ProjectMembership.objects.create(user=self.user,
project=proj)
self.user.save()
self.story.save()
self.assertEqual(self.story.projects.count(), 0)
put_data = [proj.project_id for proj ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_categories(self):\n pass",
"def test_categories_add(self):\n categories = [category.category for category in self.note.categories.all()]\n self.assertIn('test', categories)\n self.assertNotIn('note', categories)",
"def test_create_category(self):\n pass",
"def ... | [
"0.71483403",
"0.69837505",
"0.6943877",
"0.6939324",
"0.671323",
"0.6682509",
"0.66150737",
"0.6600692",
"0.65750426",
"0.6539531",
"0.6525998",
"0.65085775",
"0.6507424",
"0.648812",
"0.6480509",
"0.646588",
"0.646588",
"0.6446156",
"0.6441652",
"0.64372647",
"0.64169043",
... | 0.0 | -1 |
Test that the projects can be replaced by a new set | def test_put_list_replace(self):
for proj in Project.objects.all():
ProjectMembership.objects.create(user=self.user,
project=proj)
self.user.save()
self.story.projects.add(*list(Project.objects.filter(projecttranslation__name__in=("Finding a Bite: Food Access in t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_replace_project(self):\n pass",
"def test_patch_project(self):\n pass",
"def test_update_project(self):\n pass",
"def test_update_project(self):\n pass",
"def test_get_projects(self):\n for project in ['TEST', 'NEWTEST', 'MYPROJECT']:\n self.db.insert_... | [
"0.7686562",
"0.7118511",
"0.6937147",
"0.6937147",
"0.68412936",
"0.664243",
"0.65963596",
"0.64921886",
"0.64921886",
"0.64849156",
"0.63876593",
"0.6387262",
"0.6377214",
"0.6326615",
"0.63240904",
"0.62561744",
"0.6184639",
"0.61811954",
"0.6179854",
"0.6170281",
"0.61623... | 0.68910867 | 4 |
Test that a user cannot add projects to a story unless they're a member of the project | def test_put_list_non_member(self):
self.assertEqual(self.story.projects.count(), 0)
put_data = [project.project_id for project in
Project.objects.filter(projecttranslation__name__in=("Soccer in the Corridor", "Stories of Integration"))]
self.api_client.client.login(username=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_project_target_disabled(self):\n self.assertEqual(Project.objects.count(), 2)\n url = reverse('projectroles:api_project_create')\n post_data = {\n 'title': NEW_PROJECT_TITLE,\n 'type': PROJECT_TYPE_PROJECT,\n 'parent': str(self.category.sodar_uu... | [
"0.7039315",
"0.70217746",
"0.69767565",
"0.69535774",
"0.69455206",
"0.69319797",
"0.6929114",
"0.68965095",
"0.6879881",
"0.6834469",
"0.6770079",
"0.6673058",
"0.6634382",
"0.66137934",
"0.65939057",
"0.6575452",
"0.654883",
"0.6547558",
"0.65192723",
"0.6515651",
"0.65125... | 0.6333799 | 37 |
Test that an aunauthenticated user can't create a relation | def test_post_list_unauthenticated(self):
related_story = create_story(title="Test Related Story",
summary="Test Related Story Summary",
byline="Test Related Story Byline",
status='published',
author=self.user)
self.assertEqual(len(self.story.related_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dont_create_user(self):\n self.assertFalse(User.objects.exists())",
"def test_not_creator_cannot_update(self):\n\n logged_user = utils.create_user_and_authenticate(self)\n self.group.users.add(logged_user)\n expected_url = reverse('my_groups_view')\n\n utils.test_canno... | [
"0.7568791",
"0.7162582",
"0.7125716",
"0.70647484",
"0.7003102",
"0.6971735",
"0.6916359",
"0.68900263",
"0.686439",
"0.6791772",
"0.6787684",
"0.67546445",
"0.67518574",
"0.6748298",
"0.6701402",
"0.6687196",
"0.66448706",
"0.66440576",
"0.6625192",
"0.66007024",
"0.6573839... | 0.0 | -1 |
List columns of df where values in all cells are identical to those in a preceding column, along with the preceding column having identical values. | def duplicate_columns(df: pd.DataFrame) -> Iterator[Tuple[str, str]]:
columns = set(df.columns)
for column1, column2 in combinations(df.columns, 2):
if column1 not in columns or column2 not in columns:
continue
series1 = df[column1]
series2 = df[column2]
# convert dty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def columns_to_fix(df):\n return [col for col in df.columns.values if any([k in col and v in col for k, v in symmetric_dihedrals.items()])]",
"def common_cols(df1, df2):\n return list(set(df1.columns) & set(df2.columns))",
"def unique_values(df):\n cols = list(df.columns)\n\n for col in cols:\n ... | [
"0.6564143",
"0.6515482",
"0.59727234",
"0.5904402",
"0.5837974",
"0.5822164",
"0.5740025",
"0.5697649",
"0.5669701",
"0.56102675",
"0.55819",
"0.5535584",
"0.55008596",
"0.54901475",
"0.53747123",
"0.53559",
"0.53529125",
"0.53402436",
"0.53373665",
"0.5287932",
"0.52743405"... | 0.6471906 | 2 |
Asymptotic expansion version of `Log[cdf(x)]`, appropriate for `x<<1`. | def _log_ndtr_lower(x, series_order):
x_2 = x.square()
log_scale = -(x_2 / 2) - torch.log(-x) - 0.5 * np.log(2. * np.pi)
return log_scale + torch.log(_log_ndtr_asymptotic_series(x, series_order)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _logcdf(\n op: Op,\n value: TensorVariable,\n *inputs: TensorVariable,\n **kwargs,\n):\n raise NotImplementedError(f\"LogCDF method not implemented for {op}\")",
"def logcumsumexp(x):\n return LogCumSumExp().apply((x,))[0]",
"def logcdf(rv, value):\n\n value = at.as_tensor_variable(val... | [
"0.7066743",
"0.6886173",
"0.67769283",
"0.65196306",
"0.64711076",
"0.626878",
"0.62083393",
"0.6199836",
"0.6155655",
"0.61033636",
"0.60932064",
"0.60767925",
"0.6076336",
"0.6053308",
"0.6049065",
"0.6045781",
"0.6033064",
"0.6021532",
"0.60050315",
"0.6004752",
"0.599431... | 0.0 | -1 |
Returns whether a space is discrete. Arguments space The space. vectorized Whether to return the discreteness for the vectorized environments (True) or just the discreteness of the underlying environment (False). | def is_discrete(space, vectorized=False):
msg = 'Space type not supported.'
assert isinstance(space, (Box, Discrete, Dict, Tuple)), msg
if isinstance(space, Discrete):
return True
if isinstance(space, Box):
return False
if isinstance(space, Dict):
dimensions = {
k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discrete(self) -> bool:\n pass",
"def isDiscrete(self):\n return self._discrete",
"def discrete_observations(self) -> bool:\r\n return self.observations.discrete",
"def process_env_action(self, discrete):\n discrete = np.array(discrete, dtype=np.float32)\n if discrete.shape[0] ... | [
"0.69151866",
"0.65832114",
"0.65114856",
"0.5946722",
"0.5784924",
"0.55168486",
"0.5481677",
"0.52963936",
"0.52934676",
"0.5255461",
"0.5216951",
"0.5149975",
"0.509795",
"0.5078011",
"0.50568116",
"0.50535303",
"0.50315857",
"0.5018961",
"0.499871",
"0.4980768",
"0.492160... | 0.78345805 | 0 |
Transform a sequence of words to a sequence of onehot vectors. Transform each character in each word to its onehot representation, combine them into a larger sequence, and return. The returned sequences formatted as a numpy array with shape (n_words, max_wordlen n_chars) if argument 'flat' is true, (n_words, max_wordle... | def transform(self, words, pad='right', flat=True):
### part of 5.2
num_chars = len(self.char_list)
return_list = []
array = np.zeros(shape=(len(words), self.max_wordlen, num_chars), dtype=np.float32)
for i, word in enumerate(words):
# Use this variable to change padd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(self, x, vocab, n_grams) -> np.ndarray:\n _x = np.zeros((x.__len__(), self.max_length, vocab.__len__()))\n for i, item in enumerate(tqdm(x, desc='One Hot Text Encoder')):\n items = TextProcessor.n_gram_split(item, n_grams)\n for j, token in enumerate(items):\n ... | [
"0.67685527",
"0.67146456",
"0.6518497",
"0.6491117",
"0.64732283",
"0.6398121",
"0.6319726",
"0.63056326",
"0.62988067",
"0.6238751",
"0.61846423",
"0.61819214",
"0.61463994",
"0.60853785",
"0.605452",
"0.59487444",
"0.58728534",
"0.58433",
"0.5830424",
"0.58277416",
"0.5788... | 0.6235795 | 10 |
subclass should implement this method return the instance of WebDriver | def browser(self):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_webdriver_instance():\n return selenium._current_browser()\n # return PageBase.get_selenium2library_instance()._current_browser()",
"def _instantiate_driver(self) -> webdriver:\n\n if self.driver is None: return Browser.run_chromedriver()\n\n return self.driver",
"def _get_w... | [
"0.82278216",
"0.7653166",
"0.76504314",
"0.73171544",
"0.72641337",
"0.7253675",
"0.7218874",
"0.717698",
"0.6999632",
"0.69517833",
"0.6909646",
"0.68181604",
"0.6734197",
"0.66697186",
"0.66192114",
"0.66147476",
"0.66141635",
"0.6598826",
"0.65163535",
"0.64247483",
"0.63... | 0.59495986 | 40 |
Make a pairwise distance matrix dense assuming 1 is used to encode D = 0 | def pw2dense(pw, maxd):
pw = np.asarray(pw.todense())
pw[pw == 0] = maxd + 1
# pw[np.diag_indices_from(pw)] = 0
pw[pw == -1] = 0
return pw | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Dmat(numpts, delta=1):\n a = 0.5 / delta * ones(numpts)\n a[0] = 0\n a[-2] = 0\n #b=-2./delta**2*ones(numpts); b[0]=0;b[-1]=0\n c = -0.5 / delta * ones(numpts)\n c[1] = 0\n c[-1] = 0\n return sparse.spdiags([a, c], [-1, 1], numpts, numpts)",
"def pairwi... | [
"0.6852615",
"0.6852302",
"0.6772078",
"0.6641306",
"0.6480032",
"0.6470628",
"0.6418294",
"0.63448703",
"0.6270633",
"0.6261988",
"0.6256333",
"0.6226473",
"0.620259",
"0.6190282",
"0.61870795",
"0.6144636",
"0.6140675",
"0.61345774",
"0.61119485",
"0.61016315",
"0.6099416",... | 0.5525504 | 66 |
Test reading bti headshape. | def test_setup_headshape(hs):
nasion, lpa, rpa, hpi, dig_points = _read_head_shape(hs)
dig, t, _ = _make_bti_dig_points(nasion, lpa, rpa, hpi, dig_points)
expected = {"kind", "ident", "r"}
found = set(reduce(lambda x, y: list(x) + list(y), [d.keys() for d in dig]))
assert not expected - found | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dev_head_t():\n # test a random selected point\n raw = read_raw_artemis123(short_hpi_1kz_fname, preload=True, add_head_trans=False)\n meg_picks = pick_types(raw.info, meg=True, eeg=False)\n\n # checked against matlab reader.\n assert_allclose(raw[meg_picks[12]][0][0][123], 1.08239606023e-11... | [
"0.6705448",
"0.6422587",
"0.617298",
"0.5907294",
"0.5829476",
"0.5825571",
"0.575479",
"0.5617124",
"0.5521019",
"0.54344946",
"0.5433128",
"0.54281795",
"0.54008454",
"0.5361405",
"0.53445315",
"0.5343424",
"0.5339548",
"0.5332486",
"0.5328925",
"0.52930343",
"0.5287021",
... | 0.7146644 | 0 |
Return the home page for ez_main | def home_page(request):
return render(request, 'ez_main/home_page.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.... | [
"0.8077023",
"0.8033126",
"0.7899383",
"0.78789085",
"0.7869642",
"0.7868466",
"0.78534585",
"0.78092074",
"0.7802321",
"0.7798206",
"0.7798206",
"0.77932465",
"0.7791526",
"0.77665144",
"0.77379894",
"0.7708374",
"0.7693498",
"0.76875484",
"0.7674769",
"0.7654394",
"0.765041... | 0.76817685 | 18 |
Computes the length of the smallest contig in the assembly. Returns Numerical value of the min length. | def minContigLength(self):
stats = self.scores()
return stats['smallestContig'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_length(self) -> int:\n return pulumi.get(self, \"min_length\")",
"def min_length(self) -> int | None:\n return self._underlying.min_length",
"def minimum_length(self):\n\n return self._minimum_length.value",
"def minimum_size(self):\n # Size in arcsec\n size = self.... | [
"0.7224291",
"0.69163966",
"0.6829619",
"0.67183524",
"0.6695888",
"0.6680345",
"0.66071016",
"0.6476279",
"0.6386461",
"0.6376109",
"0.63533276",
"0.63069344",
"0.62099445",
"0.6175902",
"0.6142884",
"0.6141288",
"0.6137007",
"0.61270684",
"0.61108637",
"0.6109248",
"0.60628... | 0.8236301 | 0 |
Export sample storage to .csv | def export_sampleStorage_csv(self, sample_ids_I, filename_O):
data_O = [];
for sample_id in sample_ids_I:
data_tmp =[];
data_tmp = self.get_rows_sampleID_limsSampleStorage(sample_id);
data_O.extend(data_tmp);
if data_O:
io = base_exportData(data_O... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _write_csv(self):\n\n # add the label to the header\n if self.input_data.get_value(InputType.TIME_PERIOD) == 'all':\n self.header.append('Date')\n else:\n self.header.append('sample id')\n\n key_list = []\n\n for i, cube in enumerate(self.cube_list):\n ... | [
"0.6831625",
"0.66899014",
"0.667744",
"0.66144496",
"0.66063094",
"0.6583263",
"0.6544562",
"0.6526599",
"0.6522129",
"0.65214676",
"0.65079916",
"0.64786494",
"0.64665675",
"0.64573693",
"0.6447632",
"0.63991046",
"0.63794285",
"0.6354058",
"0.6299296",
"0.6269036",
"0.6265... | 0.7263074 | 0 |
Update velocity and position of the particle. New position must match with all constraints of the optimization. | def update(self, global_best):
self._update_velocity(global_best)
next_position = self._get_new_position()
loop_count = 0
while not self._check_constraint(next_position):
if loop_count < 5:
self._resize_velocity(0.5)
loop_count += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_position(self):\n self.position[0] += self.velocity[0]\n self.position[1] += self.velocity[1]",
"def apply_velocity(self):\n self.position.data += self.velocity.data",
"def updateVelocity(self, glob, latency):\n # Velocity equation parameters that control efficacy and beh... | [
"0.7233973",
"0.70877814",
"0.7068948",
"0.6994858",
"0.6932674",
"0.68561864",
"0.6816593",
"0.6811808",
"0.6801871",
"0.67992324",
"0.67979133",
"0.67505383",
"0.6729119",
"0.66914636",
"0.6646605",
"0.6635251",
"0.6611385",
"0.654712",
"0.654567",
"0.65453786",
"0.654403",... | 0.0 | -1 |
Return the loss operation between predictions and real_values. Add L2 weight decay term if any. | def l2_loss(predictions, real_values):
with tf.variable_scope('loss'):
# 1/2n \sum^{n}_{i=i}{(x_i - x'_i)^2}
mse = tf.div(tf.reduce_mean(
tf.square(tf.subtract(predictions, real_values))), 2, name="mse")
tf.add_to_collection('losses', mse)
# mse + weight_decay per layer
error = tf.add... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss(y_true, y_pred):\n ce = tf.keras.losses.categorical_crossentropy(y_true, y_pred, from_logits=True)\n l2_loss = l2_regularization_loss(model, weight_decay)\n return ce + l2_loss",
"def l2_loss(obs, actual):\n # (tf.Tensor, tf.Tensor, float) -> tf.Tensor\n return tf.redu... | [
"0.73699135",
"0.7342821",
"0.7275328",
"0.70679206",
"0.6878126",
"0.6847836",
"0.67321575",
"0.6729354",
"0.6704674",
"0.66830283",
"0.6670199",
"0.66624427",
"0.66487545",
"0.66260785",
"0.66246957",
"0.6620789",
"0.66150194",
"0.66134304",
"0.65974075",
"0.6593345",
"0.65... | 0.82528305 | 0 |
Return the commandline parser for the pull command. | def pull_parser():
description = \
"This command pulls all outstanding changes from the remote "\
"Transifex server to the local repository. By default, only the "\
"files that are watched by Transifex will be updated but if you "\
"want to fetch the translations for new languages as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull_parser():\n usage = \"usage: %prog [tx_options] pull [options]\"\n description = \"This command pulls all outstanding changes from the remote \"\\\n \"Transifex server to the local repository. By default, only the \"\\\n \"files that are watched by Transifex will be updated but if you ... | [
"0.70009404",
"0.6330801",
"0.6223567",
"0.6131527",
"0.61306995",
"0.6056057",
"0.60318947",
"0.59981817",
"0.5942442",
"0.59291327",
"0.58916205",
"0.5839435",
"0.5836275",
"0.5835498",
"0.5808554",
"0.58056235",
"0.5770418",
"0.5749853",
"0.57466984",
"0.5724496",
"0.57195... | 0.7026735 | 0 |
A context manager that suppresses any OSError with an errno in `errnos`. Like contextlib.suppress, but can differentiate between OSErrors. | def suppress_oserror(*errnos):
try:
yield
except OSError as e:
if e.errno not in errnos:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suppress(*exceptions):\n try:\n yield\n except exceptions:\n pass",
"def suppress(*exceptions):\n try:\n yield\n except exceptions:\n pass",
"def suppress_stdout_stderr():\n with open(devnull, 'w') as fnull:\n with redirect_stderr(fnull) as ... | [
"0.6301063",
"0.6196494",
"0.5738014",
"0.5527291",
"0.544407",
"0.54014045",
"0.53960377",
"0.52353686",
"0.5205281",
"0.519069",
"0.5175731",
"0.50958",
"0.50706995",
"0.5046171",
"0.4986878",
"0.49626318",
"0.4894895",
"0.4893036",
"0.48591492",
"0.48545337",
"0.48537678",... | 0.8427051 | 0 |
Update position of bullets and get rid of old bullet | def update_bullets(bullets):
# update bullet positions
bullets.update()
# Get rid of bullets that have disappeared
# Make a copy of the bullets list for iteration
# because items are being removed from the original list
for bullet in bullets.copy():
if bullet.rect.bottom <= 0:
bullets.remove(bullet) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_bullets(bullets):\r\n\t# Update bullet positions.\r\n\tbullets.update()\r\n\tfor bullet in bullets.copy():\r\n\t\tif bullet.rect.right >= 1000:\r\n\t\t\tbullets.remove(bullet)",
"def _update_bullets(self):\n # Update bullet positions.\n\n # Get rid of bullets that have disappeared.\n ... | [
"0.8169397",
"0.81142735",
"0.7920567",
"0.7720641",
"0.76871634",
"0.76635444",
"0.75168097",
"0.7489215",
"0.7374028",
"0.7329424",
"0.7295697",
"0.7190312",
"0.7139043",
"0.70823437",
"0.7071961",
"0.7050767",
"0.70022225",
"0.69830924",
"0.68659055",
"0.6780151",
"0.67420... | 0.79204357 | 3 |
Get the app type name used in the EPICS DB. | def get_app_type_name(self, device_type_name):
if device_type_name in ["SOLN", "BEND", "PBLM", "CBLM", "LBLM", "BLEN", "BLM", "KICK"]:
# Solenoids uses the same HW/SW as beam loss monitors
return "BLM"
elif device_type_name == "BPMS":
return "BPM"
elif device... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _app_type(self):\n return self._event['app_type']",
"def type_name(self) -> Optional[str]:\n return pulumi.get(self, \"type_name\")",
"def entity_type_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"entity_type_name\")",
"def type_name(self):\n return self.TYPE_N... | [
"0.770372",
"0.69993216",
"0.6794229",
"0.67721325",
"0.6752949",
"0.6745928",
"0.67213315",
"0.67213166",
"0.66995174",
"0.664683",
"0.6624492",
"0.6606009",
"0.659755",
"0.6581166",
"0.65710086",
"0.65710086",
"0.65710086",
"0.65710086",
"0.65710086",
"0.65710086",
"0.65710... | 0.69819856 | 2 |
Return the device type name corresponding to the passed device_type_id. | def __get_device_type_name(self, mps_db_session, device_type_id):
device_type = mps_db_session.query(models.DeviceType).filter(models.DeviceType.id==device_type_id).all()
if len(device_type) == 1:
return device_type[0].name
elif len(device_type) == 0:
raise ValueError("F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_type(self):\n return Context.devtype2str[self.device_typeid]",
"def device_type(self):\n return Context.devtype2str[self.device_typeid]",
"def get_sensor_type_name(sensor_type_id):\n query = db.session.query(\n TypeClass.sensor_type,\n ).filter(TypeClass.id == sensor_type_... | [
"0.72279674",
"0.72279674",
"0.71951437",
"0.70882386",
"0.69910216",
"0.68495435",
"0.6818533",
"0.6744156",
"0.6672197",
"0.6590665",
"0.6537876",
"0.65266067",
"0.6525124",
"0.652327",
"0.6449127",
"0.6430763",
"0.6412526",
"0.64045906",
"0.6398497",
"0.6374325",
"0.635877... | 0.8510325 | 0 |
replace the Node with the root of micro tree | def root_replace(self,node):
self.feature_index = node.feature_index
self.threshold = node.threshold
self.label = node.label
self.left = node.left
self.right = node.right
self.substitute = node.substitute
if node.left is not None and node.right is not None:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _replace_node(self, nxt, node):\n nxt.left = node.left\n nxt.right = node.right\n nxt.parent = node.parent\n if node is self.root:\n self.root = nxt\n if nxt.left:\n nxt.left.parent = nxt\n if nxt.right:\n nxt.right.parent = nxt\n ... | [
"0.6890249",
"0.6712262",
"0.6654945",
"0.6486135",
"0.6478262",
"0.6387109",
"0.6380951",
"0.6354059",
"0.6354059",
"0.6354059",
"0.6354059",
"0.6299002",
"0.62965703",
"0.62580806",
"0.6225319",
"0.6155952",
"0.61295223",
"0.6125489",
"0.61187553",
"0.61182684",
"0.6107439"... | 0.73354787 | 0 |
Test CSCAuthorizationRequest creation for authlist users This request will be created with status = Authorized as the user is in the authlist group | def test_csc_authorization_create_request_authlist_user(self):
# Arrange:
self.client.credentials(
HTTP_AUTHORIZATION="Token " + self.token_user_authlist.key
)
# Act:
url = reverse("authlistrequest-list")
payload = {
"cscs_to_change": "Test:2",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_csc_authorization_request_list_authlist_user(self):\n # Arrange:\n self.client.credentials(\n HTTP_AUTHORIZATION=\"Token \" + self.token_user_authlist.key\n )\n\n # Act:\n url = reverse(\"authlistrequest-list\")\n response = self.client.get(url, format=... | [
"0.80012643",
"0.74294287",
"0.7366957",
"0.68904203",
"0.68648237",
"0.64141643",
"0.6391",
"0.63237566",
"0.6257293",
"0.6254929",
"0.61587906",
"0.6088045",
"0.6087256",
"0.60437953",
"0.5919331",
"0.5870217",
"0.5868705",
"0.58354163",
"0.5816252",
"0.581176",
"0.57886696... | 0.76282996 | 1 |
Test CSCAuthorizationRequest creation for non authlist users This request will be created with status = Pending as the user is not in the authlist group | def test_csc_authorization_create_request_normal_user(self):
# Arrange:
self.client.credentials(
HTTP_AUTHORIZATION="Token " + self.token_user_normal.key
)
# Act:
url = reverse("authlistrequest-list")
payload = {
"cscs_to_change": "Test:2",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_csc_authorization_create_request_authlist_user(self):\n # Arrange:\n self.client.credentials(\n HTTP_AUTHORIZATION=\"Token \" + self.token_user_authlist.key\n )\n\n # Act:\n url = reverse(\"authlistrequest-list\")\n payload = {\n \"cscs_to_ch... | [
"0.7124045",
"0.7084862",
"0.6721573",
"0.6709182",
"0.6522791",
"0.6357167",
"0.6279559",
"0.6266516",
"0.6178265",
"0.6171654",
"0.61264277",
"0.6123123",
"0.6120204",
"0.6070749",
"0.6059026",
"0.5904492",
"0.58430725",
"0.5838833",
"0.58346564",
"0.5824197",
"0.58131343",... | 0.787023 | 0 |
Test CSCAuthorizationRequest with a self removal for non authlist users | def test_csc_authorization_self_remove_normal_user(self):
# Arrange:
self.client.credentials(
HTTP_AUTHORIZATION="Token " + self.token_user_normal.key
)
# Act:
url = reverse("authlistrequest-list")
payload = {
"cscs_to_change": "Test:2",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_csc_authorization_create_request_normal_user(self):\n # Arrange:\n self.client.credentials(\n HTTP_AUTHORIZATION=\"Token \" + self.token_user_normal.key\n )\n\n # Act:\n url = reverse(\"authlistrequest-list\")\n payload = {\n \"cscs_to_change... | [
"0.7206277",
"0.6919231",
"0.6788452",
"0.6734991",
"0.66978204",
"0.6515974",
"0.6415624",
"0.6405664",
"0.6393101",
"0.6361479",
"0.63583153",
"0.63106066",
"0.6310192",
"0.629461",
"0.6265155",
"0.62555206",
"0.6178651",
"0.6159528",
"0.61500895",
"0.6140246",
"0.61395687"... | 0.80528945 | 0 |
Make new alpha based on previous one | def get(self):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_alpha(self, alpha=1.0):\r\n self.unif[17] = alpha",
"def setAlpha ( self, newalpha ):\n if isinstance( newalpha, int ):\n raise ValueError('Expects a float value in the [ 0.0 - 1.0 ] range!')\n if newalpha > 1.0:\n newalpha = 1.0\n if newalpha < 0.0:\n ... | [
"0.74897295",
"0.7349046",
"0.719774",
"0.7087811",
"0.7027627",
"0.70184773",
"0.69532424",
"0.6948631",
"0.6948631",
"0.6901815",
"0.68361646",
"0.670672",
"0.6699309",
"0.6678611",
"0.66711307",
"0.6641932",
"0.6626952",
"0.6617656",
"0.6611622",
"0.65674424",
"0.6549825",... | 0.0 | -1 |
Initialize a stopping condition instance | def __init__(self, reference_value: float, smaller_value_required: bool = False, equal_required: bool = False):
self.__reference_value = reference_value
self.__smaller_value_required = smaller_value_required
self.__equal_required = equal_required | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n\t\tsuper().__init__(*args, **kwargs)\n\t\tself.condition = None",
"def __init__(self, fake_clock=None):\n self.__condition = threading.Condition()\n self.__is_running = True\n # A list of functions to invoke when this instance becomes stopped.\n ... | [
"0.71033925",
"0.68244135",
"0.6792193",
"0.6673354",
"0.6369765",
"0.6369765",
"0.6369765",
"0.6369765",
"0.6369765",
"0.6369765",
"0.62850404",
"0.61926806",
"0.6135181",
"0.5970584",
"0.5934622",
"0.59019744",
"0.5897558",
"0.58499783",
"0.58036894",
"0.57966906",
"0.57765... | 0.0 | -1 |
Returns boundingbox detection results by thresholding on scores and applying nonmaximum suppression (NMS). `boxes` has shape (detections, 4 classes), where each row represents a list of predicted bounding boxes for each of the object classes in the dataset (including the background class). The detections in each row or... | def box_results_with_nms_and_limit(
scores, boxes, score_thresh=0.05, nms=0.5, detections_per_img=100
):
num_classes = scores.shape[1]
cls_boxes = []
cls_scores = []
labels = []
device = scores.device
# Apply threshold on detection probabilities and apply NMS
# Skip j = 0, because it's t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box_results_with_nms_and_limit(scores, boxes, thresh=0.0001):\n num_classes = cfg.MODEL.NUM_CLASSES\n cls_boxes = [[] for _ in range(num_classes)]\n # Apply threshold on detection probabilities and apply NMS\n # Skip j = 0, because it's the background class\n for j in range(1, num_classes):\n ... | [
"0.84204733",
"0.7942324",
"0.7934179",
"0.780184",
"0.77977127",
"0.7753623",
"0.7660473",
"0.76365316",
"0.7620821",
"0.76023704",
"0.74971926",
"0.74427515",
"0.7436171",
"0.7436171",
"0.741563",
"0.72885686",
"0.7245337",
"0.71979815",
"0.7187788",
"0.7177897",
"0.7159671... | 0.83933276 | 1 |
Gets the claim_id of this AcknowledgeClaimRequest. | def claim_id(self) -> str:
return self._claim_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def participant(self) -> AllOfAcknowledgeClaimRequestParticipant:\n return self._participant",
"def claim_id(self, claim_id: str):\n if claim_id is None:\n raise ValueError(\"Invalid value for `claim_id`, must not be `None`\") # noqa: E501\n\n self._claim_id = claim_id",
"def c... | [
"0.64194566",
"0.6089382",
"0.6089382",
"0.55581325",
"0.5430219",
"0.5407342",
"0.5317481",
"0.52693343",
"0.5257558",
"0.52255505",
"0.5204142",
"0.5196932",
"0.5031713",
"0.5031713",
"0.5031713",
"0.5031713",
"0.5031713",
"0.5031713",
"0.5031713",
"0.5031713",
"0.5031713",... | 0.78035295 | 0 |
Sets the claim_id of this AcknowledgeClaimRequest. | def claim_id(self, claim_id: str):
if claim_id is None:
raise ValueError("Invalid value for `claim_id`, must not be `None`") # noqa: E501
self._claim_id = claim_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_audience(self, claim=AUDIENCE):\n if api_settings.AUDIENCE is not None:\n self.payload[claim] = api_settings.AUDIENCE",
"def claim_id(self) -> str:\n return self._claim_id",
"def claim_id(self) -> str:\n return self._claim_id",
"def claims(self, claims):\n\n sel... | [
"0.640694",
"0.5852464",
"0.5852464",
"0.5395691",
"0.5389391",
"0.5382339",
"0.51847035",
"0.51045895",
"0.5104083",
"0.4936739",
"0.4929954",
"0.49213144",
"0.49213144",
"0.4899429",
"0.48640993",
"0.47898957",
"0.47898957",
"0.47898957",
"0.4784059",
"0.4784059",
"0.478159... | 0.7754419 | 0 |
Gets the participant of this AcknowledgeClaimRequest. | def participant(self) -> AllOfAcknowledgeClaimRequestParticipant:
return self._participant | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def participant(self) -> AllOfCancelClaimRequestParticipant:\n return self._participant",
"def participant(self, participant: AllOfAcknowledgeClaimRequestParticipant):\n if participant is None:\n raise ValueError(\"Invalid value for `participant`, must not be `None`\") # noqa: E501\n\n ... | [
"0.74645203",
"0.63649213",
"0.62636685",
"0.62636685",
"0.5621909",
"0.55505306",
"0.5520177",
"0.53735876",
"0.52754843",
"0.51563007",
"0.51520514",
"0.48818877",
"0.48776233",
"0.48762769",
"0.4870322",
"0.48693147",
"0.48395374",
"0.48382267",
"0.48261812",
"0.47656837",
... | 0.8467136 | 0 |
Sets the comment of this InlineResponse2001. | def comment(self, comment):
self._comment = comment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_comment(self, comment):\n\t\tself.comment_ = comment",
"def comment(self, comment):\n\n self.logger.debug(\"In 'comment' setter.\")\n\n self._comment = comment",
"def set_doc_comment(self, doc, comment):\n if not self.doc_comment_set:\n self.doc_comment_set = True\n ... | [
"0.73072124",
"0.72890043",
"0.69341",
"0.6929495",
"0.6921279",
"0.6810259",
"0.675065",
"0.675065",
"0.65678596",
"0.65457094",
"0.6515755",
"0.6218715",
"0.6171989",
"0.6021593",
"0.5914744",
"0.58822334",
"0.5861905",
"0.5725136",
"0.5720277",
"0.563061",
"0.5580423",
"... | 0.6957167 | 5 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, InlineResponse2001):
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 |
Generate random string of given length which contains digits and lowercase ASCII characters | def rndstr(length):
return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_str(length):\n digits = ''.join([str(num) for num in list(range(10))])\n res = ''.join(random.choice(ascii_lowercase + digits)\n for i in range(length))\n return res",
"def random_string(length=1, uppercase=False, lowercase=False):\n characters = digits\n code = str()\n... | [
"0.83876574",
"0.8268392",
"0.81770056",
"0.81397295",
"0.8133039",
"0.8097333",
"0.80937827",
"0.8079381",
"0.804907",
"0.804842",
"0.8047538",
"0.8031719",
"0.80289316",
"0.8026995",
"0.80147463",
"0.8011875",
"0.7981967",
"0.7966263",
"0.7924162",
"0.79224277",
"0.79102385... | 0.8211742 | 2 |
Split iterable to batched of given size | def split_to_batches(iterable, n=1):
l = len(iterable)
for ndx in range(0, l, n):
yield iterable[ndx:min(ndx + n, l)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _split_on_chunks(self, iterable, size):\n return utils.split_on_chunks(iterable, size)",
"def batch(size, iterable):\r\n return list(xbatch(size, iterable))",
"def batches(iterable, size):\n sourceiter = iter(iterable)\n while True:\n batchiter = islice(sourceiter, size)\n yie... | [
"0.8282763",
"0.82487077",
"0.8223477",
"0.8197402",
"0.81807095",
"0.8129903",
"0.80731905",
"0.80731905",
"0.80731905",
"0.8039522",
"0.79986787",
"0.79142785",
"0.79089457",
"0.784753",
"0.7794766",
"0.7792377",
"0.7753125",
"0.7737593",
"0.7722098",
"0.77082235",
"0.77016... | 0.7990839 | 11 |
returns a list of a text file's contents | def getFastaData2D(fileName):
fileThing = open(fileName, "r")
data = fileThing.readlines()
fileThing.close()
retlist = []
for i in range(len(data)):
if data[i][0] == ">":
retlist.append([fixName(data[i]), fixString(data[i+1])])
return retlist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getlistfromtext(self,filename):\n l=[]\n\n if self.encoding:\n f = codecs.open(filename,\"r\",encoding=self.encoding)\n for line in f:\n l.append(line.rstrip())\n f.close()\n\n else:\n f = open(filename,\"r\")\n for line... | [
"0.835068",
"0.8260842",
"0.8114176",
"0.79069453",
"0.7841011",
"0.7759766",
"0.77241135",
"0.76275873",
"0.7534252",
"0.7525591",
"0.7525591",
"0.7517489",
"0.7465953",
"0.7452292",
"0.7432176",
"0.7423679",
"0.74142164",
"0.74059546",
"0.74059546",
"0.7375245",
"0.73552215... | 0.0 | -1 |
returns the number of bases that don't match between strings, avoiding '' and 'N' | def determineIdenticalBases(string1, string2):
S = 0
D = 0
if len(string1) != len(string2):
return -1
for i in range(len(string1)):
if checkForNOrGap(string1[i]) and checkForNOrGap(string2[i]) :
if string1[i] == string2[i]:
S += 1
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nmismatches(bases_mask):\n # Check mask is valid\n if not bases_mask_is_valid(bases_mask):\n raise Exception(\"'%s': not a valid bases mask\" % bases_mask)\n # Total the length of all index reads\n index_length = 0\n for read in bases_mask.upper().split(','):\n if read.startswi... | [
"0.69964623",
"0.6819352",
"0.64217085",
"0.6390867",
"0.62415457",
"0.6170515",
"0.61395156",
"0.61356807",
"0.6118098",
"0.6086907",
"0.59665453",
"0.5896051",
"0.58277375",
"0.5771793",
"0.57325965",
"0.5729178",
"0.5707917",
"0.57063645",
"0.5704098",
"0.5688807",
"0.5659... | 0.7691822 | 0 |
Given a list of dishes, returns the average price of all the dishes | def dishlist_avg(n:list)->float:
all_prices = dishlist_prices(n)
return sum(all_prices)/len(all_prices) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_average(lst):\n\n return sum(lst) / len(lst)",
"def avg(list):\n return sum(list) / len(list)",
"def average(lst):\n return sum(lst)/len(lst)",
"def avg(lst: list):\n return sum(lst) / len(lst)",
"def get_avg(all_stock_data):\n try:\n sum_close_vol = 0.0\n sum_vol = 0... | [
"0.7620639",
"0.6665116",
"0.66060215",
"0.64351153",
"0.64232486",
"0.6407366",
"0.6336278",
"0.6320197",
"0.62470156",
"0.6204984",
"0.61770207",
"0.61696774",
"0.61604196",
"0.6127308",
"0.61161345",
"0.6081232",
"0.6076161",
"0.6072429",
"0.6068872",
"0.6061395",
"0.60329... | 0.7038575 | 1 |
Sets the description of this ElfDataStore. | def description(self, description):
if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501
raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\r\n self.__description = description",
"def set_description(self, description):\n self.__description = description",
"def set_description(self, desc: str) -> None:\n self.metadata.data[\"description\"] = desc",
"def set_description(self, descriptio... | [
"0.7438065",
"0.7400776",
"0.73389775",
"0.73132306",
"0.72867703",
"0.7188632",
"0.7179845",
"0.717305",
"0.71113867",
"0.71113867",
"0.71113867",
"0.71113867",
"0.70993143",
"0.7072803",
"0.7072803",
"0.7072803",
"0.7072803",
"0.7072803",
"0.7072803",
"0.7072803",
"0.707280... | 0.62306434 | 89 |
Sets the id of this ElfDataStore. | def id(self, id):
if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def setID(self, idf):\n self.id = idf",
"def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKException(C... | [
"0.75483036",
"0.75280654",
"0.7358707",
"0.73167944",
"0.7280258",
"0.72601956",
"0.72039366",
"0.72039366",
"0.72039366",
"0.72039366",
"0.72039366",
"0.7196175",
"0.7196175",
"0.7196175",
"0.7196175",
"0.7196175",
"0.7196175",
"0.7196175",
"0.7196175",
"0.7196175",
"0.7196... | 0.0 | -1 |
Sets the ip_whitelist of this ElfDataStore. | def ip_whitelist(self, ip_whitelist):
if self.local_vars_configuration.client_side_validation and ip_whitelist is None: # noqa: E501
raise ValueError("Invalid value for `ip_whitelist`, must not be `None`") # noqa: E501
self._ip_whitelist = ip_whitelist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_whitelist(self, field_whitelist: ConfigNodePropertyArray):\n\n self._field_whitelist = field_whitelist",
"def setWhitelist(self, w):\n return self._set(whitelist=w)",
"def dtm_staging_ip_whitelist(self, dtm_staging_ip_whitelist: ConfigNodePropertyArray):\n\n self._dtm_staging_ip_... | [
"0.71403843",
"0.6578201",
"0.6288309",
"0.6260245",
"0.6148459",
"0.6122483",
"0.5954297",
"0.5890381",
"0.58332217",
"0.5775507",
"0.571625",
"0.56376606",
"0.559866",
"0.55859",
"0.55859",
"0.5533115",
"0.5503047",
"0.53502905",
"0.53477776",
"0.5343786",
"0.53104746",
"... | 0.76099384 | 0 |
Sets the name of this ElfDataStore. | def name(self, name):
if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n # XXX: convert name to unicode, if it's a plain string?\n d = analyze_name(name, canonical=0)\n self.data.update(d)",
"def set_name(self, name):\n self._name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n ... | [
"0.74904275",
"0.7413748",
"0.73894364",
"0.73894364",
"0.7370465",
"0.7370432",
"0.73618704",
"0.7350427",
"0.7350427",
"0.7350427",
"0.7350427",
"0.7350427",
"0.7341242",
"0.7329068",
"0.7328674",
"0.7281036",
"0.7276858",
"0.7276858",
"0.71994865",
"0.71977216",
"0.7164181... | 0.0 | -1 |
Sets the nfs_export of this ElfDataStore. | def nfs_export(self, nfs_export):
self._nfs_export = nfs_export | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nfs_export_num(self, nfs_export_num):\n\n self._nfs_export_num = nfs_export_num",
"def nfs_exports_some(self, nfs_exports_some):\n\n self._nfs_exports_some = nfs_exports_some",
"def nfs_export_num_in(self, nfs_export_num_in):\n\n self._nfs_export_num_in = nfs_export_num_in",
"def nfs... | [
"0.7504137",
"0.66359675",
"0.6597475",
"0.6398488",
"0.61966485",
"0.6117921",
"0.6046813",
"0.6021377",
"0.5910891",
"0.5814333",
"0.5797072",
"0.5559637",
"0.5543464",
"0.55083114",
"0.54361355",
"0.53753436",
"0.534846",
"0.5285034",
"0.524835",
"0.52111447",
"0.5203525",... | 0.85348 | 0 |
Sets the thin_provision of this ElfDataStore. | def thin_provision(self, thin_provision):
if self.local_vars_configuration.client_side_validation and thin_provision is None: # noqa: E501
raise ValueError("Invalid value for `thin_provision`, must not be `None`") # noqa: E501
self._thin_provision = thin_provision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thin_enabled(self, thin_enabled):\n\n self._thin_enabled = thin_enabled",
"def set_virtual_disk_storage_profile(vm, hardware_device, profile):\n\n spec = vim.vm.ConfigSpec()\n device_specs = []\n profile_specs = []\n profile_spec = vim.vm.DefinedProfileSpec()\n profile_spec.profileId = ... | [
"0.6279028",
"0.51740015",
"0.504498",
"0.5020861",
"0.4950856",
"0.49470112",
"0.49453604",
"0.4941617",
"0.49238503",
"0.4907426",
"0.48932418",
"0.48818833",
"0.48594683",
"0.48592135",
"0.4856257",
"0.4815917",
"0.48082328",
"0.4790748",
"0.4751764",
"0.47483662",
"0.4747... | 0.73258865 | 0 |
Sets the type of this ElfDataStore. | def type(self, type):
if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
self._type = type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self._type = type",
"def setDataSetType(self, type):\n self.__data_set_type__ = type",
"def store_type(self, store_type):\n self._store_type = store... | [
"0.7195635",
"0.7195635",
"0.71838605",
"0.7106904",
"0.69138044",
"0.68386513",
"0.68386513",
"0.68262064",
"0.68040544",
"0.68040544",
"0.6775129",
"0.6775129",
"0.6775129",
"0.6775129",
"0.6775129",
"0.6775129",
"0.6775129",
"0.6775129",
"0.6775129",
"0.6775129",
"0.677512... | 0.5874295 | 82 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ElfDataStore):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, ElfDataStore):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
models the bkg as an exponential + a shoulder on the left described as a wide Gaussian. Optionally adds a Lambda_b component | def bkg_with_gauss_shoulder(fiter):
###bkg pdf
fiter.bkg_indx = RooRealVar("indx", "indx", -0.001, -0.1, 0.)
fiter.linbkg = RooExponential("expBkg", "Exponential background pdf", fiter.mass, fiter.bkg_indx)
###Shoulder
fiter.sh_mean = RooRealVar("sh_mean", "sh_mean", 5279.5)
fiter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_bao_gaussian_filtering(self, k, pk, Lambda = 0.25):\n # Extrapolate\n kLinear, pLinear = UF.extrapolate_log(k, pk, 1e-6, 1e6)\n dqlog = np.diff(np.log10(kLinear))[0]\n\n # EH spectrum with rescaling\n pEH = self.EisensteinHu_nowiggle_Pk(z=0, k=kLinear)[1][0]\n p... | [
"0.6247277",
"0.5576656",
"0.5536651",
"0.5507508",
"0.54908544",
"0.5475438",
"0.5466365",
"0.54243594",
"0.54078114",
"0.5401116",
"0.53377855",
"0.5315763",
"0.53139114",
"0.5288564",
"0.52824765",
"0.52635604",
"0.52502",
"0.52335525",
"0.5219027",
"0.5216733",
"0.5203112... | 0.51058275 | 36 |
nums = [4, 3, 2, 3, 5, 2, 1], k = 4 target = sum(nums) // k sum(nums) % k !== 0 [4, 3, 2, 3, 5, 2, 1] 0 0 1 1 2 2 3 3 for each group, when we put a num, the group_sum <= target, otherwise, put the num to the next group dfs, recursive, group_sum = [0] k if a num if not able to be put in a group where group_sum <= target... | def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
if not nums or len(nums) < k:
return False
if sum(nums) % k != 0:
return False
nums.sort(reverse=True) # 倒排更快
set_sum = [0] * k
average_sum = sum(nums) // k
def dfs(index):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution2(nums, K):\n s = 0\n sum_til = []\n for n in nums:\n s += n\n sum_til.append(s)\n\n l = len(nums)\n for i in range(l):\n for j in range(i+1, l):\n sum_ij = sum_til[j] if i == 0 else sum_til[j] - sum_til[i-1]\n if K != 0 and sum_ij % K == 0:\n ... | [
"0.659395",
"0.65748876",
"0.6428642",
"0.626542",
"0.61709684",
"0.61581457",
"0.6061797",
"0.60568976",
"0.59990835",
"0.58944947",
"0.58520836",
"0.58046335",
"0.57447904",
"0.57295835",
"0.57294023",
"0.5707389",
"0.56799245",
"0.5626965",
"0.5620847",
"0.5620842",
"0.559... | 0.60926527 | 6 |
The entity that belongs to this dialog (user, chat or channel). | def entity(self):
return self._entity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetEntity(self):\n return self.__entity",
"def GetEntity(self):\n\t\treturn self.acad.ActiveDocument.Utility.GetEntity()",
"def current_entity(self):\n return self.entities[len(self.device_data[CONF_ENTITIES])]",
"def getHandle(self):\n return entity",
"def getHandle(self):\n ... | [
"0.750446",
"0.683955",
"0.6626729",
"0.65509814",
"0.65509814",
"0.65465957",
"0.6541563",
"0.64396137",
"0.641735",
"0.6409505",
"0.6409505",
"0.6409505",
"0.6409505",
"0.6409505",
"0.63765556",
"0.63250935",
"0.6234326",
"0.6213481",
"0.61589044",
"0.61589044",
"0.61589044... | 0.76670617 | 0 |
Deletes this draft, and returns `True` on success. | async def delete(self):
return await self.set_message(text='') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self,\n draft_id,\n ):\n return self._invoke('delete',\n {\n 'draft_id': draft_id,\n })",
"def _delete_draft_message(draft):\n if draft is not None:\n draft.key.delete()\n return Ht... | [
"0.71908945",
"0.69041365",
"0.6588019",
"0.6499437",
"0.64410996",
"0.63845307",
"0.63561714",
"0.6325604",
"0.62922",
"0.62871855",
"0.6187414",
"0.6170203",
"0.61286443",
"0.61286443",
"0.61286443",
"0.61286443",
"0.61286443",
"0.61286443",
"0.61286443",
"0.61286443",
"0.6... | 0.55081004 | 56 |
Validates if translation service supports this locale | def validate_locale(self, locale: str) -> bool:
return locale in self.possible_locale_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_supported_translations_retrieval(self):\n\t\t\n\t\thelpers.find_supported_translations()\n\t\tself.assertTrue(helpers.get_supported_translations() != 0)",
"def validate_lang(lang):\n if lang in LANGUAGE_OPTIONS.keys():\n return True",
"def Locale_IsAvailable(*args, **kwargs):\n return _gdi_... | [
"0.6370731",
"0.62746423",
"0.6268573",
"0.6153215",
"0.60761386",
"0.6034066",
"0.59722763",
"0.59300613",
"0.5908419",
"0.5800355",
"0.5742055",
"0.5659161",
"0.5649963",
"0.5583769",
"0.55760545",
"0.55659264",
"0.55253816",
"0.55191475",
"0.54703736",
"0.54703736",
"0.544... | 0.6729042 | 0 |
Gets the list of supported locales | def get_locales(self) -> List[str]:
return self.possible_locale_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLocales(self):\n pass",
"def get_available_locales(self):\n # TODO: Assuming first server is good - need to make fallback logic\n return self.session.get_any(\"{base}{request_url}\".format(base=self.servers[0],\n request_... | [
"0.8022857",
"0.753403",
"0.74960876",
"0.68594444",
"0.68322885",
"0.6804714",
"0.6750085",
"0.66311187",
"0.6617897",
"0.6529754",
"0.64955086",
"0.64672065",
"0.63851",
"0.6351224",
"0.6347893",
"0.6343081",
"0.6324524",
"0.62677836",
"0.62337357",
"0.61522734",
"0.6137642... | 0.82740325 | 0 |
Uses Ray object to conduct the shooting of a ray. | def shoot_ray(self, row, col):
# Uses validate method to check if row,col are legal for ray entrance location
if not self.valid_ray(row, col):
return False
# creates ray object from row, col integers
ray = Ray(row, col)
# checks if atom is in front of entrance positio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shooting(agent):\n ball = agent.info.ball\n car = agent.info.my_car\n our_goal = agent.my_goal.center\n target = shooting_target(agent)\n agent.drive.target = target\n distance = distance_2d(car.location, target)\n vf = velocity_forward(car)\n dodge_overshoot = distance < (abs(vf) + 500... | [
"0.6736173",
"0.67172074",
"0.6452606",
"0.637342",
"0.6316938",
"0.6300522",
"0.6288933",
"0.6182227",
"0.6176767",
"0.6175706",
"0.61591536",
"0.6136567",
"0.6100424",
"0.60896224",
"0.607419",
"0.6048541",
"0.58968204",
"0.58935964",
"0.5856883",
"0.5851322",
"0.58468664",... | 0.6496693 | 2 |
This produces a sparse tensor with a fixed number of nonzero entries in each column. | def make_sparse_from_indices_and_values(interp_indices, interp_values, n_rows):
if not torch.is_tensor(interp_indices):
raise RuntimeError("interp_indices and interp_values should be tensors")
# Is it batch mode?
is_batch = interp_indices.ndimension() > 2
if is_batch:
batch_size, n_tar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makesparse(matrix):\n n = matrix[0].size\n elements = []\n for i in range(n):\n for j in range(n):\n if matrix[i][j] != 0 :\n temp = MatrixElement(i, j, matrix[i][j])\n elements.append(temp)\n return SparseMatrix(n, elements)",
"def spzeros(size, de... | [
"0.729667",
"0.71987677",
"0.7089726",
"0.7048619",
"0.69894844",
"0.6829338",
"0.68113345",
"0.6722561",
"0.6696425",
"0.66762",
"0.6658975",
"0.66292584",
"0.66199434",
"0.66086936",
"0.6558429",
"0.65433145",
"0.65227616",
"0.6473993",
"0.6473197",
"0.64698404",
"0.6350784... | 0.0 | -1 |
Check whether server_flavor equals to flavor. | def assert_flavor_equal(self, flavor_id, server_flavor):
# Nova API > 2.46 no longer includes flavor.id, and schema check
# will cover whether 'id' should be in flavor
if server_flavor.get('id'):
msg = ('server flavor is not same as flavor!')
self.assertEqual(flavor_id, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_flavor(nova, flavor_settings, flavor):\n setting_meta = dict()\n if flavor_settings.metadata:\n setting_meta = flavor_settings.metadata\n metadata = nova_utils.get_flavor_keys(nova, flavor)\n\n equals = True\n for key, value in setting_meta.items():\n if metadata[key] != v... | [
"0.72011334",
"0.61390495",
"0.5974979",
"0.59680915",
"0.5830272",
"0.5784817",
"0.57700276",
"0.5689436",
"0.568894",
"0.56409764",
"0.5623241",
"0.5615034",
"0.5599651",
"0.5537495",
"0.5482635",
"0.54711413",
"0.53764373",
"0.5349284",
"0.52660775",
"0.5260676",
"0.526067... | 0.78297096 | 0 |
Call in a loop to create a terminal progress bar | def printProgress(iteration, total, prefix='', suffix='', decimals=1, barLength=100):
import sys
formatStr = "{0:." + str(decimals) + "f}"
percent = formatStr.format(100 * (iteration / float(total)))
filledLength = int(round(barLength * iteration / float(total)))
bar = '#' * filledLength + '-' * (ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_progress_bar():\n\n if simple_tregex_mode:\n total_files = len(list(to_iterate_over.keys()))\n else:\n total_files = sum(len(x) for x in list(to_iterate_over.values()))\n\n par_args = {'printstatus': kwargs.get('printstatus', True),\n 'root': r... | [
"0.7457667",
"0.74567235",
"0.7356026",
"0.7347833",
"0.7207759",
"0.719306",
"0.71752644",
"0.71168876",
"0.70719826",
"0.706273",
"0.70565593",
"0.70475775",
"0.7047213",
"0.7047213",
"0.7047213",
"0.70456415",
"0.7038827",
"0.7038827",
"0.7035007",
"0.7028102",
"0.7025002"... | 0.6792708 | 74 |
Computes the area of all the boxes. | def compute_area(boxes):
area = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])
return area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])",
"def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])",
"def area(boxes):\n y_min, x_min, y_max, x_max = np.split(boxes, 4, axis=-1)\n return np.squeeze((y_max - y_min) * (x_max ... | [
"0.8266955",
"0.8266955",
"0.8206058",
"0.8051263",
"0.8033477",
"0.7974076",
"0.7853367",
"0.7848972",
"0.7678939",
"0.7502243",
"0.7421511",
"0.7391133",
"0.7330886",
"0.7318793",
"0.7096697",
"0.7093503",
"0.700362",
"0.6956545",
"0.69442",
"0.6927992",
"0.69254535",
"0.... | 0.810532 | 3 |
Given two lists of boxes of size N and M, compute the IoU (intersection over union) between __all__ N x M pairs of boxes. The box order must be (xmin, ymin, xmax, ymax). | def pairwise_iou(boxes1, boxes2):
boxes1 = torch.Tensor(boxes1)
boxes2 = torch.Tensor(boxes2)
area1 = compute_area(boxes1)
area2 = compute_area(boxes2)
# boxes1, boxes2 = boxes1.tensor, boxes2.tensor
lt = torch.max(boxes1[:, None, :2], boxes2[:, :2]) # [N,M,2]
rb = torch.min(boxes1[:, Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boxes_iou(boxes1, boxes2):\n\n if isinstance(boxes1, Box): # boxes are Box\n # verify that images has same shapes\n # if boxes1.image_shape != boxes2.image_shape:\n # raise RuntimeError(\"boxlists should have same image shape, got {}, {}\".format(boxes1.image_shape,... | [
"0.80653083",
"0.80446345",
"0.8006719",
"0.79151267",
"0.78706336",
"0.7868766",
"0.7867581",
"0.7819531",
"0.7798797",
"0.7772003",
"0.7695893",
"0.76462966",
"0.7597505",
"0.75925773",
"0.7576918",
"0.75434035",
"0.74873704",
"0.74873704",
"0.7456308",
"0.7442685",
"0.7442... | 0.76177377 | 12 |
Initialize the policy with the given weights. | def __init__(self, action=0):
self.action = action | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setWeightInitializer(self,weights):\n self.init_w = weights",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def __init__(self, weights):\n self._weights = weights",
"def init_weights(self):\n # Initialize weights\n self.apply... | [
"0.8027765",
"0.76232827",
"0.75526696",
"0.75086707",
"0.7411168",
"0.73518175",
"0.72927654",
"0.7126509",
"0.7125119",
"0.71013486",
"0.703788",
"0.70200527",
"0.70182",
"0.69805664",
"0.69720596",
"0.696547",
"0.6952201",
"0.6870206",
"0.6869783",
"0.6860008",
"0.6856643"... | 0.0 | -1 |
Calculate the area of a square. | def area(self):
return (self.__size ** 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_area(side):\n return side**2",
"def area(self):\n if isinstance(self.crs, GeographicalCRS):\n major_axis = self.crs.ellipsoid.a\n minor_axis = self.crs.ellipsoid.b\n\n area = 0.0\n if major_axis == minor_axis: # Sphere\n for seg i... | [
"0.7945308",
"0.7751262",
"0.76438457",
"0.7587921",
"0.7577845",
"0.7563372",
"0.7541159",
"0.75039923",
"0.74905246",
"0.7412309",
"0.7388725",
"0.7342652",
"0.7323086",
"0.7319793",
"0.72662467",
"0.72631276",
"0.7250947",
"0.72429055",
"0.724116",
"0.71740705",
"0.7167246... | 0.6903274 | 86 |
Decorator function which allows passing API key as keyword argument | def requires_key(cls, func):
def wrapped(*args, api_key=None, **kwargs):
if api_key:
cls.api_key = api_key
openai.api_key = cls.api_key
return func(*args, **kwargs)
return wrapped | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_key_required(func):\n\t@wraps(func)\n\tdef decorated_view(*args, **kwargs):\n\t\treturn func(*args,**kwargs)\n\treturn decorated_view",
"def get_api_key(api_key):\n api.get(api_key)",
"def set_api_key(self, host, api_key, param_name=u'api_key'):\n raise NotImplementedError(\n u\"%s... | [
"0.77791387",
"0.62564284",
"0.6230787",
"0.62022793",
"0.6120722",
"0.60547376",
"0.60293394",
"0.60121924",
"0.5866092",
"0.57987416",
"0.5793441",
"0.57812256",
"0.5750922",
"0.57385933",
"0.5732885",
"0.57170624",
"0.56641936",
"0.56543845",
"0.56472",
"0.563139",
"0.5614... | 0.7675817 | 1 |
Get indexes of cavities in board list. | def getCavityInds(board):
cavityInd = []
for i in range(0, len(board)):
if board[i] == 1:
cavityInd.append(i)
return cavityInd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def occ_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==1:\n indices.append(index)\n return indices",
"def getIndexes(self, val):\n # Find where this value is listed. \n valNdx = (self.values == val).nonzero()[0]\n ... | [
"0.6975338",
"0.6586226",
"0.6584953",
"0.6512288",
"0.63951164",
"0.6384074",
"0.624248",
"0.6160602",
"0.61452097",
"0.61211663",
"0.61081994",
"0.6082856",
"0.6081009",
"0.6074761",
"0.60643005",
"0.60616416",
"0.60571116",
"0.60459447",
"0.60342795",
"0.60171264",
"0.6012... | 0.7236055 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.