query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Sentiment module forward function
def forward(self, vec, training = False): if self.dropout: out = self.logsoftmax(self.l1(F.dropout(vec, training = training))) else: out = self.logsoftmax(self.l1(vec)) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_sentiment(self):\r\n\r\n\r\n print(\"Beginning sentiment analysis\")\r\n # textblob time\r\n #tweet_sentiment = [TextBlob(tweet['filtered_text']).sentiment for index, tweet in self.tweet_dataframe.iterrows()]\r\n #self.tweet_dataframe['polarity'] = [i.polarity for i in tweet...
[ "0.6426259", "0.6316986", "0.631381", "0.6263776", "0.6206533", "0.61623794", "0.61538345", "0.61538345", "0.6142153", "0.6090091", "0.6080952", "0.6045462", "0.6017502", "0.6017271", "0.6006004", "0.5997427", "0.59766227", "0.5972965", "0.5962752", "0.59570754", "0.59559005"...
0.0
-1
the first ID from 1999 should always exist
def test_get_cve_id(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}/{cve_id}', headers=reg_user_headers ) ok_response_contains(res, cve_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_first_id(self):\r\n ids = \\\r\n \"R27DLI_4812 R27DLI_600 R27DLI_727 U1PLI_403 U1PLI_8969\".split(\r\n )\r\n self.assertEqual(first_id(ids, {}), 'R27DLI_4812')", "def test_get_first_id(self):\r\n lines = \"\"\">S74_1 E86FECS01CEVAV orig_bc=ACATGTCACGTG new_...
[ "0.7088285", "0.64710146", "0.6314301", "0.60994", "0.6067378", "0.5958204", "0.5878371", "0.5851126", "0.5837657", "0.58209383", "0.5790208", "0.5774725", "0.5746272", "0.57414085", "0.5736358", "0.57287204", "0.57021135", "0.57021135", "0.5698367", "0.5693931", "0.5688653",...
0.0
-1
unauthenticated users can't get full information about IDs
def test_get_cve_id_bad_org_header(reg_user_headers): uid = str(uuid.uuid4()) tmp = copy.deepcopy(reg_user_headers) tmp['CVE-API-ORG'] = uid tmp['CVE-API-USER'] = uid res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}/{cve_id}', headers=tmp ) assert res.status_code == 200 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_id_identities_get(self):\n pass", "def test_user_id_get(self):\n pass", "def getIDs():", "def getUserIds(self):\n raise BorkedGetUserIds", "def get_id(self): \n\t\treturn (self.user_id)", "def get_id_users(self):\n return self.execute(TABELLE['id_users']['select'...
[ "0.7316585", "0.67288077", "0.659847", "0.6421961", "0.64209867", "0.6371666", "0.62216234", "0.62147516", "0.6213287", "0.6206303", "0.618542", "0.61826223", "0.6156035", "0.61465263", "0.6134009", "0.6125052", "0.61215866", "0.6115197", "0.6093895", "0.6083895", "0.6075531"...
0.0
-1
the id parameter must be a string
def test_get_cve_id_id(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}/{cve_id}', headers=reg_user_headers ) assert isinstance (cve_id, str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self, *args, **kwargs) -> Any:\n pass", "def get(self, _id):", "def __init__(self, id: str):\n self.id = id", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args)...
[ "0.76560944", "0.7627602", "0.75842464", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.7416983", "0.73131484", "0.7311683", "0.7311683", "0.7311683", "0.7311683", "0.72077703",...
0.0
-1
org users can update own information
def test_post_cve_id_update_parameters(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '10', 'batch_type': 'sequential', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_user():", "def update_user():\n #TODO user update \n pass", "def update(self, user: U) -> None:\n ...", "def home_edituser():\n\tpass", "def update_user(id):\n pass", "def testUpdateAccessAllowed(self):\n for user in (self.contributor, self.delegate, self.owner, self.roo...
[ "0.76065016", "0.7539096", "0.7087189", "0.66907394", "0.66773206", "0.66604584", "0.6412654", "0.6342757", "0.6323371", "0.6305936", "0.62408584", "0.62351125", "0.6233493", "0.62263346", "0.62000376", "0.6190823", "0.61851096", "0.61774594", "0.61385065", "0.61379594", "0.6...
0.0
-1
batch type is the only optional parameter for reserving ids
def test_post_cve_id_no_params(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers ) assert res.status_code == 400 response_contains(res, 'amount') response_contains(res, 'cve_year') response_contains(res, 'short_name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate_batch(self, inputs):\n return inputs", "def is_batch():\n\n pass", "def instantiate_batch(self, inputs):\n _ = inputs\n raise NotImplementedError(\n 'LoomOp needs a definition for instantiate_batch.')", "def batch(data, batch_type=\"static\", batch_size=16, max_frames_in_ba...
[ "0.620192", "0.6078552", "0.5926326", "0.575632", "0.57218003", "0.5705383", "0.57025623", "0.56738985", "0.5569064", "0.55206966", "0.5487136", "0.54771787", "0.54666287", "0.5466322", "0.5463773", "0.5463626", "0.5457613", "0.54541177", "0.54437494", "0.5442572", "0.5442572...
0.0
-1
cve services doesn't accept id reservation with blank parameters
def test_post_cve_id_empty_params(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '', 'batch_type': '', 'cve_year': '', 'short_name': '' } ) # NOTE: there i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cve_id_empty_parameters(reg_user_headers):\n res = requests.get(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'page': ' ',\n 'state': ' ',\n 'cve_id_year': ' ',\n 'time_reserved.lt': ' ',\n ...
[ "0.61553484", "0.58308715", "0.573636", "0.566231", "0.5647734", "0.56073105", "0.55616593", "0.5545219", "0.54743046", "0.54703945", "0.54675317", "0.5464173", "0.5453533", "0.5425584", "0.53871393", "0.53465134", "0.53299", "0.5293856", "0.52780175", "0.52433264", "0.521291...
0.583669
1
reg_user_headers cannot post for 'mitre' org
def test_post_cve_id_wrong_header(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '10', 'batch_type': 'sequential', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': 'mitr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_headers():\n # the actual access token -\n g.x_tapis_token = request.headers.get('X-Tapis-Token')\n\n # the tenant associated with the subject of the request; used, for instance, when the subject is different\n # from the subject in the actual access_token (for example, when the access_token re...
[ "0.6172347", "0.5913672", "0.58570987", "0.5665602", "0.56624866", "0.56378", "0.5583079", "0.55241895", "0.5515951", "0.54737747", "0.5450771", "0.5438605", "0.5401117", "0.54006624", "0.5383342", "0.53809106", "0.53769517", "0.5355783", "0.5343951", "0.53330714", "0.5323301...
0.51243687
33
cve services rejects empty year
def test_post_cve_id_empty_year(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '10', 'batch_type': 'sequential', 'cve_year': '', 'short_name': 'mitre' } ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_cve_id_bad_year(reg_user_headers):\n res = requests.post(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'amount': '10',\n 'batch_type': 'sequential',\n 'cve_year': '20111',\n 'short_name': 'mitre'\n ...
[ "0.6313151", "0.6143077", "0.6127024", "0.60904646", "0.60735536", "0.58609223", "0.58071655", "0.5775344", "0.57210094", "0.5700775", "0.5646941", "0.5644524", "0.5628136", "0.5607409", "0.5587389", "0.5573917", "0.5566914", "0.55656594", "0.55643725", "0.555612", "0.5514439...
0.6794595
0
bulk download user should not be a CNA so can't reserve ids
def test_get_cve_id_bulk_download_user(bulk_download_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=bulk_download_user_headers, params={ 'amount': '1', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': bulk_download_user_he...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NSK129_user_ids():\n return [\n707057500045751944,\n707057500045752170,\n707057500045752255,\n707057500045752231,\n707057500045752217,\n707057500045752194,\n707057500045752156,\n707057500045752132,\n707057500045752118,\n707057500045752088,\n707057500045752064,\n707057500045752057,\n707057500045752033,\n7070...
[ "0.58862513", "0.5735354", "0.5705536", "0.56432605", "0.5610844", "0.5497258", "0.5476385", "0.5470781", "0.54458916", "0.5398383", "0.53948796", "0.53903925", "0.53885984", "0.53872275", "0.5369535", "0.5365663", "0.53542453", "0.5341866", "0.53160834", "0.5290616", "0.5284...
0.68713385
0
cve services rejects year that isn't a 4 digit number
def test_post_cve_id_bad_year(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '10', 'batch_type': 'sequential', 'cve_year': '20111', 'short_name': 'mitre' } ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cve_id_year_format_with_digits(reg_user_headers):\n res = requests.get(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'cve_id_year': '20111',\n }\n )\n assert res.status_code == 400\n response_contains_json(res, 'error'...
[ "0.7325939", "0.71417135", "0.6948594", "0.6882464", "0.68685347", "0.6862119", "0.6835641", "0.6804949", "0.6762876", "0.67234796", "0.6682335", "0.66758084", "0.6662942", "0.6632925", "0.66314346", "0.6624864", "0.6588926", "0.65760773", "0.65724236", "0.6571841", "0.656731...
0.6614464
16
cve services rejects empty amount
def test_post_cve_id_empty_amount(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '', 'batch_type': 'sequential', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': 'mitre'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_cve_id_bad_amount(reg_user_headers):\n res = get_reserve_cve_ids('a', utils.CURRENT_YEAR, reg_user_headers['CVE-API-USER'])\n assert res.status_code == 400\n assert res.reason == 'Bad Request'\n response_contains_json(res, 'error', 'BAD_INPUT')\n assert_contains(res, 'amount')", "def...
[ "0.653086", "0.62721187", "0.5955064", "0.59161574", "0.59132206", "0.57916385", "0.5741534", "0.5699919", "0.569672", "0.5678238", "0.5673891", "0.5644661", "0.5555724", "0.55537736", "0.5542234", "0.55271494", "0.54556924", "0.5434752", "0.5424136", "0.5397019", "0.5380233"...
0.6919644
0
cve services rejects amount less than or equal to 0
def test_post_cve_id_invalid_amount(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '-1', 'batch_type': 'sequential', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': reg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_cve_id_bad_amount(reg_user_headers):\n res = get_reserve_cve_ids('a', utils.CURRENT_YEAR, reg_user_headers['CVE-API-USER'])\n assert res.status_code == 400\n assert res.reason == 'Bad Request'\n response_contains_json(res, 'error', 'BAD_INPUT')\n assert_contains(res, 'amount')", "def...
[ "0.6360491", "0.611909", "0.6005989", "0.58923316", "0.58782834", "0.57782614", "0.57418144", "0.5704172", "0.5667392", "0.55872136", "0.5577535", "0.5539598", "0.55343425", "0.54992557", "0.54754955", "0.5465203", "0.54476887", "0.5438703", "0.54337156", "0.5433273", "0.5429...
0.5951793
3
cve services rejects not having a batch type
def test_post_cve_id_no_batch_type(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '10', 'batch_type': '', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': reg_user_heade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_cve_id_invalid_batch_type(reg_user_headers):\n res = requests.post(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'amount': '10',\n 'batch_type': '---',\n 'cve_year': f'{utils.CURRENT_YEAR}',\n 'short_...
[ "0.59317034", "0.54606634", "0.5347346", "0.5305016", "0.5238327", "0.5208267", "0.51238453", "0.51060337", "0.50457895", "0.50359416", "0.49542272", "0.49313167", "0.4925144", "0.49151918", "0.48936203", "0.48852006", "0.48664358", "0.48178315", "0.48169056", "0.48044324", "...
0.59035945
1
cve services rejects batch types that aren't 'sequential' or 'nonsequential'
def test_post_cve_id_invalid_batch_type(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '10', 'batch_type': '---', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': reg_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_cve_id_no_batch_type(reg_user_headers):\n res = requests.post(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'amount': '10',\n 'batch_type': '',\n 'cve_year': f'{utils.CURRENT_YEAR}',\n 'short_name': r...
[ "0.58494323", "0.5699419", "0.56590396", "0.5447683", "0.5235617", "0.51089853", "0.5033172", "0.49491057", "0.49415886", "0.49031293", "0.4901575", "0.49012297", "0.4887945", "0.48630536", "0.4860203", "0.4859041", "0.4856981", "0.4837587", "0.4836359", "0.48355365", "0.4825...
0.625506
0
api rejects nonnumeric amount when requesting IDs
def test_post_cve_id_bad_amount(reg_user_headers): res = get_reserve_cve_ids('a', utils.CURRENT_YEAR, reg_user_headers['CVE-API-USER']) assert res.status_code == 400 assert res.reason == 'Bad Request' response_contains_json(res, 'error', 'BAD_INPUT') assert_contains(res, 'amount')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_details_nonnum_id(self):\n self.check_response(\n '/attributes/xyz',\n ('Please enter an integer value for Attribute ID',))", "def test_post_cve_id_invalid_amount(reg_user_headers):\n res = requests.post(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_us...
[ "0.5972634", "0.58182454", "0.57866687", "0.57143825", "0.56861025", "0.5576269", "0.55707586", "0.5519899", "0.54803365", "0.54670215", "0.54645705", "0.54422504", "0.5417482", "0.54086465", "0.53886473", "0.53857684", "0.53546566", "0.5326676", "0.53108746", "0.5281189", "0...
0.6417517
0
priority ids can be reserved on behalf of the general user org
def test_post_cve_id_reserve_priority(reg_user_headers): res = requests.post( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'amount': '1', 'cve_year': f'{utils.CURRENT_YEAR}', 'short_name': reg_user_headers['CVE-API-ORG'] } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_priority(self):\n self.assertEqual(UserIdHook.priority, priority.AUTH)", "def getPriority(self):", "def getPriorityList(self):", "def set_normal_priority(self, cr, uid, ids, context=None):\n return self.set_priority(cr, uid, ids, '3')", "def priority(self):\n pass # pragma: n...
[ "0.60231215", "0.57526404", "0.5749479", "0.5691362", "0.5494412", "0.5494412", "0.5437413", "0.5436863", "0.54265106", "0.5387683", "0.5371276", "0.5330336", "0.5297356", "0.5265151", "0.5230199", "0.5230199", "0.5230199", "0.5230199", "0.5209371", "0.51991934", "0.51988536"...
0.54266983
8
sequential ids can be reserved on behalf of the mitre org
def test_post_cve_id_reservation(batch_type, amount, reg_user_headers): res = get_reserve_cve_ids(amount, utils.CURRENT_YEAR, reg_user_headers['CVE-API-ORG'], batch_type) ok_response_contains(res, f'CVE-{utils.CURRENT_YEAR}-') assert json.loads(res.content.decode())['cve_ids'] assert len(json.loads(res....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_identity(self) -> OrganisationId:\n ...", "def next_identity(self) -> PublicationId:\n ...", "def new_id(self):\n self.next += 1\n return self.next", "def getID():", "def getIDs():", "def test_post_cve_id_reserve_nonsequential_over_limit(reg_user_headers):\n res = get_rese...
[ "0.66211927", "0.63096344", "0.6253805", "0.6164127", "0.61354417", "0.6101703", "0.6076065", "0.60546607", "0.6034217", "0.59827703", "0.5974946", "0.59362704", "0.5935875", "0.5897026", "0.58955956", "0.5877061", "0.58733565", "0.58589154", "0.5828302", "0.5784769", "0.5774...
0.0
-1
the services api enforces a max quota of 100,000
def test_post_cve_id_reserve_sequential_over_quota(reg_user_headers): res = get_reserve_cve_ids(100001, utils.CURRENT_YEAR, reg_user_headers['CVE-API-ORG']) assert res.status_code == 403 response_contains_json(res, 'error', 'EXCEEDED_ID_QUOTA')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_quota():\n # Create the required data dictionary for Quota/Status\n api_data = {} # type: Dict[str, str]\n response = http_request(endpoint=API_QUOTA, data=api_data)\n\n if response.get('errorNo') != 0:\n return_error('API Returned, {}:{}'.format(response.get('errorNo'), response.get('...
[ "0.72457856", "0.6541689", "0.6496974", "0.6474122", "0.64361095", "0.6393663", "0.6295374", "0.62406343", "0.62023115", "0.61947495", "0.6192351", "0.61151093", "0.6046293", "0.60001254", "0.5982207", "0.5900475", "0.58583516", "0.5853473", "0.5826973", "0.5823149", "0.58192...
0.0
-1
the services api enforces a max nonsequential limit of 10
def test_post_cve_id_reserve_nonsequential_over_limit(reg_user_headers): res = get_reserve_cve_ids(11, utils.CURRENT_YEAR, reg_user_headers['CVE-API-ORG'], 'nonsequential') assert res.status_code == 403 response_contains_json(res, 'error', 'OVER_NONSEQUENTIAL_MAX_AMOUNT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exceed_limit_request(self):\n actions.login(ADMIN_EMAIL)\n ids_list = list(range(SkillAggregateRestHandler.MAX_REQUEST_SIZE))\n get_url = '%s?%s' % (self.URL, urllib.urlencode({\n 'ids': ids_list}, True))\n\n response = transforms.loads(self.get(get_url).body)\n ...
[ "0.65852773", "0.6520471", "0.63269025", "0.6082659", "0.59556395", "0.5954305", "0.5910449", "0.5846189", "0.58163947", "0.580862", "0.5794993", "0.5748793", "0.5740031", "0.57182795", "0.57025313", "0.5619837", "0.56094044", "0.5550615", "0.5540406", "0.5538336", "0.5536613...
0.5607715
17
we can get ids immediately after reserving them using the time they're reserved (noting that this may not work against a shared integration environment, we check that at least this many have been reserved)
def test_get_cve_id_by_time_reserved(reg_user_headers): n_ids = 10 time.sleep(1) t_before = get_now_timestamp() time.sleep(1) res_ids = get_reserve_cve_ids(n_ids, utils.CURRENT_YEAR, reg_user_headers['CVE-API-ORG']) time.sleep(1) t_after = get_now_timestamp() res_get_ids = requests.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReserveIds(self, request, global_params=None):\n config = self.GetMethodConfig('ReserveIds')\n return self._RunMethod(\n config, request, global_params=global_params)", "def AllocateIds(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def getIDs():"...
[ "0.6781136", "0.66229504", "0.66153526", "0.6419672", "0.6226388", "0.6134424", "0.61175394", "0.605653", "0.6043901", "0.60392207", "0.60173976", "0.59599423", "0.59259146", "0.5866394", "0.58563846", "0.580518", "0.5782845", "0.5740038", "0.571097", "0.56960756", "0.5666711...
0.63052136
4
we can get ids immediately after reserving them using the time they're reserved (noting that this may not work against a shared integration environment, we check that at least this many have been reserved)
def test_get_cve_id_by_time_modified(reg_user_headers): n_ids = 10 time.sleep(1) t_before = get_now_timestamp() time.sleep(1) res_ids = get_reserve_cve_ids(n_ids, utils.CURRENT_YEAR, reg_user_headers['CVE-API-ORG']) time.sleep(1) t_after = get_now_timestamp() res_get_ids = requests.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReserveIds(self, request, global_params=None):\n config = self.GetMethodConfig('ReserveIds')\n return self._RunMethod(\n config, request, global_params=global_params)", "def AllocateIds(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def getIDs():"...
[ "0.6780814", "0.66223234", "0.66155624", "0.64196247", "0.63053685", "0.62260455", "0.613415", "0.61171174", "0.6056178", "0.60432154", "0.603923", "0.6016525", "0.5960478", "0.5926661", "0.5866722", "0.58551824", "0.58061886", "0.5783054", "0.5740248", "0.5710705", "0.569540...
0.0
-1
org user can retrieve ids
def test_get_cve_id_with_params(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'page': 1, 'state': 'PUBLISHED', 'cve_id_year': 2011 } ) assert res.status_code == 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_id_identities_get(self):\n pass", "def user_ids(self):\r\n raise NotImplementedError", "def getUserIds(self):\n raise BorkedGetUserIds", "def getInterestedUsers():", "def get_id_users(self):\n return self.execute(TABELLE['id_users']['select']['all'])", "def getID...
[ "0.72742236", "0.7113426", "0.69859695", "0.68559736", "0.6748318", "0.6734738", "0.66231877", "0.6608751", "0.6369346", "0.636064", "0.63404447", "0.62787783", "0.62327987", "0.61808455", "0.6162478", "0.6126701", "0.6066175", "0.6033917", "0.60191303", "0.6018655", "0.60166...
0.0
-1
cannot get id with empty parameters
def test_get_cve_id_empty_parameters(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'page': ' ', 'state': ' ', 'cve_id_year': ' ', 'time_reserved.lt': ' ', 'time_reserved...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def _get_id(key):\n id = reques...
[ "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.7320569", "0.6974481", "0.69206655", "0.6858404", "0.6776071", "0.6651017", "0.6584284", "0.65360487", "0.6476524", "0.645016", ...
0.0
-1
page must be an integer'
def test_get_cve_id_page_format_number(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'page': 'test', } ) assert res.status_code == 400 response_contains_json(res, 'error', 'BAD_INPUT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page(self, num):\n return num + 10", "def get_page_arg() -> int:\n page = request.args.get('page', '1')\n try:\n page = int(page)\n except ValueError:\n page = 1\n return page", "def access_page(self, page_number):\n pass", "def get_page(data):\n try:\n ...
[ "0.72942066", "0.7255621", "0.70951617", "0.7084217", "0.69198793", "0.6883078", "0.68631285", "0.66765064", "0.6582172", "0.65000105", "0.6479773", "0.64404786", "0.6272016", "0.6267252", "0.6241071", "0.61810404", "0.6149198", "0.6130814", "0.6092832", "0.60616213", "0.5963...
0.5665793
49
page must be greater than or equal to 1'
def test_get_cve_id_page_limit(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'page': '-1', } ) assert res.status_code == 400 response_contains_json(res, 'error', 'BAD_INPUT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_page_number(self, page_number):\n try:\n page_number = int(page_number)\n except ValueError:\n raise PageNotAnInteger('That page number is not an integer')\n if page_number < 1:\n raise EmptyPage('That page number is less than 1')\n if page_...
[ "0.68724334", "0.67795455", "0.6575791", "0.6404563", "0.6392881", "0.6365751", "0.6325652", "0.6285816", "0.6275277", "0.6239366", "0.6166517", "0.6119553", "0.6100605", "0.6086404", "0.6025112", "0.59399664", "0.5886595", "0.58713305", "0.5866949", "0.58475083", "0.58428866...
0.5324134
82
state parameter can only be 'REJECTED', 'PUBLISHED' or 'RESERVED'
def test_get_cve_id_state_in_choices(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'state': 'TEST', } ) assert res.status_code == 400 response_contains_json(res, 'error', 'BAD_INPUT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self, state):\n allowed_values = [\"New\", \"StartSent\", \"StartSentFailure\", \"StartSuccess\", \"StartFailure\", \"UpdateSentFailure\", \"UpdateSent\", \"DeleteSentFailure\", \"DeleteInProgress\", \"DeleteFailure\", \"DeleteSuccess\"]\n if state not in allowed_values:\n raise ...
[ "0.6176275", "0.6131376", "0.6055712", "0.5957187", "0.59544176", "0.59054977", "0.58795524", "0.57650197", "0.56667703", "0.5662892", "0.56489974", "0.5598072", "0.55912334", "0.5574002", "0.5551734", "0.5543479", "0.5529127", "0.5524667", "0.55142933", "0.5511482", "0.54829...
0.0
-1
cve_id_year format cannot have letters
def test_get_cve_id_year_format_with_letters(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'cve_id_year': 'test', } ) assert res.status_code == 400 response_contains_json(res, 'error', 'BAD_INPUT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cve_id_year_format_with_digits(reg_user_headers):\n res = requests.get(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'cve_id_year': '20111',\n }\n )\n assert res.status_code == 400\n response_contains_json(res, 'error'...
[ "0.7290299", "0.68064517", "0.6639915", "0.6629726", "0.65061045", "0.6400136", "0.6279429", "0.62579036", "0.6201554", "0.6189587", "0.6148076", "0.61450696", "0.6132923", "0.6132025", "0.61171603", "0.6104892", "0.6042868", "0.60263044", "0.6016714", "0.601461", "0.60107243...
0.72332454
1
cve_id_year format must be 4 digits only
def test_get_cve_id_year_format_with_digits(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'cve_id_year': '20111', } ) assert res.status_code == 400 response_contains_json(res, 'error', 'BAD_INPUT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cve_id_year_format_with_letters(reg_user_headers):\n res = requests.get(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'cve_id_year': 'test',\n }\n )\n assert res.status_code == 400\n response_contains_json(res, 'error'...
[ "0.6879809", "0.6652131", "0.6589121", "0.65639925", "0.65207195", "0.640766", "0.64061123", "0.63677484", "0.6340106", "0.6324387", "0.631996", "0.6299573", "0.6240616", "0.6234675", "0.6224217", "0.61875993", "0.61271626", "0.60666287", "0.6056316", "0.60426563", "0.6026599...
0.7553173
0
CVE ID filter endpoint does not return any IDs with state 'AVAILABLE'
def test_get_cve_id_available_state(reg_user_headers): res = requests.get( f'{env.AWG_BASE_URL}{CVE_ID_URL}', headers=reg_user_headers, params={ 'page': 1, 'state': 'PUBLISHED', 'cve_id_year': 2011 } ) assert res.status_code == 200 asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cve_id_empty_parameters(reg_user_headers):\n res = requests.get(\n f'{env.AWG_BASE_URL}{CVE_ID_URL}',\n headers=reg_user_headers,\n params={\n 'page': ' ',\n 'state': ' ',\n 'cve_id_year': ' ',\n 'time_reserved.lt': ' ',\n ...
[ "0.60389936", "0.5929574", "0.58426833", "0.5815951", "0.570661", "0.5682153", "0.5544171", "0.54931444", "0.5453357", "0.5426285", "0.5375902", "0.5353277", "0.53115815", "0.5262179", "0.52360713", "0.5179641", "0.51218987", "0.51197237", "0.51189655", "0.50833505", "0.50806...
0.6503651
0
Returns how many items are currently held in the stack
def __len__(self): return self._size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n return self.N # Number of items in the stack", "def size(self): #returns the size or number of items in the stack\n if self.is_empty():\n return 0\n else:\n return self.num_items", "def size(self):\n return len(self._stack_items...
[ "0.8463215", "0.8247272", "0.8208759", "0.7955895", "0.7887319", "0.7887319", "0.78505945", "0.78081095", "0.7623325", "0.74243367", "0.74243367", "0.73424596", "0.73139846", "0.7303499", "0.7220582", "0.7211484", "0.71613765", "0.71384513", "0.7075491", "0.7070831", "0.70675...
0.0
-1
Returns the capacity of the stack
def capacity(self): return self._capacity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capacity(self):\n return self._cap", "def capacity(self):\n return self._capacity", "def size(self) -> int:\n return len(self.stack)", "def size(self):\n return len(self.stack)", "def size(self):\n return len(self.__stack)", "def size(self):\n return len(...
[ "0.7462714", "0.74571216", "0.74546", "0.7357611", "0.7292455", "0.7292455", "0.7283221", "0.72271335", "0.7219159", "0.72018915", "0.7150927", "0.70750976", "0.69642293", "0.69642293", "0.69642293", "0.69642293", "0.6958376", "0.6918588", "0.6907446", "0.6886556", "0.6886556...
0.74791604
0
Push a new value at the top of the stack
def push(self, value): if len(self)>= self.capacity(): raise ValueError("Stack capacity has been reached") self._head_pos +=1 self._data[self._head_pos] = value self._size += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(value):\n _get_stack().append(value)\n return value", "def stack_push(self, value):\n self.stack.append(value)", "def push(self, val):\n self._stack.push(val)", "def push(self, val):\n self._stack.push(val)", "def push(stack,number):\n stack.append(number)", "def pu...
[ "0.87266916", "0.8457053", "0.8216962", "0.8216962", "0.7929966", "0.7875772", "0.7875772", "0.7808286", "0.7808286", "0.7808286", "0.780612", "0.77987015", "0.7753277", "0.77151126", "0.7651747", "0.762848", "0.7595179", "0.7592026", "0.7587173", "0.75634444", "0.7550379", ...
0.72400415
43
Pop the top of the stack
def pop(self): if self.empty(): raise ValueError("Empty Stack") data = self._data[self._head_pos] self._data[self._head_pos] = None self._head_pos -= 1 self._size -= 1 return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop():\n stack = _get_stack()\n return _pop(stack)", "def pop(self):\n if not self.isEmpty():\n self.top -= 1\n return self.stack.pop()\n else:\n raise Exception(\"Stack Underflow\")", "def pop(stack):\n item = top(stack)\n stack.top = stack.top.ne...
[ "0.8520551", "0.83142734", "0.82947034", "0.8183635", "0.81185114", "0.80919856", "0.8073228", "0.8025369", "0.8021493", "0.80164456", "0.8005645", "0.8002933", "0.79993117", "0.79921395", "0.7989008", "0.7974085", "0.79444706", "0.79217684", "0.7914295", "0.7904163", "0.7896...
0.7206383
73
Select the weight function
def window_func(method='hamming'): assert type(method) == str, 'method must be a string' if method == 'hamming': return _weight_hamming elif method == 'hann': return _weight_hann elif method == 'blackman': return _weight_blackman elif method == 'triangular': retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(self):", "def _create_weight_func(G, weight):\n\n def weight_func(u, v):\n edge = G[u][v]\n\n if G.is_multigraph():\n return min(att.get(weight, 1) for att in edge.values())\n\n return edge.get(weight, 1)\n\n return weight_func", "def select(weights):\n r = r...
[ "0.7193525", "0.663707", "0.66011775", "0.657812", "0.657812", "0.6494727", "0.64417845", "0.638619", "0.638619", "0.638619", "0.638619", "0.638619", "0.638619", "0.638619", "0.638619", "0.63677955", "0.6302994", "0.6295462", "0.62838084", "0.6233081", "0.62268186", "0.6223...
0.6393914
7
Hamming weight w = 0.54 0.46cos(2pin/(N1)) where n is the element index of a total N elements. or w = 0.54 + 0.46cos(2pir/l), where r is the distance to the center of the window, and l is the total width of the filter window.
def _weight_hamming(r, l): w = 0.54 + 0.46*np.cos(2*pi*r/l) w[np.absolute(r)>l/2.]=0 return w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def windowing(input):\n N, M = np.shape(input)\n\n window = signal.hamming(M, sym=0)\n\n window_axis = lambda sample: sample * window\n\n output = np.apply_along_axis(window_axis, 1, input)\n\n # myplot(output, 'Hamming Window')\n\n return output", "def make_hamming(N):\n return map(lambda x...
[ "0.6837442", "0.65596735", "0.6552758", "0.6512625", "0.6077814", "0.605841", "0.5993005", "0.57823837", "0.5748788", "0.5671822", "0.566978", "0.56511", "0.56271595", "0.5613923", "0.5583017", "0.55617875", "0.55501837", "0.5534077", "0.5513793", "0.54881024", "0.54877645", ...
0.71120054
0
using values from wikipedia 'exact blackman'
def _weight_blackman(r,l): w = 0.42 + 0.5*np.cos(2*pi*r/l) + 0.08*np.cos(4*pi*r/l) # fase lag-> sign change w[np.absolute(r)>l/2.]=0 return w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substantiate():", "def med_in_english(word):\r\n\treturn int(med(TextBlob(word).correct(), word))", "def med_in_hindi(word):\r\n\treturn int(med(correction(word),word))", "def abw(og, fg):\n\n oe = sg2plato(og)\n re = real_extract(og, fg)\n return (oe - re) / (2.0665 - 0.010665 * oe)", "def te...
[ "0.5924522", "0.58038145", "0.5717298", "0.5541843", "0.55333203", "0.55237454", "0.5522544", "0.5512436", "0.55012935", "0.5500108", "0.54784954", "0.54728377", "0.54658407", "0.54618037", "0.53966427", "0.5384012", "0.53421545", "0.52895534", "0.5272849", "0.52247196", "0.5...
0.0
-1
Returns a 4 digit block nearest the right of the string title. OR Returns None. EG. Starwars (1977) year is 1997 2001 A space odyssey 1968 year is 1968 2010 NO year 1985. NO year 75 NO year
def find_year(title): # find all patterns that match the year pattern matches = year_pattern.findall(title) # if any matches if matches: # record for convienence year = matches[-1] too_short = len(title) < 8 # If the year is the title then return None if year == t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_year(string): \n return int(string[11:15])", "def findYear(str):\n return int(re.search(\"(?<=yr=)\\d*\", str)[0])", "def get_year_from_movielist_title(title):\n match = re.match(r'.*\\s+\\((\\d+)\\)', title)\n year = int(match.groups()[0])\n return year", "def search_ye...
[ "0.58915716", "0.58567333", "0.56649774", "0.56625235", "0.5659744", "0.56596863", "0.56417406", "0.5590322", "0.55717194", "0.5556086", "0.55372804", "0.55324984", "0.5495838", "0.5452335", "0.5448456", "0.5435247", "0.5400344", "0.5391075", "0.53525335", "0.530363", "0.5269...
0.72216535
0
Returns a dictionary of decades > number of movies released.
def rank_decades(movies): results = {} for movie in movies: year = find_year(movie) # If we found a release year then count it if year: # A way to map year to decade decade = "{0}0s".format(year[:3]) else: decade = "None" results[decad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mostMoviesPerDecades (movies):\n movieDecades = {}\n for (title,year) in movies:\n key = year[:3]\n movieDecades[key] = movieDecades.get(key, 0) + 1\n return sorted([ (count, decade+'0s') for (decade,count) in movieDecades.items() ], reverse=True)\n # OR:\n # decades = [ k[1][:3]+'...
[ "0.7007399", "0.6177839", "0.58240515", "0.58192813", "0.5802243", "0.5785403", "0.5764", "0.57110053", "0.5679944", "0.56325126", "0.56231296", "0.5615995", "0.5595944", "0.5464355", "0.5454769", "0.5368347", "0.5368315", "0.53631794", "0.5360716", "0.529787", "0.5292788", ...
0.7228442
0
Pipeline(memory=None, steps=[('tfidfvectorizer', TfidfVectorizer(analyzer='word', binary=False, decode_error='strict', dtype=, encoding='utf8', input='content', lowercase=True, max_df=0.8, max_features=None, min_df=2, ngram_range=(1, 4), norm='l2', preprocessor=None, smooth...penalty='l2', random_state=None, solver='wa...
def do_gridsearch(): df = read_df() X = df['review'] y = df['sentiment'] X_train, X_holdout, y_train, y_holdout = train_test_split(X, y, test_size=0.3, shuffle=True, stratify=y, random_state=222 ) tfidf = TfidfVectorizer(stop_words='english', max_df=0.8) stem_pipeline = make_pipeline(TextNormal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_own_pipeline() -> Pipeline:\n clf = svm.LinearSVC(C=2, loss='hinge')\n vect = TfidfVectorizer(ngram_range=(1, 2))\n\n pipeline = None\n ##### Write code here #######\n pipeline = Pipeline([\n ('vect', vect),\n ('tfidf', TfidfTransformer()),\n ('clf', clf)\n ])\n ...
[ "0.6975826", "0.6789501", "0.6725526", "0.62977254", "0.6239499", "0.6235239", "0.61340624", "0.61331767", "0.60290724", "0.60272926", "0.6016024", "0.59683824", "0.58748174", "0.5874547", "0.58424956", "0.5838253", "0.58332974", "0.5811651", "0.5795148", "0.57756644", "0.576...
0.0
-1
MultinomialNB = 0.878 LogisticRegression(C=100) = 0.9029 SVC(kernel='linear', C=1) = DNF LogisticRegression(C=100) w/ Stemming = 0.89 LogisticRegression(C=100) w/o TextNormalizer 0.90
def do_crossval(): df = read_df() # X = df['review'].apply(remove_html_lower) X = df['review'] y = df['sentiment'] X_train, X_holdout, y_train, y_holdout = train_test_split(X, y, test_size=0.3, shuffle=True, stratify=y, random_state=222 ) tfidf = TfidfVectorizer(stop_words='english', min_df=2,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, reg_penalty='l2', reg_inv=1.0, k_fold=5, random_state=0):\n print(\"Initialize model Logistic Regression\")\n self.reg_penalty = reg_penalty\n self.reg_inv = reg_inv\n self.k_fold = k_fold\n self.random_state = random_state\n self.model = sklearn.linear_...
[ "0.62698585", "0.61725384", "0.61637604", "0.6154692", "0.6104252", "0.6065043", "0.6043689", "0.6036467", "0.6005035", "0.59768355", "0.5962559", "0.5954204", "0.5923508", "0.5914702", "0.5897691", "0.5893453", "0.58933365", "0.5870308", "0.586354", "0.58188796", "0.58144957...
0.0
-1
Tests if the input configuration can be used to successfully connect to the integration
def check_config(self, logger: AirbyteLogger, config_path: str, config: json) -> AirbyteConnectionStatus: url = "https://api.kustomerapp.com/v1/customers" headers = {"Authorization": f"Bearer {config['api_token']}"} try: session = requests.get(url, headers=headers) sessi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_connection(self):\n self.assertIsNotNone(app.check_connection())", "def _check_config(self):", "def check_config(config):\n pass", "def test_verify_connection_to_a_device():", "def check_configuration(self, configuration):\n super(Hipchap, self).check_configuration(confi...
[ "0.6990856", "0.68949676", "0.684888", "0.6785907", "0.677721", "0.676802", "0.661468", "0.65629077", "0.64611405", "0.64611405", "0.63934875", "0.6344222", "0.6334913", "0.6320825", "0.63101155", "0.63068146", "0.62989163", "0.62725794", "0.62673503", "0.6253545", "0.624385"...
0.5818214
84
Return the string commands to invoke the tap with the discover flag and the right configuration options
def discover_cmd(self, logger: AirbyteLogger, config_path: str) -> str: return f"{self.TAP_CMD} -c {config_path} --discover"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_path():\n\n return {\n \"tariff:Tariff management\": {\n \"list:Show list of tariffs\": [],\n \"show:Show tariff info\": [\"tariff\"],\n \"add:Add tariff to system\": [\"tariff\", \"cpu\", \"disk\", \"ram\", \"io\"],\n \"disable:...
[ "0.58859074", "0.58670986", "0.5826348", "0.58100325", "0.5771427", "0.5704115", "0.5698732", "0.56129", "0.5583267", "0.5536959", "0.5536959", "0.5536959", "0.5536959", "0.55263853", "0.5525248", "0.5517902", "0.54636204", "0.54554516", "0.5440602", "0.54287976", "0.542587",...
0.7558065
0
Return the string commands to invoke the tap with the right configuration options to read data from the source
def read_cmd(self, logger: AirbyteLogger, config_path: str, catalog_path: str, state_path: str = None) -> str: config_option = f"--config {config_path}" properties_option = f"--catalog {catalog_path}" state_option = f"--state {state_path}" if state_path else "" return f"{self.TAP_CMD} {c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCommands(self):", "def discover_cmd(self, logger: AirbyteLogger, config_path: str) -> str:\n return f\"{self.TAP_CMD} -c {config_path} --discover\"", "def read_cmd(self):\n\n parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)\n req_opts = parser.add_argument_grou...
[ "0.57491606", "0.5746505", "0.5679547", "0.5584499", "0.5541998", "0.5482936", "0.5449338", "0.5402556", "0.537918", "0.53708476", "0.5344244", "0.5337871", "0.5331325", "0.52883744", "0.52798516", "0.5266515", "0.52500254", "0.5231561", "0.5224792", "0.52229244", "0.52014023...
0.6807015
0
Helper to extract the necessary information from the source and destination arguments.
def _extract_service_info(self, source, destination): self._validate_args(source, destination) src_tags = [] dest_tags = [] src_ranges = [] dest_ranges = [] if isinstance(source, Service): src_tags.append("%s-%s" % (source.network.name, source.name)) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_info_from_arguments(self):\r\n\r\n for sample_name in self.arguments['--sample_name']:\r\n self.list_of_samples_to_be_combined.append(sample_name)\r\n\r\n for file_path in self.arguments['--input_file']:\r\n file_object = Input_file(file_path, self.list_of_samples_to...
[ "0.6327258", "0.611357", "0.6070593", "0.6032475", "0.5898038", "0.5862193", "0.57831115", "0.5734336", "0.5718328", "0.57162285", "0.57139033", "0.5698845", "0.56835914", "0.5624857", "0.561419", "0.56104034", "0.555884", "0.5511409", "0.54986507", "0.54595613", "0.5454608",...
0.66374743
0
Add path between two services on a given port.
def add(self, source, destination, port): logger.info('Adding path from %s to %s on port %s', source, destination, port) rules = [{"IPProtocol": "tcp", "ports": [int(port)]}] src_tags, dest_tags, src_ranges, _ = self._extract_service_info( source, destination) firewall_name =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths_allow_service(ctx, network, destination, source, port):\n source_service = get_service_for_cli(ctx, network, source)\n destination_service = get_service_for_cli(ctx, network, destination)\n ctx.obj['CLIENT'].paths.add(source_service, destination_service, port)\n click.echo('Ad...
[ "0.72288865", "0.62011", "0.59549165", "0.5698274", "0.569521", "0.56599027", "0.5586385", "0.55849314", "0.5568475", "0.54433686", "0.53352237", "0.53007907", "0.5271029", "0.5248992", "0.5241183", "0.5220928", "0.52087563", "0.5194345", "0.5165232", "0.5164921", "0.5087458"...
0.685008
1
Remove path between two services on a given port.
def remove(self, source, destination, port): logger.info('Removing path from %s to %s on port %s', source, destination, port) firewall_name = "bu-%s-%s-%s" % (destination.network.name, destination.name, port) def remove_from_ranges(to_remove, address_ranges): lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths_revoke_service(ctx, network, destination, source, port):\n source_service = get_service_for_cli(ctx, network, source)\n destination_service = get_service_for_cli(ctx, network, destination)\n ctx.obj['CLIENT'].paths.remove(source_service, destination_service, port)\n click.echo...
[ "0.73585504", "0.63231486", "0.6160031", "0.6030933", "0.59920424", "0.5941496", "0.57573885", "0.5690381", "0.56471235", "0.5642937", "0.5599214", "0.55907756", "0.55659735", "0.55342007", "0.5519539", "0.5490159", "0.5467465", "0.5436124", "0.5414947", "0.54074705", "0.5395...
0.65104246
1
List all paths in a dictionary structure.
def list(self): firewalls = self.driver.ex_list_firewalls() tag_to_service = {} for service in self.service.list(): service_tag = "%s-%s" % (service.network.name, service.name) if service_tag in tag_to_service: raise BadEnvironmentStateException( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_paths():\n paths = db.session.query(Path).all()\n data = []\n for path in paths:\n data.append({\"id\" : path.id,\n \"title\":path.title,\"rating\":path.rating,\n \"description\":path.description,\"date\":path.date,\n \"start_coordinate\":path.start_coordin...
[ "0.67503875", "0.6593327", "0.6496042", "0.64637524", "0.6462023", "0.6399366", "0.6267905", "0.6239227", "0.61681885", "0.6145046", "0.6088481", "0.6067918", "0.5987216", "0.5966857", "0.59594834", "0.5934607", "0.5927588", "0.59196013", "0.58615535", "0.5857183", "0.5844941...
0.0
-1
Return true if the given network is internet accessible.
def internet_accessible(self, service, port): paths = self.list() for public_block in get_public_blocks(): source = CidrBlock(public_block) self._validate_args(source, service) if self._has_access(paths, source, service, port): return True retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def internet_on():\n try:\n urllib.request.urlopen('http://216.58.192.142', timeout=1)\n return True\n except urllib.error.URLError: \n return False", "def has_internet() -> bool:\n if public_address():\n return True\n else:\n return False", "def is_internet_on() ...
[ "0.80673635", "0.78484184", "0.7726492", "0.77061474", "0.7639725", "0.7414", "0.73989576", "0.73573595", "0.7167946", "0.69066286", "0.6890679", "0.68574977", "0.67430186", "0.67271066", "0.66752124", "0.6611635", "0.6597703", "0.6585244", "0.65795463", "0.6493639", "0.64728...
0.65210694
19
Return true if there's a path between the services.
def has_access(self, source, destination, port): logger.info('Looking for path from %s to %s on port %s', source, destination, 80) self._validate_args(source, destination) paths = self.list() logger.info('Found paths %s', paths) return self._has_access(paths, source, destination,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_path(self, start, end):\n return end in self.paths(start)", "def paths_service_has_access(ctx, network, destination, source, port):\n source_service = get_service_for_cli(ctx, network, source)\n destination_service = get_service_for_cli(ctx, network, destination)\n if ctx.o...
[ "0.6967411", "0.65646327", "0.652668", "0.64812905", "0.6433106", "0.63819546", "0.61939585", "0.6148311", "0.61272573", "0.60953724", "0.60799444", "0.6025365", "0.59581494", "0.59482163", "0.5914023", "0.5902984", "0.58886826", "0.588194", "0.5872661", "0.5815296", "0.58065...
0.5584994
43
updates the learning rate using inverse time decay
def learning_rate(epoch): return alpha / (1 + decay_rate * epoch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def update_learning_rate(self...
[ "0.7914394", "0.7914394", "0.7600384", "0.7560176", "0.7499523", "0.74376434", "0.7421272", "0.74188656", "0.73709327", "0.7334627", "0.73209643", "0.7318579", "0.7294742", "0.7198275", "0.7148807", "0.71447504", "0.7119928", "0.70642436", "0.69671065", "0.68856674", "0.68773...
0.679231
28
Returns the ManagementForm instance for this FormSet.
def management_form(self): if self.is_bound: form = AttachmentManagementForm(self.data, auto_id=self.auto_id, prefix=self.prefix) if not form.is_valid(): raise ValidationError('ManagementForm data is missing or has been tampered with') else: form = Att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _management_form(self):\n if self.is_bound:\n form = ConcurrentManagementForm(self.data, auto_id=self.auto_id,\n prefix=self.prefix)\n if not form.is_valid():\n raise ValidationError('ManagementForm data is missing or has be...
[ "0.7361065", "0.6664403", "0.6664403", "0.6357645", "0.622903", "0.619828", "0.6129273", "0.6124485", "0.61211973", "0.6112333", "0.6099777", "0.60755575", "0.5937113", "0.58789", "0.5841554", "0.575287", "0.5716436", "0.56436545", "0.5578003", "0.555524", "0.55537564", "0....
0.7139378
1
Saves and returns an existing model instance for the given form.
def save_existing(self, form, instance, commit=True): t = None if type(instance.content_object) == Temporary: t = instance.content_object setattr(instance, self.ct_field.get_attname(), ContentType.objects.get_for_model(self.instance).pk) setattr(instance, self.ct_fk_field.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_form(self, form, **kwargs):\n if form.is_valid():\n # check for save arg\n if kwargs.get('save_arg'):\n obj = form.save(kwargs.get('save_arg'))\n else:\n obj = form.save()\n if kwargs.get('data'):\n for k, v...
[ "0.6576403", "0.64161557", "0.6384659", "0.63773", "0.63773", "0.632624", "0.6257641", "0.625082", "0.62410504", "0.61304533", "0.60362434", "0.60285646", "0.60066885", "0.598247", "0.59468055", "0.59448826", "0.58961785", "0.5891683", "0.5856457", "0.5836138", "0.5831977", ...
0.0
-1
Get all the roidbs(dict for each image) in this dataset.
def get_roidb(self): # get all the images_ids in this dataset img_ids = self._COCO.getImgIds() # sort the ids, make each time the same order img_ids.sort() # load the 'image' of the COCO dataset roidb = copy.deepcopy(self._COCO.loadImgs(img_ids)) for entry in roid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getimgs():", "def _get_images(self):\n raw_outputs = self.interface.get_data(self.target_charge,\n self.charge_deviation,\n n_samples=self.n_samples)\n\n # apply roi to images\n roi_images = []\n ...
[ "0.63079953", "0.6234191", "0.6219616", "0.6211326", "0.61850816", "0.61710894", "0.6158927", "0.61159897", "0.6075292", "0.606353", "0.6056601", "0.5999819", "0.597429", "0.5974166", "0.5902935", "0.5876047", "0.5860083", "0.5860083", "0.58325046", "0.5830358", "0.581679", ...
0.6564253
0
Adds empty metadata fields to an roidb entry
def _prep_roidb_entry(self, entry): im_path = os.path.join(self.root, 'images', self.img_dir_name, entry['file_name']) assert os.path.exists(im_path), 'Image \'{}\' not found'.format(im_path) entry['image'] = im_path entry['flipped'] = False # empty placeholders entry['bb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_none_field(self):\n user_id = get_rand_string()\n data = get_rand_string()\n id = get_rand_string()\n\n doc = {}\n doc[\"user_id\"] = user_id\n doc[\"data\"] = data\n doc[\"id\"] = id\n doc[\"num\"] = None\n\n self.conn.add(**doc)", "def...
[ "0.6160103", "0.6061121", "0.59801316", "0.58670473", "0.5864214", "0.5544845", "0.554237", "0.55322087", "0.5514025", "0.5416703", "0.541656", "0.5356941", "0.53148735", "0.5307623", "0.5273423", "0.52616686", "0.5258249", "0.5258102", "0.52420217", "0.52291954", "0.5199936"...
0.5816735
5
Read gt annotation metadata from cached file
def _read_roidb_from_cachefile(self, roidb, cache_file): with open(cache_file, 'rb') as f: cached_roidb = pickle.load(f) assert len(roidb) == len(cached_roidb) for entry, cached_entry in zip(roidb, cached_roidb): values = [cached_entry[key] for key in self.valid_cached_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_annotations(self) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]:\n print('Loading annotations...')\n \n if self.caching:\n # Get last modified timestamp of the cache path\n cache_path = pathlib.Path(self.cache_path)\n ...
[ "0.62027264", "0.5997888", "0.5976737", "0.59695655", "0.59675443", "0.5937609", "0.5937239", "0.59047294", "0.5897617", "0.5891092", "0.58580345", "0.5820216", "0.57935876", "0.57935876", "0.576893", "0.5730197", "0.5653852", "0.565109", "0.5638312", "0.56168824", "0.5604916...
0.0
-1
Add gt annotation metadata to an roidb entry
def _add_roidb_from_annotations(self, entry): ann_ids = self._COCO.getAnnIds(imgIds=entry['id'], iscrowd=None) objs = self._COCO.loadAnns(ann_ids) width = entry['width'] height = entry['height'] # valid objs # change the annotation boxes from 'xywh' to 'xyxy' vali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotate(self, annotation):\n self._data = self._data.annotate(**annotation)", "def add_annotation_metadata(self, value):\n\n if self._properties is None:\n self._properties = LabelProperties()\n self._properties.parameters.insert_new_element(value)", "def add_annotations(an...
[ "0.60331297", "0.5977848", "0.5928702", "0.5885852", "0.56935644", "0.5640169", "0.5632724", "0.55520755", "0.55051976", "0.54648685", "0.5353418", "0.5333789", "0.5326382", "0.53186566", "0.5228458", "0.5219965", "0.51834035", "0.51765555", "0.51679146", "0.5166681", "0.5164...
0.5174346
18
Get a time at a proportion of a range of two formatted times. start and end should be strings specifying times formated in the given format (strftimestyle), giving an interval [start, end]. prop specifies how a proportion of the interval to be taken after start. The returned time will be in the specified format.
def strTimeProp(start, end, format, prop): stime = time.mktime(time.strptime(start, format)) etime = time.mktime(time.strptime(end, format)) ptime = stime + prop * (etime - stime) return time.strftime(format, time.localtime(ptime))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_time_proportion(start, end, format, prop):\n\n stime = time.mktime(time.strptime(start, format))\n etime = time.mktime(time.strptime(end, format))\n\n ptime = stime + prop * (etime - stime)\n\n return time.strftime(format, time.localtime(ptime))", "def str_time_prop(start, end, format, pro...
[ "0.85178894", "0.79471684", "0.7846328", "0.7843137", "0.77967566", "0.7789479", "0.7489254", "0.6821654", "0.5855493", "0.56891155", "0.5462127", "0.5439004", "0.5263487", "0.5042992", "0.50261956", "0.5021218", "0.500701", "0.49870068", "0.49614337", "0.49568093", "0.487238...
0.7883204
6
Assert linter output messages with expected messages.
def validate(self, lint_task_report, expected_messages, failed_count): for stdout in lint_task_report: if stdout.failed: for message in expected_messages: self.assert_same_list_elements( [message], stdout.trimmed_messages) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_common_case(self):\n loglevel_from_command_line = \"WARNING\"\n assert output(self.msg, \"INFO\", loglevel_from_command_line)", "def test_conformance_tests_test_output(self):\n style = pycodestyle.StyleGuide(quiet=True)\n result = style.check_files(['tests/test_output.py'])\n...
[ "0.66211826", "0.65319955", "0.6322452", "0.62098235", "0.6205033", "0.6191707", "0.614406", "0.61428285", "0.6142819", "0.6119627", "0.60981184", "0.60862803", "0.608246", "0.6077644", "0.6076441", "0.60103965", "0.60043216", "0.60003436", "0.59985435", "0.59970367", "0.5990...
0.58783114
35
A reference implementation of a fitting function
def fit(self, X, y): n_samples = X.shape[0] self.U = 0.1 * self.rng.randn(self.num_user, self.D) # user vectors self.V = 0.1 * self.rng.randn(self.num_item, self.D) # item vectors mask_u = np.zeros((self.num_user, self.D)) mask_v = np.zeros((self.num_item, self.D)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit():\n pass", "def _fit_function(self,x,a,b):\n return b + a*x", "def fit(self, x):\n pass", "def fit(self):\n raise NotImplementedError", "def fit(self, x):\n raise NotImplementedError()", "def fit(self, X):", "def fit(self):\n raise NotImplementedError ...
[ "0.79639536", "0.78046715", "0.766744", "0.7549818", "0.75253206", "0.74864894", "0.7471354", "0.73796034", "0.7347994", "0.7347994", "0.7347994", "0.7347994", "0.7347994", "0.7347994", "0.7347994", "0.7347994", "0.7347994", "0.7347994", "0.724212", "0.724212", "0.724212", ...
0.0
-1
A reference implementation of a predicting function.
def predict(self, X): n_samples = X.shape[0] y_pred = self.mean_rating_*np.ones(n_samples) for i in np.arange(n_samples): if X[i,0] < self.num_user and X[i,1] < self.num_item: y_pred[i] += np.dot(self.U[X[i,0],:],self.V[X[i,1],:]) y_pred[i] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self):\n raise NotImplementedError", "def predict(self, src): # real signature unknown; restored from __doc__\n pass", "def predict(self, **kwargs):\n raise NotImplementedError", "def _predict(self, x):\n pass", "def predictIpdFuncModel(self, refId):\n\n # Mat...
[ "0.7543543", "0.7530832", "0.7339275", "0.7310924", "0.7306891", "0.72665805", "0.72665805", "0.7234079", "0.7234079", "0.7234079", "0.7225656", "0.71698153", "0.71546125", "0.71517646", "0.7147604", "0.7123053", "0.71057063", "0.7061365", "0.7060866", "0.7042472", "0.7041859...
0.0
-1
Check all registered stateless apps and create ORM entries that are missing
def add_stateless_apps(request, **kwargs): check_stateless_loaded() return redirect('admin:django_plotly_dash_statelessapp_changelist')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_db_is_created(test_teardown):\n try:\n applications = Application.query.first()\n inhouse_postings = Inhouse.query.first()\n external_postings = External.query.first()\n except Exception:\n assert False\n assert True", "def test_app() -> Generator[FastAPI, Any, None]...
[ "0.6631696", "0.6563358", "0.63753223", "0.61903685", "0.6188892", "0.6129401", "0.6111491", "0.61106694", "0.6104654", "0.6092305", "0.60732937", "0.6062053", "0.6016797", "0.5972828", "0.5951301", "0.59272087", "0.59242654", "0.5873568", "0.58552974", "0.5852981", "0.584797...
0.55525464
61
Initiate all elements necessary to create a visualization
def __init__(self, area, algorithm, showDecrease=False): self._running = True self._display_surf = None self.size = self.width, self.height = 1040, 770 self.area = area self.algorithm = algorithm self.lastPrice = 0 self.scores = [] self.allTimeHigh = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_visualization(self) -> None:\n pass", "def _plot_init(self):\n pass", "def _plot_init(self):\n pass", "def initialize(self) -> None:\n # Only do matplotlib import when necessary\n super().initialize()\n from matplotlib import pyplot as plt\n sel...
[ "0.7872412", "0.7087144", "0.7087144", "0.69636714", "0.6836767", "0.6821109", "0.675592", "0.67427933", "0.6721345", "0.6704872", "0.67046523", "0.6684778", "0.66836005", "0.66741896", "0.66685414", "0.66287583", "0.66133267", "0.6607237", "0.6592763", "0.65526634", "0.65430...
0.0
-1
Executes given algorithm and draws visualization
def on_render(self): # set text font for in visualization pygame.font.init() font = pygame.font.SysFont('Arial', 24) # continue running algorithm until done if self.algorithm.isDone is False: self.algorithm.execute() # draw background for i in range...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(self):\n if self.mode==0: #drawing\n self.draw()\n self.graph_drawing=self.cleanGraph(self.graph_drawing)\n #if len(self.graph_drawing)>1:\n # self.function_interpolation=self.polynomialInterpolation2D(self.graph_drawing,1)\n # self.graph...
[ "0.6958115", "0.6749951", "0.667682", "0.6547552", "0.6451062", "0.6338296", "0.6285082", "0.6275436", "0.62320006", "0.6227646", "0.6182338", "0.6178661", "0.6141961", "0.6119228", "0.60796785", "0.6072379", "0.6065661", "0.6045414", "0.6041594", "0.6021481", "0.6011331", ...
0.0
-1
Closes the pygame window
def on_cleanup(self): pygame.quit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self._screen = None\n pygame.display.quit()", "def end_pygame(self):\n pygame.quit()", "def end_game():\n pygame.quit()\n exit()", "def close_window() -> bool:\n global WINDOW\n global IMPL\n global ACTIVE_CALLBACK\n try:\n cast(PygletRenderer,...
[ "0.82715863", "0.78452134", "0.77165353", "0.74987227", "0.73441", "0.72341275", "0.719603", "0.71945214", "0.7189006", "0.7164061", "0.713809", "0.70922494", "0.70883983", "0.7088168", "0.70871246", "0.70871246", "0.7066076", "0.70659834", "0.70413816", "0.70319366", "0.7005...
0.6695328
40
Starts and executes the visualisation
def on_execute(self): # cannot run without visualization if self.on_init() is False: self._running = False # while running listen for events and render these while(self._running): for event in pygame.event.get(): self.on_event(event) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize(self):\n app = QtGui.QApplication([''])\n SceneGUI(self)\n app.exec_()", "def main():\n configuration = ConfigParser()\n configuration.read_file(open('src/default.ini'))\n configuration.read(['config.ini'])\n push_exception_handler(reraise_exceptions=True)\n # Cr...
[ "0.7402717", "0.7213778", "0.71236545", "0.71204275", "0.70529693", "0.70103776", "0.6953393", "0.68962806", "0.6810111", "0.6803159", "0.67920536", "0.6783941", "0.6770534", "0.6744664", "0.67096233", "0.6675253", "0.66208965", "0.66193354", "0.6582743", "0.6575067", "0.6571...
0.0
-1
Define command line flags for MNIST model.
def define_mnist_flags(): flags_core.define_base( clean=True, num_gpu=True, train_epochs=True, epochs_between_evals=True, distribution_strategy=True) flags_core.define_device() flags_core.define_distribution() # flags.DEFINE_string('data_dir', r'D:\tf2_official_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_args():\n parser = argparse.ArgumentParser(description=\"Classify and predict digits using the mnist dataset\")\n parser.add_argument('mode', help='the mode to run in: fit, model or predict')\n parser.add_argument('--algo', help='which algorithm to use: RandomForest, KNN')\n return parser.pars...
[ "0.63784486", "0.63677526", "0.6337081", "0.6322367", "0.62878275", "0.6251837", "0.62503946", "0.61637074", "0.6119836", "0.611938", "0.6100962", "0.6022951", "0.6016902", "0.59860235", "0.5975369", "0.5955694", "0.5928708", "0.5927573", "0.5901932", "0.58923614", "0.5875625...
0.7942187
0
Returns whether the scene contains an image pixmap.
def hasImage(self): return self._image is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasImage(self):\n if self.getImage():\n return True\n return False", "def has_image(self):\n return hasattr(self, \"_image\") and self._image is not None", "def hasPng(self):\n\t\tif self.isPng:\n\t\t\treturn True\n\t\treturn textureFile( self.path.replace( self.extension, '...
[ "0.7148394", "0.69063604", "0.6811348", "0.6708111", "0.6708111", "0.66627085", "0.63021797", "0.6208606", "0.61569035", "0.613535", "0.6075283", "0.6071318", "0.59205896", "0.59165484", "0.5906985", "0.58777034", "0.5860418", "0.581497", "0.5773688", "0.5759203", "0.57401556...
0.7086305
1
Removes the current image pixmap from the scene if it exists.
def clearImage(self): if self.hasImage(): self.scene.removeItem(self._image) self._image = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearImage(self):\n if self.hasImage():\n self.scene.removeItem(self._pixmapHandle)\n self._pixmapHandle = None\n self.zoom=-1\n self.scene.clear()", "def removeScene(self):\n del self.scene, self.imgPixmapItem", "def clean_all(self):\n self....
[ "0.79136795", "0.7713988", "0.67695427", "0.6741188", "0.6572793", "0.65437007", "0.64187896", "0.63136613", "0.61855835", "0.61837137", "0.61759114", "0.61759114", "0.61453015", "0.61429083", "0.6075483", "0.6035884", "0.6033798", "0.5917658", "0.59154296", "0.5910521", "0.5...
0.7800114
1
Returns the scene's current image pixmap as a QPixmap, or else None if no image exists.
def pixmap(self): if self.hasImage(): return self._image.pixmap() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixmap(self):\n if self.hasImage():\n return self._pixmapHandle.pixmap()\n return None", "def image(self):\n if self.hasImage():\n return self._pixmapHandle.pixmap().toImage()\n return None", "def image(self):\n if self.hasImage():\n retur...
[ "0.7835423", "0.75290245", "0.74141395", "0.67934173", "0.6428947", "0.61595285", "0.6098856", "0.58280176", "0.5742987", "0.5732158", "0.5682366", "0.56738436", "0.5643078", "0.56390196", "0.5633685", "0.5633685", "0.5633685", "0.56182927", "0.5591214", "0.5585604", "0.55093...
0.79953897
0
Returns the scene's current image pixmap as a QImage, or else None if no image exists.
def image(self): if self.hasImage(): return self._image.pixmap().toImage() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixmap(self):\n if self.hasImage():\n return self._image.pixmap()\n return None", "def image(self):\n if self.hasImage():\n return self._pixmapHandle.pixmap().toImage()\n return None", "def pixmap(self):\n if self.hasImage():\n return self...
[ "0.75357985", "0.7390828", "0.7325522", "0.63724256", "0.63046825", "0.60485345", "0.5909091", "0.58557355", "0.58035487", "0.5761733", "0.57425255", "0.5711291", "0.5696588", "0.5677836", "0.5676707", "0.5676707", "0.5676707", "0.5646885", "0.5624013", "0.5589218", "0.557353...
0.7408162
1
Set the scene's current image pixmap to the input QImage or QPixmap. Raises a RuntimeError if the input image has type other than QImage or QPixmap.
def setImage(self, image): if type(image) is QPixmap: pixmap = image elif type(image) is QImage: pixmap = QPixmap.fromImage(image) elif (np is not None) and (type(image) is np.ndarray): if qimage2ndarray is not None: qimage = qimage2ndarray.arr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setImage(self, image):\n if type(image) is QPixmap:\n pixmap = image\n elif type(image) is QImage:\n pixmap = QPixmap.fromImage(image)\n else:\n raise RuntimeError(\"ImageViewer.setImage: Argument must be a QImage or QPixmap.\")\n if self.hasImage():...
[ "0.7422291", "0.6897182", "0.6531623", "0.63586396", "0.62505937", "0.6145541", "0.6143544", "0.61127263", "0.6110928", "0.6067547", "0.5999988", "0.59984446", "0.59641266", "0.5930717", "0.59233356", "0.58951384", "0.58449477", "0.580186", "0.57875705", "0.5784541", "0.57468...
0.76077926
0
Load an image from file. Without any arguments, loadImageFromFile() will pop up a file dialog to choose the image file. With a fileName argument, loadImageFromFile(fileName) will attempt to load the specified image file directly.
def open(self, filepath=None): if filepath is None: filepath, dummy = QFileDialog.getOpenFileName(self, "Open image file.") if len(filepath) and os.path.isfile(filepath): image = QImage(filepath) self.setImage(image)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(path_to_image, image_name):\n print(\"Loading: \", path_to_image + image_name, \" ...\")\n return Image.open(path_to_image + image_name)", "def load_image_file(filename, mode='RGB'):\n return imread(filename, mode=mode)", "def load_image(file_path):\r\n return Image.open(file_path)",...
[ "0.69220436", "0.68596613", "0.67387414", "0.66391367", "0.6533708", "0.6456546", "0.643648", "0.6392238", "0.63555753", "0.63424206", "0.62883973", "0.6251465", "0.61765534", "0.61312544", "0.6113461", "0.60655653", "0.60602564", "0.6048459", "0.59921944", "0.5976241", "0.59...
0.5638605
51
Show current zoom (if showing entire image, apply current aspect ratio mode).
def updateViewer(self): if not self.hasImage(): return if len(self.zoomStack): self.fitInView(self.zoomStack[-1], self.aspectRatioMode) # Show zoomed rect. else: self.fitInView(self.sceneRect(), self.aspectRatioMode) # Show entire image.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateViewer(self):\n if not self.hasImage():\n return\n if self.zoom<0:\n self.fitInView(self.sceneRect(), self.aspectRatioMode)\n self.zoom=self.size().width()/self.scene.width()\n else:\n self.setTransform(QTransform().scale(self.zoom, self.zo...
[ "0.7110633", "0.6878876", "0.67799777", "0.66970503", "0.6600747", "0.6560286", "0.648813", "0.64450556", "0.6328534", "0.63201594", "0.63057935", "0.62695974", "0.6250653", "0.6239383", "0.62117034", "0.618607", "0.6161364", "0.61387765", "0.611919", "0.6115448", "0.6115113"...
0.7233747
0
Maintain current zoom on resize.
def resizeEvent(self, event): self.updateViewer()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __zoomIn(self):\n if QApplication.focusWidget() == e5App().getObject(\"Shell\"):\n e5App().getObject(\"Shell\").zoomIn()\n else:\n aw = self.activeWindow()\n if aw:\n aw.zoomIn()\n self.sbZoom.setValue(aw.getZoom())", "def __zoomRes...
[ "0.7117528", "0.7017072", "0.69751215", "0.6882993", "0.6858646", "0.6840816", "0.67645746", "0.6685849", "0.6667905", "0.6667615", "0.6667457", "0.66327095", "0.66290236", "0.6545775", "0.64846504", "0.64807826", "0.6464954", "0.6435762", "0.64198947", "0.6410689", "0.640780...
0.6529663
14
Start mouse pan or zoom mode.
def mousePressEvent(self, event): # Ignore dummy events. e.g., Faking pan with left button ScrollHandDrag. dummyModifiers = Qt.KeyboardModifier(Qt.KeyboardModifier.ShiftModifier | Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.AltModifier | Qt.Keyb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_panning_mouse(self):\n # Panning: left button mouse\n self.set('LeftClickMove', 'Pan',\n param_getter=lambda p: (p[\"mouse_position_diff\"][0],\n p[\"mouse_position_diff\"][1]))", "def enableZoomIn(self):\n self.zoomInID =...
[ "0.6292223", "0.6211446", "0.6109515", "0.60822356", "0.5996879", "0.59794855", "0.5846898", "0.57985544", "0.5691063", "0.5691012", "0.5656027", "0.5603103", "0.5591536", "0.55351645", "0.55156785", "0.5500062", "0.54949075", "0.54825634", "0.54653955", "0.54614025", "0.5441...
0.52884054
28
Stop mouse pan or zoom mode (apply zoom if valid).
def mouseReleaseEvent(self, event): # Ignore dummy events. e.g., Faking pan with left button ScrollHandDrag. dummyModifiers = Qt.KeyboardModifier(Qt.KeyboardModifier.ShiftModifier | Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.AltModifier | Qt.Ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_zoom_out(self):\n if self.cur_zoom > 0:\n self.cur_zoom -= 1\n self.zoom_widget.setValue(self.cur_zoom)\n self.apply_zoom()", "def disableZoomOut(self):\n self.canvas.mpl_disconnect(self.zoomOutID)\n self.master.config(cursor = \"arrow\")", "def ...
[ "0.68419695", "0.6739481", "0.65681237", "0.6543827", "0.6457997", "0.6321618", "0.6290279", "0.6144844", "0.6118293", "0.6052398", "0.6047929", "0.59668887", "0.5871435", "0.5862427", "0.5862376", "0.5830977", "0.57818764", "0.5772399", "0.5762828", "0.5702071", "0.5701795",...
0.0
-1
Factory function for creating a trainer for supervised models
def create_setops_trainer( base_model, classifier, setops_model, optimizer, criterion1, criterion2, params_object, metrics={}, device=None): if device: base_model.to(device) classifier.to(device) setops_mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, trainer):\n self.trainer = trainer", "def trainer_factory(\n algorithm: Algorithm, config_overrides: dict, env: Optional[str] = None\n) -> Trainer:\n ensure_moab_envs_register()\n trainer_cls = algorithm.get_trainer_cls()\n default_config = algorithm.get_default_config()\n ...
[ "0.71435684", "0.7107374", "0.69590217", "0.6899696", "0.68078077", "0.67690617", "0.6763507", "0.66558087", "0.66419077", "0.6584648", "0.65843713", "0.6530679", "0.6478796", "0.64768434", "0.6475404", "0.64570993", "0.6412537", "0.6393217", "0.63930285", "0.6369134", "0.636...
0.5883267
60
Factory function for creating an evaluator for supervised models
def create_setops_evaluator( base_model, classifier, setops_model, metrics={}, device=None): if device: base_model.to(device) classifier.to(device) setops_model.to(device) def _inference(engine, batch): base_model.eval() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_evaluator(cls, cfg, dataset_name, output_folder=None):\n if output_folder is None:\n output_folder = os.path.join(cfg.OUTPUT_DIR, \"inference\")\n evaluator_list = []\n evaluator_type = MetadataCatalog.get(dataset_name).evaluator_type\n if evaluator_type in [\"sem_s...
[ "0.70951146", "0.70931005", "0.6880831", "0.67547524", "0.6727796", "0.6719201", "0.6615242", "0.65753007", "0.6541401", "0.6517219", "0.63667166", "0.62752193", "0.6263758", "0.6261502", "0.62416553", "0.6239041", "0.6132677", "0.61306274", "0.6113522", "0.610134", "0.607877...
0.5975046
26
Save checkpoints of the models.
def setup_checkpoint(self, base_model, classifier, setops_model, evaluator): checkpoint_handler_acc = ModelCheckpoint( self.results_path, CKPT_PREFIX, score_function=lambda eng: round( (eng.state.metrics["fake class acc"] + eng.state.metrics["S class ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, checkpoint) -> None:\r\n self.model.save(checkpoint)", "def checkpoint(self):\n save()", "def save_checkpoint(self, model):\n # print(f\"save model {self.save_model_path}\")\n torch.save(model.state_dict(), self.save_model_path)", "def save_checkpoint(self, model, o...
[ "0.7800809", "0.7565651", "0.7409244", "0.7344545", "0.73144007", "0.72660166", "0.7262461", "0.7247549", "0.72064286", "0.7176319", "0.7068394", "0.7047076", "0.70424587", "0.7033007", "0.70235634", "0.702158", "0.70195657", "0.6974094", "0.6958324", "0.69301397", "0.6920729...
0.0
-1
Create or resume the models.
def setup_model(self): logging.info("Setup the models.") logging.info("{} model".format(self.base_network_name)) if self.base_network_name.lower().startswith("resnet"): base_model, classifier = getattr(setops_models, self.base_network_name)( num_classes=80, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_models( self ):", "def create_model(self):\n self.create_model_file()\n self.create_model_unit_test()\n self.add_model_to_list()\n self.readme_reminder()", "def create_model(self):\n pass", "def create_model(self):\n pass", "def _execute(self):\n ...
[ "0.70078397", "0.63238263", "0.61417264", "0.61417264", "0.61415637", "0.59057415", "0.5848274", "0.5814495", "0.57502663", "0.5723252", "0.5714471", "0.56826335", "0.56672585", "0.5664253", "0.5658536", "0.56254953", "0.56254256", "0.56186324", "0.558689", "0.5583091", "0.55...
0.57413155
9
Load the training datasets.
def setup_datasets(self): train_transform = transforms.Compose( [ transforms.Resize(self.crop_size), transforms.RandomRotation(degrees=self.random_angle, resample=Image.BILINEAR), transforms.RandomResizedCrop( size=self.crop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dataset(self):\n # Get all the files in the directory\n file_list = self.get_file_list()\n\n # Concatenate the data corresponding to a list of files\n data = self.concatenate_file_data(file_list)\n\n # Shuffle the data and create the training and the validation datasets\...
[ "0.8218399", "0.8125178", "0.80490196", "0.7737084", "0.7685521", "0.76708466", "0.761472", "0.7569029", "0.7523898", "0.75187165", "0.7513626", "0.74819964", "0.7391458", "0.73578954", "0.728657", "0.71922135", "0.71755755", "0.71751636", "0.71503323", "0.7139459", "0.713235...
0.0
-1
Fill in created_at timestamp with something correct enough.
def forwards(apps, schema_editor): Event = apps.get_model("kompomaatti", "Event") for event in Event.objects.filter(tag__isnull=True): if event.name.startswith("Instanssi"): event.tag = str(event.date.year) event.save(update_fields=["tag"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at", "def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at", "def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at", "def creat...
[ "0.7633237", "0.7633237", "0.7633237", "0.7492085", "0.74196297", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", "0.7287477", ...
0.0
-1
Verifies if a given expression is a DOI link.
def is_doi( expr: str ) -> bool: return "/" in expr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_doi(doi):\n\n try:\n req = requests.get('http://dx.doi.org/%s' % doi, timeout=2.5)\n except (Timeout, RequestException) as e:\n logger.error('Can not validate doi: ' + str(e))\n raise\n else:\n return req.status_code == 200", "def test_external_link_no_optional()...
[ "0.5902243", "0.5859285", "0.58372796", "0.5793471", "0.5750182", "0.57325715", "0.5698225", "0.56601554", "0.5649386", "0.5642453", "0.5627013", "0.5585181", "0.5577459", "0.55432963", "0.55078125", "0.55066365", "0.54943603", "0.5493496", "0.5486709", "0.5483652", "0.546083...
0.6097317
0
Verifies if a given expression is a PMCID.
def is_pmc( expr: str ) -> bool: return expr.startswith("PMC")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pmcid(val):\n return pmcid_regexp.match(val)", "def is_pmid(val):\n return pmid_regexp.match(val)", "def isValid(t_id):\n\tstr_id=str(t_id).strip()\n\treturn str_id.isdigit()", "def validate_crx_id(crx_id):\n try:\n assert isinstance(crx_id, str)\n assert crx_id.isalnum()\n ...
[ "0.7058424", "0.5879918", "0.52431554", "0.5222485", "0.5149193", "0.51324445", "0.51155275", "0.509177", "0.49949974", "0.49601135", "0.4931984", "0.49043941", "0.4885397", "0.4833352", "0.48165584", "0.48036438", "0.48029396", "0.4801181", "0.4782276", "0.478221", "0.478114...
0.6777141
1
Verifies if a given expression is not found when trying to find a PMID from a DOI or when trying to find a PMCID from a PMID.
def not_found( expr: str ) -> bool: return expr.startswith("N")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pmc(\n expr: str\n ) -> bool:\n return expr.startswith(\"PMC\")", "def test_raises_useful_exception(self):\n exp = Expression(r'inalid (\\d]', {}, [], lambda x: x)\n with self.assertRaises(exp.InvalidPattern):\n assert not exp.pattern", "def test_fetch_nonexist_...
[ "0.5836214", "0.5558532", "0.54999846", "0.5269607", "0.52547735", "0.51899976", "0.5160352", "0.51542646", "0.50802845", "0.5080079", "0.50719815", "0.50708777", "0.5060157", "0.50567174", "0.5032003", "0.501759", "0.5013457", "0.50105387", "0.5006492", "0.5003135", "0.49980...
0.5569078
1
This function transforms a list of articles IDs into another type.
def find_ids( ids_file: str, id_type: str ) -> str: if id_type == "PMID": finder = get_pmid_for_otherid elif id_type == "DOI": finder = get_doi_for_otherid elif id_type == "PMCID": finder = get_pmcid_for_otherid else: ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_ids(docs: List) -> List:\r\n try:\r\n for doc in docs:\r\n doc[\"_id\"] = str(doc[\"_id\"])\r\n except TypeError:\r\n pass\r\n return docs", "def map_to_per_etype(self, ids): # -> None:\n ...", "def map_to_per_ntype(self, ids): # -> None:\n ...", "d...
[ "0.6685242", "0.62097913", "0.61651856", "0.61146766", "0.58948886", "0.584178", "0.5735238", "0.5686752", "0.5686752", "0.56518906", "0.5582395", "0.5522685", "0.5522685", "0.5428211", "0.5428211", "0.5423706", "0.53926516", "0.53802526", "0.5362936", "0.5321825", "0.5321825...
0.0
-1
this includes bots apparently
def player_activate(game_event): print("Player Connect") userid = game_event.get_int('userid') print("userid: %s" % userid) playerinfo = playerinfo_from_userid(userid) print("playerinfo: %s" % playerinfo) print("playerinfo userid: %s" % playerinfo.get_userid()) steam64 = convertSteamIDT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_bot(self) -> bool:", "def bots():\n return get_bots(\"botsunlimited.settings\")", "def getBottoms(self):\n\t\treturn self.bottoms", "async def otherdiscords(self, ctx: commands.Context, team: HockeyTeams) -> None:\n if team is None:\n return await ctx.send(_(\"You must provide a v...
[ "0.67719287", "0.67631114", "0.6262418", "0.59412503", "0.5838326", "0.58037865", "0.5743516", "0.57257545", "0.56945395", "0.5681595", "0.5681595", "0.5680498", "0.5637873", "0.5630661", "0.5527503", "0.55264086", "0.54999554", "0.5485988", "0.54819053", "0.54798585", "0.547...
0.0
-1
this includes bots apparently
def player_disconnect(game_event): print("Player Disconnect") userid = game_event.get_int('userid') print("userid: %s" % userid) playerinfo = playerinfo_from_userid(userid) print("playerinfo: %s" % playerinfo) steamid = playerinfo.get_networkid_string() print("player steamid: %s" % steamid) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_bot(self) -> bool:", "def bots():\n return get_bots(\"botsunlimited.settings\")", "def getBottoms(self):\n\t\treturn self.bottoms", "async def otherdiscords(self, ctx: commands.Context, team: HockeyTeams) -> None:\n if team is None:\n return await ctx.send(_(\"You must provide a v...
[ "0.67719287", "0.67631114", "0.6262418", "0.59412503", "0.5838326", "0.58037865", "0.5743516", "0.57257545", "0.56945395", "0.5681595", "0.5681595", "0.5680498", "0.5637873", "0.5630661", "0.5527503", "0.55264086", "0.54999554", "0.5485988", "0.54819053", "0.54798585", "0.547...
0.0
-1
this includes bots apparently
def player_death(game_event): print("Player Death") # Get the userid from the event victim = game_event.get_int('userid') attacker = game_event.get_int('attacker') print("victim: %s" % victim) print("attacker: %s" % attacker) #victim_edict = edict_from_userid(victim) #attacker_edict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_bot(self) -> bool:", "def bots():\n return get_bots(\"botsunlimited.settings\")", "def getBottoms(self):\n\t\treturn self.bottoms", "async def otherdiscords(self, ctx: commands.Context, team: HockeyTeams) -> None:\n if team is None:\n return await ctx.send(_(\"You must provide a v...
[ "0.67719287", "0.67631114", "0.6262418", "0.59412503", "0.5838326", "0.58037865", "0.5743516", "0.57257545", "0.56945395", "0.5681595", "0.5681595", "0.5680498", "0.5637873", "0.5630661", "0.5527503", "0.55264086", "0.54999554", "0.5485988", "0.54819053", "0.54798585", "0.547...
0.0
-1
tell all players the message
def tell_all_players(message): print("tell_all_players - disabled") #player_obj_list = leetcoin_client.getPlayerObjList() #for player_obj in player_obj_list: # #print("player_obj key: %s" player_obj.get_key()) # print(player_obj.get_userid()) # # playerinfo = playerinfo_from_use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_all(self, message):\n # We copy the _clients into a list to avoid dictionary changing\n # size during iteration.\n for character in self.players.values():\n character.message(message)", "def send_msg_to_players(players, msg=\"\"):\n for player in players:\n p...
[ "0.70819765", "0.69221133", "0.67780375", "0.644569", "0.64424276", "0.63831353", "0.63645077", "0.6316337", "0.629872", "0.6286281", "0.62688696", "0.6267403", "0.62594795", "0.62567353", "0.6223139", "0.6213465", "0.6205974", "0.6203498", "0.61870635", "0.61756897", "0.6165...
0.7917727
0
Fired when a nonplayer entity is dying.
def other_death(game_event): # Make sure the entity was a chicken... if game_event.get_string('othertype') != 'chicken': return print("CHICKEN DIED") # Get the attacker's userid... userid = game_event.get_int('attacker') # Make sure the attacker was a player... if not userid: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def die(self):\n events.trigger_event(\"on_entity_death\", self)", "def die(self, dt):\r\n self.dead = True", "def on_death(self, state):", "def on_death(self):\n self.bark('I was killed.')\n self.where = self.category.spawn\n self.life = self.life_max\n for this in ...
[ "0.7837138", "0.6934105", "0.6703524", "0.6597946", "0.6566147", "0.65286016", "0.6384168", "0.6287133", "0.62799877", "0.62252057", "0.6216475", "0.620601", "0.6187029", "0.61190146", "0.6063468", "0.6046929", "0.60035783", "0.5991906", "0.59220314", "0.5872454", "0.58209693...
0.57358956
25
Fired every time a player is typing something.
def player_say(game_event): # Make sure the typed text was "/chicken"... if game_event.get_string('text') != '/chicken': return # Create a chicken entity... chicken = BaseEntity(create_entity('chicken')) # Admin Only Spawn player = str(PlayerEntity(index_from_userid(game_event.get_int('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_typing(self, user: \"steam.User\", when: \"datetime.datetime\") -> None:", "def on_text(self, char: str, game: type):", "def ev_keyup(self, event: KeyUp) -> None:", "def on_typing(self, author_id, metadata=None):\n pass", "def ev_textinput(self, event: TextInput) -> None:", "def on_ty...
[ "0.68697137", "0.669045", "0.64575166", "0.6253871", "0.61605495", "0.6110913", "0.604485", "0.6038742", "0.6024695", "0.60245764", "0.59954387", "0.59585464", "0.5911463", "0.5904285", "0.584641", "0.57990056", "0.57855916", "0.5767433", "0.57247984", "0.5722716", "0.5712976...
0.0
-1
Clears the LSystem, leaving it in an empty state.
def clear(self): self.globalDefines = {} self.axiom = self.setAxiomFromString("") self.clearProductions() self.niterations = 1 self.resultPString = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n self._ll_tree.clear()", "def clear(self):\n self.state = [[None, None, None],\n [None, None, None],\n [None, None, None]]", "def clear(self):\n self.call('clear')", "def clear(self):\n self.initialize()\n self.device_disconnect()", ...
[ "0.70731115", "0.68451196", "0.6841078", "0.67400897", "0.6628969", "0.66263187", "0.66138744", "0.6606035", "0.6603668", "0.65833545", "0.6568264", "0.6566893", "0.6512311", "0.65085864", "0.65085864", "0.65085864", "0.6487675", "0.6486742", "0.64708894", "0.6469002", "0.646...
0.6351805
44
Defines the number of iterations for this LSystem.
def setIterations(self,niterations): self.niterations = niterations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_iterations(self) -> int:\n pass", "def setNumberOfIterations(self, value):\n return self._set(numberOfIterations=value)", "def setNumberOfIterations(self, value):\n return self._set(numberOfIterations=value)", "def number_of_iterations(self) -> int:\n return self._so...
[ "0.77225906", "0.73913205", "0.73913205", "0.73364985", "0.7133316", "0.71064", "0.705243", "0.70468533", "0.698997", "0.6880098", "0.68696505", "0.68569124", "0.674406", "0.674406", "0.674406", "0.674406", "0.65591484", "0.6519867", "0.6519867", "0.6314424", "0.631092", "0...
0.6959807
9
Defines a new global parameter. Global defines are part of a LSystem definition.
def addGlobalDefine(self,name,value): self.globalDefines[name] = value self.refreshGlobals() return name,value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setGlobal(name, value):", "def _register_global_params(self, params):\n\n for name,obj in self.params().items():\n global_params.add(**{name:obj})\n\n for name,val in params.items():\n global_params.params(name).default=val\n\n params.update(global_params.get_param_...
[ "0.7220049", "0.6664844", "0.63944066", "0.6321146", "0.6292508", "0.6287569", "0.6168385", "0.6102255", "0.6082242", "0.607618", "0.5988118", "0.59781164", "0.59773254", "0.59147763", "0.5875671", "0.58619636", "0.5822638", "0.57786924", "0.5713862", "0.5713862", "0.5651559"...
0.67719114
1
Overrides an existing global parameter.
def overrideGlobalDefine(self,name,value): if name in self.globalDefines: self.globalDefines[name] = value self.refreshGlobals() else: raise Exception("Trying to override inexistent define!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetParam(key, value):\n \n if globalParams == {}:\n warning(\"WARNING: runtime parameters not yet initialized\")\n LoadParams(\"_defaults\")\n \n if key in globalParams.keys():\n globalParams[key] = value\n else:\n raise ValueError()", "def change_general_para...
[ "0.70273", "0.6755417", "0.67453146", "0.66492784", "0.66449267", "0.6542654", "0.6311179", "0.62206256", "0.6200415", "0.61735564", "0.61186", "0.6057449", "0.5984768", "0.5965548", "0.59429675", "0.5929845", "0.5915069", "0.5876854", "0.58686477", "0.5866304", "0.5859666", ...
0.65476304
5
Adds a new empty production.
def addNewProduction(self): newProduction = ParametricProduction() newProduction.setGlobals(self.globalDefines) self.productions.append(newProduction) return newProduction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_production(g, prod):\n prods = list(g.productions())\n prods.append(prod)\n\n return CFG(prods)", "def __add__(self, other):\n return Production(self, other)", "def add_empty ( self ):\n self.add_item( 0 )\n self.delete_item()", "def eliminate_unit_productions(self) -> \...
[ "0.6510565", "0.54904515", "0.5418957", "0.5269639", "0.5244652", "0.52325046", "0.51680905", "0.5140562", "0.51313096", "0.51223606", "0.503379", "0.49855718", "0.49611712", "0.49484378", "0.4942469", "0.4886154", "0.48101586", "0.47989944", "0.4791486", "0.47834474", "0.476...
0.6333782
1
Perform a set of iterations of the LSystem
def iterate(self,N = None): result = self.iterate_loop(N) #self.writeToFile() #TODO: We need a timeout for really long executions, but it won't work because it opens another blender instance! Fix this! """ queue = multiprocessing.Queue(1) # Maximum size is 1 proc = multi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n import time\n\n\n for msr in self.msrs:\n # find state transition matrix\n phi_p, state_prop = self._compute_stm(msr.time)\n\n # use stm to propagate perturbation and covariance\n pert_m = np.matmul(phi_p, self.pert_vec[-1])\n co...
[ "0.66005445", "0.6599382", "0.6535561", "0.6529551", "0.62713087", "0.62709314", "0.62124425", "0.6200158", "0.61928564", "0.6149193", "0.6080613", "0.60784876", "0.6033699", "0.5954994", "0.5933657", "0.5933471", "0.59150016", "0.58930504", "0.5889543", "0.5878386", "0.58312...
0.0
-1
Defines compactly a complete lsystem
def toGenomeRepresentation(self): s = "" s += str(self.axiom) s += "||"+str(self.niterations) # The iterations must be shown as well for prod in self.productions: s += "||" s += prod.toGenomeRepresentation() return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLsystemFromFile( filename ):\n\tfp = open(filename, \"r\")\n\tlines = fp.readlines()\n\tfp.close()\n\tlsys = init()\n\tfor line in lines:\n\t\twords = line.split()\n\t\tif words[0] == 'base':\n\t\t\tsetBase(lsys, words[1])\n\t\telif words[0] == 'rule':\n\t\t\taddRule(lsys, words[1:])\n\treturn lsys", "...
[ "0.60046726", "0.57798505", "0.5777421", "0.57441545", "0.5731508", "0.55573076", "0.5503251", "0.5494484", "0.5390676", "0.538684", "0.5380898", "0.53788805", "0.53682077", "0.53663224", "0.5363068", "0.5362513", "0.5357351", "0.535137", "0.5327021", "0.5323201", "0.5297664"...
0.0
-1