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 |
|---|---|---|---|---|---|---|
Gets the url of this SystemPricingPlan. | def url(self) -> str:
return self._url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url(self) -> str:\n return pulumi.get(self, \"url\")",
"def url(self) -> str:\n return pulumi.get(self, \"url\")",
"def get_url(self):\n\n return self.url",
"def get_url(self):\n\n return self.url",
"def get_url(self):\n return self.resource.url",
"def url(self):\n ... | [
"0.66230303",
"0.66230303",
"0.6608708",
"0.6608708",
"0.6550064",
"0.6523262",
"0.6501513",
"0.6501513",
"0.6501513",
"0.64877915",
"0.64877915",
"0.64793205",
"0.64689285",
"0.6414895",
"0.6414895",
"0.6414895",
"0.6414895",
"0.6414895",
"0.6414895",
"0.6414895",
"0.6414895... | 0.6522593 | 8 |
Sets the url of this SystemPricingPlan. | def url(self, url: str):
self._url = url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_url(self, url):\n if url is not None:\n self.url = url",
"def set_url(self, url):\n self.url = url",
"def set_url(self, url):\n self.data['url'] = url",
"def url(self, url):\n\n self._url = url",
"def url(self, url):\n\n self._url = url",
"def url(sel... | [
"0.72602975",
"0.7247476",
"0.6971461",
"0.68381965",
"0.68381965",
"0.68381965",
"0.68381965",
"0.68381965",
"0.68381965",
"0.68381965",
"0.6829573",
"0.6806772",
"0.6786114",
"0.6721674",
"0.6410444",
"0.6406323",
"0.6265399",
"0.6223721",
"0.6166425",
"0.6149508",
"0.59500... | 0.6811395 | 13 |
Gets the name of this SystemPricingPlan. | def name(self) -> str:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_created_rate_plan_name(self):\n return self.carrier_page.get_created_rate_plan_name()",
"def pricing_plan(self) -> str:\n return pulumi.get(self, \"pricing_plan\")",
"def name(self) -> str:\n return pulumi.get(self, \"name\")",
"def name(self) -> str:\n return pulumi.get(s... | [
"0.68579113",
"0.66418684",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
"0.6535016",
... | 0.0 | -1 |
Sets the name of this SystemPricingPlan. | def name(self, name: str):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n ... | [
"0.68536186",
"0.68536186",
"0.68536186",
"0.68536186",
"0.68536186",
"0.6847046",
"0.6804992",
"0.6793774",
"0.67734396",
"0.67734396",
"0.6761828",
"0.6747207",
"0.67204374",
"0.67204374",
"0.6715378",
"0.67119384",
"0.66846526",
"0.6683237",
"0.66376007",
"0.66376007",
"0.... | 0.0 | -1 |
Gets the station_id of this SystemPricingPlan. | def station_id(self) -> str:
return self._station_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_station(self, station=None):\n stations = self.statuslist()\n if station and stations and isinstance(station, str):\n for plug in stations:\n plug_name = plug[1]\n if plug_name and plug_name.strip() == station.strip():\n return... | [
"0.6419159",
"0.6277508",
"0.6226161",
"0.61381686",
"0.60457224",
"0.5944842",
"0.5885266",
"0.5801082",
"0.5770962",
"0.57461613",
"0.57111776",
"0.570185",
"0.56796706",
"0.56689006",
"0.5625254",
"0.55995065",
"0.55462503",
"0.5522918",
"0.551214",
"0.5481365",
"0.5481365... | 0.767478 | 0 |
Gets the region_id of this SystemPricingPlan. | def region_id(self) -> str:
return self._region_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def region_id(self):\n return self._region_id",
"def region(self) -> str:\n return pulumi.get(self, \"region\")",
"def region(self) -> str:\n return pulumi.get(self, \"region\")",
"def region(self) -> str:\n return pulumi.get(self, \"region\")",
"def region(self) -> str:\n ... | [
"0.7869836",
"0.7196491",
"0.7196491",
"0.7196491",
"0.7196491",
"0.7196491",
"0.7196491",
"0.7066304",
"0.6920374",
"0.6920374",
"0.69067657",
"0.69067657",
"0.69067657",
"0.69067657",
"0.6900928",
"0.68993765",
"0.6835453",
"0.6763405",
"0.6715095",
"0.670472",
"0.6695933",... | 0.7810146 | 1 |
Gets the fare of this SystemPricingPlan. | def fare(self) -> Fare:
return self._fare | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fare(self):\n return self.price_per_km * self.current_fare_distance",
"def get_fare(self):\n return self.price_per_km * self.current_fare_distance + self.flagfall",
"def get_fare(self):\r\n return super().get_fare()*self.fanciness_rating+self.flagfall",
"def get_fare(self):\n ... | [
"0.7339358",
"0.7178417",
"0.58556604",
"0.5797454",
"0.5314207",
"0.53105354",
"0.52045435",
"0.52041924",
"0.5195407",
"0.51943845",
"0.5111202",
"0.5071918",
"0.5070142",
"0.5033235",
"0.501305",
"0.4968674",
"0.4942486",
"0.49332312",
"0.4929381",
"0.48798487",
"0.4857186... | 0.7377667 | 0 |
Gets the is_taxable of this SystemPricingPlan. | def is_taxable(self) -> bool:
return self._is_taxable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_taxable(self, is_taxable: bool):\n if is_taxable is None:\n raise ValueError(\"Invalid value for `is_taxable`, must not be `None`\") # noqa: E501\n\n self._is_taxable = is_taxable",
"def get_tax_group_enabled(self):\n return self.tax_group_enabled",
"def tax_included(sel... | [
"0.70530134",
"0.6534206",
"0.5821342",
"0.5570908",
"0.5390608",
"0.53857136",
"0.53839934",
"0.53603625",
"0.5262618",
"0.52387893",
"0.51762414",
"0.5150666",
"0.511448",
"0.5096038",
"0.5096038",
"0.5096038",
"0.5096038",
"0.5096038",
"0.5096038",
"0.5006914",
"0.49855852... | 0.8099373 | 0 |
Gets the description of this SystemPricingPlan. | def description(self) -> str:
return self._description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pricing_plan(self) -> str:\n return pulumi.get(self, \"pricing_plan\")",
"def get_description(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetDescription', self.handle)",
"def getPricingStructure(self):\n return self._PricingStructure",
"def get_description(self):\n\t\treturn call_sdk_fun... | [
"0.64014554",
"0.611778",
"0.60153925",
"0.595008",
"0.5860324",
"0.584641",
"0.57809955",
"0.57052994",
"0.5687516",
"0.5687516",
"0.56778204",
"0.56759316",
"0.56431085",
"0.56431085",
"0.56431085",
"0.56431085",
"0.56431085",
"0.56431085",
"0.56431085",
"0.56431085",
"0.56... | 0.55457073 | 85 |
Sets the description of this SystemPricingPlan. | def description(self, description: str):
if description is None:
raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, sDescription):\n\t\tcall_sdk_function('PrlVirtNet_SetDescription', self.handle, sDescription)",
"def set_description(self, description):\r\n self.__description = description",
"def set_description(self, description):\n self.__description = description",
"def set_descri... | [
"0.6527118",
"0.62742925",
"0.62721616",
"0.6254355",
"0.6242052",
"0.6221194",
"0.6200435",
"0.6198992",
"0.6181731",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
"0.6099166",
... | 0.54344213 | 77 |
There're better ways to generate unique colors, but this isn't awful. | def uniqueish_color():
return plt.cm.gist_ncar(np.random.random()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_color(n=1):\n \n if n == 1:\n c='xkcd:red'\n elif n== 2:\n c='xkcd:green'\n elif n== 3:\n c='xkcd:yellow'\n elif n== 4:\n c='xkcd:blue'\n elif n== 5:\n c='xkcd:orange'\n elif n== 6:\n c='xkcd:purple'\n elif n== 7:\n c='xkcd:cyan'\n ... | [
"0.75671417",
"0.7559066",
"0.73581594",
"0.7342885",
"0.7284416",
"0.72475344",
"0.71007663",
"0.70980465",
"0.7076487",
"0.7062553",
"0.7052646",
"0.7016977",
"0.7002936",
"0.6940305",
"0.68936247",
"0.689139",
"0.68225217",
"0.6811759",
"0.6808282",
"0.67745733",
"0.672468... | 0.7694945 | 0 |
Sets up the window, labels, and buttons | def __init__(self):
# Create the main frame
EasyFrame.__init__(self, "Panel Demo - v2")
# Create the nested frame for the date panel
data_panel = self.addPanel(row=0, column=0,
background="gray")
# Create and add widgets to the data panel
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()",
"def init... | [
"0.7338894",
"0.73091507",
"0.7220953",
"0.7183713",
"0.7181529",
"0.7172431",
"0.7150464",
"0.7139911",
"0.7128393",
"0.7095331",
"0.7059243",
"0.70444375",
"0.7004803",
"0.699745",
"0.6985808",
"0.69846314",
"0.6972527",
"0.6971511",
"0.6968496",
"0.6929337",
"0.6918298",
... | 0.0 | -1 |
Returns the the mean value for the X coordinate of the Celestial Intermediate Pole | def x_mean(self):
return self._get_mean_pole("x") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avgX(self):\n return np.mean(self.getx())",
"def get_mean_coord(self):\n # load dataset in a dummy manner\n dataset = torchvision.datasets.CIFAR10('../../data/CIFAR_data/', train=True, download=False)\n data = torch.FloatTensor(dataset.data).permute(0, 3, 1, 2) # shape [num_img, ... | [
"0.765549",
"0.72366863",
"0.7181417",
"0.714671",
"0.70938015",
"0.70391196",
"0.7017316",
"0.69678825",
"0.69647753",
"0.69323975",
"0.69323975",
"0.6927154",
"0.690455",
"0.68969023",
"0.68544084",
"0.6849889",
"0.6842303",
"0.6762883",
"0.67407936",
"0.672624",
"0.6725845... | 0.7843564 | 0 |
Returns the the mean value for the X coordinate of the Celestial Intermediate Pole | def y_mean(self):
return self._get_mean_pole("y") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x_mean(self):\n return self._get_mean_pole(\"x\")",
"def avgX(self):\n return np.mean(self.getx())",
"def get_mean_coord(self):\n # load dataset in a dummy manner\n dataset = torchvision.datasets.CIFAR10('../../data/CIFAR_data/', train=True, download=False)\n data = torch... | [
"0.7843088",
"0.76558596",
"0.72365224",
"0.7181977",
"0.7146993",
"0.7094605",
"0.7039346",
"0.70179075",
"0.6968901",
"0.6965423",
"0.6933342",
"0.6933342",
"0.6928232",
"0.6905942",
"0.6897282",
"0.68553925",
"0.6850613",
"0.6843467",
"0.6763293",
"0.67414874",
"0.6727069"... | 0.0 | -1 |
Returns True if name is starts with 'quercus' >>> is_an_oak('Quercus robur') True >>> is_an_oak('Fraxinus excelsior') False >>> is_an_oak('Pinus sylvestris') False >>> is_an_oak('Quercus cerris') True >>> is_an_oak('Quercus petraea') True >>> is_an_oak('quercus petraea') True >>> is_an_oak('quercusss petraea') True >>>... | def is_an_oak(name):
return name.lower().startswith("quercus") # use startswith() to catch bugs in spelling/spacing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_an_oak(name):\n if 'quercus' in name.lower():\n return True\n else:\n return False",
"def startsWith(self, prefix: str) -> bool:\n word = prefix\n if len(word) == 0:\n return True\n idx = ord(word[0]) - ord('a')\n if self.children[idx] is None:\n ... | [
"0.81078863",
"0.596858",
"0.5902439",
"0.5723506",
"0.5721118",
"0.5692583",
"0.55943537",
"0.5560043",
"0.55600005",
"0.5557466",
"0.55319005",
"0.54667026",
"0.54667026",
"0.543691",
"0.5436086",
"0.54211706",
"0.538166",
"0.5380922",
"0.53764695",
"0.537089",
"0.53395647"... | 0.8140336 | 0 |
Builds the camera that views the world. | def build_camera(config,
aspect_ratio):
return camera.Camera(
origin=vector.Point(*config.origin),
view_direction=vector.Vector(*config.view_direction),
view_up=vector.Vector(*config.view_up),
vertical_field_of_view=config.vertical_field_of_view,
aspect_ratio=aspect_rati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_camera(self) -> None:\n self.world.camera.update(\n cam_base_pos=(0, -3, 0),\n cam_dist=1.2*self.world.env_dim,\n cam_yaw=0,\n cam_pitch=-60\n )",
"def world_to_camera(self, X):\n raise NotImplementedError",
"def setup_camera(self) -> N... | [
"0.6975224",
"0.6935482",
"0.68473405",
"0.6802627",
"0.6686634",
"0.667848",
"0.66521096",
"0.65996784",
"0.65864193",
"0.6582034",
"0.6526087",
"0.64171714",
"0.6409535",
"0.6393944",
"0.6331509",
"0.62964714",
"0.6291957",
"0.62834793",
"0.6270255",
"0.6267055",
"0.6217760... | 0.71547115 | 0 |
Takes state as an input and returns all indexes that are blank | def allowed_positions(self, curr_state):
return [i for i, val in enumerate(curr_state) if np.isnan(val)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_empty_space(self, state):\r\n for i in range(3):\r\n for j in range(3):\r\n if state[i][j] == 0:\r\n return (i, j)",
"def empty_cells(state):\n cells = []\n\n for i, row in enumerate(state):\n for j, col in enumerate(row):\n if ... | [
"0.7609425",
"0.74684733",
"0.7295883",
"0.72697216",
"0.6574164",
"0.64868176",
"0.64562005",
"0.6417252",
"0.6342151",
"0.63298976",
"0.63008446",
"0.6279216",
"0.6252824",
"0.62334824",
"0.62222075",
"0.61555976",
"0.61473954",
"0.6135472",
"0.613546",
"0.61247045",
"0.607... | 0.69159746 | 5 |
Takes the current state as input and returns all possible (unused) values that can be placed on the board | def allowed_values(self, curr_state):
used_values = [val for val in curr_state if not np.isnan(val)]
agent_values = [val for val in self.all_possible_numbers if val not in used_values and val % 2 !=0]
env_values = [val for val in self.all_possible_numbers if val not in used_values and val % 2 =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_moves(board_state):\n for x, y in itertools.product(range(len(board_state)), range(len(board_state[0]))):\n if board_state[x][y] == 0:\n yield (x, y)",
"def find_possible_actions(board_state):\n empty_slot_indices = [ind+1 for ind,\n val in enumerate(board_state) if v... | [
"0.66364133",
"0.6348604",
"0.6346642",
"0.633989",
"0.62093145",
"0.62093145",
"0.62093145",
"0.6202773",
"0.61473435",
"0.6129042",
"0.61221147",
"0.6099413",
"0.6082561",
"0.60523844",
"0.60521907",
"0.6047348",
"0.60175395",
"0.6010056",
"0.59699154",
"0.59649056",
"0.593... | 0.66009694 | 2 |
Constructor. Applying this physics to sprites makes them walk with constant speed in a maze, taking random turns at corners and intersections. | def __init__(self, speed, maze_layer='walls', prevent_backtracking=True,
allow_wall_backtracking=False, only_turn_at_wall=False):
super(RandomMazeWalk, self).__init__(speed, maze_layer=maze_layer)
self._prevent_backtracking = prevent_backtracking
self._allow_wall_backtracking = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, pos):\n\n # initialise parent class\n pygame.sprite.Sprite.__init__(self)\n\n self.x = pos[0]\n self.y = pos[1]\n\n #emergency debug vars\n self.d1 = None\n self.d2 = None\n \n\t # state varibles\n self.idle = True\n self.w... | [
"0.6771346",
"0.67226666",
"0.63556546",
"0.63545966",
"0.6282586",
"0.6235785",
"0.61915535",
"0.61843497",
"0.6175315",
"0.6166205",
"0.61566705",
"0.615593",
"0.6154472",
"0.61151844",
"0.60828704",
"0.60795134",
"0.60164917",
"0.60024416",
"0.60024416",
"0.5991384",
"0.59... | 0.6447269 | 2 |
Update a sprite's velocity. | def _step_sprite(self, sprite, updates_per_env_step=1):
if np.isinf(sprite.mass):
return
position, velocity, entering_intersection = self._get_pos_vel(
sprite, updates_per_env_step=updates_per_env_step)
nearest_inds = self._get_nearest_point(position)
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n\t\t#update decimal position of bullet\n\t\tself.y -= self.speed_factor\n\t\t\n\t\t#update rect position\n\t\tself.rect.y = self.y",
"def update(self):\n\n self.rect.y += self.speed",
"def apply_velocity(self):\n self.position.data += self.velocity.data",
"def change_velocity... | [
"0.716601",
"0.71603477",
"0.7129178",
"0.7085528",
"0.7085528",
"0.70793784",
"0.7033087",
"0.6986844",
"0.69459826",
"0.6886964",
"0.6738221",
"0.67259884",
"0.6628196",
"0.6573966",
"0.65471244",
"0.6529225",
"0.6518309",
"0.6503265",
"0.6483479",
"0.64792",
"0.64789265",
... | 0.0 | -1 |
Update a sprite's velocity. | def _step_sprite(self, sprite, updates_per_env_step=1):
_, velocity, entering_intersection = self._get_pos_vel(
sprite, updates_per_env_step=updates_per_env_step)
if entering_intersection or np.all(velocity == 0.):
# If self._step_velocities is not empty use the next one. Otherw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n\t\t#update decimal position of bullet\n\t\tself.y -= self.speed_factor\n\t\t\n\t\t#update rect position\n\t\tself.rect.y = self.y",
"def update(self):\n\n self.rect.y += self.speed",
"def apply_velocity(self):\n self.position.data += self.velocity.data",
"def change_velocity... | [
"0.716601",
"0.71603477",
"0.7129178",
"0.7085528",
"0.7085528",
"0.70793784",
"0.7033087",
"0.6986844",
"0.69459826",
"0.6886964",
"0.6738221",
"0.67259884",
"0.6628196",
"0.6573966",
"0.65471244",
"0.6529225",
"0.6518309",
"0.6503265",
"0.6483479",
"0.64792",
"0.64789265",
... | 0.619311 | 47 |
Initialize with an authenticated GirderClient object. | def __init__(self, gc):
self.gc = gc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, client_auth_type, client_id, client_secret=None):\n self.client_auth_type = client_auth_type\n self.client_id = client_id\n self.client_secret = client_secret",
"def __init__(self,\n client_id,\n client_secret):\n self.__client_id = c... | [
"0.7123619",
"0.7068855",
"0.7024159",
"0.6915871",
"0.68627447",
"0.6855996",
"0.6804162",
"0.67682815",
"0.6758574",
"0.67232066",
"0.6714399",
"0.6692747",
"0.66813767",
"0.66793954",
"0.66695136",
"0.6667709",
"0.6642822",
"0.6624552",
"0.6549367",
"0.6507862",
"0.6504878... | 0.0 | -1 |
Get all jobs for a specified user id. Returns a dictionary of jobIds to status strings. | def getAllJobsForUser(self, userId):
params = {
'userId': userId,
'limit': 1000000
}
try:
resp = self.gc.get(JobUtils.JOB_LIST_PATH, parameters=params)
except HttpError as e:
if e.status == 400:
print('Error. invalid user id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, user_id):\n\n user = UserModel.find_by_id(user_id)\n jobs = [job.json() for job in user.posted_jobs]\n\n return {\"jobs\": jobs}",
"def get(self, user_id):\n user = UserModel.find_by_id(user_id)\n print(\"Getting volunteered jobs\")\n jobs = [job.json() for... | [
"0.7135464",
"0.70370615",
"0.7006307",
"0.6649863",
"0.6532708",
"0.6477202",
"0.64576656",
"0.63616496",
"0.6334338",
"0.6294558",
"0.6268663",
"0.62054867",
"0.61927176",
"0.6145753",
"0.61340797",
"0.61102533",
"0.6108519",
"0.6094817",
"0.60814357",
"0.6068171",
"0.60551... | 0.8477317 | 0 |
Used to calculcate a softmax score with true sequence length (without padding), rather than maxsequence length. | def masked_softmax(scores, mask):
numerator = tf.exp(tf.subtract(scores, tf.reduce_max(scores, 2, keep_dims=True))) * tf.expand_dims(mask, axis=1)
denominator = tf.reduce_sum(numerator, 2, keep_dims=True)
# weights = tf.div(numerator, denominator)
# weights = tf.div(numerator, denominator+1e-3)
wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.65781754",
"0.64430475",
"0.64190376",
"0.64110726",
"0.63797617",
"0.6353563",
"0.6272577",
"0.6120602",
"0.6109203",
"0.6074914",
"0.6065824",
"0.60382015",
"0.60382015",
"0.60330963",
"0.60167086",
"0.6000531",
"0.5999311",
"0.59955674",
"0.5994814",
"0.59929574",
"0.59... | 0.0 | -1 |
Return a humanreadable representation of the platform. | def _format_platform(platform, release, architecture=None):
rep = f"{_PLATFORMS[platform]} {release}"
if architecture is None or architecture == default.architecture:
return rep
return f"{rep} ({architecture})" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform\")",
"def platform_info(self):\n return platform.uname()._asdict()",
"def platform_info(self):\n return self.msg.platform_info",
"def platform():\n return \"micaz\"",
"def platform(self, return_str=True):... | [
"0.77333045",
"0.7601142",
"0.746394",
"0.7429397",
"0.72815746",
"0.7197434",
"0.71833473",
"0.7169291",
"0.68724775",
"0.67809016",
"0.67544687",
"0.6692626",
"0.6669631",
"0.66588914",
"0.6622722",
"0.65381676",
"0.65114045",
"0.6507363",
"0.64888215",
"0.6473264",
"0.6464... | 0.7122758 | 8 |
Return the variable bindings. | def get(self):
return dict((variable, getattr(self, variable)) for variable in self.variables) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bindings(self):\n return self.__bindings",
"def get_bindable_vars(self):\n return self.local_vars.keys() + self.parent.get_bindable_vars()",
"def get_bindable_vars(self):\n return (self.linkable_vars + self.local_vars.keys() +\n self.external_vars.keys())",
"def variables(... | [
"0.76239204",
"0.7491372",
"0.7436962",
"0.688778",
"0.68423265",
"0.68334407",
"0.6769187",
"0.67664224",
"0.66989326",
"0.6618196",
"0.661297",
"0.6599133",
"0.6576731",
"0.6538502",
"0.6532232",
"0.6528781",
"0.65230155",
"0.6504959",
"0.6495707",
"0.64903307",
"0.6476681"... | 0.0 | -1 |
Convert a scipy sparse matrix to a torch sparse tensor. | def sparse_mx_to_torch_sparse_tensor(sparse_mx):
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64)
)
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
return torch.sparse.Flo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.8300053",
"0.81481105",
"0.80453056",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8029408",
"0.8012812",
"0.79967237",
"0.79967237",
"0.79845846",
"0.79845846... | 0.8031889 | 3 |
Function to calculate precision | def precision(y_true, y_pred):
tp = true_positive(y_true, y_pred)
fp = false_positive(y_true, y_pred)
precision = tp / (tp + fp)
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_precision(self):\n ...",
"def precision(self):\n tpos, fpos = len(self.__true_positives), len(self.__false_positives)\n return float(tpos) / (tpos + fpos)",
"def precision(y_true, y_pred):\n true_positives = bk.sum(bk.round(bk.clip(y_true * y_pred, 0, 1)))\n p... | [
"0.8027367",
"0.7843842",
"0.76082224",
"0.75625396",
"0.7515702",
"0.75062746",
"0.7463843",
"0.74412477",
"0.7425824",
"0.7424389",
"0.7424389",
"0.74091244",
"0.7351832",
"0.73496675",
"0.73496675",
"0.73496675",
"0.73496675",
"0.73496675",
"0.73496675",
"0.7331656",
"0.73... | 0.74265987 | 8 |
Function to calculate recall | def recall(y_true, y_pred):
tp = true_positive(y_true, y_pred)
fn = false_negative(y_true, y_pred)
recall = tp / (tp + fn)
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred):\n true_positives = bk.sum(bk.round(bk.clip(y_true * y_pred, 0, 1)))\n possible_positives = bk.sum(bk.round(bk.clip(y_true, 0, 1)))\n recall = true_positives / (possible_positives + bk.epsilon())\n return recall",
"def calculate_recall(num_tp... | [
"0.73509765",
"0.73286057",
"0.7304889",
"0.7281222",
"0.7193735",
"0.71856743",
"0.715",
"0.7133006",
"0.7073006",
"0.70617235",
"0.7029137",
"0.7029137",
"0.7029137",
"0.7029137",
"0.7029137",
"0.7029137",
"0.6990209",
"0.6990209",
"0.6990209",
"0.6990209",
"0.6990209",
"... | 0.7632226 | 0 |
This function calculates precision at k for a single sample | def pk(y_true, y_pred, k):
# if k is 0, return 0. we should never have this
# as k is always >= 1
if k == 0:
return 0
# we are interested only in top-k predictions
y_pred = y_pred[:k]
# convert predictions to set
pred_set = set(y_pred)
# convert actual values to se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance sco... | [
"0.7684773",
"0.76707965",
"0.7594704",
"0.7451169",
"0.72854686",
"0.7158137",
"0.7127954",
"0.69888824",
"0.68721014",
"0.6825236",
"0.6816785",
"0.679297",
"0.6790948",
"0.67357737",
"0.6705404",
"0.6705404",
"0.6705404",
"0.6705404",
"0.6705404",
"0.6705404",
"0.6693689",... | 0.0 | -1 |
This function calculates average precision at k for a single sample | def apk(y_true, y_pred, k):
# initialize p@k list of values
pk_values = []
# loop over all k. from 1 to k+1
for i in range(1, k + 1):
# calculate p@i and append to list
pk_values.append(pk(y_true, y_pred, i))
# if we have no values in the list, return 0
if len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance sco... | [
"0.80753726",
"0.8022022",
"0.7806911",
"0.76421416",
"0.75518405",
"0.75518405",
"0.72296304",
"0.7221995",
"0.71388716",
"0.7082228",
"0.7057399",
"0.70227844",
"0.6948657",
"0.6886971",
"0.6846957",
"0.684183",
"0.679091",
"0.6790285",
"0.67477626",
"0.6692914",
"0.6654795... | 0.63502294 | 32 |
This function calculates msle | def mean_squared_log_error(y_true, y_pred):
# initialize error at 0
error = 0
# loop over all samples in true and predicted list
for yt, yp in zip(y_true, y_pred):
# calculate squared log error
# and add to error
error += (np.log(1 + yt) - np.log(1 + yp)) ** 2
# ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def msle(actual, predicted):\n return np.mean(sle(actual, predicted))",
"def msle(self, weights=None) -> float:\n return float(np.average((np.log1p(self.true) - np.log1p(self.predicted)) ** 2, axis=0, weights=weights))",
"def mle(data):\n\t\"\"\" return (tau, sigma ) \"\"\"\n\tcount_state_state,count... | [
"0.71351606",
"0.6998792",
"0.64508975",
"0.6421097",
"0.631412",
"0.6209827",
"0.6180435",
"0.6177251",
"0.6163286",
"0.6070666",
"0.6043474",
"0.6015264",
"0.6004101",
"0.59740937",
"0.59182835",
"0.58421826",
"0.58277386",
"0.58172446",
"0.58111274",
"0.56907165",
"0.56599... | 0.0 | -1 |
Instantiate a fake HTTP Request, complete with a database session. This is a functionlevel fixture, so every new request will have a new database session. | def dummy_request(db_session):
return testing.DummyRequest(dbsession=db_session) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dummy_request(new_session):\n return testing.DummyRequest(dbsession=new_session)",
"def dummy_request(new_session, method=\"GET\"):\n request = testing.DummyRequest()\n request.method = method\n request.dbsession = new_session\n return request",
"def new_req_session_bad():\n saEngine = sq... | [
"0.7389984",
"0.7044507",
"0.7007096",
"0.6650564",
"0.6430617",
"0.642395",
"0.6312381",
"0.6236324",
"0.6187528",
"0.6135779",
"0.6092923",
"0.60252666",
"0.601007",
"0.5996697",
"0.59935075",
"0.59873295",
"0.598082",
"0.59670746",
"0.59432584",
"0.59218264",
"0.59095174",... | 0.7496093 | 1 |
Test user table is initially empty. | def test_user_table_empty(db_session):
query = db_session.query(User).all()
assert not len(query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_users_table_populated(self):\n print('(' + self.test_users_table_populated.__name__ + ')',\n self.test_users_table_populated.__doc__)\n test_table_populated(self, USERS_TABLE, INITIAL_USERS_COUNT)",
"def test_table_empty(self):\n self.assertEqual(len(self.table), 0)",
... | [
"0.80662715",
"0.75051826",
"0.70792514",
"0.70621544",
"0.6977453",
"0.6619576",
"0.65743417",
"0.6460425",
"0.64493716",
"0.6446938",
"0.6433255",
"0.6417728",
"0.6410845",
"0.6366613",
"0.6363971",
"0.6363443",
"0.6357945",
"0.6348592",
"0.63421077",
"0.63346565",
"0.63239... | 0.8134076 | 0 |
Test category table is initially empty. | def test_category_table_empty(db_session):
query = db_session.query(Category).all()
assert not len(query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_table(self):\r\n\r\n self.mycursor.execute('CREATE TABLE IF NOT EXISTS category(\\\r\n CAT_id int PRIMARY KEY AUTO_INCREMENT,\\\r\n CAT_nom VARCHAR(50) UNIQUE)')",
"def fill_tab_categories(self):\n self.category.fill_tab_categories(self.list_categories, self.mycur... | [
"0.6893134",
"0.6714606",
"0.66215974",
"0.6571056",
"0.6555345",
"0.6529772",
"0.65202373",
"0.65094924",
"0.6491573",
"0.6488568",
"0.6437267",
"0.64030796",
"0.63756543",
"0.6283144",
"0.62645805",
"0.62645805",
"0.6257553",
"0.61895454",
"0.61831445",
"0.6147816",
"0.6131... | 0.73502403 | 0 |
Test new category is added to database. | def test_new_category_is_added(db_session):
new_cat = Category(
label="test_label",
desc="test_desc"
)
db_session.add(new_cat)
query = db_session.query(Category).all()
assert len(query) == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_category(self):\n pass",
"def test_new_category_data(db_session):\n new_cat = Category(\n label=\"test_label\",\n desc=\"test_desc\"\n )\n db_session.add(new_cat)\n category = db_session.query(Category).all()\n assert category[0].label == \"test_label\"\n as... | [
"0.8505927",
"0.8468428",
"0.84142816",
"0.8100773",
"0.806951",
"0.80331504",
"0.7986526",
"0.7824989",
"0.7784528",
"0.77238196",
"0.76007456",
"0.75589174",
"0.7555016",
"0.7540984",
"0.7518726",
"0.75098276",
"0.7472101",
"0.7418315",
"0.74041235",
"0.7375576",
"0.7375328... | 0.8491344 | 1 |
Test new category has correct data. | def test_new_category_data(db_session):
new_cat = Category(
label="test_label",
desc="test_desc"
)
db_session.add(new_cat)
category = db_session.query(Category).all()
assert category[0].label == "test_label"
assert category[0].desc == "test_desc" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_category(self):\n pass",
"def test_update_category(self):\n pass",
"def test_create_category(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n self.assertIn('Stews', str(res.data))",
"def test_ca... | [
"0.79987293",
"0.79971606",
"0.7935051",
"0.7805785",
"0.77763546",
"0.7674307",
"0.76527995",
"0.75710493",
"0.7533571",
"0.7459611",
"0.7359067",
"0.73568296",
"0.73508",
"0.7350425",
"0.73455584",
"0.7285688",
"0.7285679",
"0.72461265",
"0.72412574",
"0.7132548",
"0.713212... | 0.76691216 | 6 |
Test that when given bad credentials login doesn't happen. | def test_login_view_bad_credentials(dummy_request):
from .views.default import login_view
dummy_request.POST["username"] = "testme"
dummy_request.POST["password"] = "badpassword"
result = login_view(dummy_request)
assert result == {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_wrong_credentials(self):\n\t\tdata = {'username' : 'nonexistentuser', 'password' : 'nopasswordlol'}\n\t\tresponse = self.login(data)\n\n\t\terror_text = \"Unable to log in with provided credentials.\"\n\n\t\tself.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n\t\ttry:\n\t\t\tif erro... | [
"0.84575164",
"0.8239737",
"0.80381596",
"0.8020892",
"0.7999747",
"0.797898",
"0.79210055",
"0.78722525",
"0.7872042",
"0.78218514",
"0.7821175",
"0.7792445",
"0.77526766",
"0.77523285",
"0.7746808",
"0.77321005",
"0.7724763",
"0.7715742",
"0.76280653",
"0.7597343",
"0.75956... | 0.0 | -1 |
Test not found view. | def test_not_found_view(dummy_request):
from .views.notfound import notfound_view
result = notfound_view(dummy_request)
assert result == {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_nonexistent_test(self):\n response = self.app.test_client().get('/test/99999')\n self.assertEqual(response.status_code, 404)\n self.assert_template_used('test/test_not_found.html')",
"def test_view_url_exists(self):\n response = self.client.get('')\n response2 = se... | [
"0.78799075",
"0.76413864",
"0.7450421",
"0.7395706",
"0.73952",
"0.7368605",
"0.73390234",
"0.7312305",
"0.72942597",
"0.7281673",
"0.7269199",
"0.7257694",
"0.7231467",
"0.7219845",
"0.7217617",
"0.7215786",
"0.7214846",
"0.7214846",
"0.72122866",
"0.72095376",
"0.71826357"... | 0.8412927 | 0 |
Create an instance of webtests TestApp for testing routes. With the alchemy scaffold we need to add to our test application the setting for a database to be used for the models. We have to then set up the database by starting a database session. Finally we have to create all of the necessary tables that our app normall... | def testapp(request):
from webtest import TestApp
from pyramid.config import Configurator
def main(global_config, **settings):
config = Configurator(settings=settings)
config.include('pyramid_jinja2')
config.include('.models')
config.include('.routes')
config.include... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n # create a temporary file to isolate the database for each test\n # create the app with common test config\n app = create_app({\"TESTING\": True, \"DATABASE_NAME\": \"AAPI_DB_Test\"})\n\n # create the database and load test data\n with app.app_context():\n init_db()\n\n yield ... | [
"0.79217637",
"0.77648544",
"0.776342",
"0.76743466",
"0.7642728",
"0.76154333",
"0.758443",
"0.7572592",
"0.7569738",
"0.75545216",
"0.75386405",
"0.75386405",
"0.7538617",
"0.7523063",
"0.752093",
"0.74964994",
"0.7477891",
"0.7463496",
"0.7462033",
"0.7460362",
"0.7442908"... | 0.7455166 | 20 |
Test category view when logged in is accessible. | def test_category_view_logged_in(testapp, fill_the_db, login_fixture):
response = testapp.get('/category/1', params=login_fixture)
assert response.status_code == 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_categories(self):\n Perms.objects.create(user=self.user, access_level=4).save()\n self.client.login(username='hodor', password='hodor')\n response = self.client.get('/categories/')\n self.assertEqual(response.status_code, 200)\n self.assertTemplateUsed(response, 'vi... | [
"0.77672637",
"0.767011",
"0.74551517",
"0.6985046",
"0.6771906",
"0.67545414",
"0.66753054",
"0.66686755",
"0.6535825",
"0.64381534",
"0.6408908",
"0.6344637",
"0.63318187",
"0.6314524",
"0.6299448",
"0.6283847",
"0.6274063",
"0.6269872",
"0.62551993",
"0.6201729",
"0.619182... | 0.7629735 | 2 |
Test attribute view renders attributes when authenticated. | def test_attribute_authenticated_has_attributes(testapp, login_fixture, fill_the_db):
response = testapp.get('/attribute/1/1', params=login_fixture)
assert len(response.html.find_all("img")) == 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_attribute_view_authenticated(testapp, fill_the_db, login_fixture):\n response = testapp.get('/attribute/1/1', params=login_fixture)\n assert response.status_code == 200",
"def test_should_render_with_authenticated(self) -> None:\n with override_feature_check(unified_banner_feature.feature_i... | [
"0.82022816",
"0.62329197",
"0.6162242",
"0.6030842",
"0.6015802",
"0.6015802",
"0.5912258",
"0.5852004",
"0.5787744",
"0.57713014",
"0.57514656",
"0.57492363",
"0.5701504",
"0.56685317",
"0.56685317",
"0.5663633",
"0.5661887",
"0.5593452",
"0.5568887",
"0.553334",
"0.5518278... | 0.72004664 | 1 |
Test display view renders the string when authenticated. | def test_display_authenticated_has_string(testapp, fill_the_db, login_fixture):
response = testapp.get("/display/1/1/1", params=login_fixture)
display_h1 = response.html.find_all('h1')[1]
assert "user name, category attribute" in display_h1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_display_view_authenticated(testapp, fill_the_db, login_fixture):\n response = testapp.get(\"/display/1/1/1\", params=login_fixture)\n assert response.status_code == 200",
"def display():\n return render_template(\"signin.html\")",
"def test_login_page_text(refreshed_browser):\n assert Logi... | [
"0.81064683",
"0.72645694",
"0.6638245",
"0.65006596",
"0.64065534",
"0.6370784",
"0.6370784",
"0.6337652",
"0.6303511",
"0.62649786",
"0.62337077",
"0.6223609",
"0.6220222",
"0.6186955",
"0.61747265",
"0.61747265",
"0.61728495",
"0.61692464",
"0.61653346",
"0.61597276",
"0.6... | 0.7386137 | 1 |
Initializes a ContactCard. (See ALLOWED_FIELDS) | def __init__(self, **kwargs):
self._card = vobject.vCard()
self.__dict__.update((key, False) for key in self._modifiable_fields)
self.__dict__.update((key, value) for key, value in kwargs.items() if key in self._modifiable_fields) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, cardholder_type: str=None, full_name: str=None, card_data: CardEmbossing=None, identity_document_number: str=None, other_identity_document_number: PersonalIdentityDocumentInfo=None, birth_date: str=None, nationality: str=None, gender: str=None, civil_status: str=None, contact_information: Contac... | [
"0.6912477",
"0.6501165",
"0.6398207",
"0.6378437",
"0.61819184",
"0.61819184",
"0.61124605",
"0.60882276",
"0.60364264",
"0.6030689",
"0.5984563",
"0.59647304",
"0.5950613",
"0.5935758",
"0.59223443",
"0.5912796",
"0.5876132",
"0.5868386",
"0.58650243",
"0.585614",
"0.581965... | 0.5873739 | 17 |
Return an iterator over the datafile. Actually, this is just iter(self.data). | def __iter__(self):
return iter(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self,):\n self.f.seek(self.pos)\n data = self.f.read(BUFFER_SZ)\n while data:\n while self.dataptr < len(data):\n self.dataptr += 1\n yield data[self.dataptr - 1]\n\n self.pos = self.f.tell()\n self.dataptr = 0\n ... | [
"0.8007798",
"0.7909604",
"0.7610233",
"0.75247914",
"0.7520424",
"0.7500663",
"0.7438878",
"0.7428555",
"0.7261322",
"0.7239807",
"0.7205083",
"0.71390575",
"0.7115563",
"0.7085227",
"0.69514453",
"0.69372493",
"0.69335586",
"0.6904566",
"0.68777376",
"0.6869749",
"0.6834051... | 0.7600291 | 5 |
Returns joined game directory path relative to Steamapps | def get_game_dir(self, username=False):
if not self.common and not username:
raise RuntimeError("Can't determine this game's directory without username")
if self.common:
subdir = "common"
else:
subdir = "username"
subsubdir = self.dir
if WIN32 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSteamAppDir(appid: int) -> str:\n\tfor path in libraryFolders():\n\t\ttry:\n\t\t\tlogger.info(f'searching for {appid} in {path}..')\n\t\t\twith open(f'{path}appmanifest_{appid}.acf', 'r') as file:\n\t\t\t\t# found the app!\n\t\t\t\t# get the app's name\n\t\t\t\tinstDir = Property.parse( file, f'appmanifest_... | [
"0.7248746",
"0.67371076",
"0.66656584",
"0.66290104",
"0.65411127",
"0.6503396",
"0.63814026",
"0.6321212",
"0.63178587",
"0.6286332",
"0.62717813",
"0.62651",
"0.6227697",
"0.62151647",
"0.6207184",
"0.619172",
"0.6173946",
"0.6172356",
"0.6172356",
"0.6136663",
"0.6135941"... | 0.7005897 | 1 |
Used to return file names to show on product images upload. | def names(self):
return [line.split(',')[0] for line in self.lines] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filenames(self):\n pass",
"def raw_file_names(self):\n return self.filename",
"def GetFileNames(self):\n return self.files",
"def get_filenames(self):\n return self.filenames",
"def getImageName(self):\n return [os.path.basename(name) for name in self.meta['sources']]",
... | [
"0.73308",
"0.7283138",
"0.7244023",
"0.7095753",
"0.69480413",
"0.6941661",
"0.68573475",
"0.6848893",
"0.6830801",
"0.6765065",
"0.67344683",
"0.67254275",
"0.66919965",
"0.66325176",
"0.6631117",
"0.6627996",
"0.6620066",
"0.6620066",
"0.6615844",
"0.6611067",
"0.6607284",... | 0.0 | -1 |
Check unique userdomain ourselves because we don't have 'user' field in the form | def validate_unique_domain(self, cleaned_data):
if self._meta.model.objects.filter(user=self.request.user, domain=cleaned_data.get('domain')).exists():
self._errors["domain"] = self.error_class([ugettext('Shop with this name already exists')])
del cleaned_data["domain"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_unique_domain(self, cleaned_data):\n if self.instance:\n if self._meta.model.objects.exclude(id=self.instance.id).\\\n filter(user=self.request.user, domain=cleaned_data.get('domain')).exists():\n self._errors[\"domain\"] = self.error_class([ugettext('Sh... | [
"0.7264526",
"0.6611884",
"0.6572336",
"0.6514388",
"0.6477734",
"0.6449061",
"0.6434357",
"0.641448",
"0.6400104",
"0.6385208",
"0.6373068",
"0.6369826",
"0.6368132",
"0.6323487",
"0.63063514",
"0.6302026",
"0.6301711",
"0.6301711",
"0.62871826",
"0.6253782",
"0.6231434",
... | 0.7373279 | 0 |
The boundary conidtions on the right side, for unknown and nu. | def bcRight(self):
return self.__bcRight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_boundary_conditions(self):\n E = self.__mesh.get_edge_list()\n\n # Top and bottom wall Dirichlet bcs (boundary_id = 21)\n \n e21_iterator = self.__mesh.edge_iterator(21)\n\n self.edge_center_value[e21_iterator[0]:e21_iterator[1]+1] = 0.0 \n \n # Left Dirichlet bc... | [
"0.68701345",
"0.6751893",
"0.6673425",
"0.66722554",
"0.6550806",
"0.65174586",
"0.65043485",
"0.64497966",
"0.640456",
"0.6402061",
"0.6401766",
"0.63807136",
"0.6354826",
"0.63105524",
"0.62552804",
"0.6248912",
"0.6231945",
"0.6226551",
"0.62262386",
"0.6209225",
"0.61424... | 0.6336245 | 14 |
The boundary conidtions on the right side, for unknown and nu. | def bcRight(self):
return self.__bcRight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_boundary_conditions(self):\n E = self.__mesh.get_edge_list()\n\n # Top and bottom wall Dirichlet bcs (boundary_id = 21)\n \n e21_iterator = self.__mesh.edge_iterator(21)\n\n self.edge_center_value[e21_iterator[0]:e21_iterator[1]+1] = 0.0 \n \n # Left Dirichlet bc... | [
"0.6871974",
"0.67528176",
"0.6674659",
"0.66735184",
"0.65518904",
"0.65167886",
"0.65053695",
"0.6450479",
"0.64052886",
"0.64036",
"0.64015543",
"0.6382531",
"0.6357096",
"0.63098747",
"0.6255503",
"0.62505674",
"0.6230625",
"0.62277824",
"0.6225297",
"0.6211151",
"0.61433... | 0.6335336 | 13 |
Split string into words, remove whitespace and punctuation | def extract_words(s):
if has_dashdash(s):
s = myreplace("--"," ", s)
s = s.lower().split()
word_list = []
for word in s:
word_list.append(cleanword(word))
return word_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_words(s):\n s = re.sub(r\"\\W+\", \" \", s)\n s = re.sub(r\"[_0-9]+\", \" \", s)\n return s.split()",
"def split_into_words(s):\n s = re.sub(r\"\\W+\", \" \", s)\n s = re.sub(r\"[_0-9]+\", \" \", s)\n return s.split()",
"def separate_words(text):\n splitter = re.compile('\\\\W*')\n r... | [
"0.81911534",
"0.81911534",
"0.81272066",
"0.7758041",
"0.7716366",
"0.76931524",
"0.7605431",
"0.75545245",
"0.7552954",
"0.7484845",
"0.74509096",
"0.7412249",
"0.7400704",
"0.7386869",
"0.7384062",
"0.7382043",
"0.73162496",
"0.7292556",
"0.729119",
"0.7284273",
"0.7280315... | 0.7360942 | 16 |
Returns a predefined model by name. | def get_model(name, **kwargs):
models = {'standard_lstm_lm_200' : standard_lstm_lm_200,
'standard_lstm_lm_650' : standard_lstm_lm_650,
'standard_lstm_lm_1500': standard_lstm_lm_1500,
'awd_lstm_lm_1150': awd_lstm_lm_1150,
'awd_lstm_lm_600': awd_lstm_lm_600,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_by_name(cls, name):\n model_name = inflection.camelize(name) # class name of the model to use\n model = cls.models[model_name]\n return model",
"def get_model(*, name: str) -> typing.Optional[typing.Type]:\n return getattr(open_alchemy.models, name, None)",
"def get_model... | [
"0.86676157",
"0.81161493",
"0.80618334",
"0.79889643",
"0.79149187",
"0.7579886",
"0.7560434",
"0.7511144",
"0.7403472",
"0.7376161",
"0.736167",
"0.7312168",
"0.7291965",
"0.7262628",
"0.7163371",
"0.7163224",
"0.71504134",
"0.7129951",
"0.7081742",
"0.7073349",
"0.7051597"... | 0.73746216 | 10 |
Override the equality operator to allow work log objects to be compared. | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, LogRecord):\n return False\n\n return self.__dict__ == other.__dict__",
"def test_log_eq(self) -> None:\n self.assertTrue(self.log1 == self.log1copy)\n\n # pylint: disable=unnecessary-dunder-call\n self.assertTrue(s... | [
"0.75836176",
"0.75681394",
"0.71252966",
"0.70719105",
"0.70597893",
"0.70597893",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.7045603",
"0.70316994",
"0.6963948",
"0.6963948",
"0.696394... | 0.6735336 | 53 |
Check whether `x` is an iterable object except for string. | def is_iterable(x: Any) -> bool:
return isinstance(x, collections.abc.Iterable) and not isinstance(x, (str, bytes)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_nonstring_iterable(x):\n if isinstance(x, primitive_iterable):\n return False\n return isinstance(x, collections.Iterable)",
"def is_iterable(x):\n if isinstance(x, six.string_types):\n return False\n return hasattr(x, '__iter__')",
"def isiterable(x):\n try:\n ... | [
"0.8749865",
"0.8497222",
"0.81624997",
"0.81380945",
"0.8030398",
"0.80031663",
"0.79605573",
"0.77676135",
"0.77502674",
"0.77227896",
"0.77054363",
"0.7680664",
"0.76372164",
"0.7596562",
"0.7523219",
"0.73999214",
"0.7363047",
"0.7308817",
"0.72310627",
"0.7088277",
"0.70... | 0.8509569 | 1 |
Check whether `x` is list like, e.g., Tuple, List, or Numpy object. | def is_listlike(x: Any) -> bool:
return (isinstance(x, (list, tuple))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isList(x):\n \n return ( type(x) == list ) # True if the type of x is a list",
"def is_2dlist(x):\n if not isinstance(x, list):\n return False\n if len(x) == 0:\n return True\n\n return all(isinstance(item, list) for item in x)",
"def _is_list(item):\n return isinstance(item... | [
"0.84266996",
"0.7743655",
"0.76795244",
"0.7461792",
"0.7425574",
"0.73612356",
"0.7346784",
"0.727173",
"0.7267359",
"0.72502166",
"0.72377133",
"0.7194669",
"0.71141255",
"0.71111417",
"0.70947355",
"0.7062882",
"0.701223",
"0.68991894",
"0.689695",
"0.6881133",
"0.6863590... | 0.8683242 | 0 |
Check whether `x` is a list of complex objects (not integers). | def is_multiobjects(x: Any) -> bool:
return (is_listlike(x) or (isinstance(x, np.ndarray)
and x.dtype == "O")) and len(x) > 0 and not is_scalar(x[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_3dlist(x):\n if not isinstance(x, list):\n return False\n if len(x) == 0:\n return True\n for sub_x in x:\n if not is_2dlist(sub_x):\n return False\n\n return True",
"def isvect(x):\n return isinstance(x,list) and len(x) == 4 and isgoodnum(x[0]) and isgoodnum... | [
"0.69231665",
"0.66148293",
"0.65774804",
"0.6557322",
"0.6544302",
"0.6241429",
"0.62252635",
"0.6146695",
"0.60614073",
"0.60234874",
"0.5992401",
"0.59593034",
"0.59149426",
"0.5873439",
"0.58418334",
"0.58106965",
"0.5804771",
"0.5746204",
"0.57441247",
"0.5719728",
"0.57... | 0.68031645 | 1 |
Accesseur de l'attribut _total | def get_total(self):
return str(round(self._total, 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total(self):\n\t\treturn self._total",
"def GetTotal(self):\n return(self.total)",
"def patrimony_total(self):\n pass",
"def total(self, total):\n\n self._total = total",
"def total(self, total):\n\n self._total = total",
"def total(self, total):\n\n self._total = t... | [
"0.80544007",
"0.7829412",
"0.77574813",
"0.77258986",
"0.77258986",
"0.77258986",
"0.77258986",
"0.77258986",
"0.77258986",
"0.77258986",
"0.77258986",
"0.7628028",
"0.7603728",
"0.75854206",
"0.7486081",
"0.744265",
"0.7435703",
"0.74002254",
"0.73932624",
"0.735011",
"0.73... | 0.7358333 | 19 |
Mutateur de l'attribut _total_elle | def set_total_elle(self, valeurs):
self._total_elle = valeurs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actualizar_total(self):\n self.lblImporte.setText(\"Saldo Restante: $%.2f\" % self.total_a_pagar)",
"def set_total(self, valeurs):\r\n \r\n self._total = valeurs",
"def get_total_elle(self):\r\n \r\n return str(round(self._total_elle, 2))",
"def set_total_annee_preceden... | [
"0.75833607",
"0.7484871",
"0.7394798",
"0.696404",
"0.6904356",
"0.6874531",
"0.6832365",
"0.68305427",
"0.678836",
"0.67741424",
"0.6773135",
"0.67472005",
"0.67386746",
"0.6695214",
"0.6663005",
"0.6646944",
"0.6641274",
"0.65819174",
"0.65514565",
"0.6544768",
"0.6544768"... | 0.81075287 | 0 |
Generate a random string of fixed length | def randomString(stringLength=10):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.8680464",
"0.8573714",
"0.85486245",
"0.85297275",
"0.85209286",
"0.84331024",
"0.8432044",
"0.84157014",
"0.84120053",
"0.8389201",
"0.8345882",
"0.8343962",
"0.83406156",
"0.83348686",
"0.83240855",
"0.82986933",
"0.82911193",
"0.8281826",
"0.82818025",
"0.82811046",
"0.... | 0.7761017 | 97 |
Update a series of existing messages | def update_existing(doc_data_tples):
def per_doc(doc, data_tples):
def per_field(data_tple):
field, datas = data_tple
map(_do_append_field(doc, field), datas)
map(per_field, data_tples)
return doc
__docs = ( (per_doc(doc, data_tples), data_tples) for doc,data_tpl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateMessages(self, parameters):\n \n return",
"def updateMessages(self, parameters):\n \n return",
"def updateMessages(self, parameters):\n \n return",
"def updateMessages(self, parameters):\n \n return",
"def updateMessages(self, parameters):\n \n ... | [
"0.7310525",
"0.7310525",
"0.7310525",
"0.7310525",
"0.7310525",
"0.7310525",
"0.7310525",
"0.7310525",
"0.7310525",
"0.7310525",
"0.72571653",
"0.72571653",
"0.72571653",
"0.72571653",
"0.72571653",
"0.72571653",
"0.72571653",
"0.72571653",
"0.72571653",
"0.72571653",
"0.725... | 0.0 | -1 |
Export the queryset of objects as commaseparated value (CSV), using the model's to_csv() method. | def queryset_to_csv(self):
csv_data = []
custom_fields = []
# Start with the column headers
headers = self.queryset.model.csv_headers.copy()
# Add custom field headers, if any
if hasattr(self.queryset.model, 'get_custom_fields'):
for custom_field in self.que... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_to_csv(self, request, queryset):\n fields = self.get_table_fields()\n field_names = [field.name for field in fields]\n field_verbose_names = [field.verbose_name.encode(\n 'utf-8'\n ) for field in fields]\n\n response = HttpResponse(content_type='... | [
"0.82700646",
"0.79243326",
"0.785673",
"0.78357446",
"0.77470887",
"0.71963537",
"0.6911402",
"0.68625903",
"0.6862561",
"0.67439365",
"0.66723526",
"0.66660285",
"0.66279894",
"0.66100514",
"0.6597877",
"0.6575114",
"0.656509",
"0.64982337",
"0.6478382",
"0.6445977",
"0.642... | 0.83472526 | 0 |
Encapsulate any data which contains a comma within double quotes. | def format_in_csv(data):
csv = []
arg_list = list(data)
arg_list[3] = '=' + str(arg_list[3]) + '*12'
for value in arg_list:
# Represent None or False with empty string
if value is None or value is False:
csv.append('')
continue
# Convert dates to ISO for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comma(block):\n if ',' in block:\n block = '\"' + block + '\"'\n return block",
"def csv_safe(string):\n # let's backslash all the quotation marks anyways\n string = str(string)\n string = string.replace('\"','\\\\\"')\n\n if \",\" not in string and \"\\n\" not in string:\n re... | [
"0.6295174",
"0.62139606",
"0.6090001",
"0.6015809",
"0.5908498",
"0.5893587",
"0.58921415",
"0.5880803",
"0.58636075",
"0.58345276",
"0.5809084",
"0.57992554",
"0.5795957",
"0.5795206",
"0.57568413",
"0.5732317",
"0.5732317",
"0.5667389",
"0.56346375",
"0.5614579",
"0.561000... | 0.5347689 | 38 |
get all processes in a list | def get_processes():
cmd = 'ps -do pid:1,cmd' # linux command to run
processes = {}
with os.popen(cmd) as out:
# see https://stackoverflow.com/questions/24362007/
next(out.__iter__()) # skip header (first line)
for line in out:
# sepate pid and command in a tuple
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_processes():\n yield from psutil.process_iter()",
"def ListProcesses(self):\n stdout, stderr = self.RunCmdOnDevice(\n [\n '/bin/ps', '--no-headers', '-A', '-o', 'pid,ppid,args:4096,state'\n ],\n quiet=True)\n assert stderr == '', stderr\n procs = []\n for l ... | [
"0.7614332",
"0.72756803",
"0.7230724",
"0.71371156",
"0.70869774",
"0.7040173",
"0.6863143",
"0.68533826",
"0.68258727",
"0.68209374",
"0.678037",
"0.6773393",
"0.66728896",
"0.6625193",
"0.6593684",
"0.65855896",
"0.6559334",
"0.64931774",
"0.64349556",
"0.6412724",
"0.6407... | 0.6547949 | 17 |
Returns the memory page size on this system. Page size will never change, so get it once and cache it. | def pagesize(self):
if 'pagesize' not in self.last_values:
pgs = sh.run_cmd('/bin/pagesize')
self.last_values['pagesize'] = int(pgs)
return self.last_values['pagesize'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def memory_size(self):\n\n return ipset.ipmap_memory_size(self.map)",
"def memory():\n sin = psutil.virtual_memory()\n return round((sin.total / sin.used) / 100, 3)",
"def memory_size(self):\n\n return ipset.ip... | [
"0.84326565",
"0.7994035",
"0.78275037",
"0.7810594",
"0.7724722",
"0.7705939",
"0.76578695",
"0.74798596",
"0.7428407",
"0.73964155",
"0.7385116",
"0.72748303",
"0.724388",
"0.71809214",
"0.71197736",
"0.7118014",
"0.70714355",
"0.70684624",
"0.7053598",
"0.7052469",
"0.7048... | 0.7243294 | 13 |
This method returns the data type for float numbers from the input string. In case the input string is None or it is empty, a low float value is returned. | def float(s):
if s is None or s == "":
f = float(-maxsize)
else:
f = float(s)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertFloat(s):\n try:\n float(s)\n return \"FLOAT\"\n except:\n return s",
"def guess_type_value (x, none = None) :\n try :\n int (x)\n if x [0] == '0' and len (x) > 1 : return str\n else : return int if len (x) < 9 else str\... | [
"0.7635821",
"0.7387642",
"0.73489845",
"0.73446506",
"0.7303018",
"0.7278938",
"0.72603136",
"0.71921295",
"0.71516633",
"0.7151644",
"0.71133614",
"0.710979",
"0.7107568",
"0.7075993",
"0.7016265",
"0.6970984",
"0.69571024",
"0.68779683",
"0.68752104",
"0.6833263",
"0.67672... | 0.6502958 | 47 |
r"""Check that the units on the passed in arrays are compatible; return the magnitudes. | def check_and_drop_units(actual, desired):
try:
# If the desired result has units, add dimensionless units if necessary, then
# ensure that this is compatible to the desired result.
if hasattr(desired, 'units'):
if not hasattr(actual, 'units'):
actual = units.Quan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_equal_shapes(numpy_arrays: list):\n\n if len(numpy_arrays) < 2:\n return\n\n shapes = np.asarray([np.shape(_arr) for _arr in numpy_arrays]).astype(float)\n mean = np.mean(shapes, axis=0)\n for i in range(len(shapes)):\n shapes[i, :] = shapes[i, :] - mean\n\n if not np.sum(np... | [
"0.60291326",
"0.59873295",
"0.59666526",
"0.591283",
"0.59020066",
"0.5896654",
"0.58876365",
"0.5793808",
"0.578346",
"0.57649297",
"0.57343066",
"0.57128197",
"0.5646205",
"0.56034285",
"0.54478925",
"0.5436073",
"0.5413892",
"0.5392646",
"0.5388471",
"0.5380874",
"0.53420... | 0.49460346 | 66 |
Check that arrays are almost equal, including units. | def assert_array_almost_equal(actual, desired, decimal=7):
actual, desired = check_and_drop_units(actual, desired)
numpy.testing.assert_array_almost_equal(actual, desired, decimal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_array_equal(actual, desired):\n actual, desired = check_and_drop_units(actual, desired)\n numpy.testing.assert_array_equal(actual, desired)",
"def array_equal(a, b, unit_tol=1e-4, total_tol=1e-4, with_sign=True):\n\n a = to_nparray(a)\n b = to_nparray(b)\n\n if len(a) == 0 and len(b) ==... | [
"0.7447105",
"0.70785916",
"0.70329785",
"0.68776125",
"0.6864121",
"0.6837699",
"0.68330085",
"0.67987525",
"0.6760304",
"0.67587006",
"0.6690534",
"0.6684772",
"0.6684772",
"0.665663",
"0.6621213",
"0.6619038",
"0.66172236",
"0.66080946",
"0.6576756",
"0.65416765",
"0.65241... | 0.7569934 | 0 |
Check that arrays are equal, including units. | def assert_array_equal(actual, desired):
actual, desired = check_and_drop_units(actual, desired)
numpy.testing.assert_array_equal(actual, desired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkArraysEqual(self, a, b):\n # Modified from GNUplot would be better to have this in some module\n self.checkArrayAttrs(a, b)\n np.testing.assert_array_equal(a, b)\n if len(a.set_arrays) > 1:\n for i, set_arr in enumerate(a.set_arrays):\n np.testing.asse... | [
"0.74932903",
"0.71501815",
"0.71476245",
"0.7057142",
"0.70403886",
"0.69055694",
"0.68923753",
"0.68751323",
"0.6859004",
"0.68136066",
"0.6797591",
"0.6795477",
"0.6774892",
"0.6767964",
"0.67270464",
"0.6704331",
"0.6704331",
"0.6679936",
"0.6658721",
"0.6639561",
"0.6608... | 0.7578366 | 0 |
Hide the ticklabels on an axes. | def hide_tick_labels(ax):
ax.xaxis.set_ticklabels([])
ax.yaxis.set_ticklabels([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hide_labels(self):\n for x in 'xy':\n # \"Shared\" axis and tick labels\n axis = getattr(self, x + 'axis')\n share = getattr(self, '_share' + x)\n if share is not None:\n level = getattr(self.figure, '_share' + x)\n if level > 0:... | [
"0.8511003",
"0.7878751",
"0.7807032",
"0.7714514",
"0.7621796",
"0.7611741",
"0.75133324",
"0.7498455",
"0.7425349",
"0.73274493",
"0.7242701",
"0.69682276",
"0.68379915",
"0.6622227",
"0.6578706",
"0.6483394",
"0.64826995",
"0.6445603",
"0.6346425",
"0.63249016",
"0.6299427... | 0.8863266 | 0 |
Determines whether `f` is heading out of bounds. | def swimming_fish_out_of_bounds(f: SwimmingFish, width: int) -> bool:
return (left_edge(f) < -width/2 and f.dx < 0) or \
(right_edge(f) > width/2 and f.dx > 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_of_bounds(self):\n return self.rect.right <= 0",
"def check_bounds(f):\n\n @wraps(f)\n def deco(chunk, coords, *args, **kwargs):\n x, y, z = coords\n\n # Coordinates were out-of-bounds; warn and run away.\n if not (0 <= x < 16 and 0 <= z < 16 and 0 <= y < CHUNK_HEIGHT):\... | [
"0.6660436",
"0.6562338",
"0.6401819",
"0.61970454",
"0.60221624",
"0.5935669",
"0.58295214",
"0.5808516",
"0.57209086",
"0.5712146",
"0.5707718",
"0.5669163",
"0.5609287",
"0.5571251",
"0.55454415",
"0.5516191",
"0.5482109",
"0.54669034",
"0.54557556",
"0.5450912",
"0.544392... | 0.6845657 | 0 |
Finds the x coordinate of the left edge of a fish. | def left_edge(f: SwimmingFish) -> float:
if f.dx > 0:
return f.posn.x
else:
return f.posn.x - f.fish.size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left(self):\n return self.points['topLeft'].x",
"def left(self):\n return self.points['topLeft'].x",
"def left(self):\n x, y = (self.loc[0] - 1, self.loc[1])\n\n if x < 0:\n return None # None\n\n return self.garden.cells[y][x]",
"def pos_left(self, x=1):\n\... | [
"0.7301792",
"0.7301792",
"0.721165",
"0.710895",
"0.7108425",
"0.6952581",
"0.6705541",
"0.66770905",
"0.6617342",
"0.65757537",
"0.6570477",
"0.6512245",
"0.64900225",
"0.6489691",
"0.6486581",
"0.64571416",
"0.6450955",
"0.6427716",
"0.64027894",
"0.63981867",
"0.63929224"... | 0.87858367 | 0 |
Finds the x coordinate of the right edge of a fish. | def right_edge(f: SwimmingFish) -> float:
if f.dx > 0:
return f.posn.x + f.fish.size
else:
return f.posn.x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_edge(f: SwimmingFish) -> float:\n if f.dx > 0:\n return f.posn.x\n else:\n return f.posn.x - f.fish.size",
"def right(self):\n return self.points['topRight'].x",
"def right(self):\n return self.points['topRight'].x",
"def pos_right(self, x=1):\n\n self.x += x... | [
"0.74938285",
"0.7032446",
"0.7032446",
"0.6569234",
"0.65316516",
"0.651489",
"0.64163005",
"0.62499994",
"0.6153083",
"0.6143145",
"0.6111873",
"0.60932356",
"0.6076977",
"0.6071054",
"0.60610944",
"0.60007656",
"0.60007656",
"0.59890544",
"0.5977792",
"0.59737504",
"0.5945... | 0.8522208 | 0 |
Determines whether `p` is directly above `f`. | def is_posn_above_fish(p: Posn, f: SwimmingFish) -> bool:
return p.y > f.posn.y and left_edge(f) <= p.x <= right_edge(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fp_lt(x: float, y: float) -> bool:\n return not fp_eq(x, y) and x < y",
"def fp_gt(x: float, y: float) -> bool:\n return not fp_eq(x, y) and x > y",
"def __gt__(self, other):\n return self.__f > other.get_f()",
"def contains_point(self, p):\n return self.begin <= p < self.end",
"def... | [
"0.6382848",
"0.61952317",
"0.60438246",
"0.5982676",
"0.5938308",
"0.5912637",
"0.58335614",
"0.5830815",
"0.58229244",
"0.5743607",
"0.57263404",
"0.56490135",
"0.56434375",
"0.5631621",
"0.5618267",
"0.5615411",
"0.5603845",
"0.5593953",
"0.5562807",
"0.5538966",
"0.551651... | 0.7774571 | 0 |
Tries to feed all the fishes with food dropped at position `click`. | def try_feed_fish_list(click: Posn, fishes: FishList):
if fishes is not None:
try_feed_fish(click, fishes.first)
try_feed_fish_list(click, fishes.rest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_click(x, y):\n try_feed_fish_list(Posn(x, y), aq.fishes)",
"def try_feed_fish(click: Posn, f: SwimmingFish):\n if is_posn_above_fish(click, f):\n feed_fish(f.fish)",
"def feed(self, food, grid, snake_status, finder):\n head = snake_status[\"head\"]\n head_loc = grid.no... | [
"0.7104014",
"0.6486478",
"0.5593556",
"0.52382886",
"0.51975065",
"0.5114598",
"0.50277764",
"0.5016825",
"0.5011668",
"0.498321",
"0.497314",
"0.49579293",
"0.49493226",
"0.49408573",
"0.49015456",
"0.489851",
"0.4896407",
"0.48950163",
"0.48861074",
"0.48861074",
"0.488168... | 0.6315944 | 2 |
Find (and set) the appendix letter | def set_letter(self, appendix):
for hd in appendix_headers(appendix):
text = tree_utils.get_node_text(hd)
if self.appendix_letter:
logger.warning("Found two appendix headers: %s and %s",
self.appendix_letter, text)
self.appendix_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letterToIndex(letter):\n if letter not in all_letters:\n letter = remove_tone_marks(letter)\n\n return all_letters.find(letter) + 1",
"def find_letter(self,letter):\n for i in range(0,len(self._word)):\n if self._word[i] == letter:\n self.new_string[i] = letter\n... | [
"0.6238258",
"0.6102256",
"0.59258825",
"0.58711624",
"0.57959664",
"0.57638294",
"0.56799877",
"0.5676638",
"0.557988",
"0.557988",
"0.5565665",
"0.5565665",
"0.5426993",
"0.5415571",
"0.54114985",
"0.54114985",
"0.54114985",
"0.5410943",
"0.5406885",
"0.54008454",
"0.540084... | 0.7323634 | 0 |
Verify that the query fragment and/or design are in the query history. If reverse is True, verify the opposite. Return the size of the history; 1 if we fail to determine it. | def verify_history(client, fragment, design=None, reverse=False, server_name='beeswax'):
resp = client.get('/%(server_name)s/query_history' % {'server_name': server_name})
my_assert = reverse and assert_false or assert_true
my_assert(fragment in resp.content, resp.content)
if design:
my_assert(design in res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_history(model, history):\n if not model.get('~'*history):\n history = len([c for c in model if c.startswith('~') and c.endswith('~')][0])\n print('#'* 57)\n print(\"# WARNING: the model was trained with history length:{0} #\".format(history))\n print(\"# Falling bac... | [
"0.5621582",
"0.54270166",
"0.5357599",
"0.52575916",
"0.5242772",
"0.5210896",
"0.5204662",
"0.5203705",
"0.51053447",
"0.5076154",
"0.5009991",
"0.49987993",
"0.49759695",
"0.49759695",
"0.4972389",
"0.4966538",
"0.49533468",
"0.49365112",
"0.4918171",
"0.48912013",
"0.4881... | 0.8131922 | 0 |
Softmax Function Subtract max for numerical stability | def softmax(z):
z -= np.max(z)
numerator = np.exp(z)
denominator = np.sum(numerator, axis=1).reshape(-1, 1) + 1e-7
return numerator / denominator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x): \n e_x = np.exp(x - np.max(x)) \n return e_x / e_x.sum()",
"def softmax(x):\n e_x = np.exp(x - np.max(x))\n return e_x / e_x.sum(axis=0) # only difference",
"def softmax(x):\r\n e_x = np.exp(x - np.max(x))\r\n return e_x / e_x.sum(axis=0) # only difference\r",
... | [
"0.8152991",
"0.8079076",
"0.80757797",
"0.80667955",
"0.80667955",
"0.80667955",
"0.80667955",
"0.8042965",
"0.8034646",
"0.8034646",
"0.80252635",
"0.7989922",
"0.7975356",
"0.7973275",
"0.7970623",
"0.7970623",
"0.7970623",
"0.7970623",
"0.7970623",
"0.7970623",
"0.7970623... | 0.7722469 | 59 |
Tests adding a flow request with null profile. It tests that the request is added but its status is set to PENDING | def test_add_flow_requests_with_null_profile(self):
flow_request = {
'flow_id': 'f_44444',
'profile': None,
'start_validity': '2017-10-23T10:00:00+02:00',
'expire_validity': '2018-10-23T10:00:00+02:00'
}
res = self._add_flow_request(flow_request=fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_flow_requests_without_profile(self):\n flow_request = {\n 'flow_id': 'f_44444',\n 'start_validity': '2017-10-23T10:00:00+02:00',\n 'expire_validity': '2018-10-23T10:00:00+02:00'\n }\n res = self._add_flow_request(flow_request=flow_request)\n ... | [
"0.80036163",
"0.7232278",
"0.7049326",
"0.7048891",
"0.63334006",
"0.6172055",
"0.61487865",
"0.59809506",
"0.582963",
"0.57931393",
"0.5763863",
"0.5751336",
"0.5673823",
"0.5630929",
"0.56178033",
"0.55690885",
"0.5566032",
"0.5539675",
"0.55045915",
"0.54282176",
"0.54181... | 0.8205824 | 0 |
Tests adding a flow request without profile. It tests that the request is added but its status is set to PENDING | def test_add_flow_requests_without_profile(self):
flow_request = {
'flow_id': 'f_44444',
'start_validity': '2017-10-23T10:00:00+02:00',
'expire_validity': '2018-10-23T10:00:00+02:00'
}
res = self._add_flow_request(flow_request=flow_request)
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_flow_requests_forcing_status(self):\n flow_request = self.flow_request.copy()\n flow_request.update({\n 'process_id': '22222',\n 'status': FlowRequest.ACTIVE\n })\n\n res = self._add_flow_request(flow_request=flow_request)\n self.assertEqual(res... | [
"0.7803305",
"0.76301026",
"0.74845064",
"0.6945466",
"0.6928897",
"0.67383623",
"0.6580541",
"0.65189177",
"0.6186129",
"0.6147419",
"0.61275727",
"0.6079337",
"0.6047433",
"0.6040039",
"0.601013",
"0.59942967",
"0.5922391",
"0.5886359",
"0.5867241",
"0.5838824",
"0.5804633"... | 0.80373293 | 0 |
Tests failure when adding flow request with a client not authenticated (i.e., the request doesn't include the oauth2 header) | def test_add_flow_requests_unauthorized(self):
res = self.client.post('/v1/flow_requests/', data=json.dumps(self.flow_request),
content_type='application/json')
self.assertEqual(res.status_code, 401)
self.assertEqual(res.json(), {'errors': ['not_authenticated']}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_token_auth_required(self, client):\n assert_hook_status(client, status=401)",
"def test_not_owned_flow_request(self):\n # the flow request belongs to DEST_2\n headers = self._get_oauth_header(client_name=DEST_1_NAME)\n res = self.client.get('/v1/flow_requests/33333/', **he... | [
"0.72295207",
"0.7026418",
"0.7016032",
"0.69895214",
"0.69852763",
"0.69654834",
"0.69632566",
"0.69137406",
"0.68774265",
"0.6830494",
"0.68187094",
"0.6762043",
"0.6760029",
"0.6758737",
"0.6725911",
"0.67148423",
"0.67016965",
"0.66967964",
"0.66926056",
"0.6655485",
"0.6... | 0.7570188 | 0 |
Tests failure when adding flow request with a client which is not authorized (i.e., id doesn't have the correct oauth2 scope) | def test_add_flow_requests_forbidden(self):
# The dispatcher in test data doesn't have the flow_request:write authorization
res = self._add_flow_request(client_name=POWERLESS_NAME)
self.assertEqual(res.status_code, 403) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_confirm_add_flow_request_invalid_consent(self):\n self.client.login(username='duck', password='duck')\n res = self.client.get(\n '/v1/flow_requests/consents_confirmed/?success=true&consent_confirm_id=aaaaa')\n self.assertEqual(res.status_code, 400)\n self.assertEqual... | [
"0.7205315",
"0.7151344",
"0.7092073",
"0.70476425",
"0.70019186",
"0.6802155",
"0.66410387",
"0.65857315",
"0.65610665",
"0.6554746",
"0.64975345",
"0.6463687",
"0.6459357",
"0.64566725",
"0.64548993",
"0.6403187",
"0.64009964",
"0.63896275",
"0.63676745",
"0.6350549",
"0.63... | 0.6729807 | 6 |
Test that, if the consent manager returns a 400 status (meaning that the consent is already present), the Flow Request is not confirmed | def test_confirm_duplicated_consent(self):
# We create the flow request
res = self._add_flow_request(flow_request=self.flow_request)
confirm_id = res.json()['confirm_id']
process_id = res.json()['process_id']
callback_url = 'http://127.0.0.1/'
# Then we login as mouse si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_confirm_add_flow_request_invalid_consent(self):\n self.client.login(username='duck', password='duck')\n res = self.client.get(\n '/v1/flow_requests/consents_confirmed/?success=true&consent_confirm_id=aaaaa')\n self.assertEqual(res.status_code, 400)\n self.assertEqual... | [
"0.8356095",
"0.8189732",
"0.7774097",
"0.77730256",
"0.73073184",
"0.7107737",
"0.68566835",
"0.68218076",
"0.6663273",
"0.6648389",
"0.6569843",
"0.6542843",
"0.6463835",
"0.6227492",
"0.622404",
"0.62090856",
"0.6193876",
"0.6142819",
"0.61140966",
"0.60695136",
"0.6018724... | 0.6848969 | 7 |
Tests wrong method that accessing to /v1/flow_requests/confirm/ using the wrong HTTP method is not supported | def test_confirm_wrong_method(self):
self.client.login(username='duck', password='duck')
for method in ('post', 'put', 'head', 'options', 'delete', 'trace'):
met = getattr(self.client, method)
res = met('/v1/flow_requests/confirm/')
self.assertEqual(res.status_code, 4... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_method(self):\n\n request = service.get_request('GET', {})\n x = self.start_request_tests(request)\n # GET method not allowed\n self.assertEqual(x.status_code, 405)\n # TBD: check for informativeness\n json.dump(x.to_dict(), sys.stdout, indent=2)",
"def test... | [
"0.71129644",
"0.70722127",
"0.69622916",
"0.69186807",
"0.691428",
"0.69025284",
"0.6882624",
"0.68372715",
"0.6773238",
"0.6747209",
"0.6723123",
"0.6642933",
"0.6612381",
"0.64792246",
"0.64236444",
"0.64158463",
"0.6365028",
"0.635337",
"0.63471687",
"0.63368326",
"0.6334... | 0.8439886 | 0 |
Tests the behavior when a user try to call the /flow_requests/confirm view with a consent_confirm_id of a consent not confirmed. It uses flow_request with 'no_consent' and consent with id 'not_confirmed' (status PE) (check test data) | def test_confirm_add_flow_request_wrong_consent_status(self):
self.client.login(username='duck', password='duck')
res = self.client.get(
'/v1/flow_requests/consents_confirmed/?success=true&consent_confirm_id={}'.format(WRONG_CONFIRM_ID))
self.assertEqual(res.status_code, 302)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_confirm_cannot_contact_consent_when_getting_oauth2_token(self):\n # First perform an add request that creates the flow request with status 'PENDING'\n res = self._add_flow_request()\n confirm_id = res.json()['confirm_id']\n process_id = res.json()['process_id']\n callbac... | [
"0.7789282",
"0.7765866",
"0.7722447",
"0.76400965",
"0.71172243",
"0.71041226",
"0.6917201",
"0.68550384",
"0.67745274",
"0.67180014",
"0.6712531",
"0.6682571",
"0.62548494",
"0.6171562",
"0.61652446",
"0.6082453",
"0.6078937",
"0.6016138",
"0.5980007",
"0.59257776",
"0.5916... | 0.7704632 | 3 |
Tests that getting the flow request by channel id, using non admin REST client is forbidden | def test_search_flow_request_by_channel_id_with_standard_client(self):
# Gets the confirmation code installed with the test data
c = ConsentConfirmation.objects.get(confirmation_id=CORRECT_CONFIRM_ID)
headers = self._get_oauth_header(client_name=DEST_1_NAME)
res = self.client.get('/v1/fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_flow_request_by_channel_id_wrong_channel_id(self):\n headers = self._get_oauth_header(client_name=DISPATCHER_NAME)\n res = self.client.get('/v1/flow_requests/search/?channel_id=unknown', **headers)\n self.assertEqual(res.status_code, 404)\n self.assertEqual(res.json(), {'er... | [
"0.7692033",
"0.66722816",
"0.6641957",
"0.6613594",
"0.6613594",
"0.64904636",
"0.64061844",
"0.6208693",
"0.6166558",
"0.60622394",
"0.60141236",
"0.5930949",
"0.5894965",
"0.5872548",
"0.5847991",
"0.58454376",
"0.58320206",
"0.58320206",
"0.58252585",
"0.5823541",
"0.5802... | 0.7511905 | 1 |
Test that if the channel id is not found, it returns a 404 error | def test_get_flow_request_by_channel_id_wrong_channel_id(self):
headers = self._get_oauth_header(client_name=DISPATCHER_NAME)
res = self.client.get('/v1/flow_requests/search/?channel_id=unknown', **headers)
self.assertEqual(res.status_code, 404)
self.assertEqual(res.json(), {'errors': ['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_report_id_not_found(self) -> None:\n\n channel = self.make_request(\n \"GET\",\n \"/_synapse/admin/v1/event_reports/123\",\n access_token=self.admin_user_tok,\n )\n\n self.assertEqual(404, channel.code, msg=channel.json_body)\n self.assertEqual(... | [
"0.71299934",
"0.67744297",
"0.6734397",
"0.66709024",
"0.643966",
"0.6421132",
"0.6370583",
"0.6366984",
"0.634215",
"0.62995946",
"0.629602",
"0.6259611",
"0.62463063",
"0.6243145",
"0.6234977",
"0.6234891",
"0.6213043",
"0.62075526",
"0.61702245",
"0.61638546",
"0.6162266"... | 0.7665547 | 0 |
Calculate the residual sum of squares | def _fit_eval(rd, B, B2, fwd_svd=None, fwd_data=None, whitener=None,
constraint=None):
if fwd_svd is None:
dist = constraint(rd)
if dist <= 0:
return 1. - 100 * dist
r1s = rd[np.newaxis, :]
fwd = _dipole_forwards(fwd_data, whitener, r1s)[0]
uu, sing,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residuals(self) -> npt.NDArray[np.float64]:\n return self.data - self.theory",
"def _compute_residuals(self):\n residuls = self.I - self.E\n return residuls",
"def get_residual_sum_of_squares(input_features, output, w):\n X = get_test_data (input_features)\n y = get_test_label (o... | [
"0.735632",
"0.7171395",
"0.71091104",
"0.7106706",
"0.7095984",
"0.70876205",
"0.70765406",
"0.7014331",
"0.68075097",
"0.68059653",
"0.67989266",
"0.6765046",
"0.669938",
"0.6659923",
"0.6648715",
"0.6619461",
"0.65916556",
"0.65833104",
"0.65340805",
"0.6529239",
"0.652731... | 0.0 | -1 |
Drop vertex or edge class from database. | def drop_class(self, cls, ignore_instances=False):
if ignore_instances:
self.client.command(
'DROP CLASS {} UNSAFE'.format(cls.registry_name))
else:
self.client.command(
'DROP CLASS {}'.format(cls.registry_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop(self):\n\t\tdrop_model(self.name, self.cursor, print_info = False)",
"def drop_db():\n database.db.reflect()\n database.db.drop_all()\n print('Dropped the database')",
"def tearDownClass(cls):\n db.session.remove()\n db.drop_all()",
"def pg_drop(ctx):\n ctx.obj = ConfigDBCo... | [
"0.66206926",
"0.6331877",
"0.6190306",
"0.61555487",
"0.5968846",
"0.59642357",
"0.595685",
"0.5944796",
"0.59434813",
"0.59434813",
"0.593298",
"0.5900156",
"0.5900156",
"0.58820736",
"0.5858272",
"0.5837346",
"0.5837346",
"0.5837346",
"0.5837346",
"0.5837346",
"0.5837346",... | 0.0 | -1 |
Drop all registry classes from database. | def drop_all(self, registry):
# Drop subclasses first
for cls in reversed(list(registry.values())):
self.drop_class(cls, ignore_instances=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDownClass(cls):\n db.session.remove()\n db.drop_all()",
"def delete_all(cls):\n cls.dbm().modelclass_deleteall(cls)",
"def db_dropall():\n # db_dropall doesn't work if the models aren't imported\n import_string('models', silent=True)\n for blueprint_name, blueprint in app.... | [
"0.7330591",
"0.7313894",
"0.7256648",
"0.7116607",
"0.695387",
"0.69320095",
"0.6901476",
"0.68040967",
"0.6734259",
"0.6734259",
"0.6725226",
"0.67062515",
"0.67009777",
"0.6668985",
"0.6668985",
"0.6668985",
"0.6668985",
"0.6668985",
"0.6668985",
"0.6668985",
"0.6668985",
... | 0.8052791 | 0 |
Get edges incoming to vertex or class. | def inE(self, to, *edge_classes):
records = self.client.command('SELECT inE({0}) FROM {1}'
.format(','.join(self.coerce_class_names(edge_classes))
, self.coerce_class_names(to)))
return [self.get_edge(e) for e in records[0].oRecordData['inE']] \
if records els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edges(self):\n es = []\n for vertex1 in self.vertices():\n for vertex2 in self.out_vertices(vertex1):\n es.append(self[vertex1][vertex2])\n return es",
"def edges(self):\n return self.graph.edges",
"def edges(self):\n return [edge(self.vertices[i... | [
"0.7035939",
"0.69899637",
"0.6746813",
"0.6744376",
"0.66994214",
"0.6671893",
"0.66608536",
"0.6650307",
"0.6650307",
"0.6650307",
"0.6650307",
"0.6650307",
"0.6650307",
"0.66453147",
"0.66453147",
"0.66453147",
"0.6634539",
"0.661742",
"0.66148525",
"0.65614337",
"0.652874... | 0.6221021 | 35 |
Get class name(s) for vertexes/edges. | def coerce_class_names(classes):
return [getattr(val, 'registry_name', val) for val in classes] \
if hasattr(classes, '__iter__') and not isinstance(classes, str) \
else getattr(classes, 'registry_name', classes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_names(self):\n raise NotImplementedError",
"def className(self):\n return _osgAnimation.VertexInfluenceMap_className(self)",
"def classes(self):\n return str(self._classes)",
"def get_feature_names(self):\n return [self.__class__.__name__]",
"def getClassName(self):\n ... | [
"0.64434874",
"0.6325503",
"0.600156",
"0.59852576",
"0.59610564",
"0.59561753",
"0.5941298",
"0.59305745",
"0.5925605",
"0.5922054",
"0.59104776",
"0.59055775",
"0.5898682",
"0.5874623",
"0.5868447",
"0.5868447",
"0.5823224",
"0.5752447",
"0.5735938",
"0.57156855",
"0.571568... | 0.0 | -1 |
Missing files (after registration) should cause workers to fail | def test_query_missing_files():
with new_test_dataset(2) as test_ds:
args = build_register_args(test_ds.copy_to_s3())
args['validation_mode'] = 'SINGLE'
ds_name = args['name']
# Query works, initially
URLs.run(url_info=URLs.register_url(), json_body=args)
URLs.run(ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_log_filenames_file_not_found(self):\n\n filename = '/%s' % (uuid.uuid4())\n while os.path.exists(filename): # pragma: no cover\n filename = '/%s' % (uuid.uuid4())\n\n with self.assertRaises(Exception):\n self.app.log_filenames([filename])\n self.assertEqua... | [
"0.6224492",
"0.6176687",
"0.6166789",
"0.6033904",
"0.60183793",
"0.5974054",
"0.5968201",
"0.5962807",
"0.5959395",
"0.5944138",
"0.5920553",
"0.5909032",
"0.59021455",
"0.58476967",
"0.58468276",
"0.5807812",
"0.5805506",
"0.5805107",
"0.5794332",
"0.57740134",
"0.5770905"... | 0.6050192 | 3 |
Set negative values of input data to 0 and return the result. | def pos(x):
x[x < 0.] = 0.
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negative(data):\n return _make.negative(data)",
"def re_zero_to_datum(self):\n self.device.re_zero_to_datum()\n return \"OK\"",
"def zero_negative_weights(self):\n for k in range(len(self)):\n self[k] *= 0 if self[k] < 0 else 1\n self.finalized = True\n retu... | [
"0.7171659",
"0.67465186",
"0.6679918",
"0.6657102",
"0.6595147",
"0.6541346",
"0.6463043",
"0.6438898",
"0.6352611",
"0.6323751",
"0.63031906",
"0.62768525",
"0.6253981",
"0.624678",
"0.6225372",
"0.61416477",
"0.6112663",
"0.6110124",
"0.6088016",
"0.6039796",
"0.60369754",... | 0.58368194 | 30 |
Create an index vector which has value 1 where input data is nonzero. | def I(x):
Ix = np.zeros_like(x)
Ix[x] = 1
return Ix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonzero_indices(a):\n return (np.nonzero(a)[0])",
"def _unit_vector_or_zeros(index, size):\n u = np.zeros(size, int)\n if index != -1:\n u[index] = 1\n return u",
"def nonzero(self):\n\t\t_x = self.__seqvector.vec.nonzero()[1]\n\t\t_x = list(set(_x)) # uniquify them\n\t\t_x.sort() # sort... | [
"0.7260545",
"0.6994269",
"0.65032923",
"0.63989884",
"0.62178046",
"0.6208965",
"0.62019014",
"0.6119893",
"0.610957",
"0.6089341",
"0.6071668",
"0.60635054",
"0.6033314",
"0.6026115",
"0.6012771",
"0.60099775",
"0.5991233",
"0.598233",
"0.5979951",
"0.59490275",
"0.59478056... | 0.68579584 | 2 |
Return the maximum value on descriptor i. | def max(self, i):
x=self.val(i,0)
lm=len(self)
t=1
while t<lm:
y=self.val(i,t)
if x<y:
x=y
t+=1
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imax(self):\n return self.elem.index(max(self))",
"def max(self):\n try:\n val = iinfo._max_vals[self.key]\n except KeyError:\n if self.kind == 'u':\n val = int((1 << self.bits) - 1)\n else:\n val = int((1 << (self.bits-1)) -... | [
"0.75129414",
"0.745958",
"0.745958",
"0.7133811",
"0.7133811",
"0.7097262",
"0.7096167",
"0.7072438",
"0.7036915",
"0.7028971",
"0.7026346",
"0.7010698",
"0.6992908",
"0.696696",
"0.69639707",
"0.69639707",
"0.69506174",
"0.6946569",
"0.69345224",
"0.6916649",
"0.68550754",
... | 0.8042447 | 0 |
Return a copy of self as a bold font | def asBold(self):
return TextFont( self.name[0:2]+'B', self.size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBoldFont(self):\r\n # obsolete?\r\n profbox()\r\n boldFont = qt.QFont(\"Sans Serif\", 12, qt.QFont.Bold)\r\n return boldFont",
"def asBoldItalic(self):\n\t\treturn TextFont( self.name[0:2]+'IB', self.size)",
"def getBoldFont( self ):\n #obsolete?\n profbox()\n boldFont = qt.QFont( \... | [
"0.7818072",
"0.7815741",
"0.769006",
"0.74989736",
"0.72884196",
"0.7212081",
"0.70323277",
"0.69860613",
"0.696149",
"0.69497114",
"0.68953425",
"0.68757",
"0.6830494",
"0.6825216",
"0.6821684",
"0.6813583",
"0.6749268",
"0.66490203",
"0.66382146",
"0.6511029",
"0.6493915",... | 0.8787394 | 0 |
return a copy of the current font face as bold and italic | def asBoldItalic(self):
return TextFont( self.name[0:2]+'IB', self.size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asBold(self):\n\t\treturn TextFont( self.name[0:2]+'B', self.size)",
"def getBoldFont( self ):\n #obsolete?\n profbox()\n boldFont = qt.QFont( \"Sans Serif\", 12, qt.QFont.Bold )\n return boldFont",
"def asItalic( self):\n\t\treturn TextFont( self.name[0:2]+'I', self.size)",
"def getBoldFont(... | [
"0.6503098",
"0.646432",
"0.6424326",
"0.63638306",
"0.6275204",
"0.62321734",
"0.6177523",
"0.6177523",
"0.609761",
"0.6002326",
"0.57882345",
"0.57882345",
"0.57882345",
"0.5769333",
"0.57120836",
"0.5703144",
"0.56701016",
"0.5650212",
"0.5640166",
"0.5640166",
"0.5640166"... | 0.7222017 | 0 |
By default, all fields are simply stripped of leading and trailing whitespace. | def default_formatter(self, data):
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autostrip(cls):\r\n fields = [(key, value)\r\n for key, value in cls.base_fields.iteritems()\r\n if isinstance(value, CharField)]\r\n for field_name, field_object in fields:\r\n def get_clean_func(original_clean):\r\n return lambda value: original_clean(value a... | [
"0.7429343",
"0.73146516",
"0.7300088",
"0.64653206",
"0.6434441",
"0.63852054",
"0.63713187",
"0.6226918",
"0.616805",
"0.6107152",
"0.6086296",
"0.60737866",
"0.60654396",
"0.60541695",
"0.6051646",
"0.6050548",
"0.60501707",
"0.6029225",
"0.59660363",
"0.59535",
"0.5946430... | 0.0 | -1 |
If no faculty is given, the default faculty name, defined in the profile, is returned. Otherwise, the given faculty name is stripped of whitespace. | def format_faculty(self, data):
if data is None or data.strip() is '':
return profile.defaults['faculty']
else:
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_displayname(self):\n return self.full_name or self.user.username",
"def get_name(user_id):\n try:\n student = _UserProfile.objects.get(user_id=user_id)\n except _UserProfile.DoesNotExist:\n log.exception(f'Could not find UserProfile for id {user_id}')\n return None\n ... | [
"0.59731066",
"0.58593225",
"0.5853738",
"0.5839221",
"0.58199376",
"0.5815639",
"0.5814192",
"0.5807551",
"0.5753702",
"0.5753702",
"0.57436156",
"0.57262427",
"0.57232404",
"0.5659521",
"0.56554073",
"0.565193",
"0.5642841",
"0.56406915",
"0.5618331",
"0.560163",
"0.558794"... | 0.7850038 | 0 |
If the date is given, it is a datetime.datetime object. It is AP formatted and returned. If the date is not given, None is returned. | def format_date(self, data):
return '%s/%s' % (data.month, data.day) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_datetime(a_date: datetime) -> str:\n\n return str(a_date.date()) if a_date else Presenter.DEFAULT",
"def get_date(date):\n return date",
"def pretty_date(self, date):\r\n return time.strftime(\"%a, %b %d, %Y\", time.strptime(date,\"%Y%m%d\"))",
"def format_date(self, data):\r\n ... | [
"0.7156662",
"0.6726074",
"0.65687203",
"0.6202237",
"0.6198814",
"0.6147038",
"0.6144651",
"0.6117162",
"0.61095154",
"0.60733175",
"0.602699",
"0.5985386",
"0.5980702",
"0.5980702",
"0.59769696",
"0.5960169",
"0.5941677",
"0.59405905",
"0.5933722",
"0.5933309",
"0.5916234",... | 0.5460939 | 75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.