query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Convenience method that returns a boolean indicating whether or not this mentor has uploaded a receipt address document. | def has_receipt_address(self):
return self.receipt_address_uploaded_at is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_receipt_id(self):\n return self.receipt_id_uploaded_at is not None",
"def has_receipt_knowledge(self):\n return self.receipt_knowledge_uploaded_at is not None",
"def has_receipt_penal(self):\n return self.receipt_penal_uploaded_at is not None",
"def has_validated_email(self):\n ... | [
"0.64782876",
"0.62868804",
"0.6189907",
"0.6117655",
"0.5984311",
"0.57060516",
"0.56233454",
"0.55018026",
"0.5468316",
"0.541065",
"0.5366875",
"0.5290068",
"0.52592933",
"0.52192235",
"0.5212596",
"0.5178655",
"0.51570207",
"0.51467484",
"0.51443714",
"0.5135857",
"0.5135... | 0.78455067 | 0 |
Convenience method that returns a string indicating the status of receipt address document. | def get_receipt_address_status(self):
return self.get_document_status_choice(self.receipt_address_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address_str(self):\n return self._plrevgeoloc.addressString",
"def address(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"address\")",
"def address(self):\n return str(self._address)",
"def __str__(self):\n return format_address(**self._get_elements())",
"def addre... | [
"0.62897563",
"0.5880195",
"0.58506715",
"0.58247614",
"0.5818251",
"0.5772292",
"0.57720983",
"0.5764578",
"0.5728619",
"0.5718868",
"0.5718868",
"0.5718868",
"0.57158655",
"0.5715355",
"0.57119936",
"0.57119936",
"0.5623254",
"0.56032777",
"0.556492",
"0.5561944",
"0.555510... | 0.81621444 | 0 |
Convenience method that returns a boolean indicating whether or not this mentor has uploaded a receipt penal document. | def has_receipt_penal(self):
return self.receipt_penal_uploaded_at is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_receipt_knowledge(self):\n return self.receipt_knowledge_uploaded_at is not None",
"def has_receipt_id(self):\n return self.receipt_id_uploaded_at is not None",
"def has_receipt_diploma(self):\n return self.receipt_diploma_uploaded_at is not None",
"def _sign_document(self):\n ... | [
"0.6993594",
"0.6793389",
"0.64514655",
"0.5971812",
"0.59691846",
"0.59022176",
"0.58370596",
"0.5753457",
"0.5652585",
"0.5625828",
"0.5618876",
"0.5597251",
"0.555512",
"0.5538291",
"0.5533319",
"0.5504168",
"0.5500818",
"0.54788446",
"0.5456643",
"0.54428524",
"0.54237187... | 0.7778993 | 0 |
Convenience method that returns a string indicating the status of receipt penal document. | def get_receipt_penal_status(self):
return self.get_document_status_choice(self.receipt_penal_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_receipt_knowledge_status(self):\n return self.get_document_status_choice(self.receipt_knowledge_status)",
"def get_receipt_id_status(self):\n return self.get_document_status_choice(self.receipt_id_status)",
"def get_receipt_diploma_status(self):\n return self.get_document_status_ch... | [
"0.67679644",
"0.674314",
"0.66405",
"0.61538893",
"0.6117163",
"0.6070003",
"0.5917965",
"0.57881945",
"0.57881945",
"0.57881945",
"0.57881945",
"0.5719738",
"0.5695668",
"0.56879103",
"0.56819606",
"0.5653465",
"0.56028736",
"0.5599267",
"0.5593819",
"0.5593819",
"0.5593819... | 0.80558944 | 0 |
Convenience method that returns a boolean indicating whether or not this mentor has uploaded a receipt knowledge document. | def has_receipt_knowledge(self):
return self.receipt_knowledge_uploaded_at is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_receipt_id(self):\n return self.receipt_id_uploaded_at is not None",
"def has_receipt_penal(self):\n return self.receipt_penal_uploaded_at is not None",
"def has_receipt_diploma(self):\n return self.receipt_diploma_uploaded_at is not None",
"def exists(self) -> bool:\n doc... | [
"0.6655227",
"0.64934856",
"0.6092681",
"0.5998291",
"0.59306693",
"0.59066796",
"0.58764374",
"0.58090794",
"0.575869",
"0.57417375",
"0.5727842",
"0.56660783",
"0.5643081",
"0.5636607",
"0.55975884",
"0.5576364",
"0.5565704",
"0.55519766",
"0.55516046",
"0.5523044",
"0.5501... | 0.7803846 | 0 |
Convenience method that returns a string indicating the status of receipt knowledge document. | def get_receipt_knowledge_status(self):
return self.get_document_status_choice(self.receipt_knowledge_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_receipt_id_status(self):\n return self.get_document_status_choice(self.receipt_id_status)",
"def get_receipt_penal_status(self):\n return self.get_document_status_choice(self.receipt_penal_status)",
"def get_receipt_diploma_status(self):\n return self.get_document_status_choice(sel... | [
"0.693166",
"0.6818368",
"0.6389375",
"0.61780834",
"0.60561395",
"0.60359305",
"0.60359305",
"0.60310453",
"0.59778786",
"0.59778786",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
... | 0.79215044 | 0 |
Convenience method that returns a boolean indicating the user is Aprentice. | def is_aprentice(self):
return self.user_profile_status == self.APPRENTICE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_instructor(self):\n # pylint: disable=no-member\n return self.xmodule_runtime.get_user_role() == 'instructor'",
"def is_active_user(self):\n\n return self.is_active",
"def is_userAS(self, obj):\n # Some other places simply check for owner=None.\n return UserAS.objects.... | [
"0.6829945",
"0.6641206",
"0.6616499",
"0.659622",
"0.6589088",
"0.6558213",
"0.64577544",
"0.64459395",
"0.6381518",
"0.63771224",
"0.63575536",
"0.63575065",
"0.6327875",
"0.63228005",
"0.6259234",
"0.62209666",
"0.621713",
"0.6211068",
"0.61898243",
"0.61622936",
"0.613011... | 0.7932465 | 0 |
Convenience method that returns a boolean indicating the user is Mentor. | def is_mentor(self):
return self.user_profile_status == self.MENTOR | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_moderator(self):\n return self.user_type == 'M'",
"def have_mister(self):\n return bool(self.mister)",
"def is_me(self, m):\n return m.author == self.client.user",
"def is_monster_lord(self):\n return True",
"def is_usermanager(self):\n return False",
"def is_man... | [
"0.7296577",
"0.6606448",
"0.6503854",
"0.6304798",
"0.62919855",
"0.62060827",
"0.61309475",
"0.60007644",
"0.59829134",
"0.597783",
"0.59673125",
"0.5888706",
"0.5886342",
"0.5848115",
"0.5838958",
"0.58200926",
"0.5806323",
"0.5798316",
"0.57915664",
"0.5765612",
"0.572766... | 0.7400005 | 0 |
Convenience method that returns a boolean indicating the validation of phone | def has_validated_phone(self):
return self.phone is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_phone(phone_number):\n return bool(re.match(r\"^\\+?\\d{10,15}$\", phone_number))",
"def is_valid(self):\n return phonenumbers.is_valid_number(self)",
"def is_valid_phone(phone):\n assert phone is not None\n phone = str(phone)\n return len(phone) == 10 and is_valid_integer(phone)",... | [
"0.79293686",
"0.7683468",
"0.7595781",
"0.75742424",
"0.7514392",
"0.7443512",
"0.7431461",
"0.73148483",
"0.72093153",
"0.7154014",
"0.7131935",
"0.7127212",
"0.706573",
"0.70380145",
"0.6987092",
"0.69846326",
"0.6960358",
"0.6925507",
"0.6909568",
"0.6862383",
"0.68532175... | 0.8030809 | 0 |
Find the most interesting photo on this day in a given year | def most_interesting_today_in(flickr, nsid, year, size="l", now=None):
if now is None:
now = datetime.datetime.now()
# Find a photo from this particular year year
taken_year = now.replace(year=year)
min_taken_date = datetime.datetime.combine(
taken_year, datetime.time.min)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_year(our_data,year):\n return [album for album in our_data if album['number'] == str(year)]",
"def _bands_competed_last_year():\n lLastYear = datetime.datetime.now().year - 1\n cursor = connection.cursor()\n cursor.execute(\"SELECT count(distinct(r.band_id)) FROM contests_contestevent e, ... | [
"0.61243093",
"0.58490705",
"0.5837618",
"0.578425",
"0.57312024",
"0.5706204",
"0.5650941",
"0.5642707",
"0.55399",
"0.55190194",
"0.5505808",
"0.5503746",
"0.550342",
"0.5412458",
"0.5385897",
"0.5371862",
"0.53711355",
"0.5370602",
"0.53689253",
"0.5358301",
"0.5332933",
... | 0.66067845 | 0 |
Embeds a token that may or may not contain whitespaces and underscores. Used to embed history in the get_history_emb function. | def embed_token(self, token):
embs, words = [], token.split()
for word in words:
emb_list=[]
for element in word.split('_'):
# If we have a trailing _ we don't want to embed an empty string
if element:
emb,_ = self(elemen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token(self) -> str:",
"def make_display_word(secret_word):\n return ('_ ' * len(secret_word))",
"def show_hidden_word(secret_word, old_letters_guessed):\n word = \"\"\n for i in secret_word:\n if i in old_letters_guessed:\n word = word + \" \" +(i)\n el... | [
"0.5827567",
"0.5614556",
"0.55852085",
"0.5360257",
"0.53591496",
"0.5352921",
"0.5333791",
"0.5318553",
"0.52884144",
"0.52865165",
"0.52820224",
"0.52283466",
"0.5223314",
"0.5216136",
"0.52100027",
"0.520084",
"0.5197318",
"0.5189878",
"0.5177371",
"0.5162685",
"0.5140655... | 0.60626704 | 0 |
Test cache not changed. | def test_cache_without_data_change(self):
self.assertTrue(self.host_updater.refresh_cache())
self.assertFalse(self.host_updater.refresh_cache()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_local_cache():",
"def test_cache_create(self):\n self.assertTrue(self.host_updater.refresh_cache())\n self.assertTrue(os.path.exists(self.host_updater.cache_file))",
"def test_no_reload_if_needed(self):\n cache = DummyCache()\n cache.reload_from_storage = MagicMock()\n ... | [
"0.8100348",
"0.7629222",
"0.7540478",
"0.73877543",
"0.7316286",
"0.7256879",
"0.72504973",
"0.7245519",
"0.7210164",
"0.7187828",
"0.71844995",
"0.7143267",
"0.7125493",
"0.7103531",
"0.7101548",
"0.70875365",
"0.70796454",
"0.7078417",
"0.7076903",
"0.70706403",
"0.7048452... | 0.83605874 | 0 |
Test update_zone raises ZoneNotFound. | def test_failed_with_unknown_zone(self):
with self.assertRaises(ZoneNotFoundException) as context_manager:
self.host_updater.update_zone('not exists')
self.assertEqual(str(context_manager.exception),
'zone "not exists" not found') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPutZoneNotFound(self):\n zone = zmodels.Zone.objects.get(pk=1)\n try:\n response = self._put('inventory/zones/1zcvxzvzgvsdzfewrew4t4tga34/',\n data=testsxml.zone_put_xml % zone.created_date,\n username=\"testuser\", password=\"password\")\n ... | [
"0.7620249",
"0.7173009",
"0.6764803",
"0.6514296",
"0.6391376",
"0.62622356",
"0.62492454",
"0.62373465",
"0.62187773",
"0.62102854",
"0.61994654",
"0.6192325",
"0.61365056",
"0.6097996",
"0.6081406",
"0.60267836",
"0.60052854",
"0.5996641",
"0.5960123",
"0.59351003",
"0.589... | 0.78578836 | 0 |
Test method update_zone genereate certain content. test looks close to integrity test | def test_update_zone(self):
self.host_updater.zones = ['example.org', 'nowhere.com']
self.connection.query = mock.MagicMock(return_value=self.data_host2_v1)
self.host_updater.refresh_cache()
self.host_updater.update_zone('example.org')
zone_file = os.path.join(self.host_updater.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_zone_file(self):\n zone = 'example.ru'\n self.domain_updater.update_zone(zone)\n content = ''\n with open(self.domain_updater.get_zone_file(zone)) as fhandler:\n content = fhandler.read()\n self.assertEqual(content, \"$ORIGIN example.ru.\\n\... | [
"0.6673074",
"0.6562774",
"0.6316108",
"0.6217799",
"0.61417824",
"0.61365986",
"0.61138046",
"0.6085487",
"0.607466",
"0.60038745",
"0.58970076",
"0.5839151",
"0.57921565",
"0.5766198",
"0.5766198",
"0.5766198",
"0.5734134",
"0.5716708",
"0.56688493",
"0.5663457",
"0.5650685... | 0.70597154 | 0 |
Test database got error > empty hosts list. then mock fetcher fails when trying to get data from database and when cache not found should make empty list | def test_db_got_error_without_cache(self):
mock_method_path = ('dbtobindzone.fetcher.host_data_fetcher'
'.HostDataFetcher.is_fetch_success')
with mock.patch(mock_method_path) as mock_method:
mock_method.return_value = False
self.host_updater.refresh_ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_db_got_error(self):\n # update cache file from db\n self.host_updater.refresh_cache()\n # clean hosts for clean test\n self.host_updater.data = []\n # then mock fetcher fails when trying to get data from database\n # and refresh_cache should read from cache, not f... | [
"0.75851864",
"0.72628194",
"0.6707072",
"0.63236505",
"0.6320314",
"0.6318145",
"0.6244371",
"0.62328637",
"0.6226999",
"0.61866117",
"0.61795866",
"0.61685586",
"0.6147514",
"0.6121063",
"0.6089503",
"0.6074407",
"0.6072326",
"0.6056652",
"0.60419893",
"0.6036912",
"0.60314... | 0.7485661 | 1 |
Test database got error > loading from cache. | def test_db_got_error(self):
# update cache file from db
self.host_updater.refresh_cache()
# clean hosts for clean test
self.host_updater.data = []
# then mock fetcher fails when trying to get data from database
# and refresh_cache should read from cache, not from db
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_database_cache(self):\r\n database1 = self.profile.get_database('testing.db')\r\n database2 = self.profile.get_database('testing.db')\r\n self.assertEqual(database1, database2)",
"def test_connectFailure(self):\n db = Database.TestDB(self.mktemp())\n # Make _db_ini... | [
"0.68233234",
"0.6795803",
"0.6769085",
"0.66978383",
"0.6612974",
"0.648526",
"0.64786595",
"0.6475268",
"0.6475251",
"0.6387866",
"0.62412053",
"0.622158",
"0.62081456",
"0.61661136",
"0.6151744",
"0.61488277",
"0.6142648",
"0.6110781",
"0.6110433",
"0.61038655",
"0.6081906... | 0.71751356 | 0 |
Check existance of temp cachefile not broke system. this file created for diff with current cache file | def test_ref_cache_with_tempfile(self):
# update cache file from db
self.host_updater.refresh_cache()
# create temp_cache_file to test it doesnt broke system
with open(self.host_updater.temp_cache_file, 'a'):
pass
self.host_updater.refresh_cache()
self.assertF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_cache(self):\n return os.path.exists(self._cache_key)",
"def test_cache_create(self):\n self.assertTrue(self.host_updater.refresh_cache())\n self.assertTrue(os.path.exists(self.host_updater.cache_file))",
"def test_cachefile_timestamp(self):\n data = EngineTest.testdata['... | [
"0.7192045",
"0.698373",
"0.69123995",
"0.6822383",
"0.67104733",
"0.6651169",
"0.6542987",
"0.65384233",
"0.64723533",
"0.64395034",
"0.6421297",
"0.638648",
"0.6382988",
"0.6349996",
"0.63225186",
"0.63083565",
"0.63038844",
"0.6301061",
"0.62636364",
"0.6257134",
"0.623851... | 0.7908349 | 0 |
Save a Pandas DataFrame as a .csv file in the "eikon_data_files" directory. | def to_csv(df: pd.DataFrame, name: str, time_series=False) -> None:
abs_dir = os.path.dirname(__file__)
if time_series:
rel_dir = os.path.join(abs_dir, 'eikon_time_series_files')
else:
rel_dir = os.path.join(abs_dir, 'eikon_data_files')
path = ''.join([rel_dir, '/' + name])
df.to_cs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_df(data_frame, file_path):\r\n data_frame.to_csv(file_path)\r\n return None",
"def save_dataframe(dataframe, filename):\n with open(filename, \"w\", encoding=\"utf8\") as outfile: \n dataframe.to_csv(outfile, sep=\",\")",
"def save_to_csv(self):\n path = partial(os.path.join, 'd... | [
"0.7751126",
"0.7741542",
"0.77235526",
"0.7530153",
"0.75150573",
"0.73782974",
"0.73363316",
"0.72214663",
"0.71898437",
"0.7180845",
"0.7163062",
"0.7144632",
"0.7106038",
"0.709286",
"0.7091352",
"0.70737886",
"0.7071926",
"0.7053148",
"0.70504844",
"0.7031922",
"0.701255... | 0.78083926 | 0 |
Read .csv file by name from directory "eikon_data_files". | def read_data(name: str) -> pd.DataFrame:
import_dir = Path.cwd().joinpath('eikon_data_files')
path = Path.joinpath(import_dir, Path(name))
if path.exists():
return pd.read_csv(path, sep=',')
else:
print('File type "' + name + '.csv' + ' does not exist. Aborted.')
quit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data(file_name):\n\n path= os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n path = op.join(path, 'Data')\n path_clean = op.join(path, 'Cleaned Data')\n path = op.join(path_clean, file_name)\n names = os.listdir(path_clean)\n if all(file_name != i for i in names... | [
"0.7084711",
"0.69268346",
"0.68138516",
"0.66983",
"0.6660616",
"0.6636539",
"0.65480953",
"0.64125794",
"0.6356624",
"0.632736",
"0.6296105",
"0.6283871",
"0.6219146",
"0.62185717",
"0.6183666",
"0.6183666",
"0.61680883",
"0.6156817",
"0.6080677",
"0.6080677",
"0.6080677",
... | 0.7507538 | 0 |
Read .csv file by name from directory "eikon_time_series_files". | def read_time_series(name: str) -> pd.DataFrame:
import_dir = Path.cwd().joinpath('eikon_time_series_files')
path = Path.joinpath(import_dir, Path(name))
if path.exists():
return pd.read_csv(path, sep=',', index_col=0, parse_dates=True)
else:
print('File type "' + name + '.csv' + ' does... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_csv(self, path):\n for file in os.listdir(path):\n if file[-4:] == \".csv\":\n name = file[:-4]\n table_index_header = cfg.get_list(\"table_index_header\", name)\n filename = os.path.join(path, file)\n self.input_data[name] = pd... | [
"0.679266",
"0.6644177",
"0.6552054",
"0.652335",
"0.6426941",
"0.6384374",
"0.62948143",
"0.6096961",
"0.6068709",
"0.6060939",
"0.60421",
"0.6010094",
"0.6002107",
"0.60012746",
"0.59622777",
"0.59622777",
"0.5962247",
"0.59616935",
"0.59559196",
"0.59559196",
"0.59559196",... | 0.76592755 | 0 |
Coroutine for relaying any shell replies | async def relay_shell(self):
while True:
msg = await self.shell.recv_multipart()
self.shell_upstream.send_multipart(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def interactive_shell():\n # Create Prompt.\n session = PromptSession('Say something: ')\n\n # Run echo loop. Read text from stdin, and reply it back.\n while True:\n try:\n result = await session.prompt(async_=True)\n print('You said: \"{0}\"'.format(result))\n ... | [
"0.6428389",
"0.6336357",
"0.6317394",
"0.626365",
"0.61675215",
"0.611471",
"0.60842305",
"0.60611105",
"0.60258293",
"0.5969434",
"0.5964172",
"0.596269",
"0.59525114",
"0.5943545",
"0.5936027",
"0.59350973",
"0.5856096",
"0.58337355",
"0.5831691",
"0.5828413",
"0.5808169",... | 0.7066598 | 0 |
Get a launched child kernel | async def get_kernel(self):
# Ensure that the kernel is launched
await self.kernel_launched.wait()
if self.child_kernel is None:
self.log.error("the child kernel was not available")
return self.child_kernel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kernel(self, kernel_id):",
"def get_booted_kernel():\n try:\n return run(['/usr/bin/uname', '-r'])['stdout'].strip()\n except CalledProcessError as e:\n raise StopActorExecutionError(\n message='Unable to obtain release of the booted kernel.',\n details={'details... | [
"0.7083407",
"0.6916918",
"0.66532207",
"0.636412",
"0.5966004",
"0.593439",
"0.5927246",
"0.58631134",
"0.5812632",
"0.5762597",
"0.57245773",
"0.5662355",
"0.56476676",
"0.55442005",
"0.55419713",
"0.55407923",
"0.54859596",
"0.5483841",
"0.54278064",
"0.5376341",
"0.536693... | 0.8213533 | 0 |
Queue messages before sending between the child and parent kernels. | async def queue_before_relay(self, stream, ident, parent):
if not self.kernel_launched.is_set():
self._publish_status("busy")
kernel = await self.get_kernel()
self._publish_status("idle")
self.session.send(kernel.shell, parent, ident=ident) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_msg(self, my_queue, my_msg):",
"def process_queue(self):\n while not self.msg_queue.empty():\n addr, msg = self.msg_queue.get()\n if msg:\n print(msg)\n self.broadcast(addr, msg)\n else:\n self.clean(addr)",
"def queu... | [
"0.6494952",
"0.61603767",
"0.600474",
"0.5977941",
"0.59762317",
"0.59294206",
"0.589647",
"0.5829698",
"0.5812455",
"0.57797533",
"0.57684565",
"0.57596016",
"0.57365113",
"0.5706731",
"0.570348",
"0.5686441",
"0.56671435",
"0.5663831",
"0.56581116",
"0.56560105",
"0.560840... | 0.62145114 | 1 |
A helper function create a sandbox dataset if the sandbox dataset doesn't exist | def create_sandbox_dataset(project_id, dataset_id):
sandbox_dataset_id = get_sandbox_dataset_id(dataset_id)
friendly_name = f'Sandbox for {dataset_id}'
description = f'Sandbox created for storing records affected by the cleaning rules applied to {dataset_id}'
label_or_tag = {'label': '', 'tag': ''}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_and_create_sandbox_dataset(project_id, dataset_id):\n sandbox_dataset = get_sandbox_dataset_id(dataset_id)\n dataset_objs = list_datasets(project_id)\n datasets = [d.dataset_id for d in dataset_objs]\n\n if sandbox_dataset not in datasets:\n create_sandbox_dataset(project_id, dataset_i... | [
"0.8150587",
"0.65302235",
"0.6211556",
"0.6203787",
"0.6110615",
"0.6009707",
"0.599591",
"0.5987222",
"0.5972276",
"0.59333146",
"0.5915905",
"0.5912798",
"0.59105384",
"0.58354235",
"0.5832332",
"0.58273906",
"0.58266264",
"0.5812334",
"0.58049786",
"0.5789177",
"0.5785264... | 0.7600107 | 1 |
A helper function to create the sandbox dataset_id | def get_sandbox_dataset_id(dataset_id):
return '{dataset_id}_{sandbox_suffix}'.format(dataset_id=dataset_id,
sandbox_suffix=SANDBOX_SUFFIX) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sandbox_dataset(project_id, dataset_id):\n sandbox_dataset_id = get_sandbox_dataset_id(dataset_id)\n friendly_name = f'Sandbox for {dataset_id}'\n description = f'Sandbox created for storing records affected by the cleaning rules applied to {dataset_id}'\n label_or_tag = {'label': '', 'tag':... | [
"0.78849965",
"0.71405876",
"0.6602953",
"0.6602953",
"0.6602953",
"0.6523198",
"0.64632386",
"0.6459502",
"0.64120466",
"0.6368916",
"0.62163335",
"0.6168322",
"0.6148317",
"0.6097766",
"0.60915303",
"0.6055997",
"0.6013623",
"0.5996246",
"0.59510547",
"0.5886013",
"0.587578... | 0.7867274 | 1 |
A helper function to check if sandbox dataset exisits. If it does not, it will create. | def check_and_create_sandbox_dataset(project_id, dataset_id):
sandbox_dataset = get_sandbox_dataset_id(dataset_id)
dataset_objs = list_datasets(project_id)
datasets = [d.dataset_id for d in dataset_objs]
if sandbox_dataset not in datasets:
create_sandbox_dataset(project_id, dataset_id)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_dataset_exists(dataset):\n result = subprocess.call(['das_client.py', '--query', 'dataset dataset=%s' % dataset])\n return result == 0",
"def check_for_data():\n if not (os.path.exists(ep.get_test_data_path()) or os.path.exists(ep.get_dbn_weight_path())):\n return False\n return True... | [
"0.6857179",
"0.6779216",
"0.64716697",
"0.64182127",
"0.6369282",
"0.63053817",
"0.62662107",
"0.622796",
"0.62198323",
"0.61940056",
"0.6176697",
"0.61459297",
"0.613323",
"0.61221844",
"0.6083801",
"0.6049984",
"0.60484964",
"0.6013159",
"0.60080665",
"0.60002816",
"0.5950... | 0.7669106 | 0 |
Test that a tirangle with a2 + b2 = c2 triangle returns 'right' | def test_right():
assert 'right' == classify_triangle(3,4,5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_right_order():\n assert 'right' == classify_triangle(5,3,4)",
"def exsist_triangle(a: int, b: int, c: int):\n if a + b > c and a + c > b and b + c > a:\n print('Триугольник существует')\n if a == b == c:\n print('Триугольник равносторонний')\n elif a == b or a == c ... | [
"0.74664605",
"0.71656156",
"0.7115178",
"0.6949384",
"0.69150513",
"0.6878192",
"0.6876685",
"0.68689513",
"0.6795748",
"0.6753184",
"0.6725275",
"0.67120755",
"0.6528732",
"0.6482323",
"0.6449768",
"0.6413223",
"0.6407975",
"0.6397342",
"0.63817155",
"0.6343707",
"0.6297828... | 0.7173932 | 1 |
Test that a tirangle with a2 + b2 = c2 triangle return 'right' even when c is not the third parameter | def test_right_order():
assert 'right' == classify_triangle(5,3,4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exsist_triangle(a: int, b: int, c: int):\n if a + b > c and a + c > b and b + c > a:\n print('Триугольник существует')\n if a == b == c:\n print('Триугольник равносторонний')\n elif a == b or a == c or b == c:\n print('Триугольник равнобедренный')\n else:\n ... | [
"0.72841996",
"0.70938796",
"0.7064144",
"0.7042679",
"0.69772154",
"0.6909825",
"0.68825173",
"0.67438394",
"0.66963524",
"0.6687056",
"0.6561056",
"0.65205866",
"0.6341434",
"0.6333691",
"0.6332372",
"0.6294047",
"0.6262582",
"0.6226044",
"0.62051654",
"0.6147959",
"0.61368... | 0.7321993 | 0 |
CameraNet It estimates both the pose and camera intrinsics. | def CameraNet(features, is_training):
with tf.variable_scope("pose_net"):
batch_norm_params = {"is_training": is_training}
pyramid_src_img_1 = features[0]
pyramid_tgt_img = features[1]
pyramid_src_img_2 = features[2]
input_batch = tf.concat(
[pyramid_src_img_1[4]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_pose(self, corners, intrinsics: CameraIntrinsics):\n raise NotImplementedError()",
"def computeMVP(self):\n projMat = self.converterYUR\n modelViewMat = self.transforMat.invertCompose(\n Globals.render.getTransform(self.cameraNode)).getMat()\n return UnalignedL... | [
"0.6592196",
"0.6223447",
"0.6046168",
"0.60334927",
"0.5917073",
"0.59081036",
"0.5891999",
"0.5871949",
"0.5829941",
"0.57441187",
"0.5743422",
"0.56673825",
"0.5648097",
"0.5638882",
"0.56342745",
"0.56110543",
"0.5599019",
"0.55657715",
"0.5561983",
"0.55607575",
"0.55546... | 0.6673962 | 0 |
Function for determining which emitter to use for output. It lives here so you can easily subclass `Resource` in order to change how emission is detected. You could also check for the `Accept` HTTP header here, since that pretty much makes sense. Refer to `Mimer` for that as well. | def determine_emitter(self, request, *args, **kwargs):
em = kwargs.pop("emitter_format", None)
if not em:
em = request.GET.get("format", "json")
return em | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_emitter(cls, request):\r\n default_emitter = cls._meta.emitters[0]\r\n if not request:\r\n return default_emitter\r\n\r\n if request.method == 'OPTIONS':\r\n return JSONEmitter\r\n\r\n accept = request.META.get('HTTP_ACCEPT', '*/*')\r\n if acce... | [
"0.7551632",
"0.5921587",
"0.51619005",
"0.50627023",
"0.49786267",
"0.4954386",
"0.48966736",
"0.48966736",
"0.48662075",
"0.47559404",
"0.4678561",
"0.4672354",
"0.465888",
"0.46495494",
"0.46144724",
"0.45470876",
"0.45262626",
"0.45010194",
"0.448518",
"0.44817588",
"0.44... | 0.6632148 | 1 |
Gets the anonymous handler. Also tries to grab a class if the `anonymous` value is a string, so that we can define anonymous handlers that aren't defined yet (like, when you're subclassing your basehandler into an anonymous one.) | def anonymous(self):
if hasattr(self.handler, "anonymous"):
anon = self.handler.anonymous
if callable(anon):
return anon
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_handler(self, name):\n # Quite straight-forward, sets base class to our special-type class.\n return simple_handler(name, bases=(self.SimpleHandler,))",
"def get_handler(self):\n return self._Handler(self)",
"def get_handler_object(class_name):\n\n if class_name not in HANDLE... | [
"0.58558226",
"0.57717645",
"0.57625806",
"0.56526417",
"0.56414473",
"0.5573435",
"0.5550133",
"0.55416787",
"0.55416787",
"0.54214555",
"0.5404705",
"0.5403142",
"0.5380493",
"0.53146815",
"0.52683544",
"0.52447283",
"0.52016926",
"0.5186306",
"0.51617837",
"0.5132188",
"0.... | 0.7469685 | 0 |
Removes `oauth_` keys from various dicts on the request object, and returns the sanitized version. | def cleanup_request(request):
for method_type in ("GET", "PUT", "POST", "DELETE"):
block = getattr(request, method_type, {})
if True in [k.startswith("oauth_") for k in block.keys()]:
sanitized = block.copy()
for k in list(sanitized.keys()):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_params_sanitize(query_params):\n def allow_func(n, v):\n # This gets rid of any params beginning with \"oauth_\"\n if not n.startswith(\"oauth_\"):\n return True\n else:\n logging.warning(\"Protocol parameter ignored from URL query parameters: `%r`\", n)\n ... | [
"0.6340947",
"0.61129576",
"0.60895807",
"0.60618836",
"0.5947468",
"0.5845339",
"0.573013",
"0.56556916",
"0.55986094",
"0.5597275",
"0.5591427",
"0.54646105",
"0.54258853",
"0.54103065",
"0.53528404",
"0.53374463",
"0.5315842",
"0.5259125",
"0.5250367",
"0.52481705",
"0.523... | 0.71468884 | 0 |
Return all existing concepts, i.e. dimensions, measures and attributes within the model. | def concepts(self):
for measure in self.measures:
yield measure
for aggregate in self.aggregates:
yield aggregate
for dimension in self.dimensions:
yield dimension
for attribute in dimension.attributes:
yield attribute | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concept_list(\n self, params: Optional[Dict] = None, headers: Optional[Dict] = None\n ) -> List[ConceptDetails]:\n method = self._get_method(\"concepts\")\n\n return self.call_api_get(method=method, params=params, headers=headers)",
"def get_concept_list():\n\n DummyConcept.objects... | [
"0.6152737",
"0.59046966",
"0.5717409",
"0.56844723",
"0.56647795",
"0.56479055",
"0.56007886",
"0.55409026",
"0.54287976",
"0.5245966",
"0.5245699",
"0.5215275",
"0.52037776",
"0.51948243",
"0.51789504",
"0.5168293",
"0.51585734",
"0.51298964",
"0.5117981",
"0.5098278",
"0.5... | 0.7788307 | 0 |
Get all concepts matching this ref. For a dimension, that is all its attributes, but not the dimension itself. | def match(self, ref):
try:
concept = self[ref]
if not isinstance(concept, Dimension):
return [concept]
return [a for a in concept.attributes]
except KeyError:
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concepts(self):\n for measure in self.measures:\n yield measure\n for aggregate in self.aggregates:\n yield aggregate\n for dimension in self.dimensions:\n yield dimension\n for attribute in dimension.attributes:\n yield attribute"... | [
"0.7306389",
"0.5499479",
"0.5449412",
"0.53319293",
"0.5331049",
"0.53239477",
"0.5307324",
"0.5306824",
"0.52254325",
"0.5116618",
"0.5085297",
"0.50296056",
"0.50262725",
"0.50262725",
"0.49837452",
"0.4979411",
"0.48835322",
"0.48545992",
"0.4853992",
"0.4824217",
"0.4824... | 0.7350485 | 0 |
The list of the selector expressions. | def selectors(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SelectorArgs']]]]:
return pulumi.get(self, "selectors") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __expression_list(self):\n exprs = []\n try:\n expr = self.expression()\n exprs.extend(expr)\n\n while True:\n self.match_value(Punctuator, \",\")\n expr = self.expression()\n exprs.extend(expr)\n except ParseErr... | [
"0.6877212",
"0.6760001",
"0.6653466",
"0.6502484",
"0.59006786",
"0.58701307",
"0.5803656",
"0.57836914",
"0.5719632",
"0.56802464",
"0.56700075",
"0.5573982",
"0.556798",
"0.5540461",
"0.55181104",
"0.5493651",
"0.54884094",
"0.548296",
"0.548296",
"0.5469628",
"0.54270285"... | 0.6876682 | 1 |
Parses the Actuator Agent configuration and returns an instance of the agent created using that configuation. | def actuator_agent(config_path, **kwargs):
try:
config = utils.load_config(config_path)
except StandardError:
config = {}
if not config:
_log.info("Using Actuator Agent defaults for starting configuration.")
heartbeat_interval = int(config.get('heartbeat_interval', 60))
sch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_agent(config: configparser.ConfigParser, env, device='cpu'):\n\n # ===\n # Initialize agent\n agent_type = config['Agent']['type']\n\n if agent_type == 'a2c':\n agent = A2CAgent(\n action_space=env.action_space,\n observation_shape=env.observation_space.shape,\n ... | [
"0.71476305",
"0.6293717",
"0.6200106",
"0.6172245",
"0.5979629",
"0.5934763",
"0.5842836",
"0.56865674",
"0.56865674",
"0.55976075",
"0.5588873",
"0.5551119",
"0.5547474",
"0.5521435",
"0.55030185",
"0.5483826",
"0.54437906",
"0.5434063",
"0.53112566",
"0.53067935",
"0.52706... | 0.71061254 | 1 |
RPC method Set multiple points on multiple devices. Makes a single RPC call to the master driver per device. | def set_multiple_points(self, requester_id, topics_values, **kwargs):
requester_id = bytes(self.vip.rpc.context.vip_message.peer)
devices = collections.defaultdict(list)
for topic, value in topics_values:
topic = topic.strip('/')
device, point_name = topic.rsplit('/', 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actuator_set(self, topic_values):\n\n try:\n result = self.vip.rpc.call('platform.actuator', 'set_multiple_points',\n \"\", topic_values.items()).get(timeout=4)\n except RemoteError as ex:\n _log.warning(\"Failed to s... | [
"0.5697479",
"0.56268144",
"0.5573755",
"0.5508024",
"0.5470432",
"0.54571813",
"0.54571813",
"0.54439676",
"0.5397539",
"0.53948915",
"0.53874433",
"0.532401",
"0.5290368",
"0.5245113",
"0.52415633",
"0.5212733",
"0.5174939",
"0.5157856",
"0.51415193",
"0.5139146",
"0.511773... | 0.61240566 | 0 |
Schedule request pub/sub handler An agent can request a task schedule by publishing to the | def handle_schedule_request(self, peer, sender, bus, topic, headers,
message):
if sender == 'pubsub.compat':
message = compat.unpack_legacy_message(headers, message)
request_type = headers.get('type')
_log.debug('handle_schedule_request: {topic}, {hea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_start(self):\n print(\"Scheduler for monitoring request is running\")\n self.initialize_scheduler()",
"def setup_periodic_tasks(sender, **kwargs):\n sender.add_periodic_task(60, scheduled_task.s(), name='A scheduled task')",
"def before_task_publish(sender, headers, body, **_):\n ... | [
"0.6139473",
"0.5855892",
"0.5840555",
"0.58340037",
"0.57369846",
"0.57182884",
"0.55891144",
"0.5584025",
"0.55669606",
"0.5537173",
"0.5533908",
"0.549903",
"0.54968363",
"0.5474601",
"0.5435062",
"0.54306924",
"0.5426953",
"0.5412514",
"0.5401305",
"0.5397674",
"0.5386927... | 0.6419756 | 0 |
For a given experiment, create a set of edges of each Epoch that will define boundaries used for the binning of longitudinal data | def create_edges_set(config, epoch_df, data_type, verbose=False):
# Define type of data
data = "%s_samp_freq" % data_type
# Initialisation
edges = []
freq = config.getint("Sampling", data)
start = epoch_df.loc[("init", "t0")]
end = epoch_df.loc[("init", "t1")]
edges.append((sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_bin_boundaries(config, epoch_df, data_type, obs_per_bin, verbose=False):\n \n edges = create_edges_set(config, epoch_df, data_type)\n \n boundaries = []\n for edge in edges:\n start, end, freq = edge\n bin_size = freq * obs_per_bin\n boundaries.append(np.arange(start,... | [
"0.69138134",
"0.61062163",
"0.5813273",
"0.5782121",
"0.56975096",
"0.55750173",
"0.5499272",
"0.5499272",
"0.53826505",
"0.5380972",
"0.53510815",
"0.53146607",
"0.5314486",
"0.5292829",
"0.52705526",
"0.5215475",
"0.5197358",
"0.5190939",
"0.51648915",
"0.51060784",
"0.510... | 0.6485766 | 1 |
For a given experiment, create time boundaries used for the binning of longitudinal data | def create_bin_boundaries(config, epoch_df, data_type, obs_per_bin, verbose=False):
edges = create_edges_set(config, epoch_df, data_type)
boundaries = []
for edge in edges:
start, end, freq = edge
bin_size = freq * obs_per_bin
boundaries.append(np.arange(start, end, bin_siz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bintime(s,tunit,timebin,nanval): \r\n #same functionality can make use of pandas.cut\r\n #but have to convert column to seconds and bin accordingly i.e:\r\n #pd.cut(test.dt.seconds,[i*3600 for i in [1,2,3,4,5]],labels=[1,2,3,4])\r\n #and use pd.fillna(lastbin) for stuff outside bin\r\n #.cat.... | [
"0.61335367",
"0.5956642",
"0.5853896",
"0.58420914",
"0.5809306",
"0.578779",
"0.5734814",
"0.5706179",
"0.5675866",
"0.56389457",
"0.5593587",
"0.55667347",
"0.55590415",
"0.55437595",
"0.5537786",
"0.54919595",
"0.5465553",
"0.5460219",
"0.5459607",
"0.54543084",
"0.542250... | 0.61129564 | 1 |
Load a given file from all simulations within an experiment | def load_simulations(dirs, file_name):
dfs = []
for d in dirs:
df = pd.read_csv(os.path.join(d, file_name))
dfs.append(df)
return dfs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_sim(filename):\n return pybamm.load(filename)",
"def load_sample(filename):\n return open(os.path.join(SAMPLES, filename)).read()",
"def load_file(name):\n path = os.path.abspath(os.path.dirname(__file__))\n filename = os.path.join(path, \"tests/input\", name)\n with open(filename, \"r\... | [
"0.67374754",
"0.6170987",
"0.61021113",
"0.6085926",
"0.6049061",
"0.603076",
"0.6020017",
"0.5992513",
"0.5974742",
"0.59703946",
"0.5938234",
"0.5923322",
"0.5892145",
"0.5886311",
"0.58817947",
"0.58787066",
"0.58782333",
"0.5860194",
"0.58437705",
"0.5832787",
"0.5830565... | 0.6492545 | 1 |
Bin a set of simulations | def bin_simulations(simulations, keep_cols, bins, right=True):
sims_binned = []
for sim in simulations:
grp = sim.groupby(pd.cut(sim.t0, bins=bins, right=right))
sim_binned = grp.mean()[keep_cols]
sims_binned.append(sim_binned)
return sims_binned | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_binarise(self):\n pass",
"def bin_the_data(neuron_spikes, first, last, bin_size):\n neuron_activity = []\n timebins = range(first, int(last) + int(last) % bin_size, bin_size)\n for spike in neuron_spikes:\n activity = []\n spike_time = spike[0]\n i = 0\n for bi... | [
"0.6603843",
"0.62507457",
"0.6079155",
"0.60454094",
"0.60178524",
"0.5985635",
"0.59072727",
"0.57596207",
"0.565037",
"0.564149",
"0.55715793",
"0.55599135",
"0.5548857",
"0.55190116",
"0.5517709",
"0.55059445",
"0.550458",
"0.54895025",
"0.5461584",
"0.5418172",
"0.541571... | 0.66408455 | 0 |
Average a set of binned simulations | def average_simulations(simulations_binned, keep_cols, bin_midpoints):
sims_array = np.dstack(simulations_binned)
print(" Bins:", sims_array.shape[0])
print(" Metrics:", sims_array.shape[1])
print(" Experiments:", sims_array.shape[2])
# Count number of simulations with data for each bin
nan_arr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binning(S, bands):\n B = np.zeros((S.shape[0], len(bands)), dtype=S.dtype)\n for i, b in enumerate(bands):\n B[:, i] = np.mean(S[:, b[0] : b[1]], axis=1)\n\n return B",
"def bin_data(data, num_bins):\n\tslices = np.linspace(0, 100, num_bins+1, True).astype(np.int)\n\tcounts = np.diff(slices)\... | [
"0.6916924",
"0.6611971",
"0.6498207",
"0.64943504",
"0.64124846",
"0.63122535",
"0.6272787",
"0.6247839",
"0.624207",
"0.6168152",
"0.6158994",
"0.60757333",
"0.6036939",
"0.6018163",
"0.60148466",
"0.5987723",
"0.59650266",
"0.5911934",
"0.59088844",
"0.5907759",
"0.5873183... | 0.69469047 | 0 |
Returns a boolean stating that the user should be logged out when its True, and False otherwise. | def should_log_out(timeout: int, user: User) -> bool:
if not user or user.nickname == nick_of_anonymous_user:
return False
# check difference of
diff_action: timedelta = get_now() - user.last_action
diff_login: timedelta = get_now() - user.last_login
diff_action: int = diff_action.seconds +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_logged_out(connection,user):\r\n with connection:\r\n return connection.execute(UPDATE_USER_LOGIN_STATUS_TO_FALSE,(user,))",
"def isLoggedOut(self):\n return self.sess is None or self.sess.isNew()",
"def validUser(self):\n if self.state == SessionStates.LOGGED_OUT:\n ... | [
"0.74472284",
"0.7290976",
"0.72381735",
"0.7175781",
"0.71673757",
"0.7157834",
"0.7143311",
"0.71379465",
"0.7116527",
"0.69637626",
"0.69101816",
"0.6869772",
"0.6866669",
"0.6831484",
"0.68150437",
"0.6772321",
"0.6759161",
"0.6734961",
"0.67208004",
"0.6699055",
"0.66729... | 0.7328891 | 1 |
Return the public historical data regarding statements and edits of a certain user. | def _historical_user_data_for_statements_edits(user: User, days: int, lang: str) -> Tuple[List, List]:
statement_data = []
edit_data = []
for begin, end in _time_range_list(days):
get_tv_dict = get_textversions(user, lang, begin, end)
statement_data.append(len(get_tv_dict.get('statements', [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history():\n # extract history of operation for a particular user\n historical_data = db.execute(\"SELECT Symbol, Company, Shares, Price, Total, Timestamp FROM portfolio WHERE id = :id\", id=session[\"user_id\"])\n\n return render_template(\"history.html\", historical=historical_data)",
"def show_hi... | [
"0.6871201",
"0.68145704",
"0.6693379",
"0.66911286",
"0.6626661",
"0.6589151",
"0.6569889",
"0.6565698",
"0.6504375",
"0.6499711",
"0.64429367",
"0.6410973",
"0.63605094",
"0.63386434",
"0.63320225",
"0.63180774",
"0.6307118",
"0.6285006",
"0.62729913",
"0.6234434",
"0.62168... | 0.6864261 | 1 |
Returns the number of reviews made by the user. | def number_of_reviews(user: User, only_today: bool) -> int:
since = arrow.utcnow() if only_today else arrow.get(0)
since_timestamp = since.format('YYYY-MM-DD')
num_edits = DBDiscussionSession.query(ReviewEdit).filter(
ReviewEdit.detector_uid == user.uid,
ReviewEdit.timestamp >= since_timest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def review_count(self):\n\t\tcount = self.reviews.aggregate(\n\t\t\tcount=models.Count('rating'))['count']\n\t\tif count is None:\n\t\t\tcount = 0\n\t\treturn count",
"def num_reviews(self):\n return self.review_set.count()",
"def getNumberOfReviews(self):\n try:\n count = 0\n ... | [
"0.81208235",
"0.78017086",
"0.6986087",
"0.68612885",
"0.67599213",
"0.67022717",
"0.6659577",
"0.66041076",
"0.6421152",
"0.6246157",
"0.62308896",
"0.6216477",
"0.61635613",
"0.6123065",
"0.6101357",
"0.60882354",
"0.6087097",
"0.6015562",
"0.6011251",
"0.6003508",
"0.5990... | 0.7952932 | 1 |
Returns the number of statements and edits a user made. | def _get_count_of_statements(user: User, only_today: bool = False) -> Tuple[int, int]:
edit_count = 0
statement_count = 0
texts = DBDiscussionSession.query(TextVersion).filter_by(author_uid=user.uid)
if only_today:
today = arrow.utcnow().format('YYYY-MM-DD')
texts = texts.filter(TextVer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_edit_count_of(db_user: User, only_today: bool = False) -> int:\n edit_count, _ = _get_count_of_statements(db_user, only_today)\n return edit_count",
"def GetModifiedUser(self):\n modifycount, modify = self.__sqlData[\"SELECT u.ID,u.UID,u.Login,u.GID,u.Passwd,u.Description,i.Shell\" \\\n ... | [
"0.71797574",
"0.638631",
"0.6351734",
"0.6340748",
"0.62821656",
"0.6229606",
"0.6178747",
"0.6153758",
"0.61370444",
"0.60171616",
"0.600625",
"0.59735155",
"0.5973097",
"0.5943728",
"0.58850086",
"0.5860536",
"0.5833723",
"0.5798604",
"0.5789599",
"0.57730573",
"0.5762256"... | 0.7213073 | 0 |
Returns the number of statements a user made. | def get_statement_count_of(db_user: User, only_today: bool = False) -> int:
_, statement_count = _get_count_of_statements(db_user, only_today)
return statement_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_statements(self):\n query = read_query('content exploration/count_statements')\n response = self._submit_query(query)\n return response[0]['count']['value']",
"def count_statements_by(self, actor_label):\n query = read_query('trust/count_statements_by') % actor_label\n ... | [
"0.7699826",
"0.7209482",
"0.7123395",
"0.6792927",
"0.6753025",
"0.67326164",
"0.6575017",
"0.644621",
"0.64366263",
"0.6436165",
"0.6430178",
"0.6414416",
"0.6395853",
"0.63688165",
"0.6353478",
"0.63274384",
"0.6317921",
"0.6308827",
"0.62995607",
"0.6277423",
"0.62427354"... | 0.7438788 | 1 |
Returns the number of edits a user made. | def get_edit_count_of(db_user: User, only_today: bool = False) -> int:
edit_count, _ = _get_count_of_statements(db_user, only_today)
return edit_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_revisions_by_user(self):\n return self.run_query(f\"count({self.r}/contributor[id = 5558])\")",
"def run_edits(self):\n _edit_count = 0\n for main_key in self.job[\"edits\"]:\n for _item in self.job[\"edits\"][main_key]:\n _edit_count += self.json_o.edit(m... | [
"0.68746793",
"0.6378601",
"0.5975384",
"0.5973074",
"0.59671867",
"0.595553",
"0.59339297",
"0.59183836",
"0.5893158",
"0.58767873",
"0.58553976",
"0.57918096",
"0.5790966",
"0.5762172",
"0.5738545",
"0.5702761",
"0.5692286",
"0.5683612",
"0.5682098",
"0.56801015",
"0.567382... | 0.72009784 | 0 |
Returns the count of marked arguments and statements of the specific user. | def get_mark_count_of(user: User, only_today: bool = False) -> Tuple[int, int]:
if not user:
return 0, 0
marked_arguments = DBDiscussionSession.query(MarkedArgument).filter(MarkedArgument.author_uid == user.uid)
marked_statements = DBDiscussionSession.query(MarkedStatement).filter(MarkedStatement.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_count_of_statements(user: User, only_today: bool = False) -> Tuple[int, int]:\n edit_count = 0\n statement_count = 0\n texts = DBDiscussionSession.query(TextVersion).filter_by(author_uid=user.uid)\n\n if only_today:\n today = arrow.utcnow().format('YYYY-MM-DD')\n texts = texts.fi... | [
"0.6896396",
"0.67540836",
"0.6620312",
"0.62979406",
"0.62142026",
"0.6180741",
"0.6006424",
"0.58851326",
"0.57694185",
"0.57633024",
"0.5750103",
"0.5736711",
"0.57205635",
"0.56984997",
"0.569219",
"0.5672656",
"0.5600865",
"0.55884683",
"0.55759954",
"0.55546933",
"0.555... | 0.7462889 | 0 |
Returns the count of clicked arguments and clicked statements the user made. | def get_click_count_of(user: User, only_today: bool = False) -> Tuple[int, int]:
if not user:
return 0, 0
clicked_arguments = DBDiscussionSession.query(ClickedArgument).filter(ClickedArgument.user == user)
clicked_statements = DBDiscussionSession.query(ClickedStatement).filter(ClickedStatement.user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_arguments(self) -> int:\n if 'arguments' in self._event:\n return len(self._event['arguments'])\n return 0",
"def count_interactive(*args):\n #print args \n return sum(filter(None, args))",
"def _get_count_of_statements(user: User, only_today: bool = False) -> Tuple[int, ... | [
"0.6339022",
"0.62939394",
"0.6098393",
"0.5910566",
"0.5893837",
"0.5857723",
"0.57633877",
"0.5745147",
"0.5670483",
"0.5621861",
"0.55977577",
"0.5597537",
"0.5593333",
"0.5565685",
"0.5497682",
"0.5466758",
"0.5437324",
"0.5417644",
"0.5403606",
"0.53919506",
"0.53795457"... | 0.6849272 | 0 |
Returns all textversions, were the user is the author. | def get_textversions(user: User, lang: str, timestamp_after: Arrow = None, timestamp_before: Arrow = None) -> \
Dict[str, List[Dict[str, str]]]:
statements = []
edits = []
if not timestamp_after:
timestamp_after = arrow.get('1970-01-01').format('YYYY-MM-DD')
if not timestamp_before:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_versions(self):\n versions = TextVersion.objects.filter(text__exact=self).order_by('-created')\n # TODO: use new postgresql 8.4 row_number as extra select to do that\n #for index in xrange(len(versions)):\n # v = versions[index]\n # # version_number is 1-based\n ... | [
"0.7109906",
"0.59272015",
"0.5749301",
"0.57353383",
"0.56826156",
"0.5670209",
"0.5514083",
"0.54370844",
"0.5433891",
"0.5423951",
"0.5387547",
"0.53806776",
"0.5362834",
"0.5332066",
"0.5322581",
"0.5293491",
"0.52933645",
"0.52627265",
"0.5261462",
"0.5254291",
"0.525017... | 0.5951645 | 1 |
Get all marked arguments of the user. | def get_marked_arguments(user: User, lang: str) -> List[Dict[str, Any]]:
marked_arguments = DBDiscussionSession.query(MarkedArgument).filter_by(author_uid=user.uid).all()
return [_marked_element_to_dict(marked_argument, lang) for marked_argument in marked_arguments] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_args(self):\r\n return self.args",
"def args(self) -> List[str]:\n return self.__args",
"def get_args(self) -> List[str]:\n return self.content.split()[1:]",
"def args(self):\n return self._args",
"def args(self):\n return self._args",
"def args(self):\n ... | [
"0.68176377",
"0.6764676",
"0.6642321",
"0.6639527",
"0.6639527",
"0.6639527",
"0.66104674",
"0.66080403",
"0.6595975",
"0.6532093",
"0.6504637",
"0.6450526",
"0.6448906",
"0.64310664",
"0.6424401",
"0.6409246",
"0.6409246",
"0.6409246",
"0.6409246",
"0.6409246",
"0.6409246",... | 0.7207236 | 0 |
Get all marked statements of the user. | def get_marked_statements(user: User, lang: str) -> List[Dict[str, Any]]:
marked_statements = DBDiscussionSession.query(MarkedStatement).filter_by(author_uid=user.uid).all()
return [_marked_element_to_dict(marked_statement, lang) for marked_statement in marked_statements] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_clicked_statements(user: User, lang: str) -> List[Dict[str, Any]]:\n return [clicked_statement.to_dict(lang) for clicked_statement in user.clicked_statements]",
"def get_all_iam_statements_for_user(self, name):\n result = None\n for user_detail in self.users:\n if user_detail.... | [
"0.610428",
"0.6060263",
"0.58502007",
"0.5758442",
"0.55817443",
"0.5464419",
"0.54542357",
"0.5370775",
"0.51991487",
"0.49887905",
"0.49568728",
"0.49116477",
"0.49116477",
"0.4823958",
"0.48101163",
"0.4805514",
"0.4794544",
"0.47824982",
"0.4782069",
"0.47714946",
"0.475... | 0.734561 | 0 |
Transform a given MarkedArgument or MarkedStatement object into a dictionary representation. | def _marked_element_to_dict(marked_object: Union[MarkedArgument, MarkedStatement], lang: str) -> Dict[str, Any]:
dict_representation = marked_object.to_dict()
if type(marked_object) is MarkedArgument:
return dict_representation.update({'content': get_text_for_argument_uid(marked_object.argument_uid, lan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clicked_argument_to_dict(clicked_argument: ClickedArgument, lang: str) -> Dict[str, Any]:\n\n return {\n 'uid': clicked_argument.uid,\n 'timestamp': sql_timestamp_pretty_print(clicked_argument.timestamp, lang),\n 'is_up_vote': clicked_argument.is_up_vote,\n 'is_valid': clicked_a... | [
"0.66288126",
"0.6026332",
"0.57131404",
"0.57026494",
"0.5647321",
"0.55958235",
"0.55920523",
"0.55768657",
"0.55072814",
"0.5483353",
"0.5475108",
"0.5470173",
"0.5358039",
"0.53358006",
"0.5329212",
"0.5327898",
"0.53234696",
"0.53045577",
"0.5303567",
"0.52966726",
"0.52... | 0.7295549 | 0 |
Return all statements that the user clicked. | def get_clicked_statements(user: User, lang: str) -> List[Dict[str, Any]]:
return [clicked_statement.to_dict(lang) for clicked_statement in user.clicked_statements] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statements(self):\n return self._statements",
"def get_all_iam_statements_for_user(self, name):\n result = None\n for user_detail in self.users:\n if user_detail.user_name == name:\n result = user_detail.all_iam_statements\n break\n return ... | [
"0.66715324",
"0.59439355",
"0.5879339",
"0.57424635",
"0.56278217",
"0.5605569",
"0.5600374",
"0.55474234",
"0.55200386",
"0.5459462",
"0.5439411",
"0.54102325",
"0.5380864",
"0.53629375",
"0.53537667",
"0.5322446",
"0.53161645",
"0.5252001",
"0.5234702",
"0.52311933",
"0.52... | 0.678099 | 0 |
Transforms a single ClickedArgument object into a dictionary representation of itself. | def _clicked_argument_to_dict(clicked_argument: ClickedArgument, lang: str) -> Dict[str, Any]:
return {
'uid': clicked_argument.uid,
'timestamp': sql_timestamp_pretty_print(clicked_argument.timestamp, lang),
'is_up_vote': clicked_argument.is_up_vote,
'is_valid': clicked_argument.is_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argdict(self):\n return dict((arg.name, val) for arg, val in zip(self.sig, self))",
"def as_kwargs(self) -> Dict[str, Any]:\n ret = {}\n for arg in self.args.values():\n ret[arg.name] = arg.value\n return ret",
"def as_dict(self) -> dict:\n original_dict = self... | [
"0.627349",
"0.62556094",
"0.60366035",
"0.60117084",
"0.59324",
"0.56791705",
"0.5643486",
"0.56244975",
"0.56012976",
"0.55871683",
"0.55571014",
"0.55362844",
"0.5511772",
"0.5464543",
"0.543648",
"0.54236597",
"0.5383975",
"0.5315335",
"0.52891815",
"0.5283251",
"0.527028... | 0.7343072 | 0 |
Create a new user for an oauth provider. | def set_new_oauth_user(user_data: Dict[str, Any], oauth_id: str, provider: str, _tn: Translator) -> Dict[str, Any]:
temporary_user = dict(user_data)
# sanity check
db_user = DBDiscussionSession.query(User).filter(User.oauth_provider == str(provider),
Use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_new_user(user_info: Dict[str, Any], ui_locales: str, oauth_provider: Optional[str] = None,\n oauth_provider_id: Optional[str] = None) -> Tuple[str, str, User]:\n success = ''\n info = ''\n\n _tn = Translator(ui_locales)\n language = DBDiscussionSession.query(Language).... | [
"0.69942427",
"0.6899755",
"0.68439484",
"0.67987776",
"0.6768764",
"0.67418265",
"0.67274445",
"0.672653",
"0.6722475",
"0.67160195",
"0.6698957",
"0.66952634",
"0.66750103",
"0.66740257",
"0.66607255",
"0.6641586",
"0.6638586",
"0.6614092",
"0.6579413",
"0.6558813",
"0.6553... | 0.71642804 | 0 |
Returns a list of users which are members of the admin group. If this list is empty, DBAS is configured wrongly. | def get_list_of_admins() -> List[User]:
return DBDiscussionSession.query(User).filter(User.group == Group.ADMIN).all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_admin_users(self):\r\n try:\r\n users = self.list_all(\"users\")\r\n users_admin = [user for user in users if user[\"role\"] == \"admin\"]\r\n return users_admin\r\n except PDClientError as e:\r\n raise e",
"def get_admin_users() -> User:\n ret... | [
"0.80651945",
"0.8058923",
"0.77551794",
"0.7686736",
"0.7389198",
"0.73671716",
"0.7220253",
"0.71301055",
"0.7127656",
"0.71047544",
"0.7081496",
"0.69730145",
"0.69101524",
"0.68965375",
"0.6841849",
"0.67377156",
"0.6699433",
"0.66851383",
"0.6671356",
"0.6651909",
"0.664... | 0.816237 | 0 |
Converts fasta formated file to a dataframe | def preproc(fasta_file):
#flybase fasta file has internal newline in the same seqeunce
fas=fix_fasta.fix_fasta(fasta_file)
fasta_df=pd.DataFrame(list(fas))
fasta_df.columns=['Header','Sequence']
return fasta_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fasta(file_path):\n \n print(f\"Parsing fasta '{file_path}'\")\n data = {\n 'ur_up_': [], 'accession': [],\n 'entry_name': [], 'offset': [],\n 'taxonomy': [], 'sequence': []\n }\n\n with open(file_path, 'r') as f:\n for i, line in enumerate(f):\n ... | [
"0.77549684",
"0.7149791",
"0.7107577",
"0.7028392",
"0.6846967",
"0.6841151",
"0.67732084",
"0.67034525",
"0.6650739",
"0.6617848",
"0.64869463",
"0.648358",
"0.6388607",
"0.63245577",
"0.6291754",
"0.6245816",
"0.6206927",
"0.6189495",
"0.6162235",
"0.6140053",
"0.61213624"... | 0.77973205 | 0 |
computes the fractional frequency of a codon in its CDS | def get_cod_freq(gene):
header = gene.iloc[:,0].values[0].split(' ')
geneID=header[0][1:]
#get coding sequence
cds = gene.iloc[:,1].values[0].upper().replace('T','U')
codon_count=dict()
#build dictionary to accumulate codon counts; ignore with stop codons
for codon in list(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freq():",
"def codonfreqs_kmerdf(kmertable): \n codon_counts_kmer = np.zeros(( len(codons_nonstop) ))\n for kmer in kmertable['kmer']:\n current_kmer_codons = [ kmer[(i*3):((i*3)+3)] for i in range(3) ] # ! hard coded for length L=3\n for codon in current_kmer_codons:... | [
"0.67800206",
"0.675204",
"0.67134994",
"0.66914696",
"0.65138024",
"0.6455968",
"0.64268374",
"0.63415146",
"0.6313569",
"0.62873554",
"0.62816733",
"0.62559867",
"0.622959",
"0.6227822",
"0.62005085",
"0.61983305",
"0.61980456",
"0.6148837",
"0.61427104",
"0.61339045",
"0.6... | 0.69413567 | 0 |
Returns chats for the given user. | async def get(self):
await self.handle_request(self.chats_user_api, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_chats():\n result = g.driver.get_all_chats()\n return jsonify(result)",
"def get_all_chats_list(self):\n\n new_chats = True\n chats = self.get_chats(2**63-1,0)\n while new_chats:\n last_chat = self.get_chat(chats[-1])\n last_order = last_chat['positions'][... | [
"0.665497",
"0.6530272",
"0.6497347",
"0.6491061",
"0.6361134",
"0.6282955",
"0.62048787",
"0.6161619",
"0.61262727",
"0.60965705",
"0.6025415",
"0.5947367",
"0.59391266",
"0.59280276",
"0.57502204",
"0.5722477",
"0.57077587",
"0.57025206",
"0.56915194",
"0.5687326",
"0.56803... | 0.67895013 | 0 |
Convert the data format to ['features', 'label'] for training Use Total amount of items, num of rounds, avg time of maintenance for each car as features | def transform_train_data(df):
return df.rdd.map(
lambda x: (
Vectors.dense([x.amount, x.split, x.maintain4, x.maintain12]),
x.intime
)
).toDF(["features", "label"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_training_data():\n features = []\n labels = []\n\n with open('data.csv') as csv_file:\n csv_reader = csv.reader(csv_file, delimiter=',')\n\n rows = [line for line in csv_reader]\n random.shuffle(rows)\n\n for vector in rows:\n feature_vector = [float(vector[i... | [
"0.6324285",
"0.63232195",
"0.62793756",
"0.6191003",
"0.6170195",
"0.61395603",
"0.60945785",
"0.6013701",
"0.6004328",
"0.5980295",
"0.59714174",
"0.59705436",
"0.59663135",
"0.59519625",
"0.59460783",
"0.5931936",
"0.5912947",
"0.58884805",
"0.5856409",
"0.58496565",
"0.58... | 0.6649767 | 0 |
Get the most similar words to a word. | def most_similar_words(self, word, n_words=5, include_similarity=False):
if word in self.vocab:
token_id = self.diction[word]
tiled_embedding = np.tile(self.embeddings[token_id], (self.n_words, 1))
embedding_similarities = self._dist_metric(tiled_embedding, self.embeddings)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_similar_word(self,word, word_set):\n\t max_sim = -1.0\n\t sim_word = \"\"\n\t for ref_word in word_set:\n\t sim = self.word_similarity(word, ref_word)\n\t if sim > max_sim:\n\t max_sim = sim\n\t sim_word = ref_word\n\t return sim_word, max_sim",
"def find_frequent... | [
"0.739039",
"0.708112",
"0.7022034",
"0.69847745",
"0.6958979",
"0.6939994",
"0.69380647",
"0.6900103",
"0.68977326",
"0.6893122",
"0.6859898",
"0.6831184",
"0.68152976",
"0.6763861",
"0.6715398",
"0.6676233",
"0.666966",
"0.6642691",
"0.661362",
"0.66118616",
"0.66023576",
... | 0.7266293 | 1 |
Tests tensor encryption and decryption for both positive and negative values. | def test_encrypt_decrypt(self):
reference = get_random_test_tensor()
encrypted_tensor = SharedTensor(reference)
self._check(encrypted_tensor, reference, 'en/decryption failed') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sign(self):\n funcs = ['sign', 'sign_', 'abs', 'abs_', 'relu', 'relu_']\n for func in funcs:\n tensor = get_random_test_tensor(max_value=1e4)\n if func != 'sign' and func != 'sign_':\n # Make sure we test with some entry, say entry (0, 0), being 0\n ... | [
"0.7491157",
"0.6268153",
"0.62675613",
"0.6259197",
"0.60988694",
"0.6064985",
"0.594484",
"0.5875434",
"0.58734727",
"0.5867007",
"0.58620197",
"0.583234",
"0.57241726",
"0.571728",
"0.56861144",
"0.56763583",
"0.5657369",
"0.564832",
"0.56377465",
"0.56308943",
"0.5601653"... | 0.7160112 | 1 |
Tests arithmetic functions on encrypted tensor. | def test_arithmetic(self):
arithmetic_functions = ['add', 'add_', 'sub', 'sub_', 'mul', 'mul_']
for func in arithmetic_functions:
for tensor_type in [lambda x: x, SharedTensor]:
tensor1 = get_random_test_tensor()
tensor2 = get_random_test_tensor()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exp(self):\n funcs = ['exp', 'exp_']\n for func in funcs:\n tensor = get_random_test_tensor(max_value=2)\n encrypted = SharedTensor(tensor)\n reference = getattr(tensor, func)()\n encrypted_out = getattr(encrypted, func)()\n self._check(... | [
"0.7440904",
"0.71482503",
"0.67264414",
"0.6613173",
"0.6202073",
"0.610822",
"0.59994227",
"0.59895205",
"0.5890907",
"0.5878319",
"0.58230543",
"0.57520473",
"0.5742962",
"0.57086426",
"0.5701576",
"0.56818116",
"0.56791645",
"0.564867",
"0.5648094",
"0.5622839",
"0.561398... | 0.81342566 | 0 |
Tests transpose on encrypted tensor. | def test_transpose(self):
funcs = ['transpose', 'transpose_']
for func in funcs:
tensor = get_random_test_tensor()
encrypted = SharedTensor(tensor)
reference = getattr(tensor, func)(0, 1)
encrypted_out = getattr(encrypted, func)(0, 1)
msg = 'pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose(tensor):\n raise NotImplementedError",
"def test_encrypt_decrypt(self):\n reference = get_random_test_tensor()\n encrypted_tensor = SharedTensor(reference)\n self._check(encrypted_tensor, reference, 'en/decryption failed')",
"def transpose():",
"def _need_transpose(e... | [
"0.70575035",
"0.66483",
"0.65790385",
"0.6485043",
"0.644974",
"0.62927717",
"0.626889",
"0.6264478",
"0.61754316",
"0.60824764",
"0.60801154",
"0.60138",
"0.5976004",
"0.5968149",
"0.595",
"0.59417945",
"0.59391934",
"0.58678913",
"0.5824966",
"0.5717935",
"0.5691929",
"0... | 0.7889694 | 0 |
Test convolution of encrypted tensor with public/private tensors. | def test_conv(self):
for kernel_type in [lambda x: x, SharedTensor]:
for matrix_width in range(2, 5):
for kernel_width in range(1, matrix_width):
for padding in range(kernel_width // 2 + 1):
matrix_size = (5, matrix_width)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_encrypt_decrypt(self):\n reference = get_random_test_tensor()\n encrypted_tensor = SharedTensor(reference)\n self._check(encrypted_tensor, reference, 'en/decryption failed')",
"def encrypt_tensor(input):\n # get rank of current process\n rank = comm.get().get_rank()\n # get... | [
"0.62341356",
"0.6098622",
"0.60783917",
"0.588527",
"0.5827456",
"0.57572156",
"0.5740991",
"0.57317865",
"0.5723476",
"0.57132936",
"0.569828",
"0.56962866",
"0.5666495",
"0.5645544",
"0.5603827",
"0.5581291",
"0.55197054",
"0.5510904",
"0.5507598",
"0.54758525",
"0.5443927... | 0.7230294 | 0 |
Test average pooling on encrypted tensor. | def test_pooling(self):
for width in range(2, 5):
for width2 in range(1, width):
matrix_size = (4, 5, width)
matrix = get_random_test_tensor(size=matrix_size)
pool_size = width2
for stride in range(1, width2):
for pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avg_pool(x,\n k_h,\n k_w,\n s_h,\n s_w,\n name,\n padding=\"VALID\"):\n with tf.name_scope(name):\n outputs = tf.nn.avg_pool(x, [1, k_h, k_w, 1], [1, s_h, s_w, 1], padding)\n # Return la... | [
"0.6192437",
"0.5927074",
"0.5906969",
"0.58665806",
"0.57796353",
"0.575543",
"0.5705318",
"0.5693629",
"0.56194794",
"0.56129694",
"0.5607022",
"0.5600987",
"0.5574885",
"0.55630505",
"0.55449325",
"0.550953",
"0.5502325",
"0.5491738",
"0.5484568",
"0.5468709",
"0.546522",
... | 0.7470934 | 0 |
Tests division by numbers in [1, 2] on encrypted tensor. | def test_div(self):
funcs = ['div', 'div_']
for func in funcs:
for tensor_type in [lambda x: x, SharedTensor]:
tensor1 = get_random_test_tensor()
tensor2 = get_random_test_tensor(max_value=0.5) + 1.5
encrypted = SharedTensor(tensor1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arithmetic(self):\n arithmetic_functions = ['add', 'add_', 'sub', 'sub_', 'mul', 'mul_']\n for func in arithmetic_functions:\n for tensor_type in [lambda x: x, SharedTensor]:\n tensor1 = get_random_test_tensor()\n tensor2 = get_random_test_tensor()\n ... | [
"0.6298104",
"0.62002087",
"0.5901363",
"0.58756566",
"0.58391434",
"0.58218366",
"0.5741983",
"0.5712075",
"0.57049567",
"0.5697863",
"0.5516264",
"0.55135024",
"0.549043",
"0.5436364",
"0.54344636",
"0.5415657",
"0.53985536",
"0.5397176",
"0.5379957",
"0.5363208",
"0.535340... | 0.7220988 | 0 |
Tests sign on encrypted tensor. | def test_sign(self):
funcs = ['sign', 'sign_', 'abs', 'abs_', 'relu', 'relu_']
for func in funcs:
tensor = get_random_test_tensor(max_value=1e4)
if func != 'sign' and func != 'sign_':
# Make sure we test with some entry, say entry (0, 0), being 0
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(tensor):\n raise NotImplementedError",
"def test_sign(self):\n self.signer.Sign(b'notadb')\n self.assertTrue(True)",
"def test_encrypt_decrypt(self):\n reference = get_random_test_tensor()\n encrypted_tensor = SharedTensor(reference)\n self._check(encrypted_te... | [
"0.7096347",
"0.6326007",
"0.6290986",
"0.62882465",
"0.5925199",
"0.5925199",
"0.59247315",
"0.5827233",
"0.5817118",
"0.57916427",
"0.5778249",
"0.5716295",
"0.56801325",
"0.56043047",
"0.56009686",
"0.5596079",
"0.55898464",
"0.5577058",
"0.55761886",
"0.55273604",
"0.5524... | 0.8093219 | 0 |
Tests exp on encrypted tensor. | def test_exp(self):
funcs = ['exp', 'exp_']
for func in funcs:
tensor = get_random_test_tensor(max_value=2)
encrypted = SharedTensor(tensor)
reference = getattr(tensor, func)()
encrypted_out = getattr(encrypted, func)()
self._check(encrypted_ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_encrypt_decrypt(self):\n reference = get_random_test_tensor()\n encrypted_tensor = SharedTensor(reference)\n self._check(encrypted_tensor, reference, 'en/decryption failed')",
"def test_exp_con():\n c=14\n assert {'diff':EF.exp(c).der, 'value': EF.exp(c).val}=={'diff':0, 'valu... | [
"0.6516908",
"0.6474122",
"0.6175254",
"0.6135996",
"0.5962083",
"0.5877902",
"0.5865091",
"0.58256704",
"0.5778913",
"0.57707447",
"0.5756389",
"0.5727069",
"0.57155305",
"0.5714878",
"0.57032084",
"0.5694749",
"0.5644277",
"0.5640703",
"0.56167555",
"0.5602118",
"0.55616677... | 0.7838138 | 0 |
Return True if we are running with one or more pytestxdist workers. | def using_xdist(request: pytest.FixtureRequest) -> bool:
try:
is_master = request.getfixturevalue("worker_id") == "master"
return not is_master
except pytest.FixtureLookupError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_run_experiment(self, info, device):\n nb_qubit_max = self.backends[device]['nq']\n nb_qubit_needed = info['nq']\n return nb_qubit_needed <= nb_qubit_max, nb_qubit_max, nb_qubit_needed",
"def _workers_available(self) -> bool:\n total_compute_power = sum(self.client.nthreads().v... | [
"0.6262236",
"0.62243485",
"0.6057008",
"0.5990836",
"0.59594816",
"0.59512496",
"0.588686",
"0.58741874",
"0.5846957",
"0.57750195",
"0.5736447",
"0.57130575",
"0.5710858",
"0.5674007",
"0.5662257",
"0.5643198",
"0.5635159",
"0.5613612",
"0.5607256",
"0.56058526",
"0.559298"... | 0.74353105 | 0 |
Create a working directory and initialize an atomic counter and lock for it. | def init_work_dir(
request: pytest.FixtureRequest, base_path: Path, name: Optional[str]
) -> Tuple[Path, Union[FileCounter, NullCounter]]:
target_dir = base_path / name if name else base_path
target_dir.mkdir(exist_ok=True)
counter: Union[FileCounter, NullCounter]
if using_xdist(request):
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_numbered_dir(\n cls, prefix=\"session-\", rootdir=None, keep=3, lock_timeout=172800\n ): # two days\n if rootdir is None:\n rootdir = cls.get_temproot()\n\n nprefix = prefix.lower()\n\n def parse_num(path):\n \"\"\"Parse the number out of a path (if it... | [
"0.61736715",
"0.6094012",
"0.6063878",
"0.60209",
"0.60018677",
"0.59877455",
"0.5961637",
"0.5846552",
"0.58404374",
"0.5817772",
"0.5766177",
"0.57494277",
"0.5711198",
"0.57103443",
"0.5686363",
"0.56651175",
"0.566142",
"0.56561947",
"0.56226295",
"0.56186485",
"0.559998... | 0.62908864 | 0 |
Given the set of testcases, set the header as the first row of the result table and set flags to indicate presence or absence of various table columns. | def set_header(self, testcases):
header = ['iscorrect']
self.column_formats = ['%s']
if any(test.testcode.strip() != '' for test in testcases):
header.append("Test")
self.has_tests = True
# If the test code should be rendered in html then set that as column fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_toTable(self):\r\n # Empty results.\r\n out_f = StringIO()\r\n self.res1.toTable(out_f)\r\n self.assertEqual(out_f.getvalue(),\r\n \"SampleID\\tSize\\tEstimate\\tStd Err\\tCI (lower)\\tCI (upper)\\n\")\r\n out_f.close()\r\n\r\n # Results wi... | [
"0.59947515",
"0.5704192",
"0.56243026",
"0.5583516",
"0.5575619",
"0.5559186",
"0.55128515",
"0.5451721",
"0.54395616",
"0.5435001",
"0.5392784",
"0.538775",
"0.53682804",
"0.53610027",
"0.53144515",
"0.5301008",
"0.527047",
"0.5245722",
"0.52423686",
"0.5234809",
"0.5234799... | 0.7614132 | 0 |
A list of the numbers of columns containing images | def image_column_nums(self):
return sorted(set([key[0] for key in self.images.keys()])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_of_images(self):",
"def num_tiles(self):\n return self.num_row_tiles * self.num_col_tiles",
"def colnum(self):\n \n colnum = 0\n for table in self.columnlabels:\n table = np.asarray(table)\n if np.ndim(table) <= 1:\n table = np.reshape(t... | [
"0.7660739",
"0.6780884",
"0.6766745",
"0.6733176",
"0.67060834",
"0.66756743",
"0.6648425",
"0.66362023",
"0.6626275",
"0.6621816",
"0.66064304",
"0.6580292",
"0.6543522",
"0.65365946",
"0.65293694",
"0.6519015",
"0.6519015",
"0.6519015",
"0.6519015",
"0.6519015",
"0.6498090... | 0.7634472 | 1 |
An ordered list of the column formats. Columns containing images are forced into %h format. Don't have formats for iscorrect and ishidden columns. | def get_column_formats(self):
image_columns = self.image_column_nums()
formats = [self.column_formats[i] if i not in image_columns else '%h' for i in range(len(self.column_formats))]
return formats[1:-2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formats(self):\n if getattr(self, \"_coldefs\", None) is not None:\n return self._coldefs.formats\n\n return None",
"def formats():\n return _FORMATS",
"def format_cols(met,format_columns_sp,format_columns_dp, format_columns_tp):\n emp_list = []\n #format_columns = ['ISO',... | [
"0.7301003",
"0.69014555",
"0.65617144",
"0.65083337",
"0.64049155",
"0.63739306",
"0.6258133",
"0.5964947",
"0.58745754",
"0.58551645",
"0.5844067",
"0.58333963",
"0.5827105",
"0.5784457",
"0.5776174",
"0.5770914",
"0.5738719",
"0.570861",
"0.5695029",
"0.5672281",
"0.567055... | 0.8831168 | 0 |
Return the current result table, with images added to appropriate cells. Columns that contain images anywhere are converted to %h format and existing content in that column is htmlescaped, newlines replaced with and wrapped in a div. | def get_table(self):
result_table = [row[:] for row in self.table] # Clone the result table
# Htmlise all columns containing images
for col_num in self.image_column_nums():
for row_num in range(1, len(result_table)):
result_table[row_num][col_num] = self.htmlise(res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formatted_table(images):\n header = ['CEE (Windows)']\n table = columned_table(header, [images])\n return table",
"def turn_into_image(self):\n if self.title_colours:\n self.table_to_image = TableToImage(self.table.get_string(), self.colour, self.rows, self.titles,\n ... | [
"0.6934602",
"0.66100633",
"0.6520935",
"0.6488986",
"0.6398688",
"0.6270574",
"0.62501365",
"0.6246765",
"0.61214703",
"0.60097426",
"0.6007311",
"0.59835124",
"0.59775484",
"0.5921227",
"0.58958226",
"0.58925456",
"0.586689",
"0.5775405",
"0.57520837",
"0.5716079",
"0.57004... | 0.7697725 | 0 |
Add a result row to the table for the given test and result | def add_row(self, testcase, result, error=''):
is_correct = self.check_correctness(result + error, testcase.expected)
row = [is_correct]
if self.has_tests:
if getattr(testcase, 'test_code_html', None):
row.append(testcase.test_code_html)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_result(self,\n test_name: str,\n model: LinguisticDistributionalModel,\n distance_type: Optional[DistanceType],\n # a dictionary whose keys are the same as the results_column_names\n result: dict,\n ... | [
"0.7088182",
"0.6919971",
"0.6733427",
"0.67328036",
"0.670703",
"0.64889985",
"0.6446518",
"0.6342905",
"0.6293741",
"0.6264235",
"0.61773056",
"0.6158726",
"0.61478585",
"0.61326706",
"0.61200726",
"0.6066257",
"0.60658425",
"0.6060852",
"0.6055732",
"0.6034783",
"0.6025293... | 0.77271634 | 0 |
Convert the given string to html by escaping ''. Wrap the whole lot in a div tag so the diff checker processes the whole table cell, and within that a pre tag for correct laylout. | def htmlise(s):
return '<div><pre class="tablecell">' + html.escape(s) + '</pre></div>' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_str_to_html(string):\n if not string: return \"\"\n lines = string.splitlines()\n for index, line in enumerate(lines):\n for char in line:\n if char == '\\t':\n lines[index] = line.replace(char, \" \", 1)\n elif char == \" \":... | [
"0.71317405",
"0.708477",
"0.69059294",
"0.67269725",
"0.6640507",
"0.66395116",
"0.66350603",
"0.662082",
"0.65906113",
"0.65761566",
"0.6501235",
"0.6443022",
"0.6436428",
"0.642443",
"0.6392169",
"0.6326362",
"0.6294987",
"0.6293086",
"0.62708235",
"0.62156194",
"0.6207217... | 0.73921907 | 0 |
Store the given html_image for later inclusion in the cell at the given row and given column. column_name is the name used for the column in the first (header) row. row_num is the row number (0 origin, not including the header row). | def add_image(self, image_html, column_name, row_num):
column_num = self.table[0].index(column_name)
self.images[column_num, row_num + 1].append(image_html) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCellImage(self, row, column, imagePath, xSize = None, ySize = None, keepAspectRatio = True):\n\n\t\t\t\tcolumn = self.convertColumn(column)\n\n\t\t\t\timage = openpyxl.drawing.image.Image(imagePath, size = (xSize, ySize), nochangeaspect = keepAspectRatio)\n\t\t\t\tself.thing.add_image(image, f\"{column}{row... | [
"0.6137667",
"0.58864224",
"0.56508934",
"0.5608851",
"0.5403624",
"0.5217596",
"0.52046186",
"0.516362",
"0.5146209",
"0.5144296",
"0.5130979",
"0.5034239",
"0.5013486",
"0.50114536",
"0.50081855",
"0.49904764",
"0.49366695",
"0.48959664",
"0.48941982",
"0.48359168",
"0.4799... | 0.7935685 | 0 |
True iff expected matches got with relaxed white space requirements | def check_correctness(self, expected, got):
expected_lines = expected.strip().splitlines()
got_lines = got.strip().splitlines()
if len(got_lines) != len(expected_lines):
return False
else:
for exp, got in zip(expected_lines, got_lines):
if self.par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isValidTest(self):\n if not self.hasError():\n return False\n distance = dameraulevenshtein(self.word, self.error) \n if(distance > 1):\n return False\n regex = '.*[^a-zA-Z].*'\n if re.match(regex, self.word) or re.match(regex, self.error):\n return False\n return True",
"def... | [
"0.6464162",
"0.6410025",
"0.6232845",
"0.6204415",
"0.6173366",
"0.61282504",
"0.60845464",
"0.60727185",
"0.60701454",
"0.6045749",
"0.59901327",
"0.5904471",
"0.5899228",
"0.58241963",
"0.58187723",
"0.5790674",
"0.5777368",
"0.5774938",
"0.5773399",
"0.5772065",
"0.577199... | 0.6547885 | 0 |
Replace nonprinting chars with escape sequences, rightstrip. Limit s to max_len by snipping out bits in the middle. | def sanitise(s, max_len=MAX_STRING_LENGTH):
result = ''
if len(s) > max_len:
s = s[0: max_len // 2] + "\n*** <snip> ***\n" + s[-max_len // 2:]
lines = s.rstrip().splitlines()
for line in lines:
for c in line.rstrip() + '\n':
if c < ' ' and c != '\n':
if c == '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stripEscapes(s):\r\n result = ''\r\n show = 1\r\n i = 0\r\n L = len(s)\r\n while i < L:\r\n if show == 0 and s[i] in ANSI_TERMINATORS:\r\n show = 1\r\n elif show:\r\n n = s.find(ANSI_ESCAPE_BEGIN, i)\r\n if n == -1:\r\n return result ... | [
"0.6786607",
"0.6505607",
"0.63193846",
"0.62063974",
"0.62054354",
"0.6113116",
"0.6063999",
"0.5985852",
"0.5972879",
"0.5971324",
"0.59582806",
"0.59450966",
"0.5943937",
"0.59311616",
"0.5877219",
"0.5802846",
"0.5795996",
"0.57476574",
"0.5725873",
"0.5708619",
"0.569996... | 0.78412265 | 0 |
The pool Nf nodes should be able to process ATTRIB txn. | def test_n_minus_f_pool_processes_attrib(looper, nodeSet,
sdk_pool_handle,
sdk_wallet_steward):
make_pool_n_minus_f_nodes(looper, nodeSet)
sdk_add_raw_attribute(looper, sdk_pool_handle, sdk_wallet_steward, 'foo', 'bar') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_IN_ATTRIB(self, event):",
"def _init_node_attributes(self):\n assert False",
"def _async_update_attrs(self) -> None:\n self._attr_is_on = self.entity_description.is_on(self._lock.state)",
"def Attributes(self) -> PolicyStatementAttribute:",
"def _parse_attributes(self, attributes,... | [
"0.53677404",
"0.52353156",
"0.51709676",
"0.5087179",
"0.50175905",
"0.49855402",
"0.49726537",
"0.4956668",
"0.49476925",
"0.49185666",
"0.49086636",
"0.49046794",
"0.4867071",
"0.4858358",
"0.48316416",
"0.48271203",
"0.48230535",
"0.4820559",
"0.48107904",
"0.4805505",
"0... | 0.62520134 | 0 |
compute MTMC metrics [IDP, IDR, IDF1] | def id_measures(gtDB, trackDB, threshold):
res_ids = np.unique(trackDB[:, 1])
gt_ids = np.unique(gtDB[:, 1])
n_ids_res = len(res_ids)
n_ids_gt = len(gt_ids)
groundtruth = [gtDB[np.where(gtDB[:, 1] == gt_ids[i])[0], :] for i in range(n_ids_gt)]
prediction = [trackDB[np.where(trackDB[:, 1] == re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_bm(all_metrics):\n f_gt, n_gt, n_st = 0, 0, 0\n nbox_gt, nbox_st = 0, 0\n c, g, fp, missed, ids = 0, 0, 0, 0, 0\n IDTP, IDFP, IDFN = 0, 0, 0\n MT, ML, PT, FRA = 0, 0, 0, 0\n overlap_sum = 0\n for i in range(len(all_metrics)):\n nbox_gt += all_metrics[i].idmetrics.nbox_gt\n ... | [
"0.6361967",
"0.56476516",
"0.5639801",
"0.5516103",
"0.5484541",
"0.5480232",
"0.5475617",
"0.54705375",
"0.54360676",
"0.5425147",
"0.54175115",
"0.54091674",
"0.54001456",
"0.5373431",
"0.5356355",
"0.5349291",
"0.5348661",
"0.53458846",
"0.53451896",
"0.5340824",
"0.53401... | 0.5686588 | 1 |
Find the matching position in traj2 regarding to traj1 Assume both trajectories in ascending frame ID | def corresponding_frame(traj1, len1, traj2, len2):
p1, p2 = 0, 0
loc = -1 * np.ones((len1,), dtype=int)
while p1 < len1 and p2 < len2:
if traj1[p1] < traj2[p2]:
loc[p1] = -1
p1 += 1
elif traj1[p1] == traj2[p2]:
loc[p1] = p2
p1 += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_min2(coords1,coords2,tail1=(),tail2=()):\n nc=len(coords1)\n np1=len(coords1[0])\n np2=len(coords2[0])\n a1=array(coords1)\n a2=array(coords2)\n nt1=len(tail1)\n for i in range(nt1): \n if len(tail1[i])!= np1: raise 'Not the same lenght as coordinates 1'\n nt2=len(tail2)\n ... | [
"0.61684275",
"0.61539924",
"0.6088985",
"0.6069346",
"0.60425436",
"0.60239494",
"0.6006196",
"0.599389",
"0.57801074",
"0.5763386",
"0.57415974",
"0.57369167",
"0.5727516",
"0.5723738",
"0.57227707",
"0.5694886",
"0.5691503",
"0.56883794",
"0.56799334",
"0.56635314",
"0.564... | 0.7810299 | 0 |
Can't provide random credentials. | def test_authenticate_random_credentials(self):
self.assertRaises(
TypeError,
self.authenticator.authenticate,
foo='bar'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_expired_credentials():\n pass",
"def test_validate_credentials(self):\n pass",
"def test_init_wrong_scope(self):\n self.assertRaises(errors.Credentials,\n credentials.Credentials, 'priv.json', scope='fake')",
"def set_credentials():",
"def test_missing_cre... | [
"0.67721874",
"0.66579384",
"0.65685",
"0.65538883",
"0.6504491",
"0.64509654",
"0.64410526",
"0.6337978",
"0.6275762",
"0.62665045",
"0.62116826",
"0.62079036",
"0.62079036",
"0.6178428",
"0.6178385",
"0.6173332",
"0.6153074",
"0.61268353",
"0.60907114",
"0.6090696",
"0.6087... | 0.6880421 | 0 |
Failing to authenticate returns None. | def test_failure(self):
result = self.authenticator.authenticate(
username=u'thruflo',
password=u'wrong'
)
self.assertTrue(result is None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return abort(401)",
"def authenticate(self, username, password):\n return None",
"def authenticate():\n\n return Response(\n 'Could not verify your access level for that URL.\\n'\n 'You have to login with proper credentials', 401,\n get_auth_headers())",
"def authe... | [
"0.7916655",
"0.7376408",
"0.73581547",
"0.7302508",
"0.7234355",
"0.7234355",
"0.72101927",
"0.71538955",
"0.7141036",
"0.7095776",
"0.7082149",
"0.7044304",
"0.70170194",
"0.7016944",
"0.7013253",
"0.7013253",
"0.7013253",
"0.7013253",
"0.7013253",
"0.7013253",
"0.7013253",... | 0.7754249 | 1 |
Generation of the cover page with report title | def cover_page(self) -> NoReturn:
self.add_page()
self.set_font_size(30)
self.set_text_color(255, 0, 0)
self.set_y(int(self.h / 2))
self.set_x(self.l_margin + self.r_margin)
self.cell(0, self.line_height, 'Report on Emission Data', align='C',
ln=2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_cover(outfile: TextIO) -> None:\n outfile.write(\" <div id=\\\"cover_page\\\">\\n\")\n for i in range(1, 29):\n outfile.write(\" <img id=\\\"cover_img\" + str(i) + \"\\\" class=\\\"cover_img\\\" \"\n \"src=\\\"media/cover images/cover\" + str(i) + \".jpg\\\" />\\... | [
"0.6414111",
"0.64117116",
"0.6349079",
"0.62681794",
"0.59727424",
"0.5748772",
"0.57169175",
"0.56724197",
"0.56551754",
"0.5648741",
"0.5642634",
"0.56162053",
"0.560357",
"0.5575301",
"0.5563537",
"0.5545428",
"0.55296457",
"0.5528608",
"0.5513624",
"0.55004",
"0.54596156... | 0.6786806 | 0 |
Generation of the grpah page, with the title and graph image. | def graphs(self, title: str, graph_name: str) -> NoReturn:
self.add_page()
self.set_text_color(0, 250, 154)
self.cell(0, 0, title, align='C', ln=2)
self.ln(self.line_height)
img = Image.open(full_path(f'./output/{graph_name}'))
image_width = self.w - (self.l_margin + self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildPage(self):\n args = {}\n args['valueCol'] = 'value'\n args['textCol'] = 'size'\n args['y'] = 'index'\n args['x'] = 'number'\n args['orientation'] = 'h'\n args['title'] = ''\n args['x_title'] = ''\n args['y_title'] = ''\n args['height']... | [
"0.6904698",
"0.6361843",
"0.63040227",
"0.5922409",
"0.58391315",
"0.5834743",
"0.580533",
"0.57897055",
"0.57836205",
"0.57214135",
"0.5713594",
"0.56890815",
"0.56460506",
"0.55964106",
"0.55960745",
"0.5579858",
"0.5579447",
"0.55388254",
"0.5520271",
"0.54888874",
"0.548... | 0.6742358 | 1 |
Setup up Dot Product with various input and test output matches expectation. | def testDotProduct(self):
self._check([0.000, 1.000, 0.000], [ 1023, 1023, 1023 ])
self._check([0.125, 0.750, 0.125], [ 1023, 1023, 1023 ])
self._check([1/32., 1.000, 0.000], [ 1023, 1023, 1023 ])
self._check([1.000, 1.000, 1.000], [ 1023, 1023, 1023 ])
self._check([0, 0, 0], [ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dot_vm(self):\n self.check_dot_vm(dot2, dot3, \"np.dot()\")",
"def test_explode(self):\n prod1 = Product('test prod 1', weight=400, flammability=400.0)\n prod2 = Product(\"not explosive\", weight=1, flammability=exp(-4.0))\n #glove = BoxingGlove(\"adonis creed\")\n sel... | [
"0.5888598",
"0.58780664",
"0.57907444",
"0.577302",
"0.5766741",
"0.5724458",
"0.5688341",
"0.5672532",
"0.5575101",
"0.5515148",
"0.5504169",
"0.5467627",
"0.5462049",
"0.5455404",
"0.5448214",
"0.5404832",
"0.54017067",
"0.5398666",
"0.53925556",
"0.53335553",
"0.53304577"... | 0.6438083 | 0 |
Specifies the name of the contact's spouse/partner | def spouse_name(self, spouse_name: str):
self._spouse_name = spouse_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_name(self, contact_name):\n\n self._contact_name = contact_name",
"def contact_name(self, contact_name):\n\n self._contact_name = contact_name",
"def partner_name(self) -> str:\n return pulumi.get(self, \"partner_name\")",
"def partner_name(self) -> str:\n return pulum... | [
"0.670141",
"0.670141",
"0.65438926",
"0.65438926",
"0.6317162",
"0.6277916",
"0.6114182",
"0.60977316",
"0.59143496",
"0.584714",
"0.56561404",
"0.56525636",
"0.56364244",
"0.5601944",
"0.5590321",
"0.5587381",
"0.5587381",
"0.55662316",
"0.5541739",
"0.5541739",
"0.5541739"... | 0.7163901 | 0 |
Specifies the language that the contact uses | def language(self, language: str):
self._language = language | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_language(self, lang):\n self.lang = lang",
"def do_lang(self, lang):\n\n self.lang = lang\n print(\"Set language to %s\" % lang)",
"def language(self, language: str):\n\n self._language = language",
"def language(self, language):\n\n self._language = language",
"d... | [
"0.7474097",
"0.7078158",
"0.69595575",
"0.69452167",
"0.69452167",
"0.69452167",
"0.69452167",
"0.69452167",
"0.6943131",
"0.6903693",
"0.6723772",
"0.66693807",
"0.6657582",
"0.66056275",
"0.65838045",
"0.6582523",
"0.64349073",
"0.6416251",
"0.6403177",
"0.638861",
"0.6383... | 0.72077227 | 1 |
Specifies the additional notes | def notes(self, notes: str):
self._notes = notes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def add_note():... | [
"0.75165653",
"0.75165653",
"0.75165653",
"0.75165653",
"0.75165653",
"0.7354406",
"0.72749794",
"0.71927285",
"0.6871934",
"0.68421793",
"0.68248117",
"0.67559856",
"0.66753244",
"0.6654455",
"0.66428286",
"0.6635777",
"0.66072553",
"0.65932196",
"0.6562398",
"0.64315027",
"... | 0.7641297 | 0 |
Specifies the hobbies of the contact | def hobbies(self, hobbies: str):
self._hobbies = hobbies | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_hobby(self, hobby, i):\r\n self.__hobbies[i] = hobby",
"def hobby(self, hobby):\n\n self._hobby = hobby",
"def hobbies(self) -> str:\n return self._hobbies",
"def __str__(self):\r\n return list_str_breaks(self.__hobbies)",
"def set_bob(self) -> None:\n self._has_b... | [
"0.6440812",
"0.63694626",
"0.6321166",
"0.5236019",
"0.486461",
"0.4839456",
"0.46629572",
"0.4488214",
"0.4477313",
"0.4456959",
"0.4445599",
"0.44226927",
"0.44058955",
"0.44026157",
"0.4398499",
"0.43877187",
"0.43788406",
"0.43534407",
"0.4327806",
"0.43110254",
"0.42897... | 0.79188406 | 0 |
Specifies the contact's instant messaging address | def instant_messaging_address(self) -> str:
return self._instant_messaging_address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instant_messaging_address(self, instant_messaging_address: str):\n self._instant_messaging_address = instant_messaging_address",
"def set_amf_addr(self, addr: str) -> None:\n self.config[\"amfConfigs\"][0][\"address\"] = addr",
"def set_address(self, address):\n pass",
"def set_addre... | [
"0.74032354",
"0.6208767",
"0.6190206",
"0.61803496",
"0.59629107",
"0.59508747",
"0.592542",
"0.59088",
"0.5861823",
"0.5858329",
"0.5833608",
"0.5831511",
"0.5819879",
"0.5777731",
"0.57768065",
"0.57768065",
"0.57573485",
"0.57559896",
"0.5680085",
"0.5680085",
"0.5680085"... | 0.69372797 | 1 |
Specifies the contact's instant messaging address | def instant_messaging_address(self, instant_messaging_address: str):
self._instant_messaging_address = instant_messaging_address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instant_messaging_address(self) -> str:\n return self._instant_messaging_address",
"def set_amf_addr(self, addr: str) -> None:\n self.config[\"amfConfigs\"][0][\"address\"] = addr",
"def set_address(self, address):\n pass",
"def set_address(self, address):\n if address == \"\"... | [
"0.69372797",
"0.6208767",
"0.6190206",
"0.61803496",
"0.59629107",
"0.59508747",
"0.592542",
"0.59088",
"0.5861823",
"0.5858329",
"0.5833608",
"0.5831511",
"0.5819879",
"0.5777731",
"0.57768065",
"0.57768065",
"0.57573485",
"0.57559896",
"0.5680085",
"0.5680085",
"0.5680085"... | 0.74032354 | 0 |
Specifies an organizational ID number for the contact | def organizational_id_number(self) -> str:
return self._organizational_id_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organizational_id_number(self, organizational_id_number: str):\n self._organizational_id_number = organizational_id_number",
"def organization_id(self) -> str:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self):\n return self._organization_id",
"def organizat... | [
"0.76141155",
"0.6927863",
"0.67673415",
"0.6578775",
"0.6578775",
"0.6540718",
"0.6540718",
"0.6498766",
"0.6498766",
"0.6417101",
"0.63346595",
"0.62886757",
"0.62457144",
"0.621501",
"0.6185612",
"0.61089796",
"0.6100109",
"0.60470307",
"0.6001805",
"0.600148",
"0.59914863... | 0.73283887 | 1 |
Specifies an organizational ID number for the contact | def organizational_id_number(self, organizational_id_number: str):
self._organizational_id_number = organizational_id_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organizational_id_number(self) -> str:\n return self._organizational_id_number",
"def organization_id(self) -> str:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self):\n return self._organization_id",
"def organization_id(self, organization_id):\n\n se... | [
"0.73283887",
"0.6927863",
"0.67673415",
"0.6578775",
"0.6578775",
"0.6540718",
"0.6540718",
"0.6498766",
"0.6498766",
"0.6417101",
"0.63346595",
"0.62886757",
"0.62457144",
"0.621501",
"0.6185612",
"0.61089796",
"0.6100109",
"0.60470307",
"0.6001805",
"0.600148",
"0.59914863... | 0.76141155 | 0 |
Specifies the contact's customer ID number | def customer_id(self, customer_id: str):
self._customer_id = customer_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_customer_id(self, case_obj: Family) -> None:\n self._set_customer_id(case_obj.customer.internal_id)",
"def customer_id(self) -> str:\n return self._customer_id",
"def customer_id(self, customer_id):\n\n self._customer_id = customer_id",
"def customer_id(self, customer_id):\n\n ... | [
"0.7331466",
"0.70457953",
"0.6989",
"0.6989",
"0.6989",
"0.6989",
"0.69785947",
"0.69785947",
"0.6866441",
"0.6475223",
"0.6475223",
"0.6403951",
"0.6387642",
"0.6282466",
"0.6270163",
"0.6173643",
"0.6171024",
"0.6079751",
"0.6079751",
"0.603804",
"0.6007845",
"0.6003525"... | 0.7484628 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.