query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Initialize model, may change across different model. | def initialize_model(self):
args = self.args
if self.args.search_space == 'nasbench':
self.model_fn = NasBenchNetSearchDarts
self.fixmodel_fn = NasBenchNet
model = self.model_fn(args)
utils = darts_nasbench_utils
else:
raise NotImpleme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_model(self):\n pass",
"def initialize_model(self):\n pass",
"def initialize(self, model):\n pass",
"def initialize(self) -> None:\n self.model = load(self.path)",
"def initialize_model(self):\n model = self.model_class()\n return model",
"def __init__(se... | [
"0.9013694",
"0.90095675",
"0.8680508",
"0.8040401",
"0.7989343",
"0.7935286",
"0.7855477",
"0.7855477",
"0.771845",
"0.7684088",
"0.76819354",
"0.76546717",
"0.76546717",
"0.76546717",
"0.76546717",
"0.76107174",
"0.7604882",
"0.7563662",
"0.75348",
"0.75108904",
"0.7507977"... | 0.0 | -1 |
Own __eq__ requires own __ne__. | def __ne__(self, other):
return not self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return not (self == other) # opposite of __eq__",
"def __ne__(self, other):\n return not self.__eq__(other)",
"def __ne__(self, other):\n return super().__eq__(other)",
"def __ne__(self, other):\n return not (self == other) # opposite of __... | [
"0.86288303",
"0.86276627",
"0.86085516",
"0.8579525",
"0.8511896",
"0.8462306",
"0.84605736",
"0.84605736",
"0.84605736",
"0.84605736",
"0.8454578",
"0.8453062",
"0.84346145",
"0.84346145",
"0.84346145",
"0.8418491",
"0.8405421",
"0.840443",
"0.83997667",
"0.8397722",
"0.838... | 0.834498 | 33 |
Tests whether ``put_owner_into`` works as intended. | def test__put_owner_into():
user = User.precreate(202211270016)
team = Team.precreate(202211270017)
for input_value, defaults, expected_output in (
(ZEROUSER, False, {}),
(ZEROUSER, True, {'owner': None, 'team': None}),
(user, True, {'owner': user.to_data(defaults = True, includ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_owner(self):\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleassignment': self.update_as.sodar_uuid},\n )\n put_data = {\n 'role': PROJECT_ROLE_OWNER,\n 'user': str(self.assign_user.sodar_uuid),\n }\n resp... | [
"0.7015747",
"0.67555565",
"0.6667466",
"0.6616372",
"0.65783966",
"0.65397656",
"0.65006393",
"0.6470328",
"0.6419893",
"0.637908",
"0.63669556",
"0.6355491",
"0.6351782",
"0.63150245",
"0.6306408",
"0.6277358",
"0.62523",
"0.62053484",
"0.62022126",
"0.6143638",
"0.6126519"... | 0.7894568 | 0 |
Return the number of data points in the dataset. | def __len__(self) -> int:
return len(self.files) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_data(self):\n try:\n ndata = len(self.x)\n logger.info(\"Number of data points: {0}\".format(ndata))\n except AttributeError:\n logger.error(\"Data object has not been defined\")\n ndata = 0\n return ndata",
"def n_points(self):\n\n ... | [
"0.88020605",
"0.8231678",
"0.8149338",
"0.7946245",
"0.7914645",
"0.79072833",
"0.77896583",
"0.7780136",
"0.7764983",
"0.77046496",
"0.76889753",
"0.76854926",
"0.7678325",
"0.76518047",
"0.7537674",
"0.75103235",
"0.7477096",
"0.73541653",
"0.7346834",
"0.73309904",
"0.725... | 0.0 | -1 |
Returns the path to the backup. | def _get_backup(cls, backup_dir, idx, orig_path):
return os.path.join(
backup_dir, "{name}_{idx}".format(
name=os.path.basename(orig_path), idx=str(idx))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_backup_path(cls):\n # TODO: Make backup path configurable on server settings.\n return os.path.join(\n cls.get_installation_path(), 'html', 'backups'\n )",
"def path_backup(self) -> Path:\n return self.path_supervisor / BACKUP_DATA",
"def local_backup_path(cls):\n... | [
"0.8323794",
"0.8170831",
"0.7912387",
"0.7624974",
"0.7356165",
"0.72270954",
"0.7051839",
"0.69544053",
"0.69060457",
"0.69049317",
"0.68436694",
"0.6826672",
"0.68097526",
"0.6782912",
"0.67536366",
"0.6696023",
"0.66650534",
"0.66479254",
"0.6618547",
"0.6618547",
"0.6617... | 0.68367016 | 11 |
Return true if light is on. | def is_on(self):
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def light_is_on(self):\r\n return self._light == \"ON\"",
"def light_is_on(self):\n return self._light == \"ON\"",
"def is_on(self):\n return self._light_on",
"def is_light(self) -> bool:\n return ATTRIBUTE.Light.value in self.type_data.attributes",
"def is_light(self) -> bool:\... | [
"0.9035416",
"0.89275813",
"0.86664206",
"0.8008696",
"0.8008696",
"0.78880787",
"0.7866302",
"0.7610281",
"0.7565963",
"0.7415077",
"0.7345493",
"0.7335999",
"0.73116577",
"0.7303292",
"0.72991306",
"0.7243393",
"0.71792775",
"0.71722543",
"0.7157757",
"0.7157757",
"0.715775... | 0.6595362 | 95 |
Return (X)HTML markup for the imagetag given by match. | def _get_image_tag(self, match, path = None, format = "png"):
if format in ("png","jpg"):
try:
image = self._get_image(match.group("name"))
except KeyError:
return "<b>Couldn't find image %s</b>" % match.group("name")
if path is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _output_match(match, namespaces):\n out = \"?\"\n\n if isinstance(match, etree._Element):\n prefixed_name = _prefixed_name_from_absolute_name(match.tag, namespaces)\n out = \"<{0}>\".format(prefixed_name)\n\n elif isinstance(match, etree._ElementStringResult):\n if match.is_attrib... | [
"0.6320475",
"0.60904175",
"0.5747785",
"0.568787",
"0.56444347",
"0.5557239",
"0.53689045",
"0.53578633",
"0.530159",
"0.524473",
"0.5165377",
"0.5152818",
"0.5083324",
"0.50582284",
"0.5045566",
"0.5031419",
"0.50210065",
"0.50187933",
"0.5015817",
"0.5005287",
"0.4971653",... | 0.5350524 | 8 |
Implements Python iterator interface. This should return an object implementing a `next` method which steps through a sequence returning one element at a time and raising `StopIteration` when at the end of the sequence. Here the object returned is the DataProvider itself. | def __iter__(self):
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __next__(self):\n \n if self.i == len(self.data):\n raise StopIteration\n item = self.data[self.i]\n self.i += 1\n return item",
"def get_next(self):\n raise NotImplementedError(\"Iterator.get_next()\")",
"def __next__(self):\n return next(self.iterat... | [
"0.7132545",
"0.7053564",
"0.6803101",
"0.67858696",
"0.6764412",
"0.67258686",
"0.6725716",
"0.6725716",
"0.6725716",
"0.67128575",
"0.67095685",
"0.6648909",
"0.66359633",
"0.66359633",
"0.66359633",
"0.66107273",
"0.65991926",
"0.65864027",
"0.65708137",
"0.6569066",
"0.65... | 0.0 | -1 |
Returns next data batch or raises `StopIteration` if at end. | def next(self):
if self._curr_batch + 1 > self.num_batches:
# no more batches in current iteration through data set so start
# new epoch ready for another pass and indicate iteration is at end
self.new_epoch()
raise StopIteration()
# create an index slice ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next(self):\n if self._curr_batch + 1 > self.num_batches:\n # no more batches in current iteration through data set so start\n # new epoch ready for another pass and indicate iteration is at end\n self.new_epoch()\n raise StopIteration()\n # create an i... | [
"0.7395533",
"0.72430134",
"0.7239633",
"0.7212875",
"0.71963906",
"0.7170904",
"0.712133",
"0.7104597",
"0.71011645",
"0.7074199",
"0.7003332",
"0.69802934",
"0.69343054",
"0.683055",
"0.6819868",
"0.68186015",
"0.68100536",
"0.6798144",
"0.67755616",
"0.67679155",
"0.676644... | 0.7411901 | 0 |
Returns next data batch or raises `StopIteration` if at end. | def next(self):
if self._curr_batch + 1 > self.num_batches:
# no more batches in current iteration through data set so start
# new epoch ready for another pass and indicate iteration is at end
self.new_epoch()
raise StopIteration()
# create an index slice ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next(self):\n if self._curr_batch + 1 > self.num_batches:\n # no more batches in current iteration through data set so start\n # new epoch ready for another pass and indicate iteration is at end\n self.new_epoch()\n raise StopIteration()\n # create an i... | [
"0.74118793",
"0.72431976",
"0.72397304",
"0.72129864",
"0.7196367",
"0.7170841",
"0.7121175",
"0.7104599",
"0.7101137",
"0.70742357",
"0.70034283",
"0.69804597",
"0.6934089",
"0.68303955",
"0.6819602",
"0.6818725",
"0.681016",
"0.67983687",
"0.6775468",
"0.6767731",
"0.67664... | 0.7395501 | 1 |
Set up the main window | def finish_initializing(self, builder): # pylint: disable=E1002
super(OricusWindow, self).finish_initializing(builder)
self.AboutDialog = AboutOricusDialog
self.PreferencesDialog = PreferencesOricusDialog
# Code for other initialization actions should be added here.
if not Apac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()",
"def main... | [
"0.80549276",
"0.77803993",
"0.76101744",
"0.76079625",
"0.76058704",
"0.75583404",
"0.75058156",
"0.7500768",
"0.7449036",
"0.74340516",
"0.7430231",
"0.73911846",
"0.73764753",
"0.730698",
"0.7291845",
"0.7287895",
"0.72417337",
"0.72298133",
"0.72146386",
"0.7190348",
"0.7... | 0.0 | -1 |
Return fixed holidays, with shifts computed accordingly. | def get_fixed_holidays(self, year):
# 2021 exception.
# Because May 1st is both International Workers' day and Easter
self.include_labour_day = (year != 2021)
# Unshifted days are here:
days = super().get_fixed_holidays(year)
days_to_inspect = copy(days)
for day_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_holidays(self, year=datetime.date.today().year):\n # create a hard copy\n holidays = {}\n for month in HOLIDAYS:\n holidays[month] = []\n for day in HOLIDAYS[month]:\n holidays[month].append(day)\n \n easter = dateutil.easter.easter(year)\n easter_monday = easter + date... | [
"0.66712224",
"0.6555246",
"0.6547656",
"0.649039",
"0.6489504",
"0.6441064",
"0.62953806",
"0.62830114",
"0.6239503",
"0.6208563",
"0.60857934",
"0.60381454",
"0.5997668",
"0.59124047",
"0.5813453",
"0.5758434",
"0.57323134",
"0.56965095",
"0.5694016",
"0.56899965",
"0.56866... | 0.74456817 | 0 |
Iterator that returns the next window of data. Also removes the nolonger needed data from the internal cache. | def next_window(self) -> Iterator[Tuple[Optional[np.ndarray],
Optional[np.ndarray]]]:
for p1 in self._store1.next_window():
for p2 in self._store2.next_window():
yield p1, p2
break # Break this loop because we only want one p2 per p1. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_window(self) -> Iterator[Optional[np.ndarray]]:\n while self._count >= self._window_width:\n # Preserve what we want to return by copying it.\n p1 = np.copy(self._data_store[:self._window_width, :])\n\n # Remove the data we don't need any more from the front of the buffer.\n frames_... | [
"0.8012808",
"0.7348244",
"0.6294713",
"0.6258318",
"0.6238498",
"0.61293656",
"0.60626787",
"0.60397756",
"0.60268736",
"0.5932135",
"0.5919249",
"0.5841624",
"0.5826884",
"0.5682092",
"0.5641318",
"0.5635062",
"0.56323785",
"0.55743253",
"0.5560982",
"0.55523515",
"0.554498... | 0.6317423 | 2 |
Timestamp in seconds since the epoch of the last run of the pipeline. | def last_run(self):
return self._last_run | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_timestamp(self):\n return self._last_timestamp",
"def get_last_timestamp(self):\n return self._frame_timestamp",
"def timestamp(self) -> int:\r\n\r\n return self.__timestamp",
"def timestamp(self) -> int:\n return self.__timestamp",
"def timestamp(self):\n return... | [
"0.7219293",
"0.71905893",
"0.71662736",
"0.71595365",
"0.70753556",
"0.69971186",
"0.698459",
"0.69735855",
"0.69735855",
"0.69735855",
"0.69735855",
"0.69735855",
"0.69735855",
"0.69735855",
"0.6930524",
"0.686738",
"0.68522894",
"0.68475634",
"0.68263316",
"0.6812176",
"0.... | 0.6765974 | 23 |
Creates an asteroid with a random radius, position, and velocity. | def rand_asteroid(cls, max_velocity, max_position, max_radius):
rand_vx = randint(-max_velocity, max_velocity)
rand_vy = randint(-max_velocity, max_velocity)
rand_vz = randint(-max_velocity, max_velocity)
velocity = [rand_vx, rand_vy, rand_vz]
random_position = [randrange(max_pos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genAsteroid(cls, surface):\n side = random.randrange(4) # Choose what side to start on\n x = random.randrange(SCREEN_WIDTH) # Choose random position on screen\n y = random.randrange(SCREEN_HEIGHT)\n level = random.randrange(len(cls.radii)) # Choose radius level\n div_by = ... | [
"0.7567088",
"0.6677098",
"0.656522",
"0.63364977",
"0.6307867",
"0.62894195",
"0.616959",
"0.61415565",
"0.61392725",
"0.5995055",
"0.5963358",
"0.5959095",
"0.59305507",
"0.58840966",
"0.5854741",
"0.5813214",
"0.57930076",
"0.577064",
"0.5728965",
"0.57171726",
"0.5690869"... | 0.7424214 | 1 |
Get a vector of kf in km/s units for all redshifts. | def get_kf_kms(self):
kfkms = np.array([ self.kf / (ss.velfac * 3.085678e24/ss.units.UnitLength_in_cm) for ss in self.spectrae])
return kfkms | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_RM_K(vsini_kms, rp_Rearth, Rs_Rsun):\n D = (rp_Rearth * u.Rearth.to(u.m) / Rs_Rsun * u.Rsun.to(u.m)) ** 2\n return (vsini_kms * D / (1 - D)) * 1e3",
"def full_K(self):\n\n return kron_list(self.Ks)",
"def kubelkaMunkKSToReflectance(ksList):\n return [ks+1.0-math.sqrt(ks*(ks+2.0)) for ks i... | [
"0.5997149",
"0.5886519",
"0.5857966",
"0.5740794",
"0.5686465",
"0.56798077",
"0.5646199",
"0.56110823",
"0.55944633",
"0.55420566",
"0.55069184",
"0.54988927",
"0.5491138",
"0.5480518",
"0.54709095",
"0.5463108",
"0.5435004",
"0.5402584",
"0.5372428",
"0.5358521",
"0.535324... | 0.72832125 | 0 |
Get an array of sightlines. | def _get_cofm(self, num, base):
try:
#Use saved sightlines if we have them.
return (self.cofm, self.axis)
except AttributeError:
#Otherwise get sightlines at random positions
#Re-seed for repeatability
np.random.seed(23)
box = _get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_lines(self):\n station_lines = []\n for wrapper in self.soup.find_all(\"div\", {\"class\": \"stop-wrapper\"}):\n lines = wrapper.find(\"h3\").text.split(' ')[-1][1:-1]\n station_lines.append(lines)\n return np.array(station_lines).T",
"def lines(self):\n... | [
"0.65994215",
"0.65204436",
"0.64046556",
"0.6376938",
"0.6366432",
"0.6356004",
"0.6346919",
"0.6268131",
"0.6220958",
"0.6220907",
"0.61762553",
"0.61762553",
"0.609046",
"0.59671235",
"0.5913506",
"0.59126663",
"0.58888036",
"0.5887524",
"0.58666766",
"0.58534193",
"0.5842... | 0.0 | -1 |
Get the flux power spectrum in the format used by McDonald 2004 for a snapshot set. | def get_snapshot_list(self, base, snappref="SPECTRA_"):
#print('Looking for spectra in', base)
powerspectra = FluxPower(maxk=self.max_k)
for snap in range(30):
snapdir = os.path.join(base,snappref+str(snap).rjust(3,'0'))
#We ran out of snapshots
if not os.path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flux_hack(self):\r\n return self.planes[1].galaxies[0].light_profiles[0].flux",
"def flux(self, x):\n return self.cal_spec.get_flux(self(x))",
"def spectrum(self):\r\n f, spectrum = tsa.get_spectra(self.input.data, method=self.method)\r\n return spectrum",
"def get_spectrum(se... | [
"0.65914774",
"0.642116",
"0.6351829",
"0.6284494",
"0.626147",
"0.62209404",
"0.62105525",
"0.6196011",
"0.60755587",
"0.60729206",
"0.5937508",
"0.5933942",
"0.59233",
"0.5856566",
"0.585219",
"0.58451635",
"0.5794136",
"0.5780915",
"0.5740697",
"0.57153213",
"0.5679395",
... | 0.5898006 | 13 |
Round to 2 digits. Returns int if rounded float has only zeroes after the decimal point. | def rint(flt: float) -> int | float:
return int(rounded) if (rounded := round(flt, 2)).is_integer() else rounded | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round2(number, ndigits=None):\n if ndigits is None:\n ndigits = 0\n\n if ndigits < 0:\n exponent = 10 ** (-ndigits)\n quotient, remainder = divmod(number, exponent)\n if remainder >= exponent // 2 and number >= 0:\n quotient += 1\n return float(quotient * exp... | [
"0.71725374",
"0.64145637",
"0.6354658",
"0.63393843",
"0.6240673",
"0.6230472",
"0.6180421",
"0.6174376",
"0.61585605",
"0.608994",
"0.6085626",
"0.6062086",
"0.59914666",
"0.5951364",
"0.5951213",
"0.59042144",
"0.5836651",
"0.5740007",
"0.57363087",
"0.5706288",
"0.5686878... | 0.6910798 | 1 |
Add a horizontal line to the tab with a label and series of widgets If label is empty, first widget is used instead (usually to provide a checkbox) | def pack(self, label, *widgets, **kwargs):
col = 0
border = kwargs.get("border", 10)
font = self.GetFont()
if "size" in kwargs:
font.SetPointSize(kwargs["size"])
if kwargs.get("bold", False):
font.SetWeight(wx.BOLD)
if label != "":
tex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _labelled_lineedit(self, label):\n layout = QtWidgets.QHBoxLayout()\n layout.addWidget(QtWidgets.QLabel(label))\n lineedit = QtWidgets.QLineEdit()\n layout.addWidget(lineedit)\n\n return layout, lineedit",
"def add_line(self, text: str):\r\n\r\n # create a new label\... | [
"0.6760611",
"0.6374605",
"0.6208484",
"0.61337084",
"0.6061024",
"0.5784635",
"0.57740504",
"0.572123",
"0.55785775",
"0.5568264",
"0.5564599",
"0.5514844",
"0.54786223",
"0.544604",
"0.54340774",
"0.54114145",
"0.5410453",
"0.53978354",
"0.53768694",
"0.5362168",
"0.5349761... | 0.5246876 | 31 |
Add a file picker to the tab | def file_picker(self, label, pick_dir=False, handler=None, optional=False, initial_on=False, pack=True, **kwargs):
handler = self._changed_handler(handler)
if pick_dir:
picker = wx.DirPickerCtrl(self, style=wx.DIRP_USE_TEXTCTRL)
picker.Bind(wx.EVT_DIRPICKER_CHANGED, handler)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _open_file(self):\n file = QFileDialog.getOpenFileName(self, \"Open file\", \".\")[0]\n if file:\n self.try_add_tab(file)",
"def add_file_input(\n self,\n name: str,\n label: Optional[str] = None,\n source: Optional[str] = None,\n file_type: Optiona... | [
"0.64010465",
"0.6389445",
"0.6380142",
"0.6139424",
"0.6100877",
"0.6076915",
"0.59057724",
"0.58953226",
"0.58814114",
"0.58653426",
"0.58635044",
"0.583157",
"0.5822047",
"0.58170503",
"0.58102536",
"0.5803157",
"0.5796955",
"0.5784483",
"0.57772976",
"0.57623774",
"0.5735... | 0.63142776 | 3 |
Check if a specified filename is a valid Nifti image | def image(self, label, fname):
if not os.path.exists(fname):
raise OptionError("%s - no such file or directory" % label)
try:
return Image(fname)
except:
raise OptionError("%s - invalid image file" % label) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_type(filename):\n try:\n im = Image.read(filename)\n except SanperaError:\n return False\n else:\n return im.original_format in [b'JPEG', b'PNG', b'GIF']",
"def is_image_file(filename):\n return has_file_allowed_extension(filename, IMG_EXTENSIONS)",
"def is_valid_imag... | [
"0.7906343",
"0.76791036",
"0.75889206",
"0.7518137",
"0.74212295",
"0.73689944",
"0.73125374",
"0.727867",
"0.7240837",
"0.7232786",
"0.72063655",
"0.71474653",
"0.71460426",
"0.7103877",
"0.70926553",
"0.7050767",
"0.7049494",
"0.6973069",
"0.69444954",
"0.6931658",
"0.6926... | 0.0 | -1 |
return the simulation parameters in a dictionary | def load_params(self):
return self.params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parameters(self):\n d = Algorithm.get_parameters(self)\n d.update({\n 'M': d.pop('population_size', self.population_size),\n 'num_tests': self.num_tests,\n 'num_searches': self.num_searches,\n 'num_searches_best': self.num_searches_best,\n ... | [
"0.74853766",
"0.7437803",
"0.7363147",
"0.72639436",
"0.72505933",
"0.722475",
"0.72061324",
"0.716569",
"0.70830923",
"0.7067498",
"0.7021718",
"0.6947638",
"0.6912448",
"0.68844485",
"0.68350184",
"0.6819019",
"0.68120414",
"0.68061066",
"0.6804212",
"0.6787422",
"0.677873... | 0.0 | -1 |
This function returns a float for the string parameter s, or None in the case of a ValueError exception | def _string_to_float(s):
try:
f = float(s)
return f
except ValueError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_float(s):\n try:\n return float(s)\n except TypeError:\n return None",
"def extract_float(self, s: str) -> float:\n f = re.findall(r'([0-9]*[.]*[0-9]+)', s)\n return float(f[0]) if len(f) > 0 else None",
"def float_or_none(s):\n if s:\n return float(s)... | [
"0.7869634",
"0.7808177",
"0.7780001",
"0.774483",
"0.76589155",
"0.75912815",
"0.7560353",
"0.75414765",
"0.7493897",
"0.73984724",
"0.73561317",
"0.7244844",
"0.72319794",
"0.71240634",
"0.6994767",
"0.68834776",
"0.6807133",
"0.6805565",
"0.6793247",
"0.6771853",
"0.673172... | 0.8062841 | 0 |
Returns whether there are any sparse features in the specified schema. | def _schema_has_sparse_features(schema: schema_pb2.Schema) -> bool:
def _has_sparse_features(
feature_container: Iterable[schema_pb2.Feature]
) -> bool:
"""Helper function used to determine whether there are sparse features."""
for f in feature_container:
if isinstance(f, schema_pb2.SparseFeatu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _has_sparse_features(\n feature_container: Iterable[schema_pb2.Feature]\n ) -> bool:\n for f in feature_container:\n if isinstance(f, schema_pb2.SparseFeature):\n return True\n if f.type == schema_pb2.STRUCT:\n if f.struct_domain.sparse_feature:\n return True\n ... | [
"0.8167406",
"0.6687918",
"0.6615748",
"0.65247315",
"0.61439705",
"0.60011166",
"0.59739363",
"0.59285593",
"0.5885367",
"0.58793426",
"0.5878254",
"0.58752435",
"0.5870335",
"0.5842498",
"0.5840079",
"0.57284534",
"0.5714392",
"0.5665981",
"0.560187",
"0.5598725",
"0.552157... | 0.8772262 | 0 |
Returns whether there are features in the schema with a nl domain. | def _schema_has_natural_language_domains(schema: schema_pb2.Schema) -> bool:
for f in schema.feature:
if f.WhichOneof('domain_info') == 'natural_language_domain':
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_nlu(self):\n return self.metadata.has_been_coded_for(\"nlu\")",
"def is_dnf(self):\n return self.is_nf()",
"def _schema_has_sparse_features(schema: schema_pb2.Schema) -> bool:\n\n def _has_sparse_features(\n feature_container: Iterable[schema_pb2.Feature]\n ) -> bool:\n \"\"\"He... | [
"0.6092552",
"0.58941525",
"0.5754943",
"0.5434332",
"0.542865",
"0.5376826",
"0.5374864",
"0.5349493",
"0.5320733",
"0.53156215",
"0.5313372",
"0.5281456",
"0.5280938",
"0.527483",
"0.52382743",
"0.52308923",
"0.5227631",
"0.5195192",
"0.5167995",
"0.5164774",
"0.5142251",
... | 0.72662663 | 0 |
Apply `func` for each wrapped generators. | def _for_each_generator(self,
func: Callable[..., Any],
*args: Iterable[Any]) -> List[Any]:
return [func(gen, *args_for_func) for gen, args_for_func in zip(
self._generators, zip(*args))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_generator(generator, wrapper_function):\n for item in generator:\n yield wrapper_function(item)",
"def chained(func):\n def wrapper(*args, **kwargs):\n for xs in func(*args, **kwargs):\n for x in xs:\n yield x\n return wrapper",
"def generator(func):\n\... | [
"0.7337697",
"0.6966323",
"0.66758573",
"0.6629157",
"0.65672994",
"0.65329534",
"0.65181786",
"0.6487615",
"0.64448315",
"0.63103455",
"0.6306644",
"0.62926126",
"0.6193983",
"0.61663854",
"0.6112116",
"0.6100089",
"0.60782117",
"0.6072425",
"0.60633814",
"0.60017735",
"0.59... | 0.7277824 | 1 |
Initializes the feature_path key if it does not exist. | def _get_wrapped_accumulators(self, wrapper_accumulator: WrapperAccumulator,
feature_path: types.FeaturePath) -> List[Any]:
result = wrapper_accumulator.get(feature_path, None)
if result is not None:
return result
# Note: This manual initialization could have been avoid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n path: types.FeaturePath,\n required_paths: Optional[Iterable[types.FeaturePath]] = None):\n self._path = path\n if required_paths:\n self._required_paths = tuple(sorted(required_paths))\n else:\n self._required_paths = None",
"def initialize_fro... | [
"0.591742",
"0.58122873",
"0.578069",
"0.5610609",
"0.56088996",
"0.55268604",
"0.5474825",
"0.5474358",
"0.5430364",
"0.5399856",
"0.53551984",
"0.5325193",
"0.53067106",
"0.5301313",
"0.5287206",
"0.52853495",
"0.5255026",
"0.52462995",
"0.52162665",
"0.521456",
"0.5202886"... | 0.0 | -1 |
Parse environment variables for the DictOption. All of theses tests should result in None being returned because no environment variables are actually set. | def test_parse_env_none(self, option, prefix, auto_env):
actual = option.parse_env(prefix=prefix, auto_env=auto_env)
assert actual is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parse_env_ok(self, option, key, prefix, auto_env, expected, with_env):\n actual = option.parse_env(key=key, prefix=prefix, auto_env=auto_env)\n assert actual == expected",
"def test_parse_env_ok(self, option, key, prefix, auto_env, expected, with_env):\n actual = option.parse_env(ke... | [
"0.6832251",
"0.6832251",
"0.6832251",
"0.6679808",
"0.65364826",
"0.6528056",
"0.6486712",
"0.6396252",
"0.6384286",
"0.62930596",
"0.6196649",
"0.6192231",
"0.61634296",
"0.61333597",
"0.61333597",
"0.61333597",
"0.61333597",
"0.6116738",
"0.6083039",
"0.6042883",
"0.602794... | 0.6455472 | 7 |
Build a defaults dict from a Scheme. | def test_build_defaults(self, args, expected):
sch = scheme.Scheme(*args)
defaults = sch.build_defaults()
assert defaults == expected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defaults() -> dict:\n pass",
"def defaults():\n return {}",
"def init_dict_isdcf(rules):\n res = {}\n\n for (name, regex) in six.iteritems(rules):\n pattern = re.compile(regex)\n\n res[name] = {}\n res[name]['Value'] = ''\n res[name].update({k: DEFAULT for k ... | [
"0.5995173",
"0.5777103",
"0.56505984",
"0.5641018",
"0.54435045",
"0.54191893",
"0.53990686",
"0.539818",
"0.5367193",
"0.525431",
"0.52476007",
"0.5213229",
"0.5198825",
"0.5148193",
"0.5102565",
"0.5100211",
"0.5095959",
"0.5077388",
"0.5073199",
"0.5073199",
"0.50727916",... | 0.55283093 | 4 |
Validate a Scheme where a default value is set, and the required field may or may not be set. If a default value is provided, it should be assumed to not be required. | def test_validate_has_default(self, args, value):
sch = scheme.Scheme(*args)
sch.validate(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_default_value(self):\n if self.has_default_value:\n if not self.is_valid_value(self.default):\n raise AttributeSchemaError(\n \"Default value '%s' is not compliant with the schema\"\n )",
"def _validate_usage_of_optional(self) -> Non... | [
"0.6712962",
"0.6559259",
"0.6384457",
"0.63740396",
"0.63319457",
"0.6275177",
"0.62136495",
"0.6117872",
"0.60729265",
"0.6002735",
"0.5980889",
"0.5980177",
"0.592488",
"0.5911875",
"0.5888035",
"0.5887444",
"0.58746046",
"0.58679914",
"0.58679914",
"0.5858644",
"0.5824680... | 0.7592183 | 0 |
Conventionalize the name of a namespace (class/module). This function uses the format specified in the config.json file. If no format is specified, the function name is unchanged, which is the same as snake_case, since the testplan uses snake case. | def conventionalize_namespace(self, namespace: str) -> str:
return _conventionalize(self.options, "namespace", namespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_names(self):\n obj = dotnet.DotNetNamespace({\"id\": \"Foo.Bar\"}, jinja_env=None, app=None)\n self.assertEqual(obj.name, \"Foo.Bar\")\n self.assertEqual(obj.short_name, \"Bar\")\n\n obj = dotnet.DotNetNamespace(\n {\"id\": \"Foo.Bar.Something`1\"}, jinja_env=None, a... | [
"0.6325361",
"0.63245094",
"0.6254994",
"0.6172096",
"0.61611706",
"0.60899603",
"0.60221833",
"0.5964377",
"0.5873374",
"0.5867511",
"0.5848523",
"0.5835894",
"0.58296597",
"0.58027667",
"0.5775671",
"0.5767961",
"0.5766133",
"0.5764641",
"0.57630926",
"0.5754536",
"0.574889... | 0.68777764 | 0 |
Utility function to append the file extension to a file name. | def with_extension(self, file_name: str) -> str:
return f"{file_name}.{self.extension_file()}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_file_extension(file_name: str, extension: str) -> str:\n fname = file_name.strip()\n slice_offset = -1 * (len(extension) + 1)\n if fname[slice_offset:] != f\".{extension}\":\n fname = fname + f\".{extension}\"\n return fname",
"def changeFilenameExtension(path, ext... | [
"0.8528558",
"0.8062244",
"0.8047143",
"0.8015572",
"0.79787844",
"0.79774404",
"0.79475087",
"0.79273295",
"0.78425616",
"0.7700881",
"0.76052445",
"0.7601068",
"0.75440496",
"0.74757856",
"0.7463833",
"0.74503",
"0.7436471",
"0.7356633",
"0.73540837",
"0.7328487",
"0.731069... | 0.8069031 | 1 |
A list of extensions for the template files. By default, this uses the ``extension_file`` and ``mako``. | def extension_templates(self) -> List[str]:
default = [self.extension_file(), "mako"]
return self.options.get("extensions").get("templates", default) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_extensions():\n formats = FileFormat.list_formats()\n return render_template('home.html', formats=formats)",
"def get_file_extensions(self):\n return [ 'img', 'qcow', 'qcow2' ]",
"def extensions(cls):\n return ['ma', 'mb']",
"def list_templates(extensions: Optional[List[str]] = N... | [
"0.7211576",
"0.70925236",
"0.6736312",
"0.66613126",
"0.66350615",
"0.6608335",
"0.65512705",
"0.6537218",
"0.65297145",
"0.6517706",
"0.6482356",
"0.64313877",
"0.6427379",
"0.6425264",
"0.6425264",
"0.6413745",
"0.6393571",
"0.6377663",
"0.6377291",
"0.6376385",
"0.6357586... | 0.856407 | 0 |
Check if point (x,y) is inside the primitive | def inside(x, y, primitive):
# You should implement your inside test here for all shapes
# for now, it only returns a false test
if primitive["shape"] == "circle":
dist_sqr = ((primitive["center"][0] - x) ** 2 +
(primitive["center"][1] - y) ** 2)
return dist_sqr <= pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_inside(self, x: int, y: int) -> bool:\n pass",
"def contains_point(self, x, y): \r\n n = len(self.points)\r\n inside = False\r\n \r\n x1, y1 = self.points[0]\r\n for i in range(n + 1):\r\n x2, y2 = self.points[i % n]\r\n if y > min(y1, y2):\r\... | [
"0.8037496",
"0.7722631",
"0.76818085",
"0.765037",
"0.7569337",
"0.7489689",
"0.7483065",
"0.7481484",
"0.7449543",
"0.7449543",
"0.7445285",
"0.7424389",
"0.74223197",
"0.7382823",
"0.7363741",
"0.7363741",
"0.72750396",
"0.71956223",
"0.7188695",
"0.7178747",
"0.71675277",... | 0.8079797 | 0 |
An infinite iterator of values read from `value`. | def values(self):
while True:
try:
yield self.value
except GPIODeviceClosed:
break | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for val in self.value:\n yield val",
"def iter_sequence_infinite(seq):\n while True:\n for item in seq:\n yield item",
"def iterator(self):\n return self.ValueIterator()",
"def itervalues(self):\n def make_iter(self=self):\n keys =... | [
"0.6913911",
"0.676446",
"0.6461074",
"0.64440095",
"0.6390452",
"0.63825923",
"0.60992134",
"0.5983867",
"0.59706414",
"0.59339345",
"0.5905444",
"0.58736026",
"0.58673865",
"0.58610153",
"0.5820957",
"0.5806312",
"0.57809633",
"0.5757294",
"0.5746294",
"0.5731976",
"0.57168... | 0.6102582 | 6 |
Set globals for all tests. Called before a test is started. | def setUp(self):
self.tb = gr.top_block() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testInit(self):\n self.globalInit()\n self.test.start()",
"def setUpModule():\n # pull in test environment as dict\n global TestEnv\n get_test_env(TestEnv)",
"def setUpModule():\n # pull in test environment as dict\n global TestEnv\n get_test_env(TestEnv)",
"def setUp(self... | [
"0.74096614",
"0.7283887",
"0.7283887",
"0.71482015",
"0.6912837",
"0.68596286",
"0.6736439",
"0.66601014",
"0.6647767",
"0.6631472",
"0.66163677",
"0.6597025",
"0.6511948",
"0.645603",
"0.643608",
"0.6416348",
"0.63949156",
"0.63939023",
"0.6374158",
"0.6351894",
"0.6340355"... | 0.0 | -1 |
The second 3x3x1 group conv is replaced by 3x3x3. | def __init__(self, num_in, num_out, g=1, stride=1, d=(1,1),norm=None):
super(MFunit, self).__init__()
num_mid = num_in if num_in <= num_out else num_out
self.conv1x1x1_in1 = Conv3d_Block(num_in,num_in//4,kernel_size=1,stride=1,norm=norm)
self.conv1x1x1_in2 = Conv3d_Block(num_in//4,nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv3x3(in_planes, out_planes, stride=1,num_group=1):\n return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False,groups=num_group)",
"def subpel_conv3x3(in_ch, out_ch, r=1):\n # return nn.Sequential(\n # nn.Conv2d(in_ch, out_ch * r**2, kernel_size=3, padding=1)... | [
"0.6588943",
"0.65194446",
"0.6311151",
"0.6292436",
"0.62130153",
"0.62106985",
"0.6197277",
"0.6197277",
"0.6197277",
"0.61807626",
"0.61754745",
"0.61682445",
"0.61682445",
"0.61606604",
"0.6159857",
"0.61456317",
"0.6127157",
"0.6127157",
"0.6127157",
"0.6127157",
"0.6127... | 0.0 | -1 |
Return a list of all maximum values. Using python's max function | def v1_multimax(iterable):
max_item = max(iterable)
items = []
for item in iterable:
if item == max_item:
items.append(item)
return items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(self, values):\n return self.aggregate(values, \"max\")",
"def maxs(self):\n return self._maxs",
"def getEvolutionMax(self):\n \n return [self.getMaximumAtGivenTime(timeIndex) for timeIndex in range(self.numberOfTimes - 1)]",
"def GetMax(val, maximum):\n\tval = float(val)\n... | [
"0.77190864",
"0.76719433",
"0.75598085",
"0.7531507",
"0.75034434",
"0.73581827",
"0.7331883",
"0.7290781",
"0.7121547",
"0.71105146",
"0.709839",
"0.70891577",
"0.70564",
"0.7010202",
"0.70075643",
"0.69957966",
"0.69606304",
"0.6941175",
"0.69085854",
"0.68681145",
"0.6863... | 0.6662823 | 40 |
Return a list of all maximum values. | def v3_multimax(iterable):
max_item = None
for item in iterable:
if max_item is None or item > max_item:
max_item = item
return [
item
for item in iterable
if item == max_item
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxs(self):\n return self._maxs",
"def max(self, values):\n return self.aggregate(values, \"max\")",
"def getEvolutionMax(self):\n \n return [self.getMaximumAtGivenTime(timeIndex) for timeIndex in range(self.numberOfTimes - 1)]",
"def argmax(self, values):\n return self.... | [
"0.7807146",
"0.7401578",
"0.71416354",
"0.7037375",
"0.6986239",
"0.6941203",
"0.68978596",
"0.6857152",
"0.68385166",
"0.6761405",
"0.6698091",
"0.66160256",
"0.65944684",
"0.65931803",
"0.65923536",
"0.6561521",
"0.6507188",
"0.6471931",
"0.6455798",
"0.6451493",
"0.645044... | 0.635013 | 29 |
Return a list of all maximum values. Bonus 1 on short solution. | def v4_multimax(iterable):
try:
max_item = max(iterable)
except ValueError:
return []
return [
item
for item in iterable
if item == max_item
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxs(self):\n return self._maxs",
"def max(self, values):\n return self.aggregate(values, \"max\")",
"def getEvolutionMax(self):\n \n return [self.getMaximumAtGivenTime(timeIndex) for timeIndex in range(self.numberOfTimes - 1)]",
"def maxs(self):\n return self.intervals[... | [
"0.76413286",
"0.7270469",
"0.71932346",
"0.69931054",
"0.68992054",
"0.67882246",
"0.67848736",
"0.67767113",
"0.67683375",
"0.6738391",
"0.6735082",
"0.67070585",
"0.66327673",
"0.6533701",
"0.6530938",
"0.6522813",
"0.65119886",
"0.6493043",
"0.6488933",
"0.6484175",
"0.64... | 0.6449458 | 23 |
Return a list of all maximum values. Avoiding ValueError being raised by Max on empty lists by specifying a default value. | def v5_multimax(iterable):
max_item = max(iterable, default=None)
return [
item
for item in iterable
if item == max_item
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pmax(\n *x: Iterable,\n na_rm: bool = False\n) -> Iterable[float]:\n maxlen = max(map(length_of, x))\n x = (recycle_value(elem, maxlen) for elem in x)\n return Array([max(elem, na_rm=na_rm) for elem in zip(*x)])",
"def max(self, values):\n return self.aggregate(values, \"max\")"... | [
"0.7088949",
"0.69805247",
"0.6938142",
"0.68783617",
"0.6761037",
"0.67590576",
"0.6726837",
"0.66670704",
"0.66043216",
"0.6602137",
"0.6540179",
"0.64645016",
"0.64195466",
"0.6415842",
"0.641037",
"0.6409815",
"0.6400186",
"0.63682425",
"0.6367073",
"0.63583535",
"0.63164... | 0.6234659 | 23 |
Return a list of all maximum values. | def v6_multimax(iterable):
maximums = []
for item in iterable:
if not maximums or maximums[0] == item:
maximums.append(item)
elif item > maximums[0]:
maximums = [item]
return maximums | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxs(self):\n return self._maxs",
"def max(self, values):\n return self.aggregate(values, \"max\")",
"def getEvolutionMax(self):\n \n return [self.getMaximumAtGivenTime(timeIndex) for timeIndex in range(self.numberOfTimes - 1)]",
"def argmax(self, values):\n return self.... | [
"0.7807292",
"0.7403893",
"0.71414465",
"0.7039885",
"0.69863486",
"0.69421166",
"0.6899193",
"0.68574405",
"0.6839452",
"0.6761389",
"0.6699419",
"0.66177887",
"0.659424",
"0.6593461",
"0.6562654",
"0.65081894",
"0.64738417",
"0.64571166",
"0.6452998",
"0.64502233",
"0.64435... | 0.6595453 | 12 |
Return a list of all maximum values. | def v8_multimax(iterable, key=None):
if key is None:
def key(item): return item
item_scores = [
(key(item), item)
for item in iterable
]
try:
max_key = max(score for score, _ in item_scores)
except ValueError:
return []
return [
item
for sc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxs(self):\n return self._maxs",
"def max(self, values):\n return self.aggregate(values, \"max\")",
"def getEvolutionMax(self):\n \n return [self.getMaximumAtGivenTime(timeIndex) for timeIndex in range(self.numberOfTimes - 1)]",
"def argmax(self, values):\n return self.... | [
"0.7807146",
"0.7401578",
"0.71416354",
"0.7037375",
"0.6986239",
"0.6941203",
"0.68978596",
"0.6857152",
"0.68385166",
"0.6761405",
"0.6698091",
"0.66160256",
"0.65944684",
"0.65931803",
"0.65923536",
"0.6561521",
"0.6507188",
"0.6471931",
"0.6455798",
"0.6451493",
"0.645044... | 0.0 | -1 |
Return a list of all maximum values. Looping over all the items and keeping track of the current maximum key and the current maximum items list and then updating the key and the list as we find new maximums | def v9_multimax(iterable, key=None):
if key is None:
def key(item): return item
max_key = None
maximums = []
for item in iterable:
k = key(item)
if k == max_key:
maximums.append(item)
elif not maximums or k > max_key:
maximums = [item]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v10_multimax(iterable, key=lambda x: x):\n max_key = None\n maximums = []\n for item in iterable:\n k = key(item)\n if k == max_key:\n maximums.append(item)\n elif not maximums or k > max_key:\n maximums = [item]\n max_key = k\n return maximums"... | [
"0.73892826",
"0.67016333",
"0.6608801",
"0.66080403",
"0.6526587",
"0.6421425",
"0.640748",
"0.6286835",
"0.6267153",
"0.6192845",
"0.6155781",
"0.598234",
"0.5974505",
"0.5919671",
"0.5914128",
"0.5881167",
"0.5871056",
"0.5862119",
"0.5842603",
"0.5841861",
"0.58042765",
... | 0.7013525 | 1 |
Converts a checkpoint to a SavedModel with fixed weights for faster inference | def convert_ckpt_to_saved_model(checkpoint_path, saved_model_path, signature, proto_fields, meta_graph_path=None,
graph=None, session=None):
from diplomacy_research.utils.tensorflow import tf, graph_util, build_tensor_info, saved_model_builder, \
signature_def_utils, tag_cons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_weights_to_model(self, model: nn.Module,\n checkpoint: Optional[dict],\n cfg: Optional[ConfigType]) -> None:\n if checkpoint is not None:\n _load_checkpoint_to_model(model, checkpoint)\n else:\n warnings.warn(... | [
"0.7118923",
"0.7041227",
"0.68980575",
"0.6789204",
"0.67371106",
"0.67005",
"0.6659706",
"0.6652895",
"0.65979433",
"0.657669",
"0.65421975",
"0.6530745",
"0.65273565",
"0.649903",
"0.6497165",
"0.6491211",
"0.6476806",
"0.64754856",
"0.6460946",
"0.64562386",
"0.6408041",
... | 0.66598403 | 6 |
Loads a frozen graph from disk | def load_frozen_graph(frozen_graph_path, graph=None, session=None):
from diplomacy_research.utils.tensorflow import tf, tf_logging
# Making sure the path exists
if not os.path.exists(frozen_graph_path):
LOGGER.error('The frozen graph %s does not exist.', frozen_graph_path)
raise FileNotFoun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_graph(self,frozen_file_name):\n with tf.gfile.GFile(frozen_file_name, \"rb\") as f:\n graph_def = tf.GraphDef()\n graph_def.ParseFromString(f.read())\n with tf.Graph().as_default() as graph:\n tf.import_graph_def(\n graph_def,\n ... | [
"0.7443791",
"0.71746165",
"0.71616304",
"0.6982689",
"0.6982689",
"0.69244504",
"0.6907638",
"0.67683244",
"0.6760381",
"0.67250866",
"0.67236614",
"0.6550041",
"0.6435565",
"0.6370517",
"0.6337695",
"0.6316899",
"0.6309768",
"0.62737733",
"0.6256466",
"0.6250105",
"0.622607... | 0.7311585 | 1 |
Make sure each feature vector is of the same length | def truncate_features(self):
num_variable = len(self.Train_data['X'][0])
for i in xrange(len(self.Train_data['X'])):
num_variable = min([num_variable, len(self.Train_data['X'][i])])
# truncate train, validation and test
for i in xrange(len(self.Train_data['X'])):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return 1 + len(self.features)",
"def __len__(self):\n return len(self.features)",
"def feature_vector(features, vector):\n clean_features = set(features)\n new_features_vector = featurize(vector,clean_features)\n return new_features_vector",
"def _validate_length_f... | [
"0.622776",
"0.6133447",
"0.60583246",
"0.6037469",
"0.5869552",
"0.58094513",
"0.57574946",
"0.57548714",
"0.5720249",
"0.568373",
"0.5668222",
"0.564172",
"0.5631634",
"0.5630346",
"0.5614738",
"0.5612899",
"0.5585968",
"0.5579792",
"0.55756164",
"0.55626965",
"0.55561334",... | 0.5471492 | 25 |
Converts a listoflists to a listofdicts. | def to_listdict(list_list):
# Fastest way to this is cycle through every row but the first
# and use zip with the first row and subsequent rows
return [dict(zip(list_list[0], i)) for i in list_list[1:]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_to_dict(list_of_dicts):\n output = defaultdict(list)\n for dict_ in list_of_dicts:\n for key, value in dict_.items():\n dict_[key].append(value)\n return dict(output)",
"def list_to_dict(l):\n d={}\n for index, item in enumerate(l[::2]):\n key=item\n value=... | [
"0.71898746",
"0.682572",
"0.65544385",
"0.64600074",
"0.6403002",
"0.6402541",
"0.63975644",
"0.6336378",
"0.623129",
"0.617328",
"0.6079919",
"0.6071819",
"0.60629773",
"0.60576004",
"0.6020285",
"0.5994163",
"0.5988123",
"0.5946859",
"0.5751769",
"0.57112294",
"0.5710868",... | 0.6981767 | 1 |
Split an iterable into a list of n sized chunks. I got the original idea from stackoverflow at | def chunk(iterable_obj, part_size):
# Apparently,this was faster than all other methods when I tested
# Container for new items
temp_lst = []
# Cycle through list of items with part_size step
for i in range(0, len(iterable_obj), part_size):
# append part_size list to temp list
temp_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunk(iterable, n):\n iterable = [e for e in iterable]\n avg_length = int(math.ceil(len(iterable) / n))\n return [iterable[i * avg_length:(i + 1) * avg_length] for i in range(n)]",
"def _get_chunks(l, n = 10):\n \n for i in range(0, len(l), n): yield l[i: i + n]",
"def _chunks(l, n):\n fo... | [
"0.87779385",
"0.85783833",
"0.853273",
"0.8524417",
"0.8493434",
"0.8476329",
"0.8472466",
"0.8420054",
"0.8394578",
"0.8346244",
"0.8345122",
"0.8337749",
"0.8337749",
"0.8337749",
"0.8337749",
"0.8337749",
"0.8334111",
"0.83188",
"0.8318406",
"0.83175206",
"0.83129394",
... | 0.0 | -1 |
Returns a string indicate a current datetime(Ex. 20150106_012259). Generally used to put a timestamp on file names. | def timestamp(formatting="%Y%m%d_%H%M%S"):
now = datetime.now()
return now.strftime(formatting) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getCurrentDateString(self):\n currentDateTime = datetime.now()\n return currentDateTime.strftime(\"%Y%m%d_%H%M\")",
"def get_current_datetime_string ( ) :\n return get_current_datetime( ).strftime( \"%Y%m%d-%H%M%S\" )",
"def date_time():\n\n\treturn datetime.now().strftime(\"%d%m%Y_%H%M%S\... | [
"0.83171237",
"0.81809783",
"0.80027723",
"0.7854729",
"0.78174245",
"0.7747417",
"0.76892316",
"0.7675081",
"0.76529837",
"0.75644094",
"0.75485533",
"0.7540581",
"0.7464381",
"0.7405856",
"0.74037963",
"0.738793",
"0.73817086",
"0.73708737",
"0.7302503",
"0.72868675",
"0.72... | 0.669274 | 80 |
Write a list or dict to a JSON file | def write_json(file_path, py_content):
with open(file_path, 'w') as file:
json.dump(py_content, file)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeToFile(jsonList):\n file = open(\"data.json\", \"w\")\n file.write(json.dumps(jsonList, sort_keys=True, indent=4, separators=(',', ': ')))\n print(\"File written\")",
"def write_json_file(file_name: str, content: list):\n with open(file_name, 'w+') as file_object:\n json.dump(content,... | [
"0.789241",
"0.77660483",
"0.7728639",
"0.7647594",
"0.75397885",
"0.7442549",
"0.7407022",
"0.73851746",
"0.7371701",
"0.7337767",
"0.7334696",
"0.7326527",
"0.7306225",
"0.7290069",
"0.7285736",
"0.7282986",
"0.7280518",
"0.72532284",
"0.7245934",
"0.72335064",
"0.721222",
... | 0.68772084 | 69 |
converts a number of seconds to hours, minutes, seconds.ms | def seconds_to_str(seconds):
(hours, remainder) = divmod(seconds, 3600)
(minutes, seconds) = divmod(remainder, 60)
return "h{}m{}s{}".format(int(hours), int(minutes), float(seconds)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sec2hms(seconds):\n hours, seconds = divmod(seconds, 60**2)\n minutes, seconds = divmod(seconds, 60)\n return int(hours), int(minutes), seconds",
"def convert_time(t):\n minutes = int(t/60)\n seconds = int(t-60*minutes)\n return minutes, seconds",
"def to_seconds(hours, minutes, seconds):... | [
"0.8091216",
"0.7898459",
"0.7863454",
"0.7849779",
"0.777305",
"0.77086383",
"0.7664049",
"0.7664049",
"0.7588219",
"0.74599534",
"0.7399074",
"0.7356309",
"0.72976303",
"0.72441924",
"0.7232631",
"0.7224375",
"0.72027075",
"0.72023153",
"0.717027",
"0.7161423",
"0.7151057",... | 0.68986505 | 37 |
Convert string into list of integer tokens. | def tokenize_string(self, string: str) -> int:
return [
self.string_token_table[char]
for char in string
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_string_to_listint(string):\n\tstring = string.split()\n\tlength = len(string)\n\tnewlist = []\n\tfirst = int (string[0])\n\tsecond = int (string[1])\n\tthird = int (string[2])\n\tforth = int (string[3])\n\tfifth = int (string[4])\n\tnewlist.append(first)\n\tnewlist.append(second)\n\tnewlist.append(third)... | [
"0.73680043",
"0.72562283",
"0.7253711",
"0.71326435",
"0.7084831",
"0.6961328",
"0.69294274",
"0.69171494",
"0.68732715",
"0.68486124",
"0.6844072",
"0.6707131",
"0.6664305",
"0.65781695",
"0.6573334",
"0.6572087",
"0.65592974",
"0.6554495",
"0.6543391",
"0.6534078",
"0.6511... | 0.6898022 | 8 |
Return a booleanin regards to if there available columns for the player to choose. That is, if the does not yet have all three neutral markers used AND there are available columns that are not finished/won yet. | def are_there_available_columns_to_play(self):
available_columns = self.get_available_columns()
return self._state.n_neutral_markers != 3 and len(available_columns) > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_columns(self):\n\t\ti=0\n\t\tfor i in range(len(self.board[i])):\n\t\t\tpts = 0\n\t\t\tfor j in range(len(self.board)):\n\t\t\t\tif self.board[j][i] == self.marker:\n\t\t\t\t\tpts+=1\n\t\t\tif pts == 3:\n\t\t\t\tprint('YOU WON')\n\t\t\t\treturn True",
"def check_for_tie(self):\n\n\t\tif len(self.player... | [
"0.71259797",
"0.66521806",
"0.6643837",
"0.6570667",
"0.6502452",
"0.6418486",
"0.63401294",
"0.62101865",
"0.6208771",
"0.61511815",
"0.6135917",
"0.6094096",
"0.6060431",
"0.60536647",
"0.59778875",
"0.5970447",
"0.5923437",
"0.59130466",
"0.58886546",
"0.58699447",
"0.586... | 0.8425983 | 0 |
Converts to lowercase, removes nonword characters (alphanumerics and underscores) and converts spaces to hyphens. Also strips leading and trailing whitespace. From Django | def slugify(value):
value = re.sub('[^\w\s-]', '', value).strip()
return re.sub('[-\s]+', '-', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(self, s):\n stripped = re.sub(\"[^\\w\\s]\", \"\", s)\n stripped = re.sub(\"_\", \"\", stripped)\n\n stripped = re.sub(\"\\s+\", \" \", stripped)\n\n stripped = stripped.strip()\n\n return stripped.lower()",
"def sanitize(str):\n res = str.lower()\n return ... | [
"0.7490099",
"0.73048717",
"0.7155193",
"0.71396816",
"0.7003548",
"0.6808231",
"0.6771215",
"0.67404467",
"0.6732289",
"0.67316884",
"0.6708777",
"0.6703071",
"0.66760194",
"0.66657454",
"0.6662949",
"0.66527486",
"0.6646994",
"0.66467595",
"0.6614998",
"0.6614998",
"0.65898... | 0.637163 | 53 |
Returns self unchanged, as there are no parameters to fit. | def fit(self, X, y=None, **fit_params):
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_fit(self):\n raise NotImplementedError()",
"def fit(self, *_):\n return self",
"def fit(self, *_):\n return self",
"def fit(self, *_):\n return self",
"def fit(self, *args, **kwargs):\n return self",
"def fit(self):\n raise NotImplementedError # pragma... | [
"0.7425323",
"0.7409009",
"0.7409009",
"0.7409009",
"0.7208671",
"0.70044965",
"0.693266",
"0.68734795",
"0.68254465",
"0.6766191",
"0.6748866",
"0.6748866",
"0.6742166",
"0.6742166",
"0.6687262",
"0.6678899",
"0.6676323",
"0.66393596",
"0.6553403",
"0.6505026",
"0.6416598",
... | 0.0 | -1 |
Test case for meeting_live_stream_update | def test_meeting_live_stream_update(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_meeting_live_stream_status_update(self):\n pass",
"def test_meeting_poll_update(self):\n pass",
"def test_finds_live_stream(self):\n username = 'darth-vader'\n user = create_profile(username)\n\n now = timezone.now()\n streams = [\n {\n ... | [
"0.909592",
"0.7484508",
"0.70674634",
"0.7009298",
"0.6776961",
"0.67246264",
"0.66745967",
"0.6613003",
"0.6448205",
"0.6412952",
"0.6410457",
"0.63848335",
"0.6346094",
"0.6326666",
"0.6262576",
"0.6257109",
"0.62095994",
"0.6081964",
"0.606914",
"0.60670584",
"0.5988038",... | 0.94533026 | 0 |
Test case for meeting_update | def test_meeting_update(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_meeting_poll_update(self):\n pass",
"def test_meeting_registrant_question_update(self):\n pass",
"def test_update_activity(self):\n pass",
"def test_meeting(self):\n pass",
"def test_meeting_status(self):\n pass",
"def test_update_case(self):\n pass",
... | [
"0.8496937",
"0.7687219",
"0.74232453",
"0.7396737",
"0.73560685",
"0.7264441",
"0.7249784",
"0.71363574",
"0.7124385",
"0.7076912",
"0.7076912",
"0.7076912",
"0.7039266",
"0.6928178",
"0.6920488",
"0.68791175",
"0.6877018",
"0.6839443",
"0.68362534",
"0.68351454",
"0.6832189... | 0.92295855 | 0 |
Test case for past_meetings | def test_past_meetings(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_past_meeting_details(self):\n pass",
"def test_past_meeting_participants(self):\n pass",
"def test_list_past_meeting_polls(self):\n pass",
"def test_meetings(self):\n pass",
"def test_meeting_polls(self):\n pass",
"def test_meeting(self):\n pass",
"def... | [
"0.83691144",
"0.8264378",
"0.8200151",
"0.77695435",
"0.7351619",
"0.7106712",
"0.70970726",
"0.7059921",
"0.6994173",
"0.67973685",
"0.6548808",
"0.64982635",
"0.6493668",
"0.6487324",
"0.6465199",
"0.6453459",
"0.64049655",
"0.63727164",
"0.63508195",
"0.63105947",
"0.6297... | 0.9223625 | 0 |
Forward function. If you want to manually determine which positions are positive samples, you can set the pos_index and pos_label parameter. Currently, only the CenterNet update version uses the parameter. | def forward(self,
pred: Tensor,
target: Tensor,
pos_inds: Optional[Tensor] = None,
pos_labels: Optional[Tensor] = None,
weight: Optional[Tensor] = None,
avg_factor: Optional[Union[int, float]] = None,
reducti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_train(self, *args, **kwargs):\n pass",
"def forward_train(self, *args, **kwargs):\n return self.detector.forward_train(*args, **kwargs)",
"def forward(self, X, training=False):\n pass",
"def forward(self, anchor: torch.Tensor, pos: torch.Tensor, neg: torch.Tensor) -> torch.Te... | [
"0.64412457",
"0.63571054",
"0.63011765",
"0.6177497",
"0.60816824",
"0.605655",
"0.6022174",
"0.5996583",
"0.59943765",
"0.5989134",
"0.59772164",
"0.59658206",
"0.59545475",
"0.59515214",
"0.5947581",
"0.59369636",
"0.59261596",
"0.5922594",
"0.5908546",
"0.58961946",
"0.58... | 0.55357397 | 71 |
Draw detected bounding boxes. | def vis_detections(im, class_name, dets, thresh=0.5):
global CHECK
global CLASS_NAME
global INDS
global RES
inds = np.where(dets[:, -1] >= thresh)[0]
if len(inds) == 0:
return
bbox = dets[inds[0], :4]
score = dets[inds[0], -1]
if len(inds) > 1:
score = -1
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_bounding_boxes(self, bounding_boxes, output):\n for i, bb in enumerate(bounding_boxes):\n\n if bb[2] > output.shape[1] or bb[3] > output.shape[0] or bb[0] < 0 or bb[1] < 0:\n continue\n cv2.rectangle(\n np.asarray(output), (bb[0], bb[1]), (bb[2], ... | [
"0.77598673",
"0.7638101",
"0.7510348",
"0.72977304",
"0.7150563",
"0.7103931",
"0.7101873",
"0.7083905",
"0.7020769",
"0.6993739",
"0.6974172",
"0.69637305",
"0.6859061",
"0.68521667",
"0.68319523",
"0.6830371",
"0.6809837",
"0.6805064",
"0.67750585",
"0.6774759",
"0.6742592... | 0.0 | -1 |
Given a vector of frame labels, returns a list of indexing vectors, one for each labeled segment in the vector. | def to_inds_list(frame_labels: np.ndarray, unlabeled_label: int = 0) -> list[np.ndarray]:
segment_inds = np.nonzero(frame_labels != unlabeled_label)[0]
return np.split(segment_inds, np.where(np.diff(segment_inds) != 1)[0] + 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_of_label(self, label_name):\n return self.indices_of('label', label_name)",
"def toIndexes(self, binaryVector):\n\t\treturn n.array([i for i,v in enumerate(binaryVector) if v], dtype=\"int32\")",
"def get_label_vectors():\n print(\"Retrieving label vectors...\")\n label_dict = {} ... | [
"0.6325616",
"0.62582874",
"0.60595554",
"0.60552484",
"0.58844775",
"0.5872578",
"0.5848587",
"0.5835332",
"0.5827978",
"0.573835",
"0.57329404",
"0.5697894",
"0.5666219",
"0.55843794",
"0.55757225",
"0.5561923",
"0.55042166",
"0.5482453",
"0.5471507",
"0.5459344",
"0.543010... | 0.71350884 | 0 |
Index route for Headline NG API. Doesn't require authentication, just there for the user to know what's up. | def index():
return render_template('index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return (\n f\"Welcome to my Hawaii trip info!<br/>\"\n f\"Available Routes:<br/>\"\n f\"/api/v1.0/precipitation<br/>\"\n f\"/api/v1.0/stations<br/>\"\n f\"/api/v1.0/tobs<br/>\"\n f\"/api/v1.0/<start><br/>\"\n f\"/api/v1.0/<start>/<end>\"\n )",
... | [
"0.73796356",
"0.72805184",
"0.723012",
"0.70896846",
"0.70874864",
"0.70798343",
"0.70105684",
"0.69924283",
"0.6947956",
"0.69124204",
"0.6896553",
"0.68876255",
"0.6885809",
"0.6881961",
"0.6873674",
"0.6829164",
"0.68284523",
"0.68284523",
"0.6827725",
"0.6827213",
"0.682... | 0.66535807 | 81 |
Zeros the gradient buffers. | def reset_grad(self):
self.g_optimizer.zero_grad()
self.d_optimizer.zero_grad()
self.dr_optimizer.zero_grad() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_grad(self):\n self.grad = Tensor(data=np.zeros_like(self.data, dtype=np.float))",
"def zero_grad(self):\n for p, dp in self.params:\n dp.zero_()",
"def zero_grad(self):\n self.grad.zero_()",
"def grad_zero(self):\r\n for layer in self.layers:\r\n lay... | [
"0.7365489",
"0.722445",
"0.7213672",
"0.71395624",
"0.70908344",
"0.70908344",
"0.70107096",
"0.6991527",
"0.6980601",
"0.6939036",
"0.6928897",
"0.68486327",
"0.6833067",
"0.6826072",
"0.667195",
"0.6619478",
"0.6614191",
"0.65529835",
"0.6532025",
"0.65136254",
"0.65068316... | 0.6203366 | 43 |
Returns torch.utils.data.DataLoader for custom coco dataset. | def get_precomp_loader(data_path, data_split, vocab, opt, batch_size=100,
shuffle=True, num_workers=2):
dset = PrecompDataset(data_path, data_split, vocab)
# train_sampler = torch.utils.data.distributed.DistributedSampler(dset)
# if data_split == 'train':
# data_loader ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _custom_data_loader(self) -> DataLoader:\n dataloaders = DataLoader(self.dataset, batch_size=1)\n return dataloaders",
"def get_loader(root, path, vocab_con,transform, batch_size, shuffle, num_workers):\n # COCO caption dataset\n clef = ClefDataset(root=root,\n csv= ... | [
"0.7068867",
"0.67355895",
"0.6700325",
"0.6609198",
"0.6598869",
"0.6422404",
"0.63506544",
"0.63122624",
"0.63081515",
"0.6259346",
"0.62435836",
"0.6241007",
"0.61782414",
"0.61521894",
"0.6139885",
"0.6126699",
"0.6124809",
"0.6089955",
"0.6081112",
"0.60792625",
"0.60171... | 0.6158319 | 13 |
Gets and sets the mailingAddress | def mailing_address(self):
if "mailingAddress" in self._prop_dict:
if isinstance(self._prop_dict["mailingAddress"], OneDriveObjectBase):
return self._prop_dict["mailingAddress"]
else :
self._prop_dict["mailingAddress"] = PhysicalAddress(self._prop_dict["ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mailing_address(self):\n registered_office = db.session.query(Office).filter(Office.business_id == self.id).\\\n filter(Office.office_type == 'registeredOffice').one_or_none()\n if registered_office:\n return registered_office.addresses.filter(Address.address_type == 'mailin... | [
"0.675893",
"0.648266",
"0.6408535",
"0.64022124",
"0.6221849",
"0.61903477",
"0.61527187",
"0.6152639",
"0.5999218",
"0.59634215",
"0.59634215",
"0.5958654",
"0.5938848",
"0.5934311",
"0.58930707",
"0.586712",
"0.5783458",
"0.5771247",
"0.5769526",
"0.5757994",
"0.5757994",
... | 0.73820466 | 0 |
Gets and sets the student | def student(self):
if "student" in self._prop_dict:
if isinstance(self._prop_dict["student"], OneDriveObjectBase):
return self._prop_dict["student"]
else :
self._prop_dict["student"] = EducationStudent(self._prop_dict["student"])
return sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_student(self):\n return self.student",
"def get_student(self):\n return self._student",
"def set_student(self, student_id):\n self._student = student_id",
"def get_student(self):\n return db.get(self.student_key)",
"def get_student_id(self):\n return self.__studen... | [
"0.78024566",
"0.75783443",
"0.71720505",
"0.70691174",
"0.6799765",
"0.6727049",
"0.6494957",
"0.64545965",
"0.6268871",
"0.61956066",
"0.6098028",
"0.6070294",
"0.599784",
"0.5980766",
"0.58938706",
"0.58920294",
"0.58588845",
"0.5855758",
"0.5853466",
"0.5852979",
"0.58209... | 0.7106409 | 3 |
Gets and sets the createdBy | def created_by(self):
if "createdBy" in self._prop_dict:
if isinstance(self._prop_dict["createdBy"], OneDriveObjectBase):
return self._prop_dict["createdBy"]
else :
self._prop_dict["createdBy"] = IdentitySet(self._prop_dict["createdBy"])
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_by(self):\n return self._created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._att... | [
"0.8442601",
"0.83686256",
"0.83686256",
"0.83686256",
"0.83686256",
"0.8173276",
"0.8173276",
"0.8173276",
"0.8173276",
"0.8173276",
"0.8173276",
"0.8032089",
"0.8032089",
"0.8032089",
"0.8032089",
"0.8030728",
"0.8030728",
"0.8030728",
"0.8030728",
"0.8030728",
"0.8030728",... | 0.8009469 | 21 |
Gets and sets the assignedLicenses | def assigned_licenses(self):
if "assignedLicenses" in self._prop_dict:
return AssignedLicensesCollectionPage(self._prop_dict["assignedLicenses"])
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def licenses(self) -> Sequence[str]:\n return pulumi.get(self, \"licenses\")",
"def getLicenseList(self):\n\n res = self.getRequest('licenses')\n licenses = list()\n if res:\n for item in iter(res['items']):\n lic = vsdModels.License(**item)\n ... | [
"0.6897708",
"0.6254715",
"0.61177564",
"0.609027",
"0.60361576",
"0.59345907",
"0.5908067",
"0.5903719",
"0.59017825",
"0.58795035",
"0.58350414",
"0.5832295",
"0.57833743",
"0.57775646",
"0.5727853",
"0.57235974",
"0.57022923",
"0.5647265",
"0.56455535",
"0.5622698",
"0.558... | 0.76799256 | 1 |
Gets and sets the displayName | def display_name(self):
if "displayName" in self._prop_dict:
return self._prop_dict["displayName"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name(self):\n return self.properties.get(\"displayName\", None)",
"def display_name(self):\n return self.settings['displayName']",
"def displayName( self ):\n if ( not self._displayName ):\n return projex.text.pretty(self.objectName())\n return self._displayNa... | [
"0.8024549",
"0.79686785",
"0.770907",
"0.7293372",
"0.7293372",
"0.7293372",
"0.72066224",
"0.71439695",
"0.7096268",
"0.70412254",
"0.70148575",
"0.69626147",
"0.69534314",
"0.69334805",
"0.69321233",
"0.69321233",
"0.69321233",
"0.69321233",
"0.69321233",
"0.69321233",
"0.... | 0.80308217 | 3 |
Gets and sets the givenName | def given_name(self):
if "givenName" in self._prop_dict:
return self._prop_dict["givenName"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, newname=\"\"):\n self.name = newname",
"def set_name(self, name):\n self.name = name # overwrite the existing name with the input name",
"def set_name(self, name):\n self.name = name # overwrite the existing name wi... | [
"0.7460999",
"0.7297255",
"0.7293907",
"0.7293907",
"0.7234398",
"0.72148013",
"0.71986586",
"0.7188731",
"0.7162375",
"0.7162375",
"0.7162375",
"0.7162375",
"0.7162375",
"0.71581364",
"0.7134733",
"0.71270406",
"0.71095484",
"0.70758253",
"0.7065361",
"0.7065361",
"0.7065361... | 0.0 | -1 |
Gets and sets the mailNickname | def mail_nickname(self):
if "mailNickname" in self._prop_dict:
return self._prop_dict["mailNickname"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nickname(self):\n if (self.__email and self.__auth_domain and\n self.__email.endswith('@' + self.__auth_domain)):\n suffix_len = len(self.__auth_domain) + 1\n return self.__email[:-suffix_len]\n else:\n return self.__email",
"def get_nickname(self):\n return self._nick",
... | [
"0.7334188",
"0.71891093",
"0.68997246",
"0.66469616",
"0.6640504",
"0.6529295",
"0.6280956",
"0.6215231",
"0.618096",
"0.6180914",
"0.5977855",
"0.5951133",
"0.58780736",
"0.58590156",
"0.5749231",
"0.57239324",
"0.57160705",
"0.567876",
"0.56784236",
"0.56642926",
"0.563676... | 0.8256322 | 1 |
Gets and sets the passwordProfile | def password_profile(self):
if "passwordProfile" in self._prop_dict:
if isinstance(self._prop_dict["passwordProfile"], OneDriveObjectBase):
return self._prop_dict["passwordProfile"]
else :
self._prop_dict["passwordProfile"] = PasswordProfile(self._prop_dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setting_profile(request):\n page = \"profile\"\n if request.method == \"POST\":\n form = PasswordChangeForm(request.user, request.POST)\n if form.is_valid():\n user = form.save()\n update_session_auth_hash(request, user) # Important!\n messages.success(requ... | [
"0.6873313",
"0.66290015",
"0.63180214",
"0.628037",
"0.62421286",
"0.62276113",
"0.6209325",
"0.61765367",
"0.61000174",
"0.60634416",
"0.6060751",
"0.60552293",
"0.5992442",
"0.59705305",
"0.59646463",
"0.59646463",
"0.59646463",
"0.594875",
"0.59338003",
"0.59210217",
"0.5... | 0.8018167 | 1 |
Gets and sets the officeLocation | def office_location(self):
if "officeLocation" in self._prop_dict:
return self._prop_dict["officeLocation"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(self):\r\n return self.__location",
"def get_location(self):\n\t\treturn self.location",
"def _get_location(self):\n return industry.Location(itemID=self.locationID, flagID=self.locationFlagID, ownerID=self.ownerID, typeID=self.locationTypeID)",
"def get_location(self):\n ... | [
"0.65635866",
"0.64980894",
"0.64892936",
"0.64839494",
"0.6423581",
"0.6407762",
"0.6311838",
"0.63054234",
"0.6297608",
"0.6297608",
"0.62311643",
"0.62212193",
"0.6188513",
"0.6135908",
"0.61327225",
"0.6107569",
"0.60830134",
"0.5959776",
"0.5928723",
"0.591015",
"0.58917... | 0.83027864 | 1 |
Gets and sets the surname | def surname(self):
if "surname" in self._prop_dict:
return self._prop_dict["surname"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surname(self):\n return self.__surname",
"def surname(self):\n return self._surname",
"def surname(self):\n return self._surname",
"def surname(self, surname):\n\n self._surname = surname",
"def change_surname(change_account):\n change_data(change_account, changed_data='s... | [
"0.84988",
"0.84774137",
"0.84774137",
"0.8037763",
"0.7069211",
"0.6726845",
"0.67088896",
"0.6668887",
"0.631654",
"0.62870175",
"0.6250879",
"0.6204466",
"0.6203598",
"0.6197978",
"0.6184891",
"0.61477137",
"0.61202335",
"0.6118438",
"0.60952526",
"0.602571",
"0.59813946",... | 0.8326295 | 4 |
Gets and sets the usageLocation | def usage_location(self):
if "usageLocation" in self._prop_dict:
return self._prop_dict["usageLocation"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_usage(self, usage):\r\n self._usage = usage",
"def usage(self, usage):\n\n self._usage = usage",
"def usage(self, usage):\n\n self._usage = usage",
"def usage(self, usage):\n\n self._usage = usage",
"def get_location(self):\r\n return self.__location",
"def get_loca... | [
"0.7063971",
"0.6857429",
"0.6857429",
"0.6857429",
"0.6593344",
"0.6529003",
"0.6417323",
"0.63813573",
"0.62553126",
"0.62553126",
"0.62553126",
"0.6241921",
"0.6241921",
"0.6241921",
"0.6241921",
"0.6224283",
"0.6217997",
"0.6217997",
"0.6209649",
"0.6192832",
"0.6192832",... | 0.8254147 | 1 |
Gets and sets the userPrincipalName | def user_principal_name(self):
if "userPrincipalName" in self._prop_dict:
return self._prop_dict["userPrincipalName"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_principal_name(self) -> Optional[str]:\n return pulumi.get(self, \"user_principal_name\")",
"def user_principal_name(self) -> Optional[str]:\n return pulumi.get(self, \"user_principal_name\")",
"def user_principal_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self... | [
"0.71647626",
"0.71647626",
"0.6875519",
"0.645407",
"0.64127046",
"0.6389478",
"0.6380349",
"0.61885303",
"0.6155197",
"0.60399354",
"0.5994666",
"0.5991886",
"0.5983348",
"0.5925807",
"0.5915816",
"0.58755696",
"0.585765",
"0.58545786",
"0.5847192",
"0.58241165",
"0.5824116... | 0.7778325 | 1 |
Gets and sets the userType | def user_type(self):
if "userType" in self._prop_dict:
return self._prop_dict["userType"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"user_type\")",
"def user_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"user_type\")",
"def user_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"user_type\")",
... | [
"0.7818447",
"0.7818447",
"0.77193093",
"0.7587354",
"0.7000212",
"0.6846719",
"0.6388826",
"0.6221593",
"0.62058604",
"0.6174965",
"0.6144199",
"0.6023421",
"0.58740956",
"0.5847426",
"0.58306885",
"0.58297855",
"0.58297855",
"0.5812267",
"0.5812267",
"0.57688653",
"0.576886... | 0.82109714 | 1 |
Returns `xr.Dataset` containing radiative transfer results. | def update_heatingrates(self, atmosphere, surface, cloud=None):
self.calc_radiation(atmosphere, surface, cloud)
def fluxes(net_fluxes, pressure):
Q = fluxes2heating(net_fluxes, pressure, method="gradient")
f = PchipInterpolator(np.log(pressure[::-1]), Q[::-1])
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_rdataset(self):\n return dns.rdataset.from_rdata_list(self.ttl, list(self))",
"def __get_dataset(self):\n # Disable RasterIO logging, just show ERRORS\n log = rio_logging.getLogger()\n log.setLevel(rio_logging.ERROR)\n\n try:\n # Get dataset\n tmp_d... | [
"0.56933475",
"0.5533734",
"0.54954475",
"0.5299855",
"0.5290352",
"0.52619416",
"0.52218944",
"0.5173618",
"0.5161803",
"0.51537424",
"0.5142634",
"0.5092917",
"0.50786716",
"0.50366884",
"0.50078285",
"0.49942067",
"0.49722624",
"0.49641505",
"0.496185",
"0.49588978",
"0.49... | 0.0 | -1 |
Setup and validate dict scenario_base on mandatory keys and default data This function reduces code that constructs dict objects with specific schema (e.g. for API data). | def setup_dict(data, required=None, defaults=None):
required = required or []
for i in set(required) - set(data):
raise IndexError("Missed: %s" % i)
defaults = defaults or {}
for i in set(data) - set(required) - set(defaults):
raise ValueError("Unexpected: %s" % i)
defaults.update(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _populate_default_values(self):\n\n if 'input_data' not in self._definition:\n self._definition['input_data'] = []\n for input_dict in self._definition['input_data']:\n if 'required' not in input_dict:\n input_dict['required'] = True\n\n if 'jobs' not i... | [
"0.5858755",
"0.5646911",
"0.56163937",
"0.5574446",
"0.5519993",
"0.5516067",
"0.550196",
"0.54903513",
"0.54571384",
"0.5441002",
"0.54272586",
"0.54151857",
"0.5350351",
"0.52741444",
"0.52572984",
"0.5242386",
"0.52300185",
"0.5220676",
"0.52078766",
"0.5199672",
"0.51974... | 0.6243914 | 0 |
Assert that getting a bike returns it. | async def test_get_bike(random_bike: Bike):
bike = await get_bike(public_key=random_bike.public_key)
assert bike.id == random_bike.id
bike = await get_bike(identifier=random_bike.identifier)
assert bike.id == random_bike.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_get_bikes(random_bike):\n bikes = await get_bikes()\n assert len(bikes) == 1\n assert bikes[0] == random_bike",
"def test_get_boat(self):\n pass",
"async def test_get_bad_bike(database):\n bike = await get_bike(identifier=-1)\n assert bike is None",
"async def test_create... | [
"0.69448787",
"0.6703809",
"0.65534776",
"0.6424947",
"0.6377852",
"0.59223217",
"0.58450496",
"0.57832056",
"0.5669549",
"0.5644909",
"0.5590874",
"0.55790734",
"0.5574086",
"0.5569098",
"0.5528118",
"0.5508593",
"0.55015194",
"0.5499224",
"0.54817975",
"0.5481557",
"0.54740... | 0.6910581 | 1 |
Assert that create a bike with an invalid hex fails. | async def test_create_bike_bad_value(database, key_name):
with pytest.raises(ValueError):
await register_bike(public_key=key_name, master_key=key_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load__fail_malformed_eth_address():\n with pytest.raises(InvalidAddress):\n ContractHandler._load(\"DTFactory\", \"foo address\")",
"def test_bytes_to_pretty_hexinvalid_data():\n try:\n cmds._bytes_to_pretty_hex(data=[1, 2, 3, 4, \"500\"])\n except Exception:\n # The except... | [
"0.7106048",
"0.7054322",
"0.69543386",
"0.6933626",
"0.68277615",
"0.6793557",
"0.6743283",
"0.67044735",
"0.6690576",
"0.66785383",
"0.6621362",
"0.65353096",
"0.64916945",
"0.6436954",
"0.64224976",
"0.6406973",
"0.6399973",
"0.63674706",
"0.6364785",
"0.6330669",
"0.63257... | 0.665333 | 10 |
unicode representation of Group | def __str__(self):
return str(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return str(self.group)",
"def __str__(self):\n return u\"group_list={self.group_list} bits={self.bits}\"",
"def __repr__(self) -> str:\n\n return f\"{self.group}({self._value})\"",
"def __str__(self):\n\n return 'Group(%s)' % self.id",
"def group(self):\n ... | [
"0.77808905",
"0.7357327",
"0.7221452",
"0.6970862",
"0.6952911",
"0.6952911",
"0.6952911",
"0.6952911",
"0.6897085",
"0.66874313",
"0.66649884",
"0.66041946",
"0.6504264",
"0.64983124",
"0.6495753",
"0.6440248",
"0.63961613",
"0.63453436",
"0.63453436",
"0.6324355",
"0.62862... | 0.0 | -1 |
determines whether or not a User of this Account can do the action | def can(self, permission_code_name):
if permission_code_name in list(self.get_group_permissions().values_list('code_name', flat=True)):
# match against group permissions first for common use case
return True
return permission_code_name in list(self.get_permissions().values_list('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_allow_credit(self):\n try:\n return self.user.creditAllowed()\n except AttributeError:\n return False",
"def current_user_has_access(self):\n return self.user_has_access(users.get_current_user())",
"def has_access(self, user):\n if user.is_superuser:\n ... | [
"0.74372214",
"0.7273594",
"0.7170224",
"0.71608025",
"0.7148393",
"0.7074535",
"0.70059973",
"0.69793934",
"0.6975819",
"0.6955038",
"0.6955038",
"0.6955038",
"0.6950703",
"0.68984866",
"0.687715",
"0.6873293",
"0.6859321",
"0.67539066",
"0.67233586",
"0.6721639",
"0.6708041... | 0.0 | -1 |
Test to can't update a user password. new passwords doesn't match. | def test_invalid_update_user_old_password(self):
data = {
'password': 'password-invalido',
'new_password': 'pedro123456789',
'confirm_password': 'pedro123456789'
}
response = self.client.put(self.url, data)
self.assertEqual(response.status_code, statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_update_user_new_password(self):\n\n data = {\n 'password': 'pedro123456',\n 'new_password': 'pedro12345678',\n 'confirm_password': 'pedro123456789'\n }\n response = self.client.put(self.url, data)\n self.assertEqual(response.status_code,... | [
"0.7983415",
"0.79651874",
"0.7963609",
"0.7887497",
"0.7848595",
"0.78147435",
"0.778068",
"0.7681466",
"0.7669607",
"0.76644236",
"0.765958",
"0.76190203",
"0.76184297",
"0.7612477",
"0.7608431",
"0.75909936",
"0.7579938",
"0.7565815",
"0.7516234",
"0.7504681",
"0.74903953"... | 0.81921446 | 0 |
Test to can't update a user password. new passwords doesn't match. | def test_invalid_update_user_new_password(self):
data = {
'password': 'pedro123456',
'new_password': 'pedro12345678',
'confirm_password': 'pedro123456789'
}
response = self.client.put(self.url, data)
self.assertEqual(response.status_code, status.HTTP_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_update_user_old_password(self):\n\n data = {\n 'password': 'password-invalido',\n 'new_password': 'pedro123456789',\n 'confirm_password': 'pedro123456789'\n }\n response = self.client.put(self.url, data)\n self.assertEqual(response.statu... | [
"0.8193357",
"0.79667825",
"0.79638594",
"0.7889399",
"0.7850176",
"0.7815984",
"0.7782389",
"0.7681744",
"0.76697433",
"0.7665022",
"0.7660172",
"0.7620117",
"0.7620083",
"0.7613825",
"0.7609827",
"0.75919455",
"0.75820667",
"0.7567318",
"0.7516592",
"0.7505318",
"0.7491651"... | 0.7984543 | 1 |
Number of solutions to f(n) == 0 (mod p). | def slow_kp(p, f):
return sum(1 for n in range(p) if f(n) % p == 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(n):\n total = sum(\n [\n i\n for i in range(1, n)\n if sum_of_divisors(sum_of_divisors(i)) == i and sum_of_divisors(i) != i\n ]\n )\n return total",
"def totient(n):\n count = 0\n for i in range(1, n):\n if math.gcd(n, i) == 1:\n ... | [
"0.70655006",
"0.6877559",
"0.6740919",
"0.67151505",
"0.66580844",
"0.65614724",
"0.651559",
"0.6513478",
"0.64731294",
"0.64608306",
"0.64357936",
"0.643374",
"0.64221245",
"0.63285464",
"0.63165265",
"0.6265531",
"0.62590635",
"0.6244213",
"0.62425905",
"0.6232311",
"0.622... | 0.71465284 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81949747",
"0.80953693",
"0.80294114",
"0.8019143",
"0.79937863",
"0.79912597",
"0.7980661",
"0.79754096",
"0.7960909",
"0.79568285",
"0.79377204",
"0.79348296",
"0.7934468",
"0.79314184",
"0.79262596",
"0.792439",
"0.79241437",
"0.79229194",
"0.7922838",
"0.7922132",
"0.7... | 0.78288 | 72 |
Remove Stopwords, Form Bigrams, Trigrams and Lemmatization | def process_words(texts, stop_words=stop_words, allowed_postags=['NOUN', 'ADJ', 'VERB', 'ADV']):
texts = [[word for word in simple_preprocess(str(doc)) if word not in stop_words] for doc in texts]
texts = [bigram_mod[doc] for doc in texts]
texts = [trigram_mod[bigram_mod[doc]] for doc in texts]
text... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def clean_text(text):\n\n lemmizer = WordNetLemmatizer()\n stem... | [
"0.7595077",
"0.7500191",
"0.7484638",
"0.72615594",
"0.7241902",
"0.72376984",
"0.7194509",
"0.7106735",
"0.7103587",
"0.710146",
"0.7077993",
"0.7045015",
"0.69396186",
"0.69222355",
"0.69177824",
"0.6916844",
"0.69064945",
"0.6906475",
"0.6904333",
"0.6877099",
"0.68465155... | 0.7177824 | 7 |
Returns project root folder. | def get_project_root() -> Path:
return Path(__file__).parent.parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_root() -> Path:\n return PROJECT_ROOT",
"def getProjectRootDir():\n return ROOT_DIR",
"def getProjectRootPath():\n rootpath = os.getcwd().split('\\eles')[0]\n return rootpath",
"def get_project_root():\n return Path(__file__).parent.parent",
"def get_project_root():\n retu... | [
"0.8855307",
"0.8816829",
"0.847031",
"0.8462203",
"0.84460264",
"0.84460264",
"0.8425219",
"0.8419815",
"0.83712715",
"0.8356894",
"0.83145547",
"0.8294601",
"0.828788",
"0.8250647",
"0.82296336",
"0.8205302",
"0.81644493",
"0.8087945",
"0.8083112",
"0.80584306",
"0.7945301"... | 0.8488286 | 4 |
Applies the linear layer. | def __call__(self):
norm = F.batch_l2_norm_squared(self.W) ** 0.5
norm_broadcasted = F.broadcast_to(
F.expand_dims(norm, 1), self.W.data.shape)
g_broadcasted = F.broadcast_to(
F.expand_dims(self.g, 1), self.W.data.shape)
return g_broadcasted * self.W / norm_broadc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_final_linear_layer(model_1, model_2):\n data_1 = model_1.weight.data\n data_2 = model_2.weight.data\n\n new_weight = torch.cat((data_1, data_2), dim=1)\n new_bias = model_1.bias + model_2.bias\n\n result_model = torch.nn.Linear(\n model_1.in_features + model_2.in_features, model_1.ou... | [
"0.69687086",
"0.6941232",
"0.6796415",
"0.67366546",
"0.6459044",
"0.6247846",
"0.6246267",
"0.62435764",
"0.62029964",
"0.61661565",
"0.61601895",
"0.6055346",
"0.6045514",
"0.6020693",
"0.5988108",
"0.5977499",
"0.59479916",
"0.5939581",
"0.5923229",
"0.59169745",
"0.59108... | 0.0 | -1 |
Iterate over the Redis list. Return an iterator object which iterates over `RedisEntry` objects. | def iterate(self):
r = open_redis_connection()
pipeline = r.pipeline()
def _lpop():
"""
Pop from the head of the Redis list and get the hash entry.
Convert the pop and hash items to a `Redis<Provider>Entry` instance.
"""
entry_id = r.l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterentries(self):\n for key in self.iterkeys():\n yield self.get(key)",
"def __iter__( self ) :\n\n for entry in self.__entries : yield entry",
"def __iter__(self):\n # This could be as simple as \"return self._getKeyList().__iter__()\"\n # but this performs some ext... | [
"0.66537464",
"0.65887177",
"0.64412",
"0.63896894",
"0.63713086",
"0.63003474",
"0.6276166",
"0.62156427",
"0.6194267",
"0.61857074",
"0.61852896",
"0.6115025",
"0.6076715",
"0.6076561",
"0.6075699",
"0.60683185",
"0.6020738",
"0.60154456",
"0.6000653",
"0.5980367",
"0.59621... | 0.73219883 | 0 |
Create a mock payload object, complete with a mock manifest. | def MockPayload(self):
payload = self.mox.CreateMock(Payload)
payload.is_init = True
payload.manifest = self.mox.CreateMock(
update_metadata_pb2.DeltaArchiveManifest)
return payload | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_mock_message(message_payload: dict):\n mock_msg = Mock()\n mock_msg.sequence = randrange(1000)\n mock_msg.data = dict_to_obj(message_payload)\n json_msg_payload = json.dumps(message_payload)\n mock_msg.data.decode = Mock(return_value=json_msg_payload)\n return mock_msg",
"def generat... | [
"0.70048976",
"0.6402803",
"0.5930173",
"0.5847894",
"0.570927",
"0.569807",
"0.5649773",
"0.56492996",
"0.56390935",
"0.56357956",
"0.56269675",
"0.5623203",
"0.5611006",
"0.56019837",
"0.5545126",
"0.5532804",
"0.551904",
"0.55168694",
"0.5492037",
"0.5483892",
"0.5458499",... | 0.78864783 | 0 |
Tests _CheckMoveOperation(); fails, message contains data. | def testCheckMoveOperation_FailContainsData(self):
payload_checker = checker.PayloadChecker(self.MockPayload())
op = update_metadata_pb2.InstallOperation()
op.type = common.OpType.MOVE
self.AddToMessage(op.src_extents,
self.NewExtentList((1, 4), (12, 2), (1024, 128)))
self.Add... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testCheckMoveOperation_Pass(self):\n payload_checker = checker.PayloadChecker(self.MockPayload())\n op = update_metadata_pb2.InstallOperation()\n op.type = common.OpType.MOVE\n\n self.AddToMessage(op.src_extents,\n self.NewExtentList((1, 4), (12, 2), (1024, 128)))\n self.Add... | [
"0.7758434",
"0.76411545",
"0.7062338",
"0.7060533",
"0.7058069",
"0.6976999",
"0.69583255",
"0.6894037",
"0.68518645",
"0.684129",
"0.6839393",
"0.6718823",
"0.6708071",
"0.6655014",
"0.6650239",
"0.6649008",
"0.66394913",
"0.6609969",
"0.6587976",
"0.6579604",
"0.6578088",
... | 0.79383576 | 0 |
Returns True iff the combination of arguments represents a valid test. | def ValidateCheckOperationTest(op_type_name, is_last, allow_signature,
allow_unhashed, fail_src_extents,
fail_dst_extents,
fail_mismatched_data_offset_length,
fail_missing_dst_extents, fail_src_le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_arg(self, muts, arg):\n for mut in muts:\n if arg in mut.args():\n return True\n\n return False",
"def args_is_good(arg_list: list) -> bool:\n usage_msg = (\n \"Usage: python operations.py <number1> <number2>\\n\"\n \"Example:\\n\"\n \"... | [
"0.71368897",
"0.7135595",
"0.7127405",
"0.7082328",
"0.7043354",
"0.6991134",
"0.68135446",
"0.67253405",
"0.67212677",
"0.66865754",
"0.66599077",
"0.66532934",
"0.66231203",
"0.657325",
"0.6531221",
"0.65269756",
"0.65009314",
"0.6458926",
"0.6435036",
"0.63602054",
"0.633... | 0.0 | -1 |
Set up driver integration support. Start port agent, add port agent cleanup. Start container. Start deploy services. Define agent config, start agent. Start agent client. | def setUp(self):
self._ia_client = None
log.info('Creating driver integration test support:')
log.info('driver uri: %s', DRV_URI)
log.info('device address: %s', DEV_ADDR)
log.info('device port: %s', DEV_PORT)
log.info('log delimiter: %s', DELIM)
log.info('work di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(cls):\n cls.runner = CliRunner()\n cls.agent_name = \"myagent\"\n cls.cwd = os.getcwd()\n cls.t = tempfile.mkdtemp()\n # copy the 'packages' directory in the parent of the agent folder.\n shutil.copytree(Path(CUR_PATH, \"..\", \"packages\"), Path(cls.t, \"package... | [
"0.68984497",
"0.6158165",
"0.60763025",
"0.5999262",
"0.59503216",
"0.5869901",
"0.58481276",
"0.5819691",
"0.5795129",
"0.5716503",
"0.5698307",
"0.5670299",
"0.56568545",
"0.563181",
"0.563124",
"0.56222564",
"0.560018",
"0.55989796",
"0.55889016",
"0.55442876",
"0.5540811... | 0.679234 | 1 |
Generate the OneHot encoded classlabels from an array of integers. For example, if class_number=2 and num_classes=4 then | def one_hot_encoded(class_numbers, num_classes=None):
# Find the number of classes if None is provided.
# Assumes the lowest class-number is zero.
if num_classes is None:
num_classes = np.max(class_numbers) + 1
return np.eye(num_classes, dtype=float)[class_numbers] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_onehot(x,num_labels=7):\n enc = OneHotEncoder(n_values=num_labels)\n return enc.fit_transform(np.array(x).reshape(-1, 1)).toarray()",
"def one_hot_encoding(labels, num_classes=10):\n num_labels = labels.shape[0]\n encoded = np.zeros((num_labels, num_classes))\n encoded[np.arange(num_label... | [
"0.7915557",
"0.78779274",
"0.7824354",
"0.7803814",
"0.7803814",
"0.77992415",
"0.77992415",
"0.7781083",
"0.77659416",
"0.773527",
"0.7733319",
"0.77149636",
"0.76776016",
"0.7661272",
"0.7636502",
"0.7583619",
"0.7564254",
"0.7560411",
"0.75548714",
"0.75425845",
"0.751330... | 0.8247396 | 1 |
Returns a normalized, lemmatized list of tokens from a document by applying segmentation (breaking into sentences), then word/punctuation tokenization, and finally part of speech tagging. It uses the part of speech tags to look up the lemma in WordNet, and returns the lowercase version of all the words, removing stopwo... | def preprocess(document, max_features=150, max_sentence_len=300):
def lemmatize(token, tag):
"""
Converts the tag to a WordNet POS tag, then uses that
tag to perform an accurate WordNet lemmatization.
"""
tag = {
'N': wn.NOUN,
'V': wn.VERB,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_words(document):\n stopwords = set(nltk.corpus.stopwords.words('english'))\n lemmatizer = nltk.stem.wordnet.WordNetLemmatizer()\n for token in document:\n token = token.lower()\n if token in string.punctuation: continue\n if token in stopwords: continue\n yield l... | [
"0.75630015",
"0.7270736",
"0.7252152",
"0.7230738",
"0.72151375",
"0.7176637",
"0.71682006",
"0.7139235",
"0.7055792",
"0.7027452",
"0.69903594",
"0.6979381",
"0.6967844",
"0.6964945",
"0.6962706",
"0.69524884",
"0.69269305",
"0.6926215",
"0.6918609",
"0.69180375",
"0.691043... | 0.68564534 | 23 |
Converts a document into a sequence of indices of length max_sentence_len retaining only max_features unique words | def vectorize(doc, max_features, max_sentence_len):
tokenizer = Tokenizer(num_words=max_features)
tokenizer.fit_on_texts(doc)
doc = tokenizer.texts_to_sequences(doc)
doc_pad = pad_sequences(doc, padding='pre', truncating='pre', maxlen=max_sentence_len)
return np.squeeze(doc_pad),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(document, max_features=150, max_sentence_len=300):\n\n def lemmatize(token, tag):\n \"\"\"\n Converts the tag to a WordNet POS tag, then uses that\n tag to perform an accurate WordNet lemmatization.\n \"\"\"\n tag = {\n 'N': wn.NOUN,\n 'V':... | [
"0.7347686",
"0.66906524",
"0.66879463",
"0.66773283",
"0.6616259",
"0.6377749",
"0.6239212",
"0.6156842",
"0.61431915",
"0.6138811",
"0.6117403",
"0.6104234",
"0.6089479",
"0.6064191",
"0.60589576",
"0.6044659",
"0.6019716",
"0.6007859",
"0.5989889",
"0.5984744",
"0.59599406... | 0.7391107 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.