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 |
|---|---|---|---|---|---|---|
Converts dates to UTC time zone and strips time zone info. Date objects can be time zone aware. If the input date objects are time zone aware, they are converted to UTC time and then the time zone info is removed from the resulting object. If inputs dates are not time zone aware, no conversion occurs. Therefore, care s... | def _dates_to_naive_utc(date_objects):
if len(date_objects) == 0:
return []
naive_dates = []
for date in date_objects:
if date.tzinfo is not None and date.tzinfo.utcoffset(date) is not None:
date = date.astimezone(pytz.utc)
naive_dates.append(date.replace(tzinfo=None))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_utc(self, date):\n if date.tzinfo is not None:\n # date is timezone-aware\n date = date.astimezone(self.tz_utc)\n\n else:\n # date is a naive date: assume expressed in local time\n date = date.replace(tzinfo=self.tz_local)\n # and con... | [
"0.63109857",
"0.62138844",
"0.60326254",
"0.59162396",
"0.5774689",
"0.5677991",
"0.5668629",
"0.55915403",
"0.5523215",
"0.53684163",
"0.536691",
"0.5366553",
"0.5364978",
"0.5358796",
"0.53568125",
"0.5311947",
"0.52993566",
"0.52783865",
"0.52651066",
"0.5239206",
"0.5239... | 0.78315073 | 0 |
is_stair(game_object) Determine if an Object is a Stair. | def is_stair(game_object: GameObject) -> bool:
return CommonObjectTagUtils.has_game_tags(game_object, (
CommonGameTag.BUILD_STAIR,
)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sowing(self, player, move):\n self.state, last_pit = self.sow_step(player, move)\n if last_pit == self.M:\n \"\"\"If the last stone is sowed into the store, then the player gets to take another turn.\"\"\"\n return True\n if last_pit < self.M and self.p_pits(player.in... | [
"0.5229152",
"0.52047473",
"0.51571304",
"0.51517874",
"0.5093505",
"0.50664496",
"0.50493026",
"0.5048549",
"0.49434966",
"0.4929589",
"0.4855209",
"0.48351687",
"0.4821933",
"0.48075777",
"0.47856727",
"0.47453648",
"0.47390804",
"0.46930996",
"0.4685907",
"0.46595797",
"0.... | 0.81663954 | 0 |
The geolocation where the resource lives | def location(self) -> str:
return pulumi.get(self, "location") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(self):\n\t\treturn self.location",
"def get_location(self):\n return self.location",
"def get_location(self):\n return self.location",
"def get_location(self):\r\n return self.__location",
"def get_location(self):\r\n return None",
"def getLocation(self):\n ... | [
"0.8163121",
"0.79995364",
"0.79541063",
"0.7945684",
"0.78367764",
"0.77625895",
"0.77304244",
"0.7681069",
"0.7623996",
"0.7609371",
"0.7609371",
"0.7572579",
"0.75549495",
"0.7547667",
"0.75167984",
"0.7450784",
"0.7426638",
"0.7406368",
"0.7359659",
"0.731013",
"0.7298669... | 0.74196446 | 25 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.7919203",
"0.7919203",
"0.7866512",
"0.7866512",
"0.7866512",
"0.7866512",
"0.7866512",
"0.7708992",
"0.7553709",
"0.72823966",
"0.70586616",
"0.6979125",
"0.6920567",
"0.6870297",
"0.67298734",
"0.67034996",
"0.66536045",
"0.6646457",
"0.6548747",
"0.65427727",
"0.6542772... | 0.6638359 | 37 |
Get a MAK key. | def get_multiple_activation_key(multiple_activation_key_name: Optional[str] = None,
resource_group_name: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetMultipleActivationKeyResult:
__args__ = dict()
__args__['mult... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kms_key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"kms_key\")",
"def kms_key(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"kms_key\")",
"def kms_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"kms_key\")",
"def kms_key_id(self) -> Optiona... | [
"0.715231",
"0.71231276",
"0.697597",
"0.6803758",
"0.6803758",
"0.6803758",
"0.6803758",
"0.6681847",
"0.66007555",
"0.66007555",
"0.66007555",
"0.66007555",
"0.66007555",
"0.65061635",
"0.6477403",
"0.64680123",
"0.63961273",
"0.63961273",
"0.63705236",
"0.63705236",
"0.634... | 0.0 | -1 |
Get a MAK key. | def get_multiple_activation_key_output(multiple_activation_key_name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetMultipleActivat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kms_key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"kms_key\")",
"def kms_key(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"kms_key\")",
"def kms_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"kms_key\")",
"def kms_key_id(self) -> Optiona... | [
"0.71523213",
"0.71231526",
"0.69759935",
"0.68038154",
"0.68038154",
"0.68038154",
"0.68038154",
"0.6681887",
"0.6600807",
"0.6600807",
"0.6600807",
"0.6600807",
"0.6600807",
"0.65060896",
"0.64774245",
"0.6468022",
"0.6396108",
"0.6396108",
"0.6370554",
"0.6370554",
"0.6341... | 0.0 | -1 |
Get a worksheet, create it if it not exists. | def get_worksheet(spreadsheet, name, create_if_non_existant=True, creation_func=None):
for worksheet in spreadsheet.worksheets():
if worksheet.title == name:
return worksheet
if create_if_non_existant:
worksheet = spreadsheet.add_worksheet(title=name, rows="300", cols="10")
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_or_create_worksheet(sh, name):\n try:\n return sh.worksheet(name)\n except WorksheetNotFound:\n return sh.add_worksheet(title=name, rows=1, cols=1)",
"def get_worksheet(sheet_id, sheet_name):\n if (sheet_id, sheet_name) in WORKSHEET_CACHE:\n return WORKSHEET_CACHE[(sheet_id,... | [
"0.85583323",
"0.755549",
"0.73692024",
"0.72347677",
"0.68639153",
"0.67215496",
"0.6513055",
"0.6473003",
"0.64678854",
"0.6251399",
"0.62288326",
"0.6185336",
"0.6129111",
"0.6090783",
"0.60323226",
"0.5988487",
"0.59692043",
"0.59618634",
"0.59570676",
"0.5920709",
"0.588... | 0.8466695 | 1 |
Visualizes input image, segmentation map and overlay view. | def vis_segmentation(image, seg_map):
plt.figure(figsize=(15, 5))
grid_spec = gridspec.GridSpec(1, 4, width_ratios=[6, 6, 6, 1])
plt.subplot(grid_spec[0])
plt.imshow(image)
plt.axis('off')
plt.title('input image')
plt.subplot(grid_spec[1])
seg_image = label_to_color_image(seg_map).astype(np.uint8)
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vis_segmentation(image, seg_map):\r\n plt.figure(figsize=(15, 5))\r\n grid_spec = gridspec.GridSpec(1, 4, width_ratios=[6, 6, 6, 1])\r\n\r\n plt.subplot(grid_spec[0])\r\n plt.imshow(image)\r\n plt.axis('off')\r\n plt.title('input image')\r\n\r\n plt.subplot(grid_spec[1])\r\n seg_image = label_to_color_... | [
"0.69773686",
"0.6961605",
"0.69606674",
"0.6953871",
"0.6872205",
"0.6867784",
"0.68528426",
"0.66746914",
"0.66683316",
"0.6647922",
"0.664309",
"0.66321903",
"0.66207135",
"0.6615741",
"0.6601977",
"0.65702325",
"0.64633095",
"0.6454649",
"0.63971007",
"0.63927853",
"0.638... | 0.69926476 | 0 |
Reads an image from the disk, preprocesses it by subtracting mean etc. and returns a numpy array that's ready to be fed into a Keras model. | def get_preprocessed_image(file_name):
im = np.array(Image.open(file_name)).astype(np.float32)
assert im.ndim == 3, 'Only RGB images are supported.'
im = im - _IMAGENET_MEANS
im = im[:, :, ::-1] # Convert to BGR
img_h, img_w, img_c = im.shape
assert img_c == 3, 'Only RGB images are supported.'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_image(self, image_path):\n\n img = load_img(image_path, target_size=IMAGE_SIZE)\n img_array = img_to_array(img)\n # Create a batch by increase dimensions\n img_array = expand_dims(img_array, 0)\n print(img_array.shape)\n return img_array",
"def _preprocessing... | [
"0.6782465",
"0.675074",
"0.65530956",
"0.6447055",
"0.639356",
"0.63870716",
"0.6343957",
"0.62936145",
"0.62651575",
"0.62571585",
"0.61537045",
"0.61463547",
"0.61273724",
"0.611718",
"0.6111714",
"0.6088507",
"0.60863054",
"0.60856205",
"0.60715735",
"0.6070384",
"0.60182... | 0.55835307 | 95 |
Create a LabKey server context. This context is used to encapsulate properties about the LabKey server that is being requested against. This includes, but is not limited to, the domain, container_path, and if the server is using SSL. | def create_server_context(domain, container_path, context_path=None, use_ssl=True):
server_context = dict(domain=domain, container_path=container_path, context_path=context_path)
if use_ssl:
scheme = 'https'
else:
scheme = 'http'
scheme += '://'
if use_ssl:
session = reques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tls_context_factory():\n\n # Load the server's private key, public X509 certificate, and the certificate authority's X509 certificate\n with open(Configuration.get('tls-ca-cert-location')) as ca_certificate_file:\n ca_certificate = ssl.Certificate.loadPEM(ca_certificate_file.read())\n with open(Co... | [
"0.7055164",
"0.6989442",
"0.6374233",
"0.60733557",
"0.6056455",
"0.59311473",
"0.58339316",
"0.5803383",
"0.5791124",
"0.57495093",
"0.5721766",
"0.5715319",
"0.56801426",
"0.56250155",
"0.55218506",
"0.5479107",
"0.5467897",
"0.5457733",
"0.54099184",
"0.54049236",
"0.5351... | 0.8010613 | 0 |
Set the value of the widget. | def setValue(self, value):
self.setText(str(value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widget.setValue(value)\n elif hasattr(self.widget, \"setCurrentText\"):\n self.widget.setCurrentText(value... | [
"0.83955497",
"0.8014495",
"0.7890145",
"0.7859395",
"0.76262283",
"0.76262283",
"0.76262283",
"0.7600631",
"0.7520371",
"0.74924004",
"0.7447194",
"0.74405336",
"0.74214894",
"0.7402593",
"0.74025804",
"0.7363073",
"0.73580855",
"0.7348609",
"0.7348609",
"0.72762364",
"0.727... | 0.82491106 | 1 |
Replace the protected internal completion highlighting with our own one. | def focusInEvent(self, event):
super(CustomLineEdit, self).focusInEvent(event)
if self.completer() is not None:
# Qt should've automatically connected highlighted() to
# an internal slot, but check just to be sure
recievers = self.completer().getRecievers("highlighted... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __unhighlight(self):\n self.unhighlight()",
"def no_highlight(): #py:no_highlight\n RUR._no_highlight_()",
"def highlightCompletion(self, new_text):\n cursor_pos = self.cursorPosition()\n old_text = self.text()\n self.setText(old_text[:cursor_pos] + new_text[cursor_pos:])\n ... | [
"0.620884",
"0.6189896",
"0.61071616",
"0.6079582",
"0.60765386",
"0.59834635",
"0.579047",
"0.57782495",
"0.5762619",
"0.57580465",
"0.55763954",
"0.5516217",
"0.54941356",
"0.5483085",
"0.5481367",
"0.5461099",
"0.54431254",
"0.54196763",
"0.5412505",
"0.5394195",
"0.538030... | 0.0 | -1 |
Close the underlying stream, making this object essentially unusable. | def close(self):
self._stream.close()
self._stream = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self._raw_stream.close()",
"def close(self):\n if self.closed:\n return\n self._stream.close()\n self._stream = None",
"def close(self) -> None:\n self._stream.close()",
"def _close_stream(self):\n if self.stream:\n try:\n if not... | [
"0.87666523",
"0.8626492",
"0.86139995",
"0.84930205",
"0.83275676",
"0.82925755",
"0.7883505",
"0.7796329",
"0.76084894",
"0.7588718",
"0.7559048",
"0.7500995",
"0.7474182",
"0.74279046",
"0.742778",
"0.7409415",
"0.7387623",
"0.7351476",
"0.73262036",
"0.7319153",
"0.730483... | 0.8718716 | 1 |
Gets the coordinator of this JobJobSummarySummary. The devid of the job engine coordinator. | def coordinator(self):
return self._coordinator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_coordinator_name(self):\n return self.coordinator_name",
"def get_coordinator_name(self):\n return self.coordinator_name",
"def get_coordinator_name(self):\n return self.coordinator_name",
"def get_coordinator_name(hass, entity_id):\n if DATA_SONOS not in hass.data:\n r... | [
"0.720833",
"0.720833",
"0.720833",
"0.551473",
"0.5331341",
"0.53127277",
"0.51840186",
"0.5106076",
"0.50842553",
"0.5042209",
"0.50196046",
"0.49853247",
"0.49718553",
"0.49677223",
"0.49677223",
"0.49425888",
"0.49366054",
"0.49366054",
"0.4909093",
"0.4902433",
"0.489726... | 0.75019664 | 0 |
Gets the down_or_read_only_nodes of this JobJobSummarySummary. Whether the cluster has any down or readonly nodes. These nodes are not considered in the connected property. | def down_or_read_only_nodes(self):
return self._down_or_read_only_nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self):\n all_nodes = json.loads(self.sys_info.response).get('nodes_info')\n online_nodes = [node for node in all_nodes if node[\"infos\"][\"has_error\"] is False]\n return online_nodes",
"def down_or_read_only_nodes(self, down_or_read_only_nodes):\n \n self._down_or_r... | [
"0.62192273",
"0.6164547",
"0.6002429",
"0.590029",
"0.58365923",
"0.5746681",
"0.5603809",
"0.5568467",
"0.55417085",
"0.5515882",
"0.5489998",
"0.5484544",
"0.54499006",
"0.54262835",
"0.54262835",
"0.53958565",
"0.5354737",
"0.5346793",
"0.5334703",
"0.5334703",
"0.5328676... | 0.7644406 | 0 |
Gets the next_jid of this JobJobSummarySummary. The job ID to be assigned to the next job. | def next_jid(self):
return self._next_jid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_jid(self, next_jid):\n \n self._next_jid = next_jid",
"def job_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_id\")",
"def job_id(self):\n return self._job_id",
"def job_id(self):\n return self._properties.get(\"jobReference\", {}).get(\"jobId\")",... | [
"0.630355",
"0.62892795",
"0.6252541",
"0.6139183",
"0.61017835",
"0.6099901",
"0.57676935",
"0.5740165",
"0.57356954",
"0.56897324",
"0.5577801",
"0.55747736",
"0.5560691",
"0.5560691",
"0.5474713",
"0.5464687",
"0.54630053",
"0.54610884",
"0.5406925",
"0.54040223",
"0.53770... | 0.76718 | 0 |
Gets the run_degraded of this JobJobSummarySummary. Whether the job engine would allow most jobs to run even when the cluster is in a degraded state. | def run_degraded(self):
return self._run_degraded | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_is_degraded(self):\n return self._cluster_is_degraded",
"def run_degraded(self, run_degraded):\n \n self._run_degraded = run_degraded",
"def cluster_is_degraded(self, cluster_is_degraded):\n \n self._cluster_is_degraded = cluster_is_degraded",
"def degraded(self... | [
"0.6993051",
"0.6745219",
"0.61320424",
"0.58107734",
"0.5058179",
"0.4966946",
"0.49449915",
"0.4845415",
"0.4787507",
"0.47211966",
"0.4718163",
"0.47109586",
"0.465327",
"0.46105194",
"0.46016052",
"0.45722237",
"0.45722115",
"0.45665228",
"0.45226663",
"0.4518271",
"0.451... | 0.7638305 | 0 |
Gets the stats_ready of this JobJobSummarySummary. Whether the coordinator has recently gathered statistics for all nodes in the cluster. | def stats_ready(self):
return self._stats_ready | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats_ready(self, stats_ready):\n \n self._stats_ready = stats_ready",
"def get_ready(self):\n if self._ready_nodes is None:\n raise ValueError(\"prepare() must be called first\")\n\n # Get the nodes that are ready and mark them\n result = tuple(self._ready_nodes... | [
"0.6522116",
"0.6132502",
"0.599773",
"0.5887249",
"0.58490115",
"0.58366483",
"0.58116716",
"0.5737333",
"0.5710718",
"0.5708667",
"0.569487",
"0.569487",
"0.569487",
"0.569487",
"0.569487",
"0.569487",
"0.569487",
"0.5678756",
"0.56720006",
"0.56576055",
"0.5625804",
"0.5... | 0.7857434 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 24 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Create flask app instance and initialize all extensions | def create_app(config='catalog.config.ProductionConfig'):
# Create app
app = Flask(__name__)
app.config.from_object(config)
# Register blueprints
reg_bps(app)
# Import models (for migration purposes)
from . import Category, Item, AppUser # noqa: F401
# Initialize extensions
db.in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app() -> Flask:\r\n app = Flask(__name__.split('.')[0])\r\n init_config(app)\r\n app.register_blueprint(observer)\r\n app.teardown_appcontext(close_db)\r\n app.cli.add_command(init_db)\r\n\r\n return app",
"def create_app(self):\r\n self.app = Flask(__name__, instance_relative... | [
"0.81295854",
"0.8072099",
"0.80186373",
"0.79721135",
"0.79605925",
"0.79480875",
"0.79352355",
"0.7892048",
"0.78685635",
"0.78309464",
"0.7764575",
"0.7758465",
"0.77464014",
"0.773475",
"0.7728144",
"0.76917374",
"0.7689554",
"0.76843125",
"0.7656328",
"0.7642096",
"0.759... | 0.71957046 | 90 |
Constructs fully connected layer | def _construct_fc_layer(self, fc_dims, input_dim, dropout_p=None):
if fc_dims is None:
self.feature_dim = input_dim
return None
assert isinstance(
fc_dims, (list, tuple)
), 'fc_dims must be either list or tuple, but got {}'.format(
type(fc_dims)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, n_input, n_output, hidden_layer_size, reg):\n self.reg = reg\n self.fulllayer1 = FullyConnectedLayer(n_input, hidden_layer_size)\n self.reglayer1 = ReLULayer()\n self.fulllayer2 = FullyConnectedLayer(hidden_layer_size, n_output)",
"def construct_layer(\n self... | [
"0.71214455",
"0.70721805",
"0.6912691",
"0.656927",
"0.65531135",
"0.65515953",
"0.64806354",
"0.6465731",
"0.6457998",
"0.6439903",
"0.6437516",
"0.6430392",
"0.63707864",
"0.63662404",
"0.6353087",
"0.6352194",
"0.633589",
"0.63272685",
"0.62946653",
"0.62853",
"0.6282676"... | 0.5972497 | 65 |
Sets the from_email of this InlineSignRequest. | def from_email(self, from_email):
self._from_email = from_email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_email_name(self, from_email_name):\n if from_email_name is not None and len(from_email_name) < 1:\n raise ValueError(\"Invalid value for `from_email_name`, length must be greater than or equal to `1`\") # noqa: E501\n\n self._from_email_name = from_email_name",
"def set_from(se... | [
"0.71490955",
"0.70423144",
"0.6609988",
"0.6237223",
"0.6086222",
"0.60435724",
"0.59809273",
"0.587077",
"0.58469975",
"0.57915246",
"0.5705688",
"0.5705688",
"0.5705688",
"0.5705688",
"0.5705688",
"0.5705688",
"0.5705688",
"0.5705688",
"0.5705688",
"0.5705688",
"0.56954956... | 0.7925185 | 0 |
Sets the from_email_name of this InlineSignRequest. | def from_email_name(self, from_email_name):
if from_email_name is not None and len(from_email_name) < 1:
raise ValueError("Invalid value for `from_email_name`, length must be greater than or equal to `1`") # noqa: E501
self._from_email_name = from_email_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_email(self, from_email):\n\n self._from_email = from_email",
"def set_from(self, address):\n if not self.validate_email_address(address):\n raise Exception(\"Invalid email address '%s'\" % address)\n self._from = address",
"def from_name(self, from_name: \"str\"):\n ... | [
"0.75430554",
"0.68975437",
"0.662285",
"0.662285",
"0.6505653",
"0.63153654",
"0.6205249",
"0.5983663",
"0.5826652",
"0.58112776",
"0.56958485",
"0.56200033",
"0.56200033",
"0.5601254",
"0.54769593",
"0.5454366",
"0.5454366",
"0.5454366",
"0.5426273",
"0.54243946",
"0.542439... | 0.7875875 | 0 |
Sets the is_being_prepared of this InlineSignRequest. | def is_being_prepared(self, is_being_prepared):
self._is_being_prepared = is_being_prepared | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prepared(self) -> bool:\n return False",
"def prepare(self):\n self._prepared = True\n return True",
"def is_started(self, is_started):\n\n self._is_started = is_started",
"def synchronous_prepare(self, shared_context):\n shared_context.register_name(self.name)\n ... | [
"0.59339964",
"0.59089345",
"0.5622936",
"0.5308887",
"0.52767426",
"0.51682484",
"0.5022294",
"0.49252945",
"0.4894238",
"0.4885359",
"0.4885359",
"0.4885359",
"0.4885359",
"0.4885359",
"0.4885359",
"0.4885359",
"0.48510832",
"0.48510832",
"0.48422977",
"0.48244268",
"0.4749... | 0.8308525 | 0 |
Sets the prepare_url of this InlineSignRequest. | def prepare_url(self, prepare_url):
if prepare_url is not None and len(prepare_url) < 1:
raise ValueError("Invalid value for `prepare_url`, length must be greater than or equal to `1`") # noqa: E501
self._prepare_url = prepare_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_url(self): \n self.url = self.geturl()",
"def set_url(self, url):\n self.data['url'] = url",
"def set_url(self, url):\n self.url = url",
"def _prepare(self, url):\n pass",
"def url(self, url):\n\n self._url = url",
"def url(self, url):\n\n self._u... | [
"0.55214876",
"0.5463348",
"0.5425251",
"0.54239273",
"0.534008",
"0.534008",
"0.534008",
"0.534008",
"0.534008",
"0.534008",
"0.534008",
"0.5328661",
"0.52864707",
"0.5283839",
"0.52258676",
"0.5118182",
"0.5097283",
"0.5097283",
"0.5097283",
"0.50924194",
"0.5017423",
"0.... | 0.7578876 | 0 |
Sets the redirect_url_declined of this InlineSignRequest. | def redirect_url_declined(self, redirect_url_declined):
if redirect_url_declined is not None and len(redirect_url_declined) < 1:
raise ValueError("Invalid value for `redirect_url_declined`, length must be greater than or equal to `1`") # noqa: E501
self._redirect_url_declined = redirect_ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_declination(self, target_declination):\n self.declination = target_declination\n return self.declination",
"def redirect_url(self, redirect_url):\n\n self._redirect_url = redirect_url",
"def overwrite_url_allowed(self, overwrite_url_allowed):\n\n self._overwrite_url_allowed ... | [
"0.5526843",
"0.5457025",
"0.50646335",
"0.48590958",
"0.48590958",
"0.48119596",
"0.47142872",
"0.4703653",
"0.46872556",
"0.46482304",
"0.46062917",
"0.45839477",
"0.45724005",
"0.45185924",
"0.4473482",
"0.4473482",
"0.44325972",
"0.44257393",
"0.43998575",
"0.4395617",
"0... | 0.83130044 | 0 |
Sets the required_attachments of this InlineSignRequest. | def required_attachments(self, required_attachments):
self._required_attachments = required_attachments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attachments(self, attachments):\n\n self._attachments = attachments",
"def setAddAttachments(self,value):\n self.PDFreactorConfiguration.in1[\"addAttachments\"] = value",
"def multipart_signatures(self, multipart_signatures):\n\n self._multipart_signatures = multipart_signatures",
"d... | [
"0.6331073",
"0.56799483",
"0.5582272",
"0.5558645",
"0.5490356",
"0.5342874",
"0.5322272",
"0.5147525",
"0.50555104",
"0.48898974",
"0.48425114",
"0.48414052",
"0.47442687",
"0.47442687",
"0.47442687",
"0.47442687",
"0.4739692",
"0.47042194",
"0.46866858",
"0.46620476",
"0.4... | 0.8272204 | 0 |
Sets the text_message_verification_locked of this InlineSignRequest. | def text_message_verification_locked(self, text_message_verification_locked):
self._text_message_verification_locked = text_message_verification_locked | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked(self, locked):\n\n self._locked = locked",
"def locked(self, locked):\n\n self._locked = locked",
"def message_text(self, message_text):\n\n self._message_text = message_text",
"def set_status(self, locked=None, exclusive=None):\n self.locked = locked\n self.excl... | [
"0.5671785",
"0.5671785",
"0.5232624",
"0.506285",
"0.4943567",
"0.4904038",
"0.48929828",
"0.46991012",
"0.46806136",
"0.46150777",
"0.45808712",
"0.4577578",
"0.45657316",
"0.45592177",
"0.44928825",
"0.4478287",
"0.4469253",
"0.44658506",
"0.44613397",
"0.4367092",
"0.4347... | 0.8450362 | 0 |
Sets the subject of this InlineSignRequest. | def subject(self, subject):
if subject is not None and len(subject) < 1:
raise ValueError("Invalid value for `subject`, length must be greater than or equal to `1`") # noqa: E501
self._subject = subject | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_subject(self, subject):\n self._subject = subject",
"def subject(self, subject: \"str\"):\n self._attrs[\"subject\"] = subject",
"def subject(self, subject: \"str\"):\n self._attrs[\"subject\"] = subject",
"def subject(self, subject):\n if subject is None:\n rai... | [
"0.7156637",
"0.6929678",
"0.6929678",
"0.68385977",
"0.68385977",
"0.67677873",
"0.67677873",
"0.67677873",
"0.65544796",
"0.64963704",
"0.6314124",
"0.6309927",
"0.6305542",
"0.62812203",
"0.61386514",
"0.59969807",
"0.57735777",
"0.57715356",
"0.57715356",
"0.56887233",
"0... | 0.66941524 | 8 |
Sets the who of this InlineSignRequest. | def who(self, who):
allowed_values = ["m", "mo", "o"] # noqa: E501
if who not in allowed_values:
raise ValueError(
"Invalid value for `who` ({0}), must be one of {1}" # noqa: E501
.format(who, allowed_values)
)
self._who = who | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_sender(self, email=\"\", name=\"\"):\n if not email:\n return\n if not name:\n name = False\n self.from_who = _email.formataddr( (name, email) )",
"def signrequest(self, signrequest):\n\n self._signrequest = signrequest",
"def identity(self) -> str:\... | [
"0.49095002",
"0.48244545",
"0.47681284",
"0.4760247",
"0.47557315",
"0.46751472",
"0.46687397",
"0.46374476",
"0.45989856",
"0.4595249",
"0.45831916",
"0.456357",
"0.4502877",
"0.4479141",
"0.4479141",
"0.4479141",
"0.4479141",
"0.4479141",
"0.4479141",
"0.44711724",
"0.4469... | 0.67821324 | 0 |
Sets the signers of this InlineSignRequest. | def signers(self, signers):
self._signers = signers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signatures(self, signatures):\n\n self._signatures = signatures",
"def signatures(self, signatures):\n\n self._signatures = signatures",
"def sign(self, *signers: Keypair) -> None:\n underlying_signers = [signer.to_solders() for signer in signers]\n self._solders.sign(underlying... | [
"0.5828104",
"0.5828104",
"0.56901044",
"0.5435961",
"0.5406515",
"0.52685606",
"0.5238052",
"0.5195367",
"0.51912147",
"0.5071346",
"0.49853688",
"0.49529383",
"0.49187273",
"0.49178892",
"0.4891831",
"0.48858356",
"0.48256838",
"0.4743959",
"0.4716377",
"0.4716377",
"0.4703... | 0.79512703 | 0 |
Sets the uuid of this InlineSignRequest. | def uuid(self, uuid):
if uuid is not None and len(uuid) < 1:
raise ValueError("Invalid value for `uuid`, length must be greater than or equal to `1`") # noqa: E501
self._uuid = uuid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid(self, uuid: str):\n \n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid: s... | [
"0.68822855",
"0.6830604",
"0.6830604",
"0.6830604",
"0.6830604",
"0.6820175",
"0.65155506",
"0.64573723",
"0.57913506",
"0.57297254",
"0.5513415",
"0.55081826",
"0.53894395",
"0.5326743",
"0.5309133",
"0.5253758",
"0.52434564",
"0.52362216",
"0.5221735",
"0.5189225",
"0.5097... | 0.63436687 | 8 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, InlineSignRequest):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Convert mit.edu domain to uppercase for student emails. The mit.edu domain for user email must be uppercase, i.e. MIT.EDU. | def remap(students):
newx = dict((student_map[k], students[k]) for k in student_map)
# match certs
newx['email'] = newx['email'].replace('@mit.edu', '@MIT.EDU')
return newx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Canonicalize(user, remove_dots=True):\n # Canonicalize.\n user = user.lower()\n if user.find('@') == -1:\n username = user\n domain = 'gmail.com'\n else:\n username, domain = user.split('@')\n\n # Remove dots for gmail.\n if remove_dots and domain == 'gmail.com':\n usernam... | [
"0.648791",
"0.6342229",
"0.62529695",
"0.62509894",
"0.62306",
"0.6200309",
"0.6145216",
"0.61317825",
"0.6119704",
"0.5970376",
"0.5910126",
"0.5900288",
"0.5835981",
"0.58333015",
"0.58200574",
"0.58125216",
"0.5793642",
"0.57159984",
"0.5703023",
"0.56873137",
"0.560023",... | 0.507931 | 85 |
Initializes a new `InputProcessor`. | def __init__(self, image_str, output_size, box):
self._image = tf.image.decode_image(image_str)
self._output_size = output_size
self.box = box
# Parameters to control rescaling and shifting during preprocessing.
# Image scale defines scale from original image to scaled image.
self._image_scale ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize(self) -> None:\n p = self.params\n # We make self.input public so that users can access its methods like\n # IdsToStrings if needed.\n with py_utils.infeed_context_scope(\n infeed_host_index=p.infeed_host_index,\n num_infeed_hosts=p.num_infeed_hosts):\n self.input = p... | [
"0.684686",
"0.62809485",
"0.6261651",
"0.6199086",
"0.6125401",
"0.60438865",
"0.6000519",
"0.5960431",
"0.5950313",
"0.5945167",
"0.5893565",
"0.58462274",
"0.58087903",
"0.57894725",
"0.57887036",
"0.57792896",
"0.57728463",
"0.5755729",
"0.5755729",
"0.5755729",
"0.573774... | 0.0 | -1 |
Clip boxes to fit in an image. | def clip_boxes(self, box):
return tf.clip_by_value(box, 0, self._output_size - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_boxes(boxes, im_shape):\n boxes[:, 0::2]=threshold(boxes[:, 0::2], 0, im_shape[1]-1)\n boxes[:, 1::2]=threshold(boxes[:, 1::2], 0, im_shape[0]-1)\n return boxes",
"def clip_boxes(boxes, im_shape):\n boxes[:, 0::2]=threshold(boxes[:, 0::2], 0, im_shape[1]-1)\n boxes[:, 1::2]=threshold(boxe... | [
"0.77168405",
"0.77168405",
"0.7709",
"0.76939726",
"0.7616198",
"0.75782084",
"0.75539535",
"0.75444335",
"0.75444335",
"0.7526461",
"0.7387389",
"0.7223359",
"0.6994756",
"0.6916766",
"0.6886554",
"0.682508",
"0.68231726",
"0.67816997",
"0.66400963",
"0.66359025",
"0.655429... | 0.682512 | 15 |
returns 1 if player_x's elo is greater than player_y's elo, 0 if they are equal, and 1 otherwise | def PlayerCMP(player_x, player_y):
if player_x.GetElo() > player_y.GetElo():
return -1
elif player_y.GetElo() > player_x.GetElo():
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_lone(self, board):\n res = False\n if (self.player):\n if (self.board.p2vec[0] > board.p2vec[0]):\n res = True\n else:\n if (self.board.p1vec[0] > board.p1vec[0]):\n res = True\n return res",
"def protect_lone(self, board):\... | [
"0.67784774",
"0.6516751",
"0.65028024",
"0.64954036",
"0.64732426",
"0.6463178",
"0.64523065",
"0.637193",
"0.6341214",
"0.6239279",
"0.6235709",
"0.6205643",
"0.61959773",
"0.6164055",
"0.6113578",
"0.6083019",
"0.6079533",
"0.6079533",
"0.6079533",
"0.60643417",
"0.6040075... | 0.83861643 | 0 |
Returns the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.8313066",
"0.82006806",
"0.8049215",
"0.80409706",
"0.8017754",
"0.7999701",
"0.79541886",
"0.7942144",
"0.7942144",
"0.7942144",
"0.7937664",
"0.79287225",
"0.7921711",
"0.790314",
"0.7892264",
"0.7890117",
"0.7878668",
"0.786143",
"0.78528684",
"0.7823523",
"0.7813124",
... | 0.77466476 | 39 |
Get the daily returns series for the given index. The data should be clean of outliers, but may have gaps. | def get_returns(self, dates):
return get_price_returns(self, dates) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_returns(self, df):\n daily_returns = df.copy()\n daily_returns[1:] = (df[1:] / df[:-1].values) - 1\n daily_returns.ix[0] = 0\n return daily_returns",
"def compute_daily_returns(df):\r\n daily_returns = df.copy() # copy given DataFrame to match size and column names\r\n ... | [
"0.65060747",
"0.64147806",
"0.6069805",
"0.6025662",
"0.5932041",
"0.58667696",
"0.58166635",
"0.5783682",
"0.54561037",
"0.5435707",
"0.54058164",
"0.5375462",
"0.53741705",
"0.53688264",
"0.5335095",
"0.5331695",
"0.53299475",
"0.5320976",
"0.53203416",
"0.5317677",
"0.531... | 0.48923922 | 72 |
Get the daily returns series for the given index. The data may have gaps. | def get_returns(self, dates):
return get_price_returns(self, dates) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_returns(self, df):\n daily_returns = df.copy()\n daily_returns[1:] = (df[1:] / df[:-1].values) - 1\n daily_returns.ix[0] = 0\n return daily_returns",
"def compute_daily_returns(df):\r\n daily_returns = df.copy() # copy given DataFrame to match size and column names\r\n ... | [
"0.64617497",
"0.6389897",
"0.63688236",
"0.60601974",
"0.59214056",
"0.5904885",
"0.5882882",
"0.58669084",
"0.5792546",
"0.5611866",
"0.56011474",
"0.5573532",
"0.5552572",
"0.55336833",
"0.5492257",
"0.5480048",
"0.5473815",
"0.5464514",
"0.5439795",
"0.5407457",
"0.538724... | 0.50745517 | 55 |
Returns the AssetFeatureValue for Ticker's Region | def get_region_feature_value(self):
return self._get_region_feature(self.region.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_currency_feature_value(self):\n curr_feature = AssetFeature.Standard.CURRENCY.get_object()\n return AssetFeatureValue.objects.get_or_create(name=self.currency, feature=curr_feature)[0]",
"def _get_region_value(self):\n return self.region_option.get()",
"def get_asset_class_feature_... | [
"0.65504175",
"0.6463786",
"0.6244577",
"0.6244229",
"0.54853904",
"0.5415811",
"0.5356228",
"0.5356228",
"0.5279712",
"0.5171789",
"0.5141221",
"0.51289856",
"0.51195216",
"0.51165247",
"0.5097032",
"0.5075625",
"0.5011445",
"0.49920216",
"0.4983661",
"0.497624",
"0.495569",... | 0.72556514 | 0 |
Merge rows of dataframes sharing same columns but different time points Always Call merge_df_rows before calling merge_df_columns as time has not been set as index yet | def merge_df_rows(dlist):
# Create Dataframe from the dlist files
dframe = concat(dlist, axis=0, join='outer', sort=False)
# Sort the df based on the datetime index
dframe.sort_values(by='Dates', inplace=True)
# Setting Dates as the dataframe index
dframe.set_index(['Dates'], drop=True, inpla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_arrival_and_completion_time(tests_dataframe):\r\n arrival_time_df = tests_dataframe[['time_test_arrives_lab', 'server_size']]\r\n completion_time_df = tests_dataframe[['completion_time', 'server_size']]\r\n arrival_time_df['add'] = 1\r\n completion_time_df['add'] = -1\r\n arrival_time_df =... | [
"0.64737934",
"0.63129",
"0.63089824",
"0.62461466",
"0.61424965",
"0.606746",
"0.58426726",
"0.5839809",
"0.5805417",
"0.57820296",
"0.57442355",
"0.5738902",
"0.5736806",
"0.5703248",
"0.5701888",
"0.5670515",
"0.56461126",
"0.5629244",
"0.5590259",
"0.5539663",
"0.55253905... | 0.5937795 | 6 |
Get a list of all the scores in the contest sorted by highest score first | def get_highscores(self):
return self.filter(active=False, finished=True).order_by("-score") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_scores(scores):\n\treturn sorted(scores, key=lambda sailor: (total_score(sailor), sailor[1][0]))",
"def tiles_by_score(self):\n sorted_list = sorted(self.tiles, key=lambda t: t.score, reverse=True)\n return sorted_list",
"def get_score_list(self, query: list, top_k: int = 0, e: int = 0.5):\n ... | [
"0.71930575",
"0.7183429",
"0.6894874",
"0.68333566",
"0.68333566",
"0.68043464",
"0.6724632",
"0.6677086",
"0.6668303",
"0.66642904",
"0.6659074",
"0.66583294",
"0.6579621",
"0.6472363",
"0.64555347",
"0.6406825",
"0.63937736",
"0.63771224",
"0.63766015",
"0.63754344",
"0.63... | 0.6993149 | 2 |
Get the best score for a specific user | def get_player_best_score(self, player):
return self.get_highscores().filter(player=player).first() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_score():\n\n best_score = db.session.query(func.max(Game.score)).filter(Game.status == \"won\").first()\n score_user = db.session.query(Game.score, User.username).join(User).filter(Game.score == best_score, Game.status == \"won\").first()\n\n return score_user",
"def personal_be... | [
"0.8032995",
"0.74377114",
"0.7329879",
"0.70766807",
"0.704601",
"0.69556904",
"0.6915374",
"0.6909365",
"0.6763855",
"0.6731739",
"0.6689855",
"0.6663839",
"0.656265",
"0.6520514",
"0.65134716",
"0.649368",
"0.6480363",
"0.6479053",
"0.6473915",
"0.64090675",
"0.63944536",
... | 0.7469357 | 1 |
Returns a list of scores from unique participants | def get_unique_highscores(self, num=5):
# Checking if a player should be disqualified.
suspicion = self.get_highscores().values('player').annotate(too_many=Count('suspects')).filter(too_many__gt=1)
emails = []
for sus in suspicion:
emails.append(sus['player'])
# Pur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scores(self):\n return [(self.players[p.get_color()], p.get_score()) for p in self.state.get_players()]",
"def calculate_scores():\n all_people = models.Leaderboard.query.order_by(\n models.Leaderboard.score.desc()).all()\n print(all_people)\n users = []\n scores = []\n for p... | [
"0.6579242",
"0.65287685",
"0.64515144",
"0.63060355",
"0.6198279",
"0.6058903",
"0.6037719",
"0.6022743",
"0.5980288",
"0.58304125",
"0.58076596",
"0.5731889",
"0.5724521",
"0.5717496",
"0.56814533",
"0.5670066",
"0.5624145",
"0.5616387",
"0.56047094",
"0.55938804",
"0.55699... | 0.56533253 | 16 |
Returns an int64_list from a bool / enum / int / uint. | def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result",
"def convertT... | [
"0.68806016",
"0.659591",
"0.646043",
"0.6447361",
"0.63662255",
"0.62898934",
"0.62705195",
"0.6215276",
"0.61031455",
"0.5950929",
"0.5944742",
"0.5901341",
"0.5864068",
"0.5864068",
"0.5856132",
"0.5843577",
"0.58429956",
"0.5830027",
"0.5801629",
"0.57937616",
"0.57937616... | 0.5495083 | 63 |
Render the entire file. Used if there is no _index node. | def build_index(ast):
html = []
blocks = ast['blocks']
for block in blocks:
block_type = block['t']
if block_type == 'Header':
html.append(build_heading(block))
elif block_type == 'Para':
html.append(build_paragraph(block))
return ''.join(html) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self, out_file=None, cur_ind=\"\"):\n output_string = cur_ind\n if self.tag:\n output_string += self.get_opening_tag_string()\n for line in self.content:\n output_string += f\"{line}\"\n if self.tag:\n output_string += f\"</{self.tag}>\"\n ... | [
"0.62041676",
"0.6181641",
"0.6159848",
"0.60903937",
"0.60787255",
"0.60104287",
"0.59838194",
"0.5959387",
"0.5927104",
"0.592234",
"0.592234",
"0.5915054",
"0.59128875",
"0.5895936",
"0.5895936",
"0.5895936",
"0.5895936",
"0.5895936",
"0.5895936",
"0.5895936",
"0.5895936",... | 0.0 | -1 |
returns same function as f except that it uses infinity instead of an error | def safe(f):
def safe_f(*args,**kwargs):
try:
return f(*args,**kwargs)
except:
return float('inf')
return safe_f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe(f):\n def safe_f(*args, **kwargs):\n try:\n return f(*args, **kwargs)\n except:\n return float('inf') # this means infinity in python\n return safe_f",
"def safe(f):\n\n def safe_f(*args, **kwargs):\n try:\n return f(*args, **kwargs)\n ... | [
"0.75938433",
"0.7526544",
"0.72880715",
"0.66787815",
"0.66169935",
"0.65205413",
"0.6517625",
"0.6475382",
"0.6422819",
"0.63815963",
"0.63815963",
"0.63504535",
"0.6347744",
"0.63151926",
"0.6261893",
"0.62522525",
"0.622435",
"0.6223841",
"0.61284554",
"0.6117202",
"0.611... | 0.7194986 | 3 |
Returns the string splitted at the commas. | def split_field_content(cls, string):
if "," in string and not is_rfc1123_datetime(string):
return [s.strip() for s in string.split(",")]
else:
return string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_comma(s):\n return s.split(',')",
"def split_by_comma(s):\n return s.strip().split(\",\")",
"def split(self, text):\n\n return [x.strip() for x in text.split(\",\")]",
"def parse(text):\n # Make sure that there's text to be split\n if text == None:\n return text\n re... | [
"0.8362454",
"0.81512517",
"0.72509426",
"0.7020173",
"0.690957",
"0.6743575",
"0.6694747",
"0.6673437",
"0.65816545",
"0.6576767",
"0.6543221",
"0.64233756",
"0.64190555",
"0.6403164",
"0.6398825",
"0.638837",
"0.63838017",
"0.63495106",
"0.62642896",
"0.62642604",
"0.626067... | 0.5734979 | 60 |
Gated recurrent unit (GRU) with nunits cells. | def __call__(self, inputs, state, scope=None):
with tf.variable_scope(scope or type(self).__name__): # "GRUCell"
with tf.variable_scope("Gates"): # Reset gate and update gate.
# We start with bias of 1.0 to not reset and not udpate.
#pudb.set_trace()
# k1 x k2 x Ox x Oh where k1 x k2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_gru_cell(num_units, dropout):\n cell = tf.nn.rnn_cell.GRUCell(num_units)\n if dropout:\n result = tf.nn.rnn_cell.DropoutWrapper(cell,\n output_keep_prob=1-dropout)\n return result",
"def _initialize_gru_cell(self, num_units):\n return gru_cell.Laye... | [
"0.72178745",
"0.66562533",
"0.6297636",
"0.6271891",
"0.5898856",
"0.5839698",
"0.57064384",
"0.568265",
"0.5672555",
"0.56190634",
"0.56156737",
"0.5609707",
"0.5583975",
"0.55823404",
"0.5548996",
"0.5543328",
"0.55368257",
"0.55104464",
"0.5498484",
"0.5442755",
"0.538439... | 0.48947963 | 99 |
Wraps hidden states in new Tensors, to detach them from their history. | def repackage_hidden(h):
if args.algo == "lstm":
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h)
hidden = []
for i in range(args.nlayers):
if isinstance(h[i], torch.Tensor):
hidden.append(h[i].de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_hidden(hidden: Any) -> Any:\n return apply_to_tensor(hidden, Tensor.detach)",
"def reset_hidden(self, hidden, reset_flags):\n # detach it from history (pytorch mechanics)\n if self.rnn_type in ['lstm', 'mylstm']:\n h = Variable(hidden[0].data)\n c = Variable(hidd... | [
"0.68957293",
"0.6564459",
"0.6440747",
"0.63178086",
"0.62956566",
"0.6183138",
"0.6142068",
"0.6119588",
"0.60283935",
"0.6024268",
"0.6021169",
"0.5987536",
"0.5968863",
"0.5968863",
"0.59320563",
"0.59320563",
"0.59176254",
"0.5888734",
"0.58746004",
"0.5863536",
"0.58478... | 0.61257315 | 8 |
Initialization of attributes describing User profile | def __init__(self, name, surname, phone_number, creation_date):
self.name = name
self.surname = surname
self.phone_number = phone_number
self.creation_date = creation_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_info(self, usrs):\r\n logger.info('Starting set user profile info')\r\n user = choice(usrs)\r\n self.title = user['title']\r\n self.fname = user['fname']\r\n self.lname = user['lname']\r\n self.email = user['email']\r\n self.password = user['password']\... | [
"0.7093697",
"0.6764925",
"0.67467546",
"0.6580944",
"0.6580944",
"0.65644044",
"0.65402955",
"0.6449439",
"0.64160246",
"0.64160246",
"0.64160246",
"0.6414905",
"0.64068645",
"0.63887465",
"0.63887465",
"0.6374525",
"0.6374525",
"0.63667333",
"0.63437325",
"0.6310189",
"0.62... | 0.0 | -1 |
Convert the categorical data to one hot encoding. Return the one hot encoded values | def one_hot_encoding(data):
encoder = LabelEncoder()
y = encoder.fit_transform(data)
return(y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encoding(data):\n\n data_encoded = pd.get_dummies(data)\n\n return data_encoded",
"def pre_process_data(df):\n\n # one-hot encode categorical values\n df = pd.get_dummies(df)\n\n return df",
"def _one_hot_encoder(self):\n ohe = preprocessing.OneHotEncoder()\n ohe.fit(se... | [
"0.8313038",
"0.8071131",
"0.8012639",
"0.79997647",
"0.79836935",
"0.79823995",
"0.79693747",
"0.7911906",
"0.7910052",
"0.786356",
"0.7833818",
"0.7791979",
"0.77748424",
"0.7758039",
"0.7753138",
"0.77400875",
"0.7730037",
"0.77278656",
"0.7673274",
"0.7663526",
"0.7635965... | 0.8384245 | 0 |
Split the data into train and test. Return X_train, y_train, X_test and y_test | def split_data(data, labels):
# Split the data into train and test
X_train, X_test, y_train, y_test = train_test_split(data, labels, test_size=0.30, random_state = 42)
return(X_train, y_train, X_test, y_test) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data(self):\n X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=7)\n\n return X_train, X_test, y_train, y_test",
"def splitData(X, y):\n X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0)\n print(X_train)\n print(y_train... | [
"0.8789011",
"0.8545113",
"0.84777147",
"0.8345044",
"0.83238024",
"0.82979685",
"0.8261183",
"0.8173166",
"0.804516",
"0.8009218",
"0.79945934",
"0.7855552",
"0.7794865",
"0.7793166",
"0.7730069",
"0.7711613",
"0.77094024",
"0.76816845",
"0.76813275",
"0.7676122",
"0.7645185... | 0.7906124 | 11 |
Add MeshDescriptorRecord to the Trie and return the index of the heading. | def add(self, descriptor_record: MeshDescriptorRecord) -> int:
# convert heading to index
index = self._mesh_indexer.add(descriptor_record.heading)
# add entries to the trie
for entry in descriptor_record.entries:
tokens = self._keyword_tokenizer(entry)
self._add_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMeshIndex(gltf, idname):\n\n if gltf.get('meshes') is None:\n return -1\n\n index = 0\n for mesh in gltf['meshes']:\n key = 'id' if mesh.get('id') != None else 'name'\n if mesh.get(key) == idname:\n return index\n\n index += 1\n\n return -1",
"def _index(... | [
"0.5172757",
"0.49835277",
"0.4857236",
"0.48091388",
"0.47822925",
"0.4762819",
"0.4713355",
"0.46882272",
"0.46710342",
"0.46335602",
"0.462567",
"0.46256226",
"0.46067283",
"0.4599634",
"0.45840073",
"0.45589313",
"0.4519971",
"0.4516436",
"0.45162463",
"0.45112824",
"0.44... | 0.84066385 | 0 |
Check if the user is an administrator | def is_user_admin(request):
return request.user.is_superuser | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_admin() -> bool:\n return ctypes.windll.shell32.IsUserAnAdmin() == 1",
"def user_is_admin(user):\n return user in admins",
"def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_admin == 'YES':\n return True\n return False",
"def is_admin(user... | [
"0.8409828",
"0.83780867",
"0.83306724",
"0.8329314",
"0.8307779",
"0.82350475",
"0.8226279",
"0.81790906",
"0.81689984",
"0.81689984",
"0.81563675",
"0.80803025",
"0.80659443",
"0.80418634",
"0.80371857",
"0.8019829",
"0.7984005",
"0.7983276",
"0.79658115",
"0.79435253",
"0.... | 0.78197545 | 31 |
This method fetches the releases with the given release name. This method returns hpfortify.model.release.Release object if it successfully find it. Otherwise it returns None. | def get_release_by_application_and_release_name(self,
application_id,
release_name):
releases = self.get_releases_by_application(application_id)
if not releases.items:
return None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def fetch_data(self) -> GitHubReleaseModel | None:\n result = await self._client.repos.releases.list(\n self.repository, **{\"params\": {\"per_page\": 1}}\n )\n if not result.data:\n return None\n\n for release in result.data:\n if not release.prer... | [
"0.6965955",
"0.6360808",
"0.63598394",
"0.61267346",
"0.61146003",
"0.6017262",
"0.59895724",
"0.58955795",
"0.5799538",
"0.5694379",
"0.56522053",
"0.5633887",
"0.5626386",
"0.55629927",
"0.5560506",
"0.54625106",
"0.5432527",
"0.5412599",
"0.53770626",
"0.5358031",
"0.5347... | 0.7593866 | 0 |
Receives a filename and returns it's parsed JSON object. | def load(filename):
data_file = open('configuration/%s.json' % filename, 'r')
data = json.load(data_file, 'UTF-8')
data_file.close()
del data_file
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json(filename) :\n result = json.load(open(filename,'r'))\n return result",
"def get_json(filename):\n with open(filename) as f:\n file_content = f.read()\n data = json.loads(file_content)\n return data",
"def json_from_file(name):\n with open(name) as f_p... | [
"0.8188549",
"0.81703484",
"0.80365056",
"0.80318636",
"0.79612917",
"0.7915693",
"0.79094255",
"0.78997654",
"0.78764385",
"0.7797573",
"0.7789602",
"0.7750123",
"0.7745128",
"0.7706866",
"0.76533425",
"0.7638875",
"0.76342356",
"0.76228523",
"0.7595001",
"0.7541091",
"0.752... | 0.0 | -1 |
Returns the hashed path to the device. | def _get_device_path(self, connection_info):
mount_path = self._get_mount_path(connection_info)
return os.path.join(mount_path, connection_info['data']['name']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_path(self):\n return self._engine.device_path()",
"def device_path(self):\n return self._device_path",
"def _get_mount_path(self, connection_info):\n share = self._normalize_export(connection_info['data']['export'])\n return os.path.join(self._get_mount_point_base(),\n ... | [
"0.759163",
"0.73704904",
"0.6857122",
"0.6753061",
"0.6705155",
"0.6571093",
"0.65451086",
"0.6464489",
"0.6359992",
"0.6310782",
"0.6305917",
"0.6282682",
"0.6268923",
"0.62114817",
"0.61962295",
"0.61941296",
"0.6189533",
"0.6167375",
"0.6147204",
"0.6144681",
"0.6120219",... | 0.6823054 | 3 |
Get a tensor of padding values fitting input_dataset_types. Here we pad everything with 0. and the labels with `label_padding`. This allows us to be able to recognize them later during the evaluation, even when the values have already been padded into batches. | def get_padding_values(input_dataset_types, label_padding=-100):
def map_to_zero(dtypes):
if isinstance(dtypes, Sequence):
return tuple((map_to_zero(d) for d in dtypes))
return tf.cast(0., dtypes)
def map_to_label_padding(dtypes):
if isinstance(dtypes, Sequence):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _padding(inputs, paddings, data_format):\n if data_format == 'channels_first':\n padded_inputs = tf.pad(\n inputs, [[0, 0], [0, 0], paddings, paddings])\n else:\n padded_inputs = tf.pad(\n inputs, [[0, 0], paddings, paddings, [0, 0]])\n return padded_inputs",
"def fixed_padding(inputs,... | [
"0.7296566",
"0.7160678",
"0.71605045",
"0.71293366",
"0.7114984",
"0.711345",
"0.70754325",
"0.69587994",
"0.693802",
"0.6720703",
"0.6720703",
"0.6688067",
"0.6594272",
"0.65566427",
"0.654704",
"0.6545616",
"0.64831114",
"0.644202",
"0.639219",
"0.63649595",
"0.6364736",
... | 0.8698094 | 0 |
Return a user by their user_id (primary key). | def get_user_by_id(user_id):
return User.query.get(user_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_from_id(user_id):\n return Users.query.filter_by(id=user_id).first()",
"def get_user_by_id(user_id):\n return User.query.get(user_id)",
"def user_by_id(user_id):\n user = User.query.filter(User.id == user_id).one_or_none()\n return user",
"def get_user_by_id(user_id):\n\n ... | [
"0.88882875",
"0.88726944",
"0.8745639",
"0.86431366",
"0.8544923",
"0.8453578",
"0.8333495",
"0.832174",
"0.8316682",
"0.82876354",
"0.8228262",
"0.8160372",
"0.8157334",
"0.8153439",
"0.81411284",
"0.81137854",
"0.8101837",
"0.80909085",
"0.80745125",
"0.8038877",
"0.802280... | 0.878707 | 2 |
Testing method for subtract function | def test_subtract(self):
self.assertEqual(work_file.subtract(10, 5), 5)
self.assertEqual(work_file.subtract(-1, 1), -2)
self.assertEqual(work_file.subtract(-1, -1), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_minus(self):\n self.assertEqual(1, minus(3, 2))",
"def test_minus(self):\n print('test_minus');\n self.assertEqual(90, minus(100, 10))",
"def test_subtract_numbers(self):\n self.assertEqual(subtract(8, 4), 4)",
"def test_minus(self):\n self.assertEqual(1, foo.minus... | [
"0.8548578",
"0.84389234",
"0.8385235",
"0.83704895",
"0.83399546",
"0.83399546",
"0.8151226",
"0.810925",
"0.8074579",
"0.8023553",
"0.795466",
"0.78035593",
"0.77778685",
"0.77718747",
"0.7766856",
"0.7755882",
"0.77466536",
"0.7592455",
"0.7592455",
"0.7576524",
"0.7522026... | 0.8752008 | 0 |
Remove multiple occurrence of whitespaces | def remove_extra_space(text):
text = " ".join(text.split())
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeMultipleSpaces(self) -> None:\n self.text = re.sub('\\s+', ' ', self.text)",
"def clean_text_from_multiple_consecutive_whitespaces(text):\n multi_space_regex = re.compile(r\"\\s+\", re.IGNORECASE)\n return re.sub(multi_space_regex, ' ', text)",
"def remove_excess_white_space(lines: str):... | [
"0.8064215",
"0.76848936",
"0.75239784",
"0.74364334",
"0.73882586",
"0.73784876",
"0.73782593",
"0.73726726",
"0.7358921",
"0.7317453",
"0.7314051",
"0.7314051",
"0.73018545",
"0.7286673",
"0.7271895",
"0.72276723",
"0.7221731",
"0.7217421",
"0.7161206",
"0.71462345",
"0.712... | 0.69936424 | 30 |
Turn Sonoff switch on. | def turn_on(self, **kwargs):
set_sonoff_state(self._host, "on")
self._state = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n print(\"Turning the lights off\")\n self.led.all_off()\n self.client.publish(STATE_TOPIC, OFF) #publish",
"def turn_off(self):\n self._interrupt_flash()\n if self.on:\n GPIO.output(self.pin, GPIO.LOW)\n self.on = False",
"def force_... | [
"0.79153925",
"0.78892285",
"0.784958",
"0.7782307",
"0.7781982",
"0.7771544",
"0.77669144",
"0.76522297",
"0.76459706",
"0.76019764",
"0.75788075",
"0.7575575",
"0.75267017",
"0.7453857",
"0.7448788",
"0.74181783",
"0.7408253",
"0.7399077",
"0.73916256",
"0.7363076",
"0.7357... | 0.7746898 | 7 |
Turn Sonoff switch off. | def turn_off(self, **kwargs):
set_sonoff_state(self._host, "off")
self._state = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n print(\"Turning the lights off\")\n self.led.all_off()\n self.client.publish(STATE_TOPIC, OFF) #publish",
"def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF",
"def turn_off(self):\n GPIO.output(self.gpio, False) # turn off lig... | [
"0.8601742",
"0.83966696",
"0.83761746",
"0.82690513",
"0.82507664",
"0.82157314",
"0.81544524",
"0.8152052",
"0.8099878",
"0.8097967",
"0.8094674",
"0.808785",
"0.80836385",
"0.8047935",
"0.7973641",
"0.7970453",
"0.79395866",
"0.7939511",
"0.7929795",
"0.7925019",
"0.791691... | 0.85457575 | 1 |
This method decrements the Player's current hp. | def take_damage(self):
if self.cur_hp > 0:
self.cur_hp -= 1
self.hp_rect.width = (self.cur_hp / self.max_hp) * self.hp_bar_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encounter_decrease_hp():\n\n global character\n character['HP'] -= randint(1, 6)",
"def decrease(self):\n self.score -= self.score",
"def flee_decrease_hp():\n\n global character\n character['HP'] -= randint(1, 4)",
"def deal_damage(self, damage):\n # Another cool trick\n ... | [
"0.6815941",
"0.6618283",
"0.65629536",
"0.65163374",
"0.6467314",
"0.64093095",
"0.63478285",
"0.6321201",
"0.63064396",
"0.62977475",
"0.62625885",
"0.6168504",
"0.61446285",
"0.61005896",
"0.6050114",
"0.6027342",
"0.6012715",
"0.59528834",
"0.59158343",
"0.5912646",
"0.58... | 0.63085014 | 8 |
This method restores the Player's current hp. | def restore_hp(self):
if self.cur_hp < self.max_hp:
self.cur_hp += 1
self.hp_rect.width = (self.cur_hp / self.max_hp) * self.hp_bar_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_hp():\n\n global character\n character['HP'] = 10",
"def reset_stats(self):\n print(\"Reseting stats\")\n self.player_lives = self.ai_stts.player_lives\n self.score = 0\n self.level = 1",
"def reset_hands(self):\r\n\r\n self.player_rock = False\r\n self... | [
"0.69104165",
"0.657597",
"0.64727867",
"0.6448683",
"0.6412127",
"0.64039445",
"0.6363952",
"0.63415855",
"0.6315216",
"0.6293629",
"0.6281429",
"0.62266135",
"0.62077194",
"0.6195492",
"0.61692387",
"0.61679065",
"0.61530083",
"0.6131857",
"0.6078579",
"0.60771203",
"0.6052... | 0.7052053 | 0 |
Returns the entire contents of the file. | def read(self):
self.file.seek(0)
return self.file.read().strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents(file):\n with open(file) as f:\n return f.read()",
"def read_content(self):\n return self.file.read()",
"def get_file_contents(filename):\n with open(filename, 'r') as f:\n content = f.read()\n return content",
"def contents(self):\n if not self._contents:\n ... | [
"0.8337061",
"0.77541864",
"0.77443355",
"0.7601524",
"0.7533258",
"0.7516487",
"0.75101477",
"0.7472385",
"0.74361813",
"0.7345254",
"0.7328623",
"0.72962177",
"0.72707963",
"0.72646356",
"0.7264359",
"0.7262507",
"0.7260711",
"0.7238435",
"0.72364455",
"0.7171483",
"0.71690... | 0.7396712 | 9 |
Computes the accuracy over the k top predictions for the specified values of k | def accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).floa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.83311",
"0.8286288",
"0.8239192",
"0.82308143",
"0.8221246",
"0.81875855",
"0.81859523",
"0.81764203",
"0.817261",
"0.81711614",
"0.8167704",
"0.8165669",
"0.8164918",
"0.8163395",
"0.8163395",
"0.8163395",
"0.8163395",
"0.8163395",
"0.8163395",
"0.8163395",
"0.8163395",
... | 0.7862585 | 72 |
Check for new fragments on a branch. | def _main(compare_with: str | None, directory: str | None, config: str | None) -> None:
__main(compare_with, directory, config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_newsfragmentAdded(self):\n runCommand([\"git\", \"checkout\", \"-b\", \"quotefile\"], cwd=self.repo.path)\n\n newsfragments = self.repo.child(\"twisted\").child(\"newsfragments\")\n newsfragments.makedirs()\n fragment = newsfragments.child(\"1234.misc\")\n fragment.setCo... | [
"0.61005807",
"0.60174054",
"0.57217854",
"0.56599224",
"0.56198",
"0.55788493",
"0.5497985",
"0.54125375",
"0.5385355",
"0.53587717",
"0.53460413",
"0.53447753",
"0.5321152",
"0.52912647",
"0.5253468",
"0.52392316",
"0.5221624",
"0.52046174",
"0.51986533",
"0.5158686",
"0.51... | 0.0 | -1 |
Recreates a relative URL by adding back parst that were pased via urlparse(). The protocol and domain are ignored. | def recreate_rel_url(url, parsed):
if parsed.query:
url = u'%s?%s' % (url, parsed.query)
if parsed.fragment:
url = u'%s#%s' % (url, parsed.fragment)
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fix_url(self, curr_url, rel):\n\n rel_l = rel.lower()\n if rel_l.startswith(\"http://\") or rel_l.startswith(\"https://\"):\n curr_url, rel = rel, \"\"\n\n # compute the new url based on import\n curr_url = urlparse.urldefrag(curr_url)[0]\n parsed_url = urlparse.u... | [
"0.676564",
"0.6549058",
"0.6506792",
"0.643366",
"0.64262813",
"0.6395709",
"0.63513553",
"0.6323319",
"0.628508",
"0.6269043",
"0.6233656",
"0.6227353",
"0.6192184",
"0.6107202",
"0.60733944",
"0.6070818",
"0.6066983",
"0.60605353",
"0.60521275",
"0.60421795",
"0.6039952",
... | 0.71438575 | 0 |
Returns True if the requesting user is the owner of the object as determined by the "owner_field" property on the view. If no "owner_field" is given, the object itself is assumed to be the User object. | def has_object_permission(self, request, view, obj):
owner_field = getattr(view, "owner_field", None)
if owner_field is None:
# if no owner_field is specified, the object itself is compared
owner = obj
else:
# otherwise we lookup the owner by the specified fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_user_is_owner(self):\n return self._tag == 'user_is_owner'",
"def is_owner_or_privileged_user(obj_user, request):\n return (\n obj_user == request.user or request.user.is_superuser or is_admin_user(request)\n )",
"def isowner(self, o):\n return self._owner is o",
"def is_own... | [
"0.79866135",
"0.78781176",
"0.77176714",
"0.7695915",
"0.7673353",
"0.7356949",
"0.73254293",
"0.72564864",
"0.7253681",
"0.7201272",
"0.71545863",
"0.7130197",
"0.7126985",
"0.71105146",
"0.7063843",
"0.7058158",
"0.69858193",
"0.69840354",
"0.6969802",
"0.6937035",
"0.6936... | 0.82767034 | 0 |
Returns True if the requesting user is admin or the owner of the object as determined by the "owner_field" property on the view. If no "owner_field" is given, the object itself is assumed to be the User object. | def has_object_permission(self, request, view, obj):
if request.user and (request.user.is_staff or request.user.is_superuser):
return True
return super().has_object_permission(request, view, obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_owner_or_privileged_user(obj_user, request):\n return (\n obj_user == request.user or request.user.is_superuser or is_admin_user(request)\n )",
"def has_object_permission(self, request, view, obj):\n owner_field = getattr(view, \"owner_field\", None)\n\n if owner_field is None:\... | [
"0.8082595",
"0.79040504",
"0.74926674",
"0.7465419",
"0.73607403",
"0.72378016",
"0.7185559",
"0.71684676",
"0.7162699",
"0.71342385",
"0.71019924",
"0.70937806",
"0.70466614",
"0.7046343",
"0.7031456",
"0.7022783",
"0.7000821",
"0.6998329",
"0.6994597",
"0.69270223",
"0.688... | 0.6962536 | 19 |
This function will return a random datetime between two datetime objects. | def random_date(start, end):
delta = end - start
int_delta = (delta.days * 24 * 60 * 60) + delta.seconds
random_second = randrange(int_delta)
return start + timedelta(seconds=random_second) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_date(start, end):\r\n return start + datetime.timedelta(\r\n # Get a random amount of seconds between `start` and `end`\r\n seconds=random.randint(0, int((end - start).total_seconds())),\r\n )",
"def random_date(start, end):\r\n delta = end - start\r\n int_delta = (delta.days... | [
"0.77918494",
"0.75647223",
"0.7562488",
"0.754578",
"0.75309545",
"0.7405053",
"0.7334951",
"0.7235134",
"0.7207752",
"0.7169905",
"0.6945745",
"0.6864313",
"0.67521274",
"0.66044766",
"0.6574501",
"0.6525121",
"0.6248982",
"0.6201766",
"0.6185233",
"0.6137791",
"0.60238856"... | 0.7509593 | 7 |
Creates a range of default values with the same shape as the input `old_values`. If `value` is provided then each entry will equal `value`; if `upper` is provided then the values will be linearlyspaced from 0 to `upper`. | def _default_values_like(old_values, value=None, upper=None):
if value and upper:
raise ValueError("Only one of `value` or `upper` may be proivded.")
elif value is not None:
lower = value
upper = value
elif upper is not None:
lower = 0.
else:
raise ValueError("Eit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_maker(low, hi, step, lst=None):\n return numpy.arange(low, hi, step)",
"def map_to_range(val, old_min, old_max, new_min, new_max):\n return new_max - (val - old_min) * (new_max - new_min) / (old_max - old_min)",
"def add_default_bounds_to_params(params):\n defaults = pd.DataFrame(\n {... | [
"0.60676986",
"0.57373446",
"0.57271016",
"0.5710939",
"0.55727404",
"0.53398377",
"0.5314642",
"0.5269801",
"0.52677095",
"0.52563643",
"0.52563643",
"0.52563643",
"0.52563643",
"0.5249432",
"0.5245608",
"0.5227784",
"0.5214647",
"0.51958394",
"0.5195414",
"0.5192174",
"0.51... | 0.8552349 | 0 |
Return continued fraction expansion of x as iterator. Examples ======== >>> from sympy import Rational, pi >>> from sympy.ntheory.continued_fraction import continued_fraction_iterator >>> list(continued_fraction_iterator(Rational(3, 8))) [0, 2, 1, 2] >>> list(continued_fraction_iterator(Rational(3, 8))) [1, 1, 1, 1, 2] | def continued_fraction_iterator(x):
from sympy.functions import floor
while True:
i = floor(x)
yield i
x -= i
if not x:
break
x = 1/x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def continued_fraction_convergents(cf):\n if isinstance(cf, list) and isinstance(cf[-1], list):\n cf = itertools.chain(cf[:-1], itertools.cycle(cf[-1]))\n p_2, q_2 = S.Zero, S.One\n p_1, q_1 = S.One, S.Zero\n for a in cf:\n p, q = a*p_1 + p_2, a*q_1 + q_2\n p_2, q_2 = p_1, q_1\n ... | [
"0.68502873",
"0.6474627",
"0.63758665",
"0.6374685",
"0.58863276",
"0.58730966",
"0.58052075",
"0.57150084",
"0.5323514",
"0.52921206",
"0.5176059",
"0.509796",
"0.5072486",
"0.5052207",
"0.5030303",
"0.4996593",
"0.49558488",
"0.49032673",
"0.48190796",
"0.48157075",
"0.478... | 0.8470982 | 0 |
Create a new `Application` object. | def __init__(self, application, data):
self.application = application
self.data = data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n app = create_app()\n return app",
"def get_app(self):\n return Application()",
"def app():\n return create_app()",
"def create_app():\n app = Flask(__name__)\n app.config.from_object('app.configs.config')\n app.config.from_object('app.configs.settings')\n return app",... | [
"0.7776222",
"0.7593236",
"0.7479403",
"0.7457028",
"0.7401555",
"0.735371",
"0.71856785",
"0.7181076",
"0.7179833",
"0.71481174",
"0.7131553",
"0.7122778",
"0.71041477",
"0.70735216",
"0.7068481",
"0.7024653",
"0.7019096",
"0.7012947",
"0.7008244",
"0.7004476",
"0.699942",
... | 0.0 | -1 |
Check if a VBA object is a procedure, e.g. a Sub or a Function. This is implemented by checking if the object has a statements attribute | def is_procedure(vba_object):
if hasattr(vba_object, 'statements'):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isroutine(object):\r\n return (isbuiltin(object)\r\n or isfunction(object)\r\n or ismethod(object)\r\n or ismethoddescriptor(object))",
"def is_procedure(procedure):\n return isa(procedure,Procedure) or isa(procedure,type(max)) or isa(procedure,type(tostr))",
"def ism... | [
"0.7501533",
"0.73652065",
"0.65750307",
"0.6441875",
"0.60337204",
"0.600782",
"0.5910698",
"0.5866906",
"0.58418006",
"0.58091414",
"0.58006114",
"0.5788862",
"0.5746967",
"0.57400775",
"0.5730062",
"0.56991917",
"0.56709796",
"0.56702113",
"0.565055",
"0.56181973",
"0.5583... | 0.87175906 | 0 |
Replacement for str.lstrip (support for arbitrary chars to strip was added in Python 2.2.2). | def lstrip(s, ch):
i = 0
try:
while s[i] == ch:
i = i+1
return s[i:]
except IndexError:
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lstrip(string):\n return \"\\n\".join(map(str.lstrip, string.split(\"\\n\")))",
"def lstrip(self) -> String:\n pass",
"def LTrim(text):\n return str(text).lstrip()",
"def lstrips(text, remove):\r\n return _strips('l', text, remove)",
"def strip(s, ch):\n return lstrip(rstrip(s, ch), ch)"... | [
"0.7715777",
"0.76825374",
"0.7490925",
"0.7426292",
"0.72494376",
"0.7109801",
"0.70981556",
"0.6984771",
"0.69774735",
"0.6876167",
"0.6782354",
"0.66349643",
"0.6620854",
"0.6513064",
"0.64810306",
"0.63978547",
"0.63811684",
"0.63337487",
"0.6266742",
"0.6266742",
"0.6239... | 0.73588604 | 4 |
Replacement for str.rstrip (support for arbitrary chars to strip was added in Python 2.2.2). | def rstrip(s, ch):
try:
if s[-1] != ch:
return s
i = -2
while s[i] == ch:
i = i-1
return s[:i+1]
except IndexError:
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe_rstrip(value, chars=None):\n if not isinstance(value, six.string_types):\n LOG.warn(_(\"Failed to remove trailing character. Returning original \"\n \"object. Supplied object is not a string: %s,\") % value)\n return value\n\n return value.rstrip(chars) or value",
"... | [
"0.7969051",
"0.7554667",
"0.751441",
"0.720524",
"0.7177137",
"0.7074161",
"0.70446825",
"0.6984054",
"0.6839213",
"0.68116695",
"0.67390853",
"0.66986185",
"0.66696125",
"0.6614789",
"0.6609401",
"0.6589626",
"0.6588726",
"0.65877634",
"0.6473628",
"0.6436712",
"0.64211434"... | 0.69910526 | 7 |
Replacement for str.strip (support for arbitrary chars to strip was added in Python 2.2.2). | def strip(s, ch):
return lstrip(rstrip(s, ch), ch) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _strip(s, chars):\n # leading characters\n while len(s) > 0 and s[0] in chars:\n s = s[1:]\n # trailing characters\n while len(s) > 0 and s[-1] in chars:\n s = s[:-1]\n return s",
"def strip(value):\n return value.strip()",
"def strip(s):\n parser = StrippingParser( )\n ... | [
"0.7934274",
"0.7529356",
"0.736453",
"0.72836757",
"0.7222347",
"0.71677953",
"0.7160838",
"0.7150042",
"0.7150042",
"0.7024283",
"0.6956732",
"0.6939192",
"0.6930252",
"0.6902295",
"0.6839182",
"0.67761844",
"0.6775651",
"0.6767332",
"0.67222",
"0.67179686",
"0.6706687",
... | 0.7373261 | 2 |
Like str.rsplit, which is Python 2.4+ only. | def rsplit(s, sep, maxsplits=0):
L = s.split(sep)
if not 0 < maxsplits <= len(L):
return L
return [sep.join(L[0:-maxsplits])] + L[-maxsplits:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsplit(self) -> List[String]:\n pass",
"def _rsplit(value, sep, maxsplit=None):\n\tstr_parts = value.split(sep)\n\tif (maxsplit is not None) and (len(str_parts) > 1):\n\t\treturn [str.join(sep, str_parts[:-maxsplit])] + str_parts[-maxsplit:]\n\treturn str_parts",
"def rsplit(self, sep=None, maxsplit=Non... | [
"0.76516366",
"0.72858334",
"0.68323326",
"0.6695672",
"0.63246506",
"0.6302219",
"0.6297041",
"0.6022147",
"0.55695194",
"0.5518688",
"0.55005395",
"0.54807407",
"0.54739666",
"0.53382",
"0.5323219",
"0.53196037",
"0.52974504",
"0.52974504",
"0.529051",
"0.52700794",
"0.5258... | 0.69990665 | 2 |
Formats the hash PROPS as a string suitable for use as a Subversion property value. | def format_merge_props(props, sep=" "):
assert sep in ["\t", "\n", " "] # must be a whitespace
props = props.items()
props.sort()
L = []
for h, r in props:
L.append("%s:%s" % (h, r))
return sep.join(L) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_nuget_properties_str(properties):\n properties_strings = [str(k) + \"=\" + str(v) for (k, v) in properties.items()] # key=value\n # Sorted is used to preserve consistency between python 2.7 and 3.6, mainly for unit testing purposes\n properties_joined = \";\".join(reversed(properti... | [
"0.6242399",
"0.62407875",
"0.60268795",
"0.60022044",
"0.5950696",
"0.5904555",
"0.5893137",
"0.5860003",
"0.58344847",
"0.5834266",
"0.58154297",
"0.58108836",
"0.57794213",
"0.5761595",
"0.57605964",
"0.5728315",
"0.57085717",
"0.569367",
"0.56849164",
"0.5673128",
"0.5670... | 0.57216585 | 16 |
check whether a string exists in the trie | def search(self, word, node=None):
if not word:
for child in node.children:
if child.value == '*':
# word exists
return True
return False
if not node:
node = self.root
for child in node.children:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_word(trie, string: str) -> bool:\n return any(w == string for w in trie)",
"def test_contains_returns_true_when_word_in_trie(full_trie):\n assert full_trie.contains(\"hey\") is True",
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter i... | [
"0.7621465",
"0.73859304",
"0.73689294",
"0.73325956",
"0.7283691",
"0.7248632",
"0.72143865",
"0.71714437",
"0.7118658",
"0.70904016",
"0.705206",
"0.70503205",
"0.70216393",
"0.69572294",
"0.6931237",
"0.68769515",
"0.68564576",
"0.6847999",
"0.68413717",
"0.68360674",
"0.6... | 0.6180271 | 82 |
Identifies and extracts numbers out of a string, returning them as a list of integers. find_numbers(str) > list(int) | def find_numbers(text):
result = []
for word in text.split():
if word.isdigit():
result.append(int(word))
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_numbers(text):\n # -------------------------------------------------------------------------\n # Notice how expressive the list comprehension syntax is, in that it sounds\n # almost exactly the same as you would describe the problem in English.\n # I.e.\n # Convert each word to an integer... | [
"0.7942036",
"0.7605862",
"0.7246109",
"0.7227477",
"0.71593505",
"0.6838847",
"0.6707374",
"0.6681018",
"0.6647798",
"0.6555034",
"0.6548739",
"0.65330696",
"0.65306044",
"0.6415865",
"0.63655597",
"0.63564783",
"0.6295638",
"0.6286983",
"0.6286658",
"0.6234296",
"0.623069",... | 0.80343115 | 0 |
Identifies and extracts numbers out of a string, returning them as a list of integers. find_numbers(str) > list(int) | def find_numbers(text):
# -------------------------------------------------------------------------
# Notice how expressive the list comprehension syntax is, in that it sounds
# almost exactly the same as you would describe the problem in English.
# I.e.
# Convert each word to an integer, for ever... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_numbers(text):\n result = []\n for word in text.split():\n if word.isdigit():\n result.append(int(word))\n return result",
"def get_numbers(string:str, type_=\"int\") -> list:\n \n num_list = []\n for word in string.split():\n if type_ == \"int\":\n ... | [
"0.8034113",
"0.7605442",
"0.7244985",
"0.72268987",
"0.7159115",
"0.6840973",
"0.6708091",
"0.66814226",
"0.66487366",
"0.655355",
"0.6548199",
"0.6532053",
"0.6532038",
"0.6416996",
"0.6367404",
"0.63583326",
"0.62957704",
"0.6285691",
"0.6285642",
"0.623295",
"0.6232284",
... | 0.79416275 | 1 |
Function to split a string over a comma. separate_comma(str) > list(str) | def separate_comma(s):
return s.split(',') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_by_comma(s):\n return s.strip().split(\",\")",
"def split_by_comma_and_whitespace(s):\r\n return re.split(r'[\\s,]+', s)",
"def split_by_comma_and_whitespace(a_str):\r\n return re.split(r'[\\s,]', a_str)",
"def split_value(string):\n split = string.split(',')\n result = []\n\n level = 0... | [
"0.84582543",
"0.741952",
"0.7381286",
"0.7374586",
"0.7227277",
"0.71898735",
"0.71592087",
"0.71261436",
"0.7119296",
"0.71004915",
"0.7083506",
"0.7028268",
"0.7006084",
"0.70057094",
"0.7005276",
"0.6988248",
"0.6987602",
"0.69724643",
"0.69636893",
"0.69455755",
"0.69255... | 0.8797253 | 0 |
Sets and option, first checking for env vars, then checking for value already set, then going to the default value if passed. | def _set_bool(name, value, context):
if name in os.environ:
envval = os.environ.get(name).lower()
if envval in ["1", "true", "y", "yes"]:
context[name] = True
elif envval in ["0", "false", "n", "no"]:
context[name] = False
else:
raise ValueError(f"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_from_env(name, context, default):\n if default is _DEFAULT_ARG and name not in os.environ:\n return\n\n context[name] = os.environ.get(name, default)",
"def default_env(var, default_value):\n if var not in os.environ:\n os.environ[var] = default_value",
"def _set_option(name, va... | [
"0.6857912",
"0.67221206",
"0.66994995",
"0.6638995",
"0.6544796",
"0.65408874",
"0.6495314",
"0.6468205",
"0.6468205",
"0.6371277",
"0.6370825",
"0.6370825",
"0.6370825",
"0.63678986",
"0.6338741",
"0.63148254",
"0.6220893",
"0.6120914",
"0.6111974",
"0.60844433",
"0.6074706... | 0.55531406 | 58 |
For list types we split the env variable value using a comma as a delimiter | def _set_list(name, value, context):
if name in os.environ:
context[name] = os.environ.get(name).lower().split(",")
_set_default(name, value, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_envlist(key, *default, **kwargs):\n separator = kwargs.get('separator', ' ')\n return get_env(key, *default, coerce=lambda x: x.split(separator))",
"def env_var_list(key: str) -> list:\n return list(\n filter(\n None, map(str.strip, env_var_line(key).split(\",\"))\n )\n ... | [
"0.734742",
"0.71028745",
"0.6936836",
"0.6606503",
"0.6418507",
"0.63216245",
"0.62949544",
"0.61476827",
"0.60659057",
"0.6002282",
"0.5913215",
"0.58929557",
"0.5864426",
"0.5854314",
"0.5848277",
"0.5848277",
"0.5825079",
"0.5763082",
"0.5759066",
"0.5715126",
"0.57057405... | 0.7054378 | 2 |
Sets the default value for the option if it's not already set. | def _set_default(name, value, context):
if name not in context:
context[name] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_value(self, default_value, option_type):\n if default_value is not None:\n self.defaultValue = default_value\n if option_type is not None:\n self.optionType = option_type",
"def set_log_option_default(self, value):\n self._log_option_default = value",
... | [
"0.79183626",
"0.7712832",
"0.7692426",
"0.75238585",
"0.74890167",
"0.7453401",
"0.7388673",
"0.73775065",
"0.73775065",
"0.73775065",
"0.7320081",
"0.73147047",
"0.7293802",
"0.7244977",
"0.7224144",
"0.7191024",
"0.7024922",
"0.69753796",
"0.685567",
"0.6833672",
"0.677855... | 0.5899538 | 87 |
Returns the next element in the iteration without advancing the iterator. | def peek(self):
if self.p == None:
self.p = self.iterator.next()
return self.p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __next__(self):\n return next(self.iterator)",
"def __next__(self):\n return next(self.iter)",
"def __next__(self):\n\t\tif self.i >= len(self.l):\n\t\t\tself.i = 0\n\t\t\traise StopIteration\n\t\tresult = self.l[self.i]\n\t\tself.i += 1\n\t\treturn result",
"def __next__(self):\n if... | [
"0.79477453",
"0.78446555",
"0.775278",
"0.7702536",
"0.76835656",
"0.76673263",
"0.7658624",
"0.76465726",
"0.76022387",
"0.75659126",
"0.7556752",
"0.752537",
"0.7500898",
"0.7500898",
"0.74560964",
"0.74174786",
"0.73758715",
"0.7373713",
"0.7363025",
"0.73472965",
"0.7347... | 0.0 | -1 |
Helper function for xwing algorithm, finds values that appear only twice in rows | def find_twice_in_row(row):
results = []
for i in range(9):
temp_string = str(i)
count = 0
for item in row:
if temp_string in item:
count += 1
if count == 2:
results.append(temp_string)
return results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_twice_in_row_cols(row,item):\n results = [item]\n for i in range(9):\n if item in row[i]:\n results.append(i)\n return results",
"def check_row(sudoku):\r\n for row in range(len(sudoku)):\r\n for col in range(len(sudoku)):\r\n if sudoku[row].count(sudoku[r... | [
"0.6807793",
"0.6492274",
"0.61676943",
"0.60466117",
"0.59909856",
"0.5906",
"0.58942556",
"0.5848933",
"0.58243793",
"0.5820555",
"0.5813331",
"0.58012885",
"0.5765841",
"0.5753045",
"0.5729624",
"0.560253",
"0.5527246",
"0.5510586",
"0.55049664",
"0.5498397",
"0.549352",
... | 0.669171 | 1 |
Find index of the value _just_ smaller than n. | def predecessor(self, n, lower, upper):
pred = -math.inf
pos = None
for i, ele in enumerate(self.nums[lower: upper], start=lower):
if pred < ele < n:
pred = ele
pos = i
return pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index(j_in, n):\n j_out = j_in\n if j_out < 0:\n j_out = j_out + n\n elif j_out > n-1:\n j_out = j_out - n\n return j_out",
"def find_missing_pos_nlogn(input):\n input = sorted(input)\n min = 1\n for ii in input:\n if ii > 0:\n if ii == min:\n ... | [
"0.6864122",
"0.6799609",
"0.67734843",
"0.67102283",
"0.664752",
"0.6639641",
"0.6572916",
"0.64869434",
"0.64177555",
"0.6417727",
"0.63712215",
"0.63278073",
"0.6325703",
"0.62993824",
"0.6277036",
"0.6249602",
"0.6223656",
"0.6208542",
"0.6202872",
"0.6170078",
"0.6165445... | 0.65030736 | 7 |
Calculate the reward of an action, given a current state. | def reward(input):
state = np.array([input[0], input[1]])
action = input[2]
action = np.clip(action, -2.0, 2.0)
costs = angle_normalize(state[0])**2 + .1 * state[1]**2 + .001 * (action**2)
return - costs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self):\n if self._state is None:\n return 0\n return self.reward_fn(self._state)",
"def get_reward(self, state, action, next_state):\n assert action in self.get_possible_actions(\n state), \"cannot do action %s from state %s\" % (action, state)\n x, y ... | [
"0.8035885",
"0.796364",
"0.79373664",
"0.79256666",
"0.7887813",
"0.7840348",
"0.78245395",
"0.78014",
"0.77755356",
"0.7767457",
"0.7678349",
"0.7630624",
"0.7585712",
"0.75795573",
"0.755277",
"0.7486466",
"0.7484968",
"0.7422575",
"0.740597",
"0.7393796",
"0.73868674",
... | 0.78936285 | 4 |
Mutate this rule's continuous phenotype. | def continuousPhenotypeMutation(self, phenotype):
changed = False
if random.random() < cons.mu: #Mutate continuous phenotype
action_range = self.action[1] - self.action[0]
mutation_range = random.random()*0.5*action_range
tmp_key = random.randint(0,2) #Make random cho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_continuous(self) -> ContinuousInterest:\n pass",
"def process_ml_action(self, continuous):\n continuous = np.array(continuous, dtype=np.float32)\n if continuous.shape[0] == self.space.n:\n print(\"Already in discrete space:\", continuous)\n return continuous\n discrete = np.zeros... | [
"0.55779076",
"0.5162269",
"0.5157399",
"0.47583637",
"0.4743383",
"0.47281563",
"0.4723646",
"0.46749714",
"0.46300223",
"0.46134457",
"0.46131718",
"0.4533112",
"0.45295072",
"0.4469641",
"0.44516203",
"0.44362867",
"0.44290864",
"0.44241333",
"0.44119793",
"0.4410729",
"0.... | 0.5804639 | 0 |
Returns if the classifier (self) is more general than cl. Check that all attributes specified in self are also specified in cl. | def isMoreGeneral(self,cl):
if len(self.specified_attributes) >= len(cl.specified_attributes):# and self.action != cl.action and self.prediction < cl.prediction and self.error > cl.error:
return False
for i in range(len(self.specified_attributes)): #Check each attribute specified in self.con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_is_fitted(self):\n # Do not check `b` as some classifiers do not set it\n check_is_fitted(self, 'w')\n super(CClassifierLinear, self)._check_is_fitted()",
"def equals(self, cl):\n if cl.action == self.action and len(cl.specified_attributes) == len(self.specified_attributes)... | [
"0.55952436",
"0.55881625",
"0.52784044",
"0.52727723",
"0.5220433",
"0.5210003",
"0.5194289",
"0.51692337",
"0.5134978",
"0.5131439",
"0.50855386",
"0.50359964",
"0.50358427",
"0.50184447",
"0.4992096",
"0.4992096",
"0.49873722",
"0.49853092",
"0.49802825",
"0.49400705",
"0.... | 0.80678 | 0 |
Reset prediction, error, fitness to default initial data. | def resetParams(self):
self.prediction = cons.init_pred # Classifier payoff - initialized to a constant initial payoff value
self.error = cons.init_err # Classifier error - initialized to a constant initial error value
self.fitness = cons.init_fit # Classifier fitness - initia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reset(self):\n self._set(\"_n_init_features\", None)\n self._set(\"_n_output_features\", None)\n self._set(\"_n_intervals\", None)\n self._set(\"_mapper\", {})\n self._set(\"_cpp_preprocessor\", None)\n self._set(\"_fitted\", False)",
"def reset(self):\n self... | [
"0.75278366",
"0.7448251",
"0.7448251",
"0.73112136",
"0.72960526",
"0.7253026",
"0.71832997",
"0.716464",
"0.71455854",
"0.70881915",
"0.70574176",
"0.70562017",
"0.704109",
"0.7032838",
"0.70286757",
"0.7014807",
"0.69722515",
"0.6935173",
"0.691364",
"0.68963444",
"0.68861... | 0.75769347 | 0 |
Get SOPInstanceUID Returns str SOPInstanceUID | def uid(self) -> str:
return self.get_main_information()['MainDicomTags']['SOPInstanceUID'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sop_instance_uid(self) -> Optional[str]:\n return self._instance_uid",
"def uid(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"uid\")",
"def uid(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"uid\")",
"def uid(self) -> pulumi.Output[str]:\n return pulumi.ge... | [
"0.8016402",
"0.679508",
"0.679508",
"0.679508",
"0.67759883",
"0.67260337",
"0.6682847",
"0.6682847",
"0.6682847",
"0.6682847",
"0.6682847",
"0.6682847",
"0.66543293",
"0.6652895",
"0.6626514",
"0.6530364",
"0.6506454",
"0.64952654",
"0.6491322",
"0.6476151",
"0.6476151",
... | 0.84399265 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.