query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Sets the errors of this MigrateListingResponse. | def errors(self, errors):
self._errors = errors | [
"def errors(self, errors):\n \n self._errors = errors",
"def errors(self, errors):\n self._errors = errors",
"def validation_errors(self, validation_errors):\n\n self._validation_errors = validation_errors",
"def validation_errors(self, validation_errors):\n self._validation... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the inventory_item_group_key of this MigrateListingResponse. | def inventory_item_group_key(self, inventory_item_group_key):
self._inventory_item_group_key = inventory_item_group_key | [
"def item_group_id(self, item_group_id):\n\n self._item_group_id = item_group_id",
"def group_id(self, group_id):\n \n self._group_id = group_id",
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def inventory_id(self, inventory_id):\n\n self._inventory_id = i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the inventory_items of this MigrateListingResponse. | def inventory_items(self, inventory_items):
self._inventory_items = inventory_items | [
"def inventory(self, inventory):\n\n self._inventory = inventory",
"def put_inventory(self, InstanceId: str, Items: List) -> Dict:\n pass",
"def setInventory(self, inv):\n self.inventory = inv\n\n # Make the slotsize accessible in the middle and foreground methods\n self.slotS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the listing_id of this MigrateListingResponse. | def listing_id(self, listing_id):
self._listing_id = listing_id | [
"def listing_id(self, listing_id):\n self._listing_id = listing_id",
"def listing_id(self):\n return self._listing_id",
"def delete_listing(request, listing_id):\n listing = get_object_or_404(Listing, pk=listing_id)\n\n listing.delete()\n messages.success(\n request,\n 'Your... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the marketplace_id of this MigrateListingResponse. | def marketplace_id(self, marketplace_id):
self._marketplace_id = marketplace_id | [
"def set_AWSMarketplaceId(self, value):\n super(ListOrdersInputSet, self)._set_input('AWSMarketplaceId', value)",
"def set_AWSMarketplaceId(self, value):\n super(GetReportRequestListInputSet, self)._set_input('AWSMarketplaceId', value)",
"def registration_marketplace_id(self, registration_marketpl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the status_code of this MigrateListingResponse. | def status_code(self, status_code):
self._status_code = status_code | [
"def status_code(self, status_code):\n self._status_code = status_code",
"def set_status_code(self, status_code):\n if (status_code is not None) and (type(status_code) is int):\n self.status_code = status_code\n else:\n self.status_code = 500",
"def set_status(self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the warnings of this MigrateListingResponse. | def warnings(self, warnings):
self._warnings = warnings | [
"def warnings(self, warnings):\n if warnings is None:\n raise ValueError(\"Invalid value for `warnings`, must not be `None`\") # noqa: E501\n\n self._warnings = warnings",
"def flag_warnings(self):\n if not self._warning_status:\n self._warning_status = True",
"def wa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return 'WHERE' clause that implements kwds_filter constraints. | def _build_where_clause(**kwds_filter):
clause = []
params = []
items = kwds_filter.items()
items = sorted(items, key=lambda x: x[0]) # Ordered by key.
for key, val in items:
if _is_nsiterable(val):
clause.append(key + ' IN (%s)' % (', '.join('?' * le... | [
"def create_where():\n conjunction = Forward().setResultsName(\"conjunction\")\n nested = Group(Suppress(\"(\") + conjunction + Suppress(\")\")).setResultsName(\n \"conjunction\"\n )\n\n maybe_nested = nested | constraint\n inverted = Group(not_ + maybe_nested).setResultsName(\"not\")\n ful... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normalize value for use as SQLite column name. | def _normalize_column(column):
if not isinstance(column, str):
msg = "expected column of type 'str', got {0!r} instead"
raise TypeError(msg.format(column.__class__.__name__))
column = column.strip()
column = column.replace('"', '""') # Escape quotes.
if column ==... | [
"def normalize_tablename(x):\n return normalize_name_generic(x, remove_leading_nums=True)",
"def _normalize_name(name):\n if name:\n return name",
"def __normalize_name(self):\n self.normalized_name = normalizeSimplified(self.name)",
"def normalize(value):\n if value:\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Alternate constructor to load an existing collection of records into a tempoarary SQLite database. Loads data (an iterable of lists, tuples, or dicts) into a temporary table | def from_records(cls, data, columns=None):
temptable = TemporarySqliteTable(data, columns)
return cls(temptable.connection, temptable.name) | [
"def from_records(cls, data, columns=None):\n connection, table = _load_temp_sqlite_table(columns, data)\n return cls(connection, table)",
"def load_data(cursor, table, *args, **kwds):\n try:\n records, = args\n columns = None\n except ValueError:\n columns, records = args... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the auditbeat log file, to generate audit event model and write to the result file(optional) | def parse(self, output=True):
if not self.type == LogType.audit:
log.error("LogParser doesn't support nonetype yet.")
return
stashes = list()
with open(self.path_log, 'r') as f:
for line in f.readlines():
event: Dict = json.loads(line)
... | [
"def parse_file(self):\n with open(self.file_name, 'r', errors='ignore') as log_file:\n for line in log_file:\n self.process_line(line)",
"def __parse(self):\n lines = self.file.readlines()\n name_idx = 2\n name_idx_found = False\n pathre = re.compile(r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialise clusters by alternating the bins to which the vectors are assigned. | def alternating_bins_initialisation(self, pixel_data, a=None, b=None):
if not a or not b:
a = 0
b = len(pixel_data)
clusters = defaultdict(list)
for i in range(a, b): # selecting sevens as data set
clusters[i % self.K].append(pixel_data[i])
... | [
"def __initCluster(self):\n data_size, cluster_center = self.data_size, self.cluster_center\n self.cluster_temp = np.zeros(data_size, dtype=int)\n self.cluster_upper_bound = np.full(len(cluster_center), float('inf'), dtype=float)\n for center in cluster_center:\n self.cluster_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the codebook vectors. | def get_cb_vectors(self):
return self.cb_vectors | [
"def get_word_vectors(self):\n return self.word_vectors",
"def vectors(self):\n return {key:self[key] for key in self._vectors.keys()}",
"def get_vectors(model, corpus_size, vectors_size, vectors_type):\r\n vectors = np.zeros((corpus_size, vectors_size))\r\n for i in range(0, corpus_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts features from the final codebook vectors using the L2 norm. The way it works is that we pass in the data as an argument and the function produces len(data) feature vectors such that f(x_i)=[a_1 ... a_K] and a_j = || x_i c_j || where c_j is the codebook vector. | def extract_features(self, data):
# TODO: Should feature extraction be done on the testing data? In the lecture notes
# TODO: it is not done with the training data, but with the test data.
# TODO: Maybe we should use the validate data when we do cross-validation.
features = np.zeros([l... | [
"def process_and_get_features(self, data):\n vector_data = self.get_tokenized_index_vectors(data)\n features = self.process_example_vectors(vector_data)\n return features",
"def GenerateFeatures(data, fs, window_length_s, window_shift_s):\n window_length = window_length_s * fs\n window_shif... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the node_b of this NetflowFilters. | def node_b(self, node_b):
self._node_b = node_b | [
"def setB(self, b):\n self.b = b",
"def b(self, b):\n\n self._b = b",
"def __init__(self, bnodes=None):\n self.bnodes = bnodes if bnodes else []\n self._initialize()",
"def set_bias_for_node(node: Node, value: np.ndarray):\n bias = get_bias_for_node(node)\n if bias is None:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the qos_type of this NetflowFilters. | def qos_type(self, qos_type):
self._qos_type = qos_type | [
"def qos(self, qos: int):\n if qos is not None and qos > 2: # noqa: E501\n raise ValueError(\"Invalid value for `qos`, must be a value less than or equal to `2`\") # noqa: E501\n if qos is not None and qos < 0: # noqa: E501\n raise ValueError(\"Invalid value for `qos`, must be... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the device_interfaces of this NetflowFilters. | def device_interfaces(self, device_interfaces):
self._device_interfaces = device_interfaces | [
"def network_interfaces(self, network_interfaces):\n\n self._network_interfaces = network_interfaces",
"def serial_interfaces(self, serial_interfaces):\n self._serial_interfaces = serial_interfaces",
"def ethernet_interfaces(self, ethernet_interfaces):\n self._ethernet_interfaces = ethernet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the ip_version of this NetflowFilters. | def ip_version(self, ip_version):
self._ip_version = ip_version | [
"def ip_version(self, ip_version):\n self._ip_version = ip_version",
"def ip_count(self, ip_count):\n\n self._ip_count = ip_count",
"def vip(self, vip):\n\n self._vip = vip",
"def cavity_filter_version(self, cavity_filter_version):\n\n self._cavity_filter_version = cavity_filter_ve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the netflow_devices of this NetflowFilters. | def netflow_devices(self, netflow_devices):
self._netflow_devices = netflow_devices | [
"def netflow_filters(self, netflow_filters):\n\n self._netflow_filters = netflow_filters",
"def devices(self, devices):\n\n self._devices = devices",
"def device_groups(self, device_groups):\n\n self._device_groups = device_groups",
"def ext_devices(self, ext_devices):\n self._ext_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the top of this NetflowFilters. | def top(self, top):
self._top = top | [
"def set_top(self, top: float) -> None:\n self._selected_top = top",
"def bb_top(self, bb_top: float):\n\n self._bb_top = bb_top",
"def bevel_top(self, bevel_top):\n self._bevel_top = bevel_top",
"def top(self):\n # Sets our Z value to one.\n self.setZValue(1)\n # Set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the app_type of this NetflowFilters. | def app_type(self, app_type):
self._app_type = app_type | [
"def app_type(self, app_type):\n self._app_type = app_type",
"def application_type(self, application_type: str):\n allowed_values = [\"transfer_of_whole\", \"creation_of_new_charge\"] # noqa: E501\n if application_type not in allowed_values:\n raise ValueError(\n \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the nbar_application_names of this NetflowFilters. | def nbar_application_names(self, nbar_application_names):
self._nbar_application_names = nbar_application_names | [
"def application_name(self, application_name):\n\n self._application_name = application_name",
"def set_app_name(self, app_name):\n pass",
"def setNameFilters(self, filters):\n if self._completer:\n self._completer.model().setNameFilters(filters)",
"def set_filters(self, filter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the node_a of this NetflowFilters. | def node_a(self, node_a):
self._node_a = node_a | [
"def setA(self, a):\n self.a = a",
"def setNodesAttribute(self, idx_node: torch.Tensor, idx_attribute: torch.Tensor, value: float):\n self.node_attribute_list[idx_node][0][idx_attribute] = value",
"def set_node(self, node):\n self.__node = node",
"def SetNode(self, node):\n self.no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the conversation of this NetflowFilters. | def conversation(self, conversation):
self._conversation = conversation | [
"def conversation(self, conversation):\n \n self._conversation = conversation",
"def set_gift_conversation(self, conversation_string):\r\n self.gift_conversation = conversation_string",
"def update_conversation(self, conversation=None):\n pass",
"def conversation(self):\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the if_names of this NetflowFilters. | def if_names(self, if_names):
self._if_names = if_names | [
"def set_filters(self, filters):\n self.widget.setNameFilters(filters)",
"def setNameFilters(self, filters):\n if self._completer:\n self._completer.model().setNameFilters(filters)",
"def setFilters(self, filters):\n self.__filters = filters",
"def set_filter_status(self, filte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the direction of this NetflowFilters. | def direction(self, direction):
self._direction = direction | [
"def set_direction(self, direction: str) -> None:\n self._send_command([{\"code\": DPCODE_FAN_DIRECTION, \"value\": direction}])",
"def set_direction(self, direction: str) -> None:\n self.wink.set_fan_direction(direction)",
"def setDirection( self, direction ):\n self.layout().setDirection(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To add parents to database | def add_parent(session, df):
try:
for _, row in df.iterrows():
parent = Parent()
parent.name = row['parent_name']
parent.family = row['family']
session.add(parent)
except Exception as ex:
session.rollback()
raise ex
else:
sessio... | [
"def add_parents(self, parents):\n if len(parents) > 0:\n self.parents.append(parents)\n else:\n self.is_root = True",
"def add_parents(self, nodes):\n for n in self.node_list(nodes):\n self.add_parent(n)",
"def regenerate_parents( self ):\n ParentsRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convenience redirect to find the root outcome group for a particular context. Will redirect to the appropriate outcome group's URL. | def redirect_to_root_outcome_group_for_context_global(request_ctx, **request_kwargs):
path = '/v1/global/root_outcome_group'
url = request_ctx.base_api_url + path.format()
response = client.get(request_ctx, url, **request_kwargs)
return response | [
"def redirect_to_root_outcome_group_for_context_accounts(request_ctx, account_id, **request_kwargs):\n\n path = '/v1/accounts/{account_id}/root_outcome_group'\n url = request_ctx.base_api_url + path.format(account_id=account_id)\n response = client.get(request_ctx, url, **request_kwargs)\n\n return resp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convenience redirect to find the root outcome group for a particular context. Will redirect to the appropriate outcome group's URL. | def redirect_to_root_outcome_group_for_context_accounts(request_ctx, account_id, **request_kwargs):
path = '/v1/accounts/{account_id}/root_outcome_group'
url = request_ctx.base_api_url + path.format(account_id=account_id)
response = client.get(request_ctx, url, **request_kwargs)
return response | [
"def redirect_to_root_outcome_group_for_context_global(request_ctx, **request_kwargs):\n\n path = '/v1/global/root_outcome_group'\n url = request_ctx.base_api_url + path.format()\n response = client.get(request_ctx, url, **request_kwargs)\n\n return response",
"def _redirect(context, request):\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modify an existing outcome group. Fields not provided are left as is; unrecognized fields are ignored. When changing the parent outcome group, the new parent group must belong to the same context as this outcome group, and must not be a descendant of this outcome group (i.e. no cycles allowed). | def update_outcome_group_global(request_ctx, id, title=None, description=None, vendor_guid=None, parent_outcome_group_id=None, **request_kwargs):
path = '/v1/global/outcome_groups/{id}'
payload = {
'title' : title,
'description' : description,
'vendor_guid' : vendor_guid,
'paren... | [
"def update_outcome_group_accounts(request_ctx, account_id, id, title=None, description=None, vendor_guid=None, parent_outcome_group_id=None, **request_kwargs):\n\n path = '/v1/accounts/{account_id}/outcome_groups/{id}'\n payload = {\n 'title' : title,\n 'description' : description,\n 've... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modify an existing outcome group. Fields not provided are left as is; unrecognized fields are ignored. When changing the parent outcome group, the new parent group must belong to the same context as this outcome group, and must not be a descendant of this outcome group (i.e. no cycles allowed). | def update_outcome_group_accounts(request_ctx, account_id, id, title=None, description=None, vendor_guid=None, parent_outcome_group_id=None, **request_kwargs):
path = '/v1/accounts/{account_id}/outcome_groups/{id}'
payload = {
'title' : title,
'description' : description,
'vendor_guid' ... | [
"def update_outcome_group_global(request_ctx, id, title=None, description=None, vendor_guid=None, parent_outcome_group_id=None, **request_kwargs):\n\n path = '/v1/global/outcome_groups/{id}'\n payload = {\n 'title' : title,\n 'description' : description,\n 'vendor_guid' : vendor_guid,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deleting an outcome group deletes descendant outcome groups and outcome links. The linked outcomes themselves are only deleted if all links to the outcome were deleted. Aligned outcomes cannot be deleted; as such, if all remaining links to an aligned outcome are included in this group's descendants, the group deletion ... | def delete_outcome_group_global(request_ctx, id, **request_kwargs):
path = '/v1/global/outcome_groups/{id}'
url = request_ctx.base_api_url + path.format(id=id)
response = client.delete(request_ctx, url, **request_kwargs)
return response | [
"def delete_outcome_group_accounts(request_ctx, account_id, id, **request_kwargs):\n\n path = '/v1/accounts/{account_id}/outcome_groups/{id}'\n url = request_ctx.base_api_url + path.format(account_id=account_id, id=id)\n response = client.delete(request_ctx, url, **request_kwargs)\n\n return response",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deleting an outcome group deletes descendant outcome groups and outcome links. The linked outcomes themselves are only deleted if all links to the outcome were deleted. Aligned outcomes cannot be deleted; as such, if all remaining links to an aligned outcome are included in this group's descendants, the group deletion ... | def delete_outcome_group_accounts(request_ctx, account_id, id, **request_kwargs):
path = '/v1/accounts/{account_id}/outcome_groups/{id}'
url = request_ctx.base_api_url + path.format(account_id=account_id, id=id)
response = client.delete(request_ctx, url, **request_kwargs)
return response | [
"def delete_outcome_group_global(request_ctx, id, **request_kwargs):\n\n path = '/v1/global/outcome_groups/{id}'\n url = request_ctx.base_api_url + path.format(id=id)\n response = client.delete(request_ctx, url, **request_kwargs)\n\n return response",
"def delete_consistencygroup(self, context, group)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Link an outcome into the outcome group. The outcome to link can either be specified by a PUT to the link URL for a specific outcome (the outcome_id in the PUT URLs) or by supplying the information for a new outcome (title, description, ratings, mastery_points) in a POST to the collection. If linking an existing outcome... | def create_link_outcome_global(request_ctx, id, outcome_id=None, title=None, display_name=None, description=None, vendor_guid=None, mastery_points=None, ratings_description=None, ratings_points=None, **request_kwargs):
path = '/v1/global/outcome_groups/{id}/outcomes'
payload = {
'outcome_id' : outcome_... | [
"def create_link_outcome_global_outcome_id(request_ctx, id, outcome_id=None, title=None, display_name=None, description=None, vendor_guid=None, mastery_points=None, ratings_description=None, ratings_points=None, **request_kwargs):\n\n path = '/v1/global/outcome_groups/{id}/outcomes/{outcome_id}'\n payload = {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Link an outcome into the outcome group. The outcome to link can either be specified by a PUT to the link URL for a specific outcome (the outcome_id in the PUT URLs) or by supplying the information for a new outcome (title, description, ratings, mastery_points) in a POST to the collection. If linking an existing outcome... | def create_link_outcome_global_outcome_id(request_ctx, id, outcome_id=None, title=None, display_name=None, description=None, vendor_guid=None, mastery_points=None, ratings_description=None, ratings_points=None, **request_kwargs):
path = '/v1/global/outcome_groups/{id}/outcomes/{outcome_id}'
payload = {
... | [
"def create_link_outcome_global(request_ctx, id, outcome_id=None, title=None, display_name=None, description=None, vendor_guid=None, mastery_points=None, ratings_description=None, ratings_points=None, **request_kwargs):\n\n path = '/v1/global/outcome_groups/{id}/outcomes'\n payload = {\n 'outcome_id' :... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unlinking an outcome only deletes the outcome itself if this was the last link to the outcome in any group in any context. Aligned outcomes cannot be deleted; as such, if this is the last link to an aligned outcome, the unlinking will fail. | def unlink_outcome_global(request_ctx, id, outcome_id, **request_kwargs):
path = '/v1/global/outcome_groups/{id}/outcomes/{outcome_id}'
url = request_ctx.base_api_url + path.format(id=id, outcome_id=outcome_id)
response = client.delete(request_ctx, url, **request_kwargs)
return response | [
"def unlink(self, link_id):",
"def unlink_completely(self):\n self.last_changed = self.nodenet.current_step\n self.nodenet.get_nodespace(self.parent_nodespace).contents_last_changed = self.nodenet.current_step\n\n links_to_delete = set()\n for gate_name_candidate in self.get_gate_types... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new empty subgroup under the outcome group with the given title and description. | def create_subgroup_global(request_ctx, id, title, description=None, vendor_guid=None, **request_kwargs):
path = '/v1/global/outcome_groups/{id}/subgroups'
payload = {
'title' : title,
'description' : description,
'vendor_guid' : vendor_guid,
}
url = request_ctx.base_api_url + p... | [
"def create_thing_group(thingGroupName=None, parentGroupName=None, thingGroupProperties=None, tags=None):\n pass",
"def createMainGroup(self):\n\t\tmc.group( n = self.grp.name, em = True )",
"def with_group(title: str) -> Generator[None, None, None]:\n if os.environ.get(\"GITHUB_ACTIONS\", \"false\") != \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new subgroup of the outcome group with the same title and description as the source group, then creates links in that new subgroup to the same outcomes that are linked in the source group. Recurses on the subgroups of the source group, importing them each in turn into the new subgroup. Allows you to copy orga... | def import_outcome_group_accounts(request_ctx, account_id, id, source_outcome_group_id, **request_kwargs):
path = '/v1/accounts/{account_id}/outcome_groups/{id}/import'
payload = {
'source_outcome_group_id' : source_outcome_group_id,
}
url = request_ctx.base_api_url + path.format(account_id=acc... | [
"def clone(self, target):\r\n \r\n try:\r\n new_group = None\r\n original_group = self.info\r\n \r\n title = original_group['title']\r\n tags = original_group['tags']\r\n for tag in list(tags):\r\n if tag.startswith(\"source-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new subgroup of the outcome group with the same title and description as the source group, then creates links in that new subgroup to the same outcomes that are linked in the source group. Recurses on the subgroups of the source group, importing them each in turn into the new subgroup. Allows you to copy orga... | def import_outcome_group_courses(request_ctx, course_id, id, source_outcome_group_id, **request_kwargs):
path = '/v1/courses/{course_id}/outcome_groups/{id}/import'
payload = {
'source_outcome_group_id' : source_outcome_group_id,
}
url = request_ctx.base_api_url + path.format(course_id=course_i... | [
"def clone(self, target):\r\n \r\n try:\r\n new_group = None\r\n original_group = self.info\r\n \r\n title = original_group['title']\r\n tags = original_group['tags']\r\n for tag in list(tags):\r\n if tag.startswith(\"source-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
提取出html页面中的所有url 并跟踪这些url进行一步爬取 如果提取的url中格式为 /question/xxx 就下载之后直接进入解析函数 | def parse(self, response):
# # print(response.text)
all_urls = response.css("a::attr(href)").extract()
all_urls = [parse.urljoin(response.url, url) for url in all_urls]
all_urls = filter(lambda x: True if x.startswith("https") else False, all_urls)
for url in all_urls:
... | [
"def parse(self, response):\n all_urls = response.css(\"a::attr(href)\").extract()\n all_urls = [parse.urljoin(response.url,url) for url in all_urls]\n # all_urls = filter(lambda x:True if x.startswith(\"https\") else False,all_urls)\n for url in all_urls:\n match_obj = re.mat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse challenge from a challenge response, cache it, and return it. | def _update_challenge(request: PipelineRequest, challenger: "PipelineResponse") -> HttpChallenge:
challenge = HttpChallenge(
request.http_request.url,
challenger.http_response.headers.get("WWW-Authenticate"),
response_headers=challenger.http_response.headers,
)
ChallengeCache.set_ch... | [
"def _parse_challenge(cls, response):\n links = _parse_header_links(response)\n try:\n authzr_uri = links['up']['url']\n except KeyError:\n raise errors.ClientError('\"up\" link missing')\n return (\n response.json()\n .addCallback(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if the reference folder is in place and all attributes are ready | def check_reference_ready():
# check to see if there is a manifest file in the default reference path
manifest_file = os.path.join(settings.DEFAULT_REFERENCE_PATH, 'manifest.json')
if not os.path.isfile(manifest_file):
_log("manifest.json file cannot be found in the reference folder; simulation wil... | [
"def _ref_exists(self):\n self._collect_soft_chain()\n\n found_ref = False\n for node in self.nodes:\n if node.id == self.ref:\n self.file = os.path.join(Constants.ALTER_DIR, node.filename)\n found_ref = True\n break\n\n return foun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback to be called whenever the system state has changed. Checks whether or not the step has to be advanced or not | def updateState(self):
if ('cutting' in self.step_ops) and (self.cut_state.user_cutting):
self.step_ops['cutting'] = True
if ('cooking' in self.step_ops) and (self.cut_state.user_cooking):
self.step_ops['cooking'] = True
# TODO: add the rest of the operati... | [
"def update_aux_state(self, step, *args, **kwargs):\n return",
"def _voltage_changed(self):\n if self.checkValueBool:\n self.check_status()",
"def has_state_changed(self) -> bool:\r\n ...",
"def update_step(self):\n #---------------\n # set next step\n #--... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor for thread that will request the RSS of a particular podcast series, parse the series details and episode information, and save the information w/`storer` | def __init__(self, storer, series, i):
super(EpisodeWorker, self).__init__()
self.storer = storer
self.series = series # All series
self.i = i | [
"def __init__(self, url):\n\n self.url = url\n self.feed, self.keys, self.entries = self.parse_rss_feed()",
"def __init__(self, url=URL):\n self.entries = feedparser.parse(url).entries",
"def __init__(self, thoonk, feed):\n Queue.__init__(self, thoonk, feed)\n\n self.feed_publ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses information in `line` to request and return the RSS feed | def request_rss(self, url):
return feedparser.parse(url) | [
"def add_rss(url):",
"def get_news(url):\r\n \r\n # parse RSS feed into list of dictionaries\r\n feed = feedparser.parse(url)\r\n\r\n # no RSS feed articles for url\r\n if len(feed['entries']) == 0:\r\n return []\r\n \r\n # get first ten articles from the RSS feed\r\n news = []\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Variable assignment can include assigning array elements. | def assign_variable(executor, variable, value):
variable = variable.replace(" ", "")
# TODO Should move parsing of this to ParsedStatementLet.
# TODO Need to handle N-dimensional array element assignment.
i = variable.find("(")
if i != -1:
# Array reference
j = variable.find(")", i+1... | [
"def test_assign_vars(self):\n\n\t\tself.latt_a.assign (2, 3, [1,1], \"abcd\")\n\t\tself.assertTrue(self.latt_a.meta[\"name\"] == \"abcd\")\n\t\tself.assertTrue(np.all(self.latt_a.meta[\"stoich\"] == 1))\n\t\tself.assertTrue(self.latt_a.meta[\"nspec\"] == 2)\n\t\tself.assertTrue(self.latt_a.meta[\"dim\"] == 3)",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An if statement works by skipping to the next line, if the THEN clause is false, otherwise it continues to execute the clauses after the THEN. | def stmt_if(executor, stmt):
e = Expression()
result = e.eval(stmt._tokens, symbols=executor._symbols)
if not result:
executor.goto_next_line() | [
"def exec_else(self, stmt: ElseStmt):\n if self.if_status is None:\n self.log.error(translate(\"Algo\", \"ELSE can only be used after an IF block\"))\n self.finish()\n return\n\n if not self.if_status[1]:\n self.enter_block(stmt)\n\n self.if_status = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate tips over past X amount of time and write JSON output | def aggregate_tips():
# The SQL query to perform
now = time.time()
print("Computing tip stats...", end="", flush=True)
labels = ["30_days", "7_days", "24_hours", "1_hour"]
windows = [30*86400.0, 7*86400.0, 1*86400.0, 3600.0]
result = {}
result["unix_time"] = now
result["human_time_utc"]... | [
"def aggregate_tips():\n\n # The SQL query to perform\n now = time.time()\n print(\"Computing tip stats...\", end=\"\", flush=True)\n labels = [\"all_time\", \"30_days\", \"7_days\", \"24_hours\", \"1_hour\"]\n windows = [None, 30*86400.0, 7*86400.0, 1*86400.0, 3600.0]\n result = {}\n result[\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Publish files to somewhere on the internet. | def publish_files():
print("Publishing files to the internet...", end="", flush=True)
import subprocess
try:
subprocess.run("./upload.sh", timeout=120.0)
print("done.\n")
except:
print("failed.\n") | [
"def publish(self, filename):\n # 1) Encrypt file\n # 2) Publish to remote cloud server\n # 3) Wait for the result\n # 4) Store results in files located inside RAM folder",
"def publish():\n if sys.argv[-1] == 'publish':\n os.system('python setup.py sdist upload')\n sy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start the Microblaze Processor. The processor instance will start automatically after instantiation. | def start(self):
self.microblaze.run()
self.microblaze.write(MAILBOX_OFFSET + MAILBOX_PY2IOP_CMD_OFFSET, 0)
self.load_switch_config(self.iop_switch_config) | [
"def platform_start(self):\n self.platform.start()",
"def start(self, memory=3):\n if self.cromwell_proc:\n logging.info(\"Request to start Cromwell: already running\")\n return\n\n self.cromwell_proc = subprocess.Popen([\n 'java',\n '-Dconf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Put the Microblaze processor into reset. This method will set processor status as "STOPPED". | def stop(self):
self.microblaze.reset() | [
"def reset(self):\n self._internal_pong.machine_reset()",
"def reset(self):\n if self._reset is not None:\n self._reset.value = False\n time.sleep(0.001)\n self._reset.value = True\n time.sleep(0.001)\n else:\n raise RuntimeError(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the Microblaze processor's switch configuration. This method will update switch config. Each pin requires 8 bits for configuration. | def load_switch_config(self, config=None):
if config is None:
config = ARDUINO_SWCFG_DIOALL
elif not len(config) == 4*ARDUINO_SWITCHCONFIG_NUMREGS:
raise TypeError('Invalid switch config {}.'.format(config))
# Build switch config word
self.iop_switch_config = con... | [
"def configure_switch(self, number: str, config: SwitchConfig, platform_config: dict) -> \"SwitchPlatformInterface\":\n raise NotImplementedError",
"def configure_switch(self, config):\n raise NotImplementedError",
"def telnet_switch_reload_and_verify_using_cached_SWI_and_new_config(self,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the status of the Microblaze processor. Returns str The processor status ("IDLE", "RUNNING", or "STOPPED"). | def status(self):
return self.microblaze.state | [
"def processor_status(self):\n return self._processor_status",
"def hardware_status(self):\n return self._hardware_status",
"def read_MPPT_Status(self):\n bitstream = self._port.read_holding_registers(0x0040, 1) # 0x0040 Device Status uint16 r\n result = unpack('<H', pack('<H', bitst... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether the command mailbox is idle. Returns bool True if the command in the mailbox is idle. | def is_cmd_mailbox_idle(self):
mb_cmd_word = self.microblaze.read(MAILBOX_OFFSET +
MAILBOX_PY2IOP_CMD_OFFSET)
return (mb_cmd_word & 0x1) == 0 | [
"def is_idle(self) -> bool:\n\n return self.get_runningstate == self.cmd.C815_IDLE_STATE",
"def is_idle(self) -> bool:",
"def is_idle(self):\n return self._idle",
"def any_idle(self) -> bool:\n return self.counts()[JobStatus.IDLE] > 0",
"def connection_is_idle(self):\r\n return s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the hamming distance for sequences in seqs_mat indicated by pairs of indices. | def nb_vector_hamming_distance(indices, seqs_mat, seqs_L, check_lengths=True):
return _nb_vector_hamming_distance(indices, seqs_mat, seqs_L, check_lengths) | [
"def get_pairwise_hamming_dists(seqs):\n return get_pairwise_dists(seqs, hamming)",
"def hamming_distance(s1, s2):\n assert(len(s1) == len(s2))\n return np.sum([1 if c1 != c2 else 0 for c1, c2 in zip(s1, s2)])",
"def hamming_distance(seq1, seq2):\n dist = sum([char1 != char2 for char1, char2 in zip(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the Levenshtein edit distance between two sequences, with the AA substitution distances provided in distance_matrix. The default distance matrix has a 1 for mismatches and 0 for matches. | def nb_editdistance(seq_vec1, seq_vec2, distance_matrix=identity_nb_distance_matrix, gap_penalty=1):
q_L = seq_vec1.shape[0]
s_L = seq_vec2.shape[0]
if q_L == s_L:
"""No gaps: substitution distance
This will make it differ from a strict edit-distance since
the optimal edit-dista... | [
"def damerau_levenshtein_distance(seq1, seq2):\r\n # codesnippet:D0DE4716-B6E6-4161-9219-2903BF8F547F\r\n # Conceptually, this is based on a len(seq1) + 1 * len(seq2) + 1 matrix.\r\n # However, only the current and two previous rows are needed at once,\r\n # so we only store those.\r\n oneago = None\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute "tcrdist" distance between two TCR CDR3 sequences. Using default weight, gap penalty, ntrim and ctrim is equivalent to the original distance published in Dash et al, (2017). By setting ntrim and ctrim to 0 and adjusting the dist_weight, it is also possible to compute the CDR1/2 loop distances which can be combi... | def nb_tcrdist(seq_vec1, seq_vec2, distance_matrix=tcr_nb_distance_matrix, dist_weight=3, gap_penalty=4, ntrim=3, ctrim=2, fixed_gappos=True):
q_L = seq_vec1.shape[0]
s_L = seq_vec2.shape[0]
if q_L == s_L:
"""No gaps: substitution distance"""
tmp_dist = 0
for i in range(ntrim, q_L - ... | [
"def cdtw(c1, c2, num_steiner=5, interp=0.3, r=0):\n\n print(\"Note: Parameter r={} is not used in cdtw_plot. Use cdtw_noplot.cdtw if required.\".format(r))\n d = graph_distance(c1, c2, num_steiner, interp=interp)\n return d",
"def func_c_align_split_n(self, args):\n tik_instance, ub_ori, ub_trans... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the tcrdist distance for sequences in seqs_mat indicated by pairs of indices. | def nb_vector_tcrdist(indices, seqs_mat, seqs_L, distance_matrix=tcr_nb_distance_matrix, dist_weight=3, gap_penalty=4, ntrim=3, ctrim=2, fixed_gappos=True):
return _nb_vector_tcrdist(indices, seqs_mat, seqs_L, distance_matrix, dist_weight, gap_penalty, ntrim, ctrim, fixed_gappos) | [
"def calc_dist_mat(\n self, seqs: Sequence[str], seqs2: Optional[Sequence[str]] = None\n ) -> coo_matrix:\n pass",
"def distances(s, t_subs, ord=ord):\n return (np.linalg.norm((s - t_subs), ord=ord, axis=1)) / s.shape[0]",
"def compute_trans_dist(lmtrans):\n\n dmatrix = np.zeros((len(lmtr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the Levenshtein edit distance for sequences in seqs_mat indicated by pairs of indices. | def nb_vector_editdistance(indices, seqs_mat, seqs_L, distance_matrix=identity_nb_distance_matrix, gap_penalty=1):
#print(indices.shape)
#print(seqs_mat.shape)
#print(seqs_L.shape)
return _nb_vector_editdistance(indices, seqs_mat, seqs_L, distance_matrix, gap_penalty) | [
"def nb_editdistance(seq_vec1, seq_vec2, distance_matrix=identity_nb_distance_matrix, gap_penalty=1):\n \n q_L = seq_vec1.shape[0]\n s_L = seq_vec2.shape[0]\n if q_L == s_L:\n \"\"\"No gaps: substitution distance\n This will make it differ from a strict edit-distance since\n the opt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store the names and grades of school students. | def __init__(self):
self.students = {} | [
"def add_student(self, name: str, grade: int) -> None:\n school_grade = self.students.setdefault(grade, [])\n school_grade.append(name)\n school_grade.sort()",
"def __init__(self, name, grade):\n self.student_info = [name, grade]",
"def __init__(self, name, grade):\n self.stud... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a student to a grade in the roster. | def add_student(self, name: str, grade: int) -> None:
school_grade = self.students.setdefault(grade, [])
school_grade.append(name)
school_grade.sort() | [
"def add_student(student):",
"def add_grade(self, student, grade):\n try:\n self.grades[student.id].append(grade)\n except KeyError:\n raise ValueError('Student not in Grade Book.')",
"def add_student(self, student: 'Student') -> None:\n self.students.append(student)",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computing initial values for position and velocity in GCRS system This is for later use in orbit integration, from tables in the prediction files. Use a lagrange polynomial in order to interpolate in the tables. | def calculate_initial_values(eph, rundate):
data = sorted(eph["positions"].items())
pos_itrs = np.zeros((len(data), 3))
mjd1, mjd2 = zip(*[t for t, d in data])
rotation_mat = rotation.trs2gcrs(time.Time(val=mjd1, val2=mjd2, fmt="mjd", scale="utc"))
tbl = time.Time(val=mjd1, val2=mjd2, fmt="mjd", sca... | [
"def compute_velocities(self):\n \n xfunc = interpolate.splrep(self.TIME, self.XPOS, s=0)\n yfunc = interpolate.splrep(self.TIME, self.YPOS, s=0)\n zfunc = interpolate.splrep(self.TIME, self.ZPOS, s=0)\n \n self.XVEL = interpolate.splev(self.TIME, xfunc, der=1)\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do the initialization and setup for building a postage stamp. In the base class, we check for and parse the appropriate size and position values in config (aka base['stamp'] or base['image']. Values given in base['stamp'] take precedence if these are given in both places (which would be confusing, so probably shouldn't... | def setup(self, config, base, xsize, ysize, ignore, logger):
# .. Do any custom setup you need to do.
# Probably want to call the base class setup function to do the normal determination
# of the size and position values.
# Extra processing of 'bandpass' argument
# Most needed t... | [
"def __init__(self, **log_config):\n super(LoggingConfig, self).__init__(**log_config)\n self.level = self._parse_string('level')\n self.format = self._parse_string('format')\n self.show_statsd_messages = self._parse_bool('show_statsd_messages')\n self.show_sql_messages = self._pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Before drawing the profile, see whether this object can be trivially skipped. The base method checks if the object is completely off the main image, so the intersection bounds will be undefined. In this case, don't bother drawing the postage stamp for this object. prof The profile to draw. image The image onto which to... | def updateSkip(self, prof, image, method, offset, config, base, logger):
# NOTE: There are currently unresolved issues with the image size checking of chromatic
# objects. For now, we ignore any possible speed increases and skip the check.
# if isinstance(prof, galsim.ChromaticObject):
... | [
"def draw(self, prof, image, method, offset, config, base, logger, **kwargs):\n # ... draw prof onto the given image (making a new Image if necessary)\n if prof is None:\n return image\n else:\n logger = galsim.config.LoggerWrapper(logger)\n # Setup the kwargs t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw the profile on the postage stamp image. This is a slightly modified version of `stamp.DrawBasic()` which allows drawing of chromatic objects. prof The profile to draw. image The image onto which to draw the profile (which may be None). method The method to use in drawImage. offset The offset to apply when drawing.... | def draw(self, prof, image, method, offset, config, base, logger, **kwargs):
# ... draw prof onto the given image (making a new Image if necessary)
if prof is None:
return image
else:
logger = galsim.config.LoggerWrapper(logger)
# Setup the kwargs to pass to d... | [
"def updateSkip(self, prof, image, method, offset, config, base, logger):\n\n # NOTE: There are currently unresolved issues with the image size checking of chromatic\n # objects. For now, we ignore any possible speed increases and skip the check.\n # if isinstance(prof, galsim.ChromaticObject):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take a draft_dict that was already validated by draft_dict_validator then further sanitize, validate, and transform it. Ultimately return this "further validated" draft dict. It will have a slightly different set of keys the values for which can be used to directly create a Draft object. | def further_validated_draft_dict(
draft_dict: Dict[str, Any], user_profile: UserProfile
) -> Dict[str, Any]:
content = normalize_body(draft_dict["content"])
timestamp = draft_dict.get("timestamp", time.time())
timestamp = round(timestamp, 6)
if timestamp < 0:
# While it's not exactly an in... | [
"def validate_dict(cls, valuedict, exceptioncls, typedict):\n if not isinstance(valuedict, dict):\n raise DraftValidationError('The draft string must contain a json map/object/dict.')\n for key, typecls in typedict.iteritems():\n if not key in valuedict:\n raise ex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create drafts in bulk for a given user based on the draft dicts. Since currently, the only place this method is being used (apart from tests) is from the create_draft view, we assume that the drafts_dicts are syntactically valid (i.e. they satisfy the draft_dict_validator). | def do_create_drafts(draft_dicts: List[Dict[str, Any]], user_profile: UserProfile) -> List[Draft]:
draft_objects = []
for draft_dict in draft_dicts:
valid_draft_dict = further_validated_draft_dict(draft_dict, user_profile)
draft_objects.append(
Draft(
user_profile=use... | [
"def list_drafts(user):\n identity = get_identity_for_user(user)\n service = get_record_service()\n recids = [\n dm.json[\"id\"]\n for dm in service.draft_cls.model_cls.query.all()\n if dm is not None and dm.json is not None\n ]\n\n for recid in recids:\n try:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Edit/update a single draft for a given user. Since the only place this method is being used from (apart from tests) is the edit_draft view, we assume that the drafts_dict is syntactically valid (i.e. it satisfies the draft_dict_validator). | def do_edit_draft(draft_id: int, draft_dict: Dict[str, Any], user_profile: UserProfile) -> None:
try:
draft_object = Draft.objects.get(id=draft_id, user_profile=user_profile)
except Draft.DoesNotExist:
raise ResourceNotFoundError(_("Draft does not exist"))
valid_draft_dict = further_validate... | [
"def user_draft_id(self, user_draft_id):\n\n self._user_draft_id = user_draft_id",
"def draft(self, user=None):\r\n self.status = self.STATUS.draft\r\n self.save(force_update=True, user=user)",
"def put(self, request):\r\n user = request.user\r\n check_user_status(user)\r\n\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a draft belonging to a particular user. | def do_delete_draft(draft_id: int, user_profile: UserProfile) -> None:
try:
draft_object = Draft.objects.get(id=draft_id, user_profile=user_profile)
except Draft.DoesNotExist:
raise ResourceNotFoundError(_("Draft does not exist"))
draft_id = draft_object.id
draft_object.delete()
ev... | [
"def delete_draft(draft_uuid):\n api_request('delete', api_url('drafts', str(draft_uuid)))",
"def delete(self,\n draft_id,\n ):\n return self._invoke('delete',\n {\n 'draft_id': draft_id,\n })",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get zero version `0.0.0` | def zero(cls: Type[_R]) -> _R:
return cls("0.0.0") | [
"def get_initial_version(self):\n if self.config.semver:\n return \"0.0.0\"\n else:\n return \"0\"",
"def get_version():\n ver = '0.0.0'\n req = restcall(0, 'config', 10.0)\n if req['text'] is not None:\n try: \n tree = ET.fromstring... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get next micro version. | def bump_micro(self: _R, inc: int = 1) -> _R:
if not self.is_stable:
return self.get_stable().bump_micro(inc - 1)
return self._replace(
BaseVersion(
epoch=0,
release=(self.major, self.minor, self.micro + inc),
pre=None,
... | [
"def next_version(major=False, minor=False, patch=True):\n try:\n r = Release.objects.latest()\n except Release.DoesNotExist:\n return Version('0.0.0')\n\n v = r.version\n if major:\n v = v.next_major()\n elif minor:\n v = v.next_minor()\n else:\n v = v.next_patc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get stable version from pre or post release. | def get_stable(self: _R) -> _R:
return self._replace(
BaseVersion(
epoch=0,
release=(self.major, self.minor, self.micro),
pre=None,
post=None,
dev=None,
local=None,
)
) | [
"def latest_stable_release_version(self):\n\n result = requests.get(constants.CHROMEDRIVER_CHROMIUM_URL)\n soup = BeautifulSoup(result.content, 'html.parser')\n ul = soup.select_one(constants.UL_RELEASES)\n for li in ul:\n text = li.text.replace(u'\\u00A0', ' ')\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function for checkPass returns the first element of charList found that works for the password at index i if it fails to find a character at i, prints i and returns an empty string instead of returning i. | def findChar(username, url, charList, i):
for ch in charList:
if(checkPasswordCharacter(ch, username, url, index = i)):
return ch
#only runs if no ch in charList match:
# return i #oof, there's no match if i is out of bounds, e.g. len(password) < i
print("Missing: " + i) #so I know when... | [
"def validate(password):\n length = len(password)\n invalid_chars = [\" \", \"_\", \"-\"]\n spec_chars = list(\"!#$%&'()*+,./:;<=>?@[]^`{|}~\")\n\n # Checks for validitity of the password\n if length < 8:\n return \"Invalid\"\n else:\n for i in password:\n for j in invalid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of characters in database names | def makeDatabaseList():
charList = []
for ch in lower:
# ch = str(ch)
if(characterInDatabaseName(ch, url)):
charList.append(ch)
for ch in numbers:
ch = str(ch)
if(characterInDatabaseName(ch, url)):
charList.append(ch)
for ch in special:
ch = str(ch)
if(c... | [
"def list_database_names(self) -> List[str]:\n \n ret: List[str] = []\n if (resp := self.conn.get(path='_all_dbs')).status == 200:\n ret = resp.get_data()\n return ret",
"def get_DBList(self):\n db_list = []\n ori_db_list = self.DBClient.get_list_database()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns list of characters that appear in any username | def userNameCharacters(url, tableName, caseSensitive = False, wildCards = True):
"""
sqlzoo characters
['a', 'c', 'd', 'e', 'h', 'i', 'j', 'k', 'n', 'o', 'p', 'r', 't', 'w', '_', '%']
"""
lst = []
for ch in special:
if(checkUsernameCharacter(ch, url, tableName, notLike = False, notLikeName = "", index ... | [
"def all_users():\n\treturn [unicode(name[:-4]).lower() for name in os.listdir(os.path.join(WORLD_DIR, 'players'))]",
"def check_username(username):\n if username:\n if not re.match('[a-z]', username[0]):\n return ['username_error_badfirstchar']\n # Technically both these conditions mi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates all subsequences of ch with length k | def generateSubSequences(k, ch):
seq = ["".join(c) for c in itertools.product(ch, repeat = k)]
# discussion about the best way to do this:
# https://stackoverflow.com/questions/7074051/what-is-the-best-way-to-generate-all-possible-three-letter-strings
return seq | [
"def gc_content_subseq(dna_seq, k=100): #testar\n # complete\n #DONE\n list=[] \n for s in range(0,len(dna_seq)-(k-1),k):\n list.append(gc_content(dna_seq[s:s+k])) \n return list",
"def get_all_substrings(s, k):\n return [s[ptr:ptr + k] for ptr in range(len(s) - k + 1)]",
"def g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a user's mysql tables back into the OCF database. | def _add_mysql(user, options, dump = None):
# Access the new username with user["username"]
pass | [
"def insert_db():\n populate_tables()",
"def create_tables_and_apply_patches(self):\n\n if self.authorized and not self.db_tables_initiated:\n with self.connection.cursor() as cursor:\n for statement in self.parse_mysql_sql_file():\n cursor.execute(statement)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class for handling all minidump symbolizing code on Android. | def __init__(self, dump_finder, build_dir, symbols_dir=None):
# Map from minidump path (string) to minidump_dump output (string).
self._minidump_dump_output = {}
# Map from minidump path (string) to the directory that should be used when
# looking for symbol binaries (string).
self._minidump_symbol_... | [
"def __init__(self, dump_finder, build_dir, symbols_dir=None):\n # Map from minidump path (string) to minidump_dump output (string).\n self._minidump_dump_output = {}\n # We use the OS/arch of the host, not the device.\n super(AndroidMinidumpSymbolizer, self).__init__(\n platform.system().lower()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of paths to binaries where symbols may be located. | def GetSymbolBinaries(self, minidump):
libraries = self._ExtractLibraryNamesFromDump(minidump)
symbol_binary_dir = self._GetSymbolBinaryDirectory(minidump, libraries)
if not symbol_binary_dir:
return []
return [os.path.join(symbol_binary_dir, lib) for lib in libraries] | [
"def find_binaries():\n\n builddir = Path(__file__).parent.parent / \"builddir\"\n\n bins = []\n\n for folder in [\"examples\", \"tests\", \"tools\"]:\n for path in sorted((builddir / folder).rglob(\"*\")):\n if path.stem.startswith(\"xnvme_single\"):\n continue\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts library names that may contain symbols from the minidump. This is a duplicate of the logic in Chromium's //build/android/stacktrace/crashpad_stackwalker.py. | def _ExtractLibraryNamesFromDump(self, minidump):
default_library_name = 'libmonochrome.so'
minidump_dump_output = self._GetMinidumpDumpOutput(minidump)
if not minidump_dump_output:
logging.warning(
'Could not get minidump_dump output, defaulting to library %s',
default_library_na... | [
"def GetSymbolBinaries(self, minidump):\n libraries = self._ExtractLibraryNamesFromDump(minidump)\n # The main lib.unstripped directory is usually the correct one, but in the\n # case of mixed bitness (e.g. with Monochrome), a different directory might\n # be necessary.\n # We can pretty easily check... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the directory that should contain symbol binaries for |minidump|. | def _GetSymbolBinaryDirectory(self, minidump, libraries):
if minidump in self._minidump_symbol_binaries_directories:
return self._minidump_symbol_binaries_directories[minidump]
# Get the processor architecture reported by the minidump.
arch = None
matcher = re.compile(_PROCESSOR_ARCH_REGEX)
f... | [
"def GetSymbolBinaries(self, minidump):\n libraries = self._ExtractLibraryNamesFromDump(minidump)\n # The main lib.unstripped directory is usually the correct one, but in the\n # case of mixed bitness (e.g. with Monochrome), a different directory might\n # be necessary.\n # We can pretty easily check... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs minidump_dump on the given minidump. Caches the result for reuse. | def _GetMinidumpDumpOutput(self, minidump):
if minidump in self._minidump_dump_output:
logging.debug('Returning cached minidump_dump output for %s', minidump)
return self._minidump_dump_output[minidump]
dumper_path = local_first_binary_manager.GetInstance().FetchPath(
'minidump_dump')
i... | [
"def _GetMinidumpDumpOutput(self, minidump):\n if minidump in self._minidump_dump_output:\n logging.debug('Returning cached minidump_dump output for %s', minidump)\n return self._minidump_dump_output[minidump]\n\n dumper_path = os.path.join(self._build_dir, 'minidump_dump')\n if not os.access(dum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Red = Disable Blue = Enable Any problem such as plugins on dashboard is enable but show disable here, info Owner | async def plugin(self,ctx):
special_case = {"Anime":"myanimelist","Anti Raid":"antiraid"}
plugin_setting = await self.redis.hgetall("{}:Config:Cogs".format(ctx.message.guild.id))
embed = discord.Embed()
cogs = self.bot.cogs.keys()
for x in cogs:
setting = u"\U0001F5... | [
"def __neg__(self):\n _this_module.txt_command('disable {0}'.format(self.fullname))",
"def enabled(self, enable):\n #ic()\n pass",
"def Enabled(self) -> bool:",
"def action_pre_disable(self, software_profile_name, *args, **kwargs):\n pass",
"def disable_feature(self,reason,source... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
store input into filename used pickle.dump | def store (input, filename) :
cout = open (filename, 'w')
pickle.dump (input, cout)
cout.close () | [
"def pickle(self,data,filename):\n pickle.dump(data, open(filename, 'wb'))",
"def save(self, filename): \n pickle.dump(self, open(filename, 'w'))",
"def storeTree(inputTree,filename): \n fw = open(filename,'w')\n pickle.dump(inputTree, fw)\n fw.close",
"def psave(var, filename):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends args and kwargs to any configured callbacks. This handles the cases where the 'callbacks' variable is ``None``, a single function, or a list. | def _multiple_callbacks(callbacks, *args, **kwargs):
if isinstance(callbacks, list):
for cb in callbacks:
cb(*args, **kwargs)
return
if callbacks:
callbacks(*args, **kwargs) | [
"def _multiple_callbacks(callbacks, *args, **kwargs):\n if isinstance(callbacks, list):\n for cb in callbacks:\n cb(*args, **kwargs)\n return\n if callbacks:\n callbacks(*args, **kwargs)",
"def call_all_callbacks(callbacks, *args):\n for callback in callbacks:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds and connects attributes from default encore FKIK switch anim setup to rig nodes in scene Imports default control setup from file or you may specify source_ctrl in args to override | def make_fkikSwitch_connection_attrs(partpre=None, side='Lt', source_ctrl=None, tag_name='switch', snapTo=None,
add_attrs=None):
switch_anim = ''
if source_ctrl is not None:
switch_anim = source_ctrl
partpre = partpre
if partpre == '':
partpre = 'my... | [
"def node_setting_init(self):\n\n # Use nodes\n bpy.context.scene.use_nodes = True\n tree = bpy.context.scene.node_tree\n links = tree.links\n\n # Remove default nodes\n for node in tree.nodes:\n tree.nodes.remove(node)\n \n\n # -- Initialize nodes\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create an IK attribute on the given ctrl, connect IK handles to ik switch. Also connect fk ctrls and ik ctrls visibility to switch. This will create an 'IK' attr on the switch ctrl | def create_fk_ik_switch(switch_ctrl, ik_handles, fk_ctrls, ik_ctrls, vis_ctrl=None, switch_attr_name='IK', vis_attr_name='fkIkCtrlVis'):
fk_ctrls = mc.ls(fk_ctrls)
ik_ctrls = mc.ls(ik_ctrls)
ik_handles = mc.ls(ik_handles)
if not vis_ctrl:
vis_ctrl = switch_ctrl
# Create attributes
if ... | [
"def create_soft_ik(ik_ctrl, ik_joints, ik_handle):\n\n # get name and constant variables\n name = ik_handle+'Soft'\n parent = utils.get_parent(ik_joints[0])\n ik_handle_parent = utils.get_parent(ik_handle)\n\n # get total length of joint chain\n chain_length = 0\n for jnt in ik_joints[1:]:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create soft ik constraint on ikHandle. | def create_soft_ik(ik_ctrl, ik_joints, ik_handle):
# get name and constant variables
name = ik_handle+'Soft'
parent = utils.get_parent(ik_joints[0])
ik_handle_parent = utils.get_parent(ik_handle)
# get total length of joint chain
chain_length = 0
for jnt in ik_joints[1:]:
chain_len... | [
"def add_soft(self, fmla, weight):\n self._variables.update(fmla.get_variables())\n self._soft_constraints.append((fmla, weight))\n if self._handle is None:\n self._handle = _Handle()\n return self._handle",
"def solve_constraint_generic(problem, enqueue_condition=None) :\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Quaterion / matrix based twist for upper arms and legs. | def upper_twist(shoulder_jnt, up_arm_ik_jnt, lo_arm_ik_jnt, up_arm_jnt, lo_arm_jnt, up_arm_twist_jnts):
# Create a group that does not rotate and parent under the ik arm parent (shoulder)
stable_reader_grp = utils.create_node('transform', n=up_arm_ik_jnt+'_stable_reader', p=up_arm_ik_jnt)
# Create a grp t... | [
"def lap_mat(self):",
"def compute_twist(rbt):\n #YOUR CODE HERE\n R = rbt[:3,:3]\n orientation = eqf.find_omega_theta(R)# omega/theta\n v = eqf.find_v(orientation[0], orientation[1], trans).reshape(3,)\n return (v, orientation[0])",
"def a2t2(t, g, nu1, c1, temp, nu2, c2, wc, phi1, phim1):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stretch setup for biped (2 joint chain) arms and legs | def biped_stretch(ik_ctrl,
ik_last_node,
pv_ctrl,
switch_ctrl,
up_arm_fk_ctrl,
lo_arm_fk_ctrl,
wrist_fk_ctrl,
up_arm_ik_jnt,
lo_arm_ik_jnt,
wrist_ik_jnt,
... | [
"def main_str_transform_setup(self, stretch_bone, chain_length):\n\n\t\tcum_length = self.org_chain[0].length\n\t\tfor i, main_str_bone in enumerate(self.main_str_bones):\n\t\t\tif i == 0: continue\n\t\t\tif i == len(self.main_str_bones)-1: continue\n\t\t\tmain_str_helper = self.bone_infos.bone(\n\t\t\t\tname\t\t =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create stratch point constraints on a chain of stretch joints. | def stretch_twist_jnts(start_jnt, end_jnt, twist_jnts):
div = 1.0 / (len(twist_jnts)+1)
for i, joint in enumerate(twist_jnts):
weight = div*(i+1)
mc.pointConstraint(start_jnt, joint, weight=1.0-weight)
mc.pointConstraint(end_jnt, joint, weight=weight) | [
"def main_str_transform_setup(self, stretch_bone, chain_length):\n\n\t\tcum_length = self.org_chain[0].length\n\t\tfor i, main_str_bone in enumerate(self.main_str_bones):\n\t\t\tif i == 0: continue\n\t\t\tif i == len(self.main_str_bones)-1: continue\n\t\t\tmain_str_helper = self.bone_infos.bone(\n\t\t\t\tname\t\t =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Duplicate a joint chain. | def duplicate_chain(chain, search='', replace='', suffix=''):
if suffix:
suffix = '_'+suffix
new_jnts = []
for joint in chain:
new_name = joint.replace(search, replace, 1)+suffix
new_jnt = mc.duplicate(joint, po=1, n=new_name)[0]
if new_jnts:
mc.parent(new_jnt,... | [
"def _duplicate_joints(self):\n\n # Create new joints\n self.fk_joints = joint.duplicate_joints(self.joints, \"fk\")\n\n # Add to setups\n self.setups.extend(self.fk_joints)",
"def _duplicate_joints(self):\n\n # Create new joints\n self.ik_joints = joint.duplicate_joints(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function loops through directory and updates dates of files in said directory. | def update_date(dest=dest):
for root, _, files in os.walk(dest):
ignore = ["README.md","SUMMARY.md"]
_ = [edit_files(root + "/" + file) for file in files if (file not in ignore and file.endswith(".md"))] | [
"def _update_files():\n configuration_settings = get_configuration()\n\n # Need to find all of the files that are stored in the input_files directories in order to start building the\n # reports that will be used to generate the static log files.\n for input_path in configuration_settings.processing.inp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test combining each center's file errors | def test__combine_center_file_errors(syn):
expected_error = (
f"\t{ENT1.name} ({ENT1.id}):\n\nmy errors\nn\n\n"
f"\t{ENT1.name} ({ENT1.id}):\n\nerrors here\nf\n\n"
)
calls = [
mock.call("syn1234", downloadFile=False),
mock.call("syn2345", downloadFile=False),
]
with p... | [
"def test_single_error_merge(self):\n test_folder = base_path +'/test_data/merging_tests/error_test/'\n output_file = os.path.join(test_folder, \"output1.jpg\")\n\n self.assertRaises(mi.ImageError, lambda: mi.add_background(test_folder+\"dummy.txt\", test_folder+\"background.jpg\", output_file)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test getting all center invalid errors | def test_get_center_invalid_errors(syn):
with patch.object(
syn, "tableQuery", return_value=QueryResponse
) as patch_query, patch.object(
write_invalid_reasons, "_combine_center_file_errors", return_value="errors"
) as patch_combine:
center_invalid = write_invalid_reasons.get_center_... | [
"def test_get_data_errors(self):\n with self.assertRaises(Exception):\n self.all_struct.get_cross_validation_chunks(-1)\n with self.assertRaises(Exception):\n self.all_struct.get_cross_validation_chunks(0)\n with self.assertRaises(Exception):\n self.all_struct.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the highest magnification for the slide | def highest_mag(slide):
return int(slide.properties['aperio.AppMag']) | [
"def get_thumbnail_magnification(slide):\n ratio = np.asarray(slide.dimensions) / np.asarray(slide.associated_images[\"thumbnail\"].size)\n # np.sqrt(np.prod(ratio))\n return ratio",
"def get_size_for_mag(slide, mag):\n max_size = slide.dimensions\n max_mag = highest_mag(slide)\n downsample = m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the magnification for each level in a slide | def level_mags(slide):
return [highest_mag(slide)/downsample for downsample in slide.level_downsamples] | [
"def get_level_mag(slide, level):\n return level_mags(slide)[level]",
"def get_thumbnail_magnification(slide):\n ratio = np.asarray(slide.dimensions) / np.asarray(slide.associated_images[\"thumbnail\"].size)\n # np.sqrt(np.prod(ratio))\n return ratio",
"def get_level_for_mag(slide, mag):\n level... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the dimensions of a level | def get_level_size(slide, level):
return slide.level_dimensions[level] | [
"def level_dimensions(self, level: int = 0) -> Tuple[int, int]:\n try:\n return self._wsi.level_dimensions[level]\n except IndexError:\n raise LevelError(\n f\"Level {level} not available. Number of available levels: \"\n f\"{len(self._wsi.level_dime... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the magnification at a particular level | def get_level_mag(slide, level):
return level_mags(slide)[level] | [
"def level_to_mag(level: Optional[int], min_mag: float,\n max_mag: float) -> float:\n if level is None:\n return round(np.random.rand() * (max_mag - min_mag) + min_mag, 1)\n else:\n return round(level / _MAX_LEVEL * (max_mag - min_mag) + min_mag, 1)",
"def _calculate_magnificat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the level corresponding to a certain magnification, if available | def get_level_for_mag(slide, mag):
level_mags_rounded = list(np.round(level_mags(slide), decimals = 2))
if mag in level_mags_rounded:
return level_mags_rounded.index(mag)
else:
return None | [
"def get_level_mag(slide, level):\n return level_mags(slide)[level]",
"def level_to_mag(level: Optional[int], min_mag: float,\n max_mag: float) -> float:\n if level is None:\n return round(np.random.rand() * (max_mag - min_mag) + min_mag, 1)\n else:\n return round(level / _M... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |