query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Reshapes a rank 2 tensor back to its original rank >= 2 tensor.
def reshape_from_matrix(output_tensor, orig_shape_list): if len(orig_shape_list) == 2: return output_tensor output_shape = get_shape_list(output_tensor) orig_dims = orig_shape_list[0:-1] width = output_shape[-1] return tf.reshape(output_tensor, orig_dims + [width])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reshape_from_matrix(output_tensor, orig_shape_list):\n \"\"\"把rank为2的tensor变回rank >= 2的tensor\"\"\"\n if len(orig_shape_list) == 2:\n return output_tensor\n\n output_shape = get_shape_list(output_tensor)\n\n orig_dims = orig_shape_list[0:-1]\n width = output_shape[-1]\n\n return tf.reshape(output_tens...
[ "0.7410044", "0.725626", "0.6899436", "0.6862811", "0.66999114", "0.6680788", "0.66638684", "0.66573614", "0.66116285", "0.6584382", "0.65419245", "0.65072364", "0.6502149", "0.64449567", "0.641807", "0.6350139", "0.6346788", "0.6298768", "0.62649465", "0.6215438", "0.6208489...
0.6648785
9
Returns a payment URI from the currency, address, and satoshis.
def payment_uri(currency, address, satoshis): amount = "{0:.8f}".format(satoshis * 0.00000001) if currency == 'btc': uri = 'bitcoin:{}?amount={}'.format(address, amount) elif currency == 'bch': # Add support for legacy address format and new cashaddr format. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_payment_url(tx, amount, currency):\n # TODO - don't hard code OK_Receiver\n # TODO - don't hard code price or currencies\n return 'https://checkout.okpay.com/?' \\\n 'ok_receiver=OK882706663&' \\\n 'ok_item_1_name={}&' \\\n 'ok_currency=US...
[ "0.651629", "0.59377617", "0.5358372", "0.53351295", "0.5227871", "0.5166012", "0.51242", "0.51224154", "0.5067633", "0.50294805", "0.500631", "0.49580115", "0.49015334", "0.4895954", "0.4895954", "0.4895954", "0.4895954", "0.4895954", "0.4895954", "0.4895954", "0.4895954", ...
0.8577233
0
Human readable time remaining. Needs work. This is weird.
def ttl(end_of_life): current_time = int(time()) if current_time > end_of_life: dead_time = current_time - end_of_life output = 'terminated for {} seconds'.format(dead_time) else: time_to_live = end_of_life - current_time output = '{} seconds till termination'.format(time_to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_remaining_str(self):\n return time_string(self.time_remaining())", "def calculate_remaining_time():\n time_taken = time.time() - startTime\n remaining_time = int(round(gameLength - time_taken))\n return time.strftime(\"%M:%S\", time.gmtime(remaining_time))", "def time_remaining(time):\...
[ "0.79743797", "0.7552201", "0.74885315", "0.7360054", "0.7349796", "0.7264648", "0.7186943", "0.71834093", "0.7181691", "0.7081801", "0.7075434", "0.6914013", "0.6844877", "0.68346816", "0.6819367", "0.6716785", "0.670913", "0.66632986", "0.66517", "0.66321486", "0.6600057", ...
0.0
-1
Helps you write sporestack.json files.
def sporestackfile_helper(days, osid, startupscript=None, cloudinit=None, name=None, human_name=None, description=None, postlaunch=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n print(\"saving json file:\", self.json_path)\n with open(self.json_path, 'w') as outfile:\n outfile.write( json.dumps(self.json_data, indent=2) )", "def export_json_file_sample():\n content = json.dumps({\"sites\": [ json.loads(InventorySite.sample_json()) ],\n ...
[ "0.6474826", "0.6248367", "0.62317735", "0.6202266", "0.61771905", "0.6137133", "0.61284786", "0.6109169", "0.6083715", "0.607689", "0.6071326", "0.6043262", "0.6017446", "0.6000421", "0.59855115", "0.5942245", "0.5936577", "0.59243953", "0.59144074", "0.59135807", "0.5908484...
0.0
-1
rotate an image while keeping its center and size
def rot_center(self, image, angle): orig_rect = image.get_rect() rot_image = pygame.transform.rotate(image, angle) rot_rect = orig_rect.copy() rot_rect.center = rot_image.get_rect().center rot_image = rot_image.subsurface(rot_rect).copy() return rot_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate(img, angle, resample=False, expand=False, center=None):\n \n return img.rotate(angle, resample, expand, center)", "def rotate(self):\n\t\tlast_center = self.rect.center\n\t\tself.image = pg.transform.rotate(self.image_copy, self.angle)\n\t\tself.rect = self.image.get_rect() #...
[ "0.81452334", "0.7805273", "0.7710145", "0.76269615", "0.757972", "0.7482823", "0.7466026", "0.7434072", "0.7416224", "0.7411056", "0.7391068", "0.7391068", "0.736141", "0.736141", "0.73487955", "0.73358566", "0.73342544", "0.7307618", "0.72054905", "0.7154155", "0.7125723", ...
0.7427269
9
rotate an image while keeping its center and size
def rot_center(self, image, angle): orig_rect = image.get_rect() rot_image = pygame.transform.rotate(image, angle) rot_rect = orig_rect.copy() rot_rect.center = rot_image.get_rect().center rot_image = rot_image.subsurface(rot_rect).copy() return rot_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate(img, angle, resample=False, expand=False, center=None):\n \n return img.rotate(angle, resample, expand, center)", "def rotate(self):\n\t\tlast_center = self.rect.center\n\t\tself.image = pg.transform.rotate(self.image_copy, self.angle)\n\t\tself.rect = self.image.get_rect() #...
[ "0.81452334", "0.7805273", "0.7710145", "0.76269615", "0.757972", "0.7482823", "0.7466026", "0.7434072", "0.7416224", "0.7411056", "0.7391068", "0.7391068", "0.736141", "0.736141", "0.73487955", "0.73358566", "0.73342544", "0.7307618", "0.72054905", "0.7154155", "0.7125723", ...
0.7427269
8
Reads the table with the help of the data_manager module. Returns the name (str) of the customer with the given id (str) on None om case of nonexisting id.
def get_name_by_id(id): get_name_by_id_from_table(table, id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCustomerById(self, id):\n try:\n return self.customers[id]\n except KeyError:\n return None", "def retrieve(self, id):\n _, _, customer = self.http_client.get(\"/customers/{id}\".format(id=id))\n return customer", "def get_customer(self, customer_id):\n ...
[ "0.69935715", "0.667937", "0.66131884", "0.6394586", "0.6049137", "0.6027676", "0.5872261", "0.5804906", "0.578236", "0.5695143", "0.5622362", "0.5601036", "0.55780923", "0.5574489", "0.5525405", "0.55064607", "0.548788", "0.5477495", "0.54704213", "0.54469335", "0.54440564",...
0.6141459
4
Make a dictionary containing the ISO 3166 twoletter code as the key and the country name as the value. The data is read from a csv file.
def make_country_dict( csv_file:str = 'data/country_list.csv') -> Dict[str, str]: country_dict = {} with open(csv_file, encoding='utf-8') as country_csv: for line in country_csv: key, value = line.strip().split(',') country_dict[key] = value return country_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_country_codes():\n variables = pd.read_excel('data/F00011221-WVS-7_Variables_Report_Annex.xlsx')\n country = variables['Country/ territory']\n country.index = variables['ISO 3166-1 numeric code']\n return country #.to_dict()['Country/ territory']", "def map_country_gnp(arr_included_gnp_info: ...
[ "0.71528035", "0.6546949", "0.6520813", "0.6477254", "0.6463445", "0.64495456", "0.64329034", "0.6397807", "0.6328419", "0.6320556", "0.61916125", "0.6147822", "0.614592", "0.6104729", "0.60559475", "0.6053797", "0.6046395", "0.6025432", "0.5994286", "0.5993997", "0.5969961",...
0.76389414
0
Builds the pandas bean.
def _build_pandas_bean(training_set_attributes, training_set_classes, test_set_attributes, test_set_classes): return PandasBean(training_set_attributes, training_set_classes, test_set_attributes, test_set_classes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_df(\n self,\n *args,\n **kwargs,\n ) -> pd:\n pass", "def __init__(self):\n self.df = pd.DataFrame()", "def _hpat_pandas_dataframe_init_codegen(context, builder, signature, args):\n\n [data_val] = args\n\n dataframe = cgutils.create_struct_proxy(...
[ "0.67157024", "0.636385", "0.6358645", "0.60239655", "0.5940037", "0.5881766", "0.5874976", "0.5814375", "0.5812497", "0.5744956", "0.57387376", "0.5719662", "0.5711387", "0.5699496", "0.56773585", "0.56727093", "0.56665605", "0.5658781", "0.56570935", "0.5641768", "0.5580849...
0.80426764
0
Grace period before failover with data loss is attempted for the readwrite endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required.
def failover_with_data_loss_grace_period_minutes(self) -> Optional[int]: return pulumi.get(self, "failover_with_data_loss_grace_period_minutes")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n failover_policy: str,\n failover_with_data_loss_grace_period_minutes: Optional[int] = None):\n pulumi.set(__self__, \"failover_policy\", failover_policy)\n if failover_with_data_loss_grace_period_minutes is not None:\n pulumi.set(...
[ "0.6448174", "0.5625113", "0.56228554", "0.54772127", "0.5220702", "0.5171336", "0.50821227", "0.5068651", "0.49262348", "0.49164265", "0.47911307", "0.47650045", "0.47622326", "0.47166073", "0.47029525", "0.47029525", "0.46806479", "0.46737415", "0.46620855", "0.4660981", "0...
0.7579977
0
Resource identifier of the partner server.
def id(self) -> str: return pulumi.get(self, "id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server_id(self):\r\n return self.server_id", "def get_id(self):\n return self._server_id", "def partnerid(self):\n return self._partnerid", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", "def resource_id(self) -> str:\n return pulumi.g...
[ "0.7459616", "0.73316276", "0.7310642", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.68803895", "0.6859945", "0.6849022", "0.67182195", "0.6696361", "0.6654466", "0.6627352", "0.65504086", "0.65504086", "0.65504086", "0.65504086", "0.65504086", "0....
0.0
-1
Gets the duration of time interval for the value given by this MetricInfo. e.g., PT1H (1 hour)
def time_grain(self) -> str: return pulumi.get(self, "time_grain")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration(self) -> float:\n return self.path_interval[1] - self.path_interval[0]", "def get_duration(self):\n return self.get_end_time() - self.get_start_time()", "def get_duration(self):\n duration = self.duration_range.upper - self.duration_range.lower\n return self._get_timede...
[ "0.71866614", "0.7022115", "0.69603145", "0.69186497", "0.6914742", "0.6914742", "0.6899248", "0.68774015", "0.6871144", "0.6750798", "0.6731747", "0.6708316", "0.66844606", "0.667483", "0.66687083", "0.666448", "0.6662105", "0.6658946", "0.66300035", "0.66269726", "0.6599685...
0.0
-1
Gets the unit in which metric is measured. e.g., DTU, Frequency
def unit(self) -> str: return pulumi.get(self, "unit")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_of_measurement(self):\n return SENSORS[self.info_type][\"unit\"]", "def unit_of_measurement(self):\n return self._def[ATTR_UNIT]", "def unit_of_measurement(self):\n\t\treturn self._unit_of_measurement", "def unit_of_measurement(self):\n return SENSOR_NAMES[self.sensor_name][0]",...
[ "0.8564193", "0.8557896", "0.8380386", "0.8353222", "0.8336918", "0.83218694", "0.83218694", "0.83218694", "0.83093727", "0.83093727", "0.8290722", "0.8288169", "0.8287997", "0.82665616", "0.82385683", "0.82182646", "0.82182646", "0.82182646", "0.82182646", "0.82182646", "0.8...
0.78552604
49
Gets additional details specific to this recommended action.
def details(self) -> Mapping[str, Any]: return pulumi.get(self, "details")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_details(self):\n return self.details", "def get_details(self):\n return self.details", "def extra_info(self):\n return self._extra_info", "def error_details(self) -> 'outputs.RecommendedActionErrorInfoResponse':\n return pulumi.get(self, \"error_details\")", "def retriev...
[ "0.6596309", "0.6596309", "0.64981246", "0.6413351", "0.62999505", "0.61742836", "0.6169865", "0.6112279", "0.6112279", "0.60489297", "0.60024613", "0.5950476", "0.59346056", "0.5883686", "0.5805111", "0.5803376", "0.575997", "0.57511604", "0.57336444", "0.57195824", "0.57030...
0.6355222
4
Gets the time when system started applying this recommended action on the user resource. e.g., index creation start time
def execute_action_start_time(self) -> str: return pulumi.get(self, "execute_action_start_time")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_action_initiated_time(self) -> str:\n return pulumi.get(self, \"execute_action_initiated_time\")", "def attempt_start_time(self):\n return self._attempt_start_time", "def getStartTime(self) -> int:\n ...", "def revert_action_start_time(self) -> str:\n return pulumi.get...
[ "0.73668844", "0.69241387", "0.6825304", "0.673357", "0.66422486", "0.6631791", "0.6631791", "0.6631791", "0.66309994", "0.66242415", "0.65787023", "0.6567132", "0.6567132", "0.6567132", "0.6567132", "0.6567132", "0.6567132", "0.6567132", "0.6567132", "0.6567132", "0.6567132"...
0.7542619
0
Gets the implementation details of this recommended action for user to apply it manually.
def implementation_details(self) -> 'outputs.RecommendedActionImplementationInfoResponse': return pulumi.get(self, "implementation_details")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action(self):\n pass", "def action_spec(self):\n raise NotImplementedError", "def action_spec(self):\n return self._action_spec", "def get_action(self):\n return self.action", "def action(self):\n\t\treturn self._action", "def get_action(self) -> CommandResponse:\n ...
[ "0.6533912", "0.6380123", "0.63214844", "0.61877185", "0.6061423", "0.59674746", "0.5942632", "0.59385484", "0.5921252", "0.5921252", "0.5921252", "0.59139663", "0.583249", "0.5767143", "0.5758103", "0.5755396", "0.5718841", "0.57106024", "0.5696752", "0.565749", "0.5646952",...
0.7126441
0
Gets if this recommended action was suggested some time ago but user chose to ignore this and system added a new recommended action again.
def is_archived_action(self) -> bool: return pulumi.get(self, "is_archived_action")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_acting_last_preflop(self):\n return self.street == 0 and self.action == self.big_blind_player", "def decide(self):\n last_query_time = self._logger.get_last_query_time()\n last_interaction_time = self._logger.get_last_interaction_time()\n \n difference = last_interaction...
[ "0.6094389", "0.60065204", "0.575704", "0.5751754", "0.5651586", "0.5630911", "0.5573176", "0.55670995", "0.54961914", "0.54824364", "0.54815227", "0.547528", "0.5472187", "0.5422048", "0.54187065", "0.5416016", "0.5382188", "0.5371865", "0.5322675", "0.5322011", "0.53110814"...
0.0
-1
Gets the reason for recommending this action. e.g., DuplicateIndex
def recommendation_reason(self) -> str: return pulumi.get(self, "recommendation_reason")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reason(op_idx, details):\n\n return '%d %s'%(op_idx, details)", "def getReason(self):\n return self.message", "def reason(self):\n return \"Because I need \" + _word() + _word() + _word() + \".\"", "def reason(self):\n return self._reason", "def reason(self):\n return sel...
[ "0.6551647", "0.6417278", "0.64017135", "0.62974745", "0.62974745", "0.6280518", "0.6176783", "0.6176783", "0.61081004", "0.60839576", "0.60676664", "0.60676664", "0.60676664", "0.60676664", "0.6025495", "0.5896792", "0.57696223", "0.57484645", "0.57450694", "0.57450694", "0....
0.67920476
0
Gets the time taken for reverting changes of this recommended action on user resource. e.g., time taken for dropping the created index.
def revert_action_duration(self) -> str: return pulumi.get(self, "revert_action_duration")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revert_action_initiated_time(self) -> str:\n return pulumi.get(self, \"revert_action_initiated_time\")", "def revert_action_start_time(self) -> str:\n return pulumi.get(self, \"revert_action_start_time\")", "def timetaken(self):\n return self.runtime", "def time_taken(self) -> str:\n...
[ "0.6521328", "0.6183411", "0.61025494", "0.6005744", "0.6005744", "0.5975702", "0.5941009", "0.5840147", "0.5840147", "0.5840147", "0.58351874", "0.58263004", "0.5824069", "0.5808868", "0.5801944", "0.5792818", "0.57841855", "0.57777923", "0.5760284", "0.5758923", "0.57503057...
0.6762817
0
Gets the time when system started reverting changes of this recommended action on user resource. e.g., time when index drop is executed.
def revert_action_start_time(self) -> str: return pulumi.get(self, "revert_action_start_time")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revert_action_initiated_time(self) -> str:\n return pulumi.get(self, \"revert_action_initiated_time\")", "def refreshtime(self):\n return self._shells[0].refreshtime", "def _get_restart_time(self):\n return self.__restart_time", "def _get_restart_time(self):\n return self.__restart_ti...
[ "0.77013195", "0.6864716", "0.68407446", "0.68407446", "0.68407446", "0.68407446", "0.68407446", "0.68407446", "0.68407446", "0.68407446", "0.6683707", "0.65953445", "0.65913254", "0.65827197", "0.65733504", "0.65733504", "0.65733504", "0.65733504", "0.65733504", "0.6570419", ...
0.7534794
1
Gets the time since when this recommended action is valid.
def valid_since(self) -> str: return pulumi.get(self, "valid_since")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_since(self):\n\n\t\ttime_now = time.time()\n\t\treturn time_now - self.last_update", "def time_until_reminder(self) -> timedelta:\n return self.team_reminder_time - datetime.now()", "def next_scheduled_check_time(self) -> datetime.datetime:\n return self._next_scheduled_check_time", ...
[ "0.74717206", "0.68999726", "0.6849419", "0.681678", "0.6778853", "0.67220455", "0.67109376", "0.6710477", "0.67031854", "0.6691637", "0.66873556", "0.6686262", "0.6680484", "0.66609377", "0.66609377", "0.66609377", "0.6653108", "0.6652377", "0.66379654", "0.66354835", "0.661...
0.6759615
5
Contains information of current state for an Azure SQL Database, Server or Elastic Pool Recommended Action.
def __init__(__self__, *, action_initiated_by: str, current_value: str, last_modified: str): pulumi.set(__self__, "action_initiated_by", action_initiated_by) pulumi.set(__self__, "current_value", current_value) pulumi.set(__self__, "last_modifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self) -> 'outputs.RecommendedActionStateInfoResponse':\n return pulumi.get(self, \"state\")", "def sh_get_state_info(self):\n self.state_lock.acquire()\n acknowledged_state = self.sh_acknowledged_state\n last_classified_state = self.sh_last_classified_state\n last_cla...
[ "0.6884723", "0.63453454", "0.6185674", "0.6128811", "0.61273307", "0.6112102", "0.6112102", "0.6112102", "0.6112102", "0.6112102", "0.60932654", "0.5993424", "0.5964892", "0.5928522", "0.58891386", "0.58398426", "0.5802955", "0.5784465", "0.57828337", "0.57828337", "0.577026...
0.0
-1
Azure Active Directory identity configuration for a resource.
def __init__(__self__, *, principal_id: str, tenant_id: str, type: Optional[str] = None): pulumi.set(__self__, "principal_id", principal_id) pulumi.set(__self__, "tenant_id", tenant_id) if type is not None: pulumi.set(__self__, "type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def azure_resource_id(self) -> str:\n return pulumi.get(self, \"azure_resource_id\")", "def azure_resource_id(self) -> str:\n return pulumi.get(self, \"azure_resource_id\")", "def azure_resource_id(self) -> str:\n return pulumi.get(self, \"azure_resource_id\")", "def __init__(__self__,\n...
[ "0.5906325", "0.5906325", "0.5906325", "0.5663156", "0.5583298", "0.55084896", "0.5455127", "0.54526126", "0.54032135", "0.5376528", "0.5376528", "0.5360936", "0.53578573", "0.5324419", "0.5324419", "0.53195393", "0.530327", "0.5246745", "0.52113485", "0.52113485", "0.5192616...
0.0
-1
The Azure Active Directory tenant id.
def tenant_id(self) -> str: return pulumi.get(self, "tenant_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tenant_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"tenant_id\")", "def tenant_id(self) -> Optional[str]:\n return pulumi.get(self, \"tenant_id\")", "def tenant_id(self) -> Optional[str]:\n return pulumi.get(self, \"tenant_id\")", "def tenant_id(self) -> Optional[str]:...
[ "0.83111495", "0.8308715", "0.8308715", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308348", "0.8308212", "0.8307917", "0.82023656", "0.80933934", "0.80933934",...
0.86301285
12
The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource.
def type(self) -> Optional[str]: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n identity_type: Optional[pulumi.Input['CmkIdentityType']] = None,\n user_assigned_identity_resource_id: Optional[pulumi.Input[str]] = None):\n if identity_type is not None:\n pulumi.set(__self__, \"identity_type\", identity_type)\n ...
[ "0.67384225", "0.65714955", "0.6512898", "0.6499116", "0.6363137", "0.63440454", "0.6315517", "0.6252317", "0.6168515", "0.6134836", "0.6101683", "0.6101683", "0.609175", "0.6047436", "0.6026452", "0.599862", "0.593369", "0.593369", "0.5871807", "0.58453363", "0.58453363", ...
0.0
-1
An ARM Resource SKU.
def __init__(__self__, *, name: str, capacity: Optional[int] = None, family: Optional[str] = None, size: Optional[str] = None, tier: Optional[str] = None): pulumi.set(__self__, "name", name) if capacity is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sku(self) -> str:\n return pulumi.get(self, \"sku\")", "def sku(self) -> 'outputs.SkuResponse':\n return pulumi.get(self, \"sku\")", "def sku(self) -> Optional[str]:\n return pulumi.get(self, \"sku\")", "def sku(self) -> 'outputs.AppSkuInfoResponse':\n return pulumi.get(self, ...
[ "0.7754831", "0.7433131", "0.7425371", "0.7365058", "0.7249128", "0.7226592", "0.7225675", "0.72015244", "0.72015244", "0.72015244", "0.71966136", "0.71520746", "0.71520746", "0.7148787", "0.7148787", "0.71119463", "0.71025455", "0.70083827", "0.69252825", "0.68177664", "0.67...
0.0
-1
The tier or edition of the particular SKU, e.g. Basic, Premium.
def tier(self) -> Optional[str]: return pulumi.get(self, "tier")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tier(self) -> str:\n return pulumi.get(self, \"tier\")", "def tier(self) -> str:\n return pulumi.get(self, \"tier\")", "def tier(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"tier\")", "def tier(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"tier\...
[ "0.7626565", "0.7626565", "0.7205846", "0.71946335", "0.71946335", "0.71946335", "0.70142233", "0.70052004", "0.69222754", "0.6840509", "0.6836915", "0.6836915", "0.67667466", "0.67657375", "0.67416894", "0.6618303", "0.6594965", "0.6581822", "0.65659875", "0.65659875", "0.65...
0.75153285
4
Name of master sync member where the schema is from.
def master_sync_member_name(self) -> Optional[str]: return pulumi.get(self, "master_sync_member_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"member_name\")", "def member_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"member_name\")", "def name(self) -> str:\n return self.jid.localpart", "def name(self):\n return self.jid.localpart", ...
[ "0.6540329", "0.63086694", "0.6238972", "0.6218133", "0.62087405", "0.6108052", "0.60895944", "0.60686797", "0.6039594", "0.59960955", "0.5975998", "0.5975998", "0.5975998", "0.5975998", "0.5975998", "0.5975998", "0.5975998", "0.5975998", "0.5975998", "0.5975998", "0.5975998"...
0.872962
0
Data size of the column.
def data_size(self) -> Optional[str]: return pulumi.get(self, "data_size")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size_of_data(self):\n return self.size_of_data", "def calculated_data_size(self):\n return self.size()", "def get_data_size(self) -> int:\n return 5", "def size(self):\n return _pythia8.ColConfig_size(self)", "def numColumns(self):\r\n return self.__data.numColumn...
[ "0.8058878", "0.80150574", "0.79721403", "0.7935222", "0.7845865", "0.78209335", "0.7799793", "0.7641753", "0.75848097", "0.744863", "0.7405284", "0.7388435", "0.7388435", "0.7382289", "0.73534757", "0.73457545", "0.7330589", "0.7301851", "0.7299579", "0.7258331", "0.72295165...
0.7552453
9
Quoted name of sync group schema table.
def quoted_name(self) -> Optional[str]: return pulumi.get(self, "quoted_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fullname(self, table_name, cls):\n return f\"{DATA_QUALITY_SCHEMA}.{cls._table_prefix}_{table_name}\"", "def table_name(table):\n return '%s_%s' % (TABLE_SPACE, table)", "def table_name(cls) -> str:\n return cls.TABLE", "def table_name(self) -> str:\n return pulumi.get(self, \"tab...
[ "0.6621958", "0.6558709", "0.6557928", "0.652795", "0.6291203", "0.62106687", "0.61393255", "0.6104213", "0.60340744", "0.60340744", "0.5999187", "0.598256", "0.598256", "0.5969863", "0.5947881", "0.59066874", "0.589815", "0.5870311", "0.58592963", "0.5808762", "0.57950413", ...
0.5288921
57
Gets the StripeCustomerModel object for `customer_id` if available
def get_stripe_customer_model_instance(customer_id, live_mode=False): StripeCustomerModel = get_stripe_customer_model() try: customer = StripeCustomerModel.objects.get( stripe_id=customer_id, live_mode=live_mode ) except StripeCustomerModel.DoesNotExist: custo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCustomerById(self, id):\n try:\n return self.customers[id]\n except KeyError:\n return None", "def get_customer(self, customer_id):\n results, ok = self.get(self.url, 'customers/' + str(customer_id))\n\n return Marshal.desk_customer(results), ok", "def r...
[ "0.7903432", "0.7684271", "0.74901026", "0.71379155", "0.69046783", "0.6848603", "0.6821411", "0.6575835", "0.6485113", "0.6464373", "0.64314765", "0.6394316", "0.6348107", "0.62992394", "0.62866634", "0.62290496", "0.61767167", "0.6121727", "0.60732687", "0.6068556", "0.6047...
0.8414947
0
Retrieve the Stripe event by `event_id` Succeeds when `live_mode==True` and there a corresponding `event_id` Fails when event was generated from the Stripe dashboard webhook test
def retrieve_event(event_id, live_mode=False): _initialize_stripe(live_mode=live_mode) event = safe_stripe_call( stripe.Event.retrieve, *( event_id, ) ) return event
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_a_event(self, event_id):\n event = WhiteboardModel.get_one_event(event_id)\n if not event:\n log.info(\"No Events found for this event id --> {}\".format(event_id))\n return self.custom_response({'error': 'Event not found'}, 404)\n \n ser_event = whiteboard_schem...
[ "0.70966744", "0.6796641", "0.67452765", "0.6635314", "0.6359125", "0.6346297", "0.6338374", "0.61692816", "0.6160219", "0.61571544", "0.61548024", "0.6129047", "0.61020905", "0.60871893", "0.6064503", "0.60608256", "0.60604656", "0.6035565", "0.5923843", "0.5831937", "0.5807...
0.8290432
0
Create a second y axis for viscosity factor.
def get_yaxis_viscosity(ax): ax2 = ax.twinx() ax2.set_xlim(ax.get_xlim()) ax2.set_ylim(yranges['ViscosityFactor']) ax2.set_ylabel(ylabels['ViscosityFactor']) ax2.spines['right'].set_color('purple') ax2.yaxis.label.set_color('purple') ax2.tick_params(axis='y', colors='purple') return a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secondary_y_axis(self):\n return SecondaryYAxis(self._target)", "def get_yaxis_sfr(ax):\n ax2 = ax.twinx()\n\n ax2.set_xlim(ax.get_xlim())\n ax2.set_ylim(yranges['StarFormationRate'])\n ax2.set_ylabel(ylabels['StarFormationRate'])\n\n ax2.spines['right'].set_color('grey')\n ax2.yaxis...
[ "0.6596293", "0.6425779", "0.63741297", "0.61770993", "0.6163866", "0.60960674", "0.6092364", "0.59984815", "0.59684813", "0.59470654", "0.5911957", "0.58068734", "0.58027995", "0.57876456", "0.5774722", "0.57326573", "0.5728291", "0.57179075", "0.5686149", "0.5679545", "0.56...
0.8143797
0
Iterates through seq by returning windows of length 2n+1
def window_iterator(seq, n=1, beg="<s>", end="</s>"): for i in range(len(seq)): l = max(0, i-n) r = min(len(seq), i+n+1) ret = seq[l:r] if i < n: ret = [beg,] * (n-i) + ret if i+n+1 > len(seq): ret = ret + [end,] * (i+n+1 - len(seq)) yield ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _window(seq, n=2):\n it = iter(seq)\n result = tuple(islice(it, n))\n if len(result) == n:\n yield result\n for elem in it:\n result = result[1:] + (elem,)\n yield result", "def window(seq, n):\n it = iter(seq)\n result = tuple(islice(it, n))\n if len(result) == n:\n...
[ "0.8251473", "0.80747163", "0.8026509", "0.7745392", "0.76477677", "0.727583", "0.7197411", "0.70955616", "0.70757407", "0.7030543", "0.6977182", "0.69475794", "0.6946507", "0.6921227", "0.6837051", "0.682976", "0.677904", "0.6723889", "0.6709256", "0.66835225", "0.66470534",...
0.7513544
5
Create a onehot vector with a 1 in position
def one_hot(n, y): if isinstance(y, int): ret = np.zeros(n) ret[y] = 1.0 return ret elif isinstance(y, list): ret = np.zeros((len(y), n)) ret[np.arange(len(y)),y] = 1.0 return ret else: raise ValueError("Expected an int or list got: " + y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot(y, n):\n vector = np.zeros(n)\n if n == 2:\n y = int((y + 2) / 2)\n vector[y] = 1\n return vector", "def one_hot(length, index):\n result = np.zeros(length)\n result[index] = 1\n return result", "def one_hot(self, label):\n m = label.shape[0]\n label_onehot = [[1 ...
[ "0.86672133", "0.8641135", "0.85028416", "0.8492486", "0.8429672", "0.8424684", "0.842259", "0.8406647", "0.83957815", "0.8365757", "0.8256016", "0.8245857", "0.823287", "0.8228287", "0.820511", "0.8183584", "0.8175473", "0.8175473", "0.8167927", "0.81595516", "0.81453735", ...
0.8114993
23
Uses the input sequences in to construct new windowed data points.
def featurize_windows(data, start, end, window_size = 1): ret = [] for sentence, labels in data: sentence_ = [] for window in window_iterator(sentence, window_size, beg=start, end=end): sentence_.append(sum(window, [])) ret.append((sentence_, labels)) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sliding_windows(data, seq_length, future=1):\n x = []\n y = []\n\n for i in range(len(data)-seq_length-future):\n tx = data[i:(i+seq_length)]\n ty = data[i+seq_length+future-1]\n x.append(tx)\n y.append(ty)\n\n return np.array(x),np.array(y)", "def create_windows(baml...
[ "0.67023975", "0.64113", "0.630801", "0.60869473", "0.60410005", "0.60164666", "0.58748", "0.58548445", "0.58263516", "0.57668144", "0.5748552", "0.5720017", "0.570775", "0.5705511", "0.57007366", "0.5684396", "0.5679928", "0.5664554", "0.5650029", "0.5580477", "0.5576247", ...
0.5527687
26
Ensures each inputoutput seqeunce pair in is of length by padding it with zeros and truncating the rest of the sequence.
def pad_sequences(data, max_length, zero_vector, zero_label): ret = [] for sentence, labels in data: ### YOUR CODE HERE ### sentence_ = sentence[:max_length] + [zero_vector] * max(0, max_length - len(sentence)) labels_ = labels[:max_length] + [zero_label] * max(0, max_length - len(label...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_sequence(sequence, max_sequence_length):\n\n sequence = np.array(sequence, dtype=np.int32)\n difference = max_sequence_length - sequence.shape[0]\n pad = np.zeros((difference,), dtype=np.int32)\n return np.concatenate((sequence, pad))", "def _pad_to_length(self, sequence, path):\n left...
[ "0.6815173", "0.66534674", "0.66303873", "0.6597739", "0.6573024", "0.6532731", "0.6528182", "0.652176", "0.64644575", "0.6429765", "0.64198625", "0.63271976", "0.6326598", "0.6293092", "0.6272344", "0.6255931", "0.62079334", "0.61968476", "0.6173299", "0.61530155", "0.614564...
0.61895174
18
Test setup with a server with token auth disabled.
async def test_tokenless_server(entry, setup_plex_server) -> None: TOKENLESS_DATA = copy.deepcopy(DEFAULT_DATA) TOKENLESS_DATA[const.PLEX_SERVER_CONFIG].pop(CONF_TOKEN, None) entry.data = TOKENLESS_DATA await setup_plex_server(config_entry=entry) assert entry.state is ConfigEntryState.LOADED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_token_auth(self):\n s = self.build_session()\n s.token_auth(\"token goes here\")\n req = requests.Request(\"GET\", \"https://api.github.com/\")\n pr = s.prepare_request(req)\n assert pr.headers[\"Authorization\"] == \"token token goes here\"", "def setUp(self):\n ...
[ "0.7009723", "0.70080113", "0.692139", "0.68896157", "0.68887997", "0.68865454", "0.6753157", "0.6752903", "0.6731309", "0.67017823", "0.66879565", "0.66879565", "0.66122633", "0.65683043", "0.65327835", "0.65128523", "0.64445126", "0.644166", "0.64337033", "0.64138633", "0.6...
0.623188
40
Test setup with a bad token and a server with token auth disabled.
async def test_bad_token_with_tokenless_server( hass: HomeAssistant, entry, mock_websocket, setup_plex_server, requests_mock: requests_mock.Mocker, ) -> None: requests_mock.get( "https://plex.tv/users/account", status_code=HTTPStatus.UNAUTHORIZED ) await setup_plex_server() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_setup_with_deauthorized_token(\n hass: HomeAssistant, entry, setup_plex_server\n) -> None:\n with patch(\n \"plexapi.server.PlexServer\",\n side_effect=plexapi.exceptions.BadRequest(const.INVALID_TOKEN_MESSAGE),\n ):\n entry.add_to_hass(hass)\n assert not await h...
[ "0.73119694", "0.7186767", "0.71441424", "0.7120418", "0.7103498", "0.70751405", "0.70645696", "0.70396215", "0.7039612", "0.69960165", "0.69855124", "0.69853634", "0.69804686", "0.69665176", "0.6937846", "0.69275737", "0.69165033", "0.6909326", "0.6890609", "0.6868994", "0.6...
0.7620648
0
Test setup with a user with limited permissions.
async def test_setup_with_limited_credentials( hass: HomeAssistant, entry, setup_plex_server ) -> None: with patch( "plexapi.server.PlexServer.systemAccounts", side_effect=plexapi.exceptions.Unauthorized, ) as mock_accounts: mock_plex_server = await setup_plex_server() assert mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\r\n super(AddUserTest, self).setUp()\r\n self.add_perm(\"manage_users\")", "def setUp(self):\r\n super(UsersTest, self).setUp()\r\n self.add_perm(self.perm)", "def setUp(self):\r\n super(EditUserTest, self).setUp()\r\n self.user = self.F.UserFactory.cr...
[ "0.762844", "0.7364801", "0.7329257", "0.72419006", "0.71057427", "0.7082728", "0.69013083", "0.68922824", "0.68512213", "0.68313676", "0.68271047", "0.6826357", "0.6810347", "0.67899907", "0.67572236", "0.66979986", "0.66816974", "0.6643742", "0.6643742", "0.6643742", "0.664...
0.0
-1
Test setup with a deauthorized token.
async def test_setup_with_deauthorized_token( hass: HomeAssistant, entry, setup_plex_server ) -> None: with patch( "plexapi.server.PlexServer", side_effect=plexapi.exceptions.BadRequest(const.INVALID_TOKEN_MESSAGE), ): entry.add_to_hass(hass) assert not await hass.config_entr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_obtain_auth_token(self):\n pass", "def tearDown(self):\n self.client.token = self.manager.root_token", "def setUp(self):\n self.data = {\"email\": \"delete@token.com\", \"password\": \"d3l3t3T0k3n\"}\n self.user = samples.sample_user(**self.data)\n\n self.clie...
[ "0.71857697", "0.6934513", "0.6872392", "0.6821926", "0.67947507", "0.67883277", "0.67260987", "0.66906357", "0.66727024", "0.6665283", "0.66520125", "0.6642803", "0.6640863", "0.6590233", "0.65857404", "0.6580561", "0.65785754", "0.657371", "0.657371", "0.65543264", "0.65496...
0.74492425
0
Create DataFrame sample that contains column name and types of a generic DataFrame. DataFrame has 11 rows and 2 columns. One column called "col_name" contains some strings (that represent the column names of another DataFrame sample "df2"). Another column called "col_type" contains some possible outputs from ``trousse....
def df_column_names_by_type() -> pd.DataFrame: return pd.DataFrame( [ {"col_name": "bool_col_0", "col_type": "bool_col"}, {"col_name": "bool_col_1", "col_type": "bool_col"}, {"col_name": "string_col_0", "col_type": "string_col"}, {"col_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_dataframe_types():\n return pd.DataFrame({'X': [1.2, -5.6, 4.7, 0.5, -2.3, 4.9, -2., 5.4, 12.3],\n 'Q': ['d', 'g', 'e', 'z', 'k', 'a', 'x', 'r', 't'],\n 'U': [3, 6, 2, 7, 2, 4, 3, 7, 2],\n 'T': ['AA', 'FG', 'FG', 'AA', 'FG', 'KL', ...
[ "0.66270554", "0.6517276", "0.6379335", "0.6314471", "0.6046285", "0.6024276", "0.59166485", "0.58424336", "0.56947696", "0.5674276", "0.5658491", "0.5538161", "0.5467999", "0.5438484", "0.54202807", "0.54064286", "0.5399309", "0.5380829", "0.53605074", "0.53454894", "0.53266...
0.70321536
0
Create pandas DataFrame with columns containing variable ratios of NaN values. The returned DataFrame has a number of rows equal to the biggest
def df_multi_nan_ratio(sample_size: int) -> pd.DataFrame: sample_size = sample_size // 10 * 10 ratio_50 = int(sample_size * 0.5) num_values = [0.05 * i for i in range(sample_size)] df_multi_type_dict = { "0nan_col": [0.05 * i for i in range(sample_size)], "50nan_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_missing_table(df: pd.DataFrame) -> pd.DataFrame:\n null_val = df.isnull().sum()\n missing_rate = df.isnull().sum() / len(df)\n missing_table = pd.concat([null_val, missing_rate], axis=1)\n missing_table = missing_table.rename(\n columns={0: 'missing_num', 1: 'missing_rate'})\n missin...
[ "0.6991849", "0.6879322", "0.6861361", "0.6594009", "0.6473534", "0.6327957", "0.6266731", "0.62616634", "0.6221009", "0.62054855", "0.61983323", "0.6084278", "0.6069892", "0.60435593", "0.59700364", "0.5955252", "0.58346426", "0.5810598", "0.58035874", "0.57689226", "0.57134...
0.7166387
0
Create DataFrame with ``duplicated_cols_count`` duplicated columns. The returned DataFrame has 5 rows and ``duplicated_cols_count`` + 2 columns. Two columns are considered duplicated if they have the same column name
def df_duplicated_columns(duplicated_cols_count: int) -> pd.DataFrame: df_duplicated = pd.DataFrame({"col_0": list(range(5)), "col_3": list(range(5))}) for _ in range(duplicated_cols_count): single_col_df = pd.DataFrame({"duplic_col": list(range(5))}) df_duplicated = pd.concat([d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absorb(df):\n groups = df.columns.to_series().groupby(df.dtypes).groups\n dups = []\n for t, v in groups.items():\n dcols = df[v].to_dict(orient=\"list\")\n\n vs = list(dcols.values())\n ks = list(dcols.keys())\n lvs = len(vs)\n\n for i in range(lvs):\n fo...
[ "0.59055585", "0.58028525", "0.57761675", "0.5651315", "0.56387085", "0.5605727", "0.5585241", "0.555777", "0.54280335", "0.54233474", "0.5412107", "0.5320419", "0.531901", "0.5301436", "0.5277197", "0.52489454", "0.51790154", "0.5174626", "0.50117713", "0.50097346", "0.50078...
0.8677064
0
Log Errors caused by Updates.
def error(update, context): logger.warning('Update "%s" caused error "%s"', update, context.error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)", "def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)", "def error(self, update, context):\n self.logger.warning('Update \"%s\" caused error \"...
[ "0.7895998", "0.7895998", "0.78257465", "0.77876204", "0.77857095", "0.77857095", "0.7736321", "0.7720785", "0.77103233", "0.7705559", "0.7657797", "0.76552874", "0.76517016", "0.76468384", "0.76378685", "0.76123977", "0.7566961", "0.75665903", "0.7553289", "0.7541538", "0.75...
0.77470577
25
Returns the distance between origin and COM
def d01(self): return norm(self.p0() - self.p1())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_from_origin(self):\r\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5", "def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** .5", "def distance_from_origin(self):\n return (self.x ** 2 + self.y ** 2) ** 0.5", "def distance_from_origin(self):\n r...
[ "0.77261364", "0.7709518", "0.7692991", "0.76753354", "0.76753354", "0.7447476", "0.7355826", "0.70518714", "0.6884984", "0.67902976", "0.6745847", "0.6741104", "0.65451753", "0.65118307", "0.651114", "0.6460812", "0.6451924", "0.6434172", "0.6409411", "0.6370769", "0.6352521...
0.0
-1
Returns the angle between P0P1P2
def angle(self): a = self.p1() - self.p0() b = self.p1() - self.p2() d = np.cross(a, b)[0] pi = math.pi return pi - np.sign(-d) * math.acos(a.dot(b) / (norm(a) * norm(b)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_angle(p0, p1, p2):\n a = (p1[0] - p0[0]) ** 2 + (p1[1] - p0[1]) ** 2\n b = (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2\n c = (p2[0] - p0[0]) ** 2 + (p2[1] - p0[1]) ** 2\n return math.acos((a + b - c) / math.sqrt(4 * a * b)) * 180 / math.pi", "def calculate_angle(self, p0, p1, p2):\n ...
[ "0.8359005", "0.83545864", "0.83102924", "0.83075106", "0.80532753", "0.80306786", "0.7922037", "0.7779591", "0.77416295", "0.7650216", "0.7471951", "0.74671", "0.74495345", "0.7412468", "0.7383959", "0.7347935", "0.7336818", "0.7301673", "0.7284336", "0.7266028", "0.7255518"...
0.8197294
4
Returns all segments within a piece of cDNA that encode a given protein. A segment is returned if it, or its reverse complement, encodes the protein.
def peptide_encoding(dna, protein): rc_dna = reverse_complement(dna) rna = dna.replace('T', 'U') rc_rna = rc_dna.replace('T', 'U') res = [] len_encoding_rna = len(protein) * 3 for i in range(0, len(dna) - len_encoding_rna): rna_segment = rna[i:i + len_encoding_rna] translation = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segments(self):\n\t\tcount = ctypes.c_ulonglong(0)\n\t\tsegment_list = core.BNGetSegments(self.handle, count)\n\t\tresult = []\n\t\tfor i in xrange(0, count.value):\n\t\t\tresult.append(Segment(segment_list[i].start, segment_list[i].length,\n\t\t\t\tsegment_list[i].dataOffset, segment_list[i].dataLength, segme...
[ "0.5910641", "0.5804666", "0.56731975", "0.55955255", "0.55530834", "0.5502977", "0.54069126", "0.5394074", "0.53940046", "0.5381733", "0.5335772", "0.53112006", "0.5227356", "0.52209437", "0.52153057", "0.5205976", "0.5189233", "0.5180326", "0.51504254", "0.51011205", "0.505...
0.5875891
1
Return the score for a peptide, linear or cyclic, against a given spectrum. The score is given by the number of masses that belong to either the peptide spectrum or the given spectrum but not both.
def score_peptide(peptide, spectrum, cyclic=True): pept_spectr = peptide_spectrum(peptide, cyclic=cyclic) pept_count = Counter(pept_spectr) spectr_count = Counter(spectrum) # Take the max (union) of the two Counters totals_count = pept_count | spectr_count total = sum([value for value in totals_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cyclospectrum_score(peptide: tuple, spectrum: dict) -> int:\n cyclospectrum = {}\n for cycle_len in range(1, len(peptide)):\n peptide_extended = peptide + peptide[:(cycle_len - 1)]\n for cycle_start_pos in range(len(peptide)):\n current_mass = _peptide_mass(peptide_extended[cycl...
[ "0.7619408", "0.6197052", "0.59318626", "0.56753486", "0.55893326", "0.5581108", "0.53797495", "0.5359015", "0.5355205", "0.5348253", "0.5303733", "0.5297657", "0.52916807", "0.52060854", "0.5187018", "0.51527035", "0.51211405", "0.50724536", "0.50235367", "0.50111836", "0.49...
0.7826756
0
Then generates a new token and sets it as the cookie value and caches it as self._xsrf_token.
def test_xsrf_token_generate(self): import weblayer.request generate_hash = Mock() generate_hash.return_value = 'digest' weblayer.request.generate_hash = generate_hash self.handler.cookies.get.return_value = None self.assertTrue(self.handler.xsr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xsrf_token(self):\r\n if not hasattr(self, \"_xsrf_token\"):\r\n token = self.get_cookie(\"_xsrf\")\r\n if not token:\r\n token = binascii.b2a_hex(uuid.uuid4().bytes)\r\n expires_days = _USER_COOKIE_EXPIRES_DAYS\r\n self.set_cookie(\"_xsrf\", token, expires_days=expires_days)\...
[ "0.7803861", "0.77855605", "0.77855605", "0.7253943", "0.65340155", "0.6498047", "0.64775217", "0.64391166", "0.640974", "0.6340049", "0.62973315", "0.62596816", "0.62119013", "0.61973715", "0.61930764", "0.6155609", "0.61508113", "0.6126045", "0.6115402", "0.6089823", "0.608...
0.68058544
4
If `self._xsrf_input` then return it.
def test_xsrf_input_returns__xsrf_input(self): self.handler._xsrf_input = '<input />' self.assertTrue(self.handler.xsrf_input == '<input />')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xsrf(html):\n\n soup = BeautifulSoup(html, 'html.parser')\n _xsrf = soup.find('input', attrs={'type': 'hidden', 'name': '_xsrf'})['value']\n return _xsrf", "def test_xsrf_input_tag_from_token(self):\n \n import weblayer.request\n __xhtml_escape = weblayer.request\n \n...
[ "0.6277347", "0.57720095", "0.56793106", "0.56036425", "0.54744375", "0.54744375", "0.54279476", "0.54050237", "0.53897905", "0.53545064", "0.5333707", "0.5323171", "0.5323171", "0.5240664", "0.52210695", "0.52210695", "0.52199537", "0.52199537", "0.5218541", "0.5165701", "0....
0.68665224
0
Raise error if we haven't got an xsrf token in the request.
def test_xsrf_validate_raise_error_if_no_token_in_request(self): from weblayer.request import XSRFError self.handler.request.method = 'post' self.handler.request.headers.get.return_value = 'NotAnXMLHttpRequest' self.handler.request.params.get.return_value = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_xsrf_cookie(self):\r\n token = (self.get_argument(\"_xsrf\", None) or\r\n self.request.headers.get(\"X-Xsrftoken\") or\r\n self.request.headers.get(\"X-Csrftoken\"))\r\n if not token:\r\n raise HTTPError(403, \"'_xsrf' argument missing from POST\")...
[ "0.7775898", "0.7775898", "0.731454", "0.7274753", "0.69163984", "0.66697145", "0.6627007", "0.65128124", "0.6479452", "0.6452437", "0.6444747", "0.6422804", "0.6385889", "0.63652354", "0.6332095", "0.632264", "0.63223153", "0.62620157", "0.62470037", "0.6094414", "0.6065921"...
0.7730627
2
`handle_method_not_found` is called with `method_name` if `_method_selector.select_method()` returns `None`.
def test_handle_method_not_found_called_when_method_is_none(self): self.handler._method_selector.select_method.return_value = None self.handler.handle_method_not_found = Mock() self.handler('foo') self.handler.handle_method_not_found.assert_called_with('foo')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_method_not_found_response_used_when_method_is_none(self):\n \n self.handler._method_selector.select_method.return_value = None\n self.handler.handle_method_not_found = Mock()\n self.handler.handle_method_not_found.return_value = '405'\n self.handler('foo')\n ...
[ "0.76651996", "0.68172973", "0.65066963", "0.6190904", "0.61554116", "0.60272205", "0.59693724", "0.59693724", "0.5855358", "0.58324385", "0.57496923", "0.56782085", "0.558993", "0.55499333", "0.5463988", "0.54593235", "0.54506886", "0.5387441", "0.5303672", "0.52909225", "0....
0.82267654
0
The return value of `handle_method_not_found` is used when `_method_selector.select_method()` returns `None`.
def test_handle_method_not_found_response_used_when_method_is_none(self): self.handler._method_selector.select_method.return_value = None self.handler.handle_method_not_found = Mock() self.handler.handle_method_not_found.return_value = '405' self.handler('foo') self.norm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_method_not_found_called_when_method_is_none(self):\n \n self.handler._method_selector.select_method.return_value = None\n self.handler.handle_method_not_found = Mock()\n self.handler('foo')\n self.handler.handle_method_not_found.assert_called_with('foo')", "def ...
[ "0.81168735", "0.65434194", "0.645552", "0.62083244", "0.60216427", "0.59993017", "0.598791", "0.5929133", "0.5779368", "0.56793547", "0.5622502", "0.56053454", "0.55558485", "0.55558485", "0.5549159", "0.5537076", "0.54469633", "0.54353285", "0.54038286", "0.5387518", "0.535...
0.76982075
1
returns whether all bouts in this pool have been fought
def complete(self): victories = 0 expected = 0 add = 0 for p_entry in self.poolentry_set.all(): victories += p_entry.victories() expected += add add += 1 return victories == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_finished(self):\r\n return True if (\r\n sum(map(len, [self.queue, self.all, self.temp]))==0) else False", "def completed(self):\n if not self.has_opened():\n return len(self.bids) == 4\n elif len(self.bids) < 4:\n return False\n else:\n ...
[ "0.6800182", "0.67417043", "0.6617544", "0.6601808", "0.6540584", "0.6524366", "0.63289875", "0.6295777", "0.6292792", "0.6261346", "0.62379724", "0.6227148", "0.6226541", "0.6185235", "0.61761737", "0.61746925", "0.6172581", "0.6157518", "0.6139966", "0.6130922", "0.6117011"...
0.5853031
66
create a (600, ) array which is linear weighted around the desired value
def linear_weighted(value): n = np.arange(600, dtype='float32') dist = np.abs(n-value) normed = dist / np.mean(dist) return normed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_interpolation_weights(self, x):\n sz = x.size()\n dim = sz[1]\n index = MyLongTensor(*([self.n + 1] + list(x.size())))\n weight = MyTensor(*([self.n + 1] + list(x.size()))).zero_()\n if self.n % 2 == 0:\n for d in range(dim):\n i = torch.flo...
[ "0.63288367", "0.6269314", "0.61951137", "0.61394536", "0.60764927", "0.602567", "0.60027486", "0.5970182", "0.5968261", "0.59362", "0.5916474", "0.585447", "0.58532333", "0.58316207", "0.58253", "0.58216906", "0.58105105", "0.58025235", "0.57883024", "0.57881415", "0.5756660...
0.75503856
0
Computes the geometric average over the first dimension of a matrix.
def norm_geometric_average(x, weights=None, eps=1e-7): # Convert to log domain x_log = np.log(x + eps) # Compute the mean geom_av_log = np.average(x_log, weights=weights, axis=0) # Go back to normal domain and renormalise geom_av_log = geom_av_log - np.max(geom_av_log) geom_av = np.ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_average(matrix):\n sa = 0\n for i in range(0, matrix.shape[0]):\n for j in range(0, matrix.shape[0]):\n sa += (i+j) * matrix[i, j]\n return sa", "def get_mean(self,matrix):\n h,w = matrix.shape\n mean_vector = matrix.mean(1)\n mean = mea...
[ "0.720156", "0.70611703", "0.699632", "0.6937467", "0.679273", "0.67851317", "0.6775098", "0.66917706", "0.655848", "0.65345573", "0.6534479", "0.64310414", "0.6310581", "0.6304298", "0.6289539", "0.6283995", "0.62705857", "0.6213563", "0.6190245", "0.6189587", "0.6189121", ...
0.56273943
95
Computes the geometric average over the first dimension of a matrix.
def geometric_average(x, eps=1e-7): # Convert to log domain x_log = np.log(x+eps) # Compute the mean geom_av_log = np.mean(x_log, axis=0) # Go back to normal domain and renormalise geom_av_log = geom_av_log geom_av = np.exp(geom_av_log) return geom_av
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_average(matrix):\n sa = 0\n for i in range(0, matrix.shape[0]):\n for j in range(0, matrix.shape[0]):\n sa += (i+j) * matrix[i, j]\n return sa", "def get_mean(self,matrix):\n h,w = matrix.shape\n mean_vector = matrix.mean(1)\n mean = mea...
[ "0.7199845", "0.70594555", "0.6997378", "0.6935948", "0.6791774", "0.6784331", "0.67741024", "0.669181", "0.6556483", "0.6533868", "0.6532145", "0.64314336", "0.63088185", "0.6304272", "0.62889403", "0.62828434", "0.62702894", "0.62134975", "0.6189458", "0.6188846", "0.618793...
0.60182816
36
Get whether or not a rect is fully contained on the screen.
def is_fully_on_screen(rect): desktop = QApplication.desktop() desk_geo = desktop.availableGeometry(rect.topLeft()) if not desk_geo.contains(rect.topLeft()): return False desk_geo = desktop.availableGeometry(rect.topRight()) if not desk_geo.contains(rect.topRight()): return False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, rect: WindowType | Dnd) -> bool:\n if rect.x + rect.width < self.x:\n return False\n if rect.y + rect.height < self.y:\n return False\n\n ow, oh = self.wlr_output.effective_resolution()\n if self.x + ow < rect.x:\n return False\n ...
[ "0.77401996", "0.7531823", "0.72365505", "0.7134351", "0.7126222", "0.71064544", "0.70937645", "0.7080652", "0.70737183", "0.7059881", "0.704966", "0.70427215", "0.696423", "0.69315696", "0.6903319", "0.6892454", "0.6892454", "0.6892454", "0.6892454", "0.6892454", "0.6892454"...
0.7976698
0
Get the xcoordinate of the effective left screen edge.
def left_screen_edge(desktop, rect): p1 = rect.topLeft() p2 = rect.bottomLeft() g1 = desktop.availableGeometry(p1) g2 = desktop.availableGeometry(p2) return max(p1.x(), g1.left(), g2.left())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLeftX(self):\r\n return self.joy.getRawAxis(0)", "def get_x(self):\n return self.__x_position", "def get_x_start(self):\n return self.x_start", "def pos_x(self) -> int:\n return self._pos_x", "def getXPosition(self):\n return self._x", "def get_x(self, edge, posi...
[ "0.7789835", "0.72557056", "0.72438353", "0.689502", "0.6848631", "0.6827585", "0.68266255", "0.6754315", "0.67253506", "0.67131746", "0.6697694", "0.6697694", "0.6697694", "0.6697694", "0.66804326", "0.6662579", "0.6638767", "0.6624623", "0.6590479", "0.65610385", "0.6520734...
0.6953513
3
Get the xcoordinate of the effective right screen edge.
def right_screen_edge(desktop, rect): p1 = rect.topRight() p2 = rect.bottomRight() g1 = desktop.availableGeometry(p1) g2 = desktop.availableGeometry(p2) return min(p1.x(), g1.right(), g2.right())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRightX(self):\r\n return float(self.joy.getRawAxis(4))", "def getLeftX(self):\r\n return self.joy.getRawAxis(0)", "def right(self):\n return int(round(self._box[2]))", "def right_pos(self):\n return self.position + self.right_vec", "def GetXPosition(self):\n\n retu...
[ "0.7651538", "0.68841785", "0.651483", "0.6495938", "0.6490909", "0.6338587", "0.6315175", "0.6239171", "0.62302446", "0.6196706", "0.6159374", "0.614226", "0.61253804", "0.6124236", "0.61078054", "0.6082703", "0.60671145", "0.6048164", "0.6038051", "0.5985294", "0.5968567", ...
0.6939127
1
Get the ycoordinate of the effective top screen edge.
def top_screen_edge(desktop, rect): p1 = rect.topLeft() p2 = rect.topRight() g1 = desktop.availableGeometry(p1) g2 = desktop.availableGeometry(p2) return max(p1.y(), g1.top(), g2.top())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetYPosition(self):\n\n return self.ReadRegister(self.ETECH_REG_Y)", "def get_y(self):\n return self.y_coord", "def get_y(self):\n return self.__y_position", "def top_edge(self) -> agx.Line:\n return self._instance.getTopEdge()\\\n if self._instance\\\n ...
[ "0.69468397", "0.68745875", "0.68725204", "0.6693084", "0.6668364", "0.6668364", "0.66460705", "0.6614498", "0.6608189", "0.6588626", "0.6584775", "0.65704834", "0.65634936", "0.65482706", "0.6547921", "0.6547921", "0.6525381", "0.6499318", "0.64983845", "0.6483664", "0.64614...
0.7394258
0
Get the ycoordinate of the effective bottom screen edge.
def bottom_screen_edge(desktop, rect): p1 = rect.bottomLeft() p2 = rect.bottomRight() g1 = desktop.availableGeometry(p1) g2 = desktop.availableGeometry(p2) return min(p1.y(), g1.bottom(), g2.bottom())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_y(self):\n return self.__y_position", "def get_y(self):\n return self.y_coord", "def GetYPosition(self):\n\n return self.ReadRegister(self.ETECH_REG_Y)", "def bottom(self):\n return int(round(self._box[3]))", "def coordY(self, y):\n y_offset = 30\n if self....
[ "0.71535695", "0.71127146", "0.6981918", "0.6948534", "0.6912261", "0.68694866", "0.6855032", "0.6836063", "0.6795631", "0.67734045", "0.6754209", "0.67508316", "0.671513", "0.66916734", "0.66854966", "0.6679128", "0.6679128", "0.6671983", "0.66567355", "0.66567355", "0.66567...
0.73139304
0
Get edge for the popup arrow. Returns
def arrowEdge(self): return self._state.arrow_edge
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_edge(self):\n return self.edge", "def get_edge(self, e):\r\n return self.edges[e]", "def edge (self):\n if self.parent is not None:\n return Path (self.path.S, self.path.end - self.edge_len (), self.path.end)\n return Path (tuple (), 0, 0)", "def top_edge(self) ...
[ "0.7138317", "0.65431637", "0.6253612", "0.622324", "0.61815006", "0.6169321", "0.60713196", "0.60202456", "0.60151476", "0.60090876", "0.600762", "0.59927416", "0.5991188", "0.5976054", "0.59599537", "0.5838788", "0.58350444", "0.58079153", "0.57782024", "0.57157284", "0.571...
0.8068035
0
Get the duration of the fade in for the view. Returns
def fadeInDuration(self): return self._state.fade_in_duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fadeOutDuration(self):\n return self._state.fade_out_duration", "def getDuration(self):\r\n return self.duration", "def duration(self):\n return self.phasset.duration()", "def duration(self):\n pass", "def getDuration(self):\n return self.duration", "def setFadeInDu...
[ "0.78586805", "0.65895516", "0.65875167", "0.65852386", "0.6533402", "0.64577097", "0.645164", "0.6442139", "0.6426165", "0.6426165", "0.6426165", "0.6426165", "0.6426165", "0.6426165", "0.6426165", "0.6426165", "0.6410685", "0.6410685", "0.63915956", "0.63747376", "0.6350618...
0.84563184
0
Get the duration of the fade out for the view. Returns
def fadeOutDuration(self): return self._state.fade_out_duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fadeInDuration(self):\n return self._state.fade_in_duration", "def setFadeOutDuration(self, duration):\n self._state.fade_out_duration = duration", "def getDuration(self):\r\n return self.duration", "def duration(self):\n return self.phasset.duration()", "def duration(self):...
[ "0.7837033", "0.67150897", "0.6426356", "0.64215565", "0.6409621", "0.63726074", "0.63234967", "0.6269376", "0.6245809", "0.6245809", "0.6245809", "0.6245809", "0.6245809", "0.6245809", "0.6245809", "0.6245809", "0.6229759", "0.6218639", "0.6213154", "0.6205563", "0.6205563",...
0.8555943
0
Set the duration of the fade out for the view.
def setFadeOutDuration(self, duration): self._state.fade_out_duration = duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFadeInDuration(self, duration):\n self._state.fade_in_duration = duration", "def fadeOutDuration(self):\n return self._state.fade_out_duration", "def fadeOut(self, te, td):\n self.setAlpha((1-te/td)*255)", "def fade_out(object_to_fadeout, duration, markerstream):\n\n fadeou...
[ "0.775621", "0.6683141", "0.6645642", "0.66276044", "0.60774547", "0.6047396", "0.6027013", "0.59569806", "0.5949377", "0.58776057", "0.5818367", "0.58068275", "0.57710975", "0.57555795", "0.5606521", "0.5605776", "0.5580904", "0.5580904", "0.5580904", "0.5580904", "0.5580904...
0.8437744
0
Set whether or not close on click is enabled.
def setCloseOnClick(self, enable): self._state.close_on_click = enable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeOnClick(self):\n return self._state.close_on_click", "def set_single_click_to_open(self, value):\r\n self.set_conf('single_click_to_open', value)", "def setClosable(self, value=True):\n assert isinstance(value, bool)\n\n self._allow_close = value", "def setClosable(self, ...
[ "0.6752241", "0.66817653", "0.64021045", "0.6354871", "0.6278882", "0.6170063", "0.6170063", "0.6170063", "0.60363305", "0.60312355", "0.58533186", "0.5812207", "0.5812207", "0.5812207", "0.5812207", "0.57939345", "0.5770446", "0.5721333", "0.5633999", "0.55889815", "0.558408...
0.7966085
0
Check wether value contains the string 'true' in a variety of capitalizations (e.g. "True" or "TRUE").
def is_true(value): return value.lower() == 'true'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_true(value):\n return str(value).lower() in (\"yes\", \"true\", \"1\")", "def is_true(value):\n\tvalue = value.lower()\n\t\n\treturn (\n\t\t(value == \"true\") |\n\t\t(value == \"t\") |\n\t\t(value == \"yes\") |\n\t\t(value == \"y\")\n\t)", "def str2bool(self, v):\n return v.lower() in (\"yes\", \...
[ "0.72698236", "0.71907485", "0.6965161", "0.6931546", "0.6855297", "0.6836432", "0.67052937", "0.66846794", "0.66735846", "0.6665864", "0.6650152", "0.6642237", "0.6633885", "0.6624215", "0.6576254", "0.6532567", "0.65293974", "0.65244645", "0.65120715", "0.64745575", "0.6398...
0.74867576
0
Implement your model here. You will need to define placeholders, for the input and labels, Note that the input is not strings of words, but the strings after the embedding lookup has been applied (i.e. arrays of floats). In all cases this code will be called by an unaltered runner.py. You should read this file and ensu...
def define_graph(): # Nick: To confirm: what should the shape of the input and output tensors be? learning_rate = 0.001 # Nick: it feels weird putting this logic in here. num_units = MAX_WORDS_IN_REVIEW # Nick: Also arbitrary, unsure if more units = better. input_data = tf.placeholder(tf.float32, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def built_model(self):\n # Embedding layer\n with tf.device('/cpu:0'), tf.name_scope(\"embedding\"):\n self.word_embedding_matrix = tf.get_variable(shape=[self.vocabulary_size, self.embedding_dim],\n name=\"word_embedding_matrix\",\n ...
[ "0.7506438", "0.7012451", "0.6986058", "0.69194925", "0.6899191", "0.6892052", "0.67615587", "0.6760045", "0.67506576", "0.67117816", "0.67077684", "0.66749454", "0.6668188", "0.6603236", "0.65870655", "0.6574744", "0.65706456", "0.6555276", "0.65453476", "0.6544772", "0.6541...
0.6599431
14
This property stores all the classes that are present in the data source.
def classes(self) -> List[Union[chr, int]]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classes_(self):\n return self._classes", "def classes(self):\n return self._classes", "def classes(self):\n return self._classes", "def classes(self):\n return self._class.copy()", "def get_classes(self):\n\n # retrieve data\n classes = self.local_storage.query(q_c...
[ "0.76753724", "0.75658053", "0.7564144", "0.7506627", "0.74377525", "0.74359566", "0.71562874", "0.7024934", "0.6926109", "0.6904674", "0.6830249", "0.6792308", "0.6684355", "0.66400504", "0.66321653", "0.6617151", "0.6559195", "0.65511787", "0.6492214", "0.6458904", "0.64249...
0.6177753
31
Get the ID of the organization by the given name. Raises AtlasApiError if no organization exists by the given name.
def get_one_organization_by_name(*, client, organization_name): all_orgs = client.orgs.get().data for org in all_orgs.results: if org.name == organization_name: LOGGER.debug("Organization details: {}".format(org)) return org raise AtlasApiError('Organization {!r} not found.'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"organization_id\")", "def organization(self, *, name: str):\n return self.github.organization(name)", "def organization_id(self) -> str:\n return pulumi.get(self, \"organization_id\")", "def organizatio...
[ "0.70146406", "0.6876925", "0.68740886", "0.6854967", "0.6503334", "0.6503334", "0.6503334", "0.6503334", "0.6503334", "0.6422684", "0.63661534", "0.63617057", "0.6353698", "0.6299146", "0.6299146", "0.6299146", "0.6299146", "0.6205839", "0.6149343", "0.6149106", "0.61120135"...
0.70907164
0
Ensure a project named `project_name` exists and return it. Does not raise an exception if a project by that name already exists.
def ensure_project(*, client, project_name, organization_id): try: project = client.groups.post( name=project_name, orgId=organization_id).data except AtlasApiError as exc: if exc.error_code == 'GROUP_ALREADY_EXISTS': LOGGER.debug("Project {!r} already exists".format(proj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_exists(self, project_name):\r\n\t\treturn self.projects.find_one({\"project_name\": project_name})", "def load_project(project_name):\n if not projects.exists(project_name):\n print(\"Invalid project: {}\".format(project_name))\n sys.exit(1)\n else:\n return project_name", ...
[ "0.816524", "0.76906097", "0.7684683", "0.7551408", "0.7275038", "0.72689915", "0.71487296", "0.7090013", "0.6833345", "0.6828683", "0.6732307", "0.6713452", "0.6660239", "0.664615", "0.6561933", "0.6495914", "0.64357567", "0.6375871", "0.63483214", "0.630184", "0.6292834", ...
0.70945275
7
Returns True if the given object is a lambda expression.
def is_lambda(obj: Any) -> bool: LAMBDA = lambda: 0 # noqa: E731 return isinstance(obj, type(LAMBDA)) and obj.__name__ == LAMBDA.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isfunction(*obj):\n\n return all([callable(o) for o in obj])", "def isfunction(obj):\n return isinstance(obj, types.FunctionType)", "def isfunction(object):\n return isinstance(object, types.FunctionType) or isFunction(object)", "def is_callable_like(obj):\n return isinstance(obj, property) o...
[ "0.67431235", "0.6498243", "0.6486967", "0.6355355", "0.5996268", "0.58607453", "0.5788982", "0.5773563", "0.57404", "0.5681595", "0.56783336", "0.5670146", "0.56693596", "0.56273925", "0.55484587", "0.55321825", "0.549597", "0.5459987", "0.54139775", "0.5399618", "0.5384998"...
0.85494196
0
Set the volume level.
async def async_set_volume(self, volume): await self._soap_request( "SetVolume", f"<Channel>Master</Channel><DesiredVolume>{volume}</DesiredVolume>", "RenderingControl", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_volume_level(self, volume: float) -> None:\n self.data.client.volume(int(volume * 100))", "def volume_level(self, level):\n self._global_volume = level\n # individual player volume control method here", "def set_volume(self, volume_level): \n mixer.music.set_volume(vo...
[ "0.88359433", "0.8654467", "0.8640238", "0.8532218", "0.83283406", "0.83043885", "0.82269186", "0.8147844", "0.80169433", "0.80111635", "0.79822063", "0.79672956", "0.7815363", "0.7721689", "0.76576555", "0.7559398", "0.7541559", "0.75365704", "0.7482477", "0.7478909", "0.745...
0.66416633
90
Returns the pytz timezone for the market session.
def getTimezone(self): return self.timezone
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_session_tz(self) -> tzinfo | UTC:\n try:\n tz = \"UTC\" if not self.timezone else self.timezone\n return pytz.timezone(tz)\n except pytz.exceptions.UnknownTimeZoneError:\n logger.warning(\"converting to tzinfo failed\")\n if tzlocal is not None:\n ...
[ "0.7811844", "0.774089", "0.7660779", "0.7625223", "0.7593994", "0.75466776", "0.7505739", "0.74893945", "0.74639845", "0.7442012", "0.7427265", "0.7426999", "0.7355909", "0.7330579", "0.7262183", "0.71808094", "0.7144158", "0.7141883", "0.71319383", "0.7131545", "0.7079146",...
0.7378035
12
Returns the datetime.time representing the opening time.
def getSessions(self): return self.sessions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_time(self):\n return dt.time(0,0)", "def close_time(self):\n return dt.time(23, 59)", "def tijd_open(self):\n return datetime.timedelta(hours=self.sluit.hour - self.open.hour,\n minutes=self.sluit.minute - self.open.minute)", "def _get_time(self)...
[ "0.8032071", "0.7388529", "0.7088178", "0.6951745", "0.69499964", "0.68733805", "0.68733805", "0.6819129", "0.6787486", "0.67632127", "0.6709953", "0.66964567", "0.66892046", "0.6680167", "0.6669069", "0.66405976", "0.6636606", "0.65951496", "0.6566989", "0.655896", "0.652382...
0.0
-1
Select indices from clustering and potential augment to match minimum.
def get_augmented_subset( y: np.ndarray, ref: np.ndarray, in_cluster: np.ndarray, min_fraction: float, ) -> np.ndarray: # copy as we modify in_cluster = in_cluster.copy() # calculate how many are required desired: int = int(min_fraction * len(y)) ixs_in_cluster: np.ndarray = np.flat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_minmax(self):\n mat = distance.cdist(self.selected.values, self.X.values)\n idx = mat.max(axis=0).argmin()\n self.select_index(idx)", "def add_center(self):\n center = pd.DataFrame([0.5]*len(self.columns), index=self.columns).T\n idx = distance.cdist(center.values, s...
[ "0.6900577", "0.5850737", "0.570197", "0.56969005", "0.5685759", "0.5615921", "0.5549922", "0.5545081", "0.55032295", "0.54572004", "0.5392879", "0.5371538", "0.5370204", "0.5358801", "0.5348879", "0.53336173", "0.53210026", "0.53126544", "0.53091913", "0.52453375", "0.523289...
0.5009194
42
!Wraps produtil getbool. Config variable is checked with a default value of None because if the config is not set and a default is specified, it will just return that value. We want to log that a default was used and set it in the config so it will show up in the final conf that is generated at the end of execution. If...
def getbool(self, sec, name, default=None, badtypeok=False, morevars=None, taskvars=None): try: return super().getbool(sec, name, default=None, badtypeok=badtypeok, morevars=morevars, taskvars=taskvars) except NoOptionError: # config item was not set self.check_defaul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getboolean_def(self, section, option, default):\n try:\n return self.getboolean(section, option)\n except ConfigParser.NoOptionError:\n return default", "def check_value(installDir, value, default, boolean=True):\n configFile = installDir + \"onirc\"\n parser = Confi...
[ "0.7706431", "0.7379276", "0.73633033", "0.71830434", "0.70682174", "0.69937867", "0.68730825", "0.6852637", "0.6681882", "0.6672883", "0.6632798", "0.656548", "0.65237457", "0.65184635", "0.64083695", "0.634715", "0.6323334", "0.63229644", "0.624798", "0.6239777", "0.6216067...
0.7809856
0
!Converts time values ending in H, M, or S to seconds
def getseconds(self, sec, name, default=None, badtypeok=False, morevars=None, taskvars=None): try: # convert value to seconds # Valid options match format 3600, 3600S, 60M, or 1H value = super().getstr(sec, name, default=None, badtypeok=badtypeok, morevars=morevars, taskvars=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_time_to_secs(input_time):\n hours = input_time[:2]\n minutes = input_time[2:4]\n second = input_time[4:]\n\n hours = int(hours) * 60 * 60\n minutes = int(minutes) * 60\n second = float(second)\n\n return hours+minutes+second", "def convert_to_secs(timer):\n timer_split = timer...
[ "0.7874649", "0.7769002", "0.77147764", "0.7714542", "0.7585057", "0.7506508", "0.748734", "0.74339616", "0.7421009", "0.73882324", "0.73688656", "0.7367728", "0.72983104", "0.72795147", "0.72402436", "0.7195305", "0.7183542", "0.71573365", "0.71567184", "0.71562994", "0.7155...
0.0
-1
Get the SignedObject that this certificate signs.
def signed_object(self) -> SignedObject[ECT]: return self._signed_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_object(self) -> bytes:\n message = self.signed_object.econtent.signed_attrs().to_der()\n signature = self.private_key.sign(data=message,\n padding=padding.PKCS1v15(),\n algorithm=self.hash_algorithm())\n ...
[ "0.72473234", "0.66332227", "0.64858466", "0.6445675", "0.6444962", "0.6025024", "0.6008974", "0.59965783", "0.5957983", "0.5874496", "0.5871284", "0.5869649", "0.5834407", "0.5763526", "0.57409847", "0.57409847", "0.56672627", "0.5629953", "0.5629953", "0.5629953", "0.562995...
0.8012303
0
Get the filesystem path to the the issuer publication point.
def issuer_repo_path(self) -> str: return typing.cast(ca.CertificateAuthority, self.issuer).repo_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def issuer(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"issuer\")", "def issuer(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"issuer\")", "def get_path(self):\n if self._path is None:\n self._path = self._dl_path.path / (\n self.metadata[\"n...
[ "0.6567686", "0.6567686", "0.65625966", "0.6543492", "0.6543492", "0.6543492", "0.6543492", "0.65131104", "0.6513047", "0.6513047", "0.6513047", "0.6513047", "0.65129554", "0.6512754", "0.65119284", "0.64659446", "0.64659446", "0.64659446", "0.64659446", "0.64659446", "0.6465...
0.7341816
0
Get the 2D annotation bounding box for a given `sample_data_token`. return None if no intersection (bounding box).
def bbox_3d_to_2d(nusc: NuScenes, camera_token: str, annotation_token: str, visualize: bool = False) -> List: # Obtain camera sample_data cam_data = nusc.get('sample_data', camera_token) # Get the calibrated sensor and ego pose record to get the tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_box_2d(self, sample_annotation_2d_token: str) -> Box2d:\n record = self.get(\"sample_annotation_2d\", sample_annotation_2d_token)\n return Box2d(\n record[\"bounding_box\"], name=record[\"category_name\"], token=record[\"token\"]\n )", "def get_bb(frame_annots, segm_name):...
[ "0.6510264", "0.6299977", "0.602071", "0.59839827", "0.5941535", "0.5710957", "0.56603223", "0.55302936", "0.5511362", "0.54987574", "0.5479192", "0.5465993", "0.5465993", "0.543519", "0.5384257", "0.53028744", "0.5290869", "0.52858573", "0.5247847", "0.52372175", "0.5232522"...
0.0
-1
Given a test name, returns which OpenStack service is primarily tested. This is based partly on the location of the test in Tempest structure, partly on the knowledge of the test itself.
def get_service_name_from_test_name(test_name): nova_scenarios = [ '.test_server_advanced_ops.', '.test_shelve_instance.', '.test_server_basic_ops.' ] cinder_scenarios = [ '.test_snapshot_pattern.', '.test_stamp_pattern.', '.test_volume_boot_pattern.', ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_test_method_name(test):\n _, _, class_and_method_name = test.address()\n first_dot_index = class_and_method_name.index('.')\n test_method_name = class_and_method_name[first_dot_index + 1:]\n return test_method_name", "def get_test(self):\n return self.test_session.test...
[ "0.5959201", "0.57300466", "0.5711871", "0.5657623", "0.5647659", "0.56294876", "0.56020534", "0.55755174", "0.5554177", "0.55293226", "0.5526577", "0.5509788", "0.54899305", "0.54329956", "0.5413592", "0.54036945", "0.5396241", "0.5364716", "0.5353274", "0.5272947", "0.52697...
0.78287673
0
This method determines the the sheet by the given table name. In the first try, the method will try to open a spread sheet within the core excel sheet as a tab. If the the excel sheet tab doesn't exist within the core excel sheet the method will try to open a excel file and return the sheet1. In case, the sheet_name is...
def __determine_table_sheet(self, table_name: str, sheet_name: str = DEFAULT_SHEET_NAME) -> Worksheet: # is it cached? direct_cache_name = GSpreadAccess.CACHE_TABLE_ACCESS_PATTERN.format(self.__core_excel_sheet_name, table_name) if direct_cache_name in self.__worksheet_cache: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sheet(self, workbook_name, sheet_name):\r\n try:\r\n return workbook_name[sheet_name]\r\n except:\r\n print(\"Problem finding {} worksheet from {} workbook\".format(\r\n sheet_name, workbook_name))", "def _get_sheet(file_name, sheet_name_or_index):\n ...
[ "0.73737496", "0.7145609", "0.6918979", "0.68461365", "0.61693716", "0.6139146", "0.6070731", "0.6046604", "0.60453963", "0.6042343", "0.60003126", "0.59941274", "0.59294087", "0.5918", "0.5857898", "0.5829065", "0.5815351", "0.58059216", "0.5738132", "0.5659665", "0.56565255...
0.8180775
0
Initialization of the perceptron with given sizes.
def __init__(self, *args): self.shape = args n = len(args) # Build layers self.layers = [] # Input layer (+1 unit for bias) self.layers.append(np.ones(self.shape[0]+1)) # Hidden layer(s) + output layer for i in range(1, n): self.la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, sizes):\n self.num_layers = len(sizes)\n self.sizes = sizes\n self.biases = [np.random.randn(y, 1) for y in sizes[1:]]\n self.weights = [np.random.randn(y, x)\n for x, y in zip(sizes[:-1], sizes[1:])]", "def __init__(self, sizes):\n sel...
[ "0.72632444", "0.72632444", "0.7257682", "0.7117734", "0.6934432", "0.6758064", "0.66394323", "0.6528443", "0.652346", "0.65007114", "0.6487251", "0.6414539", "0.6378286", "0.6335006", "0.62844765", "0.6254523", "0.62520343", "0.6251705", "0.62075293", "0.6203347", "0.6185616...
0.6002745
40
Converts a raw number into a hex value encoded as a string.
def ToBase16(num): return hex(num).rstrip("L").upper()[2:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_str(an_int):\n ...", "def hex(number): # real signature unknown; restored from __doc__\n return \"\"", "def _int_to_string(number: int) -> str:\n return f\"{number:04X}\"", "def as_hex(value):\n return format(value, '#02x')", "def hex(self, x):\n return \"%x\" % x", "def to...
[ "0.74325067", "0.74320316", "0.719869", "0.69982684", "0.69900054", "0.6977614", "0.6920509", "0.69043404", "0.6903028", "0.68855846", "0.68228585", "0.6821369", "0.67783517", "0.67027116", "0.6702099", "0.66845864", "0.6683838", "0.6645393", "0.6644035", "0.66161466", "0.661...
0.0
-1
The edit profile form should not be displayed unless the user is logged in
def test_no_profile_to_edit(self): self.client.force_login(self.user) response = self.client.get(reverse('member:edit_profile', args=(10,))) self.assertEqual(response.status_code, 404) #self.assertContains(response, "you have no profile") #self.assertEqual(response.context['user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(request):\n user = logic.get_user(request)\n if request.method == \"POST\":\n form = UserForm(request.POST, instance=user)\n # check whether it's valid:\n if form.is_valid():\n m = form.save()\n m.save()\n return HttpResponseRedirect('/users/show...
[ "0.76119906", "0.760056", "0.7364602", "0.7353881", "0.7243262", "0.7188313", "0.7137096", "0.70913416", "0.70721036", "0.70423716", "0.7039569", "0.70317364", "0.70273757", "0.7019003", "0.7004576", "0.6964257", "0.6954102", "0.6934822", "0.6914784", "0.68877286", "0.6858691...
0.64267427
39
Loads data for specified city and filters by month and day if applicable.
def load_data(city, month, day): # Load *.csv corresponding to city. Convert Start Time to datetime format # and create new columns for Month and Day of Week. df = pd.read_csv(CITY_DATA[city]) df['Start Time'] = pd.to_datetime(df['Start Time']) df['Month'] = df['Start Time'].dt.month df['Day of ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_city_data(city, month, day):\n df = pd.read_csv(CITY_DATA[city])\n #extract month, day, hour from start time\n df['month'] = pd.to_datetime(df['Start Time']).dt.month_name()\n df['day'] = pd.to_datetime(df['Start Time']).dt.weekday\n df['hour'] = pd.to_datetime(df['Start Time']).dt.hour\n\n...
[ "0.8318348", "0.8245502", "0.81623906", "0.80827904", "0.80593264", "0.8051494", "0.80127233", "0.8000581", "0.79910684", "0.79897016", "0.79760075", "0.7975315", "0.7968216", "0.7965016", "0.79573226", "0.79393643", "0.7938653", "0.7936336", "0.7932866", "0.7929513", "0.7920...
0.79942125
8
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # display the most common month, day of week, and start hour # and create new column for Hour columns = ['Month', 'Day of Week', 'Hour'] df['Hour'] = df['Start Time'].dt.hour for col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\r\n\r\n print('\\nThese are the statistics of the most frequent times of travel:\\n')\r\n start_time = time.time()\r\n\r\n # Display the most common month\r\n common_month = df['month'].mode()[0]\r\n print(\"- That's the most common month based on your selection: \" +\r\n ...
[ "0.7974609", "0.7851373", "0.7800278", "0.77821916", "0.7775073", "0.7762475", "0.77532375", "0.77384645", "0.77262247", "0.7718093", "0.7685153", "0.7683606", "0.76808155", "0.7679881", "0.7650141", "0.7644975", "0.7643931", "0.76428497", "0.7629725", "0.76246285", "0.762423...
0.7272249
69
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip Combinations...\n') start_time = time.time() # display most commonly used start station, end station, and # trip combination and create new column for 'Trip' columns = ['Start Station', 'End Station', 'Trip'] df['Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\033[1m' + 'Calculating the most popular stations and trip...\\n' + '\\033[0m')\n start_time = time.time()\n\n # display the most commonly used start station\n\n start_stn = df['Start Station'].mode()[0]\n print('Most popular start station is {}.'.format(start_stn)...
[ "0.7809938", "0.76727635", "0.7538624", "0.74982685", "0.7490305", "0.74887866", "0.7436869", "0.7429845", "0.74274427", "0.7425571", "0.74126786", "0.7404592", "0.7382532", "0.7379482", "0.73747545", "0.7365935", "0.73561436", "0.7351966", "0.7324152", "0.7304813", "0.729985...
0.70906705
77
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total and mean travel time in hours ('Trip Duration' is in secs) print('Total travel time for all trips in hours: ', format(int(df['Trip Duration'].sum()/360), ',')) print('Mean trave...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(df):\r\n\r\n print('\\nThese are the statistics related to the trips durations:\\n')\r\n start_time = time.time()\r\n\r\n # Display total travel time\r\n total_travel_time = df['Trip Duration'].sum()\r\n print(\"\\n- The total travel time based on your selection is: \" +\r\n ...
[ "0.82698804", "0.81186754", "0.80481917", "0.80468994", "0.79780424", "0.7962861", "0.7959512", "0.7946294", "0.7936397", "0.7929802", "0.79278564", "0.79269135", "0.79246616", "0.79200053", "0.79158986", "0.7915428", "0.7913144", "0.79076344", "0.7903745", "0.79023826", "0.7...
0.7611701
94
Checks whether the device was vulnerable to a particular vulnerability on a particular date
def vulnerable_on(self, date, vulnerability, global_version_list=True): version = self.version_on(date) if version is None: # No records for the device on this date return VulnerabilityStatus.NOT_IN_USE if 'all' not in map(lambda x: x[0], vulnerability.manufacturers()): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eligible(date):\n now = timezone.now().date()\n delta_year = now.year - date.year\n if delta_year > 13:\n return 'allowed'\n elif delta_year == 13 and now.day > date.day and now.month >= date.month:\n return 'allowed'\n return 'blocked'", "def valid_at_date(self, date, ignore_mis...
[ "0.64876306", "0.6404969", "0.63712275", "0.6157658", "0.60552305", "0.5868212", "0.5740342", "0.56147283", "0.5608028", "0.55735177", "0.5553384", "0.55171835", "0.5476134", "0.5456499", "0.5436147", "0.54091024", "0.539666", "0.5390837", "0.5384038", "0.5382577", "0.5382158...
0.74313
0
Checks whether the gap between two times is less than gap
def times_within(time1, time2, gap): if time1 is None or time2 is None: return None return abs(time1 - time2) < gap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertTimeGap(self, time1, time2, delta):\n if time1 < time2:\n self.assertLess(time2 - time1, timedelta(seconds=delta))\n else:\n self.assertLess(time1 - time2, timedelta(seconds=delta))", "def gaps_overlap(gap1: Tuple[int, int], gap2: Tuple[int, int]) -> bool:\n r...
[ "0.75383383", "0.7387032", "0.71409035", "0.71110374", "0.69299775", "0.68807703", "0.6870961", "0.6795922", "0.6659364", "0.65143025", "0.64936167", "0.6404251", "0.6393378", "0.6390285", "0.63751966", "0.6322659", "0.6322659", "0.631742", "0.6292949", "0.628971", "0.628971"...
0.83607805
0
Return game node given history key or make not if nonexistent
def get_node(self, history): # get a DrawNode if history is empty or last action 't' not terminal if history not in self: if not history or history[-1] == 't': new_node = DrawNode(history, self) else: # a player node new_node = PlayerNode(history...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node(self, key):\n \"\"\"in order to change a value\"\"\"\n a_list = self.hash_table[self.hash_gen(key)]\n if a_list != None:\n return a_list.find_node(key)", "def find_or_create_node(branch, key):\n for node in branch:\n if not isinstance(node, dict):\n ...
[ "0.6876675", "0.6607961", "0.6120447", "0.6111275", "0.596727", "0.59456456", "0.57822907", "0.56835836", "0.5667998", "0.5663955", "0.5644495", "0.5644495", "0.5640103", "0.56364954", "0.5632962", "0.5596586", "0.5575397", "0.5529954", "0.55289245", "0.55232245", "0.5509488"...
0.6865644
1
Get the game score from a player node with history
def get_score(self, history): # make last node to have final game state hist_str = history if hist_str not in self: self[hist_str] = PlayerNode(history, self) return self[hist_str].scores
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gScore(self, node):\n return self.gScore[node]", "def get_gScore(self, node):\n # TODO: Return the g Score of a node\n return self.gScore[self.start][node]", "def play(self, player=0):\n history = ''\n self.player = player\n while True:\n node = self.game_tree.g...
[ "0.688189", "0.6661896", "0.6647176", "0.6643435", "0.64992636", "0.64528346", "0.6432408", "0.64258146", "0.63566417", "0.6230309", "0.62204736", "0.62049365", "0.62049365", "0.62049365", "0.62049365", "0.62049365", "0.62049365", "0.6165181", "0.6139781", "0.6139781", "0.613...
0.8043172
0
Return human readable string version of this node.
def __str__(self): string = '' for i in range(self.game_parameters['NUM_PLAYERS']): string = string + 'Player ' + str(i) + ' chips: ' + \ str(self.state[i]['chips']) + '\n cards: ' string = string + ' '.join(str(c) for c in self.state[i]['cards'])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n\r\n nodes = list(map(lambda x: str(x), self.nodes.values()))\r\n return ''.join(nodes)[:-1]", "def __str__(self):\n nodes = self.get_ordered_nodes()\n nodes = [ '%s(%s):%s' % (node[0],node[1],node[3]) for node in nodes ]\n nodes = \" \".join([ n for n in...
[ "0.76788586", "0.76105326", "0.7598813", "0.7580926", "0.7469155", "0.7456436", "0.743913", "0.73551077", "0.732471", "0.7321988", "0.73201925", "0.7303162", "0.7282953", "0.7282953", "0.7282953", "0.72809947", "0.7252082", "0.72108257", "0.71371907", "0.71369976", "0.7122685...
0.0
-1
Initialize node with game history leading to this node
def __init__(self, history=None, game_tree=None): super().__init__(history, game_tree) self.get_actions() self.initial_strategy() self.regret_table = {a: 0 for a in self.strat} self.strategy_table = {a: 0 for a in self.strat}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_history(self):\n self.history_manager = HistoryManager(shell=self, parent=self)\n self.configurables.append(self.history_manager)", "def initialise(self) -> None:\n self.changed = False\n self.previously_visited = self.visited\n self.visited = {}\n self.visited_...
[ "0.6524011", "0.63991296", "0.6360987", "0.63154113", "0.63124037", "0.6290154", "0.62493587", "0.6187763", "0.6132187", "0.6097241", "0.6044433", "0.60403377", "0.60398054", "0.6015826", "0.598575", "0.59714633", "0.5942795", "0.5935098", "0.5930312", "0.5927639", "0.5892373...
0.65984094
0
Classification Rate for onehot encoded arrays
def classification_rate(y_true: np.array, y_pred: np.array): v_true = np.argmax(y_true, axis=1) v_pred = np.argmax(y_pred, axis=1) return np.mean(v_true == v_pred)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_one_hot(train_y, class_count):\n\n target_y = np.zeros((train_y.shape[0], class_count), dtype=np.float32)\n target_y[np.arange(train_y.shape[0]), train_y.astype(np.int8)] = 1\n\n return target_y", "def one_hot(Y, classes):\n one_hot = np.zeros((Y.shape[0], classes))\n one_hot[np.arange...
[ "0.7542371", "0.7329011", "0.7274564", "0.7244649", "0.72100765", "0.7131925", "0.7131362", "0.7120689", "0.7102977", "0.7090497", "0.70317435", "0.7017674", "0.7009277", "0.7008534", "0.69917804", "0.6974746", "0.6970704", "0.6967161", "0.6960968", "0.69599426", "0.6958847",...
0.647465
68
Gets a date in string format (YYYYMMDD) and returns a datetime object.
def convert_bz_str_epoch(str_date): # type: (str) -> int int_epoch = int(datetime.strptime(str_date, '%Y-%m-%d').strftime('%s')) return int_epoch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDate(datestr):\n\treturn dt.datetime.strptime(datestr,\"%Y-%m-%d\")", "def get_date(s):\r\n syear = s[:4]\r\n smonth = s[5:7]\r\n sday = s[8:]\r\n return datetime.date(int(syear), int(smonth), int(sday))", "def get_date_obj(date_string):\n return datetime.datetime.strptime(date_string, '%...
[ "0.7405048", "0.71996605", "0.7130609", "0.6950956", "0.6915582", "0.6909807", "0.6908614", "0.6907116", "0.6878366", "0.68570906", "0.6852629", "0.6808433", "0.6792572", "0.67459214", "0.6736473", "0.6714844", "0.6686337", "0.6671117", "0.6671117", "0.6662724", "0.6624216", ...
0.0
-1