query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
If data_structure is a str, suffixed with 'L', and has an equivalent long, return that long. Otherwise, leave it unmodified.
def str_to_long(data_structure): if (type(data_structure) is str and len(data_structure) > 0 and data_structure[-1] == 'L'): try: return long(data_structure) except ValueError: return data_structure else: return data_structure
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_to_str(data_structure):\n if type(data_structure) is long:\n return str(data_structure) + 'L'\n else:\n return data_structure", "def decode_longs(data_structure):\n return walk_tree(str_to_long, data_structure)", "def field_to_long(value):\n if isinstance(value, (int, lon...
[ "0.7218836", "0.71197873", "0.65231264", "0.6382989", "0.63033456", "0.6299685", "0.6279305", "0.6231567", "0.60436136", "0.60384095", "0.5879732", "0.58451825", "0.58367836", "0.5819657", "0.5729154", "0.5717518", "0.5660829", "0.5635816", "0.5575279", "0.5541829", "0.553071...
0.8521766
0
Recursively convert numeric strings suffixed with 'L' to longs, in an arbitrary python data structure. Only supports treelike structures does not support structures which contain references to parent objects. Modifies the data structure inplace. To preserve the original data structure, deepcopy it before calling this f...
def decode_longs(data_structure): return walk_tree(str_to_long, data_structure)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_long(data_structure):\n if (type(data_structure) is str and len(data_structure) > 0 and\n data_structure[-1] == 'L'):\n try:\n return long(data_structure)\n except ValueError:\n return data_structure\n else:\n return data_structure", "def encode_...
[ "0.6393337", "0.57793075", "0.5697539", "0.5315446", "0.51731217", "0.5078519", "0.5069272", "0.50604373", "0.50468254", "0.49974492", "0.49188536", "0.47464722", "0.471545", "0.4613846", "0.45672265", "0.45462966", "0.45372579", "0.45328337", "0.45275134", "0.45093003", "0.4...
0.6573038
0
Returns a tensor filled with zeros The shape of the tensor is defined by the varargs sizes. Returns FloatTensor
def ones(*args): dims = list(args) assert type(dims[0]) == int return params_func(cmd, "ones", params=dims, return_type='FloatTensor')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros(*shape, **kwargs):\n return Tensor(np.zeros(shape), **kwargs)", "def zeros(*args):\n dims = list(args)\n assert type(dims[0]) == int\n return params_func(cmd, \"zeros\", params=dims, return_type='FloatTensor')", "def zeros(shape, dtype=np.float32, constant=False):\n return Tensor(n...
[ "0.7842598", "0.77164525", "0.7565274", "0.7219855", "0.7152766", "0.7091722", "0.70162374", "0.6989535", "0.685939", "0.68560123", "0.68349093", "0.6743648", "0.6743648", "0.6660959", "0.6544985", "0.6485042", "0.6408218", "0.6365994", "0.63572747", "0.6356642", "0.6340731",...
0.0
-1
Returns a tensor filled with zeros The shape of the tensor is defined by the varargs sizes. Returns FloatTensor
def zeros(*args): dims = list(args) assert type(dims[0]) == int return params_func(cmd, "zeros", params=dims, return_type='FloatTensor')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros(*shape, **kwargs):\n return Tensor(np.zeros(shape), **kwargs)", "def zeros(shape, dtype=np.float32, constant=False):\n return Tensor(np.zeros(shape, dtype), constant=constant)", "def empty(*shape, **kwargs):\n return Tensor(np.empty(shape), **kwargs)", "def zeros_like(tensor):\n ...
[ "0.7842598", "0.7565274", "0.7219855", "0.7152766", "0.7091722", "0.70162374", "0.6989535", "0.685939", "0.68560123", "0.68349093", "0.6743648", "0.6743648", "0.6660959", "0.6544985", "0.6485042", "0.6408218", "0.6365994", "0.63572747", "0.6356642", "0.6340731", "0.63303417",...
0.77164525
1
Second derivative of the Hill(position) function which represents the hill in the car on the hill problem
def _hill_diff_diff(self, position): if position < 0: return 2 else: return position * ((75 * (position ** 2)/((1 + 5 * position**2)**2.5)) - 5/((1 + 5 * position ** 2)**2.5)) \ - 10 * position/((1 + 5 * position ** 2)**1.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hill_diff(self, position):\n if position < 0:\n return 2 * position + 1\n else:\n return (1/math.sqrt(1 + 5 * position ** 2)\n - 5 * position ** 2 * (1 + 5 * position ** 2)**-1.5)", "def dif(t=None, h=None, x=None, dxdt=None, d2 = None):\r\n return d...
[ "0.71787125", "0.6337476", "0.6178819", "0.61392814", "0.61392814", "0.6037158", "0.6035797", "0.59954983", "0.5982176", "0.5980169", "0.5966511", "0.5927131", "0.59081066", "0.59002376", "0.58453137", "0.58235", "0.58235", "0.57893753", "0.578911", "0.57782894", "0.576464", ...
0.6988061
1
given a number, return True if prime else False
def is_prime(num): for x in range(2, num + 1): if num % x == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime_number(number_):\n flag = 0\n for values in range(2, number_//2):\n if number_ % values == 0:\n flag += 1\n if flag == 1:\n return True\n else:\n return False", "def is_prime(number):\n\t\n\tif number < 2: return False\n\telif number == 2: return True\n\te...
[ "0.86102134", "0.85202575", "0.8504059", "0.84321237", "0.8401166", "0.83678275", "0.83596665", "0.8356021", "0.83337253", "0.83273566", "0.8298777", "0.8295161", "0.8267883", "0.8264454", "0.8263076", "0.8255169", "0.825499", "0.82525784", "0.82493657", "0.8237897", "0.82170...
0.8259012
15
Extracts the acquisitions of each file in the dictionary files_names. The user must be careful because this function converts all files in the files_names in numpy arrays. As large the number of entries in files_names as large will be the space of memory necessary. Returns
def acquisitions(self): acquisitions_dict = {} for key in self.files: if key != 'OR_KA08_2_2': print(self.files[key]) matlab_file = scipy.io.loadmat(self.files[key]) if len(self.files[key])>41: vibration_data=matlab_file[self.files[key][19:38]]['Y'][0][0][0][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(self, reqs_dict, **kwargs):\n\n files_returned = []\n\n all_valid_names = self.cons_names\n try:\n all_valid_names += self.alias_map.keys()\n except:\n pass\n\n for key in reqs_dict:\n if key in all_valid_names:\n\n tr...
[ "0.5829079", "0.5568234", "0.55453146", "0.54928666", "0.5429139", "0.5318473", "0.52788126", "0.5267479", "0.52518123", "0.5225667", "0.5188862", "0.5174765", "0.5149673", "0.51454383", "0.5133269", "0.5126411", "0.5095342", "0.50888413", "0.506829", "0.506203", "0.50595677"...
0.6104666
0
Function to calculate the reduced learning rate after epoch
def step_decay(epoch): initial_lrate = 0.1 drop = 0.5 epochs_drop = 10.0 lrate = initial_lrate * math.pow(drop, math.floor((1 + epoch) / epochs_drop)) # print(f"For epoch {epoch}, Learning rate is {lrate}") return lrate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr", "def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)", "def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)", "def __learning_rate(self, lr0, epoch):\n \n ...
[ "0.8171031", "0.77817154", "0.77817154", "0.76992744", "0.75821906", "0.7547952", "0.74052113", "0.73309565", "0.7330828", "0.73195606", "0.7231433", "0.7229917", "0.7207195", "0.7196197", "0.7154837", "0.7145247", "0.7137893", "0.7086035", "0.70756614", "0.70351243", "0.7035...
0.72133976
12
Test get all products.
def test_get_all_products(self): response=self.get_all_products() result = json.loads(response.data.decode('utf-8')) self.assertEqual(response.status_code, 200,result['Available Products'] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_product_list(self):\n self._create_products(5)\n resp = self.app.get(\"/products\")\n self.assertEqual(resp.status_code, status.HTTP_200_OK)\n data = resp.get_json()\n self.assertEqual(len(data), 5)", "def test_list_products(self):\n sample_product(supplier_...
[ "0.81801194", "0.8162404", "0.80536664", "0.803761", "0.80301356", "0.7950588", "0.791547", "0.75464064", "0.74857324", "0.74658626", "0.74582124", "0.7397645", "0.7393845", "0.7391269", "0.72226065", "0.7208445", "0.71760243", "0.7133124", "0.71063226", "0.70965606", "0.7085...
0.80391955
3
Test geet unexisting products.
def test_get_unexisting_products(self): response=self.get_unexisting_products() result = json.loads(response.data.decode('utf-8')) self.assertEqual(result['message'],"No Available products") self.assertEqual(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product_buy_missing_goods(self):\n result_buy = self.info_list.product_buy(\"хлеб серый хлебозавод\", 3)\n self.assertFalse(result_buy)", "def test_view_product_that_doesnot_exist_in_inventory(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token =...
[ "0.7819811", "0.74510825", "0.74253905", "0.7394914", "0.7356181", "0.7286764", "0.72697175", "0.72002006", "0.7173081", "0.7157495", "0.7130074", "0.70952326", "0.70755124", "0.70718664", "0.70715106", "0.7020957", "0.6963688", "0.69167686", "0.6884809", "0.68754447", "0.683...
0.75760007
1
Test fetch for single product [GET request].
def test_fetch_single_product(self): response=self.fetch_single_product() result = json.loads(response.data.decode('utf-8')) self.assertEqual(response.status_code, 200, result['Product'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_product(self):\n # get the id of a product\n test_product = self._create_products(1)[0]\n resp = self.app.get(\n \"/products/{}\".format(test_product.id), content_type=\"application/json\"\n )\n self.assertEqual(resp.status_code, status.HTTP_200_OK)\n ...
[ "0.7694427", "0.7685613", "0.7486937", "0.71763486", "0.7136175", "0.71222603", "0.7051367", "0.6947093", "0.69322646", "0.6931065", "0.6820344", "0.68118733", "0.68020034", "0.6794163", "0.6771813", "0.67257893", "0.6672727", "0.66668415", "0.6629", "0.6615486", "0.6600097",...
0.8597788
0
Test delete unexisting product.
def test_delete_unexisting_product(self): response=self.delete_unexisting_products() result = json.loads(response.data.decode('utf-8')) self.assertEqual(result['Error'],'Product Not found') self.assertEqual(response.status_code, 400)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_03_product_delete(self):\n product = self.create_product()\n products = self.product_obj.search([])\n self.assertIn(product, products)\n product.unlink()\n self.assertNotIn(product.exists(), products)", "def test_delete_product(self):\n self._require_login(self....
[ "0.88103545", "0.8216854", "0.81327945", "0.8112992", "0.8010153", "0.7978975", "0.79663366", "0.7881493", "0.78742707", "0.78566515", "0.7665377", "0.76635945", "0.7610452", "0.74897164", "0.7470664", "0.74159336", "0.7324988", "0.72872734", "0.7279195", "0.72438973", "0.724...
0.7998871
5
If the parent of a UnaryOpNode is a Concat or an Aggregation (which must be done under MPC), then the Concat or Aggregate operation can be pushed beneath it's child UnaryOpNode, which allows the operation at that node to be done outside of MPC. This method tests whether such a transformation can be performed.
def _rewrite_unary_default(self, node: saldag.UnaryOpNode): parent = next(iter(node.parents)) if parent.is_mpc: # if node is leaf stop if node.is_leaf(): node.is_mpc = True return # node is not leaf if isinstance(parent, sal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _requires_parentheses(self, parent, node):\n if isinstance(node, (UnaryOp, BinaryOp, TernaryOp)) and\\\n isinstance(parent, (UnaryOp, BinaryOp, TernaryOp, Cast)):\n prec = get_precedence(node)\n parent_prec = get_precedence(parent)\n is_not_last_child = is...
[ "0.60450876", "0.59072757", "0.5813224", "0.57676643", "0.5746842", "0.5659774", "0.5641918", "0.56324464", "0.56120795", "0.551892", "0.54400456", "0.54369676", "0.5424817", "0.53703517", "0.5364401", "0.53630674", "0.5353329", "0.5351572", "0.5237913", "0.52110857", "0.5183...
0.60490304
0
If a UnaryOpNode is at a lower MPC boundary, it can be computed locally.
def _rewrite_unary_default(self, node: saldag.UnaryOpNode): par = next(iter(node.parents)) if node.is_reversible() and node.is_lower_boundary() and not par.is_root(): print("lower boundary", node) node.get_in_rel().stored_with = copy.copy(node.out_rel.stored_with) no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_UnaryOp(self, node):\n if node and not config.mutated:\n return self.visit_node(node)\n elif node and config.mutated and config.recovering:\n return self.recover_node(node)\n return node", "def convert_unary_op(g, op, block):\n\n # op_map stores mapping rel...
[ "0.6025578", "0.59523624", "0.58543664", "0.57577854", "0.5647349", "0.5626641", "0.55664444", "0.5544538", "0.5538449", "0.5485339", "0.5482243", "0.54461956", "0.5444908", "0.5425926", "0.5400196", "0.5392844", "0.53342915", "0.5324928", "0.53066015", "0.52906716", "0.52902...
0.63696885
0
List of enabled sitecomps. A frontend sitecomp itself determines if it enabled or not. If the sitecomp instance have no `enabled` attribute, the sitecomp considered enabled.
def enabled_modules(self): return [scomp for scomp in self.modules() if getattr(scomp, 'enabled', True)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enabled_services(self):\n services = set()\n if self.ce_collector_required_rpms_installed and self.htcondor_gateway_enabled:\n services.add('condor-ce')\n return services", "def enabled(cls):\r\n cls._check_configured()\r\n return sorted(cls._ENABLED.values(), ke...
[ "0.6417137", "0.6412139", "0.61353666", "0.61053777", "0.6003722", "0.5966211", "0.5942384", "0.5839016", "0.57538974", "0.5683024", "0.5680558", "0.566255", "0.56361353", "0.55511516", "0.5514081", "0.5436519", "0.5434192", "0.5373351", "0.53717947", "0.5356104", "0.5343243"...
0.7121855
0
Check is user have permission to access to the site module.
def has_perm(self, user): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_module_permission(self, request):\n if request.user.groups.filter(name__in=['Sellers', 'Supporters']).exists():\n return True\n return False", "def hasPerm(self,request):\n request.needAuthType(request.ADMIN)\n request.checkArgs(\"perm_name\",\"admin_username\")\n ...
[ "0.78157455", "0.7690332", "0.7496568", "0.7442057", "0.73376673", "0.7325706", "0.72618127", "0.72174263", "0.71767086", "0.7163697", "0.71339834", "0.71282077", "0.71193045", "0.71074855", "0.71074855", "0.71074855", "0.70716923", "0.704935", "0.7027433", "0.7022249", "0.70...
0.6994442
24
Base template for a module. If /base_module.html exists it would be used. The default is 'material/frontend/base_module.html'
def base_template(self): return select_template(['{}/base_module.html'.format(self.label), 'site/base/base.html' ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theme_template_base(context):\n template_path = os.path.join(settings.THEME_NAME, 'theme.html')\n return {'THEME_TEMPLATE': template_path}", "def module(self) -> \"TemplateModule\":\n return self._get_default_module()", "def templatePath(self):\n return 'v2/soc/dashboard/base.html'", "def...
[ "0.67443323", "0.65413743", "0.6059715", "0.56530476", "0.5588554", "0.5433725", "0.5433395", "0.5396736", "0.5385626", "0.5351731", "0.535068", "0.53488815", "0.52806544", "0.5266149", "0.521008", "0.5181795", "0.5163655", "0.5163655", "0.51483476", "0.51353663", "0.51289874...
0.8017753
0
Save list of names to a local json file
def save_names_to_json(names): with open("names.json", "w") as fil: name_list = list(names) name_list.sort() json.dump(name_list, fil, indent=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_json(file_name: str, content: list):\n with open(file_name, \"w+\") as file_object:\n json.dump(content, file_object)", "def save_json(ls, file_path):\n with open(file_path, 'w') as fp:\n fp.write('\\n'.join(json.dumps(i) for i in ls))", "def save_to_file(cls, list_objs):\n ...
[ "0.7470473", "0.74309605", "0.72981393", "0.72951835", "0.72927344", "0.7291648", "0.72366047", "0.71882975", "0.7170377", "0.71558744", "0.7138532", "0.7137311", "0.71370494", "0.7129362", "0.7112546", "0.7112208", "0.70899975", "0.70843244", "0.70836484", "0.7066075", "0.70...
0.8193219
0
Ensure a VM has a nonchanging filesystem, that is clean enough to be mounted with a straightforward journal replay. This is implemented using the 'fsfreeze' API through the Qemu guest agent. As we can't indicate the cleanliness of a nonrunning (potentially crashed) VM we do only signal a successful freeze iff the freez...
def frozen_vm(self): frozen = False try: if self.qemu.is_running(): self.log.info("freeze", volume="root") try: self.qemu.freeze() frozen = True except Exception as e: self.log.error( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze(self,):\n if self.frozen: return\n\n self.id_lock.acquire()\n #Set logfile to None. Put current logfile into wait for chkpt state.\n self._rotatelog(None,\"\")\n self.loglocker.acquire_write()\n self.frozen = True", "def freeze(name, **kwargs):\n use_vt = k...
[ "0.5969913", "0.56898975", "0.56407994", "0.5614483", "0.5441625", "0.54253215", "0.5394847", "0.5336395", "0.53351367", "0.53101206", "0.52970904", "0.52590144", "0.51651555", "0.51556194", "0.5142035", "0.51010585", "0.50891244", "0.5081032", "0.50533664", "0.5037725", "0.5...
0.6590824
0
Test environments with opts_from_file.
def test_environments_deployment( self, cd_tmp_path: Path, empty_opts_from_file: None, fx_deployments: YamlLoaderDeployment, runway_context: MockRunwayContext, ) -> None: runway_context.env.root_dir = cd_tmp_path deployment = fx_deployments.load("environments_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_environments_opts_from_file(\n self,\n cd_tmp_path: Path,\n fx_deployments: YamlLoaderDeployment,\n mocker: MockerFixture,\n runway_context: MockRunwayContext,\n ) -> None:\n runway_context.env.root_dir = cd_tmp_path\n mocker.patch.object(\n M...
[ "0.70948434", "0.6223884", "0.60205334", "0.5950704", "0.5867832", "0.58461916", "0.58098793", "0.58017594", "0.5798974", "0.57645106", "0.5713239", "0.57124174", "0.56775486", "0.5644353", "0.5644213", "0.5642146", "0.5614305", "0.5580403", "0.5571275", "0.5562057", "0.55115...
0.5538817
20
Test environments with opts_from_file.
def test_environments_opts_from_file( self, cd_tmp_path: Path, fx_deployments: YamlLoaderDeployment, mocker: MockerFixture, runway_context: MockRunwayContext, ) -> None: runway_context.env.root_dir = cd_tmp_path mocker.patch.object( Module, "opts_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_settings_env_file_and_env(mock_env_settings_file, tmpdir):\n climate = core.Climate(prefix=\"TEST_STUFF\")\n assert isinstance(climate.settings, Mapping)\n assert dict(climate.settings) == {\n \"testgroup\": {\"testvar\": 7, \"test_var\": 6},\n \"othergroup\": {\"blabla\": 555},\n ...
[ "0.6223884", "0.60205334", "0.5950704", "0.5867832", "0.58461916", "0.58098793", "0.58017594", "0.5798974", "0.57645106", "0.5713239", "0.57124174", "0.56775486", "0.5644353", "0.5644213", "0.5642146", "0.5614305", "0.5580403", "0.5571275", "0.5562057", "0.5538817", "0.551151...
0.70948434
0
Initialize the dataset builder.
def __init__(self) -> None: self.hebrew_alphabet = None # list of hebrew characters self.augmenter = Augmenter()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__dataset = None", "def __init__(self):\n self.args = self._prepare_args(locals())\n self.requires_full_dataset_in_memory = False", "def build_dataset(self):\n self.dataset = KITTIBEVDataset(self.dataset_config, self.transform)\n return self.dataset...
[ "0.73084944", "0.7276143", "0.72516805", "0.7171552", "0.7154101", "0.7077392", "0.6865365", "0.6857332", "0.68499774", "0.6693619", "0.6604885", "0.6574388", "0.65413815", "0.6515574", "0.65089434", "0.64838004", "0.6473971", "0.6470088", "0.64469045", "0.63952744", "0.63914...
0.0
-1
Return the entity ID.
def entity_id(self): return 'switch.pocket_auto_loading'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self) -> st...
[ "0.87450445", "0.87450445", "0.87450445", "0.87450445", "0.87450445", "0.86839527", "0.7594692", "0.7523408", "0.7392858", "0.7392858", "0.7368524", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123...
0.0
-1
Name of the device.
def name(self): return 'Pocket File Auto Loading'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):\n return f\"{get_device_name(self._data, 0, self._name)}\"", "def name(self):\n return self.device.name()", "def nam...
[ "0.90980077", "0.90980077", "0.90980077", "0.9062028", "0.9025963", "0.88166", "0.8686434", "0.8569197", "0.85582256", "0.8555482", "0.8555482", "0.85317177", "0.85317177", "0.8468815", "0.84063196", "0.8375968", "0.8366276", "0.8347895", "0.8282472", "0.8153554", "0.80649626...
0.0
-1
Turn the switch off.
def turn_off(self, **kwargs): self._is_on = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self, **kwargs):\n self.smartplug.turn_off()", "def off_switch(self):\n self._switch_callback = None", "def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF", "def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self....
[ "0.870139", "0.867637", "0.85906535", "0.8523712", "0.84588856", "0.8404447", "0.8398465", "0.8375364", "0.83491224", "0.83192796", "0.82949907", "0.8277566", "0.81680954", "0.8155346", "0.8112255", "0.8091075", "0.8072859", "0.8058921", "0.8058517", "0.8041678", "0.8036265",...
0.84180963
5
Return the state attributes of the device.
def device_state_attributes(self): attrs = {} for poc in self._pockets: id = poc[CONF_POCKET_ID] name = poc[CONF_POCKET_NAME] attrs[id] = name return attrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\r\n return self._attributes", "def device_state_attributes(self):\n return self._state_attrs", "def device_state_attributes(self):\n return self._state_attrs", "def device_state_a...
[ "0.92738223", "0.92053986", "0.91516256", "0.91516256", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148889", "0.9148746", "0.9148746", "0.9137698", "0.9110632",...
0.73110414
94
Return the entity ID.
def entity_id(self): return 'sensor.pocket_{}'.format(self._id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self) -> st...
[ "0.87450445", "0.87450445", "0.87450445", "0.87450445", "0.87450445", "0.86839527", "0.7594692", "0.7523408", "0.7392858", "0.7392858", "0.7368524", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123", "0.7363123...
0.0
-1
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1
Pad framewise_output to the same length as input frames. The pad value is the same as the value of the last frame.
def pad_framewise_output(framewise_output: torch.Tensor, frames_num: int): output = F.interpolate( framewise_output.unsqueeze(1), size=(frames_num, framewise_output.size(2)), align_corners=True, mode="bilinear").squeeze(1) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_framewise_output(framewise_output, frames_num):\n pad = framewise_output[:, -1:, :].repeat(1, frames_num - framewise_output.shape[1], 1)\n \"\"\"tensor for padding\"\"\"\n\n output = torch.cat((framewise_output, pad), dim=1)\n \"\"\"(batch_size, frames_num, classes_num)\"\"\"\n\n return outp...
[ "0.8229879", "0.821293", "0.67777383", "0.67004776", "0.6574267", "0.64285785", "0.63645834", "0.61845154", "0.60441667", "0.59772074", "0.59718066", "0.5957475", "0.59094816", "0.5904415", "0.5786226", "0.572692", "0.5724619", "0.5717271", "0.56892866", "0.5676037", "0.56541...
0.7947302
3
Tests that languages are set correctly
def test_set_language(self): # Test for default languages self.assertEqual(self.scraper.language_original, 'jpn') self.assertEqual(self.scraper.language_translated, 'eng') # Test after setting supported languages self.scraper.set_languages('jpn', 'eng') self.assertEqual(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_langs(self):\n self._api.Init(lang=\"eng\")\n lang = self._api.GetInitLanguagesAsString()\n self.assertEqual(lang, \"eng\")\n langs = self._api.GetLoadedLanguages()\n self.assertEqual(langs, [\"eng\"])\n self.assertIn(\"eng\", self._api.GetAvailableLanguages())", ...
[ "0.82205844", "0.81810033", "0.81763077", "0.799794", "0.78460836", "0.7663767", "0.7654795", "0.7654795", "0.75624233", "0.74955076", "0.74933475", "0.7261659", "0.7165447", "0.70093524", "0.6997815", "0.6950665", "0.69268453", "0.69231534", "0.68817383", "0.68645185", "0.68...
0.815594
3
This is a route handler/function! Helper function to handle the homepage route by returning the 'index.html' template. We don't need to pass anything to context for the index/root page.
def home(environ): return render_template(template_name="index.html", context={})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n logging.info('Entering route: HOME')\n\n logging.info('Rendering template: main.html')\n return render_template('main.html')", "def homepage():\n return render_template(\"home/index.html\")", "def home_page():\n\n return render_template('index.html')", "def home():\n return ma...
[ "0.8245871", "0.82334006", "0.81446964", "0.8079188", "0.8044673", "0.8006411", "0.80061173", "0.80061173", "0.80061173", "0.80061173", "0.7997146", "0.7997146", "0.799322", "0.799322", "0.799322", "0.799322", "0.799322", "0.799322", "0.7991015", "0.7941846", "0.7934459", "...
0.76254034
41
Converts a Jsonc object into a string of JSONC.
def jsonc_to_string(jsonc_obj): return simplejson.dumps(_convert_to_object(jsonc_obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prettify_jsonc(jsonc_obj, indentation=2):\n\n return simplejson.dumps(_convert_to_object(jsonc_obj), indent=indentation)", "def toJSON(object):\n\treturn json.dumps(object, ensure_ascii=False)", "def to_string(self):\n return json.dumps(self.to_json(), cls=ObjectEncoder)", "def _convert_to_object...
[ "0.763648", "0.70252323", "0.68276", "0.66171944", "0.657067", "0.657067", "0.6552616", "0.6547848", "0.65143585", "0.65031725", "0.6478948", "0.64694464", "0.6409248", "0.6409248", "0.6409248", "0.6409248", "0.63917047", "0.6386451", "0.637484", "0.6366294", "0.63393253", ...
0.9049657
0
A basic tokenizer to tokenize text into tokens. Feel free to change this to suit your need.
def basic_tokenizer(line, normalize_digits=True): line = re.sub(b'<u>', b'', line) line = re.sub(b'</u>', b'', line) line = re.sub(br'\[', b'', line) line = re.sub(br'\]', b'', line) words = [] _WORD_SPLIT = re.compile(b"([.,!?\"'-<>:;)(])") _DIGIT_RE = re.compile(br"\d") for fragment in line.strip().lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n sentence = Sentence(text)\n return sentence.tokens()", "def identity_tokenizer(text):\n return text", "def sentence_tokenizer(text):\n return sent_tokenize(text)", "def tokenize(text):\n wt = nltk.RegexpTokenizer(pattern=r'\\s+', gaps=True)\n tokens = wt.tokenize(text)...
[ "0.78429085", "0.7834927", "0.78222364", "0.7794322", "0.77724826", "0.77575785", "0.7694519", "0.76823807", "0.76819015", "0.7665016", "0.76151913", "0.7614053", "0.7604672", "0.7602172", "0.7560801", "0.75304157", "0.75261813", "0.7496317", "0.7494546", "0.74887586", "0.746...
0.0
-1
Constructs a new MeasurementSource object.
def __init__(self, doi='', reference=''): self.doi = doi self.reference = reference
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n name: str,\n source: str,\n value: np.ndarray,\n time: np.ndarray,\n units: str,\n ):\n self.name = name\n self.value = value\n self.time = time\n self.units = units\n super().__init__(source)", "def __init__(...
[ "0.6051371", "0.5905823", "0.580296", "0.5614142", "0.54517186", "0.543554", "0.53793937", "0.5364055", "0.5316719", "0.5305594", "0.529147", "0.5258558", "0.5245637", "0.52359635", "0.52341366", "0.5232506", "0.52248144", "0.51953", "0.5191575", "0.51896065", "0.5187835", ...
0.0
-1
Skip the next instruction on accumulator (flag) zero. If the accumulator zero_flag is True then the IP is incremented by two to execute the next instruction. The addr is ignored and can be zero.
def sza(self, addr): if self.alu.zero_flag: self.reg.ip_inc() self.reg.ip_inc()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip(self, skip):\n self._evaluated = False\n self._offset = skip\n return self", "def next_nonzero(self, param=None):\n self.set_seen()\n self.params['comment'][self.i] = self.tvar.get()\n\n ### At end\n if self.i > self.N-2:\n return False\n \n ...
[ "0.5458491", "0.5413596", "0.5221934", "0.5162113", "0.51294976", "0.5075789", "0.49938282", "0.49684665", "0.49445987", "0.492374", "0.49038655", "0.48820913", "0.4857151", "0.48517048", "0.48419204", "0.4826519", "0.4825338", "0.48088127", "0.48067182", "0.4802142", "0.4798...
0.47976422
21
Skip the next instruction on zerox (flag) zero. If the register zerox_flag is True then the IP is incremented by two to execute the next instruction. The addr is ignored and can be zero.
def szx(self, addr): if self.reg.zerox_flag: self.reg.ip_inc() self.reg.ip_inc()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_skip_next_if_vx_not_equals_kk(self, cpu):\n for x in range(0x0, 0xF):\n for v in range(0x0, 0xFF):\n cpu.V_register[x] = v\n for kk in range(0x0, 0xFF):\n cpu.opcode = 0x4000 | (x << 8) | kk\n for pc in [cpu.memory_start...
[ "0.55173874", "0.54714876", "0.5233479", "0.5209543", "0.5185521", "0.5167225", "0.51315415", "0.5054683", "0.50486857", "0.5045361", "0.49615648", "0.4943698", "0.49386424", "0.4933296", "0.49279723", "0.49018803", "0.48996148", "0.4887758", "0.48672345", "0.48550984", "0.47...
0.5585013
0
Create a gaussian sampling pattern where each point is sampled from a bivariate, concatenated normal distribution.
def gaussian_sampling(len_x, len_y, num_samples, spread_factor=5): # Create two truncated normal distributions for x and y dir lower = 0 upper_x = len_x mu_x = len_x // 2 sigma_x = len_x // spread_factor randgen_x = stats.truncnorm( (lower - mu_x) / sigma_x, (upper_x - mu_x) / si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_gaussian():\n amp = 10 * numpy.random.chisquare(3)\n width = numpy.random.chisquare(3)\n mean = numpy.random.uniform(-10 + width, 10 - width)\n x = numpy.linspace(-10, 10, 500)\n y = amp * numpy.exp(- (x - mean) ** 2 / width ** 2)\n add_noise(y, 0.1)\n return x, y", "def _gaussi...
[ "0.7181034", "0.6878976", "0.67922235", "0.6783051", "0.66139835", "0.6597029", "0.6592723", "0.656582", "0.6475827", "0.643301", "0.6408713", "0.63915306", "0.63869435", "0.6341883", "0.6322929", "0.63126004", "0.6296769", "0.6215988", "0.6208004", "0.6206198", "0.62055683",...
0.0
-1
Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts.
def merge_dicts(*dict_args): result = {} for dictionary in dict_args: result.update(dictionary[0]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def merge_dict(lhs, rhs, override=True):\n if not isinstance(lhs, dict) or not isinstance(rhs, dict):\n if override:\n retur...
[ "0.76667774", "0.7660147", "0.7478514", "0.74524105", "0.74524105", "0.74524105", "0.7374645", "0.7340503", "0.73065865", "0.728", "0.7274689", "0.7254571", "0.7251997", "0.7251997", "0.7251997", "0.7251997", "0.7251997", "0.7251997", "0.7232071", "0.72219414", "0.7216211", ...
0.7103071
41
Annotate barplot with pvalues.
def paired_barplot_annotate_brackets(txt, x_tick, height, y_lim, dh=.05, barh=.05, fs=10, maxasterix=None, ax=None): if type(txt) is str: text = txt else: # * is p < 0.05 # ** is p < 0.005 # *** is p < 0.0005 # etc. text = '' p = .05 while txt < ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_value_labels(ax, spacing=5):\n\n # For each bar: Place a label\n for rect in ax.patches:\n # Get X and Y placement of label from rect.\n y_value = rect.get_height()\n x_value = rect.get_x() + rect.get_width() / 2\n\n # Number of points between bar and label. Change to your...
[ "0.722161", "0.6651087", "0.6488847", "0.64184594", "0.6393515", "0.6376214", "0.6118446", "0.6086852", "0.5960943", "0.59527975", "0.5939206", "0.5854869", "0.57599854", "0.574859", "0.56947863", "0.56891966", "0.56863445", "0.5686152", "0.5666118", "0.5646012", "0.56211436"...
0.56895536
15
Remove extremes outside of scope eg. Aruba for NL Tenerife is kept within the scope, PT only inland
def correct_extremes(df, corrections_dict): for country, attributes in corrections_dict.items(): for coordinate, value in attributes.items(): df.loc[df.ISO3166A2 == country, coordinate] = value return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_distance_extremes(scan, low, high):\n scan.samples[:] = [sample for sample in scan.samples if (\n sample.distance >= low and sample.distance <= high)]", "def _get_extremes(self, attr='values'):\n # calculate the maximum and minimum for all series\n series_max = [0]\n ser...
[ "0.5920364", "0.58428663", "0.58332807", "0.5781893", "0.5607702", "0.5563302", "0.5553395", "0.55192244", "0.5501502", "0.54916805", "0.54845417", "0.5465621", "0.5422628", "0.54032284", "0.5392566", "0.5370169", "0.53650063", "0.5344582", "0.53361547", "0.5326246", "0.53082...
0.0
-1
returns true if time since start method called is greater than the current time
def has_timed_out(self): return time.time() > self.end_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_now(self, local_time):\n return self.start_time <= local_time < self.stop_time", "def is_past(self) -> bool:\n return self.start < timezone.now()", "def reached(self) -> bool:\n return (time.time() - self._start) >= self.seconds", "def isPast(self):\n return (self._t < tim...
[ "0.75587463", "0.7447426", "0.7322484", "0.72749513", "0.7180824", "0.7122764", "0.71066934", "0.71055126", "0.70186746", "0.6979792", "0.69545984", "0.6890423", "0.68858856", "0.6879124", "0.68712676", "0.68349", "0.68119526", "0.68085545", "0.67744505", "0.67661947", "0.676...
0.62234664
73
Preprocess texts and return lemmatized words params
def preprocess(nlp, strlist, min_token_len = 2, allowed_pos = ['ADV', 'ADJ', 'VERB', 'NOUN', 'PART', 'NUM', 'PROPN']): removal = ['-', r'i\.e\.'] res = list() not_stopword = {'call'} for string in strlist: text = re.sub(r"|".join(removal), ' ', strin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatize_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = None\n if self.lemmatize_method == 'wordnet':\n cleaned_tokens = [self.lemmatizer.lemmatize(token) for token in tokens]\n else:\n cleaned_tokens = [self.lemmatizer.stem(token) for token in...
[ "0.76077497", "0.7535882", "0.7332237", "0.7323411", "0.7321157", "0.72312474", "0.72027", "0.71990985", "0.7191803", "0.718809", "0.7180629", "0.71725553", "0.71674454", "0.7139645", "0.7139337", "0.71316224", "0.71124774", "0.7100935", "0.7079784", "0.7046905", "0.69840753"...
0.0
-1
Returns an initializer that generates tensors with a single value.
def constant_initializer(value=0.0, dtype=dtypes.float32): def _initializer(shape, dtype=_assert_float_dtype(dtype)): return constant_op.constant(value, dtype=dtype, shape=shape) return _initializer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initializer(init, shape):\n if init == \"zero\":\n # The generated tensor has only zero-valued elements\n return tf.zeros(shape)\n elif init == \"he\":\n # fan_in gives the number of element in the tensor\n fan_in = np.prod(shape[0:-1])\n std = 1 / np.sqrt(fan_in)\n ...
[ "0.6627922", "0.615838", "0.6008107", "0.6008107", "0.5984663", "0.59399194", "0.5935742", "0.5860273", "0.5840129", "0.5839089", "0.5685631", "0.56294525", "0.56222284", "0.560261", "0.55869544", "0.5577956", "0.5568961", "0.5558264", "0.55410224", "0.5514685", "0.5513896", ...
0.63778627
1
Returns an initializer that generates a truncated normal distribution. These values are similar to values from a `random_normal_initializer` except that values more than two standard deviations from the mean are discarded and redrawn. This is the recommended initializer for neural network weights and filters.
def truncated_normal_initializer(mean=0.0, stddev=1.0, seed=None, dtype=dtypes.float32): def _initializer(shape, dtype=_assert_float_dtype(dtype)): return random_ops.truncated_normal(shape, mean, stddev, dtype, seed=seed) return _initializer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _truncated_normal_init(tensor, mean=0, stddev=1):\n\n total_size = tensor.numel()\n\n # determine the scipy random state from the torch seed\n # the numpy seed can be between 0 and 2**32-1\n np_seed = torch.randint(0, 2**32-1, (1, 1)).view(-1).item()\n np_state = RandomState(np_seed)\n # trun...
[ "0.77179456", "0.7668178", "0.7668178", "0.76566315", "0.7642495", "0.7544176", "0.74893165", "0.73554987", "0.734346", "0.7285099", "0.70847297", "0.6747321", "0.67461723", "0.6746049", "0.67441225", "0.67441225", "0.66025716", "0.6596376", "0.6525444", "0.6525444", "0.64900...
0.854098
0
Returns an initializer that generates tensors without scaling variance. When initializing a deep network, it is in principle advantageous to keep the scale of the input variance constant, so it does not explode or diminish by reaching the final layer. If the input is `x` and the operation `x W`, and we want to initiali...
def uniform_unit_scaling_initializer(factor=1.0, seed=None, dtype=dtypes.float32, full_shape=None): def _initializer(shape, dtype=_assert_float_dtype(dtype)): scale_shape = full_shape if full_shape is not None else shape input_size = 1.0 # Estimating input size is not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normc_init(std=1.0, axis=0):\n def _initializer(shape, dtype=None, partition_info=None): # pylint: disable=W0613\n out = np.random.randn(*shape).astype(np.float32)\n out *= std / np.sqrt(np.square(out).sum(axis=axis, keepdims=True))\n return tf.constant(out)\n return _initializer", ...
[ "0.6336408", "0.63162714", "0.6254378", "0.6108202", "0.6093799", "0.60872686", "0.60849917", "0.595789", "0.59293914", "0.5887913", "0.5887913", "0.5865913", "0.58284", "0.58144355", "0.576156", "0.5744148", "0.5726834", "0.57254696", "0.572306", "0.57077867", "0.5687445", ...
0.63331884
1
Create a random tensor such that backprop neither vanishes nor explodes.
def _random_walk(shape, nonlinearity, dtype=dtypes.float32, seed=None, name="random_walk"): assert len(shape) == 2, "Random Walk initialization only supports 2D tensors." num_inputs = shape[0] if nonlinearity == math_ops.tanh: # No real formula for this case yet, but this works well for many ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _randomly_negate_tensor(self, tensor):\r\n should_flip = tf.cast(tf.floor(tf.random.uniform([]) + 0.5), tf.bool)\r\n final_tensor = tf.cond(should_flip, lambda: tensor, lambda: -tensor)\r\n return final_tensor", "def beta_gen_nonneg(p):\n return np.clip(np.random.normal(0, 3, p), 0, N...
[ "0.6999135", "0.6305865", "0.6047804", "0.59519315", "0.59018725", "0.58809227", "0.57793576", "0.573209", "0.5730425", "0.5714348", "0.57059866", "0.5691614", "0.5666119", "0.5656598", "0.5636389", "0.5631424", "0.5609406", "0.5562518", "0.555518", "0.55262125", "0.55052936"...
0.0
-1
Generate a tensor used to initialize a variable.
def __call__(self, shape, dtype=dtypes.float32): return random_ops._random_walk(shape, self._nonlinearity, dtype, seed=self._seed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initializer(init, shape):\n if init == \"zero\":\n # The generated tensor has only zero-valued elements\n return tf.zeros(shape)\n elif init == \"he\":\n # fan_in gives the number of element in the tensor\n fan_in = np.prod(shape[0:-1])\n std = 1 / np.sqrt(fan_in)\n ...
[ "0.7069225", "0.6859073", "0.6498078", "0.64272267", "0.64219946", "0.64098", "0.6369168", "0.6353301", "0.63508284", "0.63096964", "0.63017136", "0.62703353", "0.6246332", "0.61957157", "0.6187092", "0.6187092", "0.61342996", "0.607928", "0.6058933", "0.60520655", "0.6033234...
0.0
-1
Returns whether a user is authenticated or not. The default is for this method to always return true for subclasses of UserBase and False for subclasses of AnonymousUserBase
def is_authenticated(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(self._authenticated)", "def is_authenticated(self) -> bool:\n return self._authenticated", "def is_authenticated(self):\n r...
[ "0.8137904", "0.79575855", "0.7907344", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.7900938", "0.78515196", "0.77672476", "0.7602648", "0.74600065", "0.7435144",...
0.77123046
21
Returns a boolean of whether the raw_password was correct. Handles encryption formats behind the scenes.
def check_password(raw_password, enc_password): algo, salt, hsh = enc_password.split('$') return hsh == get_hexdigest(algo, salt, raw_password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password(self, raw_password):\n return check_password(raw_password, self.password)", "def password_is_correct(self, password):\n return Bcrypt().check_password_hash(self.password, password)", "def validate_password(self, password):\n return self._password == encrypt_password(password...
[ "0.7857066", "0.737345", "0.7331467", "0.7231976", "0.7169536", "0.7167939", "0.7099501", "0.70844895", "0.7061078", "0.7013788", "0.6930202", "0.69245034", "0.6905197", "0.69042325", "0.6874329", "0.68688875", "0.685561", "0.6843229", "0.6842834", "0.6842375", "0.6816546", ...
0.7618427
2
Sets the password of the user. Alorithm
def set_password(self, raw_password): if raw_password is None: self.set_unusable_password() else: import random algo = PASSWORD_ALGO salt = get_hexdigest(algo, str(random.random()), str(random.random()))[:5] hsh = get_hexdigest(algo, salt, raw_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setpassword(self, pwd):\n pass", "def set_password(self, password):\n self.password = password", "def set_password(self, password):\n self.PASS = password", "def set_password(self, password):\n self.password_hash = generate_password_hash(f\"{password}{self.user_salt}\")", "d...
[ "0.875472", "0.83630127", "0.8311807", "0.8269209", "0.8245993", "0.82397026", "0.82305145", "0.8226256", "0.8184368", "0.81251776", "0.8113186", "0.8099338", "0.8099338", "0.80857646", "0.806437", "0.8048305", "0.8044547", "0.8025353", "0.8016113", "0.7981405", "0.7967984", ...
0.720649
69
Returns a boolean of whether the raw_password was correct. Handles encryption formats behind the scenes.
def check_password(self, raw_password): return check_password(raw_password, self.password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password(raw_password, enc_password):\n algo, salt, hsh = enc_password.split('$')\n return hsh == get_hexdigest(algo, salt, raw_password)", "def check_password(raw_password, enc_password):\n algo, salt, hsh = enc_password.split('$')\n return hsh == get_hexdigest(algo, salt, raw_password)", ...
[ "0.7619669", "0.7619669", "0.7372876", "0.7331418", "0.7230792", "0.7168213", "0.71667486", "0.7099707", "0.7084301", "0.7061001", "0.70148826", "0.6929653", "0.6923825", "0.69043785", "0.690359", "0.68750536", "0.6868129", "0.6855925", "0.6844144", "0.6842196", "0.684199", ...
0.7856797
0
Get the user from a user_id. If a backend_name is given then the backend with that name will be used. If a backend_name is not given (default) then all backends are tried.
def get_user(user_id, backend_name=None): # Avoid making DB queries when we know that the user # doesn't exist. if user_id is not None: if backend_name: backends = [(backend_name, load_backends(backend_name))] else: backends = get_backends() for name, backend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_authenticated_user(username, backend_name):\r\n user = models.DjangoStorage.user.user_model().objects.get(username=username)\r\n match = models.DjangoStorage.user.get_social_auth_for_user(user, provider=backend_name)\r\n\r\n if not match:\r\n raise User.DoesNotExist\r\n\r\n user.backend ...
[ "0.7111483", "0.6955441", "0.6939471", "0.68387264", "0.6819894", "0.6815466", "0.68085545", "0.6796037", "0.67802584", "0.6777591", "0.6734524", "0.67315", "0.67286944", "0.6726206", "0.67216116", "0.6705266", "0.6702021", "0.66796607", "0.66796607", "0.66796607", "0.6679660...
0.8500259
0
Get the axes coordinate system bounding boxes for each city.
def _getCityBoundingBoxes(self,df,fontname,fontsize,ax): fig = ax.get_figure() fwidth,fheight = fig.get_figwidth(),fig.get_figheight() plt.sca(ax) axmin,axmax,aymin,aymax = plt.axis() axbox = ax.get_position().bounds newfig = plt.figure(figsize=(fwidth,fheight)) n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(self):\n latlon00 = self.ij_to_latlon(-1,-1)\n latlon01 = self.ij_to_latlon(-1,self.domain_size[1]+1)\n latlon11 = self.ij_to_latlon(self.domain_size[0]+1,self.domain_size[1]+1)\n latlon10 = self.ij_to_latlon(self.domain_size[0]+1,-1)\n return (latlon00,latlon01,...
[ "0.7102441", "0.68526953", "0.6833005", "0.6780483", "0.6707895", "0.6667037", "0.66374344", "0.6618209", "0.6618209", "0.6594542", "0.6590478", "0.6568437", "0.6559934", "0.6500408", "0.64600563", "0.6453037", "0.64077026", "0.63975704", "0.63873124", "0.6377541", "0.6365121...
0.7309756
0
Returns Using the arrow time library, get_time_last_week returns the exact time from 1 week ago.
def get_time_last_week(): current_time = arrow.utcnow() # Get the current UTC Time return current_time.shift(weeks=-1) # Return the shifted time by -1 weeks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monday_last_week():\n today = datetime.date.today()\n last_week = today - datetime.timedelta(days=7)\n return last_week - datetime.timedelta(days=(last_week.isoweekday() - 1))", "def last_week(today: Optional[datetime] = None, tz: Any = None) -> Tuple[datetime, datetime]:\n if today is None:\n t...
[ "0.72086954", "0.68326217", "0.66397226", "0.6628594", "0.6378431", "0.6200789", "0.6200194", "0.61299044", "0.6091091", "0.6062652", "0.6013681", "0.5949774", "0.59155774", "0.59052527", "0.5857257", "0.58545804", "0.5853213", "0.5820008", "0.57480353", "0.57320786", "0.5719...
0.8797187
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] plt.imshow(cm, interpolation='nearest', cmap=cmap) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81920755", "0.8093736", "0.8028212", "0.8017333", "0.79923165", "0.7989431", "0.79789335", "0.7974398", "0.795948", "0.79555666", "0.7935652", "0.7932704", "0.7932632", "0.7929465", "0.7924336", "0.7922666", "0.79221356", "0.7921299", "0.79209703", "0.7920307", "0.7916008"...
0.0
-1
Test that deleting a vendor succeeds
def test_deleting_a_vendor_succeeds(self, client, create_user, authenticate_user, new_vendors): vendor = new_vendors auth_header = self.authenticate_user(authenticate_user, NEW_USER) response = client.delete(self.vendor_url(vendor[0].id, 'soft'), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hard_deleting_a_vendor_succeeds(self, client, create_user,\n authenticate_user,\n new_vendors):\n\n vendor = new_vendors\n auth_header = self.authenticate_user(authenticate_user, NEW_USER)\n respon...
[ "0.7799253", "0.7661258", "0.7661258", "0.7494544", "0.72651595", "0.72016686", "0.7159629", "0.71584386", "0.7120205", "0.7118483", "0.7116047", "0.71136045", "0.7079588", "0.7051335", "0.70446366", "0.698235", "0.695312", "0.6908165", "0.68940604", "0.68648523", "0.68387246...
0.78644544
0
Test that deleting an already deleted vendor fails
def test_deleting_already_soft_deleted_vendor_fails(self, client, create_user, authenticate_user, new_vendors): vendor = new_vendors ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_device(self):\n pass", "def test_delete_device(self):\n pass", "def test_03_product_delete(self):\n product = self.create_product()\n products = self.product_obj.search([])\n self.assertIn(product, products)\n product.unlink()\n self.assertNotIn(...
[ "0.75459623", "0.75459623", "0.7452192", "0.74075365", "0.7372252", "0.72235596", "0.72165644", "0.71347064", "0.71295965", "0.7115089", "0.7114658", "0.7094146", "0.7082701", "0.70716214", "0.6993446", "0.69867593", "0.69623595", "0.6959551", "0.6947394", "0.69199646", "0.68...
0.7647993
0
Test that soft deleting an invalid vendor fails
def test_soft_deleting_a_nonexistent_vendor_fails(self, client, create_user, authenticate_user, new_vendors): auth_header = self.authenticate_user(authenticate_user, NEW_USER) response = client.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleting_already_soft_deleted_vendor_fails(self, client,\n create_user,\n authenticate_user,\n new_vendors):\n\n vendor = new_vendors\...
[ "0.7583298", "0.7297901", "0.7297901", "0.71233684", "0.7014351", "0.697483", "0.69399303", "0.6892412", "0.67867446", "0.67510253", "0.67497027", "0.6725129", "0.6677541", "0.6651298", "0.6626273", "0.6564269", "0.6551278", "0.6524578", "0.6523663", "0.6521882", "0.64992213"...
0.7316185
1
Test that hard deleting a vendor succeeds
def test_hard_deleting_a_vendor_succeeds(self, client, create_user, authenticate_user, new_vendors): vendor = new_vendors auth_header = self.authenticate_user(authenticate_user, NEW_USER) response = client...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_device(self):\n pass", "def test_delete_device(self):\n pass", "def test_deleting_already_soft_deleted_vendor_fails(self, client,\n create_user,\n authenticate_user,\n ...
[ "0.7660776", "0.7660776", "0.7389471", "0.7323165", "0.71299076", "0.7085943", "0.70615387", "0.70555806", "0.7034082", "0.7031129", "0.7020148", "0.69702536", "0.6954879", "0.69524693", "0.69414586", "0.69004005", "0.68843096", "0.68721646", "0.6847438", "0.6811688", "0.6809...
0.7479289
2
Test that hard deleting an invalid vendor fails
def test_hard_deleting_a_nonexistent_vendor_fails(self, client, create_user, authenticate_user, new_vendors): auth_header = self.authenticate_user(authenticate_user, NEW_USER) response = client.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_device(self):\n pass", "def test_delete_device(self):\n pass", "def test_deleting_already_soft_deleted_vendor_fails(self, client,\n create_user,\n authenticate_user,\n ...
[ "0.73035026", "0.73035026", "0.72201896", "0.7124586", "0.70758057", "0.6979314", "0.6929329", "0.6891647", "0.6888303", "0.6761945", "0.67355156", "0.67230034", "0.67109", "0.6703731", "0.66598463", "0.6619669", "0.6597893", "0.6521848", "0.6498321", "0.6485977", "0.6470646"...
0.7105173
4
cosine learning rate decay cosine learning rate decay with parameters proposed FixMatch base_lr cos( (7\pi cur_step) / (16 max_warmup_iter) )
def cosine_decay(base_lr, max_iteration, cur_step): return base_lr * (math.cos( (7*math.pi*cur_step) / (16*max_iteration) ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_lr_cosine(self, base_lr):\n # 400, 1e-3\n warmup_steps = 10\n annealing_steps = 500\n end_lr = 1e-3\n if self.steps < warmup_steps:\n lr = base_lr * (self.steps+1) / warmup_steps\n elif self.steps < warmup_steps+annealing_steps:\n step = se...
[ "0.76215017", "0.71308315", "0.69857293", "0.68086326", "0.6747723", "0.6626933", "0.6619074", "0.6434229", "0.62120056", "0.6203357", "0.6032085", "0.6017297", "0.6017297", "0.6016436", "0.6016436", "0.6001032", "0.5964419", "0.5964419", "0.5959927", "0.5958887", "0.5956513"...
0.79123783
0
Compute precision, recall and F_beta score of the predicted labels Precision = tp / (tp+fp) where tp is the number of true positives (correctly labelled prediction) and fp is the false positives. Recall is tp (tp + fn), where fn is the number of false negatives (incorrectly labelled as another class) F_beta is a weight...
def precision_recall_fscore(y_pred, y_actual, beta, average="micro"): labels = np.unique(y_actual) lab_length = len(labels) tp = y_pred == y_actual tp_b = y_actual[tp].astype(np.int64) # True positive count y_actual = y_actual.astype(np.int64) # Actual class labels y_pred = y_pred.astype(np.in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision_recall_fscore(true, predicted, beta=1, labels=None, pos_label=None, average=None):\n\n # Build contingency table as ldict\n ldict = {}\n for l in labels:\n ldict[l] = {\"tp\": 0., \"fp\": 0., \"fn\": 0., \"support\": 0.}\n\n for t, p in zip(true, predicted):\n if t == p:\n ...
[ "0.7605206", "0.7575995", "0.75451744", "0.7531215", "0.72964346", "0.7291718", "0.7131089", "0.7008994", "0.6963229", "0.69260466", "0.68862015", "0.6874378", "0.6859457", "0.68544525", "0.67534006", "0.67511564", "0.6750841", "0.6718821", "0.6715146", "0.6712433", "0.669633...
0.7687375
0
Estimate n dimensional gaussian parameters for dataset X
def estimate_gaussian_params(X): mu = X.mean(axis=0) var = X.std(axis=0)**2.0 return mu,var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate_multi_gaussian(X):\n m, n = X.shape\n mu = mean(X, axis=0)\n sigma = cov_matrix(X, mu)\n\n return mu, sigma", "def estimateGaussian(X):\n mu = X.mean(0, keepdims=True).T\n sigma2 = X.var(0, keepdims=True).T\n return mu, sigma2", "def estimateGaussian(X):\n\tmu = np.mean(X, axi...
[ "0.7689894", "0.7635076", "0.743624", "0.7307594", "0.72897595", "0.70455045", "0.70326394", "0.6980961", "0.68036413", "0.67783725", "0.6752891", "0.67495954", "0.6725792", "0.6713383", "0.6713383", "0.669505", "0.66663307", "0.66610616", "0.6656524", "0.66255856", "0.661270...
0.80568403
0
Transform XML msg into dict.
def parseMsg(self): # These 4 elements are always present # "ToUserName" # "FromUserName" # "CreateTime" # "MsgType" # Following elements depends on MsgType # "MsgId" # "Content" # "MediaId" # "PicUrl" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict(self):\n return xmltodict.parse(str(self))", "def parse_user_msg(xml):\n if not xml:\n return\n\n wechat_message = dict((child.tag, to_text(child.text))\n for child in ElementTree.fromstring(xml))\n wechat_message[\"raw\"] = xml\n wechat_message[\"type\...
[ "0.6497989", "0.62789243", "0.62068594", "0.61998916", "0.6168027", "0.6102012", "0.6079798", "0.5970177", "0.59243935", "0.5700769", "0.566267", "0.56518805", "0.5634845", "0.5613529", "0.5570247", "0.55678165", "0.5543807", "0.55166274", "0.54913425", "0.5471225", "0.545504...
0.66610605
0
Return true if the ride can be taken at the given start_time.
def is_feasible(self, start_time): if start_time <= self.earliest_start: return True else: return (start_time - self.earliest_start) <= self.buffer_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal(self, start, end) -> bool:\n return self.board(end) == 0 \\\n and self.board(start) > 0 \\\n and self._check_zone_locks(start, end) \\\n and self.exists_path(start, end)", "def has_time(self):\n return isinsta...
[ "0.6419667", "0.6325205", "0.6002013", "0.59686935", "0.59500194", "0.5915359", "0.58983153", "0.58698255", "0.5863673", "0.5850344", "0.581316", "0.57416785", "0.57410574", "0.5731883", "0.57257015", "0.57130295", "0.5694015", "0.56868196", "0.56867737", "0.5662277", "0.5655...
0.6158499
2
Image segmentation tf.data.Dataset constructor for batching from tfrecords.
def __init__(self, tfrecord_paths: List[str], image_width:int, image_channels=3, mask_channels=1, seed=0, augmenter: Optional[Augmenter]=None, seperate_background_channel: bool = True): self.tfrecord_paths = tfrecord_paths self.num_shards = len(self.tfrecord_paths) self.tfrec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dataset(self, split, directory, data_file):\n del split\n\n filenames = generate_filenames(self.name, directory, data_file)\n\n def parse_function(record):\n image_dim = self.IMAGE_SIZE_PX\n features = tf.parse_single_example(\n record,\n features={\n 'image_r...
[ "0.7134502", "0.67391247", "0.6677995", "0.66459924", "0.65505475", "0.65086603", "0.64664376", "0.6451773", "0.64167744", "0.6394336", "0.6383612", "0.63396984", "0.63367414", "0.633545", "0.6325775", "0.6309748", "0.6290949", "0.62855977", "0.627523", "0.62557524", "0.62267...
0.65276515
5
Parse a TF Example into corresponding image and mask. Positive class is assumed to be encoded as the int value 255 in tfrecords.
def _parse_example(self, example, scale_to_0_1: bool = False): features = { 'image': tf.FixedLenFeature([], tf.string), 'mask': tf.FixedLenFeature([], tf.string), } parsed_example = tf.parse_single_example(example, features) image = tf.decode_raw(parsed_example[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser(self, serialized_example):\n features = {\n 'image/height': tf.FixedLenFeature([], tf.int64),\n 'image/width': tf.FixedLenFeature([], tf.int64),\n 'image/colorspace': tf.FixedLenFeature([], tf.string),\n 'image/channels': tf.FixedLenFeature([], tf.int64...
[ "0.74753284", "0.74345124", "0.73909676", "0.7358628", "0.73342675", "0.72879314", "0.7251159", "0.7187995", "0.7168596", "0.7160668", "0.71130675", "0.7040652", "0.7018271", "0.6978618", "0.69366145", "0.6862786", "0.6860476", "0.6860038", "0.6828324", "0.68028533", "0.67198...
0.7975932
0
Parse a TF Example into corresponding image and mask. Positive class is assumed to be encoded as the int value 255 in tfrecords.
def parse_example(example, image_width:int = 224, image_channels: int = 3, mask_channels: int = 1000, scale_to_0_1: bool = False, serialized_mask_raw_dtype = tf.float64): features = { 'image': tf.FixedLenFeature([], tf.string), 'mask': tf.FixedLenFeature([], tf.string), } parsed_example = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_example(self, example, scale_to_0_1: bool = False):\n\n features = {\n 'image': tf.FixedLenFeature([], tf.string),\n 'mask': tf.FixedLenFeature([], tf.string),\n }\n parsed_example = tf.parse_single_example(example, features)\n\n image = tf.decode_raw(pa...
[ "0.7975776", "0.7475104", "0.74351525", "0.73899114", "0.7358636", "0.7333993", "0.7251172", "0.7188392", "0.7168503", "0.7160087", "0.71133935", "0.70410377", "0.7017461", "0.6977531", "0.693613", "0.6862388", "0.68610686", "0.68592453", "0.68287444", "0.68029094", "0.671887...
0.7288104
6
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(PlanMovementRequest, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.group is None: self.group = '' if self.rand_start is None: self.rand_start = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77937967", "0.77195275", "0.77195275", "0.7685702", "0.762502", "0.7562939", "0.74384665", "0.7416083", "0.73515767", "0.73078126", "0.7280228", "0.723719", "0.72265446", "0.72230625", "0.72230625", "0.7218876", "0.721051", "0.721051", "0.721051", "0.721051", "0.721051", ...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(PlanMovementResponse, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.error is None: self.error = 0 if self.start_pos is None: self.start_pos = [] if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794164", "0.7721611", "0.7721611", "0.7687804", "0.7626575", "0.7565245", "0.74406534", "0.74182206", "0.73521465", "0.73088044", "0.72807634", "0.7238138", "0.7227902", "0.72254795", "0.72254795", "0.7219563", "0.7212849", "0.7212849", "0.7212849", "0.7212849", "0.721284...
0.0
-1
When passed a number returns a list of all prime numbers < n
def primes_below(n): L, M = [2], [x for x in range(3, int(n), 2)] if n <= 2: print('There are no primes below 2') return None for i in range(3, int(n), 2): if M[i // 2 - 1] != 0 and is_prime(i): L.append(i) for j in range(i, int(n), 2 * i): M[j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]", "def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i)\n return primeList", "def make_primes(n):\n out_list = []\n for i in range(2, n):\n if is_prime(i):\n o...
[ "0.8449782", "0.84418297", "0.83096576", "0.81390417", "0.81324494", "0.8130169", "0.80668473", "0.80516845", "0.8002192", "0.796871", "0.7966493", "0.7876625", "0.78764343", "0.78710705", "0.7821648", "0.77987", "0.7797344", "0.779158", "0.7774276", "0.7772136", "0.7770932",...
0.7463167
53
Remove Stopwords, Form Bigrams, Trigrams and Lemmatization
def process_words(texts, bigram_mod,trigram_mod,stop_words=stop_words, allowed_postags=['NOUN', 'ADJ', 'VERB', 'ADV']): texts = [[word for word in simple_preprocess(str(doc)) if word not in stop_words] for doc in texts] texts = [bigram_mod[doc] for doc in texts] texts = [trigram_mod[bigram_mod[doc]] for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)", "def clean_text(text):\n\n lemmizer = WordNetLemmatizer()\n stem...
[ "0.75946814", "0.750008", "0.7484894", "0.7262158", "0.7241527", "0.72373825", "0.7193496", "0.7177442", "0.7106464", "0.71030277", "0.7102151", "0.70789164", "0.7044341", "0.69387245", "0.6920597", "0.6918305", "0.6917309", "0.6906191", "0.6905368", "0.6903818", "0.68761015"...
0.6732504
26
returns a list of parents to this domain. It is possible for a node to have multiple parents if each of the parent has made a request to the node.
def get_parents(self): return self.parents
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parents(self):\n p = self\n result = []\n while p:\n result.append(p)\n p = p.parent\n return result", "def parents(self):\n if self._pedigree is None:\n raise Exception(\"Pedigree is not defined\")\n return [self._pedigree.individual...
[ "0.83702886", "0.8325622", "0.8298969", "0.8177237", "0.7833667", "0.78315437", "0.78058773", "0.7801098", "0.7755341", "0.7688186", "0.7492334", "0.74550074", "0.7450315", "0.74398726", "0.74004024", "0.73172647", "0.7253067", "0.7239446", "0.72256595", "0.72224253", "0.7217...
0.7012659
32
Get argparse.Namespace of parsed user arguments, with sensible defaults set.
def get_args(input_args): parser = argparse.ArgumentParser( prog="PythiaPlotter", description="Convert MC event into a particle evolution diagram. " "Requires you to choose an input format, and an output printer.", formatter_class=argparse.RawTextHelpFormatter ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args(self, args=None, namespace=None):\n # This will call our parse_known_args below, so don't use setup_logging.\n namespace = argparse.ArgumentParser.parse_args(\n self, args=args, namespace=namespace)\n return namespace", "def parse() -> argparse.Namespace:\n parse...
[ "0.6995912", "0.65189636", "0.6266619", "0.6256577", "0.61642283", "0.6150543", "0.6127023", "0.60493916", "0.6015095", "0.600252", "0.5996381", "0.59579927", "0.59063697", "0.5889722", "0.58722967", "0.58713835", "0.5851699", "0.584528", "0.5836211", "0.58179045", "0.5817024...
0.0
-1
Return a list of lines read from file.
def read_file_lines(filepath): with open(filepath, 'r', encoding='utf-8', newline=os.linesep) as f: return f.readlines()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_lines_from_file(fname):\n return []", "def read_file_in_lines(filename):\r\n\twith open(filename) as infile:\r\n\t\tlines = infile.readlines()\r\n\treturn [line.strip() for line in lines]", "def read_lines(filename):\n with open(filename, 'r') as f:\n lines = f.readlines()\n return lin...
[ "0.84631497", "0.8437037", "0.835836", "0.829921", "0.8285388", "0.8251626", "0.8129196", "0.81015974", "0.8096941", "0.80671346", "0.8004761", "0.79964215", "0.7986865", "0.798173", "0.7946105", "0.7942578", "0.78944546", "0.78385884", "0.78373736", "0.780257", "0.77824664",...
0.8207441
6
Check if file extension is in given extensions.
def has_extension(filepath, extensions): return any(filepath.endswith(ext) for ext in extensions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)", "def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)", "def match_extensions(filename):\n return any(filename.endswith(e) for e in extensions)", ...
[ "0.86387336", "0.86387336", "0.8598995", "0.8555174", "0.8555174", "0.8391166", "0.8329074", "0.81875426", "0.79908013", "0.7962456", "0.79498786", "0.78666896", "0.78062314", "0.7771527", "0.7757888", "0.7693334", "0.7673005", "0.75269556", "0.7500926", "0.7425389", "0.73680...
0.84074354
5
Compute the fitness score of the ANM model in the x>y direction.
def anm_estimate(self, x, y, regressor=GPR(), test_method=hsic_test): x = scale(x).reshape((-1, 1)) y = scale(y).reshape((-1, 1)) y_predict = regressor.estimate(x, y) flag = test_method(y - y_predict, x, alpha=self.alpha) return flag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fitness(individual, X, y):\n yhat = individual.evaluate(X)\n return ((y - yhat) ** 2).sum()", "def _calculate_fitness(self):\n pass", "def calculate_fitness(self):\n fitness = (self.matrix * self.weight_matrix).sum()\n self.fitness = fitness\n return fitness", "...
[ "0.72466934", "0.7141622", "0.71325946", "0.7007074", "0.69479203", "0.69086623", "0.68808186", "0.6879599", "0.68689346", "0.681692", "0.67969614", "0.67446846", "0.67055374", "0.6699242", "0.6672816", "0.6618265", "0.661402", "0.6613973", "0.6562719", "0.6556334", "0.655294...
0.0
-1
Run when entity about to be added to hass.
async def async_added_to_hass(self) -> None: self.async_on_remove( self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.disconnect) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_added_to_hass(self):\n self.hass.data[DOMAIN].add_entity_id(self.entity_id)\n self.hass.data[DOMAIN].add_sensor(self)", "async def async_added_to_hass(self):\n await super().async_added_to_hass()\n self.coordinator.entities.append(self)", "async def async_added_to_ha...
[ "0.7644598", "0.7508649", "0.7295819", "0.72008663", "0.712577", "0.66380143", "0.66380143", "0.6609968", "0.65870553", "0.6568923", "0.65588206", "0.65459687", "0.6541892", "0.6523766", "0.6480282", "0.6473207", "0.6434319", "0.64239204", "0.6419268", "0.6390959", "0.6389259...
0.61387646
51
Return the ID of this light.
def unique_id(self): return self._light.address
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getId(self):\n return self.identifier", "def get_ID(self):\n return self.ID", "def ID(self):\n return self._id", "def GetID(self):\n return self.id", "def getID(self):\n return self._id", "def get_id(self):\n return self.id", "def get_id(self):\n ret...
[ "0.74645543", "0.7406181", "0.74057865", "0.73915154", "0.7374486", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", "0.7370322", ...
0.0
-1
Return true if light is on.
def is_on(self): return self._brightness > 0 or self._white_value > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def light_is_on(self):\r\n return self._light == \"ON\"", "def light_is_on(self):\n return self._light == \"ON\"", "def is_on(self):\n return self._light_on", "def is_light(self) -> bool:\n return ATTRIBUTE.Light.value in self.type_data.attributes", "def is_light(self) -> bool:\...
[ "0.9035416", "0.89275813", "0.86664206", "0.8008696", "0.8008696", "0.78880787", "0.7866302", "0.7610281", "0.7415077", "0.7345493", "0.7335999", "0.73116577", "0.7303292", "0.72991306", "0.7243393", "0.71792775", "0.71722543", "0.7157757", "0.7157757", "0.7157757", "0.708972...
0.7565963
8
Instruct the light to turn off.
def turn_off(self, **kwargs): self._light.set_color(0, 0, 0, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light", "def set_light_off(self):\n self._light = \"OFF\"", "def set_light_off(self):\r\n self._light = \"OFF\"", "def lightning_turnoff(self):\n self.turnOff()", "def turn_off(self, **kwargs: Any) -> None:\n ...
[ "0.9141917", "0.89695406", "0.89557284", "0.89015293", "0.8897358", "0.8873913", "0.8805522", "0.87764317", "0.86670524", "0.86476165", "0.847877", "0.8473624", "0.84669805", "0.8463841", "0.8435901", "0.8370482", "0.83494097", "0.8275936", "0.82717854", "0.82705396", "0.8253...
0.87862444
7
Test that it doesn't try to decompress content that isn't compressed
def test_decompress_regular(tmpdir, httpbin): url = httpbin.url + "/get" cass_file = str(tmpdir.join("noncompressed_response.yaml")) with vcr.use_cassette(cass_file, decode_compressed_response=True): urlopen(url) with vcr.use_cassette(cass_file) as cass: resp = urlopen(url).read() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_compress_incompressible_response(self):\n self.resp.content = self.incompressible_string\n r = GZipMiddleware(self.get_response)(self.req)\n self.assertEqual(r.content, self.incompressible_string)\n self.assertIsNone(r.get(\"Content-Encoding\"))", "def test_no_compress_com...
[ "0.7677952", "0.7587739", "0.7388321", "0.70077515", "0.6985812", "0.69692373", "0.69509184", "0.6918425", "0.6792523", "0.6715239", "0.6599061", "0.64616215", "0.6390434", "0.6389968", "0.6383845", "0.6370483", "0.6267627", "0.6235208", "0.61647934", "0.6161109", "0.61600065...
0.6851749
8
find an element in a grid
def find_person(self, grid, person): for lin in xrange(len(grid)): if grid[lin].find(person) is not -1: coord = [grid[lin].find(person), lin] # print "Find {0}: {1} ".format(person, coord) return coord
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_element(grid, target):\n \n # First, iterate over the row indices\n for row_number in range(len(grid)):\n \n# print(\"Checking row\", row_number)\n \n for col_number in range(len(grid[row_number])):\n \n# print(\"Checking column\", col_number)\n...
[ "0.7924864", "0.6937153", "0.6937153", "0.6740422", "0.67006594", "0.6542714", "0.653767", "0.64585805", "0.64585805", "0.64585805", "0.6429125", "0.6429125", "0.6429125", "0.6429125", "0.6424086", "0.6344454", "0.6344454", "0.6321732", "0.6302046", "0.6296397", "0.6285863", ...
0.6653444
5
Returns the value from the event.
def GetValue(self): return self._value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _event_to_val(self, evt):\n return evt.val", "def getEventValue(*args, **kwargs):\n pass", "def value(self):\n return self['input'].value()", "def get_value(self, data):\n value = data['value']\n return value", "def _get_value(self):\n \n return self._value"...
[ "0.7985166", "0.7292858", "0.7034268", "0.70213836", "0.70147574", "0.69983095", "0.6995245", "0.6977663", "0.6949626", "0.69414896", "0.68907326", "0.68798876", "0.6873454", "0.6873454", "0.6854066", "0.6830843", "0.6810735", "0.6809196", "0.6809196", "0.6809196", "0.6802341...
0.64827317
96
Create a Dash app from a string defining the app.
def py_source_to_app(py_source, env): exec(py_source, env) return env["app"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dash_app(server, url_rule, url_base_pathname):\n app = dash.Dash(name=__name__, server=server, url_base_pathname=url_base_pathname)\n\n customize_index_string(app, url_rule)\n add_route(app, url_rule)\n\n return app", "def create():\n\n return App()", "def app():\n return create_ap...
[ "0.7016987", "0.6223058", "0.6067492", "0.6050905", "0.6024386", "0.599829", "0.5978859", "0.5860099", "0.5788011", "0.57650197", "0.5669148", "0.56532496", "0.5609625", "0.5601644", "0.5504619", "0.5500505", "0.547201", "0.54484373", "0.5424246", "0.5412526", "0.54052836", ...
0.4981473
94
Find user by user id
def find_by_id(self, uid): return self.mapper.find_by_id(uid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(user_id):\n return repository.find(user_id)", "def get_user(id):\n pass", "def find_one(self, user_id):\n pass", "def find_by_id(cls, user_id):\n return UsersModel.query.filter_by(id=user_id).first()", "def find(self, user_id: UserId) -> Optional[U]:\n ...", "def find_...
[ "0.8248475", "0.7975132", "0.78396493", "0.7832203", "0.77757704", "0.7771436", "0.77627015", "0.77208805", "0.7698015", "0.76762605", "0.76543784", "0.7646595", "0.7602605", "0.7560415", "0.7546709", "0.7501259", "0.7491946", "0.7478427", "0.7470794", "0.7469322", "0.7469322...
0.0
-1
Converts a single HSL triplet (0360 hue, 01 sat & lightness) into an 8bit RGB triplet.
def get_bgr_from_hsl(hue, sat, light): # this function is not intended for fast conversions; use OpenCV's cvtColor for large-scale stuff if hue < 0 or hue > 360: raise AssertionError("invalid hue") if sat < 0 or sat > 1: raise AssertionError("invalid saturation") if light < 0 or light > ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RGBtoHSL( rgb ):\n # R' = R/255 (G' = G/255, B' = B/255)\n Rp = rgb[2]/255\n Gp = rgb[1]/255\n Bp = rgb[0]/255\n Cmax = max(Rp,Gp,Bp)\n Cmin = min(Rp,Gp,Bp)\n Delta = Cmax - Cmin\n if Delta == 0:\n Hue = 0\n elif Cmax == Rp:\n Hue = 60*(((Gp-Bp)/Delta)%6)\n elif Cmax...
[ "0.64130235", "0.62935245", "0.62935245", "0.6267236", "0.6167139", "0.6167139", "0.60716563", "0.5916591", "0.58765215", "0.5866079", "0.5857924", "0.5759601", "0.57461554", "0.57407945", "0.57336116", "0.57217157", "0.569049", "0.5674357", "0.5655501", "0.56361914", "0.5577...
0.5761526
11
Draws and returns a figure of a model input/predictions/targets using pyplot or OpenCV.
def draw(task, input, pred=None, target=None, block=False, ch_transpose=True, flip_bgr=False, redraw=None, **kwargs): # note: this function actually dispatches the drawing procedure using the task interface import thelper.tasks if not isinstance(task, thelper.tasks.Task): raise AssertionError("inval...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_visualization(model,X,y,classifier):\n sns.set_context(context='notebook',font_scale=2)\n plt.figure(figsize=(16,9))\n from matplotlib.colors import ListedColormap\n X_set, y_set = X, y\n X1, X2 = np.meshgrid(np.arange(start = X_set[:, 0].min() - 1, stop = X_set[:, 0].max() + 1, step = 0.0...
[ "0.7159986", "0.71269816", "0.6979452", "0.68343806", "0.68152744", "0.6794617", "0.67555916", "0.67039937", "0.65746886", "0.65040296", "0.64691865", "0.64689046", "0.64656186", "0.64492923", "0.6446469", "0.6445117", "0.6440534", "0.64348775", "0.6432961", "0.6425989", "0.6...
0.0
-1
Draws and returns an a confusion matrix figure using pyplot.
def draw_confmat(confmat, class_list, size_inch=(5, 5), dpi=160, normalize=False, keep_unset=False, show=False, block=False): if not isinstance(confmat, np.ndarray) or not isinstance(class_list, list): raise AssertionError("invalid inputs") if confmat.ndim != 2: raise AssertionE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\...
[ "0.7904794", "0.7815336", "0.76922554", "0.7653424", "0.7616082", "0.7614464", "0.7605565", "0.7572041", "0.75433517", "0.7506052", "0.74992496", "0.7462104", "0.7439486", "0.741473", "0.7391076", "0.7388952", "0.7378268", "0.73762", "0.7362219", "0.7340635", "0.73337245", ...
0.0
-1
Draws a set of bounding box prediction results on images.
def draw_bboxes(images, # type: thelper.typedefs.InputType preds=None, # type: Optional[thelper.typedefs.AnyPredictionType] bboxes=None, # type: Optional[thelper.typedefs.AnyTargetType] color_map=None, # type: Optional[thelpe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_predictions(frame, boxes, confidences, class_ids, labels, colors):\n\tfor i in range(len(boxes)):\n\t\t(x, y) = (boxes[i][0], boxes[i][1])\n\t\t(w, h) = (boxes[i][2], boxes[i][3])\n\t\tcolor = [int(c) for c in colors[class_ids[i]]]\n\n\t\t# Draw bounding box\n\t\tcv2.rectangle(frame, (x, y), (x + w, y + h...
[ "0.7153924", "0.69788766", "0.69786656", "0.69578856", "0.69455713", "0.69269544", "0.6920673", "0.68786687", "0.68783057", "0.68190116", "0.67908865", "0.67901826", "0.67824095", "0.6776105", "0.67657983", "0.67585367", "0.67451394", "0.6702489", "0.6696332", "0.66944236", "...
0.7397319
0
Applies a color map to an image of 8bit color indices; works similarly to cv2.applyColorMap (v3.3.1).
def apply_color_map(image, colormap, dst=None): assert isinstance(image, np.ndarray) and image.ndim == 2 and \ np.issubdtype(image.dtype, np.integer), "invalid input image" assert isinstance(colormap, np.ndarray) and colormap.shape == (256, 1, 3) and \ (colormap.dtype == np.uint8 or colormap.dty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applyColorMap(img, flag):\n\tif isinstance(flag, basestring):\n\t\tflag = flag.lower()\n\t\tgray = grayscale(img)\n\t\tres = cv2.applyColorMap(gray, colorMap_flag[flag])\n\t\treturn res\n\telse:\n\t\tgray = grayscale(img)\n\t\treturn cv2.applyColorMap(gray, flag)", "def get_label_color_mapping(idx):\n # h...
[ "0.6993694", "0.64156574", "0.6400454", "0.60438114", "0.60403377", "0.6033198", "0.6033198", "0.6033198", "0.6033198", "0.5932918", "0.5880191", "0.58615386", "0.5792629", "0.57838523", "0.57805866", "0.5750224", "0.57232934", "0.5703336", "0.56766784", "0.5663392", "0.56563...
0.67385656
1
Transforms a pyplot figure into a numpycompatible RGB array.
def fig2array(fig): fig.canvas.draw() w, h = fig.canvas.get_width_height() buf = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8) buf.shape = (w, h, 3) return buf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyplot_to_numpy(pyplot_figure):\n pyplot_figure.canvas.draw()\n x = np.fromstring(pyplot_figure.canvas.tostring_rgb(), dtype=np.uint8, sep='')\n x = x.reshape(pyplot_figure.canvas.get_width_height()[::-1] + (3,))\n return x", "def figure_to_RGB_array(fig):\r\n figure_buffer = io.BytesIO()\r\n\...
[ "0.7454621", "0.7297256", "0.6995081", "0.6772931", "0.6671485", "0.6526642", "0.638784", "0.6357588", "0.6337497", "0.6323847", "0.6285256", "0.6236474", "0.6227315", "0.607863", "0.607056", "0.60128844", "0.58512294", "0.5810157", "0.58070457", "0.573863", "0.5716739", "0...
0.6707854
4
A test for positive case.
def test_positive(): assert is_leap_year(2016) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_positive(self, a):\n return a > 0", "def is_negative(self, a):\n return a < 0", "def positive_only(self):\n return True", "def positive_only(self):\n return True", "def positive_only(self):\n return True", "def isnegative(x):\n if x < 0 :\n return True\...
[ "0.76228994", "0.7447405", "0.7319575", "0.7319575", "0.7319575", "0.73173547", "0.72487545", "0.7230466", "0.7117687", "0.7088469", "0.7073071", "0.7070528", "0.70645493", "0.6988175", "0.6984194", "0.69266003", "0.6913111", "0.6881622", "0.6859878", "0.68500483", "0.6829827...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(setPatternRequest, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.partial_view is None: self.partial_view = False if self.resolution is None: self.resolut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77937967", "0.77195275", "0.77195275", "0.7685702", "0.762502", "0.7562939", "0.74384665", "0.7416083", "0.73515767", "0.73078126", "0.7280228", "0.723719", "0.72265446", "0.72230625", "0.72230625", "0.7218876", "0.721051", "0.721051", "0.721051", "0.721051", "0.721051", ...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(setPatternResponse, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.success is None: self.success = False else: self.success = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794164", "0.7721611", "0.7721611", "0.7687804", "0.7626575", "0.7565245", "0.74406534", "0.74182206", "0.73521465", "0.73088044", "0.72807634", "0.7238138", "0.7227902", "0.72254795", "0.72254795", "0.7219563", "0.7212849", "0.7212849", "0.7212849", "0.7212849", "0.721284...
0.0
-1
Set the device's size.
def _setSize(self, newsize): log_method_call(self, self.name, status=self.status, size=self._size, newsize=newsize) if not isinstance(newsize, Size): raise ValueError("new size must of type Size") if not self.exists: # device does not exist (a par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setsize(self, size):\n self.__size = size", "def set_size(self, size):\n \n self.width = size[0]\n self.height = size[1]", "def set_size(self, size):\n self.dtSize = size", "def set_size(self, w, h):\n\t\tpass", "def size(self, size):\n self.width = size\n ...
[ "0.7873566", "0.77266103", "0.76895547", "0.75657886", "0.7384356", "0.7384356", "0.7289012", "0.728139", "0.7215229", "0.7205107", "0.7205107", "0.7205107", "0.7205107", "0.71879953", "0.7159446", "0.70534533", "0.70523363", "0.7034217", "0.6952837", "0.6933423", "0.6924105"...
0.6994651
18
The maximum size this partition can be.
def maxSize(self): maxPartSize = self._unalignedMaxPartSize maxFormatSize = self.format.maxSize unalignedMax = min(maxFormatSize, maxPartSize) if maxFormatSize else maxPartSize return self.alignTargetSize(unalignedMax)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximum_size(self):\n return self._maximum_size", "def maxsize(self) -> int:\n return self._maxsize", "def maxsize(self):\r\n return self._maxsize", "def largest_part_size():\n return usb_part_size(largest_partition())", "def max_disk_size(self) -> str:\n return pulumi.ge...
[ "0.8380637", "0.8212984", "0.8171533", "0.8070145", "0.7991709", "0.7987127", "0.78469193", "0.7832853", "0.77647567", "0.77159256", "0.7706225", "0.7634494", "0.75055504", "0.75033265", "0.7441761", "0.74177235", "0.7415829", "0.7301893", "0.7296699", "0.7279662", "0.7262000...
0.7416023
16
Get ReportPortal launch name.
def get_launch_name(): if product_type == "RHEL7": launch_name = "Errata-{0}_{1}_{2}_{3}_{4}_{5}CDN".format(errata_id, product_type, variant, arch, test_level, cdn) elif product_type == "RHEL8": launch_name = "Errata-{0}_{1}_{2}_{3}_{4}CDN".format(errata_id, product_type, arch, test_le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_name(self):\n return str(self.executable.name)", "def launch_template_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"launch_template_name\")", "def launch_template_name(self) -> Optional[str]:\n return pulumi.get(self, \"launch_template_name\")", "def da...
[ "0.64195514", "0.64129484", "0.6411258", "0.6287243", "0.6273052", "0.6022788", "0.601195", "0.6000929", "0.5974678", "0.59618914", "0.59589344", "0.5947068", "0.59444815", "0.5867714", "0.5867714", "0.5867714", "0.5867714", "0.5867714", "0.5867714", "0.5867714", "0.5867714",...
0.62932926
3
Initializes an event dispatcher object.
def initialize(self, simulator): self.__eventHandlers = {} self.__simulator = simulator self.__threads = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self):\n self.dispatcher.start()\n self.replyer.start()", "def __init__(self, *args, **kwargs):\n self.events = {}", "def __init__(self, loop=None):\n object.__setattr__(self, '_loop', loop or get_event_loop())", "def __init__(self):\n self._events = {}\n se...
[ "0.6839209", "0.659576", "0.6517356", "0.6499052", "0.6427141", "0.6391243", "0.6338676", "0.63212234", "0.62971014", "0.62733126", "0.6261656", "0.6213252", "0.62108886", "0.60680914", "0.6050402", "0.60471934", "0.60345197", "0.60338837", "0.60252416", "0.60218334", "0.5992...
0.6320172
8
Gets the displayed name of a user.
def get_display_name(member): if member.nick is None: name = member.name else: name = member.nick if User.objects.get(id=member.id).is_ironman: name += ' (IM)' return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_display_name(self):\n return self.user.get_full_name() or self.user.get_username()", "def get_displayname(self):\n return self.full_name or self.user.username", "def getUserName(self):\n user = User.by_id(self.user_id)\n return user.name", "def get_user_name(user: Use...
[ "0.86961114", "0.83570224", "0.8263836", "0.8258292", "0.8174829", "0.81671983", "0.8098771", "0.80199844", "0.79783666", "0.79710037", "0.79450095", "0.79325604", "0.7914343", "0.79029375", "0.7892893", "0.7878878", "0.7827481", "0.77871954", "0.77871954", "0.77628535", "0.7...
0.7292067
64