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
Testing task 88a class main logic ( input number n, we should check, if 3 is in n^2 number)
def test_task88a_main_logic(number, expected_value): assert algo.Task88a.main_logic(number) == expected_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hackerrank_sample2(self):\n result = find_digits(1012)\n self.assertEquals(result, 3)", "def McNuggets(n):\n a=0\n b=0\n c=0\n result=0\n while result <= n:\n result = 6*a + 9*b + 20*c\n if result > n:\n return False\n elif result == n:\n ...
[ "0.6815618", "0.6747526", "0.67116284", "0.67065483", "0.66427183", "0.6629345", "0.66264", "0.6622884", "0.66047126", "0.6599538", "0.6593787", "0.6577894", "0.65581673", "0.65394294", "0.65285337", "0.65165347", "0.64511865", "0.6333768", "0.6292323", "0.6292261", "0.628967...
0.6000321
59
Testing task 88b class main logic ( input number n, we should revert it)
def test_task88b_main_logic(number, expected_value): assert algo.Task88b.main_logic(number) == expected_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_reversal(self):\n num_in = 6148914691236517205\n num_out = 12297829382473034410L\n assert num_out == reverse_bits(num_in)", "def removedigits(self,n):\r\n if n == 1:\r\n for i in range(30):\r\n self.puzzle[random.randrange(0, 9)][random.randran...
[ "0.58174926", "0.5809923", "0.5797403", "0.57845104", "0.5735457", "0.5731763", "0.5730928", "0.5677225", "0.5660302", "0.56246495", "0.56156933", "0.5614818", "0.5603372", "0.55895674", "0.55864275", "0.55842286", "0.5583921", "0.5581646", "0.5579902", "0.55793625", "0.55772...
0.0
-1
Testing task 88c class main logic (Swaps the first and last digits of number)
def test_task88c(input_value, expected_value): assert algo.Task88c.main_logic(input_value) == expected_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirror(n):\n return (n % 10)*10 + (n // 10)", "def rearrange_digits(input_list):\n sorted_input_list = mergesort(input_list)\n\n # print(sorted_input_list)\n first = ''\n second = ''\n for (index,i) in enumerate(sorted_input_list):\n if index % 2 == 0:\n first = str(i)+fir...
[ "0.6305189", "0.6102487", "0.6020361", "0.5981782", "0.59158003", "0.5864332", "0.5844634", "0.5811378", "0.5800849", "0.5791464", "0.5785829", "0.5774801", "0.56952983", "0.56853944", "0.56847996", "0.5684462", "0.5648192", "0.5635733", "0.5610775", "0.55921423", "0.5577793"...
0.0
-1
Testing task 88d class main logic (Adds the digit 1 to the beginning and end of the number)
def test_task88d(input_value, expected_value): assert algo.Task88d.main_logic(input_value) == expected_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(n):\n digits = [int(x) for x in str(n)]\n for i in reversed(range(len(digits)//2+1)): \n if digits[i] < 9: break \n else: return 10*n + 11\n digits[i] = digits[~i] = digits[i] + 1\n for ii in range(i): \n digits[~ii] = digi...
[ "0.6288158", "0.6280353", "0.6254504", "0.6229598", "0.62141293", "0.62041473", "0.619861", "0.61667", "0.61341643", "0.6107508", "0.60861343", "0.60528815", "0.6035136", "0.603058", "0.6018973", "0.6015653", "0.6008204", "0.59994483", "0.5990106", "0.59878767", "0.5960903", ...
0.0
-1
Attempt to discover a set of trusted certificate authority certificates
def patched_platform_trust(): if sys.platform.lower().startswith('win'): return OpenSSLWindowsCertificateAuthorities() else: return platformTrust()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_trusted_cert_arg(trusted_cert_aliases, trusted_certs_s3_urls):\n aliases = trusted_cert_aliases.split(\",\")\n cert_paths = trusted_certs_s3_urls.split(\",\")\n if len(aliases) != len(cert_paths):\n raise ValueError(\n \"The number of trusted certificate aliases ({}) and truste...
[ "0.63446647", "0.62684494", "0.59983194", "0.5842225", "0.57963777", "0.5716636", "0.5671791", "0.56214213", "0.5601422", "0.55773354", "0.55291754", "0.5517479", "0.5491574", "0.5487893", "0.54788643", "0.5476738", "0.5476738", "0.545969", "0.5453567", "0.5453567", "0.545031...
0.56515014
7
Add native Windows trusted CA database support for SSL certificate validation
def patch_twisted_ssl_root_bug(): import twisted.internet._sslverify as mod mod.platformTrust = patched_platform_trust
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ca():\n return trustme.CA()", "def patched_platform_trust():\n if sys.platform.lower().startswith('win'):\n return OpenSSLWindowsCertificateAuthorities()\n else:\n return platformTrust()", "def get_ssl_certificate() :", "def get_ssl_certificate():", "def _check_ca_certificate(sel...
[ "0.6537825", "0.6306538", "0.61064297", "0.61018604", "0.6087838", "0.5974076", "0.59336966", "0.5890911", "0.587008", "0.5746642", "0.5725484", "0.57119465", "0.57119465", "0.5645386", "0.5623318", "0.561792", "0.56066424", "0.56022567", "0.5596177", "0.5573624", "0.5563138"...
0.5711851
13
Remove a connection from the cache and disconnect it.
def _removeConnection(self, key, connection): # avoid calling loseConnection() when connection is disconnected already. if connection.state != 'CONNECTION_LOST': connection.transport.loseConnection() self._connections[key].remove(connection) del self._timeouts[connection]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n _free_cached_connection(self._connection_hash)", "def del_connection_in_use(self, connection):\n try:\n self._in_use_connections.remove(connection)\n connection.disconnect()\n except Exception as err:\n self.class_logger.warning(\"Error o...
[ "0.74234164", "0.6996256", "0.68567115", "0.6846406", "0.67729926", "0.66850334", "0.66538113", "0.6638969", "0.6531385", "0.64849395", "0.6479783", "0.6466728", "0.6433235", "0.6432185", "0.6367528", "0.63108087", "0.6249286", "0.6247975", "0.62081605", "0.6197693", "0.61974...
0.68955743
2
treq should be lazy imported since importing treq will install reactor. twisted.web.client.HTTPConnectionPool is patched here too.
def get_treq(): patch_twisted_http_connection_pool_bug() import treq return treq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fake_twisted_request(*args, **kwargs):\n kwargs.setdefault(\n 'Request', lambda channel: Request(channel=channel, queued=False))\n request = fake_nevow_request(*args, **kwargs)\n request.finish = lambda: next(request.finish.counter)\n request.finish.counter = itertools.count()\n return re...
[ "0.5803267", "0.5696364", "0.565525", "0.554367", "0.5538993", "0.5526741", "0.55221415", "0.54777414", "0.54584825", "0.54484373", "0.5435534", "0.5435227", "0.5414661", "0.5396609", "0.53723156", "0.53629166", "0.53303", "0.5325433", "0.5303499", "0.5299356", "0.5226295", ...
0.81258976
0
Given an instance retrieve the expected test configurations for instance's datastore.
def expected_instance_datastore_configs(instance_id): instance = instance_info.dbaas.instances.get(instance_id) datastore_type = instance.datastore['type'] datastore_test_configs = CONFIG.get(datastore_type, {}) return datastore_test_configs.get("configurations", {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_configuration_details_from_instance_validation(self):\n print(\"instance_info.id: %s\" % instance_info.id)\n inst = instance_info.dbaas.instances.get(instance_info.id)\n configuration_id = inst.configuration['id']\n print(\"configuration_info: %s\" % configuration_id)\n ...
[ "0.6595712", "0.641086", "0.63042694", "0.59832126", "0.5969446", "0.5716063", "0.56343365", "0.55800563", "0.549223", "0.5459904", "0.5443902", "0.52584755", "0.52367705", "0.52236694", "0.5125736", "0.5114252", "0.51125515", "0.5100617", "0.5088254", "0.50832015", "0.508082...
0.82026744
0
Returns the expected test configurations for the default datastore defined in the Test Config as dbaas_datastore.
def expected_default_datastore_configs(): default_datastore = CONFIG.get('dbaas_datastore', None) datastore_test_configs = CONFIG.get(default_datastore, {}) return datastore_test_configs.get("configurations", {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expected_instance_datastore_configs(instance_id):\n instance = instance_info.dbaas.instances.get(instance_id)\n datastore_type = instance.datastore['type']\n datastore_test_configs = CONFIG.get(datastore_type, {})\n return datastore_test_configs.get(\"configurations\", {})", "def ...
[ "0.778061", "0.63270247", "0.6234825", "0.6132579", "0.5991797", "0.5882307", "0.58755237", "0.58285725", "0.58114976", "0.5798612", "0.5786422", "0.5751315", "0.57506293", "0.57444537", "0.5743285", "0.5723634", "0.5672421", "0.56719977", "0.566023", "0.5647218", "0.5636959"...
0.9044427
0
Test get expected configurations parameters.
def test_expected_configurations_parameters(self): allowed_attrs = ["configuration-parameters"] instance_info.dbaas.configuration_parameters.parameters( instance_info.dbaas_datastore, instance_info.dbaas_datastore_version) resp, body = instance_info.dbaas.client.last_resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetConfig():\n configs = GetConfig()\n # print(configs.host_ip)\n # print(configs.proxy_local)\n \n # print(configs.proxy_online)\n # print(configs.user_img_url)\n # print(configs.user_login_url)\n print(configs.user_start_id)\n\n # assert isinstance(configs.proxy_getter_function...
[ "0.7854843", "0.7627342", "0.73128605", "0.72536445", "0.72494423", "0.7245239", "0.7233371", "0.7131375", "0.71067", "0.7007833", "0.69805443", "0.69788545", "0.6953335", "0.69181114", "0.68901587", "0.6880675", "0.6878724", "0.6844473", "0.6844473", "0.6843554", "0.6812552"...
0.7338024
2
Test create configurations with invalid values.
def test_configurations_create_invalid_values(self): values = '{"this_is_invalid": 123}' try: instance_info.dbaas.configurations.create( CONFIG_NAME, values, CONFIG_DESC) except exceptions.UnprocessableEntity: resp, body = i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_configurations_create_invalid_value_type(self):\n values = '{\"key_buffer_size\": \"this is a string not int\"}'\n assert_unprocessable(instance_info.dbaas.configurations.create,\n CONFIG_NAME, values, CONFIG_DESC)", "def test_configurations_create_value_out_of_...
[ "0.7433865", "0.73964936", "0.71891207", "0.715679", "0.7153514", "0.70355123", "0.6980659", "0.6954836", "0.6950144", "0.69497925", "0.6934946", "0.6908571", "0.68892264", "0.68862695", "0.6879564", "0.68716174", "0.6868052", "0.6838863", "0.68274814", "0.67229503", "0.67174...
0.83784807
0
Test create configuration with invalid value type.
def test_configurations_create_invalid_value_type(self): values = '{"key_buffer_size": "this is a string not int"}' assert_unprocessable(instance_info.dbaas.configurations.create, CONFIG_NAME, values, CONFIG_DESC)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_configurations_create_invalid_values(self):\n values = '{\"this_is_invalid\": 123}'\n try:\n instance_info.dbaas.configurations.create(\n CONFIG_NAME,\n values,\n CONFIG_DESC)\n except exceptions.UnprocessableEntity:\n ...
[ "0.79776704", "0.71556807", "0.7127362", "0.7073835", "0.70391345", "0.6960719", "0.6936632", "0.6775403", "0.6733872", "0.67331606", "0.6680334", "0.665938", "0.6640967", "0.6639813", "0.66186374", "0.66141385", "0.6563347", "0.65561086", "0.65486705", "0.6546909", "0.653990...
0.85598314
0
Test create configuration with value out of bounds.
def test_configurations_create_value_out_of_bounds(self): expected_configs = self.expected_default_datastore_configs() values = json.dumps(expected_configs.get('out_of_bounds_over')) assert_unprocessable(instance_info.dbaas.configurations.create, CONFIG_NAME, values,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creation_outside_bounds():\n with pytest.raises(ValueError) as __:\n value = 42\n __ = param.Integer(value=value, hardbounds=[0, 41])", "def test_creation_incorrect_hardbounds_count():\n with pytest.raises(ValueError) as __:\n value = 1\n __ = pa...
[ "0.73345673", "0.7262614", "0.709626", "0.6822857", "0.6742535", "0.67301244", "0.66877306", "0.6641707", "0.65475726", "0.6366669", "0.63600886", "0.6332785", "0.63235784", "0.62723964", "0.62111956", "0.61827594", "0.61725974", "0.6138109", "0.6133746", "0.6107105", "0.6103...
0.8452791
0
create a configuration with valid parameters from config.
def test_valid_configurations_create(self): expected_configs = self.expected_default_datastore_configs() values = json.dumps(expected_configs.get('valid_values')) expected_values = json.loads(values) result = instance_info.dbaas.configurations.create( CONFIG_NAME, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_config(config: dict):\n pass", "def from_config(cls, config):\n return cls(**config)", "def from_config(cls, config):\n return cls(**config)", "def _from_config(cls, config, **kwargs):\n return cls(config, **kwargs)", "def create_config(self) -> None:\n pass", "def cre...
[ "0.721972", "0.70583075", "0.70583075", "0.6993714", "0.68564224", "0.68564224", "0.6761531", "0.6750268", "0.6700887", "0.6696634", "0.6635214", "0.6633998", "0.6624926", "0.65218216", "0.65006125", "0.6491186", "0.64546716", "0.64507127", "0.642447", "0.64224494", "0.640882...
0.0
-1
test assigning to an instance that does not exist
def test_assign_configuration_to_invalid_instance(self): invalid_id = "invalid-inst-id" try: instance_info.dbaas.instances.modify(invalid_id, configuration_info.id) except exceptions.NotFound: resp, body = instance_info.dba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_nonexist(self):\n promotion = PromotionFactory()\n promotion.id = '1cak41-nonexist'\n try:\n promotion.update()\n except KeyError:\n self.assertRaises(KeyError)", "def test_register_nonexisting_attr(self):\n pass", "def testInstancesMutab...
[ "0.6451093", "0.6351183", "0.612804", "0.60979885", "0.604666", "0.6027651", "0.6007585", "0.59552497", "0.5941977", "0.5896817", "0.5884863", "0.5870055", "0.5869088", "0.5843046", "0.58300275", "0.58188707", "0.5787172", "0.57769924", "0.5766723", "0.576577", "0.575496", ...
0.5941528
9
test assigning a configuration to an instance
def test_assign_configuration_to_valid_instance(self): print("instance_info.id: %s" % instance_info.id) print("configuration_info: %s" % configuration_info) print("configuration_info.id: %s" % configuration_info.id) config_id = configuration_info.id instance_info.dbaas.instances....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_property_success(self):\r\n self.config.option1 = 9001\r\n self.assertEqual(self.config.values['option1'], 9001)\r\n\r\n self.config.option2 = 'bar'\r\n self.assertEqual(self.config.values['option2'], 'bar')", "def test_assign_configuration_to_instance_with_config(self):\...
[ "0.73201257", "0.722626", "0.71452546", "0.71109563", "0.7043339", "0.69083005", "0.68408525", "0.6799425", "0.6775065", "0.6765029", "0.6743073", "0.6678476", "0.66665244", "0.6651853", "0.66037625", "0.66030836", "0.6543711", "0.6542435", "0.64977694", "0.64900345", "0.6489...
0.774803
0
test assigning a configuration to an instance conflicts
def test_assign_configuration_to_instance_with_config(self): config_id = configuration_info.id assert_raises(exceptions.BadRequest, instance_info.dbaas.instances.modify, instance_info.id, configuration=config_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_assign_configuration_to_valid_instance(self):\n print(\"instance_info.id: %s\" % instance_info.id)\n print(\"configuration_info: %s\" % configuration_info)\n print(\"configuration_info.id: %s\" % configuration_info.id)\n config_id = configuration_info.id\n instance_info....
[ "0.7306956", "0.6951928", "0.6661572", "0.6550587", "0.6458475", "0.6450685", "0.6450343", "0.6390336", "0.6361332", "0.63590527", "0.6295276", "0.62598777", "0.6243222", "0.6216796", "0.61950976", "0.6121061", "0.61144525", "0.6114061", "0.60864514", "0.60847384", "0.6062219...
0.7328827
0
validate the configuration after attaching
def test_get_configuration_details_from_instance_validation(self): print("instance_info.id: %s" % instance_info.id) inst = instance_info.dbaas.instances.get(instance_info.id) configuration_id = inst.configuration['id'] print("configuration_info: %s" % configuration_id) assert_not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_config(self):\n pass", "def validate_config(self):\n pass", "def _validate_config(self):\n pass", "def _validate_configurations(self) -> None:\n if self.__exception:\n raise self.__exception", "def _check_config(self):", "def validate(self, config_json)...
[ "0.8094318", "0.8094318", "0.80844444", "0.7277178", "0.7169298", "0.6889779", "0.6840442", "0.68237853", "0.67355216", "0.6715507", "0.66859907", "0.66709626", "0.66045344", "0.660235", "0.65428", "0.6473931", "0.6471287", "0.6402972", "0.6379981", "0.63475996", "0.63244313"...
0.57112384
86
test that the instance shows up on the assigned configuration
def test_configurations_get(self): result = instance_info.dbaas.configurations.get(configuration_info.id) assert_equal(configuration_info.id, result.id) assert_equal(configuration_info.name, result.name) assert_equal(configuration_info.description, result.description) # check th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_instance_with_configuration_active(self):\n\n def result_is_active():\n instance = instance_info.dbaas.instances.get(\n configuration_instance.id)\n if instance.status in CONFIG.running_status:\n return True\n else:\n ass...
[ "0.7277088", "0.6921824", "0.68609273", "0.6858238", "0.6796823", "0.6792561", "0.6737324", "0.672087", "0.66378343", "0.6599362", "0.65892833", "0.6547641", "0.6532229", "0.6530671", "0.65109456", "0.65109456", "0.6502967", "0.64785504", "0.6434362", "0.6398952", "0.6332469"...
0.58004695
77
test that a new instance will apply the configuration on create
def test_start_instance_with_configuration(self): global configuration_instance databases = [] databases.append({"name": "firstdbconfig", "character_set": "latin2", "collate": "latin2_general_ci"}) databases.append({"name": "db2"}) configuration_instance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_instance(self):\n with self.assertRaises(exceptions.NoInitiation):\n Config()", "def test_create(self):\n pass", "def test_assign_configuration_to_valid_instance(self):\n print(\"instance_info.id: %s\" % instance_info.id)\n print(\"configuration_info: %s\"...
[ "0.7183207", "0.6918183", "0.68747693", "0.67909354", "0.66707224", "0.6631046", "0.6573294", "0.655102", "0.64721066", "0.6381421", "0.63577807", "0.63453907", "0.6345164", "0.63238394", "0.6323695", "0.6323695", "0.6323695", "0.6312962", "0.62646854", "0.6260534", "0.624123...
0.7056933
1
wait for the instance created with configuration
def test_instance_with_configuration_active(self): def result_is_active(): instance = instance_info.dbaas.instances.get( configuration_instance.id) if instance.status in CONFIG.running_status: return True else: assert_equal("BU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create(self):\n pass\n\n # create at cluster-provider\n # get kubeconfig\n # wait for api\n # ^ could be async and seperate steps?", "async def _config_async(self):\n pass", "def test_start_instance_with_configuration(self):\n global configuration_instance...
[ "0.6413858", "0.6308735", "0.6107467", "0.5980934", "0.59375745", "0.5925346", "0.5910224", "0.5910224", "0.5906443", "0.5879241", "0.58150035", "0.5814853", "0.58117807", "0.5788292", "0.57844514", "0.5767152", "0.5764334", "0.574734", "0.57401824", "0.57239306", "0.57191616...
0.6520709
0
Test configuration is applied correctly to the instance.
def test_get_configuration_details_from_instance_validation(self): inst = instance_info.dbaas.instances.get(configuration_instance.id) configuration_id = inst.configuration['id'] assert_not_equal(None, configuration_id) _test_configuration_is_applied_to_instance(configuration_instance, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_test(self, test, config_json):\n pass", "def setUpConfig(self):\n pass", "def test_configuration(self):\n self.assertEqual(self.Test.adapter_config['write'],\n { 'adapter': TestAdapter, 'foo': 'bar' })", "def test_applyconfiguration(self):\n\n conf = c...
[ "0.7748661", "0.76830566", "0.71510565", "0.6913224", "0.6853877", "0.68483526", "0.67861223", "0.67814213", "0.6780094", "0.6780094", "0.6780094", "0.6780094", "0.6779864", "0.67668414", "0.6756881", "0.67367697", "0.6659878", "0.6659878", "0.66568047", "0.6648695", "0.66060...
0.0
-1
test to unassign configuration from instance
def test_unassign_configuration_from_instances(self): instance_info.dbaas.instances.update(configuration_instance.id, remove_configuration=True) resp, body = instance_info.dbaas.client.last_response assert_equal(resp.status, 202) instance_inf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deconfigure(self):\n\n pass", "def test_unassign_configuration_after_patch(self):\n instance_info.dbaas.instances.update(instance_info.id,\n remove_configuration=True)\n assert_equal(202, instance_info.dbaas.last_http_code)\n instance = ...
[ "0.7048801", "0.6946879", "0.6614459", "0.649544", "0.6400702", "0.63704515", "0.6354921", "0.63240206", "0.63082576", "0.63082576", "0.63082576", "0.63082576", "0.63082576", "0.63082576", "0.63082576", "0.63082576", "0.63082576", "0.63082576", "0.6148849", "0.6103507", "0.61...
0.7414041
0
test that after restarting the instance it becomes active
def test_restart_service_should_return_active(self): instance_info.dbaas.instances.restart(instance_info.id) resp, body = instance_info.dbaas.client.last_response assert_equal(resp.status, 202) def result_is_active(): instance = instance_info.dbaas.instances.get( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_workflows_restart(self):\n pass", "def restart(self) -> None:", "def restart(self):", "def test_update_instances_schedule_state(self):\n pass", "def restart(self):\r\n pass", "def restart(self):\n pass", "def test_relaunch_deployment_run(self):\n pass", "de...
[ "0.7256215", "0.696777", "0.69622266", "0.68948066", "0.6872024", "0.68592834", "0.6850953", "0.67642987", "0.66722554", "0.6623265", "0.6588452", "0.64710295", "0.6453188", "0.64142096", "0.63846517", "0.6372318", "0.6364346", "0.6354914", "0.6351463", "0.635094", "0.6344332...
0.7464111
0
Remove the configuration from the instance
def test_unassign_configuration_after_patch(self): instance_info.dbaas.instances.update(instance_info.id, remove_configuration=True) assert_equal(202, instance_info.dbaas.last_http_code) instance = instance_info.dbaas.instances.get(instance_info.id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deconfigure(self):\n\n pass", "def clear(self):\r\n del self.__config\r\n self.__config = {}\r\n self.save()", "def discard_config(self):\n raise NotImplementedError", "def deconfigure(self):\n\n self.platform.deconfigure()", "def remove_config_object() -> None...
[ "0.77284014", "0.72562224", "0.7217004", "0.6990578", "0.69849384", "0.6907566", "0.6721982", "0.6715369", "0.6702921", "0.6569719", "0.6504481", "0.6489011", "0.645405", "0.6445797", "0.63767695", "0.6362307", "0.6354743", "0.6340079", "0.629973", "0.627267", "0.6224767", ...
0.63077646
18
Saves training statistics to Tensorboard.
def write_summary(summary_writer, episode, all_agents_episode_reward): summary = tf.Summary() summary.value.add(tag='all_agents_episode_reward', simple_value=all_agents_episode_reward) #summary.value.add(tag='all_agents_episode_reward', simple_value=all_agents_episode_reward) summary...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_training_metrics(self) -> None:\n self.trainer_metrics.write_training_metrics()", "def save_metrics(self):\n self.data_stats.write.format(\"org.apache.spark.sql.cassandra\").mode(\"append\").options(table=self.cassandra_stats_table, keyspace=self.cassandra_keyspace).save()\n print ...
[ "0.75096583", "0.7211596", "0.70696545", "0.6998508", "0.69289213", "0.68915075", "0.68635535", "0.67728406", "0.6752811", "0.66333526", "0.6493239", "0.6422247", "0.641128", "0.63652384", "0.63617915", "0.6360104", "0.631111", "0.63079447", "0.62764376", "0.62493044", "0.624...
0.0
-1
Creates and runs training episode
def run(self): data_provider = DataProvider(self.config) hex_attr_df = data_provider.read_hex_bin_attributes() hex_distance_df = data_provider.read_hex_bin_distances() city_states = data_provider.read_city_states(self.city_states_filename) neighborhood = data_provider.read_neighb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(n_episodes=1000, max_n_steps=300, eps_start=1.0, eps_end=0.01, eps_decay=0.995, strCheckpointFile='checkpoint.pth'):\n\n global env\n scores = [] # list containing scores from each episode\n scores_window = deque(maxlen=100) # last 100 scores\n eps = eps_start # initialize epsilon\n num...
[ "0.69895226", "0.6918572", "0.6881398", "0.68469167", "0.67953247", "0.6751099", "0.67229265", "0.6722295", "0.6702173", "0.6629002", "0.66240805", "0.6619617", "0.6615569", "0.6597727", "0.65905917", "0.6578193", "0.65754354", "0.65655774", "0.6553282", "0.6544957", "0.65398...
0.63512284
34
Serializer for rest entities.
def rest_format(entity): if isinstance(entity, datetime.datetime): if entity.utcoffset() is not None: entity = entity - entity.utcoffset() return int(calendar.timegm(entity.timetuple()) * 1000 + entity.microsecond / 1000) elif isinstance(entity, list): return json.dumps([ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSerializer():", "def serializer_class(self):", "def json(self):\n if self.resource:\n return jsonify(self.resource)\n return jsonify({'id': self.id})", "def get_serializer(self, *args, **kwargs):\n kwargs['part_detail'] = True\n kwargs['location_detail'] = True\n...
[ "0.6882212", "0.68215704", "0.63747984", "0.6332871", "0.6106284", "0.61036044", "0.6091098", "0.60572743", "0.6037072", "0.6037072", "0.6031064", "0.60207045", "0.601788", "0.6005014", "0.59965926", "0.5994282", "0.5994044", "0.5969976", "0.5953127", "0.59487045", "0.5940530...
0.6303647
4
urljoin replaces base_url's path if endpoints start with with /
def test_endpoints_urljoin(self): for endpoint in self.client.user.endpoints.values(): assert not endpoint.startswith('/')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urljoin(base, *path):\n return reduce(_join, path, base)", "def urljoin(cls, base, end):\n\n if base and not base.endswith('/'):\n base = base + '/'\n return urljoin(base, str(end))", "def urljoin(cls, base, end):\r\n if base and not base.endswith(\"/\"):\r\n b...
[ "0.82374907", "0.8162815", "0.81212187", "0.79887116", "0.7946308", "0.79049665", "0.78104043", "0.76742834", "0.7556705", "0.7537379", "0.7511424", "0.7474246", "0.74705774", "0.74505424", "0.7418653", "0.7378205", "0.737034", "0.7370095", "0.7353267", "0.72845113", "0.72163...
0.63997936
44
Return a given noise sim. Provide either 'psa' or all of 'season', 'pa', and 'patch' . Will return a stack of enmaps with shape [n_freqs, 3, Ny, Nx], where the second element has the elements (T, Q, U). n_freqs will be 1 for pa1 and pa2.
def getActpolSim(iterationNum = 0, patch = 'deep5', season = 's13', \ array = 'pa1', \ psa = None,\ noiseDictFile = 'templateInputsMr3c.dict', \ noiseDictFilePath = os.path.join(os.path.dirname(os.path.abspath(__file__)),'../inputPara...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_many_fits(spectrum,rms,guesses,nruns):\n tk_fit = []\n tex_fit = []\n ntot_fit = []\n width_fit = []\n for i in range(nruns):\n noisy_spectrum = add_noise(spectrum,rms)\n noisy_spectrum.specfit(fittype='cold_ammonia',guesses=guesses,fixed=[F,F,F,F,F,T])\n parcopy =...
[ "0.5349266", "0.534863", "0.5337738", "0.5226224", "0.5186345", "0.5164142", "0.5131979", "0.5094437", "0.50330424", "0.5022629", "0.5019019", "0.49728072", "0.49429372", "0.4927111", "0.49185708", "0.49174252", "0.491209", "0.48873687", "0.4871158", "0.486897", "0.48670015",...
0.6391047
0
The relative weight is used to determine how much we want to see the data of this VM.
def update_relative_weight(self): self.relative_weight = 1 # Add up all of the historical cpu datapoints (higher CPU = more weight) for i in self.cpu_datapoints: self.relative_weight += i # Multiply by the status value (so VMs with red alarm have most weight) self.rel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(self):\n return self._base.weight", "def get_weight(self):\n pass", "def get_weight(self):\n pass", "def weight(self):\r\n return self._weight", "def weight(self) -> float:\r\n return self._weight", "def weight(self):", "def weight(self):\n return se...
[ "0.76758707", "0.75917065", "0.75917065", "0.7509697", "0.7506455", "0.74212307", "0.74037105", "0.74037105", "0.74037105", "0.7399485", "0.7393575", "0.7339185", "0.7339185", "0.7282254", "0.72358805", "0.7191375", "0.7191375", "0.7191375", "0.7191375", "0.7191375", "0.71913...
0.77360976
0
Simple error handling to output message in JSON.
def output_message(message): print message return json.dumps({"vms": [{"error": message}]}, indent=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_error(message):\n return json_response(isError=True, message=message)", "def json_err(msg: str) -> Response:\n return jsonify({\"success\": False, \"error\": msg})", "def _Error(message):\n return json.dumps({\n 'success': False,\n 'error': message,\n })", "def output_message(messa...
[ "0.8168176", "0.8111271", "0.7917972", "0.78989154", "0.73067904", "0.7293762", "0.7265825", "0.7260078", "0.7100166", "0.7074734", "0.7051431", "0.7050313", "0.70240587", "0.7013287", "0.70030206", "0.6978571", "0.6978571", "0.6966607", "0.6955499", "0.6948813", "0.69310826"...
0.7077959
9
This is the main function. It will connect to the vCenter server, obtain perf data and output json
def generate_json(vmware_monitor): global server if not server.is_connected(): try: server.connect(VCENTER_SERVER, VCENTER_USERNAME, VCENTER_PASSWORD) except Exception as error: vmware_monitor.json = output_message("Error connecting to vCenter server" + error.message) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n mvip, user, user_pass, mvip_node = get_inputs()\r\n payload = build_payload()\r\n headers, url = build_auth(mvip, user, user_pass, mvip_node)\r\n response_json = connect_cluster(headers, url, payload)\r\n paired_vols = get_replication_status(response_json)\r\n payload = get_vol_st...
[ "0.72526777", "0.6615053", "0.64513654", "0.6322624", "0.6305242", "0.6293527", "0.6285189", "0.6199369", "0.6193257", "0.61887294", "0.6167653", "0.6165325", "0.6135984", "0.6133732", "0.60920906", "0.608006", "0.6055071", "0.60381323", "0.6032247", "0.6027444", "0.5989539",...
0.57714283
41
Using the HP 214B, see what the DIL is.
def limit(): fig, ax = plt.subplots() fname = "1_lim_dye.txt" folder = os.path.join("..", "2018-09-29") fname = os.path.join(folder, fname) limit_scan(fname, ax) fname = "2_lim_dye.txt" folder = os.path.join("..", "2018-09-29") fname = os.path.join(folder, fname) limit_scan(fname, ax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hilfe(self):\n sDreieck_hilfe(3)", "def 100MbHd(self):\n\t\treturn self._get_attribute('100MbHd')", "def get_nh_tun_dip(self):\n return int(self.get('nhr_tun_dip'))", "def dis(self):\n return self.nlegomena(2)", "def get_number_of_soil_levels(description):\n if description == \"...
[ "0.5378886", "0.53230643", "0.532024", "0.51799697", "0.51531583", "0.5151014", "0.5138483", "0.51215535", "0.50883967", "0.5087422", "0.5077211", "0.50666606", "0.50648385", "0.505127", "0.50236315", "0.5022597", "0.5021465", "0.5016764", "0.49618086", "0.49615175", "0.49303...
0.0
-1
Using the dye laser at 180 GHz, the MW f is scanned over the cavity resonances, finding center, FWHM, and Q values.
def cavity_resonances(): fig, axes = plt.subplots() folder = os.path.join("..", "2018-09-29") fname = "3_fscan.txt" fname = os.path.join(folder, fname) mw_fscan(fname, -1, axes) axes.axhline(0.9, c='k') fig.tight_layout() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mwion_scan():\n fig, ax = plt.subplots()\n # Data from 2018-09-27, using the SFIP\n fname = \"4_mwion_blnk.txt\" # -180 GHz\n folder = os.path.join(\"..\", \"2018-09-29\")\n fname = os.path.join(folder, fname)\n data = pd.read_csv(fname, sep=\"\\t\", comment=\"#\")\n data['r'] = data['s1'...
[ "0.6064495", "0.5878037", "0.58687", "0.58565015", "0.58228654", "0.5680766", "0.5676266", "0.5649586", "0.56221026", "0.55221057", "0.550911", "0.5495786", "0.5488341", "0.5469519", "0.54619396", "0.54504097", "0.5449331", "0.5435872", "0.54289246", "0.54144907", "0.5391044"...
0.500826
98
Take ratios of MW on / MW off to get ionization rate at different values of the Variable Attenuator
def mwion_scan(): fig, ax = plt.subplots() # Data from 2018-09-27, using the SFIP fname = "4_mwion_blnk.txt" # -180 GHz folder = os.path.join("..", "2018-09-29") fname = os.path.join(folder, fname) data = pd.read_csv(fname, sep="\t", comment="#") data['r'] = data['s1']/data['s2'] data['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_wdiff(self):\n try:\n self.wdiff=self.mdiff*self.ws.coef[1]\n except:\n self.wdiff=self.mdiff", "def ventilation_rate(self):\n # TODO: calculate based on MERV ratings/efficiency/power/etc.\n return (\n sum(v.calculate_ach(self.volume) for v in self...
[ "0.5724092", "0.57147384", "0.57147056", "0.5699352", "0.569743", "0.56841946", "0.5673837", "0.56293803", "0.56123024", "0.5608617", "0.5603243", "0.55872136", "0.55722046", "0.5559003", "0.5518091", "0.5449566", "0.5444566", "0.54309285", "0.542473", "0.5420982", "0.5413419...
0.0
-1
Return a URL to redirect the user to for OAuth authentication.
def authorize_url(self): auth_url = OAUTH_ROOT + '/authorize' params = { 'client_id': self.client_id, 'redirect_uri': self.redirect_uri, } return "{}?{}".format(auth_url, urlencode(params))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAuthRedirectUrl(self):\n url = ('https://foursquare.com/oauth2/authenticate' +\n '?client_id=' + self.cfg('client_id') +\n '&response_type=code' + \n '&redirect_uri=' + self.cfg('callback'))\n return url", "def auth_url(self):\n return_url = s...
[ "0.7715835", "0.765731", "0.7414582", "0.7319085", "0.7271399", "0.7268403", "0.72574794", "0.7226456", "0.72241175", "0.71897054", "0.7189668", "0.7074997", "0.7049519", "0.698674", "0.6955335", "0.69383276", "0.69312274", "0.6917746", "0.6883517", "0.6828134", "0.68101203",...
0.75158864
2
Exchange the authorization code for an access token.
def exchange_token(self, code): access_token_url = OAUTH_ROOT + '/access_token' params = { 'client_id': self.client_id, 'client_secret': self.client_secret, 'redirect_uri': self.redirect_uri, 'code': code, } resp = requests.get(access_token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_code(self, code):\n data = {\n 'client_id': self.client_id,\n 'client_secret': self.client_secret,\n 'grant_type': 'authorization_code',\n 'code': code,\n 'redirect_uri': self.redirect_uri,\n 'scope': 'identify'\n }\n\n ...
[ "0.7655848", "0.72651523", "0.7153681", "0.71138126", "0.70811975", "0.7071909", "0.7048902", "0.7033969", "0.70338416", "0.69557816", "0.6936204", "0.6890346", "0.6886055", "0.68474656", "0.68372333", "0.6788539", "0.67677724", "0.67472637", "0.67402524", "0.66617274", "0.66...
0.78054535
0
Depending on the data available when the instance was created, it may be necessary to fetch data.
def sections(self): if self._sections is None: self._load() return self._sections
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_data(self):\n pass", "def fetch(self):\n pass", "def fetch(self):\n pass", "def fetch(self):\n raise NotImplementedError()", "def fetch_data(self):", "def prepare_data(self):", "def fetch(self) -> None:\n pass", "def _load(self):\n entity: dict = s...
[ "0.73714876", "0.67429495", "0.67429495", "0.6691442", "0.66398287", "0.66221267", "0.6526471", "0.6496337", "0.6489389", "0.6489389", "0.64677316", "0.6444079", "0.6438012", "0.6391575", "0.6374911", "0.6321516", "0.6319836", "0.6312477", "0.62334055", "0.62228936", "0.61955...
0.0
-1
May hit server. See Cloudcast.sections
def description(self): if self._description is None: self._load() return self._description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_agent():", "def onConnect(self, request_or_response):", "def on_server_start(self, server):\n pass", "def server():", "def server():", "def on_server_start(self):\n raise NotImplementedError", "def __InitCutSpecs(self, server_url):\n cut_spec_list = self._publish_helper.GetC...
[ "0.53935707", "0.5312162", "0.5286659", "0.5255948", "0.5255948", "0.5204778", "0.5133544", "0.51161766", "0.5111437", "0.5080685", "0.50246394", "0.5020504", "0.50069565", "0.4991341", "0.4967803", "0.49366564", "0.48987773", "0.48854232", "0.4880621", "0.48805633", "0.48495...
0.0
-1
initialize the plugin control. Function gets called even when plugin is inactive
def __init__(self, iface): QObject.__init__(self) self.iface = iface
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def control_plugin(self):\n pass", "def init(): \n\tset_verbosity()\n\t_set_threads()\n\t_set_heartbeat()\n\t#_set_storage()\n\t\n\tinit_targets()\n\t\n\tsend_heartbeat(start=True)\n\t\n\tinfo_msg = \"init plugin script\"\n\tlogger.info(info_msg)\n\n\tinit_plugin()\n\n\tinfo_msg = \"loaded %s plugin...
[ "0.7538625", "0.74492675", "0.7026882", "0.698795", "0.69407874", "0.68968344", "0.68321264", "0.6829527", "0.6704338", "0.6692178", "0.6689962", "0.6669781", "0.66691786", "0.66323197", "0.66221416", "0.66221416", "0.6621397", "0.66109675", "0.658712", "0.6586253", "0.657325...
0.0
-1
Optimise & Modifiy s3xml etree to and produce s3ocr etree
def s3ocr_etree(self): s3xml_etree = self.resource.struct(options=True, references=True, stylesheet=None, as_json=False, as_tree=True) # xml tags ITEXT = "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_s3_xsl(**kwargs):\n access_id = kwargs.get(\"access_id\")\n access_secret = kwargs.get(\"access_secret\")\n bucket = kwargs.get(\"bucket\")\n dest_prefix = kwargs.get(\"destination_prefix\")\n source_prefix = kwargs.get(\"source_prefix\")\n if kwargs.get(\"dag\"):\n run_id = ...
[ "0.6150906", "0.51852006", "0.508772", "0.50787896", "0.50765", "0.5073153", "0.5026106", "0.50156415", "0.49646425", "0.49586073", "0.4957999", "0.4951361", "0.4915427", "0.49097997", "0.48692062", "0.48484707", "0.4826902", "0.47564453", "0.47277948", "0.47235677", "0.47011...
0.6966398
0
Produces OCR Compatible PDF forms
def pdf_manager(self): s3ocr_root = self.s3ocr_etree() # get element s3xml # define font size titlefontsize = 18 sectionfontsize = 15 regularfontsize = 13 hintfontsize = 10 # etree labels ITEXT = "label" HINT = "comment" TYPE = "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_pdf(self, imageFileName, outFileName, fontname=\"Times-Roman\", fontsize=10, withVisibleOCRText=False, withVisibleImage=True, withVisibleBoundingBoxes=False):\n if self.hocr is None:\n # warn that no text will be embedded in the output PDF\n print \"Warning: No hOCR file specified. PDF will be ...
[ "0.71103066", "0.6850961", "0.620784", "0.6170736", "0.6110796", "0.60865885", "0.6054647", "0.6042758", "0.6038035", "0.6037029", "0.60323054", "0.59971327", "0.5987923", "0.598557", "0.59637684", "0.59621507", "0.5960972", "0.59477437", "0.59177977", "0.5907321", "0.587861"...
0.62864804
2
Update custom fieldtype specific settings into the etree
def __update_custom_fieldtype_settings(self, eachfield, #field etree ): # xml attributes TYPE = "type" READABLE = "readable" WRITABLE = "writable" LABEL = "label" HINT = "comment" DEFAU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update_custom_field_settings(self,\n eachfield, #field etree\n resourcetablename,\n fieldname\n ):\n\n # xml attributes\n TYPE = \"type\"\n ...
[ "0.72086793", "0.5807909", "0.53538555", "0.5347925", "0.53453594", "0.52939373", "0.5225218", "0.521721", "0.521721", "0.521721", "0.521721", "0.521721", "0.517917", "0.51706946", "0.51572657", "0.5152697", "0.513768", "0.5122455", "0.5120483", "0.51168615", "0.5108007", "...
0.78392935
0
Update custom field specific settings into the etree
def __update_custom_field_settings(self, eachfield, #field etree resourcetablename, fieldname ): # xml attributes TYPE = "type" READABLE = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update_custom_fieldtype_settings(self,\n eachfield, #field etree\n ):\n\n # xml attributes\n TYPE = \"type\"\n READABLE = \"readable\"\n WRITABLE = \"writable\"\n LABEL = \"label\"\n HINT = \...
[ "0.7209946", "0.5625204", "0.55950165", "0.5523595", "0.54563826", "0.5431626", "0.53579104", "0.5331359", "0.5295891", "0.5295891", "0.5295891", "0.5295891", "0.5295891", "0.5272213", "0.5268226", "0.52631927", "0.5263186", "0.52535546", "0.52160764", "0.52101666", "0.517815...
0.72390586
0
Sequence of components is returned as a list
def __rheader_tabs_sequence(self, resourcename): component_seq = [] component_l10n_dict = {} rtabs = self.rheader_tabs for eachel in rtabs: if eachel[1] != None: component_seq.append(eachel[1]) component_l10n_dict[eachel[1]] = eachel[0].decode("ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def components(self):\r\n return list(self._components)", "def components(self):\n return self._components", "def components(self):\n comps = []\n for rx in self.source_field.receiver_list:\n comps += rx.components\n return comps", "def components(self):\n return ...
[ "0.83249015", "0.75074756", "0.7326647", "0.726829", "0.726829", "0.7225893", "0.72074807", "0.72074807", "0.72027194", "0.72027194", "0.69295657", "0.69187224", "0.67903036", "0.67144316", "0.6710612", "0.66885436", "0.66767395", "0.66645396", "0.6651395", "0.66495377", "0.6...
0.0
-1
Helper to trim off any enclosing paranthesis
def __trim(self, text): if isinstance(text, str) and \ text[0] == "(" and \ text[-1] == ")": text = text[1:-1] return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeOuterParentheses(self, S):\n _open, _close = \"(\", \")\"\n oc, cc = 0, 0\n part, res = \"\", \"\"\n\n for i, p in enumerate(S):\n if p == _open:\n oc += 1\n elif p == _close:\n cc += 1\n\n part += p\n\n ...
[ "0.73211086", "0.7262523", "0.7182982", "0.710938", "0.68146855", "0.67114186", "0.66600233", "0.6646801", "0.66210675", "0.63920456", "0.6388178", "0.6297051", "0.6198644", "0.61323136", "0.6124953", "0.6042619", "0.6026883", "0.59085965", "0.58875585", "0.58423495", "0.5814...
0.7543117
0
Generate barcode of uuid
def barcode(self, uuid): barcode = code128.Code128(str(uuid), barWidth=1, barHeight=20) barcode.drawOn(self.canvas, self.lastx, self.lasty) self.lasty = self.lasty - 20 self.y = self.lasty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_barcode_upce(self):\n pass", "def gen_uuid() -> str:\n return str(uuid4())", "def gen_uuid():\n return str( uuid.uuid4() )", "def gen_uuid():\n return str( uuid.uuid4() )", "def gen_uuid():\n return str(uuid.uuid4())", "def test_generate_barcode_qr_code(self):\n ...
[ "0.7014342", "0.6803592", "0.6756756", "0.6756756", "0.67063415", "0.66737944", "0.6648601", "0.6631629", "0.65757394", "0.6569812", "0.6564768", "0.6560364", "0.6551317", "0.65252805", "0.6519483", "0.64701307", "0.6449104", "0.6431399", "0.63647515", "0.63552344", "0.634510...
0.70955324
0
Decorates the the form with the markers needed to align the form later
def decorate(self): c = self.canvas c.rect(20, 20, 20, 20, fill=1) # bt lf c.rect(self.width - 40, 20, 20, 20, fill=1) # bt rt c.rect(20, self.height - 40, 20, 20, fill=1) # tp lf c.rect(self.width/2 - 10, 20, 20, 20, f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_info_pane(self):\n self.param_layout = QtWidgets.QFormLayout()\n self.param_layout.addRow(QtWidgets.QLabel(\"<b>Beam Parameters</b>\"))\n self.param_layout.addRow(QtWidgets.QLabel(\"<i>(all radii are 1/e<sup>2</sup>)</i>\"))\n self.param_layout.addRow(QtWidgets.QWidget())\n ...
[ "0.5889768", "0.56807333", "0.54529166", "0.5433139", "0.5364859", "0.5307656", "0.5294832", "0.5239281", "0.52261335", "0.51892585", "0.51808476", "0.5134926", "0.51180494", "0.51014", "0.507253", "0.5062814", "0.5055471", "0.5048222", "0.50481534", "0.50334847", "0.50271285...
0.53835815
4
Give the lines to be printed as a list, set the font and grey level
def print_text(self, lines, fontsize=13, gray=0, seek=0, continuetext=0, style="default"): self.fontsize = fontsize self.gray = gray if not continuetext and not self.pagebegin: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _processLine(self, line):\r\n actual = []\r\n i = 0 # Where we're at in the list.\r\n for chunk in re.split(self.colourRe, line):\r\n if not i: # Chunk is to be printed.\r\n actual.append(chunk)\r\n elif i == 1: #This is the colour string to be replaced.\r\n line = line.replace(chunk, '')\r\n el...
[ "0.69209313", "0.6801368", "0.65103096", "0.6326998", "0.6304809", "0.62688285", "0.61521924", "0.61188495", "0.6079596", "0.600978", "0.5984168", "0.5942742", "0.59410363", "0.59023833", "0.5894867", "0.5870124", "0.58687025", "0.58591884", "0.5850511", "0.5845156", "0.58450...
0.57493615
28
Writes one character on canvas
def writechar(self, char=" "): font=self.selectfont(char) t = self.canvas.beginText(self.x, self.y) t.setFont(font, self.fontsize) t.setFillGray(self.gray) t.textOut(char) self.canvas.drawText(t) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writechar(self, char: int, /) -> None:", "def point(self, x, y, char):\n assert len(char) == 1\n assert x >= 0\n assert x < self.cols\n assert y >= 0\n assert y < self.lines\n\n self.canvas[y][x] = char", "def draw(self, x, y, char=None, fg=(255, 255, 255), bg=None...
[ "0.73790383", "0.7066766", "0.68195283", "0.6806944", "0.67353094", "0.67342776", "0.6577753", "0.657208", "0.65341264", "0.63544863", "0.62962973", "0.6283854", "0.6271442", "0.62612313", "0.6221333", "0.61874944", "0.6184578", "0.61663246", "0.61465734", "0.6140425", "0.603...
0.7528636
0
Moves the y cursor down one line
def nextline(self, fontsize=0): if fontsize != 0: self.fontsize = fontsize if self.pagebegin == 0: self.y = self.y - (self.fontsize + self.linespacing) if self.y < self.margintop: self.set_new_page() self.pagebegin = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_down(self):\n self.y -= 1", "def down():\n global y, canvas # y é modificado\n canvas.create_line(x, y, x, y + 10)\n y += 10", "def move_down(self):\n\n if self.ycor() < -280:\n self.sety(-300)\n else:\n new_y = self.ycor() - 40\n ...
[ "0.77307236", "0.74918664", "0.7345495", "0.7278264", "0.720714", "0.6866249", "0.68256307", "0.68138885", "0.67725194", "0.6758919", "0.67446613", "0.67111486", "0.66705567", "0.6626607", "0.6626268", "0.6555517", "0.6534377", "0.64906883", "0.6479359", "0.64725524", "0.6413...
0.0
-1
Moves the x cursor with offset
def resetx(self, offset=0, seek=None): if seek == None: self.x = self.marginsides + offset else: self.x += seek lastvalidx = self.width - (self.marginsides + (self.fontsize / 2)) writablex = self.width - (2 * self.marginsides) if self.x > lastvalidx: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveOffset(self,x,y):\n\t\ttry:\n\t\t\tassert(type(x)) == int\n\t\t\tassert(type(y)) == int\n\t\t\tself.actionObject().move_by_offset(x,y).perform()\n\t\texcept Exception as e:\n\t\t\tprint(f\"{bcolors.FAIL}[!] Failed to move cursor.\\n{bcolors.ENDC}\")\n\t\t\tprint(\"{}\".format(e))\n\t\t\treturn -1", "def ...
[ "0.74626994", "0.7450069", "0.72059727", "0.72001314", "0.7079755", "0.70654345", "0.69329727", "0.68054104", "0.6768366", "0.67312205", "0.67191005", "0.6697998", "0.66977483", "0.66903126", "0.66565937", "0.66522527", "0.6636908", "0.661386", "0.6609151", "0.65872264", "0.6...
0.6456289
26
Helper function, unscape any html special characters
def __html_unescape(self, text): return re.sub("&(%s);" % "|".join(name2codepoint), lambda m: unichr(name2codepoint[m.group(1)]), text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HtmlUnescape(text):\n def fixup(m):\n text = m.group(0)\n if text[:2] == \"&#\":\n # character reference\n try:\n if text[:3] == \"&#x\":\n return unichr(int(text[3:-1], 16))\n else:\n return unichr(int(text[2:-1]))\n except ValueError:\n pass\n ...
[ "0.7573651", "0.7364295", "0.7331905", "0.7253137", "0.72181624", "0.71190745", "0.7084132", "0.70779747", "0.70685714", "0.7064826", "0.7025266", "0.7018884", "0.69066876", "0.68993235", "0.6868041", "0.68646187", "0.681538", "0.68096876", "0.67958766", "0.67727417", "0.6755...
0.67851436
19
Moves the y cursor down by given units
def linespace(self, spacing=2): if self.pagebegin == 0: self.y -= spacing self.pagebegin = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_down(self):\n self.y -= 1", "def move_down(self):\n\n if self.ycor() < -280:\n self.sety(-300)\n else:\n new_y = self.ycor() - 40\n self.sety(new_y)", "def moveDown():\n tt.right(90)\n tt.forward(60)\n tt.right(90)\n tt.forward(250)\n ...
[ "0.7722293", "0.7466162", "0.7184463", "0.7060244", "0.701929", "0.700755", "0.6916313", "0.68742716", "0.66979045", "0.6689104", "0.6673814", "0.6659693", "0.6582511", "0.65576077", "0.6543806", "0.65316916", "0.6517288", "0.64817727", "0.64633125", "0.6456213", "0.6456124",...
0.0
-1
Select font according to the input character
def selectfont(self, char): charcode = ord(char) for font in fontchecksequence: for fontrange in fontmapping[font]: if charcode in xrange(fontrange[0], fontrange[1]): return font return "Helvetica" # fallback, if no thirdparty font is installed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectFont():\n font,ok = QtGui.QFontDialog.getFont()\n if ok:\n return font\n else:\n return None", "def get_font(self, option):\n return get_font(option=option)", "def comdlg32_ChooseFont(jitter, get_str, set_str):\n ret_ad, args = jitter.func_args_stdcall([\"lpcf\"])\n ...
[ "0.71344846", "0.6802239", "0.6530128", "0.6522377", "0.6478366", "0.64376915", "0.6403912", "0.6403912", "0.6403912", "0.63943005", "0.63856626", "0.63823503", "0.63529533", "0.6318125", "0.6304441", "0.62798864", "0.6212459", "0.62093073", "0.6207095", "0.61832416", "0.6175...
0.8041888
0
Function to draw check boxes default no of boxes = 1
def draw_check_boxes(self, boxes=1, completeline=0, lines=0, seek=0, continuetext=0, fontsize=15, gray=0, style="", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_checkboxes(self):\n self.create_y_crop_box()", "def draw(self, surface):\n for box in self.checkboxes:\n box.draw(surface)", "def _create_checkboxes(self) -> widgets.VBox:\n checkboxes = []\n pgons_checkboxes = []\n graph_checkboxes = []\n\n graph...
[ "0.6706593", "0.62596804", "0.5975192", "0.57803637", "0.5758032", "0.5719117", "0.5667263", "0.5657341", "0.5637688", "0.5620014", "0.5609665", "0.5569312", "0.5564542", "0.55392426", "0.5529903", "0.55119216", "0.5509527", "0.54798144", "0.5429685", "0.5427229", "0.541907",...
0.71929073
0
Draw circles on the form
def draw_circle(self, boxes=1, completeline=0, lines=0, seek=0, continuetext=0, fontsize=0, gray=0, style=""): c = self.canvas c.setLineWidth(0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_circle(c):\n turtle.circle(c.radius)", "def draw_circle(c):\n turtle.circle(c.radius)", "def draw(self):\r\n arcade.draw_circle_filled(self.center.x, self.center.y, self.radius, TARGET_COLOR)", "def draw(self):\n if self.is_clicked:\n pg.draw.circle(self.window, self.c...
[ "0.7249896", "0.7249896", "0.7189372", "0.7115165", "0.7111092", "0.69933903", "0.69777113", "0.69707626", "0.69310564", "0.692889", "0.6890434", "0.685327", "0.6820816", "0.68044144", "0.68034935", "0.6779196", "0.67732954", "0.675049", "0.67363393", "0.6729557", "0.67272913...
0.699794
5
Function to draw a straight line
def draw_line(self, gray=0, nextline=0): self.fontsize = 4 if nextline: self.nextline() else: self.linespace(8) self.resetx() c = self.canvas c.setStrokeGray(gray) c.setLineWidth(1) #self.y = self.y + self.linespacing + (self.fonts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DrawLine(*args, **kwargs):\n return _gdi_.PseudoDC_DrawLine(*args, **kwargs)", "def draw_line(self, x0, y0, x1, y1, color=Color['white']):\n pygame.draw.line(self.display, color, (x0, y0), (x1, y1))", "def DrawLine(*args, **kwargs):\n return _gdi_.DC_DrawLine(*args, **kwargs)", "def ...
[ "0.7746539", "0.7608448", "0.7524277", "0.747525", "0.7469992", "0.74549323", "0.74070466", "0.7299705", "0.72944117", "0.7292102", "0.7289104", "0.7271509", "0.7263645", "0.72484", "0.72240627", "0.7220985", "0.72052413", "0.716304", "0.7162634", "0.7149132", "0.7143844", ...
0.73168623
7
All changes are forgotten when a showPage() has been executed. They have to be set again.
def set_new_page(self): self.num += 1 c = self.canvas c.showPage() self.decorate() self.x = self.marginsides self.lastx = self.marginsides self.y = self.height - self.margintop #self.print_text(["Page %s" % unicode(self.num)], fontsize=8, # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_changed(self):\n if self.current >= 0:\n if self.not_again:\n self.not_again = False\n return\n ok = self.check_oldpage(self.current)\n if not ok:\n self.not_again = True\n self.nb.setCurrentIndex(self.curr...
[ "0.70605916", "0.6955794", "0.6765878", "0.6572109", "0.6186676", "0.61688864", "0.61620325", "0.60944754", "0.60944754", "0.60222304", "0.60115504", "0.5944667", "0.5944667", "0.5910455", "0.5902232", "0.5863104", "0.5841093", "0.58031714", "0.5786781", "0.57840115", "0.5782...
0.55147797
48
Sets the title of the pdf.
def set_title(self, title = "FORM"): c = self.canvas.setTitle(title)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setTitle(self,value):\n self.PDFreactorConfiguration.in1[\"title\"] = value", "def settitle(self, title):\n self.__title = title", "def settitle(self, title):\n self.__title = title", "def set_title (self, title):\n self.title = title", "def set_title(self, title):\r\n ...
[ "0.82881707", "0.81624424", "0.81624424", "0.80525887", "0.8025876", "0.7973449", "0.79517174", "0.7950903", "0.79386455", "0.7936141", "0.79311997", "0.7926738", "0.7868639", "0.7838614", "0.77434546", "0.7718151", "0.77113163", "0.7706195", "0.77036643", "0.77034336", "0.77...
0.79990625
5
Generate ``model``specific synthesis script.
def generate_yosys_script(summary, renderer, ostream, model, model_sources, template = "synth.specific.tmpl.ys"): renderer.add_generic( ostream, template, model = model, model_sources = model_sources, yosys_script = summary.yosys["script"], iteritems = iteritems, itervalues = itervalues )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_script(model: onnx.ModelProto, output_file: str = None) -> str:\n current_dir = os.path.dirname(os.path.realpath(__file__))\n env = jinja2.Environment(loader=jinja2.FileSystemLoader(current_dir + '/templates/'))\n model_header_render = gen_model_header(env, model)\n imports, main_function, sub_...
[ "0.71790755", "0.61078423", "0.6011807", "0.5968458", "0.5965008", "0.5928381", "0.59106827", "0.5892473", "0.58815545", "0.5837325", "0.5752082", "0.57328606", "0.5700278", "0.5665125", "0.5638353", "0.5630792", "0.5620719", "0.5588311", "0.55843246", "0.556606", "0.55422443...
0.63034165
1
Adapt a CWL job object to the Galaxy API. CWL derived tools in Galaxy can consume a job description sort of like CWL job objects via the API but paths need to be replaced with datasets and records and arrays with collection references. This function will stage files and modify the job description to adapt to these chan...
def galactic_job_json(job, test_data_directory, upload_func, collection_create_func): datasets = [] dataset_collections = [] def upload_file(file_path): if not os.path.isabs(file_path): file_path = os.path.join(test_data_directory, file_path) _ensure_file_exists(file_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galactic_job_json(\n job, test_data_directory, upload_func, collection_create_func, tool_or_workflow=\"workflow\"\n):\n\n datasets = []\n dataset_collections = []\n\n def upload_file(file_path, secondary_files, **kwargs):\n file_path = abs_path_or_uri(file_path, test_data_directory)\n ...
[ "0.59139556", "0.58567005", "0.5696271", "0.5631622", "0.5470596", "0.52659386", "0.52299416", "0.5168686", "0.49637362", "0.49448887", "0.49375767", "0.48854095", "0.48788068", "0.48770913", "0.4875025", "0.48702103", "0.4839494", "0.48336488", "0.48224968", "0.47955766", "0...
0.5963013
0
Convert objects in a Galaxy history into a CWL object. Useful in running conformance tests and implementing the cwlrunner interface via Galaxy.
def output_to_cwl_json(galaxy_output, get_metadata, get_dataset): def element_to_cwl_json(element): element_output = GalaxyOutput( galaxy_output.history_id, element["object"]["history_content_type"], element["object"]["id"], ) return output_to_cwl_json(ele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __build_history(self, obj: Object) -> dict:\n previous_history = obj.history\n return {**previous_history, self.__get_timestamp(): {'type_id': obj.type_id, 'redshift': obj.redshift}}", "def __build_history(self, obj: Object) -> dict:\n previous_history = dict(obj.history)\n return...
[ "0.5449591", "0.53597903", "0.53180766", "0.5217686", "0.5002477", "0.48273036", "0.48258838", "0.47788423", "0.47186252", "0.4703909", "0.46876624", "0.46831584", "0.46785995", "0.46753672", "0.46651852", "0.46631747", "0.46261874", "0.45973223", "0.45775396", "0.455817", "0...
0.56445116
0
Convert text (chars) to bits
def bits_provider(message): for char in message: ascii_value: int = ord(char) for power in range(7, -1, -1): yield 1 if ascii_value & 2 ** power else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_to_bits(text, encoding=\"utf-8\", errors=\"surrogatepass\"):\n bits = bin(int.from_bytes(text.encode(encoding, errors), \"big\"))[2:]\n return bits.zfill(8 * ((len(bits) + 7) // 8))", "def _char2bits(c):\r\n return \"{0:05b}\".format(CHARMAP[c])", "def tobits(s):\n # Get the length of the ...
[ "0.78553545", "0.7398142", "0.73097473", "0.7280526", "0.72450334", "0.7237495", "0.715391", "0.67713135", "0.67093974", "0.6529686", "0.6525931", "0.6513504", "0.64785576", "0.6464103", "0.6406809", "0.6403036", "0.6384544", "0.63443404", "0.6343995", "0.6336565", "0.6273629...
0.6249112
22
Hide text message in image
def create_image(message, path) -> None: bits_in_msg = len(message) * 8 img = Image.open(path) image_width = img.width image_height = img.height image_size = image_width * image_height assert image_size >= bits_in_msg, 'Image is too small or message is too long.' pixels = np.array(img) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self, img, message):\r\n encoded = img.copy()\r\n width, height = img.size\r\n index = 0\r\n\r\n message = message + '~~~'\r\n message_bits = \"\".join(tools.a2bits_list(message))\r\n\r\n npixels = width * height\r\n if len(message_bits) > npixels * 3:\r\n ...
[ "0.74264765", "0.67812157", "0.6555191", "0.63366294", "0.6206182", "0.61647385", "0.6140112", "0.60605264", "0.60046065", "0.58995646", "0.5879182", "0.5851367", "0.5810509", "0.57908887", "0.57908887", "0.5782038", "0.5773678", "0.576504", "0.5762351", "0.5754111", "0.57509...
0.0
-1
Decode hidden text from image
def decode_image(path): img = Image.open(path) image_width = img.width image_height = img.height pixels = np.array(img) print(pixels[0]) bits = [] for i in range(image_height): for j in range(image_width): bits.append(pixels[i][j][0] & ((1 << 1) - 1)) bytes_l = [i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, image):\r\n raise NotImplementedError(\"Not Implemented\")", "def read_text(text=\"刘菁我爱你\"):\n\tpygame.init()\n\tfont = pygame.font.Font('/System/Library/Fonts/Supplemental/Songti.ttc', 26)\n\trtext = font.render(text, True, (0, 0, 0), (255, 255, 255))\n\n\tif os.path.exists(CHAR_IMG):\n\...
[ "0.6660461", "0.6456692", "0.630483", "0.6240027", "0.6235049", "0.6189339", "0.61866933", "0.6102977", "0.60968524", "0.60382414", "0.603307", "0.6017118", "0.60026586", "0.595732", "0.5909072", "0.5901013", "0.587999", "0.58738095", "0.5866608", "0.58384985", "0.58263344", ...
0.63908744
2
Run the Kmeans algorithm using the C extension.
def run_kmeans(self, maxiter=200, tol=1e-4, verbose=True): iterations = _algorithms.kmeans(self._data, self.means, self.kmeans_rs, tol, maxiter) if verbose: if iterations < maxiter: print("K-means converged after {0} iterations." .form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n data = Dummy(n_samples=500, n_dim=3)\n X = data.get_dummy()\n clustering = Kmeans(X, K=5, display=False)\n clustering.run()\n print(f\"Number of iterations: {clustering.num_iterations}\\n\")\n\n \"\"\" Test example of clustering_kmeans with unknown number of clusters K \"\"\"\n c...
[ "0.7291935", "0.6812883", "0.6681753", "0.66578525", "0.6563064", "0.63314784", "0.6288734", "0.6270159", "0.6257893", "0.6223509", "0.6217739", "0.62014", "0.6193823", "0.6177026", "0.6174597", "0.6166811", "0.6160683", "0.6157466", "0.6144527", "0.6141743", "0.6133406", "...
0.5979256
34
Run the EM algorithm.
def run_em(self, maxiter=400, tol=1e-4, verbose=True, regularization=0.0): self.means = self.means.T L = None for i in xrange(maxiter): newL = self._expectation() if i == 0 and verbose: print("Initial NLL =", -newL) self._maximization(regular...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_em(self, r):\n self.tc.reset()\n self.pf.Y = r.T\n em_data = {}\n if self.print_mode:\n print 'The hessian trace is {}'.format(\n np.trace(self.tc.t_H.get_value()))\n\n print 'Running full EM'\n\n for u in range(self.n_itr):\n t...
[ "0.72161376", "0.628836", "0.6144694", "0.61367214", "0.6123989", "0.60628617", "0.60402554", "0.6032735", "0.60259813", "0.60199857", "0.59711766", "0.5922304", "0.59206814", "0.5912053", "0.5896723", "0.5892612", "0.58919305", "0.58890396", "0.58829486", "0.58683765", "0.58...
0.6405142
1
The decorator method to be called on the class object. This method will set the proper `discoverable` type to the class. It should return the class passed in, according to the decorator spec.
def discoverable(_class): # Set the attribute to the class name, to prevent subclasses from also # being discoverable. setattr(_class, _get_discoverable_attribute(_class), True) return _class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_class_discoverable(_class, default_discoverability=False):\n return bool(getattr(_class, _get_discoverable_attribute(_class),\n default_discoverability))", "def not_discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being no...
[ "0.6100534", "0.5945838", "0.5689444", "0.5677215", "0.56717265", "0.55983895", "0.55354106", "0.5534171", "0.55314434", "0.5498857", "0.54959726", "0.5491333", "0.54092", "0.54038715", "0.5341593", "0.53414214", "0.5279805", "0.52688867", "0.52337843", "0.52116585", "0.52032...
0.70861286
0
The decorator method to be called on the class object. This method will set the proper `not discoverable` type to the class. It should return the class passed in, according to the decorator spec.
def not_discoverable(_class): # Set the attribute to the class name, to prevent subclasses from also # being not discoverable. setattr(_class, _get_discoverable_attribute(_class), False) return _class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being discoverable.\n setattr(_class, _get_discoverable_attribute(_class), True)\n return _class", "def checktype(type):\n def decorator(klass):\n register_type(type, klass)\n ret...
[ "0.7026496", "0.60254246", "0.58712715", "0.58391374", "0.5762568", "0.57158124", "0.55842835", "0.54794437", "0.5475729", "0.54330164", "0.5426265", "0.5411975", "0.53922296", "0.5384349", "0.53761977", "0.5354712", "0.53032106", "0.52928644", "0.5277489", "0.5265347", "0.52...
0.7357723
0
Returns true if the class is marked discoverable
def is_class_discoverable(_class, default_discoverability=False): return bool(getattr(_class, _get_discoverable_attribute(_class), default_discoverability))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_discoverable_attribute(_class):\n return \"__{}_is_discoverable\".format(_class.__name__)", "def discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being discoverable.\n setattr(_class, _get_discoverable_attribute(_class), True)\n return _...
[ "0.69203067", "0.6642737", "0.62106764", "0.6052726", "0.5998927", "0.5970129", "0.5938582", "0.5887358", "0.58857167", "0.5808782", "0.57919824", "0.57619464", "0.5701386", "0.5670407", "0.56579703", "0.5640263", "0.5625706", "0.5594766", "0.5586563", "0.5519655", "0.5512455...
0.8230393
0
Get an attribute to set on a class to consider it discoverable
def _get_discoverable_attribute(_class): return "__{}_is_discoverable".format(_class.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being discoverable.\n setattr(_class, _get_discoverable_attribute(_class), True)\n return _class", "def get_attr(self, key: str) -> Any:\n raise NotImplementedError(\"This method should be impl...
[ "0.71000606", "0.666556", "0.6570846", "0.653001", "0.63913965", "0.63654155", "0.6253668", "0.620802", "0.6182992", "0.6182578", "0.6147421", "0.61464113", "0.61088574", "0.60911614", "0.608464", "0.608464", "0.6043526", "0.60277534", "0.6022185", "0.6009808", "0.60057694", ...
0.74975735
0
This test is currently hardcoded to /tmp to workaround a seeming inability to load custom modules inside the pydsl renderers. This is a FIXME.
def test_rendering_includes(self): self.run_function("state.sls", ["pydsl.aaa"]) expected = textwrap.dedent( """\ X1 X2 X3 Y1 extended Y2 extended Y3 hello red 1 hello green 2 hello b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_module(self):\n pass", "def test_loaders():\n\n tempdir = tempfile.mkdtemp()\n\n loader = \"\"\"\nfrom mindbender import api\n\nclass DemoLoader(api.Loader):\n def process(self, asset, subset, version, representation):\n pass\n\n\"\"\"\n\n with open(os.path.join(tempdir, \"my_l...
[ "0.69728214", "0.6790694", "0.6469623", "0.64158565", "0.63885814", "0.63555634", "0.6350806", "0.62353915", "0.6227655", "0.62198085", "0.6196952", "0.6154964", "0.6149774", "0.6133385", "0.6129895", "0.61110246", "0.61017686", "0.6092707", "0.6056918", "0.6047915", "0.60174...
0.0
-1
Convert file to raw file.
def convert_to_raw(file): img = Image.open(file) img = img.convert('L') # convert to 8 bits per pixels (x, y) = img.size pixels = bytearray(list(img.getdata())) filename, file_extension = os.path.splitext(file) file2 = file.replace(file_extension, '.dat') file_name = str(x) + 'x' + str(y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_convert_file():\n try:\n str_out = io.BytesIO()\n str_out.write(process_text(request.data.decode('utf-8')).encode('utf-8'))\n str_out.seek(0)\n\n return send_file(\n str_out,\n attachment_filename='result.txt',\n as_attachment=True,\n ...
[ "0.64115816", "0.6371769", "0.6140477", "0.5940787", "0.5906996", "0.57152784", "0.562413", "0.5623284", "0.56161326", "0.5604619", "0.55842215", "0.5559293", "0.55592465", "0.5539912", "0.54099935", "0.5399127", "0.53941727", "0.5383642", "0.5368682", "0.53505486", "0.534988...
0.6456368
0
Convert a raw file to jpg file.
def convert_to_jpg(raw_file): match = re.match('(\d+)x(\d+)x(\d+)x(\d+)_(\w+)', raw_file) if match: # print(match.group(1)) # print(match.group(2)) # print(match.group(3)) # print(match.group(4)) # print(match.group(5)) x = int(match.group(1)) y = int(mat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_image_conversion_for_image_file(self):\n # Given\n with open(self.image_file_path) as f:\n # When\n result = convert_image_to_jpeg(f)\n img = Image.open(result)\n # Then\n self.assertEqual(JpegImageFile.format, img.format)\n self....
[ "0.64591265", "0.62869", "0.5926924", "0.5918034", "0.56613654", "0.5598152", "0.5569632", "0.5559631", "0.5479805", "0.54383266", "0.54034483", "0.5335417", "0.53307116", "0.52239347", "0.51870555", "0.51752836", "0.5163474", "0.5141427", "0.51402164", "0.5122234", "0.507653...
0.6899732
0
Wrapper function on top of the interpolation executable. It is also a benchmarking function, it returns the name of the output image and the time needed to do all the iterations
def interpolate(file_in, file_out, device, iterations, interpolation_type, new_width, new_height): command_string = './Interpolate ' + device + ' ' + str(iterations) + ' ' + interpolation_type + ' ' + file_in + ' ' + file_out + ' ' + str(new_width) + ' ' + str(new_height) program_out = str(subprocess.check_ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem2():\n\n data = loaddata(\"data/bayerdata.npy\")\n r, g, b = separatechannels(data)\n\n img = assembleimage(r, g, b)\n display_image(img)\n\n img_interpolated = interpolate(r, g, b)\n display_image(img_interpolated)", "def Resampler(name):\n\n def resample_average(path, dsquery, dsti...
[ "0.6005782", "0.5990915", "0.58582526", "0.57174736", "0.5715835", "0.57075953", "0.5687177", "0.5644446", "0.55878294", "0.55830985", "0.55769694", "0.55724096", "0.5563402", "0.55316186", "0.55314726", "0.5511741", "0.5504877", "0.54847926", "0.54411846", "0.5347744", "0.53...
0.6844896
0
Benchmark cpu vs gpu time wise.
def benchmark_cpu_vs_gpu(input_raw_file): nb_iterations = 20 (cpu1, f1) = interpolate(input_raw_file, 'cpu_nn_lena.dat', 'cpu', nb_iterations, 'nn', 4000, 2000) (gpu1, f2) = interpolate(input_raw_file, 'gpu_nn_lena.dat', 'gpu', nb_iterations, 'nn', 4000, 2000) (cpu2, f3) = interpolate(input_raw_file, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speed():\r\n\r\n algo = ['logistic_sgd', 'logistic_cg', 'mlp', 'convolutional_mlp',\r\n 'dA', 'SdA', 'DBN', 'rbm', 'rnnrbm']\r\n to_exec = [True] * len(algo)\r\n# to_exec = [False] * len(algo)\r\n# to_exec[-1] = True\r\n do_float64 = True\r\n do_float32 = True\r\n do_gpu = True\...
[ "0.7225633", "0.695674", "0.68218005", "0.6769229", "0.6725079", "0.6654836", "0.6625746", "0.65144086", "0.647302", "0.63773113", "0.63309896", "0.6302064", "0.6302064", "0.6302064", "0.6184083", "0.61827475", "0.6167184", "0.6167184", "0.6167184", "0.6154827", "0.6154827", ...
0.7135301
1
Plot durations in a graph
def plot_graph(durations, figure_name): # with plt.xkcd(): N = 2 # cpuMeans = (1.218, 10.303) cpuMeans = durations[0] ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars fig, ax = plt.subplots() rects1 = ax.bar(ind, cpuMeans, width, color='r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_durations(episode_durations):\n plt.figure(1)\n plt.clf()\n durations_t = torch.tensor(episode_durations, dtype=torch.float)\n plt.title('Training...')\n plt.xlabel('Episode')\n plt.ylabel('Duration')\n plt.plot(durations_t.numpy())\n # Take 100 episode averages and plot them too\n...
[ "0.72214806", "0.6794013", "0.6602274", "0.64844376", "0.6473804", "0.64605564", "0.6244804", "0.6228357", "0.62237227", "0.62048656", "0.6119964", "0.6044144", "0.603566", "0.60011363", "0.5992164", "0.59725773", "0.59345585", "0.59101963", "0.5890492", "0.5890143", "0.58801...
0.6580548
3
Check bit exactness on interpolation executable between Gpu vs Cpu with various parameters.
def check_bit_exactness(input_raw_file): (t1, f1) = interpolate(input_raw_file, 'cpu_nn_lena.dat', 'cpu', 1, 'nn', 8000, 4000) (t2, f2) = interpolate(input_raw_file, 'gpu_nn_lena.dat', 'gpu', 1, 'nn', 8000, 4000) (t3, f3) = interpolate(input_raw_file, 'cpu_bl_lena.dat', 'cpu', 1, 'bl', 8000, 4000) (t4, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cpu_gpu_result(self, precision=1e-1):\n res1 = run_infer(self.model, CASE_ROOT + \"/resnet_fluid_gpu.yaml\",\n self.input_data)\n res2 = run_infer(self.model, CASE_ROOT + \"/resnet_fluid_cpu.yaml\",\n self.input_data)\n result1 = res1[0]...
[ "0.640324", "0.56350285", "0.5585213", "0.55641", "0.5548312", "0.55470926", "0.5535607", "0.5483092", "0.547579", "0.5412719", "0.53335917", "0.533129", "0.53188753", "0.5310341", "0.53064054", "0.53023964", "0.53012884", "0.529403", "0.5288582", "0.5288348", "0.5280955", ...
0.7583435
0
Exercise interpolation executable with various parameters.
def exercise(): # # Convert Lena Tiff image to raw format # for f in glob.glob('*.jpg'): os.remove(f) for f in glob.glob('*.dat'): os.remove(f) input_raw_file = convert_to_raw('Lena.tiff') for device in ['cpu', 'gpu']: for interp in ['nn', 'bl']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(fn_input, fn_output):\n # read file\n inter = Interpolator()\n inter.read_file(fn_input)\n inter.write_interpolated(fn_output)", "def interpolate(file_in, file_out, device, iterations, interpolation_type, new_width, new_height):\n\n command_string = './Interpolate ' + device + ' ' + str(i...
[ "0.6645586", "0.6190364", "0.59685075", "0.5843205", "0.5804264", "0.5763879", "0.55460095", "0.55202895", "0.5519476", "0.5505364", "0.54812557", "0.54327023", "0.5418951", "0.54126453", "0.5406538", "0.53813463", "0.5375634", "0.53435653", "0.5336754", "0.53331405", "0.5270...
0.48577774
100
Setup an example users generator instance so can use the record
def setUp(self): gen = UsersGenerator({}) gen.generate_adt_user() self.record = gen.class_data.findall('record')[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n # Allocates users\n self.users = []\n self.user_session_tokens = []\n\n # Template for creating users\n user_template = {\n \"clientId\": 2,\n \"username\": \"user\",\n \"pwd\": \"password\",\n \"nameLast\": \"Last\",\n ...
[ "0.6956374", "0.6918225", "0.686735", "0.6851119", "0.67789096", "0.67656577", "0.66330135", "0.6540279", "0.6540279", "0.6522282", "0.6480351", "0.64449173", "0.64280057", "0.63684684", "0.6364395", "0.63467336", "0.63422114", "0.63228506", "0.6303323", "0.63001335", "0.6283...
0.780119
0
Make sure the record has teh correct id and model
def test_record(self): self.assertEqual(self.record.attrib['id'], 'nhc_def_conf_adt_user', 'Incorrect ID ') self.assertEqual(self.record.attrib['model'], 'res.users', 'Incorrect model')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkModel(self, model):\n # TODO", "def test_id_field_is_not_created(self):\r\n assert not hasattr(AbstractModel, 'id')\r\n assert not hasattr(AbstractModelWithCol, 'id')", "def test_id_type(self):\n\n base_model = BaseModel()\n self.assertTrue(base_model.id, str)", "d...
[ "0.74250984", "0.6795302", "0.6740589", "0.65888137", "0.65381956", "0.64983934", "0.64636314", "0.6453162", "0.6444478", "0.6395121", "0.63648635", "0.6346171", "0.63236946", "0.6287212", "0.62062424", "0.6201254", "0.61972934", "0.6193447", "0.6167271", "0.6111231", "0.6097...
0.642963
9
Make sure the name field is correct
def test_name_field(self): field = self.record.find('field[@name=\'name\']') self.assertEqual(field.text, 'GUH-ADT', 'Incorrect Name Field')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_name(self):\n\t\tpass", "def test_should_name_field(self):\n self.assertIn(\"name\", self.fields)", "def test_reserved_name(self):\n with self.assertRaises(ValidationError):\n field_name_validator('_id')", "def test_nonreserved_name(self):\n try:\n field_...
[ "0.80483794", "0.76999706", "0.75463855", "0.7521705", "0.7409506", "0.7372538", "0.7320282", "0.71896374", "0.7162188", "0.71472406", "0.71424186", "0.7107738", "0.7054699", "0.70347553", "0.7023951", "0.69843197", "0.6968333", "0.6964454", "0.69297624", "0.6903072", "0.6881...
0.73358804
6
Make sure the login field is correct
def test_login_field(self): field = self.record.find('field[@name=\'login\']') self.assertEqual(field.text, 'adt', 'Incorrect login Field')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_correct_user(self, login, password):\n pass", "def test_valid_login_form_but_failed_authentication(self):\n\n\n\t\tpass", "def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n ...
[ "0.7687447", "0.7681044", "0.73155206", "0.7277039", "0.71960974", "0.71253973", "0.71253973", "0.69699216", "0.69193745", "0.69148284", "0.690887", "0.68859607", "0.68819684", "0.6844276", "0.6832944", "0.6815374", "0.680718", "0.6804857", "0.68000656", "0.67888963", "0.6786...
0.72664356
4
Make sure the password field is correct
def test_password_field(self): field = self.record.find('field[@name=\'password\']') self.assertEqual(field.text, 'adt', 'Incorrect password Field')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MAX_PWD_LEN']))]))\n\n valid_password(None, pass_field)", "def test_invalid_password(self):\n pass", "def test_password_verification(self):\n self.user.password = '123456'\n self.assert...
[ "0.853948", "0.8231189", "0.7955539", "0.7746779", "0.7742566", "0.7735405", "0.77348197", "0.7720045", "0.771726", "0.77053875", "0.7683147", "0.76789725", "0.7593923", "0.7579056", "0.7571688", "0.7571357", "0.75690925", "0.7559359", "0.7558063", "0.75377166", "0.75374734",...
0.7502228
24
Make sure the login field is correct
def test_group_field(self): field = self.record.find('field[@name=\'groups_id\']') self.assertEqual(field.attrib['eval'], '[(4, ref(\'nh_clinical.group_nhc_admin\'))]', 'Incorrect eval on groups id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_correct_user(self, login, password):\n pass", "def test_valid_login_form_but_failed_authentication(self):\n\n\n\t\tpass", "def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n ...
[ "0.7688415", "0.76811504", "0.7316769", "0.7275612", "0.7266759", "0.71959186", "0.7124947", "0.7124947", "0.6971015", "0.69210243", "0.6915079", "0.69085586", "0.68865377", "0.6883478", "0.68451554", "0.6833884", "0.6816657", "0.68066406", "0.6805583", "0.6801194", "0.678934...
0.0
-1
Make sure the category field is correct
def test_category_field(self): field = self.record.find('field[@name=\'category_id\']') self.assertEqual(field.attrib['eval'], '[(4, ref(\'nh_clinical.role_nhc_admin\'))]', 'Incorrect eval on category id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_category(self, data):\n try:\n if data['category_name'] == \"\":\n return \"Category_name cannot be blank\"\n if 'category_name' not in data.keys():\n return \"Enter category_name\"\n if not re.match(r\"^[a-zA-Z0-9 _]*$\", data['cat...
[ "0.72112346", "0.7149475", "0.70695424", "0.695298", "0.6914686", "0.6820568", "0.6801627", "0.6753331", "0.67150813", "0.67089504", "0.6665941", "0.658121", "0.65487945", "0.6504894", "0.64788413", "0.6469945", "0.646018", "0.645516", "0.644144", "0.63654494", "0.63285184", ...
0.66435
11
Make sure the pos field is correct
def test_pos_field(self): field = self.record.find('field[@name=\'pos_id\']') self.assertEqual(field.attrib['ref'], 'nhc_def_conf_pos_hospital', 'Incorrect eval on pos id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_positions():\n positions = set([field[\"position\"] for field in fields])\n if len(positions) != len(fields):\n raise IncorrectPredictionsTableOrder", "def recheckPosition(self):\n self.start = self.bounds[0].pos\n self.end = self.bounds[1].pos", "def valid_...
[ "0.72222084", "0.67631936", "0.6703772", "0.66257393", "0.6558366", "0.6546612", "0.6393958", "0.6359109", "0.6330162", "0.6291483", "0.62529105", "0.62184364", "0.61974156", "0.61886114", "0.6177559", "0.6175728", "0.6171237", "0.61665016", "0.61665016", "0.6160105", "0.6153...
0.6339601
8
Fetch organization details from the API.
def fetch_details_from_api(self, org_names=None): logger.debug('Fetching org details from API...') details = {} if org_names is None: org_names = self._all_page_names(without_namespace=True) for org in org_names: code = self._code_by_name(org) if code ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_organization(organization):\n return fetch_json(organization_url, organization)", "def test_get_organization(self):\n pass", "def test_retrieve_l_organization(self):\n pass", "def test_get_organization_from_api_key(self):\n pass", "def get_organization(self, id: str) -> di...
[ "0.82742935", "0.7215253", "0.71555364", "0.71401477", "0.70368063", "0.6870949", "0.6747574", "0.67154455", "0.6695743", "0.66767126", "0.66356957", "0.6629043", "0.65509844", "0.6486175", "0.64638036", "0.64497346", "0.64293605", "0.6352869", "0.6321579", "0.62873846", "0.6...
0.7452373
1
Create new organization category tree and pages.
def recreate_tree(self, fetch_from_api=False): logger.debug('Creating organization category tree and pages...') for parent, children in self._hierarchy( fetch_from_api=fetch_from_api).items(): self._create_pages(parent) parent_category = f'[[Category:{parent}]]' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_category_pages(app):\n env = app.builder.env\n\n template = \"category.html\"\n\n categories = env.categories\n for name, category in categories.iteritems():\n context = {}\n context[\"title\"] = category.name\n context[\"subcategories\"] = category.subcategories\n ...
[ "0.6847534", "0.67013305", "0.63725936", "0.6334025", "0.6069195", "0.59774697", "0.5846274", "0.5729139", "0.57264924", "0.57257324", "0.5705253", "0.5705121", "0.5620174", "0.56092304", "0.5568929", "0.55641246", "0.5545612", "0.553405", "0.5525433", "0.55243224", "0.551429...
0.7765683
0
Nuke organization category tree and pages.
def nuke_tree(self): logger.debug('Nuking organization category tree and pages...') def recurse_delete(page): if page.exists: page_is_category = True try: page_members = page.members() except AttributeError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recreate_tree(self, fetch_from_api=False):\n logger.debug('Creating organization category tree and pages...')\n for parent, children in self._hierarchy(\n fetch_from_api=fetch_from_api).items():\n self._create_pages(parent)\n parent_category = f'[[Category:{pa...
[ "0.6612943", "0.6476937", "0.6362572", "0.6236043", "0.6191051", "0.61242706", "0.6083505", "0.5918996", "0.5907317", "0.5860402", "0.58141035", "0.5798131", "0.57252145", "0.5720753", "0.5695223", "0.56784064", "0.56283355", "0.56238097", "0.55597705", "0.5531781", "0.550324...
0.7459369
0
Update organization pages from apografi API.
def update_pages(self, fetch_from_api=False, details=None, force_create=False): logger.debug('Updating organization pages...') def template_text(org_details): te = TemplateEditor(self.TEMPLATE) template = te.templates[self.TEMPLATE_NAME][0] # Add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, organisation: Organisation) -> None:\n ...", "def UpdateOrganizationSettings(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')", "def update(self):\n...
[ "0.576033", "0.5739277", "0.5607183", "0.55946696", "0.5534071", "0.54312897", "0.53235763", "0.53037417", "0.5271056", "0.5237154", "0.51738906", "0.5145725", "0.51090777", "0.51086265", "0.5090848", "0.50289696", "0.49717492", "0.49616772", "0.49475837", "0.4938556", "0.493...
0.6676893
0
Delete old organizations (removed from apografi API).
def delete_old(self, fetch_from_api=False, dry_run=False): latest_org_names = [ re.sub(' +', ' ', org['preferredLabel'].strip()) for org in self._all(fetch_from_api=fetch_from_api) ] for org_page in self._all_pages_simple(): org_page_title = org_page.page_titl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_organization(self):\n pass", "def organization_del_no_login(self, client, id):\n assert client.delete('/organizations/' + id, headers={},\n data={'name': 'Daisy'}).status == \\\n '400 BAD REQUEST'", "def destroy_organization(org):\n loggin...
[ "0.7003894", "0.69430643", "0.6779369", "0.6760345", "0.6661491", "0.66509014", "0.64223874", "0.63361734", "0.63012654", "0.62665826", "0.62275946", "0.61975694", "0.61780876", "0.6114003", "0.61025506", "0.6031166", "0.5984855", "0.59208715", "0.58962715", "0.58863324", "0....
0.6021057
16
Returns a list of status targets for the build master.
def get_status(options): authz = Authz( gracefulShutdown = True, forceBuild = True, forceAllBuilds = True, pingBuilder = True, stopBuild = True, stopAllBuilds = True, cancelPendingBuild = True, stopChange = True, cleanShutdown= True ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_targets(self, status='all'):\n\n if status == 'all':\n targets = dal.targets.all()\n elif status == 'active':\n targets = dal.targets.active()\n elif status == 'inactive':\n targets = dal.targets.inactive()\n else:\n raise AttributeErr...
[ "0.69302946", "0.66925645", "0.6496912", "0.6137351", "0.6025481", "0.601673", "0.5983731", "0.58676773", "0.57701623", "0.5763165", "0.57297146", "0.5726561", "0.5712458", "0.564753", "0.5628999", "0.5617043", "0.55508494", "0.5536795", "0.5524964", "0.5484972", "0.54645896"...
0.5171014
49
Displays the status, the owner, the project name and the number of cart items.
def __str__(self): return _( "cart (status: %(status)s, owner: %(owner)s, project name: " "%(project_name)s, number of cart items: %(nb_cart_items)d, " "total amount: %(total_amount)d)" ) % { 'status': self.CART_STATUSES[self.status][1], 'owner...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(auth_context):\n\n cart = carts.get_cart(auth_context.get('uid'))\n for item in cart:\n product = product_catalog.get_product(item.item_id)\n item.info = product\n\n return render_template('cart.html',\n cart=cart,\n auth_contex...
[ "0.65103585", "0.60823727", "0.59575856", "0.5933486", "0.5839279", "0.5830037", "0.5798492", "0.57583416", "0.57334095", "0.5703823", "0.5699384", "0.5692979", "0.56647104", "0.56580704", "0.56565565", "0.56434786", "0.563236", "0.5614772", "0.5598291", "0.5586921", "0.55683...
0.7057877
0
Retrieves all cart items for a given cart.
def get_cart_items(self): return CartItem.objects.filter(cart=self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cart_items(request):\n return CartItem.objects.filter(cart_id=_cart_id(request))", "def get_cart_items(request):\n return CartItem.objects.filter(cart_id=_cart_id(request))", "def get_cart_items(request):\n return CartItem.objects.filter(cart_id = get_cart_id_session(request))", "def get_ite...
[ "0.7381225", "0.7381225", "0.72456187", "0.69202214", "0.6845669", "0.66992563", "0.65180063", "0.6440269", "0.6359296", "0.6044959", "0.6000852", "0.59828556", "0.5950014", "0.5811841", "0.5804673", "0.573022", "0.5728143", "0.568424", "0.56840277", "0.5662042", "0.5657203",...
0.7630341
0
Retrieves the number of distinct cart items for a given cart.
def nb_cart_items(self): return CartItem.objects.filter(cart=self).count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cart_distinct_item_count(request):\n return get_cart_items(request).count()", "def get_cart_counter(request):\n return len(get_cart_items(request))", "def num_carts(self):\n return self._num_carts", "def __len__(self):\n return sum(item['qty'] for item in self.cart.values())", "def ...
[ "0.83708996", "0.7122882", "0.66277915", "0.64961153", "0.6374639", "0.63468164", "0.5831994", "0.5810013", "0.578669", "0.5636934", "0.5636934", "0.56178385", "0.56098634", "0.5601126", "0.55407643", "0.54967433", "0.5454864", "0.54540205", "0.54383975", "0.5436613", "0.5397...
0.73278224
1
Retrieves the total amount of cart items for a given cart.
def total_amount(self): total_amount = 0 for cart_item in self.get_cart_items(): total_amount += cart_item.total_price return total_amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_of_cart(session_id):\n cart_items = CartItem.objects.filter(cart_id=session_id)\n cart_total_list = [cart_item.total() for cart_item in cart_items]\n return sum(cart_total_list)", "def cart_subtotal(request):\n cart_total = decimal.Decimal('0.00')\n cart_products = get_ca...
[ "0.78944373", "0.7428659", "0.74166524", "0.7226727", "0.6956555", "0.66739833", "0.6626357", "0.6577171", "0.65215605", "0.6469818", "0.64654446", "0.644342", "0.6432942", "0.6390239", "0.6378628", "0.62492317", "0.6200687", "0.6190806", "0.61329013", "0.6089602", "0.6088345...
0.7810109
1