query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict, output_dict, exec_properties, executor_class_path, training_inputs, job_id) -> Dict[Text, Any]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]],\n output_dict: Dict[Text, List[types.Artifact]],\n exec_properties: Dict[Text, Any],\n executor_class_path: Text,\n training_inputs: D...
[ "0.70724356", "0.6887883", "0.68650603", "0.6819622", "0.6720383", "0.6570948", "0.6565429", "0.65353024", "0.6483057", "0.6375926", "0.6367454", "0.63338363", "0.6326136", "0.6322333", "0.6315006", "0.629442", "0.62928957", "0.6290497", "0.6287055", "0.62419564", "0.61994785...
0.7656704
0
Creates the job spec.
def _create_job_spec( self, job_id: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]:\n\n job_spec = {\n 'display_name': job_id,\n 'job_spec': training_input,\n 'labels': job_labels,\n }\n return job_s...
[ "0.72192025", "0.71575874", "0.652794", "0.6339889", "0.6263073", "0.6225149", "0.62125117", "0.6160883", "0.61028594", "0.6097879", "0.6095217", "0.60905993", "0.60423464", "0.59173054", "0.58997864", "0.58075607", "0.5807247", "0.58008564", "0.5778806", "0.57773787", "0.575...
0.7605234
0
Gets the job name.
def get_job_name(self) -> Text: return self._job_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_name(self) -> str:\n return pulumi.get(self, \"job_name\")", "def job_name(self):\n return self._stub.List(self._message).job_name", "def job_name(self) -> str:\n return self._step_execution_context.job_name", "def job_name(self) -> pulumi.Input[str]:\n return pulumi.get(s...
[ "0.9124221", "0.8854782", "0.86039746", "0.8555109", "0.8552845", "0.82115984", "0.7826915", "0.7780019", "0.7780019", "0.7755838", "0.7453526", "0.74189264", "0.7279247", "0.7250569", "0.72497904", "0.72245", "0.7056386", "0.705631", "0.6979349", "0.6973385", "0.69360894", ...
0.8991103
1
Creates the discovery job client. Can also be used for recreating the job client (e.g. in the case of communication failure). Multiple job requests can be done in parallel if needed, by creating an instance of the class for each job. Note that one class instance should only be used for one job, as each instance stores ...
def create_client(self) -> None: self._client = discovery.build('ml', 'v1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_client(self) -> None:\n self._client = gapic.JobServiceClient(\n client_options=dict(api_endpoint=self._region + _UCAIP_ENDPOINT_SUFFIX))", "def __init__(self,\n job_uids=None,\n cluster_id=None,\n cluster_match_string=None,\n e...
[ "0.6929064", "0.57790893", "0.55540615", "0.5551953", "0.54512167", "0.54504716", "0.5449162", "0.5445811", "0.53970695", "0.5364705", "0.5301948", "0.5293237", "0.5282406", "0.52800995", "0.52337587", "0.5223323", "0.5223323", "0.5222134", "0.5202863", "0.51972383", "0.51919...
0.6168927
1
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]], output_dict: Dict[Text, List[types.Artifact]], exec_properties: Dict[Text, Any], executor_class_path: Text, training_inputs: Dict[Text,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict, output_dict, exec_properties,\n executor_class_path, training_inputs,\n job_id) -> Dict[Text, Any]:\n pass", "def get_train_args():\n d_train = cfg.get_train_args_schema().fields\n \n if num_local_gpus ...
[ "0.7657387", "0.6888748", "0.68656194", "0.682167", "0.67204", "0.6571265", "0.6566474", "0.6535822", "0.6482168", "0.63752997", "0.6367284", "0.6333624", "0.6325504", "0.6321786", "0.63143045", "0.62942094", "0.62941766", "0.6291347", "0.6287213", "0.6240908", "0.61983275", ...
0.70728606
1
Creates the Gapic job client. Can also be used for recreating the job client (e.g. in the case of communication failure). Multiple job requests can be done in parallel if needed, by creating an instance of the class for each job. Note that one class instance should only be used for one job, as each instance stores vari...
def create_client(self) -> None: self._client = gapic.JobServiceClient( client_options=dict(api_endpoint=self._region + _UCAIP_ENDPOINT_SUFFIX))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __new__(cls, *_args, **_kwargs):\n if cls._instance is None:\n cls._instance = super(TestJob, cls).__new__(cls)\n return cls._instance", "def make_instance(self, include_optional):\n # model = kloudio.models.new_job.NewJob() # noqa: E501\n if include_optional :\n ...
[ "0.61560833", "0.6033133", "0.59234405", "0.57237214", "0.5716353", "0.5714552", "0.57126325", "0.5688973", "0.56439745", "0.5621558", "0.56208074", "0.56127506", "0.5611762", "0.55921733", "0.5577413", "0.5556657", "0.5548118", "0.5516411", "0.5515737", "0.5490988", "0.54838...
0.80078906
0
Creates the job spec.
def _create_job_spec( self, job_id: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]: job_spec = { 'display_name': job_id, 'job_spec': training_input, 'labels': job_labels, } return job_spec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]:\n pass", "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[T...
[ "0.7605234", "0.71575874", "0.652794", "0.6339889", "0.6263073", "0.6225149", "0.62125117", "0.6160883", "0.61028594", "0.6097879", "0.6095217", "0.60905993", "0.60423464", "0.59173054", "0.58997864", "0.58075607", "0.5807247", "0.58008564", "0.5778806", "0.57773787", "0.5755...
0.72192025
1
Gets the longrunning job.
def get_job(self) -> CustomJob: return self._client.get_custom_job(name=self._job_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job(self):\n return self.batch[self.job_id]", "def get_job(self) -> Job:\n return self.jobs_list[self.sel_idx]", "def get_job(self) -> Dict[Text, Text]:\n request = self._client.projects().jobs().get(name=self._job_name)\n return request.execute()", "def current_job(self):\n as...
[ "0.755368", "0.7488666", "0.7425105", "0.7287057", "0.7284264", "0.7177822", "0.71693903", "0.7139543", "0.7112392", "0.698487", "0.6967169", "0.6921034", "0.6912143", "0.6863278", "0.6839613", "0.68319654", "0.6814457", "0.677886", "0.6773958", "0.67043626", "0.6698025", "...
0.78749716
0
A pserve script aware of static resources.
def pserve(): import pyramid.scripts.pserve import pyramid_fanstatic import os dirname = os.path.dirname(__file__) dirname = os.path.join(dirname, 'resources') pyramid.scripts.pserve.add_file_callback( pyramid_fanstatic.file_callback(dirname)) pyramid.scripts.pserve.main()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_static (filename):\n return static_file(filename, root=\"./static\")", "def server_static(filename):\n return static_file(filename, root='static/stats')", "def statics(file, type='img'):\n return bottle.static_file(file, root=HOME+STATIC_PATH+'/'+type)", "def static(filename):\n return...
[ "0.7150718", "0.69992626", "0.67572206", "0.6541767", "0.6521592", "0.6472664", "0.64559674", "0.64321667", "0.6429534", "0.63892156", "0.6383383", "0.63797045", "0.6370705", "0.636868", "0.6363368", "0.63551867", "0.6335698", "0.630819", "0.6294129", "0.6259669", "0.6254209"...
0.76249796
0
approved condo payment creates an egreso
def test_approved__condo_payment_creates_egreso(self): pago = Pagos_Condominio.objects.get(id = 1) try: self.assertIsNotNone(pago.egreso) except: print 'WARNING: _loaded_values in model is creating problem' #self.assertEqual(hasattr(pago, 'egreso'), True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment(self, **post):\n cr, uid, context = request.cr, request.uid, request.context\n payment_obj = request.registry.get('payment.acquirer')\n sale_order_obj = request.registry.get('sale.order')\n\n order = request.website.sale_get_order(context=context)\n order.write({'user...
[ "0.68200374", "0.66911495", "0.6539901", "0.64811856", "0.6442946", "0.6428527", "0.6295282", "0.62489337", "0.61958116", "0.6165144", "0.6128512", "0.6098366", "0.60955703", "0.60880065", "0.6079592", "0.6073143", "0.6071113", "0.60629845", "0.60420525", "0.6017494", "0.5990...
0.68466234
0
extra_col being saved updates account balance
def test_extra_col_updates_account_balance(self): banco = Bancos.objects.get(id=1) previous_balance = banco.balance condominio = Condominio.objects.get(rif='J6750435') factura_condominio = Factura_Condominio.objects.get(id=1) data ={ 'id':1, 'factura': factura_condominio, 'titulo': 'sample_extra_col'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_db_account_balances(self, quote:str, **kwargs):\n\n\t\t# real_balance \t\t\t\t= kwargs.get('real_balance', None)\n\t\t# real_locked \t\t\t\t= kwargs.get('real_locked', None)\n\t\t# internal_balance \t\t\t= kwargs.get('internal_balance', None)\n\t\t# internal_locked \t\t\t= kwargs.get('internal_locked', ...
[ "0.64701575", "0.644509", "0.6379475", "0.6347287", "0.6296751", "0.61106837", "0.61038214", "0.6090905", "0.6013311", "0.5932772", "0.5912174", "0.5902762", "0.5897663", "0.5892612", "0.5846604", "0.5769641", "0.5735082", "0.57056206", "0.56956476", "0.56887454", "0.5668993"...
0.7536452
0
Construct a new RationalQuadraticSpline bijector. For each argument, the innermost axis indexes bins/knots and batch axes index axes of `x`/`y` spaces. A `RationalQuadraticSpline` with a separate transform for each of three dimensions might have `bin_widths` shaped `[3, 32]`. To use the same spline for each of `x`'s th...
def __init__(self, bin_widths, bin_heights, knot_slopes, range_min=-1., validate_args=False, name=None): with tf.name_scope(name or 'RationalQuadraticSpline') as name: dtype = dtype_util.common_dtype( [bin_widt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolateSpline(x, y) :\n n = len(x)\n\n dim = 4 * (n - 1)\n b = np.zeros((dim, 1))\n A = np.zeros((dim, dim))\n\n for i in range(n-1):\n x1 = x[i]\n x2 = x[i+1]\n y1 = y[i]\n y2 = y[i+1]\n b[i*4:(i+1)*4, 0] = [y1, y2, 0, 0]\n\n A[i*4, i*4:(i+1)*4] = [...
[ "0.5183332", "0.51626414", "0.5119118", "0.5079179", "0.4961845", "0.49498278", "0.49099728", "0.49079925", "0.48892424", "0.48506638", "0.48246297", "0.478306", "0.47814262", "0.4725182", "0.4706628", "0.46775335", "0.46716303", "0.46659052", "0.46585312", "0.46565458", "0.4...
0.6718378
0
Flattens and normalizes the plastic strain time derivative tensor. Normalize plastic strain time derivative by dividing by the strain time derivative magnitude
def calc_output(self, plastic_strain_dot, strain_dot): # Calculate Frobenius norm of elastic strain time derivative tensor strain_dot_mag = np.sqrt(np.mean(np.mean(np.square(strain_dot), axis=2), axis=1)) # To avoid singularities, if strain rate magnitude is zero, set it equal to one s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_transition(self):\n self._t /= self._t.sum(1)[:, np.newaxis]", "def _partial_flatten_and_normalize(x):\n x = np.reshape(x, (x.shape[0], -1))\n return (x - np.mean(x)) / np.std(x)", "def unnormalize(tensor, mean, std):\n for t, m, s in zip(tensor, mean, std):\n t.mul_(s).add...
[ "0.62458545", "0.5984606", "0.59279716", "0.5894949", "0.58369017", "0.57565486", "0.5707113", "0.5672379", "0.5637169", "0.56276435", "0.5559953", "0.55526054", "0.5547735", "0.55388963", "0.55312216", "0.5528915", "0.5524366", "0.551839", "0.5514702", "0.54963565", "0.54954...
0.630154
0
Gets the area cords for the dancefloor
def get_dancefloor_area(self): cords = [] x1 = self.coordinates[0] y1 = self.coordinates[1] x2 = self.coordinates[0] + self.width y2 = self.coordinates[1] + self.height if self.width <= 0: x1, x2 = x2, x1 if self.height <= 0: y1, y2 = y2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_referenced_floor_area() -> np.ndarray:\n\n return envelope.get_referenced_floor_area()", "def area(self):\n return _cantera.wall_area(self.__wall_id)", "def get_area(self):\n ### Original\n from pyresample.spherical_geometry import get_polygon_area\n\n return get_polygon_...
[ "0.66182476", "0.65240717", "0.63324845", "0.6230986", "0.6223651", "0.6190598", "0.6087059", "0.60808396", "0.6071041", "0.60708934", "0.60700375", "0.6048479", "0.60449976", "0.5992652", "0.59492236", "0.59431803", "0.5929464", "0.5906095", "0.58992434", "0.5882558", "0.586...
0.8184448
0
This function sends a SUCCESS/FAILED response to the CloudFormation stack that invoked the Lambda function.
def send_cf_response(event, context, success=True, reason='Unknown'): data = { 'Status': 'SUCCESS' if success else 'FAILED', 'PhysicalResourceId': context.log_stream_name, 'StackId': event['StackId'], 'RequestId': event['RequestId'], 'LogicalResourceId': event['LogicalResourc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n\n return {\n \"statusCode\": 200,\n \"body\": json.dumps({\n 'message': 'API deployed',\n })\n }", "def lambda_handler(event, context):\n return {\n 'statusCode': 200,\n 'body': say_hello()\n }", "def lambda_respons...
[ "0.7016714", "0.6934398", "0.65957916", "0.6580948", "0.65773124", "0.6350327", "0.62960196", "0.6292117", "0.62879604", "0.626153", "0.62377375", "0.6202347", "0.6150959", "0.61024934", "0.60883546", "0.59804237", "0.5948244", "0.5916419", "0.5903106", "0.58938974", "0.58765...
0.7171703
0
testuser1 has a 'testing' subnamespace, testuser2 tries to see its permissions but fails.
def testRandomUserCannotGETRandomUserSubNamespace(self): headers = { 'accept': 'application/json', } self.addBasicAuthHeader(headers, 'testuser2', 'secret') path = defaults.sep.join([defaults.namespaceCategoryName, 'testuser1', 'testing']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_namespace_access(self, namespace, user):\n if not namespace.owners.filter(id=user.id).count():\n raise exceptions.PermissionDenied(\n 'The namespace listed on your filename must match one of '\n 'the namespaces you have access to.'\n )", "def ...
[ "0.6429766", "0.6371066", "0.6243876", "0.6156751", "0.6154213", "0.61048347", "0.6101933", "0.60836434", "0.60561347", "0.6050891", "0.6036248", "0.60299695", "0.6001029", "0.5991596", "0.59487164", "0.5943904", "0.5931206", "0.5913553", "0.5899936", "0.58955866", "0.5859986...
0.66301256
0
Checks if two intervals are overlapping. Function requires intervals to be proper (end >= start). Works with any types of comparable by mathematical operators objects.
def ranges_overlap(start1, end1, start2, end2): return start1 <= end2 and end1 >= start2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dates_intervals_are_overlapped(start_1, end_1, start_2, end_2):\n return end_1 >= start_2 and end_2 >= start_1", "def overlap(start1, end1, start2, end2):\n return not (end1 < start2 or end2 < start1)", "def overlap(t1start, t1end, t2start, t2end):\n\n return (t1start <= t2start <= t1end) or (t2st...
[ "0.8221766", "0.8196568", "0.80125463", "0.7714692", "0.76665205", "0.7543957", "0.75031185", "0.74704397", "0.7351677", "0.73447514", "0.72555596", "0.72339934", "0.72237253", "0.71955794", "0.7165406", "0.71499693", "0.70835686", "0.7058538", "0.70213556", "0.69799066", "0....
0.82069135
1
Returns (list of) sum of intervals. Intervals could be tuple of any orderable values (ex. integers, dates). If sets are overlapping, they are "merged" together and resulting interval is (min(start1, start2), max(end1, end2)). >>> sum_of_intervals([(1, 5), (4, 10), (7, 13), (15, 20), (21, 30)]) [(1, 13), (15, 20), (21, ...
def sum_of_intervals(intervals): intervals_set = set() for v_start, v_end in intervals: intervals_set.add((v_start, True)) intervals_set.add((v_end, False)) intervals = list(intervals_set) intervals.sort(key=lambda a: a[0]) current_start = None started = 0 result = [] fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intervals(start, end, delta, intervals_right_closed=False):\r\n result = []\r\n interval_start, interval_end = None, None\r\n while True:\r\n interval_start = start if interval_end is None else interval_end\r\n interval_end = min(end, interval_start + delta)\r\n result.append(thal...
[ "0.59077203", "0.563408", "0.5407047", "0.5392709", "0.52991736", "0.52946335", "0.52101135", "0.5203491", "0.5171669", "0.51691556", "0.5138005", "0.5121623", "0.51164556", "0.506967", "0.506666", "0.5054887", "0.5036717", "0.50176084", "0.5004771", "0.49338767", "0.49328962...
0.7316026
0
Normalize decimal without scientific notation (remove exponent and trailing zeros).
def normalize_decimal(d): return d.quantize(Decimal(1)) if d == d.to_integral() else d.normalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_exponent(val):\n context = decimal.Context(prec=self.max_digits)\n return val.quantize(decimal.Decimal(1), context=context) if val == val.to_integral() else val.normalize(context)", "def normalize(amount, min=2, max=4):\n if not amount:\n return amount\n\n # To Decim...
[ "0.71156347", "0.6817118", "0.6672521", "0.6446351", "0.62960124", "0.61859643", "0.6139326", "0.5954451", "0.5883746", "0.5880353", "0.58401924", "0.5834147", "0.57599866", "0.5726349", "0.57119143", "0.5709601", "0.5705417", "0.5702603", "0.5699816", "0.56875485", "0.568076...
0.7325013
0
Use IPMITOOL to blink a chassis LED
def blink_light(hostname, on=True): if on: opt = "force" else: opt = "0" LOGGER.info("Blinking chassis LED for %s", hostname) command = "ipmitool -U {} -P {} -H {} chassis identify {}".format( USER, PASS, hostname, opt) subprocess.check_call(command, shell=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def blink(my_board, pin):\n\n # set the pin mode\n await my_board.set_pin_mode_digital_output(pin)\n\n # toggle the pin 4 times and exit\n for x in range(4):\n print('ON')\n await my_board.digital_write(pin, 1)\n await asyncio.sleep(1)\n print('OFF')\n await my_...
[ "0.73258066", "0.69174576", "0.6745456", "0.6721252", "0.66942364", "0.66491276", "0.6608069", "0.65577483", "0.64461106", "0.63938886", "0.63897306", "0.6379322", "0.637831", "0.63509107", "0.63327783", "0.626326", "0.62223494", "0.61845493", "0.6181832", "0.6151551", "0.612...
0.7913171
0
Get the MAC for eth0 using IPMI
def get_eth0_mac_address(hostname): command = "ipmitool -H {} -U ADMIN -P ADMIN raw 0x30 0x21".format(hostname) try: result = subprocess.check_output(command, shell=True) except subprocess.CalledProcessError as exc: LOGGER.exception("Failed to get eth0 mac for %s", hostname) # Remove ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac_address():\n eth0_interface = 'eth0'\n addresses = netifaces.ifaddresses(eth0_interface)[netifaces.AF_LINK][0]\n mac_address = addresses['addr']\n return mac_address", "def getMac(self):\n # Import netifaces here to prevent error importing this module in setup.py\n import ne...
[ "0.78554046", "0.78055936", "0.7448746", "0.7251684", "0.72502637", "0.72043616", "0.7181221", "0.71635437", "0.70859075", "0.69643205", "0.69631994", "0.6941659", "0.69308925", "0.6928495", "0.68998766", "0.6882689", "0.6879579", "0.68495977", "0.68219835", "0.67996645", "0....
0.8025036
0
Convert to an emulab style mac
def emulab_mac(mac): return "".join(mac.lower().split(':'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def macFor(cls, board):\n return cls.MAC_PREFIX + '{:02X}'.format(int(board))", "def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))", "def good_mac(mac):\r\n return mac.upper().replace('-', ':')", "def get_mac_string():\n mac_int = getnode()\n mac_str =...
[ "0.6040826", "0.59956956", "0.5854787", "0.5779863", "0.5675275", "0.56129545", "0.5586242", "0.552146", "0.54683423", "0.5457044", "0.54549307", "0.54475677", "0.5410852", "0.5382184", "0.5353483", "0.5331743", "0.5249846", "0.52239674", "0.5209968", "0.51962715", "0.5182766...
0.69217736
0
Gather the MAC addresses of eth0 from all SM hosts
def get_eth0_macs(): mac_dict = { 'mac_to_host': {}, 'host_to_mac': {} } # Host Range for i in range(1, 95): if i == 47: # 47 is broken continue hostname = "sm{}-ipmi".format(i) realname = "sm{}".format(i) mac = get_eth0_mac_ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac_address_table(self):\n\n mac_address_table = []\n command = '/interface bridge host print terse'\n\n output = self._send_command(command)\n\n for host in parse_terse_output(output):\n mac_address_table.append({\n 'mac': cast_mac(host.get('mac-addres...
[ "0.7146105", "0.67204034", "0.6417322", "0.6113413", "0.60379297", "0.6028078", "0.6010826", "0.5976122", "0.5964501", "0.5955474", "0.5925722", "0.5905432", "0.5898975", "0.58903706", "0.58572847", "0.5804898", "0.5784774", "0.5769922", "0.57560873", "0.575395", "0.57504755"...
0.70925903
1
Using image pairs from 'image_pair_path', plot the following three plots. Violin plot the distribution of the cosine similarity score of impostor pairs (different people) and Genuine pair (same people) the plots are separated by ethnicitygender attribute of the first person of each pair. Overlapped Score Distribution p...
def create_bias_analysis_plots( im_pair_paths, im_paths, dir_embeddings, data=None, save_data=None, dir_output="results", ): if data is not None: print("load processed data") with open(data, "rb") as f: data_pair_df = pk.load(f) else: print( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_comparison(unaligned_image_ccd_lst,aligned_image_ccd_lst,stacked_img_ccd,outputs_path,obsdate):\n source_hdu = CCDData(unaligned_image_ccd_lst[0],unit='adu')\n source_image_hdr = source_hdu.header\n run_filename = source_image_hdr['RUN'].strip(' ')\n target_name = source_image_hdr['FIELD'].st...
[ "0.60212815", "0.58584404", "0.58527213", "0.57937336", "0.57918864", "0.5790756", "0.57834584", "0.5701096", "0.56923074", "0.5685753", "0.56194687", "0.56160814", "0.560447", "0.55893874", "0.5575749", "0.55580103", "0.554318", "0.5543136", "0.5528448", "0.5515287", "0.5513...
0.63760436
0
Clean image pair csv and image list csv by deleting the rows that contain a path to an image whose embedding does not exist in embedding_dir_path
def clean_image_pair_and_image_list_csv(pair_paths, im_paths, dir_embeddings): check_exist = lambda rel_path: os.path.exists( os.path.join(dir_embeddings, replace_ext(rel_path)) ) # clean image pair csv image_pair = pd.read_csv(pair_paths) old_nrow = image_pair.shape[0] image_pair = imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_images_without_label(path_folder):\n\n\n #labels = os.listdir(path_folder + \"labels/val/\")\n labels = os.listdir(path_folder + \"labels/val/\")\n images = os.listdir(path_folder + \"images/val/\")\n for i in images:\n name_i = i.split(\".\")\n if name_i[0] + '.xml' not in lab...
[ "0.5739397", "0.5736125", "0.5692936", "0.56318676", "0.5618469", "0.5549257", "0.5507775", "0.5480919", "0.54733306", "0.54409546", "0.5440345", "0.53812724", "0.5352057", "0.53235275", "0.53018755", "0.5283982", "0.5273521", "0.5258717", "0.5249607", "0.52281815", "0.521329...
0.76012003
0
get the value of property _IntegrityCheck
def IntegrityCheck(self): if self.force_auto_sync: self.get('IntegrityCheck') return self._IntegrityCheck
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EnableDataIntegrity(self):\n\t\treturn self._get_attribute('enableDataIntegrity')", "def syncheck(self) :\n\t\ttry :\n\t\t\treturn self._syncheck\n\t\texcept Exception as e:\n\t\t\traise e", "def safety(self):\n return self._safety", "def IsChecked(self):\r\n\r\n return self.GetValue()", ...
[ "0.65075386", "0.5869347", "0.58475804", "0.5753277", "0.56255025", "0.56019104", "0.55463", "0.5503255", "0.54740024", "0.54402155", "0.5437776", "0.5430208", "0.542952", "0.53729284", "0.53613406", "0.53375405", "0.5316777", "0.52882695", "0.52658975", "0.52637374", "0.5240...
0.77188
0
get the value of property _VlanPriority
def VlanPriority(self): if self.force_auto_sync: self.get('VlanPriority') return self._VlanPriority
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FlowStatVlanPriority(self):\n\t\treturn self._get_attribute('flowStatVlanPriority')", "def FlowAggregatedStatVlanPriority(self):\n\t\treturn self._get_attribute('flowAggregatedStatVlanPriority')", "def getPriority(self):\n return self.priority", "def _get_priority(self):\n return self.__priority", ...
[ "0.79581535", "0.7343887", "0.6676573", "0.6580757", "0.6580757", "0.6580757", "0.6580757", "0.64934856", "0.6474305", "0.64592236", "0.6305657", "0.6254205", "0.6198934", "0.61785793", "0.6153762", "0.6153322", "0.6140507", "0.6137974", "0.61376005", "0.61376005", "0.6112572...
0.81053984
0
get the value of property _Tos
def Tos(self): if self.force_auto_sync: self.get('Tos') return self._Tos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_t(self):\n return self.t", "def get_tin(self):\n return self.tin[:]", "def get_value(self):", "def getvalue(self):\n ...", "def getvalue(self):\n ...", "def get_value(self):\n pass", "def get_property(self, client):\r\n client.getProperty()", "def val...
[ "0.6263516", "0.60954124", "0.5952132", "0.5925507", "0.5925507", "0.58892965", "0.5864855", "0.582428", "0.5820709", "0.5789876", "0.5787564", "0.5787564", "0.5771059", "0.5739372", "0.5739372", "0.5739372", "0.5739372", "0.5739372", "0.5739372", "0.5735682", "0.5675374", ...
0.6674808
0
get the value of property _TrafficClass
def TrafficClass(self): if self.force_auto_sync: self.get('TrafficClass') return self._TrafficClass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_traffic_class_dscp(self):\n return self.__traffic_class_dscp", "def _get_dscp_traffic_class(self):\n return self.__dscp_traffic_class", "def _get_cos_traffic_class(self):\n return self.__cos_traffic_class", "def _get_traffic_class_cos(self):\n return self.__traffic_class_cos", "def Tes...
[ "0.770501", "0.7645266", "0.7078378", "0.6788123", "0.65251666", "0.6222348", "0.611295", "0.60471976", "0.5920321", "0.5832696", "0.58309454", "0.5787103", "0.5750884", "0.5724215", "0.57223487", "0.5681254", "0.5625653", "0.5563834", "0.5563361", "0.5501558", "0.5486571", ...
0.78202903
0
get the value of property _TCPTearDown
def TCPTearDown(self): if self.force_auto_sync: self.get('TCPTearDown') return self._TCPTearDown
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSTOP(self):\n return self.listener.STOP", "def TunnelDown(self):\n if self.force_auto_sync:\n self.get('TunnelDown')\n return self._TunnelDown", "def shutdown(self):\n return self._read(MX_SHUTDOWN)", "def _get_mtu(self):\n return self.__mtu", "def shutdown(...
[ "0.56405234", "0.5586166", "0.55796576", "0.5548832", "0.5526753", "0.5505324", "0.5388013", "0.5388013", "0.53842556", "0.5268649", "0.5263692", "0.52432394", "0.52288353", "0.5213106", "0.5203482", "0.519355", "0.5181534", "0.51442873", "0.51442873", "0.5141946", "0.513288"...
0.82825774
0
Build the corpus using a twitter name
def build_corpus(username, api): print('getting tweets for user: ', username) timeline = api.GetUserTimeline(screen_name=username, count=200) tweets = [t.text for t in timeline] corpus = ' '.join(tweets) return corpus
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tweet():\n\n verb = conjugate(random.choice(verbs)['present'], tense=PARTICIPLE, parse=True).title()\n animal = random.choice(animals).title()\n food = random.choice(foods).title()\n noun = random.choice(nouns).title()\n\n band = food + \" \" + noun\n track = verb + \" \" + animal\n\n featu...
[ "0.6071258", "0.60542446", "0.60268915", "0.59970444", "0.58995855", "0.57679427", "0.5691467", "0.5684041", "0.5651101", "0.5639109", "0.56301737", "0.5628061", "0.55921966", "0.558687", "0.55145305", "0.5506921", "0.5503124", "0.5486536", "0.5473638", "0.54730463", "0.54729...
0.7513815
0
Return the model result combining all the components.
def combineResult(self, *xpars): if len(xpars) == 0: xpars = self.__x xshape = self.__xshape else: assert len(xpars) == self.__nx # The input parameter number should be consistent. xshape = xpars[0].shape #-> Calculate the add model components ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_result(self, value):\n self.result = {}\n\n if \"ModelResult\" in type(value).__name__:\n self.result.update(value.params.valuesdict())\n self.comps = value.model.components\n elif (\"list\" or \"tuple\") in type(value).__name__:\n assert all(\"ModelR...
[ "0.68452895", "0.67719156", "0.64932096", "0.6341544", "0.61996853", "0.60693794", "0.60488963", "0.5863232", "0.5848498", "0.58373946", "0.5782107", "0.57694054", "0.5704184", "0.56759906", "0.55905336", "0.5586056", "0.55771947", "0.55771947", "0.5559133", "0.55555564", "0....
0.6960958
0
Return the results of all the add components multiplied by the multiplicative models correspondingly.
def componentResult(self, *xpars): if len(xpars) == 0: xpars = self.__x else: assert len(xpars) == self.__nx # The input parameter number should be consistent. #-> Calculate the add model components result = OrderedDict() for modelName in self._addList: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combineResult(self, *xpars):\n if len(xpars) == 0:\n xpars = self.__x\n xshape = self.__xshape\n else:\n assert len(xpars) == self.__nx # The input parameter number should be consistent.\n xshape = xpars[0].shape\n #-> Calculate the add model com...
[ "0.6945165", "0.6073313", "0.5908816", "0.5898524", "0.5885824", "0.5876134", "0.58678466", "0.5867306", "0.58552486", "0.584598", "0.5729092", "0.5700349", "0.5661854", "0.5661854", "0.56593186", "0.5658847", "0.5640436", "0.5640436", "0.5640436", "0.56191427", "0.55759156",...
0.663265
1
Get the name list of the add models.
def get_modelAddList(self): return self._addList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namelist(self):\n return []", "def get_names(self):\n return self.names", "def namelist(self):\n return self._handle.getnames()", "def namelist(self):\n return self._handle.getnames()", "def getNames(self) -> List[unicode]:\n ...", "def namelist(self):\n retu...
[ "0.69251263", "0.6675172", "0.6654015", "0.6654015", "0.6648755", "0.65859276", "0.65859276", "0.65683997", "0.6558869", "0.655723", "0.6532181", "0.65298927", "0.6516372", "0.64144635", "0.64045525", "0.63822156", "0.63694435", "0.6307903", "0.62908643", "0.6270188", "0.6267...
0.7012186
0
Calculate the closure phase with the given baselines.
def Closure_Phase(self, uv1, uv2, uv3): phi1 = self.Phase(*uv1) phi2 = self.Phase(*uv2) phi3 = self.Phase(*uv3) cphi = phi1 - phi2 + phi3 cphi[cphi < -pi] += 2 * pi cphi[cphi > pi] -= 2 * pi return cphi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closure_phase_operator(self, redundant=False):\n N = self.nbap\n q = (N - 1) * (N - 2) // 2 if not redundant else N * (N - 1) * (N - 2) // 6\n p = self.nbuv\n base_apertures = [0] if not redundant else list(range(N))\n CPO = np.zeros((q, p))\n CPO_index = 0\n fo...
[ "0.6384488", "0.5323988", "0.522521", "0.5066586", "0.49080592", "0.48869595", "0.48869595", "0.48577842", "0.478878", "0.4783607", "0.47687697", "0.47503272", "0.47377008", "0.47261426", "0.47184068", "0.46760312", "0.46681336", "0.46456474", "0.46408623", "0.45900592", "0.4...
0.5491304
1
1 if the current device is CPU. Otherwise GPU ID. If called outside the current task context, return data owner's device_id by default
def _current_device_index(self) -> int: device = PArray._get_current_device() if device is None: # not called inside current task return self._coherence.owner elif device.architecture == cpu: return CPU_INDEX else: # assume GPU here, won't check devic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deviceid(gpu):\n\n # Return if this is already a torch device\n # pylint: disable=E1101\n if isinstance(gpu, torch.device):\n return gpu\n\n # Always return -1 if gpu is None or an accelerator device is unavailable\n if gpu is None or not Models.hasaccelerator():\n...
[ "0.7568771", "0.7159804", "0.70684135", "0.7065984", "0.7047651", "0.7042267", "0.69943464", "0.6928884", "0.69227505", "0.6922525", "0.68241423", "0.678068", "0.6731357", "0.67055494", "0.6656736", "0.6651197", "0.66496414", "0.66417074", "0.6622966", "0.6599968", "0.6592631...
0.76064694
0
An estimate of bytes used in `device_id` after data is moved there. It is neither lower bound nor upper bound.
def nbytes_at(self, device_id:int): if self._slices: if isinstance(self._coherence._local_states[device_id], dict): # there are subarrays no this device if self._slices_hash in self._coherence._local_states[device_id].keys(): # this subarray is already there retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dev_size(device):\n device_path = \"/sys/block/\"\n num_sectors = open(device_path + device + \"/size\").read().rstrip(\"\\n\")\n sector_size = (\n open(device_path + device + \"/queue/hw_sector_size\")\n .read()\n .rstrip(\"\\n\")\n )\n return int(num_sectors) * int(sector_...
[ "0.65671223", "0.6112991", "0.6105079", "0.60627437", "0.5987058", "0.59140545", "0.5829351", "0.5811486", "0.5776342", "0.5741981", "0.57396996", "0.5708407", "0.5708407", "0.5708407", "0.5708407", "0.56670177", "0.56650215", "0.56228447", "0.56125957", "0.5601722", "0.55944...
0.6388065
1
Print global overview of current PArray for debugging
def print_overview(self) -> None: state_str_map = {0: "INVALID", 1: "SHARED", 2: "MODIFIED"} print(f"---Overview of PArray\n" f"ID: {self.ID}, " f"Name: {self._name}, " f"Parent_ID: {self.parent_ID if self.ID !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(self):\n \n #path\n print('Path information:')\n for k, v in self.__path.items():\n print(k, v)\n \n #sample count\n print('Sample statistic of each phase')\n for k, v in self.__phase_sample_count.items():\n print(k, v)\n ...
[ "0.6506461", "0.64922816", "0.6477643", "0.636149", "0.6245735", "0.6226677", "0.62087417", "0.6165838", "0.616191", "0.6132819", "0.6120514", "0.6097762", "0.6072334", "0.60700065", "0.6064867", "0.60573196", "0.60506463", "0.6027437", "0.60007197", "0.5984009", "0.5981173",...
0.77615994
0
Evict all copies from buffer, and clean all related fields
def evict_all(self) -> None: self._array = None self._coherence = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeall(self):\n\n # If there used to be a key, there must exist an old value blob somewhere in the database. It should be deallocated after a successful commit to disk.\n for key in self.keys:\n if self.keys[key] is not None:\n punchat,punchlen = self.keys[key]\n ...
[ "0.68613684", "0.67462224", "0.6734561", "0.6724728", "0.67224747", "0.66970587", "0.6572537", "0.65546036", "0.6525338", "0.64800787", "0.6477587", "0.6454403", "0.6439972", "0.6403386", "0.6378573", "0.6376939", "0.63683766", "0.6359996", "0.63383526", "0.6332468", "0.63194...
0.6973438
0
Evict a device's copy and update coherence states.
def evict(self, device_id: int = None, keep_one_copy: bool = True) -> None: if device_id is None: device_id = self._current_device_index with self._coherence_cv[device_id]: operations = self._coherence.evict(device_id, keep_one_copy) self._process_operations(operatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discard(self) -> None:\n self._cached_cpu_activations.clear()", "def on_unassign(self):", "def deactivate(self):\n if self.parents[0].type == 'dm-multipath':\n devmap = block.getMap(major=self.major, minor=self.minor)\n if devmap:\n try:\n ...
[ "0.5906839", "0.55631566", "0.5532155", "0.5498732", "0.54559594", "0.5447127", "0.5381022", "0.53707004", "0.53222936", "0.5274804", "0.5268613", "0.52685386", "0.5236002", "0.5207943", "0.52032274", "0.519083", "0.51686573", "0.5156111", "0.5144335", "0.51166004", "0.511233...
0.63869596
0
Tell the coherence protocol a read happened on a device. And do data movement based on the operations given by protocol.
def _coherence_read(self, device_id: int = None, slices: SlicesType = None) -> None: if device_id is None: device_id = self._current_device_index # update protocol and get operation with self._coherence._lock: # locks involve operations = self._coherence.read(device_id,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inReadEvent(self):\r\n try:\r\n self._checkAssert()\r\n if self.handshaker:\r\n self._doHandshakeOp()\r\n elif self.closer:\r\n self._doCloseOp()\r\n elif self.reader:\r\n self._doReadOp()\r\n elif self.w...
[ "0.5821118", "0.5671535", "0.5632781", "0.55741394", "0.5570815", "0.5503475", "0.5421125", "0.5362482", "0.5355735", "0.5354419", "0.53358424", "0.53311753", "0.52687645", "0.52552265", "0.5245723", "0.5225012", "0.5190005", "0.5173454", "0.51724124", "0.5166722", "0.5164686...
0.60276663
0
Tell the coherence protocol a write happened on a device. And do data movement based on the operations given by protocol.
def _coherence_write(self, device_id: int = None, slices: SlicesType = None) -> None: if device_id is None: device_id = self._current_device_index # update protocol and get operation with self._coherence._lock: # locks involve operations = self._coherence.write(device_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_writing(self, soc):\n self._log(\"writing %r\" % self._writing[soc])\n sent = soc.send(self._writing[soc])\n if not sent:\n self._handle_error(soc)\n # Offsets would be more efficient, but this is python so it's not worth it.\n self._writing[soc] = self._writing[soc][sent:]\n if ...
[ "0.59771055", "0.58352953", "0.5795601", "0.5769751", "0.5651605", "0.55738467", "0.55253106", "0.5506683", "0.54791766", "0.5464289", "0.54628277", "0.5449849", "0.54188335", "0.540623", "0.5374942", "0.53657895", "0.5349587", "0.53315616", "0.53300697", "0.5323799", "0.5311...
0.62454164
0
Process the given memory operations. Data will be moved, and protocol states is kept unchanged.
def _process_operations(self, operations: List[MemoryOperation], slices: SlicesType = None) -> None: for op in operations: if op.inst == MemoryOperation.NOOP: pass # do nothing elif op.inst == MemoryOperation.LOAD: if MemoryOperation.LOAD_SUBARRAY in op.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TransferMemorySequence():\r\n pass", "def run(self, in_op):\n self.move_inner_state(in_op)\n if isinstance(in_op, memops.ReorderBase):\n self.substitute_reorder(in_op)\n elif isinstance(in_op, memops.FlushBase):\n self.flush_stores(in_op)\n elif isinst...
[ "0.6162057", "0.59280264", "0.58506984", "0.56673956", "0.5547582", "0.53738374", "0.53355587", "0.53013074", "0.52991265", "0.5276234", "0.5227555", "0.51870847", "0.51634264", "0.51478267", "0.5125763", "0.51199305", "0.51100224", "0.51066715", "0.50779814", "0.5077944", "0...
0.7123763
0
Get current device from task environment. Return None if it is not called within the current task context
def _get_current_device() -> Device | None: if task_runtime.has_environment(): return task_runtime.get_current_devices()[0] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_device():\n return context.get_context('device_target')", "def get_device(self):\n raise NotImplementedError()", "def get_device(self):\n return self.parent.get_device()", "def get_device():\n c_dev = ct.c_int(0)\n safe_call(backend.get().af_get_device(ct.pointer(c_dev)))\n ...
[ "0.80176103", "0.72012043", "0.71950096", "0.71387523", "0.7131235", "0.7082842", "0.70785034", "0.6983162", "0.6983162", "0.6983162", "0.6983162", "0.6983162", "0.69713515", "0.68028766", "0.67965627", "0.6782209", "0.67590714", "0.6711837", "0.66777796", "0.6625428", "0.657...
0.89496875
0
Automatically move data to current device. Multiple copies on different devices will be made based on coherence protocol.
def _auto_move(self, device_id: int = None, do_write: bool = False) -> None: # this is the view of current array, only data within this range should be moved # currently, only use first slices, which means automove of subarray of subarray is not supported # TODO: support auto-move subarray of su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_devices(self, data):\n data = clean(data, self.move_parameters)\n return self.put(\"/devices/move\", data)", "def move_data_to_device(self, data: Tuple) -> Tuple:\n tmp = []\n for dv in data:\n tmp.append(dv.to(self.device))\n \n return tuple(tmp)", ...
[ "0.64000696", "0.58103156", "0.5614368", "0.55714643", "0.5544471", "0.5494813", "0.5398319", "0.53958523", "0.5386477", "0.53515464", "0.5343784", "0.5320827", "0.53119296", "0.52720946", "0.52668", "0.52289945", "0.5112816", "0.5110937", "0.510419", "0.50865155", "0.508469"...
0.6202042
1
Return True if the two PArrays are in the same device.
def _on_same_device(self, other: "PArray") -> bool: this_device = self._current_device_index return this_device in other._array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arrays_are_same(a1, a2):\n try:\n return a1.__array_interface__['data'] == a2.__array_interface__['data'] \\\n and a1.strides == a2.strides\n except AttributeError:\n return False", "def __eq__(self, other: JaggedArray) -> bool:\n\n return np.array_equal(self.data, other...
[ "0.71909565", "0.6712798", "0.64848155", "0.645493", "0.6450996", "0.6444737", "0.64358234", "0.64259166", "0.6402271", "0.6372332", "0.63694084", "0.6294412", "0.6291298", "0.62789136", "0.6271262", "0.6222032", "0.6214251", "0.61150944", "0.6109401", "0.61036193", "0.605932...
0.86543465
0
Returns the entropy of a discrete distribution p
def entropy(p): assert (p >= 0).all() assert abs(np.sum(p)-1) < 1e-6 return -np.sum(p*np.log(p+1e-12))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy_py(p):\n return 2 ** np.sum(-p*np.log2(p+1e-10))", "def entropy(P):\n P_nan = P.copy()\n P_nan[P_nan == 0] = np.nan\n return np.nansum(np.multiply(P_nan, np.log2(1 / P_nan)))", "def entropy(p: torch.Tensor):\n nz = (p > 0).to(p.device)\n\n eps = torch.finfo(p.dtype).eps\n p_sta...
[ "0.8535428", "0.8026321", "0.7933022", "0.7899416", "0.7778248", "0.7755773", "0.7616017", "0.7574335", "0.7550206", "0.75214255", "0.74680275", "0.7442331", "0.7418228", "0.73868614", "0.7344822", "0.7340159", "0.7325228", "0.7321643", "0.73122334", "0.7301384", "0.728359", ...
0.8559822
0
Returns the fourier transform of evolution for a list of graphs for the hamiltonian ising and xy.
def return_fourier_from_dataset(graph_list, rot_init=settings.rot_init): fs_xy = np.zeros((2, len(graph_list), 1000)) fs_is = np.zeros((2, len(graph_list), 1000)) for i, graph in enumerate(graph_list): fs_xy[0][i], fs_xy[1][i] = generate_signal_fourier(graph, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numpyFourierTransform(self,graph):\n z=[complex(*graph[i]) for i in range(len(graph))]\n return np.fft.fft(z)", "def fourier(data, temp_freq, axis, output = 'amplitude'):\n\t\t\n\t\n\t# take largest possible multiple of F1 from PSTH.\n\t# Generate freq and fft\n\t# generate amplitude\n\t# retur...
[ "0.55366683", "0.5516783", "0.5465739", "0.5419355", "0.52768075", "0.5247535", "0.519193", "0.51801133", "0.51327807", "0.50940454", "0.50563395", "0.5017494", "0.49684712", "0.49435076", "0.4934959", "0.49291548", "0.4896146", "0.48880312", "0.48491418", "0.48234916", "0.48...
0.5995976
0
Returns the list of states after evolution for each graph following return_evolution functions.
def return_list_of_states(graphs_list, times, pulses, evol='xy', verbose=0): all_states = [] for G in tqdm(graphs_list, disable=verbose==0): all_states.append(return_evolution(G, times, pulses, evol)) return all_states
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_states(self):\n return list(self.iter_final_states())", "def get_states():\n # Getting all hidden state through time\n all_hidden_states = tf.scan(GRU, processed_input, \n initializer=initial_hidden, name='states')\n return all_hidden_states", "d...
[ "0.6391523", "0.62999266", "0.6123978", "0.6084034", "0.6044997", "0.60010105", "0.58874", "0.5814941", "0.5797912", "0.5785024", "0.57735914", "0.57689357", "0.5768432", "0.57666254", "0.57618797", "0.57523", "0.57481694", "0.57441455", "0.57423705", "0.57423705", "0.5676234...
0.69398534
0
Returns all the discrete probability distributions of a diagonal observable on a list of states each one associated with a graph. The observable can be different for each state. The distribution is taken of all possible values of all observables.
def return_energy_distribution(graphs_list, all_states, observable_func=None, return_energies=False, verbose=0): all_e_distrib = [] all_e_values_unique = [] for i, G in enumerate(tqdm(graphs_list, disable=verbose==0)): if observable_func == None: observable = generate_Ham_from_graph( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, observations):\n observations = numpy.asarray(observations)\n if self.continuous:\n state_probabilities = [kde(observations) for kde in self.state_distributions]\n else:\n state_probabilities = [hist[observations] for hist in self.state_distributions]\n...
[ "0.6591823", "0.5872692", "0.58593", "0.5736784", "0.5724965", "0.5662096", "0.56376517", "0.55812466", "0.55553836", "0.54749936", "0.54611444", "0.5455154", "0.5436561", "0.5419842", "0.536642", "0.5363021", "0.53453237", "0.53352815", "0.5247028", "0.5240108", "0.5212738",...
0.62507945
1
Extends masses array with columns of zeros for missing energies.
def extend_energies(target_energies, energies, masses): energies = list(energies) N = masses.shape[0] res = np.zeros((N, len(target_energies))) for i, energy in enumerate(target_energies): if energy not in energies: res[:, i] = np.zeros((N, )) else: res[:, i] = ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_cdm_missing_columns(self, all_merged_obs):\n #cdm_keys = self.obs_table_columns \n nan_array = np.empty( all_merged_obs['observed_variable'].shape )\n nan_array[:] = np.nan\n for k in self.obs_table_columns:\n if k not in list(all_merged_obs.colu...
[ "0.5828517", "0.5681226", "0.55303085", "0.5472589", "0.54533696", "0.5409089", "0.54075205", "0.5340413", "0.5293353", "0.5269589", "0.5262647", "0.5260811", "0.5245497", "0.5217069", "0.5212759", "0.5197485", "0.5173649", "0.5173649", "0.5170683", "0.5164495", "0.5139979", ...
0.6560954
0
Returns the JensenShannon distance matrix of discrete distributions.
def return_js_square_matrix(distributions, verbose=0): js_matrix = np.zeros((len(distributions), len(distributions))) for i in range(len(distributions)): for j in range(i + 1): masses1 = distributions[i] masses2 = distributions[j] js = entropy((masses1+masses2)/2) -\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDistanceMatrix(self):\n v = self.getVectors()\n vLis = v.keys()\n N = len(v.keys())\n D = np.zeros([N, N], dtype=np.float32)\n print(N)\n for i in range(N):\n print(\"%d/%d\" %(i, N))\n D[i, i] = 1\n for j in range(i + 1, N):\n ...
[ "0.6366571", "0.62066615", "0.60713434", "0.60403615", "0.5970018", "0.59257656", "0.5893016", "0.58267516", "0.5821366", "0.5815694", "0.5802866", "0.5776638", "0.5758599", "0.5732003", "0.5713257", "0.5684547", "0.56317765", "0.5623221", "0.5565517", "0.55054116", "0.549900...
0.6692387
0
Key insensitive to how edges of the graph are returned (order of edges and order of nodes in edges). Same result for [(a, b), (c, d)] and [(d, c), (a, b)]
def edges_unique_key(graph): edges = list(map(sorted, graph.edges)) return tuple(map(tuple, sorted(edges, key=itemgetter(0,1))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges_key(graph):\n return tuple(graph.edges())", "def getEdges(self):\n # for node in graph,\n # return node -> node for j in graph[node]\n\n return [\"->\".join([str(n1), str(n2)]) for n1 in self.graph.keys() for n2 in self.graph[n1]]", "def graph():\n\n graph = {'A': ['B',...
[ "0.8092503", "0.68510854", "0.6834099", "0.6819503", "0.6698048", "0.6691937", "0.6650468", "0.65600914", "0.65495294", "0.6514974", "0.6514542", "0.64773357", "0.6469168", "0.646692", "0.64300513", "0.639204", "0.6339081", "0.6325254", "0.6244339", "0.62142223", "0.62065727"...
0.7559962
1
Simple key based on the edges list
def edges_key(graph): return tuple(graph.edges())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(self):\r\n\t\treturn ( hashE(self.edge),self.p1,self.p2);", "def edges_unique_key(graph):\n edges = list(map(sorted, graph.edges))\n return tuple(map(tuple, sorted(edges, key=itemgetter(0,1))))", "def hash_key(self):", "def key(self):\n if self._key is None:\n fields =...
[ "0.74839115", "0.70695525", "0.62742394", "0.61138654", "0.6107315", "0.5972589", "0.59714097", "0.593486", "0.59181863", "0.5910348", "0.58266234", "0.5789931", "0.576313", "0.574726", "0.5664185", "0.56608796", "0.56562984", "0.56529033", "0.5643613", "0.563653", "0.5627483...
0.77654463
0
Gets observable on graph Uses memoization to speed up the process if graph has been seen before
def get_observable(self, graph): key = self.get_key(graph) if key not in self.graphs: self.graphs[key] = self.observable(graph) return self.graphs[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_graph(self):\n return copy.deepcopy(self.graph)", "def graph(self):\n ...", "def _get_full_graph(self):", "def gen_graph(self):", "def buildGraph(self):\n return None", "def graph(self):\n return self.__graph", "def get_graph(self, engine, args):\n if args not...
[ "0.58682907", "0.5854089", "0.5836618", "0.56403035", "0.5633858", "0.5579515", "0.55596554", "0.5537906", "0.55360013", "0.5529597", "0.5515514", "0.5511076", "0.5501991", "0.5464765", "0.54600555", "0.54531276", "0.54531276", "0.5360173", "0.53295106", "0.53181666", "0.5314...
0.7362642
0
set the Cursor invisible
def hide_cursor(): props = WindowProperties() props.setCursorHidden(True) # somehow the window gets undecorated after hiding the cursor # so we reset it here to the value we need #props.setUndecorated(settings.fullscreen) base.win.requestProperties(props)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_cursor(self) -> None:\n self._impl.hide_cursor()", "def cursor_hidden():\n return mouse.SDL_ShowCursor(SDL_QUERY) == SDL_DISABLE", "def hide_cursor():\n ret = mouse.SDL_ShowCursor(SDL_DISABLE)\n if ret < 0:\n raise_sdl_err(\"hiding the mouse cursor\")", "def cursor_set(self, y...
[ "0.80812335", "0.7785941", "0.77270675", "0.7230774", "0.7165916", "0.71635675", "0.69014233", "0.67774254", "0.67243725", "0.6599917", "0.6590271", "0.658137", "0.65602016", "0.6552145", "0.65371734", "0.64842963", "0.64664114", "0.6464243", "0.64412075", "0.6363666", "0.635...
0.80937314
0
injects a new request into current request object.
def inject_new_request(self): self.__current_request_mock = CoreRequestMock()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_request(self, req):\n req.context = self.make_context(req)", "def _set_request(self, request):\n self._request = request", "def newRequest(self):\n return Request( )", "def append_to_request(self, request_base, request_object):\n\n pass", "def add_request(self, reque...
[ "0.69178027", "0.68766016", "0.6790378", "0.6778249", "0.653759", "0.65059483", "0.64909685", "0.63973343", "0.6350897", "0.6327566", "0.6317726", "0.6312367", "0.6303929", "0.6248073", "0.62330276", "0.6227705", "0.6210762", "0.6203217", "0.62026197", "0.6074421", "0.6033342...
0.76589864
0
clears current request object.
def clear_current_request(self): self.__current_request_mock = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clear_request(self):\n self._request = None", "def clear(self, request):\n requests.put('{}/clear'.format(self._get_url()), data=request.json())", "def clear(self, request):\n del request.session[self.id]", "def clearRequest():\n setRequest(marker)", "def reset(self):\n ...
[ "0.88998795", "0.81141376", "0.80775124", "0.786648", "0.7781764", "0.76556665", "0.75459784", "0.74782085", "0.7166208", "0.7107878", "0.7107878", "0.70750976", "0.70750976", "0.70750976", "0.67689496", "0.65714395", "0.6553273", "0.65381855", "0.64922774", "0.6453986", "0.6...
0.8228699
1
sets the given access token in current request.
def set_access_token(self, token): self.__current_request_mock.headers['Authorization'] = token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_access_token(self, access_token):\n self.access_token = access_token", "def access_token(self, access_token):\n\n self._access_token = access_token", "def set_access_token(self, value: str) -> None:\n\n self.__requester.set_authorization(value)", "def auth_access_token_request(se...
[ "0.7911822", "0.77660596", "0.7647122", "0.7603611", "0.7121884", "0.7116163", "0.69187003", "0.68211925", "0.67627317", "0.6746904", "0.67017776", "0.6563495", "0.65510315", "0.64993775", "0.6483176", "0.64291406", "0.6401049", "0.6347656", "0.6347559", "0.63349056", "0.6166...
0.79374963
0
sets the given refresh token in current request.
def set_refresh_token(self, token): self.__current_request_mock.headers['Cookie'] = f'Refresh-Auth={token}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_refresh(self, token_refresh):\n\n self._token_refresh = token_refresh", "def set_reddit_oauth_refresh_token(site_name, token, _current_parser=None):\n set_value(site_name, OAUTH_CRED_KEYS[CredKeys.refresh], token, _current_parser)", "def refresh_token(self):\n url = 'https://www.yiky...
[ "0.819976", "0.7503534", "0.6996313", "0.69947696", "0.69867736", "0.69400346", "0.6887728", "0.68788785", "0.68174803", "0.6813276", "0.6781366", "0.6763729", "0.67563605", "0.67479444", "0.67211205", "0.67074114", "0.6697538", "0.6684261", "0.66680694", "0.666029", "0.66441...
0.79867774
1
Generates a token of a different format depending on the medium, a 32 characters alphanumeric one if the medium is email, a 6 characters numeric one otherwise.
def generateTokenForMedium(medium: str) -> str: if medium == "email": return generateAlphanumericTokenOfLength(32) else: return generateNumericTokenOfLength(6)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token_string(token):\n if JWT_AUTH:\n return 'JWT {}'.format(token)\n else:\n return 'Token {}'.format(token)", "def make_token():\n return secrets.token_urlsafe(36)", "def generateToken():\n length = random.randint(8, 32)\n rdmtoken = ''.join(random.choice(string.prin...
[ "0.6564728", "0.63657165", "0.6316097", "0.59882337", "0.59799993", "0.59217316", "0.58563113", "0.5784893", "0.5770865", "0.57325625", "0.5705895", "0.56980544", "0.5682344", "0.5665848", "0.5569553", "0.55450803", "0.5539791", "0.550906", "0.5489072", "0.5478415", "0.547741...
0.8976365
0
Consume RPC calls for the given API
async def consume_rpcs( self, apis: Sequence[Api], bus_client: "BusClient" ) -> Sequence[RpcMessage]: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.logger.info(\"start consuming api calls\")\n while not self.shutdown:\n self.rpc.listen()", "def call(api, url, method, payload=None, headers=None, auth=_KERBEROS_AUTH,\n proxies=None, retries=_NUM_OF_RETRIES, timeout=None, stream=None):\n if not api:\n ...
[ "0.68935806", "0.62278247", "0.61158144", "0.5999046", "0.5981028", "0.5978859", "0.5921289", "0.58170295", "0.5805861", "0.5794442", "0.578403", "0.5707386", "0.56905967", "0.5672584", "0.5668719", "0.5659307", "0.5646943", "0.5626587", "0.5602543", "0.5596548", "0.5589859",...
0.7117492
0
Utility method to sanity check the `listen_for` parameter. Call at the start of your consume() implementation.
def _sanity_check_listen_for(self, listen_for): if not listen_for: raise NothingToListenFor( "EventTransport.consume() was called without providing anything " 'to listen for in the "listen_for" argument.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen(self, backlog: int) -> None:\n ...", "def listen(self):\n raise NotImplementedError()", "def listen(self) -> None:\n raise NotImplementedError", "def listen(self, *a, **kw):\n raise NotImplementedError()", "def test_listen_server(self):\n self.assertRaises(vk.l...
[ "0.6402229", "0.63514966", "0.6343499", "0.6256435", "0.6250072", "0.6207335", "0.5995244", "0.55732787", "0.551111", "0.5510104", "0.546018", "0.5428086", "0.53994113", "0.5398242", "0.5391532", "0.53798866", "0.5355215", "0.5354416", "0.5351625", "0.53470826", "0.53413", ...
0.80365247
0
Store a schema for the given API
async def store(self, api_name: str, schema: Dict, ttl_seconds: int): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_schema(self, schema: str):\n return", "def create_model(self, ApiId: str, Name: str, Schema: str, ContentType: str = None, Description: str = None) -> Dict:\n pass", "def schema() -> None:\n pass", "def create_schema():\n schema = Schema(idx=ID(stored=True),\n da...
[ "0.65519774", "0.6362324", "0.6066803", "0.6042462", "0.6007055", "0.59981275", "0.5994073", "0.59561974", "0.59448963", "0.5918168", "0.58865476", "0.58362156", "0.5805175", "0.5794914", "0.57884306", "0.57884306", "0.57884306", "0.5776773", "0.5716331", "0.57124263", "0.569...
0.7529382
0
Get a set of all transports irrespective of type
def get_all_transports(self) -> Set[Transport]: all_transports = chain(*[entry._asdict().values() for entry in self._registry.values()]) return set([t for t in all_transports if t is not None])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transports(self) -> List[TransportPair]:\n with self._lock:\n return self._transport_list", "def getClientTransports(self):\n\n return self.transports", "def get_router_transports(self, details=None):\n self.log.debug(\"{}.get_router_transports\".format(self.__class__.__...
[ "0.73238736", "0.685588", "0.6616401", "0.60161", "0.55688196", "0.55271745", "0.5488733", "0.5408329", "0.5400791", "0.537061", "0.53552693", "0.53174263", "0.52763665", "0.5236717", "0.5139262", "0.512368", "0.51200074", "0.5116004", "0.5114515", "0.5111977", "0.5108901", ...
0.7916006
0
This function run as a Process. Deletes the IP if no minute deviation is found since the first packet sent by it
def delete_by_time(): while True: try: now = time.time() for user in get_time_start(): ip, start, protocol = str(user[0][0]), user[1][0], str(user[2][0]) if now - start >= 60 and ip not in BLACK_LIST: delete_ip(ip) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_packets(self, num):\n for i in range(num):\n del self._packets[0]", "def deleteIpTcp(self):\n\t\tquery = ''\n\t\tconn = self.get_connection()\n\t\theaders = { 'Content-type' : 'application/json', 'Authorization' : 'A10 %s' %self.sessionid}\n\t\tconn.request('DELETE', self.get_path() ...
[ "0.57281846", "0.55785", "0.55547357", "0.5404259", "0.53753024", "0.5368322", "0.5351206", "0.5324668", "0.529334", "0.52827144", "0.5262819", "0.5261861", "0.52167547", "0.5207755", "0.5196121", "0.51961124", "0.5155561", "0.5154647", "0.514658", "0.5094146", "0.5070127", ...
0.66586894
0
Truncating an Integral returns itself.
def __trunc__(self, ???):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trunc(x):\n return 0", "def integral_normed (self):\n return self / self.integral", "def trunc_inplace(a):", "def trunc(self, typ):", "def __trunc__(self, *args, **kwargs): # real signature unknown\n pass", "def __trunc__(self, *args, **kwargs): # real signature unknown\n ...
[ "0.60533917", "0.56643367", "0.5633817", "0.55444497", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5532241", "0.5470706", ...
0.589768
1
int.bit_length() > int Number of bits necessary to represent self in binary. >>> bin(37) '0b100101' >>> (37).bit_length() 6
def bit_length(self, ???):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bit_length(self): # real signature unknown; restored from __doc__\n pass", "def bit_length(self): # real signature unknown; restored from __doc__\n pass", "def bit_length(self): # real signature unknown; restored from __doc__\n pass", "def bit_length(self): # real signature unknown; ...
[ "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.80463344", "0.7434369", "0.7217988", "0.7121551", "0.7097779", ...
0.81482387
0
Calculate the Surface Area of a Cube. >>> surface_area_cube(1) 6 >>> surface_area_cube(1.6) 15.360000000000003 >>> surface_area_cube(0) 0 >>> surface_area_cube(3) 54 >>> surface_area_cube(1)
def surface_area_cube(side_length: float) -> float: if side_length < 0: raise ValueError("surface_area_cube() only accepts non-negative values") return 6 * side_length**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area_of_cube(side):\n return side", "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def calc_surface_area(faces, verts):\n # Calculate the surface area of a mesh from it's triangle faces.\n # faces: List of all the faces on the surface. Each face ind...
[ "0.72815645", "0.7010892", "0.7009734", "0.68451345", "0.6664104", "0.6644253", "0.65627605", "0.6529839", "0.64588445", "0.64086616", "0.63413715", "0.62906426", "0.6159937", "0.6155156", "0.60905915", "0.6041885", "0.6029499", "0.5991128", "0.5963586", "0.59513634", "0.5945...
0.7367549
0
Calculate the Surface Area of a Cuboid. >>> surface_area_cuboid(1, 2, 3) 22 >>> surface_area_cuboid(0, 0, 0) 0 >>> surface_area_cuboid(1.6, 2.6, 3.6) 38.56 >>> surface_area_cuboid(1, 2, 3)
def surface_area_cuboid(length: float, breadth: float, height: float) -> float: if length < 0 or breadth < 0 or height < 0: raise ValueError("surface_area_cuboid() only accepts non-negative values") return 2 * ((length * breadth) + (breadth * height) + (length * height))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area_cube(side_length: float) -> float:\r\n if side_length < 0:\r\n raise ValueError(\"surface_area_cube() only accepts non-negative values\")\r\n return 6 * side_length**2", "def surface_area_of_cube(side):\n return side", "def compute_surface_area(self):\n return np.sum(sel...
[ "0.6666402", "0.64514595", "0.64180577", "0.6362404", "0.6269711", "0.6249463", "0.62020266", "0.6193033", "0.617231", "0.6169103", "0.61569345", "0.60257256", "0.60193086", "0.5955302", "0.590112", "0.5897125", "0.5896731", "0.589559", "0.58863145", "0.58802015", "0.5876737"...
0.75224274
0
Calculate the Surface Area of a Sphere.
def surface_area_sphere(radius: float) -> float: if radius < 0: raise ValueError("surface_area_sphere() only accepts non-negative values") return 4 * pi * radius**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area_hemisphere(radius: float) -> float:\r\n if radius < 0:\r\n raise ValueError(\"surface_area_hemisphere() only accepts non-negative values\")\r\n return 3 * pi * radius**2", "def sphere_area(radius : number) -> number:\n area = 4*pi*radius*radius\n return area", "def sphereAre...
[ "0.75944006", "0.7547221", "0.74640936", "0.7159024", "0.71472585", "0.66771775", "0.6609041", "0.6607308", "0.6575029", "0.6481573", "0.64479804", "0.6444091", "0.64219826", "0.6398195", "0.6333034", "0.6320497", "0.6280175", "0.6243655", "0.6232985", "0.6222155", "0.6218048...
0.77417064
0
Calculate the Surface Area of a Hemisphere.
def surface_area_hemisphere(radius: float) -> float: if radius < 0: raise ValueError("surface_area_hemisphere() only accepts non-negative values") return 3 * pi * radius**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def surface_area(DEM, resolution):\n\n resolution_squared = resolution ** 2.\n cross_distance_squared = 2.0 * (resolution ** 2.)\n\n m1 = ((DEM[0:-1, 0:-1] - DEM[0:-1, 1:]) ** 2.0 + resolution_squared) ** 0.5\n m2 ...
[ "0.72399956", "0.7046556", "0.69472444", "0.68784386", "0.67994255", "0.67446357", "0.67176634", "0.6669289", "0.6648197", "0.6646721", "0.6634711", "0.6555099", "0.6460852", "0.63712317", "0.6334383", "0.63145924", "0.63024366", "0.629782", "0.6238995", "0.62154955", "0.6206...
0.73289835
0
Calculate the Surface Area of a Conical Frustum. >>> surface_area_conical_frustum(1, 2, 3) 45.511728065337266 >>> surface_area_conical_frustum(4, 5, 6) 300.7913575056268 >>> surface_area_conical_frustum(0, 0, 0) 0.0 >>> surface_area_conical_frustum(1.6, 2.6, 3.6) 78.57907060751548 >>> surface_area_conical_frustum(1, 2,...
def surface_area_conical_frustum( radius_1: float, radius_2: float, height: float ) -> float: if radius_1 < 0 or radius_2 < 0 or height < 0: raise ValueError( "surface_area_conical_frustum() only accepts non-negative values" ) slant_height = (height**2 + (radius_1 - radius...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def __CalculateArea(self, contour):\r\n return cv2.contourArea(contour)", "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def getSurfaceArea(self) -> float:\n return self.area(...
[ "0.6291956", "0.58364004", "0.5753722", "0.57246095", "0.5682314", "0.5677191", "0.5626083", "0.5558596", "0.5558541", "0.55439174", "0.55187523", "0.5473769", "0.54420286", "0.537165", "0.5346501", "0.53398824", "0.53286076", "0.5327467", "0.5319384", "0.5314725", "0.5282321...
0.61237943
1
Calculate the area of a rectangle. >>> area_rectangle(10, 20) 200 >>> area_rectangle(1.6, 2.6) 4.16 >>> area_rectangle(0, 0) 0 >>> area_rectangle(1, 2)
def area_rectangle(length: float, width: float) -> float: if length < 0 or width < 0: raise ValueError("area_rectangle() only accepts non-negative values") return length * width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangle_area(width : number, height : number) ->number:\n area = width*height\n #print(\"The area of rectangle is =\", area, \"sq. units\")\n return area", "def rectangle_area(base, height):\n return (base * height)", "def rectangle_area(coordinates):\n return (coordinates[2] - coordinates...
[ "0.7999198", "0.78071344", "0.7696935", "0.7585217", "0.7534478", "0.7475466", "0.7437463", "0.7410219", "0.74051803", "0.73629963", "0.7253645", "0.7221623", "0.7206669", "0.7179803", "0.7151558", "0.71345943", "0.70913184", "0.70744777", "0.7072634", "0.70539236", "0.703855...
0.78188956
1
Calculate the area of a square. >>> area_square(10) 100 >>> area_square(0) 0 >>> area_square(1.6) 2.5600000000000005 >>> area_square(1)
def area_square(side_length: float) -> float: if side_length < 0: raise ValueError("area_square() only accepts non-negative values") return side_length**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_square(l):\n x = l * l\n return x", "def rectangle_area(width : number, height : number) ->number:\n area = width*height\n #print(\"The area of rectangle is =\", area, \"sq. units\")\n return area", "def square_area(side):\n return side**2", "def area(x, y):\n return x*y/2", "...
[ "0.7286142", "0.72473055", "0.7205924", "0.7182893", "0.7121043", "0.7083093", "0.70261645", "0.70175433", "0.6921208", "0.6849839", "0.6845397", "0.68417615", "0.6837337", "0.67906415", "0.6776792", "0.6761042", "0.6683266", "0.6667608", "0.6652926", "0.6637591", "0.6605035"...
0.7561725
0
Calculate the area of a triangle given the base and height. >>> area_triangle(10, 10) 50.0 >>> area_triangle(1.6, 2.6) 2.08 >>> area_triangle(0, 0) 0.0 >>> area_triangle(1, 2)
def area_triangle(base: float, height: float) -> float: if base < 0 or height < 0: raise ValueError("area_triangle() only accepts non-negative values") return (base * height) / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle_area(base, height): # Compute the area of a triangle\n area = (1.0 / 2) * base * height\n return area", "def triangleArea(base, height):\n base = float(base)\n height = float(height)\n area = 0.5*base*height\n return area", "def triangle_area(base, height):\n return...
[ "0.8957526", "0.87159944", "0.86000496", "0.79980665", "0.7791066", "0.7697558", "0.75109094", "0.7322677", "0.72746557", "0.72196394", "0.72144634", "0.7144356", "0.713802", "0.71086264", "0.7080001", "0.7001037", "0.69351196", "0.69297236", "0.69238174", "0.67804193", "0.67...
0.89786404
0
Calculate the area of a parallelogram. >>> area_parallelogram(10, 20) 200 >>> area_parallelogram(1.6, 2.6) 4.16 >>> area_parallelogram(0, 0) 0 >>> area_parallelogram(1, 2)
def area_parallelogram(base: float, height: float) -> float: if base < 0 or height < 0: raise ValueError("area_parallelogram() only accepts non-negative values") return base * height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parallelogram_area(base, height):\n area = base*height\n\n return area", "def area(self):\n if isinstance(self.crs, GeographicalCRS):\n major_axis = self.crs.ellipsoid.a\n minor_axis = self.crs.ellipsoid.b\n\n area = 0.0\n if major_axis == minor_axis: ...
[ "0.7611743", "0.6797339", "0.66222835", "0.66028", "0.6557646", "0.6508004", "0.64778906", "0.6472124", "0.6465857", "0.643528", "0.636906", "0.6340976", "0.63334084", "0.6315533", "0.6281842", "0.6274356", "0.6265391", "0.6235155", "0.62327737", "0.62298787", "0.622897", "...
0.78010267
0
Calculate the area of a ellipse. >>> area_ellipse(10, 10) 314.1592653589793 >>> area_ellipse(10, 20) 628.3185307179587 >>> area_ellipse(0, 0) 0.0 >>> area_ellipse(1.6, 2.6) 13.06902543893354 >>> area_ellipse(10, 20)
def area_ellipse(radius_x: float, radius_y: float) -> float: if radius_x < 0 or radius_y < 0: raise ValueError("area_ellipse() only accepts non-negative values") return pi * radius_x * radius_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ellipse_area(semi_major_axis: number, semi_minor_axis : number) -> number:\n area = pi*semi_major_axis*semi_minor_axis\n return area", "def ellipse_area(preds, target):\n # unpack target = (target, mask)\n target, mask = target\n if preds.size(2) != 4:\n raise ValueError('Prediction mus...
[ "0.7569128", "0.7252887", "0.70606506", "0.67599463", "0.66614044", "0.6620491", "0.65754545", "0.65114665", "0.6509608", "0.64492077", "0.63622475", "0.6348709", "0.6340304", "0.63310313", "0.63249993", "0.63071716", "0.62976605", "0.6270165", "0.6263262", "0.6239973", "0.62...
0.811346
0
Calculate the area of a rhombus. >>> area_rhombus(10, 20) 100.0 >>> area_rhombus(1.6, 2.6) 2.08 >>> area_rhombus(0, 0) 0.0 >>> area_rhombus(1, 2)
def area_rhombus(diagonal_1: float, diagonal_2: float) -> float: if diagonal_1 < 0 or diagonal_2 < 0: raise ValueError("area_rhombus() only accepts non-negative values") return 1 / 2 * diagonal_1 * diagonal_2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rhombus_area(diagonal_1, diagonal_2):\n return (diagonal_1 * diagonal_2) / 2", "def test_rhombus_area(self):\n self.assertEqual(17.5, rhombus_area(\n self.values['diagonal_1'], self.values['diagonal_2']))", "def cylinder_area(radius: number, height: number) -> number:\n area...
[ "0.75263935", "0.7184548", "0.6937286", "0.6691163", "0.66702396", "0.6650702", "0.6582693", "0.6513818", "0.64598763", "0.64313805", "0.63858813", "0.635034", "0.630958", "0.63000727", "0.6297246", "0.62846583", "0.6269995", "0.6269995", "0.62570214", "0.62527114", "0.625173...
0.7288092
1
Get step fixture name.
def get_step_fixture_name(name, type_, encoding=None): return "pytestbdd_{type}_{name}".format( type=type_, name=force_encode(name, **(dict(encoding=encoding) if encoding else {})) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_name(self):\n return self._step_name", "def step_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"step_name\")", "def getName(self):\n return self.stepDictionary[self.getLocation()]", "def step_name(self, index):\n step_label = self.get_step_label_at...
[ "0.7763003", "0.748142", "0.73309714", "0.72060895", "0.6888064", "0.68299204", "0.6611632", "0.65668637", "0.6497758", "0.6459365", "0.64183545", "0.63749194", "0.63527083", "0.6326266", "0.6295378", "0.62894195", "0.62200695", "0.6190335", "0.60310096", "0.6026371", "0.6012...
0.76748794
1
Step decorator for the type and the name.
def _step_decorator(step_type, step_name, converters=None, scope="function", target_fixture=None): def decorator(func): step_func = func parser_instance = get_parser(step_name) parsed_step_name = parser_instance.name if step_type == GIVEN: if not hasattr(func, "_pytestf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(step_name, extra_types=None):\n\n def decorator(func):\n # Register the step, other way return the function unchanged\n step_function = StepFunction(func, step_name, extra_types)\n # Check for similar steps, in both directions\n step_function.search_and_report_similar()\n ...
[ "0.78558373", "0.6774913", "0.6774913", "0.6761041", "0.6756011", "0.6623449", "0.6594203", "0.6491945", "0.6300954", "0.6300954", "0.6245583", "0.6217207", "0.6098405", "0.60954994", "0.6029569", "0.601242", "0.6006383", "0.5976284", "0.59603477", "0.59603477", "0.5949149", ...
0.7030183
1
Return the module of the caller.
def get_caller_module(depth=2): frame = sys._getframe(depth) module = inspect.getmodule(frame) if module is None: return get_caller_module(depth=depth) return module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_module(self):\n return self.module", "def module(self):\n return self.lib.module", "def module(self):\n return self._module", "def module(self):\n return self._module", "def module(self):\n return self._module", "def module(self):\n return self._module", ...
[ "0.8061645", "0.7585297", "0.75477153", "0.75477153", "0.75477153", "0.75477153", "0.75477153", "0.75134873", "0.72565323", "0.7210985", "0.712284", "0.7058211", "0.69959307", "0.6984209", "0.695014", "0.6890235", "0.6839327", "0.67928845", "0.6765729", "0.6759371", "0.673699...
0.78693414
1
Inject fixture into pytest fixture request.
def inject_fixture(request, arg, value): fd_kwargs = { "fixturemanager": request._fixturemanager, "baseid": None, "argname": arg, "func": lambda: value, "scope": "function", "params": None, } if "yieldctx" in get_args(pytest_fixtures.FixtureDef.__init__): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_example_data():\n import_example_data()", "def setup_fixtures(func):\n func = pytest.mark.usefixtures('smtp', 'mock_access_request', 'dummy_access_request')(func)\n func = pytest.mark.parametrize('mock_access_request',\n [{\n ...
[ "0.6621165", "0.6542824", "0.6542824", "0.6503567", "0.6448711", "0.6152027", "0.61376375", "0.6117961", "0.59044176", "0.5899505", "0.56671584", "0.56661564", "0.5649839", "0.5639458", "0.55946094", "0.55808634", "0.5549694", "0.5549694", "0.5549694", "0.55391383", "0.551508...
0.71561885
0
Test that having axes in any order or quantity does not confuse glyphsLib, even when the weight or width are not in the default positions.
def test_weight_width_custom(axes, ufo_module): doc = _make_designspace_with_axes(axes, ufo_module) font = to_glyphs(doc) if _is_subset_of_default_axes([GSAxis(name=n, tag=t) for t, n in axes]): assert font.customParameters["Axes"] is None else: assert font.customParameters["Axes"] == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_axis_with_no_mapping_does_not_error_in_roundtrip_with_2_axes(ufo_module):\n doc = _make_designspace_with_axes(\n [(\"wght\", \"Weight with mapping\"), (\"wdth\", \"Width without mapping\")], ufo_module\n )\n # Add mapping to weight axis\n doc.axes[0].map = [(0, 0), (50, 350), (100, 1000...
[ "0.6985757", "0.6233533", "0.6203525", "0.6161034", "0.5991015", "0.5960742", "0.5880376", "0.5853626", "0.582937", "0.5827674", "0.5728147", "0.5699523", "0.5676249", "0.5665066", "0.5654618", "0.56122905", "0.5566728", "0.55429345", "0.55375475", "0.5530844", "0.5522221", ...
0.707271
0
Tests get_regular_master when 'Variable Font Origin' custom parameter name is used with master set to 'Regular Text'. This is the current default custom parameter name in the Glyphs editor / glyphs source file specification.
def test_custom_parameter_vfo_current(): source_path = os.path.join("tests", "data", "CustomParameterVFO.glyphs") font = GSFont(source_path) assert font.customParameters["Variation Font Origin"] is None test_id = font.customParameters["Variable Font Origin"] assert test_id == "ACC63F3E-1323-486A-94A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_regular_master(masters, regularName=None):\n assert len(masters) > 0\n if regularName is not None:\n for font in masters:\n if font.info.styleName == regularName:\n return font\n base_style = find_base_style(masters)\n if not base_style:\n base_style = '...
[ "0.69350207", "0.6909895", "0.6648281", "0.5223326", "0.5092955", "0.4946685", "0.46939337", "0.468453", "0.46685544", "0.46685544", "0.4646657", "0.4641774", "0.46350524", "0.4610456", "0.45767817", "0.45586544", "0.45528513", "0.45253748", "0.45107546", "0.45049223", "0.447...
0.75802004
0
Tests get_regular_master when 'Variation Font Origin' custom parameter name is used with master set to 'Regular Text'. This custom parameter name is not used in current releases of the Glyphs editor / glyphs source file specification.
def test_custom_parameter_vfo_old_name(): source_path = os.path.join("tests", "data", "CustomParameterVFO.glyphs") font = GSFont(source_path) # mock up source for this test with a source file from another test del font.customParameters["Variable Font Origin"] font.customParameters["Variation Font O...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_custom_parameter_vfo_current():\n source_path = os.path.join(\"tests\", \"data\", \"CustomParameterVFO.glyphs\")\n font = GSFont(source_path)\n assert font.customParameters[\"Variation Font Origin\"] is None\n test_id = font.customParameters[\"Variable Font Origin\"]\n assert test_id == \"A...
[ "0.7359684", "0.67687136", "0.6363678", "0.51723284", "0.50032544", "0.48569408", "0.48275173", "0.47787303", "0.4668857", "0.4668857", "0.4658506", "0.4607545", "0.46026233", "0.45687926", "0.45522752", "0.45285955", "0.4505046", "0.44999492", "0.4479202", "0.44763657", "0.4...
0.69167006
1
Tests that a custom axis without a mapping and without sources on its extremes does not generate an error during roundtrip. Also tests that during a to_glyphs, to_designspace roundtrip the min and max axis information is not lost.
def test_axis_with_no_mapping_does_not_error_in_roundtrip(ufo_module): doc = designspaceLib.DesignSpaceDocument() # Add a "Regular" source regular = doc.newSourceDescriptor() regular.font = ufo_module.Font() regular.location = {"Style": 0} doc.addSource(regular) axis = doc.newAxisDescripto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_axis_with_no_mapping_does_not_error_in_roundtrip_with_2_axes(ufo_module):\n doc = _make_designspace_with_axes(\n [(\"wght\", \"Weight with mapping\"), (\"wdth\", \"Width without mapping\")], ufo_module\n )\n # Add mapping to weight axis\n doc.axes[0].map = [(0, 0), (50, 350), (100, 1000...
[ "0.6741086", "0.63700724", "0.60149807", "0.59821606", "0.5976643", "0.59512246", "0.59347403", "0.58607495", "0.58135533", "0.5804691", "0.57687473", "0.5730494", "0.56702256", "0.56487083", "0.5643897", "0.5605512", "0.56046045", "0.55329436", "0.55052537", "0.54996556", "0...
0.7079482
0
Tests that a designspace with 2 axis, one with a mapping and one without a mapping, roundtrips correctly without error. The axis without a mapping should generate an identity mapping on the fly so that the Glyphs.app customParameter field does not lose min/max infromation about the axis.
def test_axis_with_no_mapping_does_not_error_in_roundtrip_with_2_axes(ufo_module): doc = _make_designspace_with_axes( [("wght", "Weight with mapping"), ("wdth", "Width without mapping")], ufo_module ) # Add mapping to weight axis doc.axes[0].map = [(0, 0), (50, 350), (100, 1000)] doc2 = dee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_axis_with_no_mapping_does_not_error_in_roundtrip(ufo_module):\n doc = designspaceLib.DesignSpaceDocument()\n\n # Add a \"Regular\" source\n regular = doc.newSourceDescriptor()\n regular.font = ufo_module.Font()\n regular.location = {\"Style\": 0}\n doc.addSource(regular)\n\n axis = do...
[ "0.6810397", "0.5886508", "0.5643056", "0.5603255", "0.54835993", "0.54721045", "0.5446302", "0.5376088", "0.5350451", "0.5329995", "0.5325369", "0.5283556", "0.52822846", "0.52486473", "0.5247364", "0.5243737", "0.52394617", "0.52358276", "0.52293557", "0.5220297", "0.521388...
0.7278305
0
Glyphs 3 introduced a socalled "variable" instance which is a pseudoinstance that holds various VF settings. This messed with the instance_mapping creation as it would overwrite the designLoc of a default instance of an axis back to 0.
def test_variable_instance(ufo_module): source_path = os.path.join("tests", "data", "VariableInstance.glyphs") font = GSFont(source_path) assert len(font.instances) == 28 # Including the VF setting doc = to_designspace(font) assert doc.axes[0].map[2] == (400, 80) assert doc.axes[0].default == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_fvar(font, axes, instances: List[InstanceDescriptor]):\n\n assert axes\n assert isinstance(axes, OrderedDict)\n\n log.info(\"Generating fvar\")\n\n fvar = newTable(\"fvar\")\n nameTable = font[\"name\"]\n\n for a in axes.values():\n axis = Axis()\n axis.axisTag = Tag(a.tag)...
[ "0.6553433", "0.5917079", "0.5742166", "0.56198436", "0.54889625", "0.5462958", "0.54621774", "0.5449796", "0.5375079", "0.5375077", "0.530325", "0.5295575", "0.52705187", "0.5258103", "0.5204888", "0.51782185", "0.5152422", "0.5150765", "0.51438206", "0.51391065", "0.5139057...
0.80153453
0
An NLTK function Gets frequency distribution of all words in a tokenized list We also sort these frequencies in descending order
def get_frequency(processed_text_list): word_frequency = FreqDist(word for word in processed_text_list) sorted_counts = sorted(word_frequency.items() , key = lambda x: x[1] , reverse = True) return sorted_counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeWordsFrequencies(self):\n token_stream = self._tokenize(self.readable)\n token_map = self._countTokens(token_stream)\n # print token_map.items()\n return sorted(token_map.items(), key = lambda x : x[1], reverse = True)", "def word_frequencies(corpus):\n return frequencie...
[ "0.76779157", "0.73156095", "0.7145833", "0.70837116", "0.7030191", "0.7008413", "0.6866585", "0.6865012", "0.68593633", "0.68579507", "0.6846506", "0.6841639", "0.68362874", "0.6827901", "0.6799203", "0.6798519", "0.6783668", "0.67678326", "0.6741677", "0.67347926", "0.67283...
0.7932055
0
Return the actions available to the agent at the state. The action representation is upto the task specification. Returns a list
def actions(self, agent_state): raise NotImplementedError("Don't know what actions are available")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_actions(self):\n return self.actions", "def get_actions(self):\n return self.agent.get_actions()", "def actions(self) -> list:\n if self.debug: print(f\"AState.actions()\")\n if not self._examined:\n if self.debug: print(f\"\\tExamining...\")\n ...
[ "0.80822146", "0.8062952", "0.7993937", "0.799084", "0.7978289", "0.78011256", "0.7752233", "0.77196807", "0.76255643", "0.7568808", "0.75244987", "0.7518797", "0.75011617", "0.7431885", "0.7431885", "0.74023604", "0.7308176", "0.727038", "0.72663873", "0.72566926", "0.719015...
0.80894357
0
Given the desired state and action, create an action message
def create_action_msg(self, action): raise NotImplementedError("Don't know how to translate the action to a msg")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_low_level_action(self, i_state, action):\n pass", "def _createAction(self, item, actionString):\n action = {\n \"action\": actionString,\n \"item_id\": item.item_id\n }\n\n pocketLogger.debug(\"Action\" + str(action))\n\n self.actions.append...
[ "0.65029216", "0.642163", "0.64017195", "0.63986725", "0.6392934", "0.63834316", "0.63461274", "0.63110197", "0.62237453", "0.6194514", "0.61881584", "0.6137856", "0.6132849", "0.6127335", "0.6109601", "0.6091603", "0.6078355", "0.6060754", "0.6048459", "0.6038914", "0.603512...
0.7599728
0
Explicit call to increment the number of timesteps that occurred
def increment_steps(self): self.num_steps += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment(self):\n self._deltas += 1", "def increment_counter(self) -> None:", "def increment_time_step(self):\n for grid in self.get_grid_list():\n try:\n self[grid].increment_time_step()\n except AttributeError:\n pass", "def tick(self):...
[ "0.75099885", "0.7304666", "0.7255583", "0.71396923", "0.7119622", "0.7098083", "0.7093106", "0.70083195", "0.6971343", "0.68312025", "0.6744346", "0.6730654", "0.6708262", "0.67001796", "0.67001796", "0.6629736", "0.6612223", "0.6596166", "0.65689284", "0.6552915", "0.655291...
0.8445815
0
Set the world state
def set_world_state(self, world_state, action): self.world_state = world_state self.action = action
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_world(self):\n self.world_alive = True\n self.world_setable = False", "def world(self, value):\n self.worlds[self.world_index] = value", "def update_world(self):\n pass", "def set_state( self ):", "def set_state(self, state: Any) -> None:\n raise NotImplementedError(\...
[ "0.7429299", "0.7246788", "0.70243907", "0.6625803", "0.647866", "0.6457073", "0.64543515", "0.64229536", "0.6357686", "0.63364655", "0.63113374", "0.6282837", "0.6245218", "0.62417537", "0.6235918", "0.6228587", "0.62264144", "0.6222763", "0.6221341", "0.62172246", "0.619063...
0.79954255
0
Given a world state, returns the agent's observation model. By default the agent has access to the complete world state
def get_agent_state(self): return self.world_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_obs(self):\n # return np.concatenate((self.world.state[:6], self.world.state[7:13]))\n return np.concatenate((self.world.state, np.zeros(7)))\n # return self.world.state", "def get_observation(world_state,weather,time_now):\n obs = np.zeros((2, OBS_SIZE, OBS_SIZE))\n object_li...
[ "0.6433146", "0.62845165", "0.6092617", "0.5913347", "0.58923274", "0.58671933", "0.5793312", "0.5788415", "0.57711667", "0.57316136", "0.57107484", "0.56854695", "0.56197894", "0.5549037", "0.55431503", "0.55347174", "0.5503566", "0.54819864", "0.5470213", "0.5451508", "0.54...
0.6532894
0
Create the data structure to save the task
def _save(self): raise NotImplementedError("Don't know how to save the task")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_task():", "def generate_tasks(self, task):", "def make_save(self):\n\t\tsave = {}\n\t\tsave['p'] = self.p\n\t\tsave['injail'] = self.injail.copy()\n\t\tsave['tile'] = self.tile.copy()\n\t\tsave['bal'] = self.bal.copy()\n\t\tsave['goojf'] = self.goojf.copy()\n\t\tsave['isalive'] = self.isalive.copy()...
[ "0.67924315", "0.65425", "0.652313", "0.6397578", "0.6379625", "0.6369474", "0.6355105", "0.6344151", "0.6308834", "0.6289811", "0.6195527", "0.61949176", "0.61514395", "0.6129603", "0.6129044", "0.61009836", "0.6026523", "0.6016444", "0.60064936", "0.5986836", "0.59778374", ...
0.66189206
1
Load the task from the data dictionary
def _load(self, data): raise NotImplementedError("Don't know how to load the task")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_dict(self, kwargs):\n # TaskInfo always needs a description and task_type, but all other\n # supported (optional) parameters are loaded from kwargs to\n keyword_args = dict(kwargs)\n task_id = TaskInfo._dpop(keyword_args, \"id\")\n if task_id is not None:\n s...
[ "0.6894152", "0.68634784", "0.67587066", "0.67548025", "0.6582195", "0.6552855", "0.65317833", "0.6389541", "0.6385041", "0.6374283", "0.632729", "0.63198704", "0.6310949", "0.6292082", "0.6270582", "0.6261923", "0.62304664", "0.62278163", "0.6208512", "0.620306", "0.6188854"...
0.839734
0
Failure condition if any of the objects is lost
def _is_fail(self): failed = False for obj in self.world_state.objects: failed = failed or obj.lost return failed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lost(self):\r\n return None", "def test_data_object_del_all(self):\n pass", "def reject(self):\n self.new_rom = None\n self.new_reductor = None", "def __exit__(self, exc_type, exc_val, exc_tb):\n self.delete()\n if exc_type:\n return False\...
[ "0.6590283", "0.6133852", "0.5932318", "0.59298193", "0.5891115", "0.58692384", "0.5850308", "0.58211994", "0.5807659", "0.57847774", "0.5715833", "0.5684817", "0.56463337", "0.56376064", "0.5617179", "0.5617179", "0.5617179", "0.56154984", "0.5613748", "0.5602049", "0.560128...
0.6886242
0
Signs into Email and returns imap object
def email_startup(): imap = imaplib.IMAP4_SSL('imap.gmail.com') # authenticate imap.login(email_credentials.email_user, email_credentials.email_pass) return imap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mail() -> imaplib.IMAP4_SSL:\n mail = imaplib.IMAP4_SSL(config['mail']['imap'])\n mail.login(USER_MAIL, PASS_MAIL)\n mail.list()\n mail.select('inbox')\n return mail", "def login(self):\n self.IMAP = imaplib.IMAP4_SSL(self.mailconfig.IMAPHost, 993, ssl_context=ssl.create_default_con...
[ "0.6071403", "0.5906617", "0.56876385", "0.56174904", "0.55747813", "0.54144245", "0.5320152", "0.53145826", "0.51558757", "0.5139861", "0.5137904", "0.5127193", "0.5107942", "0.5104838", "0.51033807", "0.50951505", "0.5094071", "0.50889444", "0.50601846", "0.5053714", "0.503...
0.68906516
0
Returns current unread count
def get_unread_count(imap): status, messages = imap.select('Inbox') status, response = imap.uid('search', None, 'UNSEEN') unread_msg_nums = response[0].split() return len(unread_msg_nums)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unread_count(self) -> dict[str, int]:\n return self.subreddit._reddit.get(API_PATH[\"modmail_unread_count\"])", "def inbox_count_for(user):\n return Message.inbox.for_user(user).unread().count()", "def get_unread_count(username, password):\n obj = imaplib.IMAP4_SSL('imap.gmail.com', '993')\n ...
[ "0.7879572", "0.77617085", "0.7675302", "0.7408627", "0.72338617", "0.7100542", "0.707241", "0.6982085", "0.6980177", "0.6980177", "0.6965017", "0.6919026", "0.69053316", "0.6899091", "0.68954474", "0.68706244", "0.68266624", "0.68144584", "0.68018526", "0.67775595", "0.67583...
0.78147435
1