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 |
|---|---|---|---|---|---|---|
Return shallow copy of the box. | def copy(self):
cls = type(self)
# Create a new instance without calling __init__: parameters are
# different depending on the class.
new_box = cls.__new__(cls)
# Copy attributes
new_box.__dict__.update(self.__dict__)
return new_box | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n return shallow_clone(self)",
"def clone(self):\n return self.copy()",
"def copy(self):\n return self.mutate().simple_copy()",
"def __copy__(self):\n return self.copy()",
"def shallow_copy(self):\n # TODO: Rename this to __copy__()?\n raise NotImp... | [
"0.7379114",
"0.732625",
"0.7284596",
"0.7245255",
"0.7227114",
"0.722654",
"0.722654",
"0.722654",
"0.722654",
"0.720113",
"0.7200829",
"0.7198012",
"0.7191244",
"0.71871173",
"0.71871173",
"0.71871173",
"0.71871173",
"0.71733266",
"0.7168223",
"0.7140842",
"0.7140842",
"0... | 0.7911073 | 0 |
Height of the border box. | def border_height(self):
return self.padding_height() + self.border_top_width + \
self.border_bottom_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def margin_height(self):\n return self.border_height() + self.margin_top + self.margin_bottom",
"def widget_height(self) -> int:\n return self.widget_size[1]",
"def border_box_y(self):\n return self.position_y + self.margin_top",
"def fill_height(self) -> int:\n\n return self.widg... | [
"0.7547454",
"0.74408555",
"0.73188794",
"0.7287243",
"0.7153241",
"0.7085284",
"0.7085284",
"0.7028676",
"0.7028676",
"0.7028676",
"0.7008414",
"0.700596",
"0.7001656",
"0.6973002",
"0.6957458",
"0.6936312",
"0.6936312",
"0.6936312",
"0.6936312",
"0.6935184",
"0.69146097",
... | 0.8552498 | 0 |
Absolute horizontal position of the content box. | def content_box_x(self):
return self.position_x + self.margin_left + self.padding_left + \
self.border_left_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def border_box_x(self):\n return self.position_x + self.margin_left",
"def horiz_center(self):\n return self._horiz_center",
"def horiz_center(self):\n return self._horiz_center",
"def get_x_position(self):\n return self.rect.x",
"def getAbsoluteLeft(self):\n return self.... | [
"0.6728505",
"0.66553515",
"0.66553515",
"0.6581842",
"0.65807885",
"0.6534253",
"0.64621174",
"0.6404666",
"0.6379179",
"0.6120783",
"0.60490865",
"0.6027229",
"0.6020938",
"0.60104346",
"0.5994419",
"0.5983199",
"0.597157",
"0.597157",
"0.59531415",
"0.5923712",
"0.5919226"... | 0.7834931 | 0 |
Absolute vertical position of the content box. | def content_box_y(self):
return self.position_y + self.margin_top + self.padding_top + \
self.border_top_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def border_box_y(self):\n return self.position_y + self.margin_top",
"def get_y_position(self): \n return self.rect.y",
"def top_y(self):\r\n return self.position.y + self.size.y + self.bulk",
"def layout_y(self):\n return self.floris.farm.layout_y",
"def bottom_y(self):\r\... | [
"0.7087281",
"0.67881",
"0.6538821",
"0.6450854",
"0.6425494",
"0.6411425",
"0.63959825",
"0.622453",
"0.6223081",
"0.62028515",
"0.61950654",
"0.6172215",
"0.6163036",
"0.61626035",
"0.6158388",
"0.6143998",
"0.6131259",
"0.6012137",
"0.60040176",
"0.59534836",
"0.5927464",
... | 0.8033591 | 0 |
Absolute horizontal position of the padding box. | def padding_box_x(self):
return self.position_x + self.margin_left + self.border_left_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_box_x(self):\n return self.position_x + self.margin_left + self.padding_left + \\\n self.border_left_width",
"def border_box_x(self):\n return self.position_x + self.margin_left",
"def horizontal_spacing(self):\r\n return self.padding[1] + self.padding[3] + self.marg... | [
"0.6952133",
"0.6891804",
"0.67181057",
"0.65620136",
"0.6416479",
"0.6252712",
"0.617819",
"0.60975415",
"0.60946643",
"0.6084164",
"0.6053155",
"0.6004137",
"0.598554",
"0.59803134",
"0.59803134",
"0.5925337",
"0.5893004",
"0.58872205",
"0.58491534",
"0.5814092",
"0.5773299... | 0.81801754 | 0 |
Absolute vertical position of the padding box. | def padding_box_y(self):
return self.position_y + self.margin_top + self.border_top_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def border_box_y(self):\n return self.position_y + self.margin_top",
"def additional_vertical_padding(self):\n return 0",
"def content_box_y(self):\n return self.position_y + self.margin_top + self.padding_top + \\\n self.border_top_width",
"def vertical_spacing(self):\r\n ... | [
"0.7233211",
"0.71484476",
"0.7135889",
"0.6745091",
"0.6738197",
"0.62514216",
"0.6228163",
"0.6220388",
"0.61600095",
"0.60356116",
"0.60348684",
"0.60247403",
"0.5989435",
"0.5938697",
"0.5928665",
"0.58639675",
"0.58032674",
"0.58032674",
"0.57979786",
"0.5780974",
"0.573... | 0.817486 | 0 |
Absolute horizontal position of the border box. | def border_box_x(self):
return self.position_x + self.margin_left | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_box_x(self):\n return self.position_x + self.margin_left + self.padding_left + \\\n self.border_left_width",
"def get_position(self):\n return self._border.get_position()",
"def padding_box_x(self):\n return self.position_x + self.margin_left + self.border_left_width... | [
"0.73751223",
"0.71634537",
"0.68785566",
"0.66280526",
"0.66280526",
"0.6528443",
"0.6507175",
"0.6370657",
"0.62706405",
"0.6265488",
"0.62021047",
"0.6186619",
"0.6180456",
"0.61801624",
"0.61638564",
"0.6160488",
"0.6090158",
"0.6055241",
"0.60346806",
"0.6022639",
"0.597... | 0.80828613 | 0 |
Absolute vertical position of the border box. | def border_box_y(self):
return self.position_y + self.margin_top | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_box_y(self):\n return self.position_y + self.margin_top + self.padding_top + \\\n self.border_top_width",
"def padding_box_y(self):\n return self.position_y + self.margin_top + self.border_top_width",
"def get_position(self):\n return self._border.get_position()",
... | [
"0.7564933",
"0.71105236",
"0.7084793",
"0.6634344",
"0.64496034",
"0.6349352",
"0.63005346",
"0.62790143",
"0.62748384",
"0.62343097",
"0.62245136",
"0.6224023",
"0.6164834",
"0.60775906",
"0.60721713",
"0.60509175",
"0.60425043",
"0.6029255",
"0.599274",
"0.5981933",
"0.597... | 0.8162051 | 0 |
Return whether this box is floated. | def is_floated(self):
return self.style['float'] in ('left', 'right') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsFloating(self):\r\n\r\n return self.HasFlag(self.optionFloating)",
"def IsDocked(self):\r\n \r\n return not self.HasFlag(self.optionFloating)",
"def IsFloatable(self):\r\n\r\n return self.HasFlag(self.optionFloatable)",
"def semileaf(self):\n if self._leftchild and no... | [
"0.73970026",
"0.6865899",
"0.64380574",
"0.62132263",
"0.62114817",
"0.61071235",
"0.60313225",
"0.60152346",
"0.6008185",
"0.60051405",
"0.5827323",
"0.58010197",
"0.58008677",
"0.57146144",
"0.56798714",
"0.5663555",
"0.56538993",
"0.56024015",
"0.5550096",
"0.55265933",
"... | 0.8501624 | 0 |
Return whether this box is a footnote. | def is_footnote(self):
return self.style['float'] == 'footnote' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_footnote_text(self, par):\n return (par is not None) and (\"foot\" in par.attrs.get(\"class\", []))",
"def is_footnote(self, par):\n if par.find_next_sibling('p') is None:\n return False\n return self.is_footnote_text(par) or self.is_footnote_link(par)",
"def is_footnote_... | [
"0.7265759",
"0.7170218",
"0.6632735",
"0.59218776",
"0.57401067",
"0.5586411",
"0.55315626",
"0.551728",
"0.55106705",
"0.54914474",
"0.5377699",
"0.53599644",
"0.53001225",
"0.52205914",
"0.5200247",
"0.51603234",
"0.51547456",
"0.51104414",
"0.5109226",
"0.5089236",
"0.507... | 0.7547772 | 0 |
Return whether this box is in the absolute positioning scheme. | def is_absolutely_positioned(self):
return self.style['position'] in ('absolute', 'fixed') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_absolute(self) -> bool:\n return isinstance(self, AbsoluteFormula)",
"def is_absolute(self):\r\n \r\n # FIXME(Ole): It is unfortunate that decision about whether points\r\n # are absolute or not lies with the georeference object. Ross pointed this out.\r\n # Moreover, th... | [
"0.7507939",
"0.72111034",
"0.67534184",
"0.6500001",
"0.645585",
"0.635387",
"0.6313501",
"0.6268382",
"0.6267162",
"0.6255716",
"0.6204598",
"0.61716646",
"0.60994166",
"0.6099335",
"0.6075522",
"0.5994977",
"0.5966853",
"0.59599",
"0.5941935",
"0.58888084",
"0.5865557",
... | 0.79945296 | 0 |
Return whether this box is in normal flow. | def is_in_normal_flow(self):
return not (
self.is_floated() or self.is_absolutely_positioned() or
self.is_running() or self.is_footnote()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_normal(self, channel=None):\n return self.get_state(channel) == 0",
"def isBox(self):\n return self.box",
"def normalisable(self):\n\n return np.abs(np.nansum(self.data)) > 0",
"def IsNormalMode(self):\n return self.mode == ViKeyHandler.NORMAL",
"def box_valid(self):\n ... | [
"0.6773206",
"0.6754883",
"0.66144663",
"0.6343029",
"0.6264891",
"0.6247972",
"0.61971253",
"0.6193037",
"0.61818945",
"0.61239284",
"0.6108276",
"0.5996519",
"0.5992594",
"0.59924346",
"0.5968958",
"0.5959272",
"0.59415346",
"0.59253716",
"0.5921145",
"0.5908553",
"0.588005... | 0.83009154 | 0 |
Set to 0 the margin, padding and border of ``side``. | def _reset_spacing(self, side):
self.remove_decoration_sides.add(side)
setattr(self, f'margin_{side}', 0)
setattr(self, f'padding_{side}', 0)
setattr(self, f'border_{side}_width', 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_empty_side(self, side):\n if side == u'right':\n for k,v in self.d.items():\n item = v[0]\n mnemo = ''\n self.d[k] = [item, mnemo]\n\n if side == u'left':\n for k,v in self.d.items():\n item = ''\n ... | [
"0.7036191",
"0.6606974",
"0.6606974",
"0.6606974",
"0.6217911",
"0.6036602",
"0.59891796",
"0.58494824",
"0.57428396",
"0.56421643",
"0.5629919",
"0.55633193",
"0.5546039",
"0.5521607",
"0.55055493",
"0.5504051",
"0.54909146",
"0.54688704",
"0.54688704",
"0.5467622",
"0.5464... | 0.81979334 | 0 |
The type of object. | def type(self):
return self._type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def o... | [
"0.8937486",
"0.8937486",
"0.8937486",
"0.8937486",
"0.8937486",
"0.88385755",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
"0.8824235",
... | 0.7918371 | 63 |
Checks if username doesn't exist | def clean_username(self):
username = self.cleaned_data.get('username')
user_exists = User.objects.filter(username=username).exists()
if user_exists:
raise forms.ValidationError(
'El usuario ya existe en nuestros registros.'
)
return username | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_check(username):\n\n try: \n pwd.getpwnam(username)\n print(\"User %s DOES EXIST. Try a different username.\" % (username)) \n return False\n\n except KeyError: \n print(\"User %s DOES NOT exist. Continuing...\" % (username)) \n return True",
"def username... | [
"0.7972532",
"0.79545826",
"0.7847115",
"0.78322953",
"0.7747959",
"0.7713199",
"0.7658261",
"0.764199",
"0.76378953",
"0.7565447",
"0.7561419",
"0.75274974",
"0.749014",
"0.74724287",
"0.7457557",
"0.745078",
"0.7413976",
"0.74097043",
"0.7401796",
"0.7378579",
"0.7369877",
... | 0.72408897 | 34 |
Checks if email doesn't exist | def clean_email(self):
email = self.cleaned_data.get('email')
email_exists = User.objects.filter(email=email).exists()
if email_exists:
raise forms.ValidationError(
'El correo ya existe en nuestros registros.'
)
return email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_exists(self, email):\n user = [user for user in ALL_USERS if user['email'] == email]\n if user:\n return True\n return False",
"def email_exists(self, input_email):\n # SQL query\n query = u\"SELECT * FROM tbl_users WHERE email = %s;\"\n inputs = inp... | [
"0.7584798",
"0.75061446",
"0.74152505",
"0.73657453",
"0.73157233",
"0.7309233",
"0.72540945",
"0.7211691",
"0.72073364",
"0.72073364",
"0.71815467",
"0.7176503",
"0.71681577",
"0.7165214",
"0.71476984",
"0.7137869",
"0.71250343",
"0.71243393",
"0.71171874",
"0.7097332",
"0.... | 0.7097465 | 19 |
Convert a xarray Dataset into a dict of numpy arrays. | def dataset_to_numpy(dataset):
dataset_numpy = {dim: var.values for dim, var in dataset.items()}
return dataset_numpy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_xarray(cls, xarray_object):\n\n array_dict = cls()\n for var in xarray_object:\n array_dict[var] = Array.from_xarray(xarray_object[var])\n\n array_dict.attrs.update(**xarray_object.attrs)\n\n return array_dict",
"def to_xarray(self):\n\n xarray_object = xr.D... | [
"0.6757536",
"0.6720276",
"0.6584834",
"0.6548294",
"0.64767146",
"0.62611365",
"0.615193",
"0.6075919",
"0.6045286",
"0.6007275",
"0.5927304",
"0.58893335",
"0.58324987",
"0.5823576",
"0.5820583",
"0.5749503",
"0.57434094",
"0.57178354",
"0.57171595",
"0.5690036",
"0.565362"... | 0.65587837 | 3 |
returns a Mapping of operation names and it's associated types. | def operations_map(self):
# type: () -> Dict[Union[str, None], str]
document_ast = self.document_ast
operations = {} # type: Dict[Union[str, None], str]
for definition in document_ast.definitions:
if isinstance(definition, ast.OperationDefinition):
if definit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_op_types(self):\n return self.cur_config['ops']",
"def get_file_operations() -> dict:\n\n from FileWrangler.fileops.CompletelyReplace import CompletelyReplaceUIOperation\n from FileWrangler.fileops.Separator import SeparatorUIOperation\n from FileWrangler.fileops.PatternFinding import Pat... | [
"0.68804735",
"0.67007524",
"0.66103023",
"0.66103023",
"0.6447077",
"0.6252341",
"0.61477053",
"0.61160356",
"0.61068416",
"0.6014176",
"0.5966824",
"0.5890129",
"0.58260703",
"0.5815494",
"0.57935053",
"0.57662284",
"0.5743631",
"0.5737179",
"0.57322985",
"0.5711562",
"0.57... | 0.79952025 | 0 |
Return a list of fixed nodes for the problem. | def fixed_nodes(self):
bottom_left = 2 * xy_to_id(0, self.nely, self.nelx, self.nely)
bottom_right = 2 * xy_to_id(self.nelx, self.nely, self.nelx, self.nely)
fixed = numpy.array(
[bottom_left, bottom_left + 1, bottom_right, bottom_right + 1])
return fixed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node_list(self):\n return [[node] for node in self.graph.nodes]",
"def get_nodes(self):\n self.map_graph_id()\n self.nodes_list = [\n self.NX_GRAPHS[self.graph_id].nodes[idx]['label'] \n for idx in range(len(self.NX_GRAPHS[self.graph_id].nodes))]",
"def nodes(... | [
"0.6289943",
"0.6272836",
"0.6270858",
"0.6263859",
"0.6128373",
"0.61160856",
"0.60912627",
"0.6083915",
"0.60730124",
"0.60729504",
"0.60694134",
"0.6046233",
"0.60460246",
"0.60453355",
"0.6017175",
"0.6017175",
"0.6017175",
"0.6008623",
"0.6005863",
"0.6004234",
"0.597307... | 0.73415834 | 0 |
Initialize linear associator model | def __init__(self, input_dimensions=2, number_of_nodes=4, transfer_function="Hard_limit"):
self.input_dimensions = input_dimensions
self.number_of_nodes = number_of_nodes
self.transfer_function = transfer_function
self.initialize_weights() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dualgan:nn.Module, l_adv:float=1., l_rec:float=1., l_idt:float=0.):\n super().__init__()\n store_attr()",
"def __init__(self):\n self.incidents_models = {}\n self.risks = []\n self.incidents_models = None",
"def __init__(self, elementLabels: tuple):\n ... | [
"0.6391725",
"0.6366248",
"0.63397354",
"0.6335165",
"0.6327864",
"0.62552357",
"0.6243334",
"0.62063235",
"0.6159212",
"0.6156385",
"0.6153855",
"0.61227274",
"0.6105251",
"0.6105251",
"0.607627",
"0.6017138",
"0.6017138",
"0.6017138",
"0.6017138",
"0.6017138",
"0.59813696",... | 0.0 | -1 |
This function sets the weight matrix. | def set_weights(self, W):
if(self.weights.shape != W.shape):
return -1
self.weights = W | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_output_weights(self, weight_matrix):\n pass",
"def _set_weights(self, weights):\r\n self.weights = weights.reshape(self.output_size, self.input_size+1)",
"def fill_weight_matrix(self,adjMatrix):\n\t\tassert len(adjMatrix[0]) == self._size\n\t\tself.myWeights = self.init_zero_matrix(self._... | [
"0.75917155",
"0.7561686",
"0.74251693",
"0.74057245",
"0.73995805",
"0.7366359",
"0.73237705",
"0.7178649",
"0.7132717",
"0.7092969",
"0.7077529",
"0.7051122",
"0.7018717",
"0.70061266",
"0.69976825",
"0.69909936",
"0.69626874",
"0.6801653",
"0.6777497",
"0.6747767",
"0.6715... | 0.71820426 | 7 |
Given a batch of data, and the targets, this function adjusts the weights using pseudoinverse rule. | def fit_pseudo_inverse(self, X, y):
X_inverse = np.linalg.pinv(X)
self.weights = np.dot(y,X_inverse) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_weights(weights, target, learn_rate):\r\n\r\n for w in range(0, len(target)):\r\n weights[w] += learn_rate * (target[w] - weights[w])",
"def soft_update_target_network(self):\n \n pars_behavior = self.model.get_weights() # these have form [W1, b1, W2, b2, ..], Wi ... | [
"0.6908424",
"0.6476231",
"0.64345556",
"0.6262481",
"0.6145484",
"0.6142997",
"0.6122697",
"0.60380703",
"0.6024749",
"0.59905016",
"0.5974725",
"0.5926977",
"0.5926524",
"0.5894392",
"0.5840574",
"0.583031",
"0.58120495",
"0.5809123",
"0.57127297",
"0.5702386",
"0.56721133"... | 0.5651017 | 23 |
Get one or more Gym environment wrapper class specified as a hyper parameter "env_wrapper". e.g. | def get_wrapper_class(hyperparams: Dict[str, Any]) -> Optional[Callable[[gym.Env], gym.Env]]:
def get_module_name(wrapper_name):
return ".".join(wrapper_name.split(".")[:-1])
def get_class_name(wrapper_name):
return wrapper_name.split(".")[-1]
if "env_wrapper" in hyperparams.keys():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_env(env, wrappers):\n for wrapper, args in wrappers:\n env = wrapper(env, **args)\n return env",
"def env_is_wrapped(self, wrapper_class: Type[gym.Wrapper], indices: VecEnvIndices = None) -> List[bool]:\n raise NotImplementedError()",
"def get_environment():\n return GenericGymE... | [
"0.6096798",
"0.6052231",
"0.59912294",
"0.57114047",
"0.57114047",
"0.5557337",
"0.55042905",
"0.5464746",
"0.543429",
"0.53685516",
"0.52957886",
"0.5278891",
"0.52631134",
"0.5241795",
"0.5221909",
"0.5214444",
"0.5197946",
"0.51593316",
"0.5158215",
"0.5122617",
"0.511495... | 0.750518 | 0 |
Create environment for testing a trained agent | def create_test_env(
env_id: str,
n_envs: int = 1,
stats_path: Optional[str] = None,
seed: int = 0,
log_dir: Optional[str] = None,
should_render: bool = True,
hyperparams: Optional[Dict[str, Any]] = None,
env_kwargs: Optional[Dict[str, Any]] = None,
) -> VecEnv:
# Create the environm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_env(rank, agents, seed=10000):\n\tdef _init():\n\t\tenv = TradingGameEnv.TradingGameEnv(player_count = NUM_PLAYERS, other_agent_list = agents,\n\t\t\tseq_per_day = SEQ_PER_DAY, cards_per_suit = CARDS_PER_SUIT, player_hand_count = HAND_COUNT,\n\t\t\trandom_seq = True, self_play = SELF_PLAY, policy_type = P... | [
"0.7220108",
"0.7003817",
"0.6894523",
"0.6844513",
"0.68102515",
"0.6799078",
"0.6743154",
"0.6700907",
"0.66974413",
"0.6640475",
"0.6633822",
"0.66282904",
"0.66203725",
"0.6607242",
"0.65914094",
"0.65685356",
"0.6561079",
"0.6529526",
"0.6463921",
"0.6440378",
"0.637764"... | 0.62644726 | 27 |
Linear learning rate schedule. | def linear_schedule(initial_value: Union[float, str]) -> Callable[[float], float]:
if isinstance(initial_value, str):
initial_value = float(initial_value)
def func(progress_remaining: float) -> float:
"""
Progress will decrease from 1 (beginning) to 0
:param progress_remaining: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lr_schedule(epoch, current_lr):\n lr = current_lr\n if epoch == 23: lr *= 0.5\n elif epoch == 21: lr *= 1e-1\n elif epoch == 16: lr *= 1e-1\n elif epoch == 11: lr *= 1e-1\n return lr",
"def lr_schedule(epoch,lr):\r\n learning_rate = lr\r\n if epoch > 10:\r\n learning_rate *= 0.1\r\n ... | [
"0.75147927",
"0.7498791",
"0.74401283",
"0.7395729",
"0.73818046",
"0.73818046",
"0.73818046",
"0.73818046",
"0.7321529",
"0.73215175",
"0.7317692",
"0.731659",
"0.731496",
"0.72786736",
"0.7256097",
"0.7231925",
"0.7225809",
"0.72007567",
"0.71790355",
"0.71790355",
"0.7156... | 0.0 | -1 |
Gets the build directory, if it is different from the package dir | def get_build_dir(package_dir):
return os.path.split(makepkg(["--packagelist"], True, package_dir)[0])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_directory(self) -> Optional[str]:\n return self.configuration.build_directory",
"def output_dir(self):\n return self.c.build_dir.join(self.c.build_config_fs)",
"def get_package_dir():\n return Path(__file__).parent",
"def GetPackageDirectory():\n return os.path.dirname(__file__)",
... | [
"0.7862443",
"0.75938064",
"0.7481042",
"0.73216975",
"0.6991647",
"0.6930225",
"0.6872608",
"0.6819463",
"0.67386687",
"0.6714438",
"0.67099077",
"0.6677071",
"0.6583682",
"0.6583368",
"0.65579236",
"0.655382",
"0.65140015",
"0.6500912",
"0.64612174",
"0.63854384",
"0.63827"... | 0.8245016 | 0 |
Constructs an empty Deque. | def __init__(self):
self._front = None
self._rear = None
self._size = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_empty_deque():\n from deque import Deque\n new_deque = Deque()\n return new_deque",
"def make_empty_queue():\n return Queue(0, None, None)",
"def filled_deque():\n from deque import Deque\n new_filled_deque = Deque([4, 3, 2, 1])\n return new_filled_deque",
"def full_deque():\n ... | [
"0.78957057",
"0.7683682",
"0.7357979",
"0.732451",
"0.7282869",
"0.7282869",
"0.7249888",
"0.7075481",
"0.69550776",
"0.68943685",
"0.6795114",
"0.6795114",
"0.6795114",
"0.6795114",
"0.6785788",
"0.6767234",
"0.67031604",
"0.66935194",
"0.6661223",
"0.6635992",
"0.6621864",... | 0.0 | -1 |
Adds item to the front of the Deque. | def addFront(self, item, clock):
temp = Node2Way(item, clock)
temp.setPrevious(self._front)
if self._size == 0:
self._rear = temp
else:
self._front.setNext(temp)
self._front = temp
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue_front(self, item):\n self._items.insert(0, item)",
"def add_front(self, item):\n\n self.items.insert(0, item)",
"def append_front(self, item):\n\n self.front = Node(item, self.front)",
"def push(self, item):\n super().add_item_to_front(item)",
"def insertFront(self, ... | [
"0.8503061",
"0.84112746",
"0.806158",
"0.7935762",
"0.79062057",
"0.7791102",
"0.7592936",
"0.75804085",
"0.7571454",
"0.7532207",
"0.7532207",
"0.7499569",
"0.7430051",
"0.729814",
"0.7292674",
"0.7199572",
"0.7182535",
"0.71400446",
"0.70909846",
"0.7067429",
"0.7030358",
... | 0.75836325 | 7 |
Adds item to the front of the Deque. | def addRear(self, item, clock):
temp = Node2Way(item, clock)
temp.setPrevious(self._rear)
if self._size == 0:
self._front = temp
else:
self._rear.setNext(temp)
self._rear = temp
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue_front(self, item):\n self._items.insert(0, item)",
"def add_front(self, item):\n\n self.items.insert(0, item)",
"def append_front(self, item):\n\n self.front = Node(item, self.front)",
"def push(self, item):\n super().add_item_to_front(item)",
"def insertFront(self, ... | [
"0.8503061",
"0.84112746",
"0.806158",
"0.7935762",
"0.79062057",
"0.7791102",
"0.7592936",
"0.75836325",
"0.75804085",
"0.7571454",
"0.7532207",
"0.7532207",
"0.7499569",
"0.7430051",
"0.729814",
"0.7292674",
"0.7199572",
"0.7182535",
"0.71400446",
"0.70909846",
"0.7067429",... | 0.0 | -1 |
Returns the front item of the Deque without removing it. | def peekFront(self):
if self._size == 0:
raise AttributeError("Cannot peekFront from an empty Deque")
return self._front.getData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dequeue_front(self):\n try:\n return self._items.pop(0)\n except:\n raise IndexError('The deque is empty')",
"def peek_front(self):\n if ((self.is_empty()) or self.data_[self.front_]== None): #If we trip this if block we raise an error since we know the deque should... | [
"0.8411548",
"0.83858526",
"0.8352976",
"0.8334104",
"0.8310938",
"0.82863164",
"0.82146513",
"0.8045097",
"0.803487",
"0.8033181",
"0.8032885",
"0.80267525",
"0.80193824",
"0.8011991",
"0.79220986",
"0.7900422",
"0.7900422",
"0.789885",
"0.7890735",
"0.7772636",
"0.77380794"... | 0.8432476 | 0 |
Returns the rear item of the Deque without removing it. | def peekRear(self):
# ADD CODE HERE
if self._size == 0:
raise AttributeError("Cannot peek rear from an empty Deque")
return self._rear.getData() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dequeue_rear(self):\n try:\n return self._items.pop()\n except:\n raise IndexError('The deque is empty')",
"def removeRear(self):\n # ADD CODE HERE\n if self._size == 0:\n raise AttributeError(\"Cannot remove rear from an empty Deque\")\n\n ... | [
"0.83373857",
"0.8256974",
"0.82050604",
"0.80810225",
"0.80195206",
"0.7987391",
"0.7950262",
"0.7950262",
"0.7943264",
"0.792392",
"0.7901924",
"0.78893733",
"0.7889306",
"0.7889306",
"0.7886396",
"0.7886336",
"0.78707236",
"0.7868281",
"0.785302",
"0.783849",
"0.7832302",
... | 0.81609875 | 3 |
Returns the number of items in the Deque. | def size(self):
return self._size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\n return len(self.items)",
"def size(self) -> int:\n return self.num_items",
"def size(self):\n return len(self._queue_items)",
"def items_count(self):\n ... | [
"0.7717007",
"0.7717007",
"0.7685522",
"0.7664394",
"0.7634923",
"0.7613052",
"0.7595032",
"0.75913787",
"0.75481284",
"0.7546288",
"0.7540771",
"0.7540771",
"0.74724704",
"0.74078655",
"0.74078655",
"0.7404437",
"0.7394497",
"0.7392858",
"0.738907",
"0.7370105",
"0.7370105",... | 0.0 | -1 |
Returns a string representation of all items from rear to front. | def __str__(self):
resultStr = "(rear)"
current = self._rear # point current at rear node
while current != None: # while current points to a node
resultStr = resultStr + " " + str(current.getData())
current = current.getNext() # move current to next node
resultSt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"Front -> \" + repr(self._items) + \" <- Rear\"",
"def __str__(self) -> str:\n res = '*** top of stack ***\\n'\n\n # iterate through the stack.\n # Note: we are using our __iter__ method here\n for element in self:\n res += str(element) ... | [
"0.7321274",
"0.6566139",
"0.6536937",
"0.63982487",
"0.6382842",
"0.6375123",
"0.63610363",
"0.63105345",
"0.6284797",
"0.62781686",
"0.6278072",
"0.6278072",
"0.6259798",
"0.6239803",
"0.6234658",
"0.62344724",
"0.6197469",
"0.61948586",
"0.61867374",
"0.61830455",
"0.61785... | 0.73797476 | 0 |
Checks if ship collides with a pipe. | def collision_pipes(self, pipes_list: list):
result = False
for pipe in pipes_list:
if self.x_pos + self.width > pipe.x_pos and self.x_pos < pipe.x_pos + pipe.width:
if self.y_pos < pipe.y_pos_up + pipe.height: # collide with top
result = True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_collision(self, obj: Union[Pipe, Base], base: Base) -> bool:\n bird_mask = self.get_mask()\n for mask, top in zip(obj.get_mask(), obj.get_tops()):\n if bird_mask.overlap(mask, (round(obj.x) - self.x, top - int(self.y))):\n return True\n\n # Collision wit... | [
"0.665745",
"0.6594883",
"0.6406942",
"0.63645035",
"0.6194801",
"0.6161226",
"0.61601794",
"0.6095289",
"0.6053193",
"0.6053087",
"0.6022381",
"0.59645474",
"0.5922599",
"0.5922125",
"0.59153587",
"0.5868596",
"0.58149797",
"0.5807791",
"0.5790609",
"0.5783216",
"0.5763555",... | 0.7081068 | 0 |
Checks if ship collides with a pipe. | def collision_hourglass(self, hourglass: Hourglass):
result = False
if self.x_pos + self.width >= hourglass.x_pos and self.x_pos < hourglass.x_pos + hourglass.width: # x collapse
if self.y_pos < hourglass.y_pos + hourglass.height and self.y_pos + self.height > hourglass.y_pos:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collision_pipes(self, pipes_list: list):\n result = False\n for pipe in pipes_list:\n if self.x_pos + self.width > pipe.x_pos and self.x_pos < pipe.x_pos + pipe.width:\n if self.y_pos < pipe.y_pos_up + pipe.height: # collide with top\n result = True\n... | [
"0.7078979",
"0.66547304",
"0.65941495",
"0.6406585",
"0.6366871",
"0.61936396",
"0.61596763",
"0.615884",
"0.60936147",
"0.6052015",
"0.6051961",
"0.6019696",
"0.5962686",
"0.5921747",
"0.5920889",
"0.5915922",
"0.5867209",
"0.58153254",
"0.58091414",
"0.57893723",
"0.578519... | 0.0 | -1 |
Resets ship object to start a new game. | def reset(self):
self.x_pos = -self.width
self.y_pos = self.screenHeight / 2 - self.height
self.isJump = False
self.y_velocity = self.origin_y_velocity
self.x_velocity = self.origin_x_velocity
self.score = 0
self.spriteCount = 0
self.goForward = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNewShip(self):\n self._ship = Ship()",
"def setNewShip(self):\r\n self._ship = Ship(GAME_WIDTH/2,SHIP_BOTTOM+SHIP_HEIGHT/2,SHIP_WIDTH,\r\n SHIP_HEIGHT,'ship.png')",
"def reset(self):\n self.ship_list = self.backup_list",
"def reset_game(self):\n self.ships_left =... | [
"0.7613012",
"0.71007055",
"0.7032546",
"0.7012762",
"0.69223547",
"0.67419815",
"0.66071326",
"0.65688974",
"0.6509298",
"0.64954394",
"0.6476439",
"0.6469589",
"0.64524686",
"0.6443982",
"0.63852894",
"0.6375697",
"0.63743085",
"0.63743085",
"0.6371009",
"0.6367636",
"0.636... | 0.5989748 | 65 |
Returns a string representation of the program manager. | def __str__(self):
if self.root is None:
return 'Folder <root>'
else:
ind = self.pids.index(self.root)
if self.ptypes[ind] == 'folder':
return 'Folder (' + self.root + ')'
elif self.ptypes[ind] == 'program':
return '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return self.program_name",
"def __str__(self):\n self._validate()\n commandline = \"%s \" % self.program_name\n for parameter in self.parameters:\n if parameter.is_set:\n #This will include a trailing space:\n commandline +... | [
"0.68664634",
"0.6558628",
"0.6200472",
"0.61865264",
"0.6116562",
"0.608411",
"0.6003443",
"0.5948345",
"0.5945958",
"0.5880138",
"0.5869755",
"0.5863907",
"0.58474433",
"0.5846502",
"0.5815469",
"0.58097833",
"0.5803294",
"0.5791979",
"0.57829946",
"0.57380056",
"0.5731661"... | 0.56202894 | 26 |
Initialize object with first name, last name, address | def __init__(self, first_name, last_name, address):
self.first_name = first_name
self.last_name = last_name
self.address = address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, first_name, last_name):\r\n self.first_name = first_name\r\n self.last_name = last_name",
"def __init__(self, first_name, last_name):\r\n\r\n self.first_name = first_name\r\n self.last_name = last_name",
"def __init__(self, first_name: str, last_name: str):\n ... | [
"0.8260607",
"0.8233808",
"0.8079924",
"0.80651474",
"0.80267096",
"0.8012204",
"0.7906889",
"0.7905634",
"0.78780264",
"0.7781363",
"0.7781363",
"0.77198243",
"0.7644383",
"0.7592912",
"0.75897384",
"0.75897384",
"0.75897384",
"0.75897384",
"0.75897384",
"0.75897384",
"0.758... | 0.89666814 | 0 |
Takes in X_train, X_validate and X_test dfs with numeric values only Returns scaler, X_train_scaled, X_validate_scaled, X_test_scaled dfs | def standard_scaler(X_train, X_validate, X_test):
scaler = StandardScaler().fit(X_train)
X_train_scaled = pd.DataFrame(scaler.transform(X_train), index = X_train.index, columns = X_train.columns)
X_validate_scaled = pd.DataFrame(scaler.transform(X_validate), index = X_validate.index, columns = X_validate.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_max_scaler(X_train, X_validate, X_test):\n scaler = sklearn.preprocessing.MinMaxScaler().fit(X_train)\n X_train_scaled = pd.DataFrame(scaler.transform(X_train), index = X_train.index, columns = X_train.columns)\n X_validate_scaled = pd.DataFrame(scaler.transform(X_validate), index = X_validate.ind... | [
"0.74204516",
"0.7194785",
"0.69540775",
"0.69312465",
"0.6831341",
"0.6789244",
"0.6764424",
"0.67450315",
"0.6625847",
"0.66153824",
"0.66031164",
"0.6532654",
"0.6523285",
"0.6507567",
"0.6469304",
"0.64608693",
"0.64427733",
"0.6400517",
"0.6397522",
"0.6267527",
"0.62375... | 0.8094019 | 0 |
Takes in X_train, X_validate and X_test dfs with numeric values only Returns scaler, X_train_scaled, X_validate_scaled, X_test_scaled dfs | def min_max_scaler(X_train, X_validate, X_test):
scaler = sklearn.preprocessing.MinMaxScaler().fit(X_train)
X_train_scaled = pd.DataFrame(scaler.transform(X_train), index = X_train.index, columns = X_train.columns)
X_validate_scaled = pd.DataFrame(scaler.transform(X_validate), index = X_validate.index, colu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standard_scaler(X_train, X_validate, X_test):\n\n scaler = StandardScaler().fit(X_train)\n X_train_scaled = pd.DataFrame(scaler.transform(X_train), index = X_train.index, columns = X_train.columns)\n X_validate_scaled = pd.DataFrame(scaler.transform(X_validate), index = X_validate.index, columns = X_v... | [
"0.80944294",
"0.7196674",
"0.69544864",
"0.6930648",
"0.6832563",
"0.679076",
"0.67655474",
"0.6745233",
"0.66266084",
"0.6617471",
"0.6604811",
"0.6534041",
"0.6525131",
"0.65073156",
"0.64696753",
"0.6459925",
"0.64433837",
"0.6401544",
"0.6399328",
"0.62693506",
"0.623863... | 0.74203056 | 1 |
This helper is invoked by the tested class when it wants to create a new file. Return a filelike object, so that we avoid hitting the filesystem. | def new_file_override(self):
self.events_out = StringIO.StringIO()
return self.events_out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_factory(test_workspace):\n\n return FileCreator(test_workspace)",
"def file(self):\n file = BytesIO(b\"the_file\")\n file.name = \"the file name\"\n return File(file)",
"def _tempfile(self):\n fd, path = tempfile.mkstemp(dir = os.path.join(self.root, \"temporary\"))\n ... | [
"0.72354794",
"0.68107456",
"0.6713434",
"0.67001843",
"0.6684421",
"0.65999997",
"0.65577835",
"0.6547843",
"0.6542497",
"0.65304786",
"0.6497866",
"0.64923155",
"0.64845955",
"0.6474557",
"0.6460152",
"0.64301276",
"0.6365805",
"0.6329406",
"0.6313777",
"0.629703",
"0.62644... | 0.0 | -1 |
Sanity check for flask application (used in automated tests) | def page_test():
# get user-name and access rights from IAM
html = "<h3>Hello world! 2</h3>"
return html | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_app():\n pass",
"async def test_app_sanity(cli):\n resp = await cli.get('/')\n assert resp.status == 200",
"def test_06_applications_2(self):\r\n with self.flask_app.app_context():\r\n self.create()\r\n\r\n res = self.app.get('/app', follow_redirects=True)\r\n ... | [
"0.68447715",
"0.6830147",
"0.68236595",
"0.67532414",
"0.66618043",
"0.66547716",
"0.66476446",
"0.6634346",
"0.66061676",
"0.65618896",
"0.65589154",
"0.65514475",
"0.6542755",
"0.6526802",
"0.6526802",
"0.65053743",
"0.6502199",
"0.6499582",
"0.6498814",
"0.6484383",
"0.64... | 0.0 | -1 |
Sanity check for flask application (used in automated tests) | def demo_url():
return render_template('demo_page.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_app():\n pass",
"async def test_app_sanity(cli):\n resp = await cli.get('/')\n assert resp.status == 200",
"def test_06_applications_2(self):\r\n with self.flask_app.app_context():\r\n self.create()\r\n\r\n res = self.app.get('/app', follow_redirects=True)\r\n ... | [
"0.68447715",
"0.6830147",
"0.68236595",
"0.67532414",
"0.66618043",
"0.66547716",
"0.66476446",
"0.6634346",
"0.66061676",
"0.65618896",
"0.65589154",
"0.65514475",
"0.6542755",
"0.6526802",
"0.6526802",
"0.65053743",
"0.6502199",
"0.6499582",
"0.6498814",
"0.6484383",
"0.64... | 0.0 | -1 |
Return user information about an authenticated session | def meta():
if current_user.is_anonymous:
return {"status": 401, "error": "Not Authenticated"}, 401
return {
"id": current_user.id,
"name": current_user.name,
"email": current_user.email,
"access": current_user.access,
}, 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info(self):\n return self.auth.get_user_by_session()",
"def user_info(self):\n \n return self.auth.get_user_by_session()",
"def get_user_info(self, session, apikey):\n if self.is_login(session, apikey):\n session = sessions.first(session=session)\n if sess... | [
"0.8665497",
"0.8163502",
"0.75509804",
"0.75209004",
"0.7508347",
"0.74681795",
"0.74260265",
"0.7319163",
"0.7206339",
"0.71865714",
"0.7186034",
"0.7170858",
"0.71625113",
"0.71600366",
"0.71578586",
"0.7105165",
"0.7094413",
"0.7080187",
"0.6990699",
"0.6979983",
"0.69292... | 0.6339604 | 81 |
A test user should not be able to get details for a nonexistent flavor Request detailed flavor information about a nonexistent image with an id value of "999". Ensure that the flavor is not found. | def test_get_non_existent_flavor(self):
try:
self.flavors_client.get_flavor_details(999)
self.fail('No exception thrown for a non-existent flavor id')
except ItemNotFound:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_flavor_get(self):\n pass",
"def test_get_flavor(self):\n response = self.flavors_client.get_flavor_details(self.flavor_ref)\n flavor = response.entity\n self.assertEqual(self.flavor_ref, flavor.id)",
"def test_will_not_get_instance_by_unknown_flavor_id(self)... | [
"0.69575405",
"0.68212783",
"0.678936",
"0.6644416",
"0.65039134",
"0.65034527",
"0.62204206",
"0.6180263",
"0.61330944",
"0.60907614",
"0.60401416",
"0.60205483",
"0.59740025",
"0.58661395",
"0.5851858",
"0.57882357",
"0.5699298",
"0.5688119",
"0.56547695",
"0.565154",
"0.56... | 0.81344527 | 0 |
A request for a list of flavors should respect the page size requested Get a list of flavors with a page size of 1. Validate that the flavor list returned contains only one flavor. | def test_list_flavors_limit_results(self):
response = self.flavors_client.list_flavors(limit=1)
flavors = response.entity
self.assertEqual(1, len(flavors)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_detailed_limit_results(self):\n response = self.flavors_client.list_flavors_with_detail(limit=1)\n flavors = response.entity\n self.assertEqual(1, len(flavors))",
"def test_list_flavors_min_disk_greater_than_max_flavor_ram(self):\n response = self.flavors_client.... | [
"0.6773399",
"0.6615716",
"0.659806",
"0.6565761",
"0.6352313",
"0.62648416",
"0.6174388",
"0.6113915",
"0.6074305",
"0.6072235",
"0.60364264",
"0.60068774",
"0.59964526",
"0.5996313",
"0.59841347",
"0.59049416",
"0.5883266",
"0.5879322",
"0.58626485",
"0.5859774",
"0.5818552... | 0.7102727 | 0 |
A detailed list of flavors should respect the page size requested Get a detailed list of flavors with a page size of 1. Validate that the flavor list returned contains only one flavor. | def test_list_flavors_detailed_limit_results(self):
response = self.flavors_client.list_flavors_with_detail(limit=1)
flavors = response.entity
self.assertEqual(1, len(flavors)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_detailed_min_ram_larger_than_max_flavor_ram(self):\n response = self.flavors_client.list_flavors_with_detail(\n min_ram=self.max_ram+1)\n flavors = response.entity\n self.assertEqual(len(flavors), 0)",
"def test_list_flavors_limit_results(self):\n resp... | [
"0.72692335",
"0.6993",
"0.6975724",
"0.6775518",
"0.66108835",
"0.6598654",
"0.6595308",
"0.6507704",
"0.6486693",
"0.64632416",
"0.6462133",
"0.6461964",
"0.6436978",
"0.6343365",
"0.6241269",
"0.6231986",
"0.6210635",
"0.61123186",
"0.6027086",
"0.59841406",
"0.5934969",
... | 0.77028376 | 0 |
A detailed list of flavors should respect the minimum disk value Get a detailed list of flavors. Sort the list in ascending size based on disk size. Get the second flavor in the list. Use the selected flavor as the minimum disk value to request a detailed list of flavors. The returned list should contain only flavors w... | def test_list_flavors_detailed_filter_by_min_disk(self):
response = self.flavors_client.list_flavors_with_detail()
flavors = response.entity
# Sort the flavors by disk size in ascending order
flavors.sort(key=lambda k: int(k.disk))
# Remove any flavors from the list that are sm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_filter_by_min_disk(self):\n response = self.flavors_client.list_flavors_with_detail()\n flavors = response.entity\n\n # Sort the flavors by disk size in ascending order\n flavors.sort(key=lambda k: int(k.disk))\n\n # Remove any flavors from the list that are... | [
"0.79064655",
"0.76494086",
"0.7014709",
"0.7003907",
"0.6683093",
"0.6664123",
"0.64579594",
"0.6351199",
"0.62572366",
"0.604422",
"0.5874262",
"0.58390677",
"0.5744783",
"0.5693845",
"0.56822014",
"0.5653456",
"0.56228125",
"0.55915195",
"0.54989654",
"0.54765755",
"0.5413... | 0.8298093 | 0 |
A detailed list of flavors should respect the minimum RAM value Get a detailed list of flavors. Sort the list in ascending size based on RAM. Get the second flavor in the list. Use the selected flavor as the minimum RAM value to request a detailed list of flavors. The returned list should contain only flavors with equa... | def test_list_flavors_detailed_filter_by_min_ram(self):
response = self.flavors_client.list_flavors_with_detail()
flavors = response.entity
# Sort the flavors by RAM in ascending order
flavors.sort(key=lambda k: int(k.ram))
# Remove any flavors from the list that are smaller th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_filter_by_min_ram(self):\n response = self.flavors_client.list_flavors_with_detail()\n flavors = response.entity\n\n # Sort the flavors by RAM in ascending order\n flavors.sort(key=lambda k: int(k.ram))\n\n # Remove any flavors from the list that are smaller... | [
"0.7647747",
"0.73793036",
"0.7116157",
"0.70208275",
"0.674207",
"0.65968704",
"0.62509936",
"0.6178522",
"0.6066959",
"0.5955417",
"0.57257205",
"0.5702084",
"0.5696764",
"0.5689037",
"0.56070036",
"0.55988693",
"0.5544982",
"0.5531503",
"0.5525074",
"0.54804194",
"0.547524... | 0.80745846 | 0 |
A list of flavors should respect the minimum disk value Get a list of flavors. Sort the list in ascending size based on disk size. Get the second flavor in the list. Use the selected flavor as the minimum disk value to request a list of flavors. The returned list should contain only flavors with equal or greater disk s... | def test_list_flavors_filter_by_min_disk(self):
response = self.flavors_client.list_flavors_with_detail()
flavors = response.entity
# Sort the flavors by disk size in ascending order
flavors.sort(key=lambda k: int(k.disk))
# Remove any flavors from the list that are smaller tha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_detailed_filter_by_min_disk(self):\n response = self.flavors_client.list_flavors_with_detail()\n flavors = response.entity\n\n # Sort the flavors by disk size in ascending order\n flavors.sort(key=lambda k: int(k.disk))\n\n # Remove any flavors from the list... | [
"0.7967245",
"0.698046",
"0.6924168",
"0.6551626",
"0.653909",
"0.6505925",
"0.6239511",
"0.6065896",
"0.57148397",
"0.56215006",
"0.56201935",
"0.55881685",
"0.55793554",
"0.5541013",
"0.5526112",
"0.5488403",
"0.54707336",
"0.54130465",
"0.5341823",
"0.5335453",
"0.5334507"... | 0.81360674 | 0 |
A list of flavors should respect the minimum RAM value Get a list of flavors. Sort the list in ascending size based on RAM. Get the second flavor in the list. Use the selected flavor as the minimum RAM value to request a detailed list of flavors. The returned list should contain only flavors with equal or greater RAM s... | def test_list_flavors_filter_by_min_ram(self):
response = self.flavors_client.list_flavors_with_detail()
flavors = response.entity
# Sort the flavors by RAM in ascending order
flavors.sort(key=lambda k: int(k.ram))
# Remove any flavors from the list that are smaller than the
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_detailed_filter_by_min_ram(self):\n response = self.flavors_client.list_flavors_with_detail()\n flavors = response.entity\n\n # Sort the flavors by RAM in ascending order\n flavors.sort(key=lambda k: int(k.ram))\n\n # Remove any flavors from the list that ar... | [
"0.78179264",
"0.7143624",
"0.6959522",
"0.6862549",
"0.6840433",
"0.6356217",
"0.62443584",
"0.5802648",
"0.5756072",
"0.5738406",
"0.572786",
"0.57066953",
"0.56971383",
"0.56776315",
"0.56546545",
"0.5652776",
"0.5617332",
"0.561039",
"0.5388548",
"0.53672916",
"0.5268847"... | 0.78148806 | 1 |
A list of flavors cannot be gotten with invalid min disk size Validate that if the value "invalid_disk" is used as the minimum disk size when requesting a list of flavors a 'Bad Request' error is returned. | def test_list_flavors_filter_by_invalid_min_disk(self):
with self.assertRaises(BadRequest):
response = self.flavors_client.list_flavors(
min_disk='invalid_disk')
flavors = response.entity
self.assertEqual(len(flavors), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_detailed_filter_by_invalid_min_disk(self):\n with self.assertRaises(BadRequest):\n response = self.flavors_client.list_flavors_with_detail(\n min_disk='invalid_disk')\n flavors = response.entity\n self.assertEqual(len(flavors), 0)",
"de... | [
"0.79772615",
"0.7423984",
"0.7410752",
"0.73978215",
"0.71516395",
"0.7127876",
"0.70060366",
"0.6965269",
"0.61212754",
"0.5957699",
"0.58845043",
"0.569477",
"0.5557321",
"0.5455618",
"0.5432733",
"0.5420402",
"0.5408405",
"0.5384821",
"0.5377821",
"0.53583497",
"0.5343149... | 0.81898594 | 0 |
A list of flavors cannot be gotten with invalid min RAM value Validate that if the value "invalid_ram" is used as the minimum RAM value when requesting a detailed list of flavors a 'Bad Request' error is returned. | def test_list_flavors_filter_by_invalid_min_ram(self):
with self.assertRaises(BadRequest):
response = self.flavors_client.list_flavors(min_ram='invalid_ram')
flavors = response.entity
self.assertEqual(len(flavors), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_detailed_filter_by_invalid_min_ram(self):\n with self.assertRaises(BadRequest):\n response = self.flavors_client.list_flavors_with_detail(\n min_ram='invalid_ram')\n flavors = response.entity\n self.assertEqual(len(flavors), 0)",
"def t... | [
"0.8222114",
"0.78415656",
"0.7670671",
"0.7519925",
"0.7332289",
"0.72744393",
"0.71596193",
"0.6792408",
"0.6772193",
"0.6239186",
"0.60609823",
"0.59127426",
"0.5704961",
"0.56056166",
"0.55798525",
"0.5540946",
"0.55113494",
"0.54793704",
"0.54600227",
"0.542845",
"0.5427... | 0.82892764 | 0 |
A detailed list of flavors should respect the minimum RAM value Use the flavor with the largest RAM value selected during setup to generate a RAM value greater than the RAM value of any available flavor. Use this value as the minimum RAM value to request a detailed list of flavors. The returned list should contain no f... | def test_list_flavors_detailed_min_ram_larger_than_max_flavor_ram(self):
response = self.flavors_client.list_flavors_with_detail(
min_ram=self.max_ram+1)
flavors = response.entity
self.assertEqual(len(flavors), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_detailed_filter_by_min_ram(self):\n response = self.flavors_client.list_flavors_with_detail()\n flavors = response.entity\n\n # Sort the flavors by RAM in ascending order\n flavors.sort(key=lambda k: int(k.ram))\n\n # Remove any flavors from the list that ar... | [
"0.78036183",
"0.7468705",
"0.7450239",
"0.69815814",
"0.6633264",
"0.64935136",
"0.6447969",
"0.6383293",
"0.6196574",
"0.611326",
"0.6096169",
"0.601967",
"0.5914473",
"0.58840567",
"0.5716161",
"0.56621754",
"0.5658563",
"0.56528366",
"0.56454223",
"0.5555029",
"0.5553954"... | 0.7839815 | 0 |
A list of flavors should respect the minimum RAM value Use the flavor with the largest RAM value selected during setup to generate a RAM value greater than the RAM value of any available flavor. Use this value as the minimum RAM value to request a list of flavors. The returned list should contain no flavors. | def test_list_flavors_min_disk_greater_than_max_flavor_ram(self):
response = self.flavors_client.list_flavors(min_ram=self.max_ram+1)
flavors = response.entity
self.assertEqual(len(flavors), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_flavors_filter_by_min_ram(self):\n response = self.flavors_client.list_flavors_with_detail()\n flavors = response.entity\n\n # Sort the flavors by RAM in ascending order\n flavors.sort(key=lambda k: int(k.ram))\n\n # Remove any flavors from the list that are smaller... | [
"0.7719621",
"0.7444388",
"0.728215",
"0.6574974",
"0.6445169",
"0.64293814",
"0.6190854",
"0.61504924",
"0.6129567",
"0.6036931",
"0.58160037",
"0.57745135",
"0.57065696",
"0.5670365",
"0.56702673",
"0.5668343",
"0.56143826",
"0.5571212",
"0.5508676",
"0.5461132",
"0.5442216... | 0.7527261 | 1 |
Returns true if the stack is empty | def empty(self):
return False if self.items else True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self):\r\n return len(self.stack) == 0",
... | [
"0.9305836",
"0.92613053",
"0.92524546",
"0.9214772",
"0.9208443",
"0.91811085",
"0.91811085",
"0.91415906",
"0.9096282",
"0.9041763",
"0.9005153",
"0.8998196",
"0.89502347",
"0.8933985",
"0.8933985",
"0.8927363",
"0.8907168",
"0.8875383",
"0.884464",
"0.8828912",
"0.880489",... | 0.0 | -1 |
Adds a new item to the top of the stack | def push(self, new_item):
self.items.append(new_item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, item):\r\n self.stack.insert(0, item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n # Reassign the link to top of the stack and update the\n self.top = [item] + self.top",
"d... | [
"0.8620121",
"0.83016",
"0.83016",
"0.8186542",
"0.81092334",
"0.80427295",
"0.79207015",
"0.78931206",
"0.7859435",
"0.7789774",
"0.7779491",
"0.77564436",
"0.7720832",
"0.7679282",
"0.7653648",
"0.7614214",
"0.76020825",
"0.7488552",
"0.745698",
"0.7434519",
"0.7416267",
... | 0.7282818 | 28 |
Returns true if the stack is empty | def empty(self):
return False if self.items else True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self):\r\n return len(self.stack) == 0",
... | [
"0.9305836",
"0.92613053",
"0.92524546",
"0.9214772",
"0.9208443",
"0.91811085",
"0.91811085",
"0.91415906",
"0.9096282",
"0.9041763",
"0.9005153",
"0.8998196",
"0.89502347",
"0.8933985",
"0.8933985",
"0.8927363",
"0.8907168",
"0.8875383",
"0.884464",
"0.8828912",
"0.880489",... | 0.0 | -1 |
Returns true if the stack is empty | def empty(self):
return False if self.items else True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self):\r\n return len(self.stack) == 0",
... | [
"0.93045145",
"0.9260007",
"0.92513",
"0.9213735",
"0.92072403",
"0.9179939",
"0.9179939",
"0.91410196",
"0.9095541",
"0.9040253",
"0.9004623",
"0.8996372",
"0.89486843",
"0.893283",
"0.893283",
"0.8926122",
"0.89067554",
"0.8874167",
"0.8843005",
"0.8827909",
"0.88043624",
... | 0.0 | -1 |
Returns pose/velocity of the platform | def get_configuration(self):
return self.dynamics.joint_state(self._get_state(), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocity(self):\n return self.base_platform.velocity",
"def relative_velocity(self):\n return self.base_platform.relative_velocity",
"def getVelocity(self):\n return self.v",
"def get_pose(self):\n return self._model.get_pose()",
"def present_velocity(self):\n return self... | [
"0.7533078",
"0.7068033",
"0.6780903",
"0.6751468",
"0.674127",
"0.6727141",
"0.67038786",
"0.6695513",
"0.66722524",
"0.6626946",
"0.659814",
"0.65617824",
"0.651505",
"0.651505",
"0.647296",
"0.64081824",
"0.635317",
"0.6294779",
"0.6260986",
"0.6258995",
"0.62391233",
"0... | 0.0 | -1 |
Return list of primes less than n | def sieve_of_eratosthenes(n):
res = [2]
i = 3
marked = set()
while i <= n**.5:
if i not in marked:
res.append(i)
j = 0
while j <= n/i:
marked.add(i + j*i)
j += 1
i += 2
while i <= n:
if i not in marked:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]",
"def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i)\n return primeList",
"def generate_prime_less_than_n(n):\n\tif n <= 1:\n\t\treturn []\n\tlist_of_primes = [2]\n\tfor i in range... | [
"0.85877454",
"0.83639765",
"0.82958645",
"0.82537484",
"0.81773555",
"0.8175165",
"0.8055133",
"0.8029037",
"0.8020284",
"0.7970635",
"0.79358584",
"0.79313624",
"0.7929669",
"0.79196995",
"0.78625333",
"0.78057945",
"0.77480763",
"0.77270615",
"0.76826465",
"0.76776105",
"0... | 0.0 | -1 |
Return the execute table as a data frame | def get_execute_table(self, limit=None):
query = self.select_all()
self.cur.execute(query)
if limit is None:
result = self.cur.fetchall()
else:
result = self.cur.fetchmany(limit)
return to_data_frame(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_execute_table(self):\n return self.get_table(self._EXECUTE_LIST)",
"def get_df(self) -> pd.DataFrame:\n return pd.DataFrame(self.fetchall(), columns=self.headers())",
"def as_DataFrame (self):\n return DataFrame(self.table)",
"def targets_to_dataframe(conn):\n return connect_d... | [
"0.7248217",
"0.68042606",
"0.65944356",
"0.6581562",
"0.65078425",
"0.6500838",
"0.6437194",
"0.64358824",
"0.641033",
"0.63869965",
"0.6378579",
"0.6332088",
"0.6309337",
"0.63078797",
"0.62618005",
"0.62390244",
"0.62309873",
"0.6196431",
"0.6182403",
"0.6176415",
"0.61549... | 0.7991539 | 1 |
This function returns the month given by days. | def get_month(self, data):
# Create two empty list.
month = []
# Get the length of data.
total_size = len(data)
# Iterate over the elements and check what month does the time
# belong in the 2015.
for x in range(total_size):
if da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def days_in_month(name):\n if name == \"January\" or name == \"March\" or name == \"May\" or name == \"July\" or name == \"August\" or name == \"October\" or name == \"December\":\n return 31\n elif name == \"February\":\n return 28\n elif name == \"April\" or name == \"June\" or name == \... | [
"0.7139508",
"0.7123913",
"0.6956153",
"0.68911994",
"0.6859444",
"0.6857539",
"0.6783069",
"0.6775877",
"0.67519367",
"0.67519367",
"0.6685244",
"0.66802084",
"0.66560376",
"0.6641984",
"0.661951",
"0.65851104",
"0.6466983",
"0.64599097",
"0.64467096",
"0.6441488",
"0.641605... | 0.58115476 | 93 |
Remove a group from the GroupManager | async def delete_group(ctx, group_name: str, owner: str=None):
if owner and owner != ctx.message.author.name:
if ctx.message.author.id != bot.owner_id:
await ctx.send("Sorry, you don't have permission to delete that group. Nerd.")
else:
owner = ctx.message.author.name
if bg_bot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_group():\n _id = request.form['_id']\n data, code, message = FIELD_SERVICE.remove_group(_id)\n return __result(data, code, message)",
"def delete_group(self, group):\n raise NotImplementedError('delete_group')",
"def removeGroup(self, *args):\n return _libsbml.GroupsModelPlugi... | [
"0.8115871",
"0.80996877",
"0.8061881",
"0.7767342",
"0.7719985",
"0.76509994",
"0.7597447",
"0.755996",
"0.7517175",
"0.74359256",
"0.7421456",
"0.74123335",
"0.7396829",
"0.72429514",
"0.72422725",
"0.7241246",
"0.7207029",
"0.7193853",
"0.71844965",
"0.71823263",
"0.715879... | 0.6453845 | 64 |
''' Parses the mol.atom attribute of PySCF molecule object to get the coordinates and atoms and returns a Molecule object. | def parse_pyscf_atom(atom):
atom_split = atom.split()
atoms = []
xyz = np.zeros((int(len(atom_split) / 4), 3))
for i in range(xyz.shape[0]):
atoms.append(atom_split[4 * i])
xyz[i, 0] = float(atom_split[4 * i + 1])
xyz[i, 1] = float(atom_split[4 * i + 2])
xyz[i, 2] = flo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractAtoms(self, mol):\n\n\t\tself.atomlist = []\n\t\tfor chain in mol.chain:\n\t\t\tfor res in chain.residue:\n\t\t\t\tfor atom in res.atom:\n\t\t\t\t\tself.atomlist.append(atom)",
"def get_mol_masses(mol):\n return np.array([a.GetMass() for a in mol.GetAtoms()])",
"def parse_molecule(smiles: str):\n... | [
"0.63762295",
"0.62692744",
"0.62053746",
"0.61409163",
"0.6098871",
"0.60982925",
"0.6030985",
"0.600189",
"0.5951846",
"0.5931322",
"0.59182084",
"0.5912897",
"0.5877997",
"0.58777696",
"0.58378416",
"0.58369446",
"0.58270377",
"0.58173484",
"0.57828224",
"0.57697034",
"0.5... | 0.743658 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(len(classes))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194965",
"0.8095361",
"0.8029404",
"0.8019132",
"0.79937756",
"0.7991249",
"0.798065",
"0.7975405",
"0.79608935",
"0.79568267",
"0.79377085",
"0.79348165",
"0.7934456",
"0.79314065",
"0.7926248",
"0.79243755",
"0.79241306",
"0.7922902",
"0.79228246",
"0.792212",
"0.791808... | 0.78492916 | 45 |
Check wether the motion is left dominant or right dominant | def IsLeftDominant ( Skeleton_matrix ):
elbowDiffLeft = Skeleton_matrix[1:, 0:12] - Skeleton_matrix[0:-1, 0:12]
elbowDiffRigh = Skeleton_matrix[1:, 12:24] - Skeleton_matrix[0:-1, 12:24]
motionLeft = numpy.sum( numpy.sqrt( numpy.sum(elbowDiffLeft**2)))
motionRigh = numpy.sum( numpy.sqrt( numpy.sum(elb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_left(self):\n if self.pupils_located:\n return self.horizontal_ratio() >= 0.65",
"def right_or_left(self): \n right_sum = 0\n right_avg = 0\n left_sum = 0\n left_avg = 0\n self.scan()\n for angle in self.scan_data:\n if angle < self.MI... | [
"0.66442096",
"0.6593912",
"0.65235335",
"0.6516455",
"0.64921093",
"0.63418454",
"0.59255767",
"0.57339233",
"0.5675734",
"0.5633975",
"0.56130534",
"0.55818325",
"0.5577053",
"0.55738086",
"0.5538296",
"0.5537613",
"0.5473482",
"0.54701084",
"0.546487",
"0.54618853",
"0.542... | 0.72012526 | 0 |
Add item to array, at the end of the current rotation. | def add_item(self, item):
self.items.append(item)
self.length += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, item):\n if self.full or self.pre_allocated:\n # overwrite\n self.data[self.cur] = item\n else:\n self.data.append(item)\n if not self.full:\n self.full = self.cur == self.max - 1\n self.cur = (self.cur + 1) % self.max",
"de... | [
"0.6971427",
"0.67394227",
"0.6503555",
"0.6485873",
"0.6391282",
"0.628604",
"0.62483484",
"0.6230729",
"0.6210632",
"0.6192709",
"0.6181296",
"0.6154072",
"0.61276424",
"0.61196655",
"0.61196655",
"0.61196655",
"0.61196655",
"0.61196655",
"0.6118738",
"0.6114228",
"0.609311... | 0.6288492 | 5 |
Return the data at a particular index. | def get_by_index(self, index):
if index > self.length - 1:
return None
else:
return self.items[index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_at_index(self, index: int) -> object:\n return self.data[index]",
"def __getitem__(self, index):\n\n if self._data_indices is not None:\n index = self._data_indices[index]\n data = self._dataset[index]\n return data",
"def __getitem__(self, index):\n return... | [
"0.83152765",
"0.8258225",
"0.8138882",
"0.8138882",
"0.8091646",
"0.806858",
"0.80271816",
"0.79806983",
"0.79287827",
"0.77824396",
"0.76720756",
"0.76456827",
"0.7636508",
"0.760349",
"0.7576769",
"0.7552055",
"0.75459427",
"0.75103563",
"0.749667",
"0.7448369",
"0.7406558... | 0.6672689 | 76 |
Return objects whose attribute, attr, falls inclusively | def close_to(arr, attr, val, d):
return filter(lambda x: getattr(x, attr) < (val + d) and \
getattr(x, attr) > (val - d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_attr_list(self, attrs):\n for other in attrs:\n if other.matches(self): return True\n return False",
"def _with_attr0(self, attr, val=None):\r\n\r\n if attr in ['x', 'y', 'z']:\r\n TOL = 1.0E-8\r\n\r\n if isinstance(val,list):\r\n tmp = RealList(val, ... | [
"0.6205064",
"0.59380543",
"0.5897298",
"0.5776204",
"0.5750606",
"0.57411385",
"0.5689764",
"0.5567145",
"0.5567145",
"0.5566069",
"0.5536471",
"0.55183005",
"0.55155253",
"0.55040026",
"0.5451062",
"0.5433152",
"0.54315734",
"0.5409424",
"0.5365219",
"0.5365219",
"0.5236640... | 0.5592895 | 7 |
Launches a Chrome instance and returns a Selenium webdriver | def launch(self, user_data_dir=None):
if self.custom_driver:
return self.custom_driver
options = self.driver_options()
return webdriver.Chrome(options=options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chrome():\n driver = Driver()\n driver.browser = 'chrome'\n return Chrome(driver)",
"def launch_chrome():\r\n DRIVER_PATH = '/Users/User/Downloads/chromedriver_win32/chromedriver' #Location of chromedriver application\r\n chrome_options = webdriver.ChromeOptions()\r\n chrome_options.add_arg... | [
"0.8111828",
"0.77044505",
"0.75090927",
"0.7499976",
"0.74697196",
"0.7414706",
"0.7334554",
"0.7237982",
"0.72127736",
"0.71132636",
"0.71099675",
"0.7082748",
"0.7055246",
"0.7044957",
"0.7031518",
"0.7018674",
"0.6960537",
"0.6919676",
"0.6912881",
"0.6901561",
"0.6883496... | 0.71169233 | 9 |
Determines if the predictor has failed. Simply checks the uncertainty passed in to determine whether or not it exceeds some threshold. | def base_failure(self, uncertainty):
return False
rpos = self.sim.getAgentPosition(self.robot_num)
gpos = self.overall_robot_goal
if ((rpos[0]-gpos[0])**2 + (rpos[1]-gpos[1])**2)**0.5 <= \
self.sim.getAgentRadius(self.robot_num):
return True
elif (rpos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_error_at_confidence(self, threshold):\r\n\r\n nominator = numpy.sum(numpy.logical_and(self.test_errors, self.test_confidences >= threshold))\r\n denominator = numpy.sum(self.test_confidences >= threshold)\r\n if denominator > 0:\r\n return nominator / float(denominator)\r\n... | [
"0.6359437",
"0.6272016",
"0.6160693",
"0.6157329",
"0.61359435",
"0.60652316",
"0.6053646",
"0.60488313",
"0.6032285",
"0.602517",
"0.6021534",
"0.60066825",
"0.60007775",
"0.5991141",
"0.5986506",
"0.5979616",
"0.5970319",
"0.5970319",
"0.5939547",
"0.59083027",
"0.5906766"... | 0.76480514 | 0 |
Get the number of PETs in bins. | def getObsPETs(mat, binSize=5000):
minC = np.min(mat)
a = (mat[:, 0] - minC) / binSize
b = (mat[:, 1] - minC) / binSize
a = a.astype(int)
b = b.astype(int)
ss = {}
for i in range(len(a)):
x = a[i]
y = b[i]
if x not in ss:
ss[x] = {}
if y not in ss[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_particles_bins(DG, bins=[0, 0.5, 3, 10, 100]):\n radii = fid.rss(DG.gas['Coordinates'][()])\n hist, bin_edges = np.histogram(radii, bins)\n\n return hist, bin_edges",
"def GetNumberOfBins(self):\n return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IUL2_GetNumberOfBins(s... | [
"0.72959924",
"0.6575715",
"0.6571734",
"0.6554338",
"0.65469116",
"0.6500551",
"0.64836395",
"0.6481808",
"0.6473354",
"0.64645475",
"0.6449608",
"0.6441527",
"0.64285016",
"0.64221364",
"0.6418641",
"0.6397439",
"0.639342",
"0.63787425",
"0.63059306",
"0.6295418",
"0.625193... | 0.55358946 | 87 |
Takes a colour image, where each colour represents one specific labelclass and replaces the colour value with label ids. The mapping is defined by array `colourlabelmap`. | def encode_labelmap(colour_img, colourlabelmap):
colour_img = colour_img.astype(int)
labels = np.zeros((colour_img.shape[0], colour_img.shape[1]), dtype=np.int16)
for label_id, colour in enumerate(colourlabelmap):
labels[np.where(np.all(colour == colour_img, axis=-1))] = label_id
return labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_label_colors(array, ignore_vals=[0]):\n colset = [(166, 206, 227),\n (31, 120, 180),\n (178, 223, 138),\n (51, 160, 44),\n (251, 154, 153),\n (227, 26, 28),\n (253, 191, 111),\n (255, 127, 0),\n (202,... | [
"0.6715757",
"0.6632805",
"0.6518933",
"0.6498073",
"0.63977313",
"0.6355915",
"0.6317171",
"0.6296388",
"0.6277029",
"0.62350404",
"0.6216559",
"0.6162586",
"0.60530454",
"0.6048145",
"0.6036835",
"0.6021017",
"0.6010546",
"0.5999058",
"0.5996457",
"0.5987417",
"0.59450525",... | 0.79581547 | 0 |
Euclidean distance between each row in x_mat and each row in y_mat. | def euclidean(x_mat: 'Tensor', y_mat: 'Tensor', device: str = 'cpu') -> 'numpy.ndarray':
device = tf.device('/GPU:0') if device == 'cuda' else tf.device('/CPU:0')
with _get_tf_device(device):
return tf.sqrt(
tf.reduce_sum((tf.expand_dims(x_mat, 1) - tf.expand_dims(y_mat, 0)) ** 2, 2)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distances(X, Y):\r\n\r\n D = np.zeros((X.shape[0],Y.shape[0]))\r\n \r\n for X_idx in range(X.shape[0]):\r\n for Y_idx in range(Y.shape[0]): \r\n \r\n D[X_idx,Y_idx] = np.sqrt(np.sum((X[X_idx,:]-Y[Y_idx,:])**2))\r\n \r\n return D",
"def euclidean_distance... | [
"0.7589463",
"0.74321777",
"0.73370945",
"0.72543764",
"0.72361743",
"0.70849586",
"0.70610857",
"0.70462006",
"0.70162845",
"0.70080185",
"0.6906394",
"0.68550295",
"0.67314875",
"0.66940135",
"0.666506",
"0.6640727",
"0.65618706",
"0.65566975",
"0.6549469",
"0.6540694",
"0.... | 0.77697575 | 0 |
Return upside down mirror version of grid | def upsidedownmirror(self):
for l in range(self.numRows):
upsideDownGrid = []
for l in range(self.numCols-1,-1,-1):
upsideDownGrid.append(self.grid[l][::-1])
return upsideDownGrid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mirror(self):\n for l in range(self.numRows):\n mirrorGrid = []\n for l in range(self.numCols):\n row = self.grid[l][::-1]\n mirrorGrid.append(row)\n return mirrorGrid",
"def push_down (grid):\r\n for i in range (3):\r\n for row in range(2,-1, -1):\r\n for c... | [
"0.7935506",
"0.72462374",
"0.70518005",
"0.70102024",
"0.6894548",
"0.68804294",
"0.6834116",
"0.682316",
"0.66689914",
"0.6622002",
"0.65921116",
"0.6533905",
"0.65154237",
"0.64962107",
"0.64527524",
"0.64381564",
"0.6384986",
"0.6341907",
"0.63271755",
"0.63228244",
"0.62... | 0.872336 | 0 |
Return a mirror of the grid | def mirror(self):
for l in range(self.numRows):
mirrorGrid = []
for l in range(self.numCols):
row = self.grid[l][::-1]
mirrorGrid.append(row)
return mirrorGrid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_mirror():\n mir = np.array([[1, 0, 0, 0],\n [0, 1, 0, 0],\n [0, 0, -1, 0],\n [0, 0, 0, -1]])\n return mir",
"def upsidedownmirror(self):\n for l in range(self.numRows):\n upsideDownGrid = []\n for l in range(self.numCols-1,-1,-1):... | [
"0.7598251",
"0.75713336",
"0.70959276",
"0.7064602",
"0.7023853",
"0.7012777",
"0.69304353",
"0.67970407",
"0.6779892",
"0.6775998",
"0.6694905",
"0.63585186",
"0.6325471",
"0.6261349",
"0.6208448",
"0.6187639",
"0.6135965",
"0.611668",
"0.6110576",
"0.6102309",
"0.60888433"... | 0.8673302 | 0 |
Compute singlevariate poisson pdf based on given x value. | def pdf(self, x):
if x < 0:
raise Exception("input value x can't be a negative value!")
if self.is_fit:
if x >= 0:
enu = np.power(self.alpha, x) * np.power(np.e, -self.alpha)
den = np.math.factorial(x)
return enu / den
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poisson_pdf(x, u, log=False):\n #return np.exp(-u)*(u**x)/factorial(x)\n #return np.exp(-u)*(u**x)/gamma(x+1)\n if log:\n return poisson.logpmf(x, u)\n return poisson.pmf(x, u)",
"def pdf(self, x, mu, **kwargs):\n xrange = self._xrange_nonzero_(mu)\n \n if ... | [
"0.80060697",
"0.77290285",
"0.746754",
"0.74321085",
"0.73766387",
"0.73766387",
"0.7327724",
"0.7308253",
"0.73033535",
"0.7286893",
"0.72788674",
"0.7229847",
"0.7218555",
"0.7212742",
"0.71262",
"0.70993584",
"0.70681363",
"0.706146",
"0.70385",
"0.70210195",
"0.700163",
... | 0.68149936 | 30 |
Compute singlevariate poisson log pdf based on given x value. | def log_pdf(self, x):
if x < 0:
raise Exception("input value x can't be a negative value!")
if self.is_fit:
if x >= 0:
return -np.log(np.math.factorial(x)) + \
x * np.log(self.alpha) - self.alpha
else:
return 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poisson_pdf(x, u, log=False):\n #return np.exp(-u)*(u**x)/factorial(x)\n #return np.exp(-u)*(u**x)/gamma(x+1)\n if log:\n return poisson.logpmf(x, u)\n return poisson.pmf(x, u)",
"def log_pdf_at_x(x):\n return lambda point: gs.log(\n self.information_manifold.poin... | [
"0.8030542",
"0.7829923",
"0.7691047",
"0.7691047",
"0.7633737",
"0.7405216",
"0.7341674",
"0.73204",
"0.72555554",
"0.72165716",
"0.71938014",
"0.7120553",
"0.71013963",
"0.70813584",
"0.70601296",
"0.7056842",
"0.7052874",
"0.70136195",
"0.700685",
"0.70067114",
"0.6999138"... | 0.75321233 | 5 |
1. If env is a string, use as gym environment. If its a class, use "as is". | def __init__(self, env, agent, agent_config, remote=None):
self.env = Environment(env)
self.episodes = 1000
self.remote = remote
if remote:
self.has_remote_agent = True
else:
self.has_remote_agent = False
"""Agent Class."""
self._agent_cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, env):\n gym.Wrapper.__init__(self, env)",
"def __init__(self, env):\n gym.Wrapper.__init__(self, env)",
"def base_env(*args, **kwargs):\n try:\n # regular gym\n env = gym.make(*args, **kwargs)\n except:\n try:\n # gym retro\n env... | [
"0.6920916",
"0.6920916",
"0.68952525",
"0.66533804",
"0.65653676",
"0.6491083",
"0.6346518",
"0.6346518",
"0.6346518",
"0.63381356",
"0.6236658",
"0.6236658",
"0.6229014",
"0.62052095",
"0.61834896",
"0.61301744",
"0.6070526",
"0.6053397",
"0.6041602",
"0.60350984",
"0.60225... | 0.0 | -1 |
takes a word and a string of letters, and that returns True if the word contains only letters in the string available. | def uses_only(word, available):
for letter in word:
if letter not in available:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_letter(word):\r\n for char in word:\r\n if char.isalpha():\r\n return True\r\n return False",
"def onlyuse(word, letters):\r\n truth = True\r\n for letter in word:\r\n truth = letter in letters and truth\r\n return truth",
"def isSingleLetter(self, word):\n re... | [
"0.86074716",
"0.8513235",
"0.79927224",
"0.79536486",
"0.7836343",
"0.7773489",
"0.75961965",
"0.7531453",
"0.75006104",
"0.737336",
"0.7321533",
"0.7284515",
"0.7254464",
"0.72329587",
"0.71178985",
"0.71171176",
"0.70757115",
"0.7070024",
"0.702876",
"0.70210665",
"0.70097... | 0.7609516 | 6 |
takes a word and a string of required letters, and that returns True if the word uses all the required letters at least once. | def uses_all(word, required):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onlyuse(word, letters):\r\n truth = True\r\n for letter in word:\r\n truth = letter in letters and truth\r\n return truth",
"def uses_all(w, letters):\n\treturn set(letters).issubset(set(w))",
"def can_make_word(word, letters):\n grouped_chars = group_input(word)\n for char in letters... | [
"0.84489214",
"0.7982792",
"0.7876722",
"0.78638417",
"0.77915055",
"0.7626374",
"0.7598347",
"0.74598455",
"0.7446505",
"0.73768705",
"0.7265605",
"0.72264594",
"0.71832824",
"0.7179121",
"0.7172664",
"0.70954055",
"0.70718545",
"0.7045502",
"0.70408785",
"0.7035883",
"0.703... | 0.65470076 | 55 |
Store the existing state of the adapted context as a new version. | def create( self, message, manual = False ):
version = self.domain_model()
context = self.__parent__
trusted = removeSecurityProxy(context)
# set values on version from context
self._copyFields(trusted, version)
# content domain ids are typically not in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context(self, context):\n if self._context == context:\n LOGGER.debug('App context is unchanged and will not be saved: %s', context)\n return\n\n if not isinstance(context, dict):\n raise AppStateError('Unable to set context, must be a dict: {}'.format(context))\n... | [
"0.69409615",
"0.6727992",
"0.65941954",
"0.65410453",
"0.62287426",
"0.61916345",
"0.6127744",
"0.60819423",
"0.6044008",
"0.60309714",
"0.5985948",
"0.59758073",
"0.5943083",
"0.5928237",
"0.59280854",
"0.591799",
"0.591799",
"0.5868256",
"0.58240134",
"0.58123785",
"0.5791... | 0.0 | -1 |
Test to check if the result with months is correct. | def test_result_months_ok(self):
graphic = HeightCurve(
gender=Constants.MALE,
age=Constants.MONTHS
)
# percentis_3
self.assertEqual(graphic.result(42.90, 0), -1)
self.assertEqual(graphic.result(42.91, 0), 0)
self.assertEqual(graphic.result(42.92... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_all_valid_months(self):\n\n for expected, month in enumerate(range(1, 12), 2):\n actual = self.expander.get_next_month(month)\n self.assertEqual(expected, actual)\n self.assertEqual(1, self.expander.get_next_month(12))",
"def test_found_all_months(self):\n ary ... | [
"0.77943224",
"0.76700723",
"0.75122726",
"0.74990994",
"0.7486392",
"0.7460819",
"0.7450114",
"0.7326136",
"0.72269684",
"0.71658486",
"0.70534474",
"0.6999787",
"0.6958122",
"0.6949242",
"0.6918169",
"0.6911351",
"0.6890788",
"0.68556225",
"0.6842833",
"0.6794051",
"0.67794... | 0.6617357 | 24 |
Return True when the lists are equal. | def all_equal(list_a, list_b):
if len(list_a) != len(list_b):
return False
a, b = np.array(list_a), np.array(list_b)
return all(a == b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lists_are_identical(list1, list2):\n if len(list1) != len(list2):\n return False\n for elem1, elem2 in zip(list1, list2):\n if elem1 != elem2:\n return False\n return True",
"def check_lists_equal(list_1, list_2):\n if len(list_1) != len(list_2):\n return False\n ... | [
"0.8187124",
"0.8117367",
"0.8113539",
"0.7717671",
"0.7657437",
"0.7579605",
"0.75186914",
"0.74958646",
"0.7453568",
"0.74317855",
"0.73824066",
"0.7372103",
"0.7364319",
"0.73333275",
"0.7320997",
"0.7228209",
"0.7228009",
"0.72179544",
"0.7203639",
"0.7125817",
"0.711339"... | 0.80524313 | 3 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, EBookConvertOptions):
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 |
r"""Check if string is ASCII numeric (09). | def ascii_numeric(s: str) -> bool:
return frozenset(s).issubset(_ascii_n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_num_char(x):\n return ord('0') <= ord(x) <= ord('9')",
"def isNumeric(string, needHexPrefix):\n return (True)",
"def isNumber(string):\r\n for char in string:\r\n charNum = ord(char)\r\n if (charNum < 48 or charNum > 57):\r\n return False\r\n return True",
"def is_nu... | [
"0.774125",
"0.7464109",
"0.74181896",
"0.71609664",
"0.7144454",
"0.7073901",
"0.68736863",
"0.6838207",
"0.6838207",
"0.6715633",
"0.66421455",
"0.66182935",
"0.6586781",
"0.65756184",
"0.65128654",
"0.64708334",
"0.6457712",
"0.64545965",
"0.64541936",
"0.6440446",
"0.6434... | 0.7651023 | 1 |
Test that we are correctly encoding env vars in our kernel spec | def test_env_vars():
# Create a variable with the file system encoding and save it
# in our PYTHONPATH
env_var = to_fs_from_unicode(u'ñññ')
CONF.set('main', 'spyder_pythonpath', [env_var])
# Create a kernel spec
kernel_spec = SpyderKernelSpec()
# Assert PYTHONPATH is in env vars and it's n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_environment_string(self):\n pass",
"def test_env_top_dict(self, monkeypatch):\n with open(\".scuba.yml\", \"w\") as f:\n f.write(\n r\"\"\"\n image: na\n environment:\n FOO: This is foo\n FOO_WITH... | [
"0.75925577",
"0.700853",
"0.68674994",
"0.6743138",
"0.67153186",
"0.66426075",
"0.66123027",
"0.6543652",
"0.6477192",
"0.6464455",
"0.64430434",
"0.6394149",
"0.6368545",
"0.6348031",
"0.6341027",
"0.6305607",
"0.6299047",
"0.6246474",
"0.6243802",
"0.6232669",
"0.623098",... | 0.7588397 | 1 |
Transform rows to a standard normal distribution | def inverse_normal_transform(M):
R = stats.mstats.rankdata(M, axis=1) # ties are averaged
if isinstance(M, pd.DataFrame):
Q = pd.DataFrame(stats.norm.ppf(R/(M.shape[1]+1)), index=M.index, columns=M.columns)
else:
Q = stats.norm.ppf(R/(M.shape[1]+1))
return Q | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gen_normal(self, count, **kwargs):\n normal = scipy.stats.norm(loc=kwargs['mean'], scale=kwargs['stdev'])\n rvs = normal.rvs(count)\n return rvs",
"def normalize_standard_deviation(dataset):\n return dataset*(1/np.std(dataset))",
"def normalize(values):\n return (values - np.mean(... | [
"0.68190247",
"0.6764567",
"0.67454267",
"0.67383444",
"0.6730055",
"0.67108285",
"0.6682377",
"0.65742296",
"0.6554936",
"0.6517874",
"0.6480299",
"0.64562374",
"0.6451684",
"0.6423905",
"0.6423815",
"0.6412694",
"0.6412694",
"0.64110565",
"0.6385403",
"0.63780075",
"0.63749... | 0.6118123 | 41 |
Logs specified patches with real image patch and groundtruth label to comet | def log_patches(comet, epoch, batch_img1, batch_img2, labels, cd_preds):
batch_size = batch_img1.shape[0]
samples = list(range(0, batch_size, 10))
for sample in samples:
sample_img1 = _denorm_image(batch_img1, sample)
sample_img2 = _denorm_image(batch_img2, sample)
# log cd
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_patches(rimage, gimage, mimage, num_patches=48, patch_size=80, patch_stride=80):\n num_FSpatches = 16\n num_RApatches = 32\n rpatches = []\n gpatches = []\n mpatches = []\n #R_imgs = ((rimage+1)*127.5).astype(np.uint8)\n #scipy.misc.imsave('results'+'/' + 'rainy.jpg', R_imgs[0,:,:,:])\... | [
"0.62412834",
"0.5875176",
"0.5683001",
"0.5674835",
"0.5669401",
"0.56321836",
"0.56107026",
"0.56032974",
"0.5525512",
"0.5513703",
"0.5494003",
"0.54565084",
"0.5452301",
"0.54286367",
"0.539818",
"0.5395479",
"0.53935844",
"0.5336021",
"0.5320349",
"0.52976197",
"0.529745... | 0.6434358 | 0 |
Given user arguments, loads dataset metadata, loads full onera dataset, defines a preloader and returns train and val dataloaders | def get_loaders(opt):
train_samples, val_samples = get_train_val_metadata(opt.dataset_dir,
opt.validation_cities,
opt.patch_size,
opt.stride)
pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataloader(self):\n\n # load / split data\n train_data = self.data.get_train_data()\n if self.args.use_dev:\n train_data, dev_data = self.data.split_data(train_data)\n test_data = self.data.get_test_data()\n\n #print(train_data[0])\n #print(dev_data[0])\n ... | [
"0.7539904",
"0.7458606",
"0.73879087",
"0.73845744",
"0.7376338",
"0.7292914",
"0.72840375",
"0.7209982",
"0.70393264",
"0.7028568",
"0.6956872",
"0.6948966",
"0.6943288",
"0.68969864",
"0.6879262",
"0.6878095",
"0.6865113",
"0.68500304",
"0.67280823",
"0.67159665",
"0.67139... | 0.74586946 | 1 |
Returns the Z/r potential energy curve for the atom for all points r | def get_nuclear_potential(self, r):
return -self.nuclear_charge/r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy(self, r):\n sigma = self.params['sigma']\n epsilon = self.params['epsilon']\n s = sigma / r\n s6 = s**6; s12 = s6 * s6\n pot = 4.0 * epsilon * (s12 - s6)\n return pot",
"def Er( z, r, epsilon, k0, w0, wp, t) :\n Er_array = \\\n epsilon * m_e*c**2/e *... | [
"0.71010906",
"0.666124",
"0.6576645",
"0.6448738",
"0.64126766",
"0.6352892",
"0.61737823",
"0.6098233",
"0.6070207",
"0.6012644",
"0.59255",
"0.5922552",
"0.5868461",
"0.58620566",
"0.5858182",
"0.58456755",
"0.582571",
"0.582491",
"0.5815666",
"0.5814875",
"0.581461",
"0... | 0.55532914 | 40 |
Generate a radial integration grid containing n points. | def make_grid(n, gl=False):
if gl:
low = 0.0 # Lower Range
high = 1.0
p = 0.5
# The method here uses 2*n points so halve it
n, r, wt = GridGenerator.gaussp(low, high, n//2)
r = np.concatenate((r, np.zeros((n))))
wt = np.concat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomgrid(self, n):\n lam = np.random.random((n, 3))\n return self.normalize(lam)",
"def make_grid(N):\n\n x = np.linspace(-2. , 2 , N)\n y = np.linspace(-2. , 2 , N)\n # two evenly spaced grids from -2 to 2\n\n return x, y",
"def build_grid(self, n):\n\n # TODO: other sha... | [
"0.6730488",
"0.669417",
"0.66516614",
"0.6618301",
"0.6423013",
"0.6391277",
"0.63496494",
"0.6205611",
"0.6183361",
"0.6181622",
"0.61756015",
"0.6173547",
"0.61643034",
"0.6157398",
"0.6108445",
"0.6089621",
"0.6056449",
"0.6040318",
"0.6039868",
"0.6024513",
"0.60230476",... | 0.70324767 | 0 |
Reshape x so that the last dimension becomes two dimensions. The first of these two dimensions is n. | def split_last_dim(self, x, n):
old_shape = list(x.size())
last = old_shape[-1]
new_shape = old_shape[:-1] + [n] + [last // n if last else None]
ret = x.view(new_shape)
return ret.permute(0, 2, 1, 3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_last_dimension(x, n):\n x_shape = shape_list(x)\n m = x_shape[-1]\n if isinstance(m, int) and isinstance(n, int):\n assert m % n == 0\n return tf.reshape(x, x_shape[:-1] + [n, m // n])",
"def split_last_dimension(x, n):\n old_shape = x.get_shape().dims\n last = old_shape[-1]\n ... | [
"0.7302571",
"0.72813654",
"0.7274875",
"0.72003365",
"0.7135375",
"0.7063622",
"0.70418215",
"0.6966903",
"0.69236207",
"0.6819207",
"0.6562574",
"0.65192795",
"0.64982146",
"0.64710486",
"0.6420965",
"0.6357035",
"0.6277613",
"0.62467366",
"0.6245626",
"0.62392926",
"0.6237... | 0.74960494 | 1 |
Reshape x so that the last two dimension become one. | def combine_last_two_dim(self, x):
old_shape = list(x.size())
a, b = old_shape[-2:]
new_shape = old_shape[:-2] + [a * b if a and b else None]
ret = x.contiguous().view(new_shape)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten(x):\n return reshape(x, (x.shape[0], -1))",
"def reshape(x, shape):\n return Reshape(shape)(x)",
"def _reshape_channels(x):\n assert x.dim() == 4\n batch_size, nc, h, w = x.size()\n x_t = x.view(batch_size, nc, -1).transpose(1, 2).contiguous()\n x_t = x_t.view(batc... | [
"0.7624362",
"0.7361735",
"0.7356254",
"0.73524576",
"0.7211992",
"0.71524197",
"0.70263374",
"0.69711345",
"0.69283223",
"0.6908497",
"0.67825496",
"0.6772853",
"0.67166173",
"0.67037886",
"0.66884685",
"0.66884685",
"0.6648974",
"0.6637822",
"0.660816",
"0.658997",
"0.65652... | 0.5980656 | 62 |
Create the given file with empty contents. | def create(self, fn: str) -> None:
# Make the directories as needed.
theDir = g.os_path_dirname(fn)
if theDir:
ok = g.makeAllNonExistentDirectories(theDir)
# #1453: Don't assume the directory exists.
if not ok:
g.error(f"did not create director... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_file():\n with open(\"example.txt\", \"w\") as file:\n file.write(\"\")",
"def zero_file(filepath) -> None:\n open(filepath, 'w').close()",
"def make_dummy_file(path, contents=None):\n dirname = op.dirname(path)\n\n if not op.exists(dirname):\n os.makedirs(dirname)\n\n i... | [
"0.7592157",
"0.7100137",
"0.6966329",
"0.69085926",
"0.6854358",
"0.68313",
"0.68303776",
"0.68086267",
"0.6732311",
"0.6710509",
"0.6574697",
"0.65531534",
"0.6482465",
"0.6363703",
"0.63495284",
"0.632462",
"0.62980986",
"0.6258295",
"0.62312716",
"0.6217524",
"0.6210912",... | 0.53755677 | 83 |
Hide the Spell tab. | def hide(self, event: Event = None) -> None:
if self.handler:
self.c.frame.log.selectTab('Log')
self.c.bodyWantsFocus() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide(self):\n self.visible = False",
"def hide(self):\n self.set_visible(False)",
"def hide(self):\n super(SkillShotScreen, self).hide()\n \n if self.cube != None: self.cube.clearLight(self.dlnp)\n if self.cubeMovement: self.cubeMovement.finish()\n if self.c... | [
"0.67313415",
"0.65986913",
"0.653312",
"0.6479031",
"0.64094037",
"0.6257442",
"0.62511915",
"0.62476766",
"0.62469125",
"0.62076837",
"0.62022203",
"0.602773",
"0.5979225",
"0.59649926",
"0.59649926",
"0.5963062",
"0.593383",
"0.592573",
"0.590624",
"0.59055126",
"0.5905512... | 0.52499574 | 86 |
Budget configuration for a billing account. | def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
all_updates_rule: Optional[pulumi.Input[pulumi.InputType['BudgetAllUpdatesRuleArgs']]] = None,
amount: Optional[pulumi.Input[pulumi.InputType['BudgetAmountArgs']]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self, budget):\n\t\traise NotImplementedError('This function needs to be overwritten in %s.'%(self.__class__.__name__))",
"async def __getBBL_async(self, account, projectedBillData) -> dict:\n _LOGGER.info(\"Getting budget billing data\")\n data = {}\n\n try:\n asyn... | [
"0.6522192",
"0.61680603",
"0.58205515",
"0.58205515",
"0.5675533",
"0.563814",
"0.5600954",
"0.5585118",
"0.55699074",
"0.5562507",
"0.5562507",
"0.55531263",
"0.5499314",
"0.5499314",
"0.5499314",
"0.54829043",
"0.5468307",
"0.5397864",
"0.53652316",
"0.53650486",
"0.532660... | 0.0 | -1 |
Get an existing Budget resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
all_updates_rule: Optional[pulumi.Input[pulumi.InputType['BudgetAllUpdatesRuleArgs']]] = None,
amount: Optional[pulumi.Input[pulumi.InputType['BudgetAmountArgs']]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_by_id(state_id):\n state = storage.get(State, state_id)\n if not state:\n abort(404)\n return jsonify(state.to_dict()), 200",
"def get_state_by_id(state_id):\n for key, value in storage.all(\"State\").items():\n if state_id == value.id:\n return jsonify(value.to... | [
"0.6261861",
"0.62336147",
"0.6220251",
"0.61567605",
"0.61423117",
"0.60418653",
"0.6022493",
"0.60019565",
"0.5936098",
"0.59260243",
"0.58958197",
"0.5865877",
"0.5797005",
"0.5739675",
"0.5599962",
"0.5541989",
"0.5517266",
"0.550598",
"0.5495594",
"0.5441278",
"0.5420004... | 0.5747557 | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.