query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Check that there is only two reward volumes within a session, one of which is 0. | def check_reward_volume_set(data, **_):
metric = data["rewardVolume"]
passed = 0 < len(set(metric)) <= 2 and 0. in metric
return metric, passed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_reward_volumes(data, **_):\n metric = data['rewardVolume']\n correct = data['correct']\n passed = np.zeros_like(metric, dtype=bool)\n # Check correct trials within correct range\n passed[correct] = (1.5 <= metric[correct]) & (metric[correct] <= 3.)\n # Check incorrect trials are 0\n ... | [
"0.6595489",
"0.59923935",
"0.58829993",
"0.55576754",
"0.5459114",
"0.5263144",
"0.5262954",
"0.5224466",
"0.51899666",
"0.5080002",
"0.50792956",
"0.5036989",
"0.5031256",
"0.5027713",
"0.501224",
"0.50117445",
"0.5010227",
"0.49776033",
"0.49289915",
"0.49272078",
"0.49198... | 0.71636873 | 0 |
Check that the difference between wheel position samples is close to the encoder resolution and that the wheel timestamps strictly increase. | def check_wheel_integrity(data, re_encoding='X1', enc_res=None, **_):
if isinstance(re_encoding, str):
re_encoding = int(re_encoding[-1])
# The expected difference between samples in the extracted units
resolution = 1 / (enc_res or ephys_fpga.WHEEL_TICKS
) * np.pi * 2 * ephys_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_wheel_freeze_during_quiescence(data, **_):\n assert np.all(np.diff(data[\"wheel_timestamps\"]) >= 0)\n assert data[\"quiescence\"].size == data[\"stimOnTrigger_times\"].size\n # Get tuple of wheel times and positions over each trial's quiescence period\n qevt_start_times = data[\"stimOnTrigge... | [
"0.6416596",
"0.6204324",
"0.5757079",
"0.5752711",
"0.5702539",
"0.5654965",
"0.56396395",
"0.5632442",
"0.5595564",
"0.5541013",
"0.5507114",
"0.54889065",
"0.54887325",
"0.5486571",
"0.54845035",
"0.5462624",
"0.54456806",
"0.5435884",
"0.5428846",
"0.53493243",
"0.5341664... | 0.6974392 | 0 |
Check that there are no audio outputs between the start of the trial and the go cue sound onset 20 ms. | def check_audio_pre_trial(data, audio=None, **_):
if audio is None:
_log.warning("No BNC2 input in function call, retuning None")
return None
s = audio["times"][~np.isnan(audio["times"])] # Audio TTLs with NaNs removed
metric = np.array([], dtype=np.int8)
for i, c in zip(data["intervals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_skipped_already_unsilenced(self):\n self.cog.scheduler.__contains__.return_value = False\n self.cog.previous_overwrites.get.return_value = None\n\n for channel in (MockVoiceChannel(), MockTextChannel()):\n with self.subTest(channel=channel):\n self.asse... | [
"0.6270315",
"0.60045695",
"0.5891026",
"0.5863397",
"0.57892865",
"0.57889146",
"0.57805943",
"0.57586294",
"0.5748307",
"0.57187366",
"0.57087165",
"0.5685844",
"0.5684214",
"0.5667447",
"0.56195986",
"0.5612378",
"0.5611862",
"0.5586836",
"0.5543327",
"0.55262345",
"0.5487... | 0.662603 | 0 |
Check the VTK version. | def vtk_version_ok(major, minor, build):
requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)
ver = vtkVersion()
actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \
* 100000000 + ver.GetVTKBuildVersion()
if actual_version >= request... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vtk_version_ok(major, minor, build):\n needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n try:\n vtk_version_number = vtk.VTK_VERSION_NUMBER\n except AttributeError: # as error:\n ver = vtk.vtkVersion()\n vtk_version_number = 10000000000 * ver.GetVT... | [
"0.75072044",
"0.6211863",
"0.61744905",
"0.60805243",
"0.60018027",
"0.5978742",
"0.59628785",
"0.59613186",
"0.595438",
"0.5882819",
"0.5849206",
"0.58227885",
"0.5737467",
"0.5716113",
"0.56421566",
"0.56049746",
"0.55878174",
"0.5585991",
"0.5575074",
"0.5545344",
"0.5543... | 0.7449666 | 1 |
Try to read a file from subversion for inclusion in the wiki. | def GoogleCode_ReadSVNFile(wikifier, domain, path, start, end):
gcurl = "http://%s.googlecode.com/svn/trunk/%s" % (domain,path)
fdata = urllib.urlopen(gcurl).readlines()
return gcurl, fdata[start-1:end] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_file_with_svn_and_revision(self):\n self._test_get_file(\n tool_name='Subversion',\n revision='123',\n base_commit_id=None,\n expected_revision='123')",
"def read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname))... | [
"0.6046934",
"0.5708818",
"0.5687152",
"0.56721485",
"0.564001",
"0.5629846",
"0.55640376",
"0.5557791",
"0.5525044",
"0.5476475",
"0.5451403",
"0.5451343",
"0.5430152",
"0.5422481",
"0.5422481",
"0.53963757",
"0.5382174",
"0.5358687",
"0.53586805",
"0.53561574",
"0.53425014"... | 0.60082895 | 1 |
Calculate the distance between the weights vector of the node and a given vector. | def get_distance(self, vec):
sum = 0
if len(self.weights) == len(vec):
for i in range(len(vec)):
sum += (self.weights[i] - vec[i]) * (self.weights[i] - vec[i])
return np.sqrt(sum)
else:
sys.exit("Error: dimension of nodes != input data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(v: Vector, w: Vector) -> float:\n return magnitude(subtract(v, w))",
"def distance(v, w):\n return magnitude_of_vector(vector_subtract(v, w))",
"def vector_dist(v, w):\n if isinstance(v, list):\n v = np.asarray(v)\n return vector_mag(v - w)",
"def distance(v, w):\n\treturn mag... | [
"0.7776724",
"0.7519333",
"0.7443472",
"0.7413635",
"0.72083104",
"0.705537",
"0.6956175",
"0.6888227",
"0.6851769",
"0.66734695",
"0.6631523",
"0.6563728",
"0.65633744",
"0.6544231",
"0.6533643",
"0.6511806",
"0.6494287",
"0.6481558",
"0.6432434",
"0.64151883",
"0.64133346",... | 0.8128836 | 0 |
The Game Object that was added. | def added_game_object(self) -> GameObject:
return self._added_game_object | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, game_obj):\r\n self.game_objects_for_adding.append(game_obj)",
"def added_game_object_id(self) -> int:\n return CommonObjectUtils.get_object_id(self.added_game_object)",
"def added_object_guid(self) -> int:\n return CommonObjectUtils.get_object_guid(self.added_game_object)",
... | [
"0.6893105",
"0.67863286",
"0.6558083",
"0.60798115",
"0.6059226",
"0.60259646",
"0.60233736",
"0.6021916",
"0.5961065",
"0.5930729",
"0.5921287",
"0.5852365",
"0.58480656",
"0.58340657",
"0.5832652",
"0.5820273",
"0.5774459",
"0.5736312",
"0.571463",
"0.5690474",
"0.56496143... | 0.8658577 | 0 |
The decimal identifier of the Game Object that was added. | def added_game_object_id(self) -> int:
return CommonObjectUtils.get_object_id(self.added_game_object) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def added_object_guid(self) -> int:\n return CommonObjectUtils.get_object_guid(self.added_game_object)",
"def GetID(self):\n return hex(id(self()))",
"def id(self):\n # Might also be a first 12-characters shortcut.\n return self._id",
"def dot_id(self):\n return u\"{0}_{1}\".format... | [
"0.72008175",
"0.67034495",
"0.6595657",
"0.6433382",
"0.6414539",
"0.63876456",
"0.6380759",
"0.637583",
"0.63683313",
"0.6359994",
"0.6348633",
"0.63423586",
"0.633373",
"0.6327065",
"0.6312481",
"0.6284648",
"0.62755895",
"0.6267277",
"0.62603825",
"0.6254732",
"0.6250296"... | 0.74052256 | 0 |
The guid identifier of the Game Object that was added. | def added_object_guid(self) -> int:
return CommonObjectUtils.get_object_guid(self.added_game_object) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def added_game_object_id(self) -> int:\n return CommonObjectUtils.get_object_id(self.added_game_object)",
"def guid(self):\n return self._guid",
"def guid(self) -> str:\n return pulumi.get(self, \"guid\")",
"def guid(self) -> str:\n return pulumi.get(self, \"guid\")",
"def guid(... | [
"0.7552691",
"0.7443691",
"0.7353285",
"0.7353285",
"0.69248873",
"0.6919849",
"0.6838233",
"0.68214774",
"0.6788781",
"0.6781373",
"0.6761098",
"0.6761098",
"0.6756859",
"0.67415684",
"0.6731418",
"0.6731418",
"0.6710318",
"0.67052126",
"0.6645539",
"0.6645539",
"0.6645539",... | 0.8549839 | 0 |
Get the current voltage. | def voltage(self):
return self._voltage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_voltage(self):\n self._raise_not_implemented()",
"def voltage(self):\n return self.outputValue()",
"def get_voltage(self):\n return self.environment.get_voltage(self.neuron_id)",
"def get_voltage(self):\n print(\"voici le voltage de la batterie\")",
"def voltage(self) ->... | [
"0.87557864",
"0.8721714",
"0.86113745",
"0.8594014",
"0.8466012",
"0.8349264",
"0.8208592",
"0.8176201",
"0.812972",
"0.7857926",
"0.7801919",
"0.77965105",
"0.7761072",
"0.773627",
"0.76734275",
"0.76537436",
"0.7645603",
"0.7621279",
"0.7468227",
"0.7446886",
"0.73814726",... | 0.8939401 | 0 |
Computes the thrust force for the given command. | def get_thrust_value(self, command):
return self._gain * numpy.abs(command) * command | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyForce(self, F, dT):",
"def thrust(self, evt=None):\n self.dbgprint(\"thrust(%r)\"%evt)",
"def calculer_force_traction(module_young, coefficient_poisson, longueur_fleche,\n longueur_bras, longueur_corde):\n return calculer_ressort(module_young, coefficient_poisson) * \\... | [
"0.5629867",
"0.55524796",
"0.5294417",
"0.52144986",
"0.5205213",
"0.51810914",
"0.51384085",
"0.50823224",
"0.5055878",
"0.49796396",
"0.49717823",
"0.4953122",
"0.49304152",
"0.49190193",
"0.48769048",
"0.48733506",
"0.48713782",
"0.4851697",
"0.48084703",
"0.48044527",
"0... | 0.6190781 | 0 |
Get a pydicom.FileDataset from the instance's Orthanc identifier | def get_pydicom(orthanc: Orthanc, instance_identifier: str) -> pydicom.FileDataset:
dicom_bytes = orthanc.get_instances_id_file(instance_identifier)
return pydicom.dcmread(BytesIO(dicom_bytes)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pydicom(self) -> pydicom.FileDataset:\n return util.get_pydicom(self.client, self.id_)",
"def get_dataset(self, identifier):\n # Test if a subfolder for the given dataset identifier exists. If not\n # return None.\n dataset_dir = self.get_dataset_dir(identifier)\n if no... | [
"0.76758665",
"0.6792178",
"0.6289413",
"0.628798",
"0.62494963",
"0.6189763",
"0.6181921",
"0.6159265",
"0.6122643",
"0.60905063",
"0.6083762",
"0.60353416",
"0.6018338",
"0.6012588",
"0.59544116",
"0.5922192",
"0.5917395",
"0.59086275",
"0.5863918",
"0.58565897",
"0.5843114... | 0.75693786 | 1 |
Rasterize a collection of lon,lat shapes onto a DLTile. | def rasterize_shape(
tile: Tile,
shapes: AnyShapes,
values: Sequence[int] = None,
out: np.ndarray = None,
mode="burn",
dtype=np.byte,
shape_coords="lonlat",
all_touched=False,
) -> np.ndarray:
shapes = normalize_polygons(shapes)
if values is None:
if mode == "burn":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rasterize(shapes, coords, fill=np.nan, **kwargs):\n from rasterio import features\n transform = transform_from_latlon(coords['lat'], coords['lon'])\n out_shape = (len(coords['lat']), len(coords['lon']))\n raster = features.rasterize(shapes, out_shape=out_shape,\n fill... | [
"0.6464894",
"0.60362566",
"0.57705593",
"0.57181996",
"0.5690948",
"0.5690948",
"0.56545186",
"0.5653969",
"0.5625701",
"0.55724025",
"0.5562426",
"0.55392987",
"0.54787064",
"0.5474159",
"0.546856",
"0.5447885",
"0.5437408",
"0.54057693",
"0.5390586",
"0.5384432",
"0.538070... | 0.6133304 | 1 |
Retrieve a PyUSB device for the Luxafor Flag. Will lazy load the device as necessary. | def get_device(l):
if not l.device:
l.device = find_device()
setup_device(l.device)
return l.device | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_device():\n device = usb.core.find(\n idVendor=LuxaforFlag.DEVICE_VENDOR_ID,\n idProduct=LuxaforFlag.DEVICE_PRODUCT_ID\n )\n return device",
"def get_device(cls, devdesc: UsbDeviceDescriptor) -> UsbDevice:\n cls.Lock.acquire()\n try:\n if devdesc.index or ... | [
"0.69254965",
"0.6485634",
"0.63472474",
"0.6307298",
"0.6286261",
"0.6203117",
"0.61067283",
"0.60893977",
"0.60004014",
"0.59861434",
"0.59207916",
"0.59178483",
"0.5893291",
"0.58582234",
"0.58397084",
"0.5817381",
"0.5815132",
"0.5781035",
"0.5756109",
"0.5748684",
"0.571... | 0.65442044 | 1 |
Send values to the device. Expects the values to be a List of command byte codes. Refer to the individual commands for more information on the specific command codes. | def write(l, values):
l.get_device().write(1, values)
# Sometimes the flag simply ignores the command. Unknown if this
# is an issue with PyUSB or the flag itself. But sending the
# command again works a treat.
l.get_device().write(1, values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __send(self, cmd_val, data):\n # Proof the input\n if cmd_val not in command.values():\n raise ValueError(\"{}: the provided command value {} is not valid.\".format(self.sensor_name, cmd_val))\n if not isinstance(data, bytearray):\n raise TypeError(\"{}: command data ... | [
"0.70586413",
"0.69986117",
"0.6902992",
"0.6806956",
"0.677012",
"0.6769976",
"0.6622003",
"0.6621487",
"0.6603113",
"0.658566",
"0.6583125",
"0.6578142",
"0.6574134",
"0.65513706",
"0.6506194",
"0.65046686",
"0.64179957",
"0.6382939",
"0.6382298",
"0.6373489",
"0.63698804",... | 0.71878153 | 0 |
Fade a single LED or multiple LEDs from their current colour to a new colour for the supplied duration. | def do_fade_colour(l, leds, r, g, b, duration):
l._do_multi_led_command(
create_fade_colour_command, leds, r, g, b, duration
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fade_out(self, duration: int = 1):\n original_brightness = self.np.brightness\n\n step_level = 0.01\n sleep_cycle = duration / (original_brightness / step_level)\n\n while self.np.brightness > 0:\n # FIXME :\n # Im not totally sure why, but...\n # se... | [
"0.7056472",
"0.68512785",
"0.6850706",
"0.6402508",
"0.63308096",
"0.62507784",
"0.62267405",
"0.6176442",
"0.6172806",
"0.6114443",
"0.6007189",
"0.5919894",
"0.5918335",
"0.5838925",
"0.58141935",
"0.578331",
"0.5769158",
"0.567631",
"0.566404",
"0.5663928",
"0.5610591",
... | 0.79324836 | 0 |
Animate the flag with a wave pattern of the given type, using the specified colour, duration and number of times to repeat. | def do_wave(l, wave_type, r, g, b, duration, repeat):
command = create_wave_command(
wave_type, r, g, b, duration, repeat
)
l.write(command) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animate_to(number, color):\n for _ in range(10):\n trellis.pixels.fill((0, 0, 0))\n display_number(random.randint(10, 99), color)\n time.sleep(0.1)\n trellis.pixels.fill((0, 0, 0))\n display_number(number, color)",
"def flash_red(self, duration=0.2):\n self.pen_color = wx... | [
"0.5687249",
"0.5520184",
"0.5502301",
"0.549894",
"0.54490465",
"0.5440435",
"0.52621114",
"0.52320236",
"0.522888",
"0.52235174",
"0.5193794",
"0.5145144",
"0.51310945",
"0.5130986",
"0.5125205",
"0.51163036",
"0.5074429",
"0.504401",
"0.5028484",
"0.5004908",
"0.4992485",
... | 0.5781703 | 0 |
Constructor for the SSH Timeout Exception class | def __init__(self, message="Remote operation timeout"):
super(SshTimeout, self).__init__(message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, error_msg):\n super(RequestTimeoutException, self).__init__(error_msg)",
"def __init__(self, timeout_time):\n self.timeout_time = timeout_time",
"def __init__(self, hostname, username, password, timeout, optional_args):\n raise NotImplementedError",
"def __init__(self,... | [
"0.67599875",
"0.67163706",
"0.64918303",
"0.64363897",
"0.63409185",
"0.6284611",
"0.6284362",
"0.6282421",
"0.62392485",
"0.6182562",
"0.6173027",
"0.6143694",
"0.6105834",
"0.6094346",
"0.6094346",
"0.60341465",
"0.5954169",
"0.59241354",
"0.5864031",
"0.57930404",
"0.5763... | 0.8164756 | 0 |
create a shell connector from machine info object | def from_info(cls, info, user='root'):
conn = None
if not isinstance(info, MachineInfo):
raise TypeError('info must be a MachineInfo')
if user == 'cmuser':
conn = cls(info.ip, 22, info.operator_user,
info.operator_password, '')
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_shell(self, shell):",
"def __init__(self, connector=pxssh.pxssh()):\n self.connector = connector\n\n # pxssh.UNIQUE_PROMPT is \"\\[PEXPECT\\][\\$\\#] \", set prompt for csh\n # should not contain slash(\\)\n if isinstance(self.connector, pxssh.pxssh):\n self.connect... | [
"0.63129455",
"0.55860054",
"0.5557034",
"0.55390114",
"0.5533736",
"0.5485371",
"0.54844224",
"0.5483027",
"0.5439714",
"0.54216254",
"0.53780776",
"0.5342085",
"0.53084445",
"0.5289528",
"0.5280711",
"0.52249736",
"0.52055746",
"0.51824886",
"0.5179961",
"0.51555294",
"0.51... | 0.59186614 | 1 |
Updates the text labels that display the slider values | def updateLabels(self):
# Intensity range
self.minIntensityLabel.setText("Intensity: "+str(self.ABsettings["intensity_range"][0]).rjust(3))
self.labelMaxInt.setText(str(self.ABsettings["intensity_range"][1]).ljust(3))
# Z range
self.minZLabel.setText("Z range: "+str(self.ABsettin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_elements(self, viewer):\n for i in range(self.num_labels):\n lbl = self.lbls[i]\n # get data coord equivalents\n x, y = self.get_data_xy(viewer, (lbl.x, lbl.y))\n # format according to user's preference\n lbl.text = self.format_value(x)",
"... | [
"0.73107535",
"0.7074322",
"0.68887264",
"0.6816435",
"0.67901117",
"0.6768138",
"0.6733651",
"0.6677558",
"0.6651518",
"0.65698177",
"0.6497585",
"0.6495086",
"0.64658064",
"0.6458767",
"0.64468765",
"0.64334774",
"0.64204824",
"0.64106315",
"0.63746005",
"0.63589525",
"0.63... | 0.77173656 | 0 |
encode string into numpy.ndarray using utf32. | def array_encode(s):
return np.frombuffer(s.encode('utf32'), dtype=np.int32, offset=4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unicode(arr):\n try:\n return unicode(arr)\n except UnicodeEncodeError:\n dt = arr.dtype.newbyteorder('S')\n return unicode(arr.view(dt))",
"def encoded(self):\n text, chars = self.chars()\n int2char = dict(enumerate(chars))\n char2int = {ch: ii for ii, ch in ... | [
"0.6568203",
"0.6536662",
"0.6487182",
"0.6231948",
"0.6180096",
"0.6152209",
"0.5947935",
"0.59344274",
"0.59313184",
"0.59313184",
"0.5893763",
"0.5873927",
"0.5808209",
"0.56744933",
"0.56118715",
"0.5595339",
"0.55714226",
"0.55584484",
"0.5555841",
"0.55391484",
"0.55205... | 0.8272287 | 0 |
Test handling a poorly implemented locate_module method. | def test_handling_wrong_locate_module_implementation(method):
loader = WrongEnamlImporter()
with pytest.raises(ImportError):
getattr(loader, method)('module_name') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test___find_corresponding_module_for_location_exceptions(self):\r\n # pylint: disable=protected-access\r\n with self.assertRaises(ItemNotFoundError):\r\n self.peer_grading._find_corresponding_module_for_location(\r\n Location('org', 'course', 'run', 'category', 'name', '... | [
"0.704441",
"0.66467345",
"0.65472347",
"0.642813",
"0.6363407",
"0.6362937",
"0.625545",
"0.6194759",
"0.6184722",
"0.6180454",
"0.6120239",
"0.6073932",
"0.60296243",
"0.6000383",
"0.596782",
"0.5952297",
"0.5937704",
"0.5937704",
"0.5937704",
"0.59352267",
"0.5929191",
"... | 0.693356 | 1 |
Create an enaml module in a tempdir and add it to sys.path. | def enaml_module(tmpdir):
name = '__enaml_test_module__'
folder = str(tmpdir)
path = os.path.join(folder, name + '.enaml')
with open(path, 'w') as f:
f.write(SOURCE)
sys.path.append(folder)
yield name, folder, path
sys.path.remove(folder)
if name in sys.modules:
del sys... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_import_and_cache_generation(enaml_module):\n name, folder, _ = enaml_module\n with imports():\n importlib.import_module(name)\n\n assert name in sys.modules\n\n # Check that the module attributes are properly populated\n mod = sys.modules[name]\n assert mod.__name__ == name\n a... | [
"0.6082835",
"0.6066244",
"0.60439175",
"0.58154875",
"0.5798756",
"0.57679164",
"0.575023",
"0.574298",
"0.57139564",
"0.56493825",
"0.5631153",
"0.5621098",
"0.5608184",
"0.5584475",
"0.55722296",
"0.55148625",
"0.54987985",
"0.5458551",
"0.54473263",
"0.54202634",
"0.54123... | 0.7460824 | 0 |
Test importing a module and checking that the cache was generated. | def test_import_and_cache_generation(enaml_module):
name, folder, _ = enaml_module
with imports():
importlib.import_module(name)
assert name in sys.modules
# Check that the module attributes are properly populated
mod = sys.modules[name]
assert mod.__name__ == name
assert mod.__fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_import_when_cache_exists(enaml_module):\n name, folder, _ = enaml_module\n assert name not in sys.modules\n with imports():\n importlib.import_module(name)\n\n assert name in sys.modules\n del sys.modules[name]\n\n cache_folder = os.path.join(folder, '__enamlcache__')\n assert ... | [
"0.7983087",
"0.7303237",
"0.72239596",
"0.7091177",
"0.69668573",
"0.693975",
"0.67968786",
"0.67071986",
"0.6687973",
"0.66533375",
"0.6651848",
"0.6650018",
"0.6642446",
"0.66381323",
"0.6611553",
"0.6525819",
"0.6480871",
"0.6442875",
"0.6429513",
"0.6378989",
"0.63643533... | 0.7375834 | 1 |
Test importing a module when the cache exists. | def test_import_when_cache_exists(enaml_module):
name, folder, _ = enaml_module
assert name not in sys.modules
with imports():
importlib.import_module(name)
assert name in sys.modules
del sys.modules[name]
cache_folder = os.path.join(folder, '__enamlcache__')
assert os.path.isdir(c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __exist_module_in_sys_cache(module_name):\n try:\n if hasattr(sys, 'stypy_module_cache'):\n return module_name in sys.stypy_module_cache\n else:\n __preload_sys_module_cache()\n return False\n except:\n return False",
"def test_import_cache_only(ena... | [
"0.7172652",
"0.70065624",
"0.6809813",
"0.67054206",
"0.66869247",
"0.6645123",
"0.6615341",
"0.65780705",
"0.6531684",
"0.64752275",
"0.64740145",
"0.64509606",
"0.6437659",
"0.6436985",
"0.6392631",
"0.6389371",
"0.63749903",
"0.6354479",
"0.6347128",
"0.6333608",
"0.63293... | 0.80143213 | 0 |
Standard enaml importer whose state is restored after testing. | def enaml_importer():
print(imports, dir(imports))
old = imports.get_importers()
yield imports
imports._imports__importers = old | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_importer_management(enaml_importer):\n standard_importers_numbers = len(enaml_importer.get_importers())\n enaml_importer.add_importer(WrongEnamlImporter)\n assert WrongEnamlImporter in enaml_importer.get_importers()\n enaml_importer.add_importer(WrongEnamlImporter)\n assert (len(enaml_impor... | [
"0.624024",
"0.58275086",
"0.5791585",
"0.57655126",
"0.55804414",
"0.55008775",
"0.5492725",
"0.53878236",
"0.5371314",
"0.5351267",
"0.5319722",
"0.52447087",
"0.5232631",
"0.5228512",
"0.5220751",
"0.52105415",
"0.5205329",
"0.5183187",
"0.5170881",
"0.5164955",
"0.5149321... | 0.6965677 | 0 |
Test managing manually enaml importers. | def test_importer_management(enaml_importer):
standard_importers_numbers = len(enaml_importer.get_importers())
enaml_importer.add_importer(WrongEnamlImporter)
assert WrongEnamlImporter in enaml_importer.get_importers()
enaml_importer.add_importer(WrongEnamlImporter)
assert (len(enaml_importer.get_im... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enaml_importer():\n print(imports, dir(imports))\n old = imports.get_importers()\n\n yield imports\n\n imports._imports__importers = old",
"def test_import_and_cache_generation(enaml_module):\n name, folder, _ = enaml_module\n with imports():\n importlib.import_module(name)\n\n as... | [
"0.7417657",
"0.6825249",
"0.6661549",
"0.6391132",
"0.63690794",
"0.6306982",
"0.6259021",
"0.6216331",
"0.6164024",
"0.6135842",
"0.60130453",
"0.59856313",
"0.59792435",
"0.5934923",
"0.5910432",
"0.59071934",
"0.58914375",
"0.5864077",
"0.58505535",
"0.58491695",
"0.58251... | 0.77357394 | 0 |
r""" Convert a Pico detection to a menpo.shape.PointDirectedGraph. This enforces a particular point ordering. The Pico detections are circles with a given diameter. Here we convert them to the tighest possible bounding box around the circle. No orientaton is currently provided. | def pointgraph_from_circle(fitting):
diameter = fitting.diameter
radius = diameter / 2.0
y, x = fitting.center
y -= radius
x -= radius
return bounding_box((y, x), (y + diameter, x + diameter)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_puncturefinder_graph(self):\n try:\n return self._puncturefinder_graph\n except AttributeError:\n pass\n\n # g = Graph(multiedges=True, loops=True)\n g = nx.MultiGraph()\n for i in self.switches():\n for sw in {-i, i}:\n b1... | [
"0.50767064",
"0.49477744",
"0.48864093",
"0.48731953",
"0.48656204",
"0.48196903",
"0.48136315",
"0.48119062",
"0.47768894",
"0.4766206",
"0.47514772",
"0.47462827",
"0.47427285",
"0.47004747",
"0.4687095",
"0.46782252",
"0.46657154",
"0.4664539",
"0.46427816",
"0.46333265",
... | 0.6494857 | 0 |
Makes the horizontal box with buttons | def makeButtons(self):
self.but_run = QtWidgets.QPushButton('Run')
self.but_status = QtWidgets.QPushButton('Status')
self.but_brow = QtWidgets.QPushButton('View')
self.but_remove = QtWidgets.QPushButton('Remove files')
self.hboxB = QtWidgets.QHBoxLayout()
self.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button_box(self):\r\n\r\n below_hz_frame = tkinter.Frame(self)\r\n ok_button = ttk.Button(below_hz_frame, text=\"OK\",\r\n width=10, command=self.ok,\r\n default=tkinter.ACTIVE)\r\n ok_button.grid(row=0, column=0, padx=30, pady=10... | [
"0.7095853",
"0.6955391",
"0.6926687",
"0.68542206",
"0.6837923",
"0.67752045",
"0.6765243",
"0.671351",
"0.6640223",
"0.66398984",
"0.6555973",
"0.65282583",
"0.6519112",
"0.64659417",
"0.64081466",
"0.6394941",
"0.63714725",
"0.63361865",
"0.62948644",
"0.6293922",
"0.62938... | 0.71940935 | 0 |
Integration test that logger will raise an exception if account does not exists. | def test_configure_no_account(self):
config = self._getConfiguration()
account = u'no-such-account'
logger = manufacture.makeLogger()
with self.assertRaises(UtilsError) as context:
logger.configure(configuration=config, account=account)
self.assertEqual(u'1026', con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_lookup_account(self):\n pass",
"def test_account_already_exists(mocker, api: API):\n mocker.patch.object(Account, \"does_exist\", return_value=True)\n login = mocker.patch.object(Account, \"login\")\n create = mocker.patch.object(Account, \"create\")\n\n Account(api, \"USERNAME\", \"P... | [
"0.63863415",
"0.6266122",
"0.6089439",
"0.6070338",
"0.60358477",
"0.59792036",
"0.5952488",
"0.5939118",
"0.58980507",
"0.5886915",
"0.5841414",
"0.5836312",
"0.58110714",
"0.57805747",
"0.5735064",
"0.5731167",
"0.5697972",
"0.56951076",
"0.5693734",
"0.5681385",
"0.567892... | 0.76106346 | 0 |
Extracts an archive if it matches tar, tar.gz, tar.bz, or zip formats. | def _extract_archive(file_path, path=".", archive_format="auto"):
if archive_format is None:
return False
if archive_format == "auto":
archive_format = ["tar", "zip"]
if isinstance(archive_format, six.string_types):
archive_format = [archive_format]
for archive_type in archive_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_archive(file_path, path='.', archive_format='auto'):\n if archive_format is None:\n return False\n if archive_format == 'auto':\n archive_format = ['tar', 'zip']\n if isinstance(archive_format, six.string_types):\n archive_format = [archive_format]\n\n for archive_type... | [
"0.77330834",
"0.76566243",
"0.7581955",
"0.6881372",
"0.6814677",
"0.66347516",
"0.64978355",
"0.6380294",
"0.6378682",
"0.6291018",
"0.62800467",
"0.6221986",
"0.6217149",
"0.619506",
"0.6140137",
"0.61342347",
"0.6103157",
"0.61027014",
"0.6078421",
"0.6045398",
"0.5988209... | 0.77244127 | 1 |
Minimization of a scalar function of one or more variables using parallel CMAES retry. | def minimize(fun,
bounds = None,
value_limit = math.inf,
num_retries = 1000,
logger = None,
workers = mp.cpu_count(),
popsize = 31,
max_evaluations = 50000,
capacity = 500,
stop_fittness = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_scalar(objective, **kwargs):\n result = minimize_scalar(objective, **kwargs)\n return result.fun",
"def auxminf1(x):\n \n# Sum over data points\n f = 0.0\n for m_ind in range(cfg.ntrain):\n f += auxmin_f1_part_i(x,m_ind) \n \n return f",
"def fmin(func, x0, sigma0=None, arg... | [
"0.58401585",
"0.5788632",
"0.57425696",
"0.57303965",
"0.56360745",
"0.56013083",
"0.55810285",
"0.556376",
"0.55437535",
"0.5528637",
"0.55246705",
"0.5506914",
"0.550672",
"0.550141",
"0.54960895",
"0.54928195",
"0.54925305",
"0.5491091",
"0.5490144",
"0.548972",
"0.548911... | 0.6479807 | 0 |
sorts all store entries, keep only the 90% best to make room for new ones. | def sort(self): # sort all entries to make room for new ones, determine best and worst
ns = self.num_stored.value
ys = np.asarray(self.ys[:ns])
yi = ys.argsort()
sortRuns = []
for i in range(len(yi)):
y = ys[yi[i]]
xs = self.get_x(yi[i])
sortRu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_and_reduce(self):\n self.data = sorted(self.data, key=lambda item: item.pubDate)\n if len(self.data) > MAX_SIZE:\n self.data = self.data[-MAX_SIZE:]",
"def volume_sort(self):\n self.jobs_sorted = sorted(\n self.jobs,\n key=lambda job: (job['height'],... | [
"0.65042984",
"0.6291601",
"0.5924032",
"0.58100486",
"0.56878287",
"0.56756747",
"0.5670386",
"0.5621025",
"0.55958736",
"0.55391216",
"0.5532553",
"0.54889405",
"0.5487602",
"0.5483785",
"0.5481501",
"0.5474903",
"0.54568",
"0.54499155",
"0.5449535",
"0.5449535",
"0.5441329... | 0.690427 | 0 |
Calculates hash value of the state and its children. | def hash(self, hashed_states=None):
if hashed_states is None:
hashed_states = []
hashed_states.append(self)
result = '1' if self.final else '0'
result += str(len(self.children))
for symbol in self.children:
child = self.children[symbol]
if chi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hash(self, value, get_val, get_child):\n hasher = getattr(hashlib, self.hash_func)\n children = get_child(value)\n\n # If leaf node\n if len(children) < 1:\n return hasher(get_val(value)).hexdigest()\n\n h = hasher()\n for child in children:\n # ... | [
"0.7342968",
"0.72909665",
"0.7124429",
"0.70509243",
"0.6966833",
"0.6820188",
"0.6742874",
"0.67155385",
"0.67155385",
"0.6707483",
"0.66744095",
"0.6658651",
"0.65652084",
"0.6561096",
"0.65602064",
"0.65579015",
"0.6549498",
"0.65474933",
"0.65199417",
"0.65194243",
"0.65... | 0.7933615 | 0 |
Copies state and its children. Ignores parents. | def copy(self):
new_state = State(self.final)
for symbol in self.children:
child = self.children[symbol]
new_state.add_child(child.copy(), symbol)
return new_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n copy = Node(self.node_data, self.tree_type, self.parent)\n if self.children:\n copy.children = [c.copy() for c in self.children]\n for c in copy.children:\n c.parent = copy\n return copy",
"def clone_state(self):\n return self.str... | [
"0.66461754",
"0.66092765",
"0.64861435",
"0.64813745",
"0.64767754",
"0.64714724",
"0.6470946",
"0.6437448",
"0.64342207",
"0.6415057",
"0.64008224",
"0.6400438",
"0.6381998",
"0.63714826",
"0.6197291",
"0.61630076",
"0.61239284",
"0.61002094",
"0.61002094",
"0.61002094",
"0... | 0.7628509 | 0 |
Login to APICEM northbound APIs in shell. | def login():
try:
client = NbClientManager(
server=APIC,
username=APIC_USER,
password=APIC_PASSWORD,
connect=True)
return client
except requests.exceptions.HTTPError as exc_info:
if exc_info.response.status_code == 401:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login(self):\n return self.client.login(username='Georgie', password='12345678')",
"def _login(self):\n data = self._send(self.nc_request(action=\"login\", parameters={\"apipassword\": self._api_password}))\n\n self._session_id = data[\"apisessionid\"]\n\n logging.info(f\"logged in su... | [
"0.6875937",
"0.6725718",
"0.67193294",
"0.6714746",
"0.657623",
"0.6535312",
"0.65296215",
"0.64994276",
"0.6449236",
"0.64444697",
"0.642967",
"0.6409585",
"0.6409585",
"0.63871634",
"0.63714683",
"0.6365348",
"0.6360069",
"0.63199073",
"0.6291092",
"0.62905693",
"0.6288457... | 0.6854403 | 1 |
According to this function We Fetch data from the data base ordering by reverse Id here (N_post = Normal profile posts) (my_post_lists > refer fetching all post from the data base | def get(self, request, *args, **kwargs):
my_normal_post_lists = NormalPosts.objects.filter(uploded_by=request.user.normalprofile).order_by("-id")
return render(request, self.template_name, {
'my_normal_post_lists': my_normal_post_lists,
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_posts():\n get_chain_address = F\"{CONNECTED_NODE_ADDRESS}/chain\"\n response = requests.get(get_chain_address)\n if response.status_code == 200:\n content = []\n chain = json.loads(response.content)\n for block in chain[\"chain\"]:\n for tx in block[\"transaction... | [
"0.6402055",
"0.63352996",
"0.62798464",
"0.62748545",
"0.6224536",
"0.6171342",
"0.6130636",
"0.6092321",
"0.60728544",
"0.59778965",
"0.5957494",
"0.5913101",
"0.58570284",
"0.58428276",
"0.579514",
"0.57481414",
"0.5719974",
"0.5713792",
"0.5709445",
"0.5702672",
"0.568024... | 0.66532075 | 0 |
Check a given line to see if a move is valid. Return the squares that will change, if the move is valid, otherwise an empty list. | def valid_line(board, x, y, dx, dy):
if not 0 <= x + dx + dx < 8:
return []
if not 0 <= y + dy + dy < 8:
return []
coords_1 = board.columns[x+dx] + board.rows[y+dy]
coords_2 = board.columns[x+dx+dx] + board.rows[y+dy+dy]
if board[coords_1] != -self.color:
# If the neighbour square... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legal_moves(player, board):\n return [sq for sq in Othello.squares() if Othello.is_legal(sq, player, board)]",
"def is_valid(move):\n return isinstance(move, int) and move in Othello.squares()",
"def is_valid_move(state, move):\n row, col = move\n if row not in [1, 2, 3] or col not in [... | [
"0.6370445",
"0.62957835",
"0.6113358",
"0.61125934",
"0.59849495",
"0.5977295",
"0.5965192",
"0.5934297",
"0.59330297",
"0.59321463",
"0.5929608",
"0.5929004",
"0.5915414",
"0.5898067",
"0.58975315",
"0.5873103",
"0.5867404",
"0.586026",
"0.5846924",
"0.58331126",
"0.5830166... | 0.7884284 | 0 |
Check if the given key is valid, with the format XY. X is the column, between A and H, and Y is the row, between 1 and 8. | def _is_valid_key(self, key):
# If the key is not a string
if not isinstance(key, str):
return False
else:
key = str.upper(key)
# If the given key does not match the standard notation XY
if len(key) != 2:
return False
# If the key is out of the board
if key[0] not in self.columns or key[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __check_key_validity(self, key):\n if not isinstance(key, tuple):\n raise TypeError(\"key must be a tuple\")\n if len(key) != 2:\n raise ValueError(\"key must be of length two\")\n if not (isinstance(key[0], int) and isinstance(key[1], int)):\n raise TypeEr... | [
"0.7048035",
"0.69368386",
"0.692533",
"0.6781486",
"0.64831704",
"0.6406309",
"0.6364915",
"0.6322703",
"0.63189375",
"0.63171273",
"0.6212421",
"0.61821645",
"0.6121905",
"0.6106289",
"0.60453564",
"0.60074675",
"0.6005349",
"0.5961546",
"0.5960941",
"0.5926862",
"0.5837048... | 0.79342586 | 0 |
wrapper function for replace dialog, launches dialog over the passed curses window and returns a tuple of (pattern, replace) or (None,None) if canceled | def replace( scr ):
d = ReplaceDialog(scr)
value = d.main()
if not "pattern" in value:
return (None,None)
else:
return (value["pattern"],value["replace"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,scr):\n (max_y,max_x) = scr.getmaxyx()\n dialog.Dialog.__init__(self, scr, \"ReplaceDialog\", 5, max_x-4, [ dialog.Frame(\"Search and Replace\"),\n dialog.Prompt(\"pattern\",1,2,1,\"Pattern: \",-1),\n ... | [
"0.66686773",
"0.66447234",
"0.62689984",
"0.6130497",
"0.60572594",
"0.6004771",
"0.5970039",
"0.5969815",
"0.55415326",
"0.55407614",
"0.5508379",
"0.5372172",
"0.53694844",
"0.53567016",
"0.52937233",
"0.5293361",
"0.5287301",
"0.5183273",
"0.5166747",
"0.5142576",
"0.5140... | 0.69241583 | 0 |
wrapper function for the confirm replace dialog, returns 1 == yes, 2 == no, 3 == all, 4 == cancel returns 4 == cancel if canceled | def confirm_replace( scr ):
d = ConfirmReplaceDialog(scr)
value = d.main()
if "yes" in value:
if value["yes"]:
return 1
elif value["no"]:
return 2
elif value["all"]:
return 3
elif value["cancel"]:
return 4
else:
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm(text, window=None):\n return message(text, u'Confirma', M_QUESTION, B_YES_NO, window) == R_YES",
"def confirm(force):\n if not force:\n ans = input(que(bold(\"Are you sure? [y/N]: \")))\n else:\n ans = 'y'\n\n return ans.lower()",
"def ask_ok_cancel(message=\"\", title=Non... | [
"0.6553291",
"0.6408498",
"0.63460416",
"0.633145",
"0.6314579",
"0.63029253",
"0.6250293",
"0.6190345",
"0.6184483",
"0.6169528",
"0.6107208",
"0.60912764",
"0.6072582",
"0.607161",
"0.60662067",
"0.6043061",
"0.6029693",
"0.6001996",
"0.5931839",
"0.59036756",
"0.59018284",... | 0.85182613 | 0 |
Sets default value for order prefix | def default_order_prefix():
return 'mag_' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_prefix(self) -> str:",
"def default_prefix(self) -> str:\n return \"\"",
"def default_prefix(self) -> str:\n return \"\"",
"def setDefaultTopicPrefix(self, prefix):\n\n internals.blpapi_SessionOptions_setDefaultTopicPrefix(\n self.__handle,\n prefix)",
... | [
"0.7458118",
"0.69559276",
"0.69559276",
"0.6246707",
"0.6121237",
"0.6042731",
"0.6010271",
"0.6010271",
"0.59950566",
"0.5959341",
"0.5876922",
"0.58622044",
"0.58620113",
"0.58606994",
"0.5838946",
"0.5803903",
"0.57959056",
"0.57950515",
"0.57381994",
"0.57282114",
"0.567... | 0.7345233 | 1 |
Import order states for instances | def import_order_states(cls, instances):
OrderState = Pool().get('magento.order_state')
for instance in instances:
Transaction().context.update({
'magento_instance': instance.id
})
# Import order states
with OrderConfig(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_owned_instances():\n\n global owned_instances\n\n owned_instances = []\n try:\n with open(state_file, 'r') as f:\n for line in f:\n # Strip spaces and skip empty lines\n inst = line.strip()\n if inst != '':\n owned_instances.append(inst)\n logging.info(\"Loaded ... | [
"0.611863",
"0.5710451",
"0.55662745",
"0.55035776",
"0.5480113",
"0.54768515",
"0.54705364",
"0.54545605",
"0.5401249",
"0.5392934",
"0.5383165",
"0.53240365",
"0.53240365",
"0.5321685",
"0.5317529",
"0.5316439",
"0.5280355",
"0.52445763",
"0.51902944",
"0.51692367",
"0.5133... | 0.7806463 | 0 |
Sets default for active | def default_active():
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_active(self, active):\n self.active = active",
"def set_active(self):\n self.active = True",
"def set_active(self, active):\n self._active = active",
"def active(self, active):\n\n self._active = active",
"def active(self, active):\n\n self._active = active",
"d... | [
"0.75453544",
"0.75211966",
"0.7276021",
"0.70126075",
"0.70126075",
"0.70126075",
"0.70126075",
"0.6970733",
"0.6970733",
"0.6938084",
"0.69131684",
"0.68543226",
"0.68543226",
"0.6832889",
"0.6776642",
"0.67710924",
"0.6755308",
"0.6708381",
"0.6620978",
"0.65976095",
"0.65... | 0.80122274 | 0 |
Sets current company as default | def default_company():
return Transaction().context.get('company') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def company(self, company):\n self._company = company",
"def company(self, company):\n\n self._company = company",
"def company(self, company):\n\n self._company = company",
"def set_as_default (self):\n\t\ttry:\n\t\t\tself.config.set('Global', 'Default', self.currentAccount.data['name']... | [
"0.70627534",
"0.6857343",
"0.6857343",
"0.6305711",
"0.62525135",
"0.6229821",
"0.6217805",
"0.60344994",
"0.59844",
"0.5886969",
"0.5837648",
"0.5830834",
"0.58194566",
"0.5790694",
"0.5790694",
"0.57838154",
"0.5768062",
"0.56869924",
"0.5668195",
"0.5659434",
"0.5657504",... | 0.7678898 | 0 |
Import the websites and their stores/view from magento | def import_websites(cls, instances):
Website = Pool().get('magento.instance.website')
Store = Pool().get('magento.website.store')
StoreView = Pool().get('magento.store.store_view')
MagentoOrderState = Pool().get('magento.order_state')
try:
instance, = instances
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_inventory(self, websites):\n for website in websites:\n website.export_inventory_to_magento()",
"def importSites(self,sites_list):\n \"\"\" Append these sites objects to a sample \"\"\" \n self.sites = []\n for s in sites_list:\n mySite = Site(s)\n ... | [
"0.6846587",
"0.6164038",
"0.61030966",
"0.58853394",
"0.56397796",
"0.5540255",
"0.5497646",
"0.5465208",
"0.5342944",
"0.52653944",
"0.52565813",
"0.5253915",
"0.5238693",
"0.51912624",
"0.5140717",
"0.5108908",
"0.50549793",
"0.50509304",
"0.5028507",
"0.5003324",
"0.49764... | 0.7438709 | 0 |
Import carriers/shipping methods from magento for instances | def import_carriers(cls, instances):
InstanceCarrier = Pool().get('magento.instance.carrier')
for instance in instances:
with Transaction().set_context({
'magento_instance': instance.id
}):
with OrderConfig(
instance.url, inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_methods(self):\r\n methods = {obj['method'] for obj in self.cf_data}\r\n metadata = {obj['name']: obj for obj in self.csv_data}\r\n self.data = {}\r\n missing = set()\r\n for line in self.cf_data:\r\n if line['method'] not in self.units:\r\n ... | [
"0.5449542",
"0.5294955",
"0.5138079",
"0.48752856",
"0.48261753",
"0.4798459",
"0.47784653",
"0.47548106",
"0.47265235",
"0.4684022",
"0.46793112",
"0.46229893",
"0.4609243",
"0.46083152",
"0.45978007",
"0.45886204",
"0.45643952",
"0.45614693",
"0.45093706",
"0.4497847",
"0.... | 0.728472 | 0 |
Sets default root category id. Is set to 1, because the default root category is 1 | def default_magento_root_category_id():
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_id(root: TreeNode):\n current_id = [0]\n init_id_helper(root, current_id)\n return current_id[0]",
"def PrimaryCategory(self, default=None):\n return self.data.get('categories', [default])[0]",
"def root(self) -> 'Category':\n if self.parent:\n return self.parent.... | [
"0.65238833",
"0.60481906",
"0.5950954",
"0.5714606",
"0.5712186",
"0.5594999",
"0.55752224",
"0.55726135",
"0.5566532",
"0.5562183",
"0.55386394",
"0.55160403",
"0.5515742",
"0.5502178",
"0.5425077",
"0.5389408",
"0.5376485",
"0.53576773",
"0.5263281",
"0.52428555",
"0.52280... | 0.82208395 | 0 |
Sets default product uom for website | def default_default_uom():
ProductUom = Pool().get('product.uom')
return ProductUom.search([('name', '=', 'Unit')])[0].id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_product():\n return Product.objects.get_or_create(name='Unknown', category=get_default_category())",
"def setUp(self) -> None:\n self.default = Product('Test Product')\n self.tester = Product('Tester', price=15, weight=2)",
"def set_product(self, product):\n self.single_... | [
"0.56517774",
"0.56510484",
"0.563105",
"0.54381317",
"0.5406732",
"0.5265254",
"0.52629864",
"0.52540123",
"0.52490556",
"0.5216789",
"0.52122056",
"0.519658",
"0.51876277",
"0.5182377",
"0.5166348",
"0.5162013",
"0.51297545",
"0.50542104",
"0.5047263",
"0.5036484",
"0.50230... | 0.64440674 | 0 |
Looks for the website whose `values` are sent by magento against the instance with `instance` in tryton. If a record exists for this, return that else create a new one and return | def find_or_create(cls, instance, values):
websites = cls.search([
('instance', '=', instance.id),
('magento_id', '=', int(values['website_id']))
])
if websites:
return websites[0]
return cls.create([{
'name': values['name'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_or_create(cls, website, values):\n stores = cls.search([\n ('website', '=', website.id),\n ('magento_id', '=', int(values['group_id']))\n ])\n\n if stores:\n return stores[0]\n\n return cls.create([{\n 'name': values['name'],\n ... | [
"0.66654605",
"0.5773132",
"0.5575794",
"0.52986217",
"0.5219435",
"0.5175775",
"0.5101473",
"0.50378966",
"0.50342923",
"0.50271636",
"0.497034",
"0.49112558",
"0.48881826",
"0.48387477",
"0.4782479",
"0.47679812",
"0.47377402",
"0.47104242",
"0.46826082",
"0.46774152",
"0.4... | 0.78474057 | 0 |
Exports inventory stock information to magento | def export_inventory(self, websites):
for website in websites:
website.export_inventory_to_magento() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_inventory_to_magento(self):\n Location = Pool().get('stock.location')\n\n product_templates = []\n instance = self.instance\n\n locations = Location.search([('type', '=', 'storage')])\n\n for magento_product_template in self.magento_product_templates:\n prod... | [
"0.6697952",
"0.6533873",
"0.63715094",
"0.6170064",
"0.6122549",
"0.6118368",
"0.60934365",
"0.6089652",
"0.60319245",
"0.5859282",
"0.5852072",
"0.58282447",
"0.5828063",
"0.5802748",
"0.5768997",
"0.57482827",
"0.57467115",
"0.57139105",
"0.5640052",
"0.5583418",
"0.557933... | 0.6653359 | 1 |
Exports stock data of products from tryton to magento for this website | def export_inventory_to_magento(self):
Location = Pool().get('stock.location')
product_templates = []
instance = self.instance
locations = Location.search([('type', '=', 'storage')])
for magento_product_template in self.magento_product_templates:
product_template =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStockData():\n pass",
"def export_inventory(self, websites):\n for website in websites:\n website.export_inventory_to_magento()",
"def export_inventory(self, cursor, user, ids, context):\n website_obj = self.pool.get('magento.instance.website')\n\n website_id = con... | [
"0.64082617",
"0.6399653",
"0.63895637",
"0.62795657",
"0.6145077",
"0.60885113",
"0.6076985",
"0.6049843",
"0.6021914",
"0.6008381",
"0.5943344",
"0.59400165",
"0.59058166",
"0.5860487",
"0.58527863",
"0.5842598",
"0.58248246",
"0.5812929",
"0.57357395",
"0.57285345",
"0.570... | 0.656638 | 0 |
Returns company related to website | def get_company(self, name):
return self.website.company.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_website_companies_get_details(self):\n pass",
"def get_company(self, company_referece):\n url = 'companies/{0}'.format(company_referece)\n result = self.get(url)\n return result.get('company', result)",
"def run_whoxy_company_search(self,company):\n if self.whoxy_api... | [
"0.67787915",
"0.65286976",
"0.64474934",
"0.6438675",
"0.6438675",
"0.6394601",
"0.62661326",
"0.6226491",
"0.6183185",
"0.611617",
"0.6092316",
"0.60650074",
"0.60194445",
"0.5988",
"0.59472513",
"0.5944278",
"0.590658",
"0.58898836",
"0.5884298",
"0.5875273",
"0.5849969",
... | 0.67437315 | 1 |
Returns instance related to website | def get_instance(self, name):
return self.website.instance.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_site(self):\n raise NotImplementedError",
"def website(self):\n return self._website",
"def get_website(self):\n if self.website:\n return self.website\n else:\n try:\n return self.parent.get_website\n except AttributeError: # ... | [
"0.64772785",
"0.636314",
"0.6204019",
"0.6150029",
"0.6150029",
"0.6122803",
"0.61147714",
"0.61060196",
"0.5981487",
"0.5979728",
"0.597262",
"0.5944322",
"0.5904715",
"0.5840119",
"0.57975864",
"0.57975864",
"0.5797228",
"0.5790714",
"0.5753903",
"0.57280713",
"0.56908727"... | 0.7607952 | 0 |
Looks for the store whose `values` are sent by magento against the website with `website` in tryton. If a record exists for this, return that else create a new one and return | def find_or_create(cls, website, values):
stores = cls.search([
('website', '=', website.id),
('magento_id', '=', int(values['group_id']))
])
if stores:
return stores[0]
return cls.create([{
'name': values['name'],
'magento_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_or_create(cls, instance, values):\n websites = cls.search([\n ('instance', '=', instance.id),\n ('magento_id', '=', int(values['website_id']))\n ])\n\n if websites:\n return websites[0]\n\n return cls.create([{\n 'name': values['name'... | [
"0.7311195",
"0.6705495",
"0.5444057",
"0.53808737",
"0.5374841",
"0.5243312",
"0.5237537",
"0.52265453",
"0.51574576",
"0.51567435",
"0.51019216",
"0.49754298",
"0.4973136",
"0.49432912",
"0.48770675",
"0.48759344",
"0.4862138",
"0.48415354",
"0.47996405",
"0.47916886",
"0.4... | 0.7607294 | 0 |
Exports tier prices of products from tryton to magento for this store | def export_tier_prices_to_magento(self):
instance = self.website.instance
for mag_product_template in self.website.magento_product_templates:
product_template = mag_product_template.template
product = product_template.products[0]
# Get the price tiers from the produ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_export_(self, fields):\n Store = Pool().get('magento.website.store')\n\n store = Store(Transaction().context.get('active_id'))\n\n return {\n 'products_count': store.export_tier_prices_to_magento()\n }",
"def get_prices(self):\n pass",
"def import_price... | [
"0.75007206",
"0.57632595",
"0.5730589",
"0.5632844",
"0.55756336",
"0.5540464",
"0.55365473",
"0.5528423",
"0.54979783",
"0.5493264",
"0.5401977",
"0.5359194",
"0.5324393",
"0.52958417",
"0.52836686",
"0.5243634",
"0.5186369",
"0.51700795",
"0.5145529",
"0.5140887",
"0.51227... | 0.83025616 | 0 |
Returns instance related to store | def get_instance(self, name):
return self.store.instance.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_store(self):\n return self._store",
"def get_resource(self):\n return self._stores",
"def get_store(self, store_name: str) -> Any:\n pass",
"def get(cls):\n return cls.instance",
"def instance(self):\n return self.__instance",
"def get_store(store_name: str):\n ... | [
"0.7551979",
"0.70366335",
"0.67878246",
"0.6653498",
"0.66288173",
"0.6600048",
"0.6577926",
"0.6564163",
"0.6541299",
"0.6418138",
"0.6418138",
"0.63910156",
"0.639095",
"0.63711053",
"0.63395643",
"0.6328525",
"0.6310312",
"0.6309283",
"0.62250817",
"0.62165284",
"0.618410... | 0.7497158 | 1 |
Returns website related to store | def get_website(self, name):
return self.store.website.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def website(self):\n return self._website",
"def get_store(self, store_name: str) -> Any:\n pass",
"def get_store(self, store_id):\n for store in self.get_stores():\n if store[\"code\"] == store_id:\n return store",
"def storelocator():\n\n\treturn render_templa... | [
"0.60933346",
"0.6046867",
"0.6016062",
"0.5945412",
"0.5943508",
"0.594223",
"0.59373456",
"0.59351546",
"0.5915155",
"0.59022623",
"0.58764714",
"0.58564603",
"0.58500767",
"0.58093214",
"0.57855004",
"0.57465243",
"0.57146066",
"0.57071215",
"0.5671937",
"0.5665069",
"0.56... | 0.68372726 | 0 |
Returns company related to store | def get_company(self, name):
return self.store.company.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_company(self, company_referece):\n url = 'companies/{0}'.format(company_referece)\n result = self.get(url)\n return result.get('company', result)",
"def company(self):\n return self._company",
"def company(self):\n return self._company",
"def get_company(self, name)... | [
"0.64457345",
"0.6345455",
"0.6345455",
"0.6151367",
"0.6144638",
"0.6015758",
"0.5981194",
"0.588651",
"0.58488876",
"0.58255076",
"0.5811751",
"0.5811187",
"0.5736758",
"0.5736758",
"0.5736758",
"0.5736758",
"0.56247306",
"0.5568528",
"0.5560751",
"0.555124",
"0.5547191",
... | 0.6659226 | 0 |
Looks for the store view whose `values` are sent by magento against the store with `store` in tryton. If a record exists for this, return that else create a new one and return | def find_or_create(cls, store, values):
store_views = cls.search([
('store', '=', store.id),
('magento_id', '=', int(values['store_id']))
])
if store_views:
return store_views[0]
return cls(**{
'name': values['name'],
'code': ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_or_create(cls, website, values):\n stores = cls.search([\n ('website', '=', website.id),\n ('magento_id', '=', int(values['group_id']))\n ])\n\n if stores:\n return stores[0]\n\n return cls.create([{\n 'name': values['name'],\n ... | [
"0.60469294",
"0.55298656",
"0.54436827",
"0.5388281",
"0.5386525",
"0.5251227",
"0.5241936",
"0.52329993",
"0.51904476",
"0.514361",
"0.50282407",
"0.49991724",
"0.49459726",
"0.49037516",
"0.4829308",
"0.48178092",
"0.48170227",
"0.47974437",
"0.47709832",
"0.47291148",
"0.... | 0.79743385 | 0 |
Calls wizard to import orders for store view | def import_orders_button(cls, store_views):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_order_from_store_view(self):\n Sale = Pool().get('sale.sale')\n MagentoOrderState = Pool().get('magento.order_state')\n\n new_sales = []\n instance = self.instance\n with Transaction().set_context({\n 'magento_instance': instance.id,\n 'magento_we... | [
"0.72466475",
"0.7039832",
"0.6421888",
"0.5852894",
"0.58005047",
"0.56411994",
"0.5609187",
"0.5599366",
"0.5552095",
"0.55054647",
"0.5487412",
"0.54771256",
"0.5407994",
"0.5373156",
"0.53110003",
"0.5274243",
"0.52071506",
"0.52046293",
"0.5194662",
"0.5182003",
"0.51817... | 0.7385691 | 0 |
Calls wizard to export order status for store view | def export_order_status_button(cls, store_views):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_order_status(self, store_views=None):\n if store_views is None:\n store_views = self.search([])\n\n for store_view in store_views:\n store_view.export_order_status_for_store_view()",
"def export_order_status_for_store_view(self):\n Sale = Pool().get('sale.sal... | [
"0.7288336",
"0.72106403",
"0.66292167",
"0.64519197",
"0.6352034",
"0.61387265",
"0.5909034",
"0.5826499",
"0.5795876",
"0.5792858",
"0.5707474",
"0.56563604",
"0.56291175",
"0.5613185",
"0.55068296",
"0.5367808",
"0.5351224",
"0.53355646",
"0.5288537",
"0.52830464",
"0.5270... | 0.7584346 | 0 |
Imports sale from store view | def import_order_from_store_view(self):
Sale = Pool().get('sale.sale')
MagentoOrderState = Pool().get('magento.order_state')
new_sales = []
instance = self.instance
with Transaction().set_context({
'magento_instance': instance.id,
'magento_website': self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_orders_button(cls, store_views):\n pass",
"def import_stores(self):\n\n stores = self.product_infos['stores']\n\n for product_store in stores:\n try:\n store = Stores.objects.get(\n name=product_store\n )\n exc... | [
"0.5974712",
"0.58691406",
"0.5794356",
"0.578453",
"0.5557279",
"0.55490655",
"0.54773957",
"0.5474218",
"0.5408638",
"0.54054606",
"0.53851986",
"0.537367",
"0.5366755",
"0.5356549",
"0.5353029",
"0.53460276",
"0.52735",
"0.5259739",
"0.52387893",
"0.51985174",
"0.519066",
... | 0.71493983 | 0 |
Export sale orders to magento for the current store view. If last export time is defined, export only those orders which are updated after last export time. | def export_order_status_for_store_view(self):
Sale = Pool().get('sale.sale')
exported_sales = []
domain = [('magento_store_view', '=', self.id)]
if self.last_order_export_time:
domain = [('write_date', '>=', self.last_order_export_time)]
sales = Sale.search(domain)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_shipment_status_to_magento(self):\n Shipment = Pool().get('stock.shipment.out')\n Sale = Pool().get('sale.sale')\n\n instance = self.instance\n\n sale_domain = [\n ('magento_store_view', '=', self.id),\n ('shipment_state', '=', 'sent'),\n ('ma... | [
"0.67229575",
"0.6432975",
"0.6346789",
"0.6296307",
"0.5768794",
"0.5759411",
"0.5717263",
"0.5693412",
"0.564108",
"0.556255",
"0.5428441",
"0.53630245",
"0.52866554",
"0.52807623",
"0.5272195",
"0.5250655",
"0.5202378",
"0.51813996",
"0.51757",
"0.5057805",
"0.5045959",
... | 0.77887744 | 0 |
Import orders from magento for store views | def import_orders(cls, store_views=None):
if store_views is None:
store_views = cls.search([])
for store_view in store_views:
store_view.import_order_from_store_view() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_order_from_store_view(self):\n Sale = Pool().get('sale.sale')\n MagentoOrderState = Pool().get('magento.order_state')\n\n new_sales = []\n instance = self.instance\n with Transaction().set_context({\n 'magento_instance': instance.id,\n 'magento_we... | [
"0.8316281",
"0.7346102",
"0.6070537",
"0.5948057",
"0.5888158",
"0.58869237",
"0.5863658",
"0.5711296",
"0.56941754",
"0.5657132",
"0.55940354",
"0.55788964",
"0.55533653",
"0.5447958",
"0.5446187",
"0.54387885",
"0.53899795",
"0.53408515",
"0.53375185",
"0.5320202",
"0.5295... | 0.7725665 | 1 |
Export Shipment status for shipments related to current store view. This method is called by cron. | def export_shipment_status(cls, store_views=None):
if store_views is None:
store_views = cls.search([])
for store_view in store_views:
# Set the instance in context
with Transaction().set_context(
magento_instance=store_view.instance.id
):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_shipment_status_to_magento(self):\n Shipment = Pool().get('stock.shipment.out')\n Sale = Pool().get('sale.sale')\n\n instance = self.instance\n\n sale_domain = [\n ('magento_store_view', '=', self.id),\n ('shipment_state', '=', 'sent'),\n ('ma... | [
"0.8125076",
"0.7221847",
"0.66516876",
"0.62769276",
"0.60418105",
"0.5811156",
"0.5546291",
"0.55305487",
"0.55091906",
"0.5489711",
"0.54192644",
"0.54172236",
"0.53858155",
"0.53763556",
"0.53559977",
"0.53334343",
"0.53119606",
"0.5288046",
"0.52613235",
"0.5238616",
"0.... | 0.8081001 | 1 |
Exports shipment status for shipments to magento, if they are shipped | def export_shipment_status_to_magento(self):
Shipment = Pool().get('stock.shipment.out')
Sale = Pool().get('sale.sale')
instance = self.instance
sale_domain = [
('magento_store_view', '=', self.id),
('shipment_state', '=', 'sent'),
('magento_id', '!=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_shipment_status(cls, store_views=None):\n if store_views is None:\n store_views = cls.search([])\n\n for store_view in store_views:\n # Set the instance in context\n with Transaction().set_context(\n magento_instance=store_view.instance.id\n ... | [
"0.72959864",
"0.65770334",
"0.61950433",
"0.61917406",
"0.5866233",
"0.5862453",
"0.5841632",
"0.57592666",
"0.5728388",
"0.5728388",
"0.5728388",
"0.5728388",
"0.5728388",
"0.5728388",
"0.5728388",
"0.5728388",
"0.5728388",
"0.5726259",
"0.5599219",
"0.5533492",
"0.5525183"... | 0.83704627 | 0 |
Helper method to get the current store view. | def get_current_store_view(cls):
return cls(Transaction().context.get('magento_store_view')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_view(self):\n return self.view",
"def view(self) -> str:\n return pulumi.get(self, \"view\")",
"def _get_store(self):\n return self._store",
"def GetView(self):\r\n return self.model.GetView()",
"def View(self):\n return self._view",
"def getCurrentView(self):\n... | [
"0.69337434",
"0.6776546",
"0.6570207",
"0.644002",
"0.636768",
"0.6339466",
"0.63136166",
"0.63065296",
"0.6254641",
"0.6231597",
"0.622977",
"0.6139501",
"0.60650826",
"0.5972074",
"0.59618914",
"0.59374434",
"0.5819738",
"0.57517654",
"0.5725532",
"0.5725355",
"0.56592387"... | 0.8440489 | 0 |
Import the websites, store and store views and show user a confirmation message | def default_start(self, data):
return {
'message': "This wizard has imported all the websites for this " +
"magento instance. It has also imported all the stores and " +
"store views related to the websites imported. If any of " +
"the records existed ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n rel_sup_csv_form = RelationSupportCSVDatasetForm()\n queries_csv_form = QueriesCSVDatasetForm()\n text_file_form = TextDatasetForm()\n article_url_form = NewsArticleURLForm()\n ind_sent_form = IndividualSentenceForm()\n html_files_form = HTMLFilesForm()\n data = []\n fo... | [
"0.5696574",
"0.55614066",
"0.55519164",
"0.5478478",
"0.54566526",
"0.5309509",
"0.52523816",
"0.5249747",
"0.5243258",
"0.5227952",
"0.5217405",
"0.521123",
"0.5184404",
"0.5179009",
"0.51621497",
"0.51396",
"0.51369673",
"0.51349753",
"0.5115782",
"0.51126957",
"0.5110532"... | 0.61303335 | 0 |
Import carriers and show the user appropriate message | def default_start(self, data):
return {
'message': "This wizard has imported all the carriers / " +
"shipping methods for this magento instance. You should now " +
"configure the imported carriers / shipping methods to " +
"match the shipment carriers ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_click(self):\n path = self.path.get()\n if not path:\n self.error_label.config(text='Alege baza de date.')\n return\n\n password = self.pass_entry.get()\n if not password:\n self.error_label.config(text='Introdu parola.')\n return\n\n try:\n sharing.import_databas... | [
"0.5680752",
"0.5669067",
"0.54800856",
"0.5428995",
"0.5351158",
"0.5288161",
"0.528",
"0.52469295",
"0.5222503",
"0.5153588",
"0.5078875",
"0.5049231",
"0.5039973",
"0.503053",
"0.5001831",
"0.49440625",
"0.49394995",
"0.4930786",
"0.49300444",
"0.49074003",
"0.48968795",
... | 0.57213557 | 0 |
Export price tiers and return count of products | def default_export_(self, fields):
Store = Pool().get('magento.website.store')
store = Store(Transaction().context.get('active_id'))
return {
'products_count': store.export_tier_prices_to_magento()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_tier_prices_to_magento(self):\n instance = self.website.instance\n\n for mag_product_template in self.website.magento_product_templates:\n product_template = mag_product_template.template\n product = product_template.products[0]\n\n # Get the price tiers fr... | [
"0.668143",
"0.5804564",
"0.5580061",
"0.5539434",
"0.5399712",
"0.5346444",
"0.53069025",
"0.52848166",
"0.52742374",
"0.5270996",
"0.5269696",
"0.5262819",
"0.52455866",
"0.5227559",
"0.51672083",
"0.5146561",
"0.5138672",
"0.5123716",
"0.5082605",
"0.5078199",
"0.50692075"... | 0.7045785 | 0 |
Type a PWIF amount then submit the form | def enter_pwif_amount(self, pwif_amount):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_pwif_amount(self, pwif_amount):\n raise NotImplementedError",
"def test_send_inaccurate_data(self):\n self.driver.get('http://psl-outbreak.herokuapp.com/report')\n self.driver.find_element_by_xpath(\"//select[@name='state_id']/option[text()='Casanare']\").click()\n self.dri... | [
"0.63574934",
"0.5679091",
"0.5629604",
"0.5536104",
"0.54938644",
"0.5485624",
"0.5392728",
"0.538577",
"0.5369903",
"0.53328675",
"0.52951163",
"0.52555466",
"0.52504057",
"0.5243308",
"0.5236295",
"0.52079064",
"0.5151744",
"0.51280564",
"0.50812286",
"0.50660056",
"0.5040... | 0.6748572 | 0 |
For every argument in kwargs sets a WITH_FOO if FOO=True or a WITHOUT_FOO if FOO=False | def set_with_options(self, **kwargs) -> None:
for k, v in kwargs.items():
assert not k.startswith("WITH_"), "Invalid WITH/WITHOUT options name " + k
assert not k.startswith("WITHOUT_"), "Invalid WITH/WITHOUT options name " + k
assert isinstance(v, bool)
self._with... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kwargs(kwargs):\n run_kwargs(kwargs)",
"def _UpdateWithKwargs(base, **kwargs):\n conflicts = set(kwargs.keys()) & set(base.keys())\n if conflicts:\n raise GanetiApiError(\"Required fields can not be specified as\"\n \" keywords: %s\" % \", \".join(conflicts))\n\n ba... | [
"0.64105",
"0.6144896",
"0.6131709",
"0.60270417",
"0.5965363",
"0.59641284",
"0.59275097",
"0.59046793",
"0.58989435",
"0.58380234",
"0.58345735",
"0.5807486",
"0.5805582",
"0.57605976",
"0.5753322",
"0.57189995",
"0.57189995",
"0.5716972",
"0.5685885",
"0.5642669",
"0.56208... | 0.7388897 | 0 |
Strip all ELF binaries to reduce the size of the benchmark directory | def strip_elf_files(self, benchmark_dir) -> None:
self.info("Stripping all ELF files in", benchmark_dir)
self.run_cmd("du", "-sh", benchmark_dir)
for root, dirnames, filenames in os.walk(str(benchmark_dir)):
for filename in filenames:
file = Path(root, filename)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_flatbuffer_binaries():\n for element in FLATBUFFERS_CONVERSION_DATA:\n for json in element.input_files:\n path = processed_json_path(json)\n if os.path.isfile(path):\n os.remove(path)",
"def clean():\n clean_flatbuffer_binaries()\n clean_webp_textures()",
"def scrub():\n\n\tloc... | [
"0.6843979",
"0.6425804",
"0.6238822",
"0.6171667",
"0.58739084",
"0.57915837",
"0.5787829",
"0.57830065",
"0.5750248",
"0.57371056",
"0.56529194",
"0.56070024",
"0.55917656",
"0.5587348",
"0.5559113",
"0.5551564",
"0.55382293",
"0.551886",
"0.5486453",
"0.54620624",
"0.54358... | 0.8146737 | 0 |
Fail immediately, with the given message. | def fail(self, msg=None):
raise Exception, msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fail(self, msg=None):\r\n raise self.failureException(msg)",
"def fail(self, message, *args, **kwargs):\n self.counters[\"failure\"] += 1\n self._write(message.format(*args, **kwargs), FAILURE)",
"def fail(self, message):\n logger.warning(message)\n g.failed = True",
"def tc_fa... | [
"0.8109415",
"0.761201",
"0.7590433",
"0.75791526",
"0.7566061",
"0.7528459",
"0.7067831",
"0.6895462",
"0.6790964",
"0.6782338",
"0.67756104",
"0.6773557",
"0.6760443",
"0.6701905",
"0.6625162",
"0.6528707",
"0.6483209",
"0.64499813",
"0.64096963",
"0.64075947",
"0.63567835"... | 0.7741948 | 1 |
Validate (previous) KMALLOC/KFREE calls of a set of tasks (pids) | def validate(self, tracked_pids, test_case=stubTestcase, debug=False):
out = os.popen('dmesg -c -s %d' % LOG_BUF_LEN)
dmesg_lines = out.readlines()
out.close()
allocations = []
memory_allocated = False
if debug:
f = open('mm_debug.tx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bad_cgroup_processes_check():\n return CGCheck([], bad_cgroup_processes)",
"def check_kpts(self):\n if 'fleurinp' in self.ctx.inputs:\n fleurinp = self.ctx.inputs.fleurinp\n else:\n fleurinp = get_fleurinp_from_remote_data(self.ctx.inputs.parent_folder)\n\n only_... | [
"0.5835271",
"0.54331756",
"0.54150486",
"0.5370245",
"0.53074366",
"0.52768683",
"0.52522767",
"0.5199778",
"0.51450527",
"0.5127863",
"0.5077406",
"0.5031161",
"0.5010177",
"0.5008991",
"0.49914876",
"0.49872923",
"0.49616095",
"0.49612164",
"0.4950241",
"0.49074998",
"0.48... | 0.65229285 | 0 |
Release for the other side of the fork that is syncing this side | def release(self):
if self._inchild:
os.write(self._pw_child, self.RELEASE_MSG)
else:
os.write(self._pw_parent, self.RELEASE_MSG) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _release(self):\n\n os.write(self.job_pipe[1], b'+')",
"async def release(self) -> None:\n ...",
"async def release(self) -> None:\n ...",
"async def release(self) -> None:\n ...",
"def release(self):",
"def release(self):\r\n pass",
"def release(self):\n s... | [
"0.703684",
"0.6900427",
"0.6900427",
"0.6900427",
"0.6875046",
"0.6745146",
"0.6730091",
"0.6527831",
"0.6527831",
"0.6390934",
"0.63661313",
"0.6281708",
"0.62689257",
"0.6262654",
"0.6258315",
"0.61609346",
"0.61515474",
"0.6143002",
"0.6137582",
"0.60939044",
"0.60918385"... | 0.6965916 | 1 |
Return the correct write side of the general pipe | def _wpipe(self):
if self._inchild:
return self._general_pw_child
else:
return self._general_pw_parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self, s):\n\t\tif self._input: raise PlumberExceptions.PipeTypeException(self)\n\t\treturn pservlet.pipe_write(self._pipe_desc, s)",
"def write():\n pass",
"def _handle_write(self):\n pass",
"def write(self, out):",
"def make_send_write(pipe_to_child, uid, params_and_values):\n d... | [
"0.6027396",
"0.5985349",
"0.58283186",
"0.57623416",
"0.5752828",
"0.56974834",
"0.5655385",
"0.5602302",
"0.5599069",
"0.55921566",
"0.5586974",
"0.55652577",
"0.555992",
"0.5538428",
"0.55314046",
"0.54355025",
"0.54124594",
"0.5402488",
"0.5365683",
"0.53546226",
"0.53379... | 0.60171205 | 1 |
Dump data through the pipe. The data is sent using pickle binary format. | def pickle_dump(self, data):
os.write(self.wpipe, pickle.dumps(data, bin=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def dump(self, data: dict, file: IO):",
"def pickle(self,data,filename):\n pickle.dump(data, open(filename, 'wb'))",
"def dump(filename, data):\n _savez(filename, [], data, True, allow_pickle=False)",
"def pickle_dump(data, file):\n with open(file, 'wb') as f:\n pickle.dump(data, f,... | [
"0.6462049",
"0.62800205",
"0.6105975",
"0.6078913",
"0.6073406",
"0.60545284",
"0.6024091",
"0.60216373",
"0.6004561",
"0.6004561",
"0.59766096",
"0.5972074",
"0.59595984",
"0.59463143",
"0.59452784",
"0.5923174",
"0.5905648",
"0.58634555",
"0.5854407",
"0.58264023",
"0.5821... | 0.8239927 | 0 |
Load data from the pipe. The data is sent using pickle binary format. | def pickle_load(self):
#
# I am wrapping the file descriptor because this way pickle
# returns on each data send separately (allowing for sending
# multiple data before reading).
# I close the file descriptor or else for some reason just
# closing the write side ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data():\n with open('data.pickle', 'rb') as f:\n data = pickle.load(f)\n return data",
"def pickle_dump(self, data):\n \n os.write(self.wpipe, pickle.dumps(data, bin=True))",
"def load_data(self, data):\n self._load_raw_data = data",
"def run(self, data: PipeLineDat... | [
"0.6285068",
"0.6276552",
"0.62092227",
"0.61791235",
"0.61763227",
"0.61763227",
"0.60887617",
"0.60785884",
"0.6005809",
"0.5972852",
"0.5966116",
"0.59555256",
"0.5851574",
"0.57980245",
"0.57809585",
"0.574515",
"0.5736422",
"0.5733839",
"0.5733341",
"0.5703455",
"0.56713... | 0.7654427 | 0 |
A function to force Tensorflow to use CPU even Nvidia GPU present | def cpu_fallback(flag=True):
gpu_phy_devices = tf.config.list_physical_devices("GPU")
cpu_phy_devices = tf.config.list_physical_devices("CPU")
general_warning_msg = (
f"Tensorflow has already been initialized, {inspect.currentframe().f_code.co_name}() needs "
f"to be called before any Tenso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_gpu_tf():\n\n try:\n # locate available devices & set required environment variables\n available_device_ids = GPUtil.getFirstAvailable(order='first', maxLoad=0.7, maxMemory=0.7, attempts=1, interval=10)\n available_device_id = available_device_ids[0]\n os.environ['CUDA_... | [
"0.7213077",
"0.7027226",
"0.6988259",
"0.6981788",
"0.6814441",
"0.6727671",
"0.67254525",
"0.6702479",
"0.6702479",
"0.66789967",
"0.6660818",
"0.66421443",
"0.65990984",
"0.65961355",
"0.65846235",
"0.6550118",
"0.6528544",
"0.6528544",
"0.6528544",
"0.65123516",
"0.651196... | 0.7158892 | 1 |
Return results from detector. This function prepares the environment loading the plugins, getting the response and passing it to the detector. In case of errors, it raises exceptions to be handled externally. | def get_detection_results(
url,
timeout,
metadata=False,
save_har=False,
splash_url="",
):
plugins = load_plugins()
if not plugins:
raise NoPluginsError("No plugins found")
logger.debug("[+] Starting detection with %(n)d plugins", {"n": len(plugins)})
response = get_respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_plugins(self):",
"def setup(self):\n rc = self.rc\n try:\n for plugin in self.plugins:\n plugin.setup(rc)\n except Exception as e:\n self.exit(e)",
"def load_results(self):\n\n scan_results = engine_pb2.EnrichedLaunchToolResponse()\n ... | [
"0.57042605",
"0.55662245",
"0.54125327",
"0.5357799",
"0.5216095",
"0.519449",
"0.5178228",
"0.5124306",
"0.5099311",
"0.5020611",
"0.5015244",
"0.4988996",
"0.49813417",
"0.49721754",
"0.49609536",
"0.49307635",
"0.49148032",
"0.49138626",
"0.48853156",
"0.48720548",
"0.486... | 0.58674943 | 0 |
Returns encoding of HTTP response. | def encoding(response: tornado.httpclient.HTTPResponse) -> str:
if 'Content-Encoding' in response.headers:
return response.headers['Content-Encoding'].decode()
elif 'Content-Type' in response.headers:
headers = email.message_from_string('Content-Type: ' +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_response_string(self):\n response = \"{} {}\\r\\n\".format(self.protocol, self.code)\n str_headers = \"\"\n if self.headers:\n for k, v in self.headers.items():\n str_headers += \"{}: {}\\r\\n\".format(k, v)\n\n encoded_response = \"{}{}\\r\\n\".form... | [
"0.71907353",
"0.706094",
"0.6990889",
"0.6629994",
"0.6604779",
"0.65353036",
"0.64132226",
"0.6401666",
"0.6394215",
"0.6381188",
"0.6364501",
"0.633328",
"0.6321899",
"0.62905544",
"0.62905544",
"0.62905544",
"0.62905544",
"0.6269559",
"0.6250087",
"0.6205546",
"0.618269",... | 0.7276046 | 0 |
Get HTTP response body as text. | def text_body(response: tornado.httpclient.HTTPResponse) -> str:
return response.body.decode(encoding(response)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_request_txt(self):\n #print (self.url)\n try:\n with closing(get(self.url, stream=True)) as resp: #returns b`txt`\n if self.is_txt(resp):\n return resp.content.decode(\"utf-8\")\n else:\n return None\n exce... | [
"0.72369504",
"0.71414113",
"0.7134768",
"0.70143604",
"0.68329924",
"0.67339194",
"0.6597049",
"0.6577305",
"0.6570372",
"0.64789695",
"0.64780384",
"0.6470492",
"0.64699656",
"0.6439313",
"0.6419446",
"0.64055383",
"0.63803506",
"0.6376543",
"0.63081264",
"0.62654847",
"0.6... | 0.8240622 | 0 |
Get HTTP response body as json | def json_body(response: tornado.httpclient.HTTPResponse):
return json.loads(text_body(response)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json(response):\n\tif requests.__version__ >= \"1.0.0\":\n\t\treturn response.json()\n\telif requests.__version__ == \"0.14.2\":\n\t\treturn response.json\n\telse:\n\t\treturn json.loads(response.content)",
"def generate_http_response(body):\n body = json.dumps(body, ensure_ascii=False).encode('utf8')... | [
"0.729981",
"0.7209948",
"0.7168147",
"0.706024",
"0.7018765",
"0.69994396",
"0.69508433",
"0.6911265",
"0.6746027",
"0.6719141",
"0.6719075",
"0.67182344",
"0.67025316",
"0.669225",
"0.66248244",
"0.6580149",
"0.65752757",
"0.6573697",
"0.65716434",
"0.6570659",
"0.65155184"... | 0.7616408 | 0 |
Create a default list of bounds for a given signal description | def _default_bounds(signal):
# there's just the name
if isinstance(signal, str):
return (signal, 0, 0, 0, 0)
else:
# there's just the name in a list
if len(signal) == 1:
return signal + [0, 0, 0, 0]
# there's the name and bounds
if len(signal) == 3:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounds():\n return [0.00], [1.00]",
"def bounds(self):\n return [(2, None)]",
"def bounds(self): # -> tuple[()]:\n ...",
"def bounds(self, pos):",
"def _init_optimizer_bounds(self):\n bounds = []\n for filt in self.filters:\n if filt.optimize_fc:\n... | [
"0.7021897",
"0.67702514",
"0.6683141",
"0.63438934",
"0.63145226",
"0.62476254",
"0.6207278",
"0.6207278",
"0.6207278",
"0.6207278",
"0.6207278",
"0.6207278",
"0.6207278",
"0.6207278",
"0.6167822",
"0.61064106",
"0.60504097",
"0.6016998",
"0.5977074",
"0.5952667",
"0.589701"... | 0.7777678 | 0 |
Parseinterfaces described in YAML files, bundled with the package | def parse_interface_definitions(dir_name=DIR):
try:
filenames = listdir(dir_name)
except OSError:
raise OSError(f"Directory '{dir_name}' "
"doesn't exist or cannot be listed")
defs = []
for filename in filenames:
with open(join(dir_name, filename)) as f:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(self, infile):\r\n raise NotImplementedError()",
"def _parse(self, infile):\n raise NotImplementedError()",
"def __parse(self, to_parse):\n path = Path(to_parse)\n if not path.exists():\n raise FileNotFoundError(f\"Configuration file {path.absolute()} not found.\")\... | [
"0.5856186",
"0.5764196",
"0.5734122",
"0.5686092",
"0.56764734",
"0.56446433",
"0.5535054",
"0.55263555",
"0.5507395",
"0.54634154",
"0.5458527",
"0.5440412",
"0.53991145",
"0.53776085",
"0.536266",
"0.53351825",
"0.5331788",
"0.53305066",
"0.532903",
"0.5318388",
"0.5302064... | 0.57860667 | 1 |
Given filenames of Verilog source and JSON target, use 'write_json' function of yosys | def verilog_to_json(verilog_filename, json_filename):
system(f'yosys -p "read_verilog {verilog_filename}" '
'-p "write_json {json_filename}"') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_write_source(self):\n req = Request()\n for name in sample_data.keys():\n orig_fn = self._filepath(name)\n temp_fn = self._filepath(name + '-write-source')\n\n # Read the message\n resp = req.get(fromfile=orig_fn)\n\n # Write to a tempor... | [
"0.654977",
"0.6347858",
"0.6209616",
"0.6194429",
"0.6187571",
"0.6149994",
"0.6075553",
"0.6070677",
"0.60704535",
"0.60384846",
"0.60266185",
"0.60266185",
"0.600497",
"0.5989924",
"0.59744734",
"0.59439313",
"0.59291714",
"0.5905016",
"0.5904322",
"0.58849543",
"0.5879473... | 0.69165206 | 0 |
get channel metadata from index | def get_ch_metadata(self, index):
tag = self.get_ch_tag(index)
return getattr(self, f"{tag.lower()}_metadata") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_meta(self, *, index=None):\n\n return self.metadata(index=index, exclude_applied=False)",
"def showmeta(self,\r\n index):\r\n\r\n return self.get_metadata_from_note(index)",
"def getMetadata(self):\n result = super().getMetadata()\n if len(self._frames) > 1:\... | [
"0.6677486",
"0.64471376",
"0.63067454",
"0.6167251",
"0.60129225",
"0.5979515",
"0.59767544",
"0.5872275",
"0.5782871",
"0.57287145",
"0.5725852",
"0.5725031",
"0.5657962",
"0.56345564",
"0.5610363",
"0.56080425",
"0.5587384",
"0.55509144",
"0.5509374",
"0.5505031",
"0.54950... | 0.749579 | 0 |
deletes and returns minimum value (in this case the root of the heap) | def delete_min(self):
self.switch(0, -1)
min = self.heap.pop(-1)
self.bubble_down(0)
return min | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_min(self):\n #The length is 1 because the heap list was initialized with 0\n if len(self.heap_list) == 1:\n return \"Empty heap.\"\n\n #Store the min value of the heap\n top = self.heap_list[1]\n\n #Move the last value of the heap to the top\n self.he... | [
"0.8399035",
"0.8222343",
"0.81165886",
"0.8064376",
"0.7997324",
"0.7903924",
"0.7903202",
"0.7774015",
"0.7720592",
"0.76391006",
"0.76284105",
"0.76253104",
"0.75730777",
"0.75428915",
"0.752482",
"0.7467781",
"0.7435114",
"0.7430907",
"0.739603",
"0.73590386",
"0.73556286... | 0.8246364 | 1 |
Inserts key into heap and heapifies the heap | def insert(self, key):
self.heap.append(key)
self.bubble_up(len(self.heap) - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, key, value):\n self.heap.append(None)\n hi = HeapItem(key,value)\n self.siftup(hi, len(self.heap)-1)\n return hi",
"def insert(self, k): \r\n self.heap_array.append(k)\r\n\r\n current_index = len(self.heap_array) - 1\r\n while (current_index > 0):\r\n ... | [
"0.7821339",
"0.7730161",
"0.7576347",
"0.7494207",
"0.7476214",
"0.74364775",
"0.7433599",
"0.730302",
"0.7184035",
"0.7181078",
"0.7181078",
"0.7160404",
"0.715419",
"0.7034118",
"0.7034118",
"0.69545007",
"0.6943963",
"0.6931309",
"0.692168",
"0.68648547",
"0.6861515",
"... | 0.796826 | 0 |
Returns parent of node at n; None if there isn't a parent | def parent(self, n):
return None if n == 0 else (n - 1) // 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parent(node):\n if node == _root():\n return _root()\n return (node + 1) // 2 - 1",
"def parent(self, n):\n return n._parent",
"def parent(self, node):\n self._validate_node(node)\n idx = node._index\n if idx == 0:\n return None #... | [
"0.7602089",
"0.7594332",
"0.7559299",
"0.7262482",
"0.72294337",
"0.71347463",
"0.70621294",
"0.7060756",
"0.70123017",
"0.6988264",
"0.6957921",
"0.69313556",
"0.68682724",
"0.68682724",
"0.68682724",
"0.6822674",
"0.6808915",
"0.6743967",
"0.672329",
"0.6721794",
"0.672035... | 0.7795919 | 0 |
Returns right child of node at n; None if there isn't a right_child | def right_child(self, n):
if 2 * n + 2 >= len(self.heap):
return None
else:
return 2 * n + 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node_right(self, n: MazeCell) -> MazeCell:\n if n.x == self._ncols - 1:\n return None\n else:\n return self.get_node(n.x + 1, n.y)",
"def right_child(self, position):\n child = 2 * position + 2\n if child > len(self.table) - 1:\n return None\n ... | [
"0.76178944",
"0.7611006",
"0.725117",
"0.71613806",
"0.71096224",
"0.7073449",
"0.69539064",
"0.6897677",
"0.6885739",
"0.6885739",
"0.68463993",
"0.68296987",
"0.6825695",
"0.67875445",
"0.6721572",
"0.67042595",
"0.6691901",
"0.6611986",
"0.65743893",
"0.6552465",
"0.64684... | 0.7729437 | 0 |
Test case for aws_service_api_availability_zones_get | def test_aws_service_api_availability_zones_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_regions_get(self):\n pass",
"def get_availability_zones(self, context, filters=None, fields=None,\n sorts=None, limit=None, marker=None,\n page_reverse=False):",
"def compute_zones(self):\n path = '/os-availabili... | [
"0.7338367",
"0.7293569",
"0.717585",
"0.7083272",
"0.68036807",
"0.68036807",
"0.68036807",
"0.68036807",
"0.68036807",
"0.68036807",
"0.6736183",
"0.67031825",
"0.66727173",
"0.66036886",
"0.65988815",
"0.6523843",
"0.6429594",
"0.6417555",
"0.63666177",
"0.6355343",
"0.629... | 0.95381105 | 0 |
Test case for aws_service_api_flavor_get | def test_aws_service_api_flavor_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_flavors_get(self):\n pass",
"def test_get_flavor(self):\n response = self.flavors_client.get_flavor_details(self.flavor_ref)\n flavor = response.entity\n self.assertEqual(self.flavor_ref, flavor.id)",
"def get_flavor(name):\r\n return nova.flavors.find(na... | [
"0.86479574",
"0.7678447",
"0.71027285",
"0.70904493",
"0.7076974",
"0.6954673",
"0.68324184",
"0.6791326",
"0.6621454",
"0.657417",
"0.65623415",
"0.65623415",
"0.6551517",
"0.652183",
"0.637626",
"0.63374686",
"0.63270867",
"0.6284752",
"0.62383753",
"0.62356555",
"0.622235... | 0.9599665 | 0 |
Test case for aws_service_api_flavors_get | def test_aws_service_api_flavors_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_flavor_get(self):\n pass",
"def get_flavors(self):\n url = '%s/flavors/detail' % self.catalog['compute']\n res = self.get(url)\n if res['status'] == 200:\n return json.loads(res['body'])['flavors']\n else:\n LOG.error('Get flavors ... | [
"0.8574573",
"0.7565045",
"0.714905",
"0.71012104",
"0.70156753",
"0.7013291",
"0.68955284",
"0.6883247",
"0.6825781",
"0.6584661",
"0.65827054",
"0.6564486",
"0.64388686",
"0.64029205",
"0.6390174",
"0.6388977",
"0.63272315",
"0.6317298",
"0.6264503",
"0.62626445",
"0.620792... | 0.95660037 | 0 |
Test case for aws_service_api_image_get | def test_aws_service_api_image_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_public_image_get(self):\n pass",
"def test_aws_service_api_private_image_get(self):\n pass",
"def test_aws_service_api_public_images_get(self):\n pass",
"def test_aws_service_api_private_images_get(self):\n pass",
"def test_get_ao_image(self):\n r... | [
"0.8832171",
"0.8454593",
"0.84126693",
"0.80433905",
"0.7256785",
"0.7198876",
"0.7104483",
"0.71016484",
"0.69397616",
"0.6722128",
"0.66869414",
"0.66866714",
"0.6682441",
"0.665069",
"0.6630389",
"0.6626029",
"0.6619967",
"0.6611323",
"0.66050965",
"0.6582941",
"0.6579301... | 0.94997585 | 0 |
Test case for aws_service_api_interfaces_get | def test_aws_service_api_interfaces_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInterface(self):\n\t\tquery = ''\n\t\tconn = self.get_connection()\n\t\theaders = { 'Content-type' : 'application/json', 'Authorization' : 'A10 %s' %self.sessionid}\n\t\tconn.request('GET', self.get_path() + '/' + query, headers=headers)\n\t\tresponse = conn.getresponse()\n\t\texpected_status = 200\n\t\terr... | [
"0.6886365",
"0.68692887",
"0.68692887",
"0.68692887",
"0.6744842",
"0.64471203",
"0.6425522",
"0.64148664",
"0.63893855",
"0.63771516",
"0.6328008",
"0.6327504",
"0.6318172",
"0.61683834",
"0.6158",
"0.6158",
"0.6126433",
"0.61211205",
"0.61211205",
"0.61211205",
"0.61211205... | 0.9369289 | 0 |
Test case for aws_service_api_keypair_delete | def test_aws_service_api_keypair_delete(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_api_key(self):\n pass",
"def test_aws_service_api_keypair_get(self):\n pass",
"def test_delete_api_key_from_org(self):\n pass",
"def test_delete():\n test_key = 'qmk_compiler_test_unique_key_name'\n\n # Make sure our test key doesn't exist\n try:\n qmk_sto... | [
"0.79903865",
"0.76005006",
"0.74329925",
"0.73833454",
"0.7266609",
"0.72653955",
"0.7207944",
"0.71949244",
"0.7136774",
"0.7025226",
"0.7004992",
"0.69196093",
"0.67822355",
"0.67449534",
"0.66366833",
"0.6636205",
"0.6635616",
"0.6596003",
"0.65895045",
"0.6583519",
"0.65... | 0.9563869 | 0 |
Test case for aws_service_api_keypair_generate_post | def test_aws_service_api_keypair_generate_post(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_keypair_import_post(self):\n pass",
"def test_aws_service_api_keypair_get(self):\n pass",
"def test_create_api_key(self):\n pass",
"def test_aws_service_api_keypair_delete(self):\n pass",
"def create_key ():",
"def test_aws_service_api_keypairs_get(sel... | [
"0.7824777",
"0.7448113",
"0.73979497",
"0.7172839",
"0.71695393",
"0.70038456",
"0.6849004",
"0.6799752",
"0.67478347",
"0.6668105",
"0.66087174",
"0.65747166",
"0.6556049",
"0.6553861",
"0.64367193",
"0.6361898",
"0.6323369",
"0.63042235",
"0.626602",
"0.6251426",
"0.623475... | 0.9603776 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.