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 |
|---|---|---|---|---|---|---|
Setter method for admin_distance, mapped from YANG variable /bgp_state/route/evpn/mac/admin_distance (int32) | def _set_admin_distance(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name="admin-distance", rest_name="admin-distance", parent=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_admin_distance(self):\n return self.__admin_distance",
"def is_admin(self, is_admin: bool):\n if is_admin is None:\n raise ValueError(\"Invalid value for `is_admin`, must not be `None`\") # noqa: E501\n\n self._is_admin = is_admin",
"def is_admin(self, is_admin):\n\n ... | [
"0.7035226",
"0.5679691",
"0.5243161",
"0.5088806",
"0.5064053",
"0.5009725",
"0.4968311",
"0.49410224",
"0.48906347",
"0.4872769",
"0.4828172",
"0.48265433",
"0.4806414",
"0.47296792",
"0.47175312",
"0.4713837",
"0.47084597",
"0.47043973",
"0.46891806",
"0.4676273",
"0.46652... | 0.848713 | 0 |
Getter method for l3_label, mapped from YANG variable /bgp_state/route/evpn/mac/l3_label (int32) | def _get_l3_label(self):
return self.__l3_label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_l3_label(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name=\"l3-label\", rest_name=\"l3-label\", parent=sel... | [
"0.83915883",
"0.5781938",
"0.5475046",
"0.520142",
"0.5200634",
"0.518894",
"0.5181683",
"0.51688933",
"0.5143152",
"0.514129",
"0.5131253",
"0.51141983",
"0.5095959",
"0.50904393",
"0.50888866",
"0.50633866",
"0.50545776",
"0.50535",
"0.5013053",
"0.5012966",
"0.5007337",
... | 0.7572211 | 1 |
Setter method for l3_label, mapped from YANG variable /bgp_state/route/evpn/mac/l3_label (int32) | def _set_l3_label(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name="l3-label", rest_name="l3-label", parent=self, path_helper=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_l3_label(self):\n return self.__l3_label",
"def _set_l2_label(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, ... | [
"0.70971125",
"0.65469706",
"0.5760362",
"0.55529535",
"0.529785",
"0.5284386",
"0.52838194",
"0.5185494",
"0.51587504",
"0.5157344",
"0.51356393",
"0.5106012",
"0.50581807",
"0.50562936",
"0.5053143",
"0.50524807",
"0.50118595",
"0.49925813",
"0.49903148",
"0.49612194",
"0.4... | 0.89856035 | 0 |
Getter method for esi, mapped from YANG variable /bgp_state/route/evpn/mac/esi (string) | def _get_esi(self):
return self.__esi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_esi(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"esi\", rest_name=\"esi\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mg... | [
"0.6438036",
"0.48731652",
"0.47249076",
"0.45993653",
"0.45476517",
"0.45257425",
"0.45001796",
"0.44725043",
"0.4466427",
"0.44617414",
"0.4447378",
"0.44402593",
"0.43799716",
"0.4356439",
"0.4350553",
"0.43357283",
"0.43319207",
"0.43195543",
"0.43034455",
"0.42955282",
"... | 0.62764627 | 1 |
Getter method for mac, mapped from YANG variable /bgp_state/route/evpn/mac/mac (string) | def _get_mac(self):
return self.__mac | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_mac(self, v, load=False):\n parent = getattr(self, \"_parent\", None)\n if parent is not None and load is False:\n raise AttributeError(\"Cannot set keys directly when\" +\n \" within an instantiated list\")\n\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n ... | [
"0.6963544",
"0.6812403",
"0.67475903",
"0.669612",
"0.66622156",
"0.66369957",
"0.6620996",
"0.65639406",
"0.6504258",
"0.64928067",
"0.64632714",
"0.64471436",
"0.64471436",
"0.6406178",
"0.6394177",
"0.63675225",
"0.6351941",
"0.6332047",
"0.63284487",
"0.6324845",
"0.6313... | 0.67939645 | 2 |
Setter method for mac, mapped from YANG variable /bgp_state/route/evpn/mac/mac (string) | def _set_mac(self, v, load=False):
parent = getattr(self, "_parent", None)
if parent is not None and load is False:
raise AttributeError("Cannot set keys directly when" +
" within an instantiated list")
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YAN... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac(self, mac):\n\n self._mac = mac",
"def mac(self):\n mac = hexlify(WLAN().config('mac'), ':').decode()\n return mac.upper() # MAC-address in upper case",
"def mac_address(self):\n if self._mac_address is None:\n expression = expressions.WPA_MAC\n name =... | [
"0.70633817",
"0.6451035",
"0.6415845",
"0.63952243",
"0.636544",
"0.62476975",
"0.6150491",
"0.61077535",
"0.60958034",
"0.6041815",
"0.60208905",
"0.59615165",
"0.5955605",
"0.59532267",
"0.5949985",
"0.59478515",
"0.5947069",
"0.5947069",
"0.5922859",
"0.59133255",
"0.5883... | 0.7617756 | 0 |
Getter method for l2vni, mapped from YANG variable /bgp_state/route/evpn/mac/l2vni (uint32) | def _get_l2vni(self):
return self.__l2vni | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_l2vni(self, v, load=False):\n parent = getattr(self, \"_parent\", None)\n if parent is not None and load is False:\n raise AttributeError(\"Cannot set keys directly when\" +\n \" within an instantiated list\")\n\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\... | [
"0.74583226",
"0.5737369",
"0.49928522",
"0.4815846",
"0.47398567",
"0.47125748",
"0.46796742",
"0.46781385",
"0.4618018",
"0.4590754",
"0.4587778",
"0.4470396",
"0.44310454",
"0.44280466",
"0.44100675",
"0.44089234",
"0.44072032",
"0.4402721",
"0.43970332",
"0.43891013",
"0.... | 0.7143709 | 1 |
the same as the previous function (almost) but without partitioning the dataset into two separate train/val loaders | def get_test_loader(id_list = './data/sample_submission.csv', root_dir = './data/test/'):
data = HumanProteinDataset(id_list, root_dir, transform = transforms.Compose([
Rescale((256, 256)),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_val_loader(train_dataset, val_dataset, val_split=0.1, random_split=False, batch_size=32, num_workers=4, pin_memory=False):\n if val_dataset is not None:\n train_loader = torchutils.DataLoader(\n train_dataset, batch_size=batch_size, shuffle=True,\n num_workers=num_work... | [
"0.74103993",
"0.7326379",
"0.7302729",
"0.7268984",
"0.7262039",
"0.70657194",
"0.70487183",
"0.69832474",
"0.6968116",
"0.6966106",
"0.68997",
"0.6858828",
"0.6858152",
"0.6845753",
"0.68344057",
"0.68067324",
"0.6803335",
"0.6793472",
"0.6779923",
"0.6751903",
"0.67455786"... | 0.0 | -1 |
Compute the pairwise distance between vector x and y | def metric(x, y):
d = 2
summ = []
i = 0
while i < len(x):
# in this case use euclidean distance
summ.append((x[i] - y[i])**d)
i = i + 1
return sum(summ) ** (1 / float(d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairwise_euclidean_distance(x, y):\n m, n = x.size(0), y.size(0)\n dist_mat = torch.pow(x, 2).sum(1, keepdim=True).expand(m, n) + \\\n torch.pow(y, 2).sum(1, keepdim=True).expand(n, m).t() \\\n - 2 * torch.matmul(x, y.t())\n # for numerical stability\n dist_mat = dist_ma... | [
"0.7959089",
"0.7919787",
"0.7887377",
"0.78832746",
"0.78823066",
"0.77322984",
"0.7697263",
"0.7663328",
"0.7622567",
"0.75793624",
"0.75626653",
"0.75529647",
"0.7543478",
"0.7507571",
"0.7493424",
"0.7429117",
"0.7343736",
"0.73437357",
"0.7338723",
"0.7338349",
"0.730621... | 0.0 | -1 |
Retrieves the campaign data of the ad account as a dictionary | def get_campaign_data(ad_account: adaccount.AdAccount) -> {}:
logging.info('get campaign data for account {}'.format(ad_account['account_id']))
campaigns = ad_account.get_campaigns(
fields=['id',
'name',
'adlabels'],
params={'limit': 1000,
'status'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_campaign(self, campaign_id: str) -> dict:\n return self.http_request(\"GET\", f'/campaign/{campaign_id}')",
"def get_adcampaign_detail(self, account_id, campaign_id, date_preset):\n campaign_fields = [\n 'name', 'campaign_status', 'daily_budget', 'lifetime_budget',\n '... | [
"0.74798214",
"0.7270215",
"0.71838593",
"0.7102927",
"0.6910742",
"0.6888167",
"0.67917913",
"0.6656645",
"0.65966827",
"0.6573094",
"0.64368117",
"0.6418411",
"0.6384282",
"0.63074404",
"0.62874997",
"0.6266214",
"0.6226645",
"0.62007195",
"0.61897147",
"0.6093297",
"0.6069... | 0.8140289 | 0 |
Constructs data array which contains also data from the axis | def _data_with_axis(self, axis):
shpl = list(self.data.shape)
if len(shpl) == 2:
shpl[1] += 1
shp = tuple(shpl)
data = numpy.zeros(shp,dtype=self.data.dtype)
data[:,1:] = self.data
data[:,0] = axis.data
elif len(shpl) == 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data():\n return RaggedArray(\n [[0, 1], [1, 2, 3, 4], [], [-1, -2], []]*20, dtype='float64')",
"def augment_data(self,data):\n d = np.empty([data.shape[0]+2,data.shape[1]+2])\n d[1:-1,1:-1] = data\n d[0,1:-1] = data[0,:]\n d[1:-1,0] = data[:,0]\n d[-1,1:-1] = dat... | [
"0.6954867",
"0.69188064",
"0.68539286",
"0.684455",
"0.6809453",
"0.6759577",
"0.6734904",
"0.6650623",
"0.65200347",
"0.64438343",
"0.63718563",
"0.63473487",
"0.6328436",
"0.62681544",
"0.62681544",
"0.62372404",
"0.62372404",
"0.62063354",
"0.6174277",
"0.6140562",
"0.612... | 0.7768123 | 0 |
Returns a list of default commandline flags. | def GetDefaultFlags(self):
return [
'-i', self.ssh_key_file,
'-o', 'UserKnownHostsFile=/dev/null',
'-o', 'CheckHostIP=no',
'-o', 'StrictHostKeyChecking=no',
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_argv():\n\n return ['--quick', # so no config file is loaded\n # Other defaults to minimize side effects on stdout\n '--colors=NoColor', '--no-term-title','--no-banner',\n '--autocall=0']",
"def read_flags():\n return flag_args",
"def _get_flags(args: Sequence[s... | [
"0.740617",
"0.66794264",
"0.66648924",
"0.66379106",
"0.66160214",
"0.65821373",
"0.65794957",
"0.6555721",
"0.6390384",
"0.6366706",
"0.6243162",
"0.6085537",
"0.6068992",
"0.6051399",
"0.59985006",
"0.59657645",
"0.5932578",
"0.59135467",
"0.5878358",
"0.58655524",
"0.5842... | 0.72359943 | 1 |
Encode the timestamp into string representation. | def _strftime(cls, timestamp: typing.Optional[datetime.datetime]) -> typing.Optional[str]:
if not timestamp:
return None
return timestamp.strftime(cls._TSFMT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_timestamp(self, time_obj):\n\n if isinstance(time_obj, (dt.datetime, dt.date, dt.time)):\n return time_obj.strftime(self.timestamp_format)\n else:\n return time_obj",
"def encode(self, timestamp: int) -> int:\n return timestamp",
"def timestamp_str(self,\n ... | [
"0.77683187",
"0.76765305",
"0.7303453",
"0.7222982",
"0.71735287",
"0.6997807",
"0.69902015",
"0.6737596",
"0.6644965",
"0.6533335",
"0.6518069",
"0.6518069",
"0.6497288",
"0.6462049",
"0.64397365",
"0.64397365",
"0.6410246",
"0.6397173",
"0.6389709",
"0.63675267",
"0.636462... | 0.56180626 | 94 |
Get the project of this generation. | def project(self) -> 'prjmod.Level':
return self.lineage.project | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getProject(self):\r\n return self.project",
"def getProject(self):\n return self.project",
"def getProject(self):\n\t\treturn self.__project",
"def get_project(self):\n raise NotImplementedError(\"get_project is not implemented\")",
"def project(self):\n return self._project... | [
"0.8459022",
"0.84283864",
"0.84060997",
"0.8301082",
"0.8256392",
"0.8256392",
"0.8256392",
"0.8256392",
"0.8256392",
"0.8155388",
"0.80494577",
"0.80042017",
"0.80042017",
"0.80042017",
"0.80042017",
"0.80042017",
"0.80042017",
"0.80042017",
"0.80042017",
"0.80042017",
"0.8... | 0.76221853 | 54 |
add (e) to the graph by adding an entry in both directions. if there is already an edge connecting these vertices, the new edge replaces it | def add_edge(self, e):
a, b = e
self[a][b] = e
self[b][a] = e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addEdge(self, e):\n v = e.either()\n w = e.other(v)\n self._validateVertex(v)\n self._validateVertex(w)\n self._adj[v].add(e)\n self._adj[w].add(e)\n self._E += 1",
"def add_edge(self, e):\n v, w = e\n self[v][w] = e\n self[w][v] = e",
"def add_edge(self, edge):\r\... | [
"0.8256848",
"0.8011468",
"0.77001023",
"0.7696952",
"0.7696663",
"0.76689976",
"0.76547",
"0.7597188",
"0.751026",
"0.7485459",
"0.7485459",
"0.74729645",
"0.74144447",
"0.73839235",
"0.73785144",
"0.7367536",
"0.7355265",
"0.73256135",
"0.7320839",
"0.7289511",
"0.7288446",... | 0.81912374 | 1 |
Convert binary string to a float. | def bin_to_float(b):
bf = int_to_bytes(int(b, 2), 8) # 8 bytes needed for IEEE 754 binary64.
return struct.unpack('>d', bf)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def float_from_string(data):\n return float(maybe_number(data))",
"def _string_to_float(s):\n try:\n f = float(s)\n return f\n except ValueError:\n return None",
"def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])",
"def... | [
"0.7611349",
"0.7297061",
"0.7283626",
"0.7211255",
"0.7162156",
"0.7158703",
"0.71040463",
"0.7091765",
"0.70672995",
"0.69594955",
"0.6904782",
"0.6901475",
"0.6892667",
"0.6879177",
"0.68638176",
"0.67756915",
"0.6766792",
"0.6754018",
"0.66947466",
"0.66913944",
"0.669126... | 0.7315557 | 1 |
Changes the maximum sequence length of the transformer input. | def change_max_seq_len(self, n_position):
enc_d_word_vec = self.model.encoder.src_word_emb.weight.shape[1]
dec_d_word_vec = self.model.decoder.tgt_word_emb.weight.shape[1]
self.model.encoder.position_enc = nn.Embedding.from_pretrained(get_sinusoid_encoding_table(n_position, enc_d_word_vec, paddi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_max_sentence_length(self):\n new_max = int(self.set_max_sentence.get())\n cur_min = self.min_sentence_length\n\n if new_max > cur_min:\n self.max_sentence_length = new_max\n else:\n old_max = self.max_sentence_length\n old_max_var = tk.StringVar(... | [
"0.7094483",
"0.70861804",
"0.70861804",
"0.70861804",
"0.70861804",
"0.7075678",
"0.7075678",
"0.7075678",
"0.7018811",
"0.7018684",
"0.68126583",
"0.68126583",
"0.68126583",
"0.68126583",
"0.68126583",
"0.68126583",
"0.68126583",
"0.68126583",
"0.68126583",
"0.68126583",
"0... | 0.6206882 | 49 |
Pads out an array to a large size. ori_array A 2D numpy array. pad_size The number of elements to add to each of the "sides" of the array. The padded 2D numpy array. | def padArray(ori_array, pad_size):
if (pad_size > 0):
[x_size, y_size] = ori_array.shape
lg_array = numpy.ones((x_size+2*pad_size,y_size+2*pad_size))
lg_array[pad_size:(x_size+pad_size),pad_size:(y_size+pad_size)] = ori_array.astype(numpy.float64)
lg_array[0:pad_size,:] = numpy.flipu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pad_simple(array, pad_width, fill_value=None):\n # Allocate grown array\n new_shape = tuple(\n left + size + right\n for size, (left, right) in zip(array.shape, pad_width)\n )\n order = 'F' if array.flags.fnc else 'C' # Fortran and not also C-order\n padded = np.empty(new_shape, ... | [
"0.6460345",
"0.6238403",
"0.61861277",
"0.6095269",
"0.6090862",
"0.60888755",
"0.6087641",
"0.6047931",
"0.604198",
"0.60220504",
"0.6019242",
"0.59746325",
"0.5960745",
"0.5948368",
"0.5938511",
"0.59360707",
"0.59350854",
"0.59166175",
"0.5891437",
"0.5877283",
"0.5843643... | 0.8216594 | 0 |
peak_finder A PeakFinder object. peak_fitter A PeakFitter object. properties Which properties to return, e.g. "x", "y", etc. | def __init__(self, peak_finder = None, peak_fitter = None, properties = None, **kwds):
super(PeakFinderFitter, self).__init__(**kwds)
self.peak_finder = peak_finder
self.peak_fitter = peak_fitter
self.properties = properties
# The properties must include at least 'x' and 'y'.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPeakProperties(self):\n peaks = {}\n for pname in self.properties:\n peaks[pname] = self.peak_fitter.getPeakProperty(pname)\n\n # x,y,z corrections.\n if (pname == \"x\"):\n peaks[pname] -= float(self.peak_finder.margin)\n\n elif (pnam... | [
"0.695204",
"0.6749205",
"0.6444316",
"0.6166085",
"0.61298215",
"0.6098216",
"0.6097876",
"0.5991825",
"0.5964867",
"0.5961722",
"0.5901229",
"0.5693157",
"0.56395674",
"0.56355584",
"0.56012124",
"0.55866766",
"0.55831134",
"0.5548459",
"0.5541811",
"0.55392635",
"0.5527200... | 0.7671931 | 0 |
Return the margin to add to the image for finding/fitting. | def getMargin(self):
assert False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_margin(self):\n _pal.lib.geometry_get_margin.restype = c.c_float\n return _pal.lib.geometry_get_margin(self._geometry)",
"def margin(self):\r\n return self._generate_spacing_info(self.config['margin'])",
"def margin(self) -> Tuple[int, int, int, int]:\n return (self.imargin[... | [
"0.74821776",
"0.74392563",
"0.7304482",
"0.71689236",
"0.6940478",
"0.67452353",
"0.66729534",
"0.6590329",
"0.6561296",
"0.65026",
"0.6280023",
"0.62775594",
"0.626785",
"0.6207382",
"0.61792797",
"0.61053485",
"0.60813314",
"0.6078401",
"0.6021749",
"0.60151803",
"0.598012... | 0.7197946 | 3 |
Return maximum z position for the PSF in nanometers. | def getZMax(self):
return self.zmax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def z_max(self):\n return self.get_max_value(self.Z_INDEX)",
"def zmax(self):\n # Extract parameters\n pzs = self.params[0]\n return max([pz.zmax for pz in pzs])",
"def zmax(self):\n # Extract parameters\n pzs = self.params[0]\n return max([pz.zmax for pz in pzs... | [
"0.7448265",
"0.7246991",
"0.7246991",
"0.7183903",
"0.66504174",
"0.6402911",
"0.63063383",
"0.6214927",
"0.62002575",
"0.61642313",
"0.6149559",
"0.61111695",
"0.6093739",
"0.6079765",
"0.6060686",
"0.59669477",
"0.59584385",
"0.5946841",
"0.5943993",
"0.59124416",
"0.58788... | 0.74356306 | 1 |
Return the minimum z position for the PSF in nanometers. | def getZMin(self):
return self.zmin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def z_min(self):\n return self.get_min_value(self.Z_INDEX)",
"def find_local_min_x(self, Ns=None):\n if Ns is None:\n Ns = self.num\n with self.fix_evaluator():\n params = np.linspace(0, np.pi, Ns)\n dx_func = lambda param: self.diff(param)[0]\n dx... | [
"0.753644",
"0.6510906",
"0.6315002",
"0.6168882",
"0.61566377",
"0.60720825",
"0.60312086",
"0.6016893",
"0.6014745",
"0.59864134",
"0.5984826",
"0.5980652",
"0.5956168",
"0.5945482",
"0.5922578",
"0.59159184",
"0.58925366",
"0.58721316",
"0.5871364",
"0.58615553",
"0.583937... | 0.7437964 | 1 |
Returns a spreadsheet for processing. | def _get_spreadsheet(i):
path = io_mgr.get_parties_spreadsheet(i)
if not os.path.exists(path):
raise IOError()
return openpyxl.load_workbook(path, read_only=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_spreadsheet(self) -> sc.Spreadsheet:\n\n f, wb = self.to_workbook()\n wb.close() # Close the workbook to flush any xlsxwriter content\n spreadsheet = sc.Spreadsheet(f) # Wrap it in a spreadsheet instance\n return spreadsheet",
"def spreadsheets(self):\r\n return resour... | [
"0.7508088",
"0.70546705",
"0.6989037",
"0.6753166",
"0.66771746",
"0.6397674",
"0.63626623",
"0.6356544",
"0.63145155",
"0.62679905",
"0.62404364",
"0.6226204",
"0.61786735",
"0.6130538",
"0.6080748",
"0.60611695",
"0.60382074",
"0.6012392",
"0.59984195",
"0.598874",
"0.5977... | 0.638951 | 6 |
Return index of x in listy, and None if it doesn't exist | def find(listy, x):
return listy.index(x) if x in listy else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _silent_idx(x, y):\n if y in x:\n return x.index(y) \n else:\n return None",
"def find_at(self, x, y):\n return list(self.ifind_at(x, y))",
"def index(a, x):\n i = bisect_left(a, x)\n if i != len(a) and a[i] == x:\n return i\n raise ValueError",
"def get_index(y... | [
"0.83567804",
"0.67176056",
"0.6712219",
"0.66661775",
"0.66661775",
"0.66381544",
"0.65499777",
"0.6406221",
"0.6258568",
"0.6207031",
"0.6204028",
"0.6141942",
"0.6112859",
"0.61122996",
"0.6099335",
"0.59858006",
"0.5942153",
"0.5941707",
"0.59304327",
"0.59229887",
"0.591... | 0.8659387 | 0 |
Removes image extensions from paths. | def remove_extension(path):
for extension in EXTENSIONS:
path = path.replace(".%s" % extension, "")
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_imgs(path):\n files = os.listdir(path)\n for file in files:\n if file.endswith(\".jpg\"):\n os.remove(os.path.join(path, file))",
"def space_cleaning():\n for file in os.listdir(\".\"):\n if file.endswith(\".png\"):\n os.remove(file)",
"def _remove_dot_from_... | [
"0.6632835",
"0.6574495",
"0.65395063",
"0.6518795",
"0.61967963",
"0.6136677",
"0.6127496",
"0.6116261",
"0.6111247",
"0.60311663",
"0.6030781",
"0.6011465",
"0.60058314",
"0.59735197",
"0.5929311",
"0.5912986",
"0.5827785",
"0.58202034",
"0.5816234",
"0.5813576",
"0.5794071... | 0.75678253 | 0 |
Test that the template name has something. | def test_template_name():
for t in templates:
assert len(t.name) > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_template_name(self, template):\n filename = os.path.join(get_conf('DEFAULT_TEMPLATE_PATH'), template, '__init__.ini')\n if self._check_file_exists(filename) and self._check_access(filename, os.R_OK):\n return True\n else:\n return False",
"def test_do_some_te... | [
"0.71347404",
"0.7088506",
"0.6971249",
"0.6902723",
"0.68294173",
"0.6801981",
"0.6786713",
"0.6785868",
"0.6733738",
"0.6691268",
"0.6662116",
"0.6625422",
"0.66211677",
"0.66208905",
"0.6594956",
"0.65942675",
"0.65342337",
"0.646388",
"0.64468247",
"0.64204335",
"0.640980... | 0.81505466 | 0 |
Constructor method to initialize the cell object | def __init__(self, row=None, column=None, mark=None):
self.row = row
self.column = column
self.occupied = False
self.mark = mark
self.hit_count = 0
self.ship = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, x, y, type, id):\n Cell.__init__(self, x, y, type, id, \"S\")",
"def __init__(self, cells):\n self.cells = cells\n # Used by MakeTableData for layout.\n self.idx = None\n self.group = None\n self.rows_in_group = None\n self.starred = None",
"def __init__(self, width ... | [
"0.7640625",
"0.7637247",
"0.7625675",
"0.7416435",
"0.73724324",
"0.732038",
"0.72490895",
"0.7246748",
"0.72179824",
"0.72103155",
"0.7117393",
"0.7115862",
"0.70671237",
"0.70537144",
"0.7048215",
"0.7029255",
"0.70058274",
"0.69743216",
"0.69638",
"0.6957414",
"0.69477963... | 0.631899 | 77 |
Method to check whether a cell has a destroyed ship or not. | def has_destroyed_ship(self):
if self.mark == constants.DEAD_SHIP_MARK:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_destroyed(self) -> bool:\n return self._coords == self.damaged_cells",
"def hit(self):\n\n self.units.pop()\n return (len(self.units) == 0) # Returns True if the ship has been sunk",
"def shipCollided(self):\n self.shipHealth -= 1\n\n if self.shipHealth > 0:\n s... | [
"0.73538667",
"0.6442408",
"0.63842756",
"0.6360512",
"0.635092",
"0.63366675",
"0.62955135",
"0.6240572",
"0.6236489",
"0.6189574",
"0.6168497",
"0.61454564",
"0.6129832",
"0.6052333",
"0.6047097",
"0.6046595",
"0.6024927",
"0.602376",
"0.6011105",
"0.5969197",
"0.5960932",
... | 0.80303735 | 0 |
Converts a time in minutesandhalves to an integer number of seconds. | def from_minutes_and_halves(s):
s = s.strip()
half = s.endswith("H")
s = s.strip("H ")
return (int(s) * 60 if s else 0) + (30 if half else 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_int(time):\n minutes = time.hour * 60 + time.minute\n seconds = minutes * 60 + time.second\n return seconds",
"def time_to_int(self):\n minutes = self.hour * 60 + self.minute\n seconds = minutes * 60 + self.second\n return seconds",
"def to_seconds(time):\n return 3... | [
"0.84157294",
"0.8202632",
"0.80790406",
"0.7889102",
"0.7819151",
"0.7785367",
"0.7744494",
"0.75738543",
"0.7565239",
"0.7548273",
"0.75057244",
"0.7438854",
"0.7416682",
"0.7411561",
"0.73923975",
"0.72641695",
"0.72484",
"0.7228742",
"0.7207754",
"0.71911055",
"0.71769804... | 0.0 | -1 |
Returns a dictionary mapping the variational form's parameters to randomly sampled values. | def get_param_dict(self, theta):
# create dictionary setting parameters in the feature map to a value corresponding to the random samples
vf_param = list(self.circuit.parameters)
zip_it = zip(vf_param, theta)
param_dict = dict(zip_it)
return param_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_parameters():\n res = dict()\n res[\"population_size\"] = random.randrange(2, 21)\n res[\"mutation_prob\"] = random.choice([0.02, 0.05, 0.10, 0.20, 0.30, 0.40, 0.50])\n res[\"crossover\"] = random.choice([True, False])\n res[\"selection\"] = random.choice([True, False]... | [
"0.7222752",
"0.69664747",
"0.6960328",
"0.67369616",
"0.654479",
"0.65353614",
"0.64399874",
"0.6396368",
"0.63910115",
"0.6367922",
"0.63623846",
"0.62295747",
"0.62271935",
"0.6223884",
"0.62208706",
"0.6204946",
"0.61936307",
"0.61817944",
"0.61411333",
"0.6139908",
"0.61... | 0.6208158 | 15 |
Initialize this neural network. | def __init__(self, num_policies: int, num_layers: int,
hidden_dim: int, learning_rate: float, repetitions: int):
super().__init__()
self.input_size = num_policies * 2
self.num_layers = num_layers
self.hidden_dim = hidden_dim
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, neuron_count):\n # The current state of the thermal network.\n self.current_state = [0.0] * neuron_count\n\n # The weights.\n self.weights = np.zeros( [neuron_count*neuron_count] )\n\n # The neuron count.\n self.neuron_count = neuron_count",
"def __ini... | [
"0.74480855",
"0.737668",
"0.7364146",
"0.73508215",
"0.73390734",
"0.73275644",
"0.7320305",
"0.73163414",
"0.729676",
"0.72839534",
"0.7262423",
"0.72310257",
"0.7211808",
"0.71855086",
"0.7182377",
"0.7174805",
"0.71719444",
"0.7157335",
"0.71380174",
"0.7103189",
"0.70481... | 0.0 | -1 |
Sets the id of this GetUniverseAncestries200Ok. | def id(self, id):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def setID(self, id):\n self._id = id\n return self.callRemote('setID', id)",
"def id... | [
"0.55627495",
"0.556244",
"0.5530395",
"0.539364",
"0.53707707",
"0.5337645",
"0.5337645",
"0.5337645",
"0.5337645",
"0.5337645",
"0.53365433",
"0.53365433",
"0.53365433",
"0.53365433",
"0.53365433",
"0.53365433",
"0.53365433",
"0.53365433",
"0.53365433",
"0.53365433",
"0.533... | 0.0 | -1 |
Sets the name of this GetUniverseAncestries200Ok. | def name(self, name):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name: str) -> None:\n lib.wlr_seat_set_name(self._ptr, name.encode())",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name =... | [
"0.543439",
"0.54118425",
"0.52682024",
"0.52682024",
"0.52682024",
"0.52682024",
"0.52682024",
"0.525187",
"0.52480674",
"0.5232304",
"0.5211759",
"0.5211759",
"0.5175062",
"0.51648355",
"0.51648355",
"0.51648355",
"0.51648355",
"0.516112",
"0.5147719",
"0.5135887",
"0.51286... | 0.0 | -1 |
Sets the bloodline_id of this GetUniverseAncestries200Ok. | def bloodline_id(self, bloodline_id):
if bloodline_id is None:
raise ValueError("Invalid value for `bloodline_id`, must not be `None`") # noqa: E501
self._bloodline_id = bloodline_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blood_group(self, blood_group):\n\n self._blood_group = blood_group",
"def line_item_id(self, line_item_id):\n\n self._line_item_id = line_item_id",
"def player_b_id(self, player_b_id):\n\n self._player_b_id = player_b_id",
"def set_line(self, line, membership):\n self._lines[line... | [
"0.5008046",
"0.4894315",
"0.47884497",
"0.46749923",
"0.46240598",
"0.45920947",
"0.4590707",
"0.45891026",
"0.4559923",
"0.4507638",
"0.44804582",
"0.4452775",
"0.4417231",
"0.44116056",
"0.43656263",
"0.43526465",
"0.43448877",
"0.4331241",
"0.4262733",
"0.4261366",
"0.425... | 0.6813667 | 0 |
Sets the short_description of this GetUniverseAncestries200Ok. | def short_description(self, short_description):
self._short_description = short_description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_description(self, short_description):\n self._short_description = short_description",
"def shortDescription(self):\n return None",
"def short_description(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"short_description\")",
"def short_description(self, short_descripti... | [
"0.613938",
"0.56611496",
"0.55781734",
"0.5508479",
"0.5501185",
"0.5501185",
"0.52354795",
"0.520119",
"0.51488686",
"0.5082632",
"0.5064031",
"0.5059931",
"0.50513244",
"0.50335985",
"0.5029674",
"0.5026287",
"0.5019935",
"0.49796677",
"0.4969308",
"0.4956616",
"0.49438858... | 0.6052721 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, GetUniverseAncestries200Ok):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
displays the home page | def show_home_page():
pet_list = Pet.query.all()
return render_template('index.html', pet_list=pet_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n return render_template('home_page.html')",
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home():\n return render_template('home.html', title=\"Home\")",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n\n\treturn render_template('i... | [
"0.84273356",
"0.8338485",
"0.83180165",
"0.83047885",
"0.8292919",
"0.82712096",
"0.8260174",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",
"0.8221521",... | 0.0 | -1 |
Returns the Squared Loss between Q values currently predicted by the network, and Q_target. | def get_loss(self, states, Q_target):
return nn.SquareLoss(self.run(states), Q_target) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _loss(self, p_y_pred, y_target, q_target, q_context):\n # Log likelihood has shape (batch_size, num_target, y_dim). Take mean\n # over batch and sum over number of targets and dimensions of y\n log_likelihood = p_y_pred.log_prob(y_target).mean(dim=0).sum()\n # KL has shape (batch_si... | [
"0.6680116",
"0.6401714",
"0.6361018",
"0.6225185",
"0.6174637",
"0.6165812",
"0.615276",
"0.6120093",
"0.60753036",
"0.6071159",
"0.60334575",
"0.60066515",
"0.6001974",
"0.5964521",
"0.59473485",
"0.5940789",
"0.59046274",
"0.59021187",
"0.5863922",
"0.5835014",
"0.58275324... | 0.77711356 | 0 |
Return an iterator for n values read from stdin | def readValues(n):
for i in xrange(n):
yield int(raw_input().strip()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_input():\n f = open(INPUT_FILE, 'r')\n \n number_of_lines = int(f.readline())\n for i in range(number_of_lines):\n yield [i+1, f.readline().split()]\n f.close()",
"def readlines(self, n = None):\n\t\tif not self._input: raise PlumberExceptions.PipeTypeException(self)\n\t\tresult = ... | [
"0.70083684",
"0.6911841",
"0.65581214",
"0.6388255",
"0.618351",
"0.61292666",
"0.61286694",
"0.60789806",
"0.60246277",
"0.60153824",
"0.5961255",
"0.59231836",
"0.5872982",
"0.585636",
"0.58443975",
"0.5840999",
"0.58171666",
"0.58077747",
"0.5800548",
"0.5799448",
"0.5766... | 0.79734826 | 1 |
Returns starting state of the board. | def initial_state():
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)",
"def start_state():\n return chess.Board()",
"def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))... | [
"0.80825067",
"0.78919244",
"0.7534521",
"0.72784024",
"0.72784024",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",
"0.72256464",... | 0.0 | -1 |
Returns player who has the next turn on a board. | def player(board):
if board == initial_state():
return X
total_x = 0
total_o = 0
for i in board:
total_x += i.count(X)
total_o += i.count(O)
if (total_x + total_o) % 2 == 1:
return O
else:
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None",
"def next_player(self,board, prev_player):\r\n... | [
"0.79114103",
"0.75227296",
"0.74222565",
"0.7371223",
"0.71971357",
"0.69781494",
"0.69620293",
"0.6927192",
"0.6921247",
"0.6902451",
"0.6849014",
"0.6841733",
"0.6838688",
"0.682715",
"0.6776798",
"0.6776798",
"0.6771467",
"0.6713596",
"0.67088133",
"0.66568995",
"0.661671... | 0.5969825 | 95 |
Returns the optimal action for the current player on the board. | def minimax(board):
if terminal(board):
return None
action_x = []
value_x = []
action_y = []
value_y = []
def max_value(board):
v = -float('inf')
if terminal(board):
return utility(board)
for action in actions(board):
v = max(v, min_val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction",
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min... | [
"0.7766856",
"0.76323676",
"0.75855315",
"0.75285065",
"0.75175256",
"0.74667144",
"0.7460485",
"0.74263537",
"0.7416421",
"0.73943585",
"0.7375846",
"0.7333894",
"0.73147565",
"0.7306611",
"0.7284639",
"0.72650313",
"0.72650313",
"0.7250975",
"0.72331834",
"0.7203267",
"0.71... | 0.0 | -1 |
The application should never directly report who the admin is. This method reports if the current authenticated user is the admin. | def get_is_admin(self, obj):
try:
user = self.context.get('request').user
except Exception:
# raise serializers.ValidationError('Could not access request.user')
return False
if user == obj.admin:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self):\n if not self.current_user:\n return False\n else:\n return self.current_user in [\"1\"]",
"def is_admin(self):\r\n return self.admin",
"def is_admin(self):\n return self.admin",
"def is_admin_user(self):\n if \"is_admin\" in self._... | [
"0.8340453",
"0.82293767",
"0.8200761",
"0.8184014",
"0.8165293",
"0.8111697",
"0.8074325",
"0.8023838",
"0.8012995",
"0.8012995",
"0.7999914",
"0.7975382",
"0.7925982",
"0.7920057",
"0.7899573",
"0.7829601",
"0.78175044",
"0.7813338",
"0.779548",
"0.7750622",
"0.77310234",
... | 0.781479 | 17 |
Takes as input the current state and outputs an augmented state Augmented state = [x_k u_k1 x_k1 ...] (MUST BE FLAT!) The state is then fed in the action, giving the next action u_k, which then updates the augmented state It is important to average down from the memory size to the output size Each output tensor will co... | def __init__(self, state_size, action_size, memory_size=40, output_size=11):
self.memory_size = memory_size
self.output_size = output_size
self.action_size = action_size
self.state_size = state_size
self.output_len = output_size * state_size + (output_size-1) * action_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, state): \n self.last_state = state \n state_array, action_array = self.average()\n\n state_array = np.append(state.cpu().numpy(), state_array).astype(np.float32)\n action_array = np.append([], action_array).astype(np.float32)\n\n augmented_state = np.appe... | [
"0.7188881",
"0.7175103",
"0.6422392",
"0.64140266",
"0.63504654",
"0.6272626",
"0.6234533",
"0.6232153",
"0.62184453",
"0.62008435",
"0.611963",
"0.611963",
"0.61001074",
"0.6095984",
"0.60957515",
"0.60509706",
"0.60399306",
"0.5975184",
"0.5956459",
"0.59530383",
"0.595125... | 0.6785837 | 2 |
Return the last data value for this key, or [] if it's an empty list; raises KeyError if not found. | def __getitem__(self, key):
list_ = dict.__getitem__(self, key)
try:
return list_[-1]
except IndexError:
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getlast(self, key, default=None):\n \n values = self.getlist(key)\n return values[-1] if values else default",
"def __getitem__ (self, key):\n if not self.data.has_key(key):\n return []\n else:\n return self.data[key]",
"def get(self, k, default=None... | [
"0.76607096",
"0.6740562",
"0.6687297",
"0.63893616",
"0.6354344",
"0.63419735",
"0.63393205",
"0.622576",
"0.62249166",
"0.6201697",
"0.6134014",
"0.6133728",
"0.6099361",
"0.6090145",
"0.60838026",
"0.6083797",
"0.6073274",
"0.60474706",
"0.6022747",
"0.6000882",
"0.5989406... | 0.72470164 | 1 |
Return a list of (key, value) pairs, where value is the last item in the list associated with the key. | def items(self):
return [(key, self[key]) for key in self.keys()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getlast(self, key, default=None):\n \n values = self.getlist(key)\n return values[-1] if values else default",
"def __getitem__(self, key):\n list_ = dict.__getitem__(self, key)\n try:\n return list_[-1]\n except IndexError:\n return []",
"def... | [
"0.6581079",
"0.64002573",
"0.61846876",
"0.6175821",
"0.60306066",
"0.59634405",
"0.5883523",
"0.5826571",
"0.5821172",
"0.581535",
"0.5776787",
"0.5776787",
"0.57693726",
"0.5759618",
"0.5749633",
"0.5742428",
"0.57389444",
"0.5714732",
"0.5672345",
"0.56674993",
"0.5657259... | 0.5639779 | 21 |
Return a list of (key, list) pairs. | def lists(self):
return dict.items(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_list(dict):\n list = []\n for key in dict:\n list.append(key)\n return list",
"def to_list(self) -> List[Tuple[keyType, valueType]]:\n key_count, value_count = self.size()\n if (key_count == 0) and (value_count == 0):\n return []\n keys = [] # type: List[k... | [
"0.75286436",
"0.70711476",
"0.706734",
"0.70502084",
"0.70420957",
"0.7037334",
"0.69474477",
"0.6907425",
"0.6881616",
"0.6874674",
"0.6874674",
"0.6852168",
"0.6826466",
"0.6818258",
"0.679182",
"0.67879117",
"0.6781128",
"0.6781128",
"0.6745045",
"0.67025524",
"0.66662866... | 0.66372573 | 25 |
Returns a copy of this object. | def copy(self):
import copy
MultiDict.__setitem__ = dict.__setitem__
cp = copy.deepcopy(self)
MultiDict.__setitem__ = MultiDict._setitem_list
return cp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__copy__()",
"def copy(self):\n return self.__copy__()",
"def copy(self):\n return self.__copy__()",
"def copy(self):\n return self.__copy__()",
"def __copy__(self):\n return self.copy()",
"def copy(self):\n return copy(self)",
"de... | [
"0.90618587",
"0.90618587",
"0.90618587",
"0.90618587",
"0.90363246",
"0.9003144",
"0.9003144",
"0.899227",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
"0.89381063",
... | 0.0 | -1 |
Fixes the trailing slash in an url. If the user requests an container object without an slash it will appends one. Requested an non container object with an traling slash will result in an redirect to the same url without it. the QUERY_STRING won't get lost but post data would. So don't forget the slash problem in your... | def fix_slash(environ, wantslash):
from colubrid.exceptions import HttpMoved
#FIXME
# argh. never did something that supid
# find a better solution for that problem.
url = quote(environ.get('SCRIPT_NAME', ''))
url += quote(environ.get('PATH_INFO', ''))
query = environ.get('QUERY_STRING', '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalise_last_slashes(url_segment):\n return url_segment if not url_segment.endswith(\"/\") else url_segment[:-1]",
"def get_full_path_without_slash(self, request):\n new_path = request.get_full_path()[:-1]\n if settings.DEBUG and request.method in ('POST', 'PUT', 'PATCH'):\n ... | [
"0.6418786",
"0.63428855",
"0.6202414",
"0.5977207",
"0.5905895",
"0.5896143",
"0.5848401",
"0.5799246",
"0.578113",
"0.5763919",
"0.5733415",
"0.5714121",
"0.5606476",
"0.55059355",
"0.5503102",
"0.5493641",
"0.5476705",
"0.5458537",
"0.5446212",
"0.54270905",
"0.54250133",
... | 0.68248594 | 0 |
Gets the label of the AutoStorage account to use in the credentials.json file. | def _get_autostorage_credentials_label():
return 'autostorage_account' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_account_name(self) -> str:\n return pulumi.get(self, \"storage_account_name\")",
"def storage_account(self) -> str:\n return pulumi.get(self, \"storage_account\")",
"def get_azure_storage_account_name(self):\n try:\n account = self.instance_metadata.get_tags()['bkp_s... | [
"0.7202679",
"0.70836556",
"0.6945382",
"0.692499",
"0.692499",
"0.6893106",
"0.6624626",
"0.6624626",
"0.6580496",
"0.65676063",
"0.65478283",
"0.6478101",
"0.6438652",
"0.6438652",
"0.6352361",
"0.6346186",
"0.6346186",
"0.62148565",
"0.6213707",
"0.6208757",
"0.6200348",
... | 0.83873755 | 0 |
Parse json file to sessions | def get_prev_sessions(sessions_path):
result = {}
with open(sessions_path, 'r') as prev_sessions:
try:
sessions = load(prev_sessions)
for record in sessions['skip']:
result[record['ip']] = record['os']
for record in sessions['add']:
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_sessions(self):\n try:\n with open(\"sessions.json\") as file:\n data = json.load(file)\n except:\n data = {}\n\n return data",
"def load_session(path):\n dct = {}\n with open(path, 'r', encoding='utf-8') as f:\n dct = json.load(f)\n... | [
"0.74308985",
"0.7157992",
"0.6577723",
"0.5961422",
"0.59021497",
"0.58744043",
"0.5873925",
"0.5845056",
"0.58321995",
"0.5829582",
"0.58279693",
"0.5738574",
"0.5733757",
"0.56932986",
"0.5673642",
"0.5665678",
"0.56542474",
"0.5637395",
"0.5541343",
"0.55234337",
"0.55203... | 0.6068639 | 3 |
Returns a new byte array with the value increment by 1 | def inc_bytes(a):
out = list(a)
for i in reversed(range(len(out))):
if out[i] == 0xFF:
out[i] = 0
else:
out[i] += 1
break
return bytes(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bytes_increment(b):\n assert isinstance(b, six.binary_type)\n b = bytearray(b) # Used subset of its API is the same on Python 2 and 3.\n for i in range(len(b) - 1, -1, -1):\n if b[i] != 0xff:\n b[i] += 1\n return bytes(b[:i+1])\n return None",
"def increment(self):\n... | [
"0.664725",
"0.6576865",
"0.6350202",
"0.6128536",
"0.60853094",
"0.59910166",
"0.5948776",
"0.5924715",
"0.5904228",
"0.5866007",
"0.5857071",
"0.58046174",
"0.5795092",
"0.5695493",
"0.5645422",
"0.56406915",
"0.5618551",
"0.55242074",
"0.551152",
"0.54960227",
"0.54870826"... | 0.74212205 | 0 |
Determine if a adress POI is within the specified service area. function to see whether a certain household is within the service area of rest. The test criterion is a shapefile containing all places in the city of Amsterdam. Input is x and y coordinates of a house and a list of polygons of service area. If polygon_lis... | def address_in_service_area(x, y, polygon_list=None, subsectie=None):
if polygon_list is None:
polygon_list = load_geodata_containers(subsectie=subsectie)
point = shapely.geometry.Point(float(x), float(y))
for polygon in polygon_list:
if polygon.contains(point):
return True
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInside(point_x, point_y, area_left, area_top, area_width, area_height):\n return (area_left <= point_x < area_left + area_width) and (area_top <= point_y < area_top + area_height)",
"def contains(polygon, point):\n in_hole = functools.reduce(\n lambda P, Q: P and Q,\n [inter... | [
"0.60924816",
"0.57769156",
"0.5754702",
"0.57249343",
"0.5721033",
"0.5711726",
"0.56726533",
"0.56571084",
"0.5651622",
"0.5651145",
"0.5640821",
"0.5617309",
"0.5589282",
"0.5576596",
"0.55749345",
"0.5539769",
"0.55323017",
"0.5528735",
"0.5515898",
"0.54999673",
"0.54966... | 0.7839224 | 0 |
Shift weight state initialization. | def __init__(self, motion, **kwargs):
super(ShiftWeight, self).__init__(motion) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weight(self):\n init_bn(self.norm0)",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)\n # Tie weights if needed\n self.tie_weights()",
"def init_weights(self, init_w=3e-3):\n self.l3.weight.data.uniform_(-init_w, init_w)\n ... | [
"0.6814883",
"0.67846644",
"0.67426896",
"0.67426896",
"0.6694248",
"0.6670333",
"0.661398",
"0.6610446",
"0.6610446",
"0.66008544",
"0.65538216",
"0.6542686",
"0.6479568",
"0.6479568",
"0.6479568",
"0.6467896",
"0.64614636",
"0.64555013",
"0.6453663",
"0.6453476",
"0.6432352... | 0.66523 | 6 |
Divide all RGB values by 255. | def _normalize_color(color):
return [c / 255.0 for c in color] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RGB255(RGB):\r\n return [round((RGB[0]*255), 2),\r\n round((RGB[1]*255), 2),\r\n round((RGB[2]*255), 2)]",
"def brighten(rgb, factor):\n return [min(255, int(round(factor * c))) for c in rgb]",
"def normalise(self):\n return self.map_channels(lambda component: float(compo... | [
"0.6586282",
"0.6556963",
"0.6442884",
"0.6397133",
"0.6396577",
"0.6394547",
"0.6362969",
"0.63608295",
"0.63585067",
"0.6346164",
"0.62541634",
"0.6236677",
"0.62055653",
"0.6196871",
"0.6182541",
"0.61518097",
"0.61449003",
"0.6133639",
"0.6123531",
"0.6116145",
"0.6102723... | 0.63448685 | 10 |
Calculate distance in HLS color space between Hue components of 2 colors | def _color_distance(first_color: list, second_color: list) -> float:
first_color_hls = colorsys.rgb_to_hls(*_normalize_color(first_color))
second_color_hls = colorsys.rgb_to_hls(*_normalize_color(second_color))
hue_distance = min(
abs(first_color_hls[0] - second_color_hls[0]),
1 - abs(first_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_distance(color1, color2):\n dist_h = color1[0] - color2[0]\n dist_s = color1[1] - color2[1]\n dist_v = color1[2] - color2[2]\n\n return sqrt(dist_h * dist_h + dist_s * dist_s + dist_v * dist_v)",
"def calc_color_distance(rgb1, rgb2):\n\n color1_rgb = sRGBColor(rgb1[0], rgb1[1], rgb1[2])\... | [
"0.78177077",
"0.74043524",
"0.73791105",
"0.73657477",
"0.731713",
"0.7142365",
"0.70769227",
"0.6976936",
"0.6909379",
"0.6849337",
"0.6838533",
"0.6518623",
"0.6508475",
"0.64364517",
"0.64090025",
"0.6251404",
"0.6089996",
"0.6031608",
"0.6027131",
"0.6021125",
"0.5949991... | 0.819869 | 0 |
Plot training loss over the 3 repeats for DMSO | def losses_repeats():
paths = [os.path.join(path_to_here, '../data/landscape_visualizations/DMSO/original/*'),
os.path.join(path_to_here, '../data/landscape_visualizations/DMSO/repeat_a/*'),
os.path.join(path_to_here, '../data/landscape_visualizations/DMSO/repeat_b/*')]
fig = plt.figur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_loss(stats):\r\n plt.plot(stats['train_loss_ind'], stats['train_loss'], label='Training loss')\r\n plt.plot(stats['val_loss_ind'], stats['val_loss'], label='Validation loss')\r\n plt.legend()\r\n plt.xlabel('Number of iterations')\r\n plt.ylabel('Loss')\r\n plt.show()",
"def plot_loss(... | [
"0.7457981",
"0.74050486",
"0.73433083",
"0.727126",
"0.7261747",
"0.69767016",
"0.69755757",
"0.69523245",
"0.6899693",
"0.6893466",
"0.68595153",
"0.6774496",
"0.67576045",
"0.67500454",
"0.67237324",
"0.6695659",
"0.66804385",
"0.6678503",
"0.6666483",
"0.66584903",
"0.665... | 0.680145 | 11 |
Policy Iteration Algorithm. Iteratively evaluates and improves a policy until an optimal policy is found. | def policy_iter_v(env, policy_eval_v=policy_eval_v, discount_factor=1.0):
# Start with a random policy
policy = np.ones([env.nS, env.nA]) / env.nA
policy_stable = False
while not policy_stable:
V = policy_eval_v(policy, env, discount_factor=discount_factor)
policy_stable = True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policyIteration(P,R,gamma,theta,initial_policy,max_iter=1000000):\n policy_stable = False\n policy = np.copy(initial_policy)\n num_iter = 0\n \n while (not policy_stable) and num_iter < max_iter:\n num_iter += 1\n print('Policy Iteration: ', num_iter)\n # policy evaluation\n... | [
"0.78322613",
"0.76458544",
"0.76105034",
"0.75934285",
"0.74304587",
"0.7279287",
"0.70324534",
"0.6979689",
"0.6894392",
"0.68478245",
"0.68441045",
"0.6839532",
"0.6834337",
"0.6767179",
"0.6763606",
"0.6676275",
"0.66043675",
"0.65563804",
"0.65328753",
"0.6525436",
"0.64... | 0.70010376 | 7 |
we want to calculate the padding such that y.shape = x.shape for y = layer(x) output_height = input_height + 2padding_height kernel_height +1 (assuming stride=1) output_width = input_width + 2padding_width kernel_width + 1 (assuming stride=1) we want output_height = input_height and output_width = input_width. Therefor... | def __calc_padding(self, input_shape, kernel_size, stride=1):
# default of pytorch for input_size = (C_in, H_in, W_in)
if len(input_shape) == 3:
if stride != (1,1):
raise ValueError("calc padding only works for stride=(1,1)")
padding = (0,0)
if kernel_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_padding(kernel_size, stride, dilation):\n return -((-kernel_size - (kernel_size - 1) * (dilation - 1)) // stride + 1) // 2",
"def hook(module, input):\n image_dimensions = input[0].size()[-2:]\n module.padding = _determine_padding_from_tf_same(image_dimensions, kernel_size, stride)",
... | [
"0.76626575",
"0.7321163",
"0.7197608",
"0.708562",
"0.7051485",
"0.70154095",
"0.7010198",
"0.6976139",
"0.6956503",
"0.6887719",
"0.683962",
"0.68388116",
"0.6809131",
"0.67358273",
"0.67209125",
"0.67181945",
"0.6712474",
"0.6710233",
"0.6702922",
"0.6700733",
"0.6700216",... | 0.77479404 | 0 |
Initialize this stack and push the given items, if any. | def __init__(self, iterable=None):
# Initialize a new linked list to store the items
self.list = LinkedList()
if iterable is not None:
for item in iterable:
self.push(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, items=None):\n self.root = None\n self.size = 0\n if items is not None:\n for item in items:\n self.insert(item)",
"def __init__(self, items=None):\n self.root = None\n if items is not None:\n for item in items:\n ... | [
"0.69392025",
"0.6930629",
"0.6834535",
"0.6790103",
"0.67478544",
"0.66215223",
"0.6531489",
"0.6289256",
"0.6279537",
"0.62618995",
"0.6247543",
"0.6240025",
"0.6232691",
"0.6232691",
"0.6223752",
"0.6184145",
"0.6169956",
"0.6132227",
"0.6101639",
"0.6101488",
"0.6085301",... | 0.0 | -1 |
Return a string representation of this stack. | def __repr__(self):
return 'Stack({} items, top={})'.format(self.length(), self.peek()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return str(self.stack)",
"def __repr__(self):\n return str(self._stack_items)",
"def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"STACK: { \" + \", \".join(data_str) + \" }\"",
"def __str__(self):\n data_str = [str(i) for i in se... | [
"0.875712",
"0.8496123",
"0.83126545",
"0.83126545",
"0.8260822",
"0.821833",
"0.8193683",
"0.81315273",
"0.80790037",
"0.7979116",
"0.7880514",
"0.7880514",
"0.75088024",
"0.7413718",
"0.72869647",
"0.7161716",
"0.71416235",
"0.7118204",
"0.7117414",
"0.7117414",
"0.7117414"... | 0.76325303 | 14 |
Return the number of items in this stack. | def length(self):
return self.list.length() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self): #returns the size or number of items in the stack\n if self.is_empty():\n return 0\n else:\n return self.num_items",
"def size(self):\n return len(self._stack_items)",
"def items_num(self):\n return len(self.items)",
"def it... | [
"0.8947366",
"0.86162454",
"0.8375316",
"0.8325879",
"0.8325879",
"0.83244956",
"0.8303078",
"0.8239616",
"0.8109176",
"0.8082689",
"0.80800056",
"0.80773133",
"0.7993691",
"0.7993691",
"0.7948907",
"0.79432666",
"0.7746773",
"0.7693393",
"0.7693393",
"0.7693393",
"0.7693393"... | 0.7172348 | 64 |
Return the item on the top of this stack without removing it, or None if this stack is empty. | def peek(self):
if self.is_empty():
return None
return self.list.head.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n # Pre:\n # The stack may not be empty.\n # Post:\n # If the stack was empty, None will be returned.\n if self.is_empty:\n return None\n else:\n return self.data_container[0]",
"def top(self): # O(1)\n if... | [
"0.8053813",
"0.80241615",
"0.8007668",
"0.79588395",
"0.7937413",
"0.7834169",
"0.780374",
"0.77540207",
"0.7744664",
"0.77019894",
"0.7701925",
"0.76907986",
"0.76823837",
"0.7677907",
"0.76766515",
"0.7676261",
"0.7676261",
"0.76641786",
"0.7662657",
"0.76471835",
"0.76467... | 0.70650584 | 75 |
Initialize this stack and push the given items, if any. | def __init__(self, iterable=None):
# Initialize a new list (dynamic array) to store the items
self.list = list()
if iterable is not None:
for item in iterable:
self.push(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, items=None):\n self.root = None\n self.size = 0\n if items is not None:\n for item in items:\n self.insert(item)",
"def __init__(self, items=None):\n self.root = None\n if items is not None:\n for item in items:\n ... | [
"0.69388974",
"0.6930818",
"0.68330026",
"0.6789121",
"0.6745846",
"0.66202074",
"0.6530871",
"0.6292553",
"0.62764543",
"0.626445",
"0.6247166",
"0.6238415",
"0.6236083",
"0.6236083",
"0.6223231",
"0.6183762",
"0.61671233",
"0.6131931",
"0.6099847",
"0.60993683",
"0.6082777"... | 0.5897514 | 34 |
Return a string representation of this stack. | def __repr__(self):
return 'Stack({} items, top={})'.format(self.length(), self.peek()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return str(self.stack)",
"def __repr__(self):\n return str(self._stack_items)",
"def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"STACK: { \" + \", \".join(data_str) + \" }\"",
"def __str__(self):\n data_str = [str(i) for i in se... | [
"0.875712",
"0.8496123",
"0.83126545",
"0.83126545",
"0.8260822",
"0.821833",
"0.8193683",
"0.81315273",
"0.80790037",
"0.7979116",
"0.7880514",
"0.7880514",
"0.75088024",
"0.7413718",
"0.72869647",
"0.7161716",
"0.71416235",
"0.7118204",
"0.7117414",
"0.7117414",
"0.7117414"... | 0.76325303 | 15 |
Return the number of items in this stack. | def length(self):
return len(self.list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self): #returns the size or number of items in the stack\n if self.is_empty():\n return 0\n else:\n return self.num_items",
"def size(self):\n return len(self._stack_items)",
"def items_num(self):\n return len(self.items)",
"def it... | [
"0.8946225",
"0.8613611",
"0.837812",
"0.83287156",
"0.83287156",
"0.83271325",
"0.8301425",
"0.82427084",
"0.81060874",
"0.8082052",
"0.80799097",
"0.80795205",
"0.79905564",
"0.79905564",
"0.79511595",
"0.7945412",
"0.7748217",
"0.769481",
"0.769481",
"0.769481",
"0.769481"... | 0.0 | -1 |
Return the item on the top of this stack without removing it, or None if this stack is empty. | def peek(self):
if self.is_empty():
return None
list_length = len(self.list) - 1
return self.list[list_length] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n # Pre:\n # The stack may not be empty.\n # Post:\n # If the stack was empty, None will be returned.\n if self.is_empty:\n return None\n else:\n return self.data_container[0]",
"def top(self): # O(1)\n if... | [
"0.8054806",
"0.8025021",
"0.8009686",
"0.7960299",
"0.7938854",
"0.7835404",
"0.78052527",
"0.77555597",
"0.77463466",
"0.7703465",
"0.77028966",
"0.7692294",
"0.768339",
"0.76781785",
"0.76780415",
"0.7676852",
"0.7676852",
"0.7664764",
"0.76641655",
"0.76483756",
"0.764713... | 0.0 | -1 |
Sets the sample ID. | def id(self, value: str):
self._id = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setSampleId(self, value):\n return self.getDbRecord().setColumnValue(SAMPLE_ID_COLUMN, value)",
"def setID(self, id):\r\n raise NotImplementedError(\"must be implemented in subclass\")",
"def _set_id(self):\n raise NotImplementedError()",
"def _set_id(self, value):\n pass",
... | [
"0.8281432",
"0.6702385",
"0.660846",
"0.65645576",
"0.65269643",
"0.6455361",
"0.6454219",
"0.64475507",
"0.64471686",
"0.63955015",
"0.6380561",
"0.63388795",
"0.63388795",
"0.63388795",
"0.63388795",
"0.63388795",
"0.63388795",
"0.63388795",
"0.63388795",
"0.63388795",
"0.... | 0.0 | -1 |
Gets a writer that writes the same format as this reader reads. Any common options between the reader and writer are copied. | def get_writer(self) -> 'SpectrumWriter':
# Get the writer class
writer_class = self.get_writer_class()
# Get the common options between ourselves and the writer class
common_options = self.get_common_options(writer_class)
# Get the options sub-list corresponding to those optio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_writer(self):\n return self.writer",
"def get_writer(fn, samples):\n if is_bed(fn):\n return BedWriter(fn, samples)\n elif is_vcf(fn):\n return VcfWriter(fn, samples)\n else:\n raise ValueError(\"Could not get reader for %s\" % fn)",
"def writer(self):\n retu... | [
"0.6598818",
"0.6569548",
"0.6349664",
"0.6074876",
"0.5650704",
"0.56017554",
"0.55681425",
"0.5419384",
"0.5414107",
"0.5212463",
"0.51979506",
"0.51595885",
"0.51360756",
"0.5062754",
"0.5007139",
"0.4971488",
"0.49403208",
"0.4939057",
"0.48842028",
"0.4823712",
"0.479807... | 0.72911686 | 0 |
Gets a reader that reads the same format as this writer writes. Any common options between the reader and writer are copied. | def get_reader(self) -> SpectrumReader:
# Get the reader class
reader_class = self.get_reader_class()
# Get the common options between ourselves and the reader class
common_options = self.get_common_options(reader_class)
# Get the options sub-list corresponding to those options... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reader(self):\n\n return self._reader",
"def reader(self):\n return self._r",
"def get_writer(fn, samples):\n if is_bed(fn):\n return BedWriter(fn, samples)\n elif is_vcf(fn):\n return VcfWriter(fn, samples)\n else:\n raise ValueError(\"Could not get reader for %... | [
"0.6180682",
"0.61681384",
"0.59333414",
"0.5717509",
"0.5630187",
"0.5630092",
"0.5416142",
"0.53299123",
"0.53185266",
"0.5316401",
"0.5315081",
"0.5284894",
"0.5094372",
"0.50838363",
"0.50801265",
"0.5064711",
"0.5054141",
"0.4997511",
"0.49943015",
"0.48969626",
"0.48958... | 0.714092 | 0 |
Select several files from a file dialog to create entries | def load_batch(self, request, *args, **kwargs):
try:
# get a list of the files in the associated path
base_path = self.request.user.profile.Window_path
file_list = listdir(base_path)
# include only csv files
file_list = [el[:-4].replace('BF_', '') for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectFiles(self):\n\n filenames = []\n self.fileIDs = \"\"\n self.caseIDs = \"\" # clears any case selections\n cur = self.settings['conn'].cursor()\n cur.execute(\"select id, name, status from source\")\n result = cur.fetchall()\n for row in result:\n ... | [
"0.7737599",
"0.72902584",
"0.7160352",
"0.7138926",
"0.7086406",
"0.70838773",
"0.6933529",
"0.69325805",
"0.69195807",
"0.6869528",
"0.6867541",
"0.6862612",
"0.68321353",
"0.6814722",
"0.6790414",
"0.67435807",
"0.6723224",
"0.66985244",
"0.6696358",
"0.669432",
"0.6690398... | 0.0 | -1 |
Select several files from a file dialog to create entries | def load_batch(self, request, *args, **kwargs):
try:
# get a list of the files in the associated path
base_path = self.request.user.profile.VideoExperiment_path
file_list = listdir(base_path)
# include only csv files
file_list = [el[:-4] for el in file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectFiles(self):\n\n filenames = []\n self.fileIDs = \"\"\n self.caseIDs = \"\" # clears any case selections\n cur = self.settings['conn'].cursor()\n cur.execute(\"select id, name, status from source\")\n result = cur.fetchall()\n for row in result:\n ... | [
"0.7737599",
"0.72902584",
"0.7160352",
"0.7138926",
"0.7086406",
"0.70838773",
"0.6933529",
"0.69325805",
"0.69195807",
"0.6869528",
"0.6867541",
"0.6862612",
"0.68321353",
"0.6814722",
"0.6790414",
"0.67435807",
"0.6723224",
"0.66985244",
"0.6696358",
"0.669432",
"0.6690398... | 0.0 | -1 |
Returns a list of SSARegiters that occur in the condition Eliminate multiple occurences in the list | def getRegisters(self):
if( self.cond == CT.NOT ):
return self.right.getRegisters()
elif( not isLogicalConst(self.cond) ):
return list(set( self.left.getRegisters() + self.right.getRegisters()))
else:
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeDuplicates(self,covariateList,bands):\n\t\t\n\t\treturn [elem for elem in covariateList if elem not in bands]",
"def remove_sgons(s_value, candidates):\n return list(filter(lambda x: x.s != s_value,\n candidates))",
"def __eliminate_unused_constraits (self, objects):\... | [
"0.6078199",
"0.57260597",
"0.53996664",
"0.5322587",
"0.52900314",
"0.52651197",
"0.52523637",
"0.52479714",
"0.52405554",
"0.52369726",
"0.52259946",
"0.5225879",
"0.52059466",
"0.5204199",
"0.5187568",
"0.5175596",
"0.5135529",
"0.5114134",
"0.5089442",
"0.5085531",
"0.507... | 0.51597315 | 16 |
Get Network this subnet resides in. | def get_network(self):
return self._network | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_network(self):\n return self.get_ip_network()[-1]",
"def network(self):\n address = unicode(\"%s/%s\" % (self.address, _get_cidr(self.netmask)))\n return IPv4Network(address, strict=False)",
"def net(self):\n if self._net is None:\n self._net = Net(name=self.name)... | [
"0.7883652",
"0.74223965",
"0.7255603",
"0.7076776",
"0.7072443",
"0.7072443",
"0.7072443",
"0.70173717",
"0.6982723",
"0.69730806",
"0.694434",
"0.68964154",
"0.68476284",
"0.66096103",
"0.66078997",
"0.652712",
"0.6525104",
"0.6503161",
"0.6503149",
"0.6484874",
"0.64641154... | 0.75860316 | 1 |
Get a list of subnet's nodes | def nodes(self):
return list(self._nodes_dict.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNodes(self):\n nodes = [{\"address\": \"http://0.0.0.0:100\"}\n ,{\"address\": \"http://0.0.0.0:200\"}\n ,{\"address\": \"http://0.0.0.0:300\"}\n ,{\"address\": \"http://0.0.0.0:400\"}\n ,{\"address\": \"http://0.0.0.0:500\"}]\n retur... | [
"0.72508055",
"0.6962399",
"0.69609004",
"0.6843213",
"0.67449564",
"0.6712943",
"0.6711037",
"0.670919",
"0.6701422",
"0.66980886",
"0.66857165",
"0.6683568",
"0.6674321",
"0.6636246",
"0.65806174",
"0.6553158",
"0.6516284",
"0.65005547",
"0.64611864",
"0.6457594",
"0.645547... | 0.61389923 | 57 |
Generates a grid of normalized ([1,1]) pixel coordinates (size [BxHxWx2]) that torch.functional.grid_sample uses as input. | def inverse_warp(self, x, depth, pose, intrinsics, intrinsics_inv):
B, C, H, W = x.size()
cam_coords = self.pixel2cam(depth, intrinsics_inv)
proj_cam_to_src_pixel = intrinsics.bmm(pose)
src_pixel_coords = self.cam2pixel(cam_coords, proj_cam_to_src_pixel)
#grid = F.affine_grid(the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid_image(output):\n grid = []\n for data in output:\n grid += [make_grid(data, nrow=5, normalize=True)]\n return grid",
"def test_ndc_to_grid_sample_coords(self):\n\n # square image tests\n image_size_square = [100, 100]\n xy_ndc_gs_square = torch.FloatTensor(\n ... | [
"0.68826586",
"0.6687754",
"0.6547037",
"0.65385073",
"0.6486837",
"0.6473468",
"0.64434713",
"0.64080536",
"0.64071184",
"0.64060676",
"0.6402653",
"0.6402266",
"0.63696736",
"0.63366175",
"0.63288856",
"0.6306623",
"0.6305968",
"0.62281466",
"0.6218799",
"0.62081283",
"0.62... | 0.0 | -1 |
Converts the image grid into an array of camera coordinates (x,y,z) values for all pixels in the image) using the camera intrinsics and depth. | def pixel2cam(self, depth, intrinsics_inv):
b, _, h, w = depth.size()
i_range = torch.arange(0, h).view(1, h, 1).expand(1,h,w).type_as(depth) # [1, H, W]
j_range = torch.arange(0, w).view(1, 1, w).expand(1,h,w).type_as(depth) # [1, H, W]
ones = torch.ones(1,h,w).type_as(depth)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camera_transform(image):\n img = np.zeros((image.shape[0], image.shape[1], 3))\n for y in range(image.shape[0]):\n for x in range(image.shape[1]):\n img[y][x] = (x - 320) / 575.5 * image[y, x], (240 - y) / 575.5 * image[y, x], image[\n y, x]\n return img",
"def pixel... | [
"0.64044404",
"0.63030523",
"0.62749237",
"0.62730753",
"0.6179977",
"0.61652017",
"0.61342776",
"0.6045297",
"0.60191935",
"0.6013613",
"0.6010528",
"0.59713286",
"0.5942632",
"0.59403735",
"0.5901278",
"0.58390576",
"0.583143",
"0.5805119",
"0.5801704",
"0.5800298",
"0.5750... | 0.6911614 | 0 |
r""" >>> lines = ['hello\n', 'world\n'] >>> _index_to_row_col(lines, 0) (0, 0) >>> _index_to_row_col(lines, 7) (1, 1) | def _index_to_row_col(lines, index):
if index < 0:
raise IndexError('negative index')
current_index = 0
for line_number, line in enumerate(lines):
line_length = len(line)
if current_index + line_length > index:
return line_number, index - current_index
current_ind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_row_col_index(index):\n row_col = [0, 0]\n while index >= len(INDEXES):\n index -= len(INDEXES)\n row_col[0] += 1\n row_col[1] = index\n\n return row_col",
"def find_column(text, index):\n\n last_cr = text.rfind(\"\\n\", 0, index)\n if last_cr < 0:\n last_cr = 0\n ... | [
"0.7309166",
"0.7235375",
"0.6954243",
"0.67495805",
"0.6640308",
"0.6428252",
"0.6380165",
"0.63663054",
"0.6233662",
"0.6228951",
"0.6220717",
"0.6215055",
"0.61694103",
"0.6158954",
"0.6131605",
"0.61313546",
"0.6127463",
"0.61019605",
"0.60691047",
"0.6049448",
"0.6018372... | 0.80457765 | 0 |
Sum over last axis for the use in generalized ufuncs. `np.sum` is more accurate over the fast axis, so we ensure the array to be ccontiguous. | def _gu_sum(a, **kwds):
return np.sum(np.ascontiguousarray(a), axis=-1, **kwds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(input, axis=None, dtype=None, keepdims=False, acc_dtype=None):\r\n\r\n out = elemwise.Sum(axis=axis, dtype=dtype, acc_dtype=acc_dtype)(input)\r\n\r\n if keepdims:\r\n out = makeKeepDims(input, out, axis)\r\n return out",
"def sum(self, axis=None, keepdims=False, dtype=None, out=None):\n ... | [
"0.67738503",
"0.66302085",
"0.6468734",
"0.6465741",
"0.64534724",
"0.64149743",
"0.6343834",
"0.6304383",
"0.6302121",
"0.626876",
"0.6225772",
"0.6156275",
"0.6087346",
"0.6049844",
"0.5979643",
"0.59518576",
"0.5916043",
"0.5884902",
"0.58529425",
"0.5838191",
"0.5825377"... | 0.81620055 | 0 |
Return last received timestamp from Platform. If the device didn't connect at least once, then this will return None. | def request_timestamp(self) -> Optional[int]:
if self.last_platform_timestamp is None:
self.logger.warning("No timestamp available yet, will return None")
if not self.connectivity_service.is_connected():
self.logger.warning("Not connected, not requesting new time")
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lasttime(self):\n if hasattr(self, \"_lasttime\"):\n return self._lasttime\n else:\n return None",
"def get_last_timestamp(self):\n return self._frame_timestamp",
"def last_timestamp(self):\n return self._last_timestamp",
"def get_last_timestamp(self, sym... | [
"0.7128037",
"0.7068101",
"0.6788683",
"0.6762326",
"0.67308927",
"0.67082524",
"0.66656977",
"0.6648795",
"0.663978",
"0.6618066",
"0.6585973",
"0.65769273",
"0.6554507",
"0.6545569",
"0.6544824",
"0.65433437",
"0.65433437",
"0.65433437",
"0.65433437",
"0.65433437",
"0.65433... | 0.77236396 | 0 |
Function that takes the label of a field and tries to generate a unique name for it. The 'max_tries' parameter denotes the maximum number of times the function will try to find unique name. | def generate_field_name(field_class, field_label, max_tries=10000, use_uuid=True):
def field_name_in_use(_field_class, _name):
return _field_class.objects.filter(name=_name).count() > 0
field_name = slugify(field_label)
if not field_name_in_use(field_class, field_name):
return field_name
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_label(orig_label: str) -> str:\n return orig_label[0] + \"l\" + uuid4().hex\n # TODO: check for meteors.",
"def gensym(names=[], prefix='col_', suffix='', n_max_tries=100,\n n_random_chars=4):\n names = set(names)\n\n # Try out without any randomness first\n candidate = prefix... | [
"0.65927714",
"0.6094744",
"0.5982472",
"0.5916453",
"0.58238703",
"0.58186406",
"0.57962704",
"0.57776415",
"0.57660013",
"0.5727337",
"0.5716029",
"0.566636",
"0.5615884",
"0.55871224",
"0.5561317",
"0.5554275",
"0.55523413",
"0.55001104",
"0.5490314",
"0.54828864",
"0.5473... | 0.83230233 | 0 |
cv2 resize image data 6 parameter 1,5 is resolution ratio its need /resize_ratio | def resize_raster(self,resize_ratio=0.5):
size=(int(self.width*resize_ratio),int(self.height*resize_ratio))
self.resizedimage=cv2.resize(self.image_nparray,size,interpolation=cv2.INTER_AREA)
self.ResizeGeo=list(self.geotrans)
print('input Geo parameter, :',self.ResizeGeo)
self.R... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(img, ratio=100, size=None, interpolation=None):\n\n def _interpolation_choice(interpolation):\n if interpolation is None: # Set a default\n if size is not None:\n if (ratio >= 100) or (size[0] >= img.shape[0]) or (size[1] >= img.shape[1]):\n ... | [
"0.7333853",
"0.72153926",
"0.7214746",
"0.7195882",
"0.7146677",
"0.7080156",
"0.706978",
"0.69925046",
"0.698775",
"0.69782764",
"0.69402045",
"0.69271636",
"0.6884302",
"0.6855037",
"0.68314564",
"0.6826592",
"0.67938393",
"0.6764221",
"0.6757841",
"0.6738867",
"0.67298174... | 0.7144234 | 5 |
Sets the description for this snapshot | def setDescription(self, description):
url = G.api + self.testId + '/snapshots/' + self.hash
self.info = requests.put(url, auth=(G.username, G.authkey), data={'description':description}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\r\n self.__description = description",
"def set_description(self, description):\n self.__description = description",
"def set_description(self, desc: str) -> None:\n self.metadata.data[\"description\"] = desc",
"def set_description(self, descriptio... | [
"0.8178489",
"0.8166039",
"0.8151963",
"0.8110133",
"0.80903465",
"0.7966108",
"0.7958749",
"0.7958749",
"0.7958749",
"0.7958749",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
"0.7929554",
... | 0.80518645 | 5 |
add a new transition to the buffer | def add(self, obs_t, action, reward, obs_tp1, done, info):
assert self.replay_buffer is not None
# Update current episode buffer
self.episode_transitions.append((obs_t, action, reward, obs_tp1, done, info))
if done:
# Add transitions (and imagined ones) to buffer only when an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storeTransition(self, transition):\n self.buffer.append(transition)",
"def add(self, state, action, reward, next_state, done):\n e = self.transition(state, action, reward, next_state, done)\n self.buffer.append(e)",
"def add(self, transition: Tuple[np.ndarray, ...]) -> Tuple[Any, ...]:... | [
"0.77596265",
"0.7419274",
"0.7304988",
"0.7234456",
"0.70836526",
"0.70348704",
"0.6973781",
"0.68939126",
"0.6768309",
"0.6743578",
"0.67420524",
"0.6680733",
"0.6604713",
"0.65684104",
"0.65420747",
"0.6486401",
"0.64780766",
"0.6453972",
"0.6435826",
"0.6421666",
"0.63925... | 0.6449315 | 18 |
Change billing_owner of this project. | def put(self, user_id):
self.conn = pecan.request.db_conn
self.conn.change_billing_owner(request.context,
project_id=self.project_id,
user_id=user_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def billing(self, billing):\n\n self._billing = billing",
"def set_owner(self, owner):\n self.settings[\"owner\"] = owner",
"def billing_currency(self, billing_currency):\n\n self._billing_currency = billing_currency",
"def change_ownership(obj, userid):\n assert isinstance(userid, st... | [
"0.6588316",
"0.65589374",
"0.6230038",
"0.6171225",
"0.6164178",
"0.6123353",
"0.6012759",
"0.59617716",
"0.5894772",
"0.58250284",
"0.5816487",
"0.5742454",
"0.5721845",
"0.5639005",
"0.560879",
"0.55670285",
"0.554525",
"0.554525",
"0.554525",
"0.554525",
"0.5538901",
"0... | 0.77313393 | 0 |
String representation for this object. | def __repr__(self):
return '<%s "%s" (%s)>' % (self.__class__.__name__, self.name, self._id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self):\n\n\t\treturn str(self)",
"def serialize(self):\n\n return str(self)",
"def as_string(self):\n return self.__repr__()",
"def __str__(self):\n return str(self.serialize())",
"def serialize(self) -> str:\n pass",
"def __repr__(self) -> str:\n return s... | [
"0.8694663",
"0.8648277",
"0.84509367",
"0.84407336",
"0.839939",
"0.83971435",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
"0.83582443",
... | 0.0 | -1 |
Returns the kwargs required to recreate this node. Used by dictize() and dedictize(). Subclasses should add their properties to this dict. | def _kwargs(self):
dict = {"name":self.name}
return dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kwargs (self):\n return copy.deepcopy (self._kwargs)",
"def get_kwargs(self):\n return {}",
"def get_kwargs(d):\n raise NotImplementedError(\"subclass must implement get_kwargs()\")",
"def _kwargs(self):\n dict = DAG._kwargs(self) \n dict[\"inputpaths\"] = self.inputpat... | [
"0.73872286",
"0.7375472",
"0.69844353",
"0.69556576",
"0.6803954",
"0.67796487",
"0.67796487",
"0.66286445",
"0.6624012",
"0.66016495",
"0.65897924",
"0.6584854",
"0.6562319",
"0.65020496",
"0.6439275",
"0.6419872",
"0.63900167",
"0.63759625",
"0.63625294",
"0.63021857",
"0.... | 0.69695336 | 3 |
True if this node is a source ie, has no parents | def isSource(self):
return (len(self.parents()) == 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_if_source(self):\n # titles ending in a parenthetical (usually with date) are generally\n # sources.\n p = re.compile(r'.*\\(.*\\)')\n m = p.match(self.title)\n if self.title in ['Quotes', 'Sourced']:\n self.is_source = False\n return\n ... | [
"0.73631346",
"0.6805475",
"0.65184647",
"0.64943707",
"0.64128876",
"0.63231564",
"0.62935233",
"0.6247751",
"0.62443256",
"0.6207464",
"0.61116487",
"0.6097948",
"0.607261",
"0.6063049",
"0.60139054",
"0.5989732",
"0.5969904",
"0.59312105",
"0.5915522",
"0.58952165",
"0.589... | 0.8728649 | 0 |
Returns the set of all nodes that are in the DAG that contains this node. | def nodes(self, visited=None):
if (not visited):
visited = set()
if (self not in visited):
visited.update([self])
for node in self.parents():
visited.update(node.nodes(visited=visited))
for node in self.children():
visited.u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodeset(self):\n return set(self.nodeset) # return the nodeset",
"def nodes(self):\n\n return list(set(self._graph.keys() + [x for x in itertools.chain.from_iterable(self._graph.values())]))",
"def nodes(self):\n return set(self.values())",
"def nodes(self):\n nodes = []\... | [
"0.77861667",
"0.7713756",
"0.7709591",
"0.7602142",
"0.7429195",
"0.7405948",
"0.735527",
"0.7344105",
"0.71931976",
"0.7167872",
"0.70455664",
"0.7042498",
"0.7008261",
"0.69583625",
"0.694999",
"0.69358736",
"0.6894921",
"0.6795894",
"0.67873716",
"0.67648995",
"0.67599815... | 0.7352129 | 7 |
Find the root node(s) of the DAG that this node is in. a list containing all the parent nodes | def sources(self):
s = [node for node in self.nodes() if node.isSource()]
s.sort(lambda x,y: cmp(x._id, y._id))
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_list(root_node: ast.AST, node: ast.AST):\n ans = []\n current = node\n while current is not None:\n current = get_parent(root_node, current)\n if current is not None:\n ans.append(current)\n return ans",
"def getRootParents(nodes):\n return {getRootParent(node) ... | [
"0.71854806",
"0.7075197",
"0.67767656",
"0.66741854",
"0.6574405",
"0.646587",
"0.64403456",
"0.64376724",
"0.642618",
"0.6364652",
"0.63330305",
"0.6276277",
"0.6255423",
"0.6254909",
"0.62512904",
"0.6225578",
"0.62223744",
"0.6191263",
"0.61907524",
"0.6186046",
"0.617424... | 0.0 | -1 |
Returns the kwargs required to recreate a HappyJobNode, in conjunction with DAG.kwargs(). Used by dictize() and dedictize(). Subclasses should add their properties to this dict. | def _kwargs(self):
dict = DAG._kwargs(self)
if (self.job):
dict["inputpaths"] = self.job.inputpaths
dict["outputpath"] = self.job.outputpath
dict["job"] = "%s()" % self.job.__class__.__name__
return dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _kwargs(self):\n dict = DAG._kwargs(self) \n dict[\"inputpaths\"] = self.inputpaths\n dict[\"outputpath\"] = self.outputpath\n dict[\"query\"] = self.query\n return dict",
"def get_kwargs(self):\n return {}",
"def kwargs (self):\n return copy.deepcopy (self.... | [
"0.7458511",
"0.6939644",
"0.6714157",
"0.6676816",
"0.6574664",
"0.6562034",
"0.6460387",
"0.64150184",
"0.6139147",
"0.6097142",
"0.60685664",
"0.60685664",
"0.60280234",
"0.5999942",
"0.59596235",
"0.59475803",
"0.5899195",
"0.5896217",
"0.58945364",
"0.58577406",
"0.58564... | 0.780288 | 0 |
Get a train/test split for the given dataset | def get_train_test_split(dataset: SentenceComplexityDataset, n_test: float) -> Tuple[Subset, Subset]:
# determine sizes
test_size = round(n_test * len(dataset))
train_size = len(dataset) - test_size
# calculate the split
train, test = random_split(dataset, [train_size, test_size],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_test_split(dataset, split):\r\n train = list()\r\n train_size = split * len(dataset)\r\n dataset_copy = list(dataset) \r\n while len(train) < train_size:\r\n index = randrange(len(dataset_copy))\r\n train.append(dataset_copy.pop(index))\r\n return train, dataset_copy",
"def... | [
"0.7786153",
"0.7645297",
"0.74507606",
"0.7438377",
"0.7402888",
"0.7395611",
"0.73915726",
"0.7362422",
"0.7358521",
"0.7358521",
"0.7344598",
"0.7342347",
"0.733859",
"0.73163193",
"0.7311915",
"0.72810626",
"0.727462",
"0.7274613",
"0.7257762",
"0.72359025",
"0.7225679",
... | 0.75907946 | 2 |
Get status enabled/disabled for tracking. | def isTracking3DEnabled(self):
if not self.proxy:
self.proxy = self.session.service("ALExpressiveListening")
return self.proxy.isTracking3DEnabled() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStatus(self):\n return self.enabled",
"def get_status(self):\n return super(Cabling, self).get_status()",
"def get_status():\n return ('off', 'off')",
"def get_status(self):\n return self.status",
"def get_status(self):\n return self.status",
"def get_status(self):\n... | [
"0.75832987",
"0.72617185",
"0.7147112",
"0.69868785",
"0.69868785",
"0.69868785",
"0.6972502",
"0.69043845",
"0.68539554",
"0.6800334",
"0.67808807",
"0.67430705",
"0.6640635",
"0.662767",
"0.6622269",
"0.66099805",
"0.6608105",
"0.6594461",
"0.65896237",
"0.6518772",
"0.651... | 0.0 | -1 |
Deserialize floating point values. | def test_deserialize_float_value(self):
from petstore_api.model import banana
_response_for_200 = api_client.OpenApiResponse(
content={
self.json_content_type: api_client.MediaType(schema=banana.Banana),
},
)
data = {
'lengthCm': 3.1415
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFloat(self):\n try:\n data, n = self._buf.pop(_F_LEN)\n \n if n != _F_LEN:\n raise SerializationError('There is not enough data left.')\n \n return _F_STRUCT.unpack(data)[0]\n except StructError as e:\n raise Seri... | [
"0.67503417",
"0.66794133",
"0.65923357",
"0.6514714",
"0.6417108",
"0.6368431",
"0.6344429",
"0.6210224",
"0.612458",
"0.60783345",
"0.60493",
"0.60337645",
"0.5966486",
"0.59603405",
"0.59204286",
"0.59131175",
"0.59109503",
"0.58933157",
"0.5883673",
"0.58743757",
"0.58717... | 0.70606124 | 0 |
Euclidean distance between current pose and the goal. | def euclidean_distance(self, goal_pose):
return sqrt(pow((goal_pose.x - self.pose.x), 2) +
pow((goal_pose.y - self.pose.y), 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(self, goal_pose):\n return sqrt(pow((goal_pose.x - self.pose.x), 2) +\n pow((goal_pose.y - self.pose.y), 2))",
"def euclidean_distance(self):\n return sqrt(pow((self.goal_pose.x - self.ground_truth_pose.x), 2) +\n pow((self.goal_pose.y - ... | [
"0.8480881",
"0.82868296",
"0.7695317",
"0.7395312",
"0.71660006",
"0.69989324",
"0.69919956",
"0.6880315",
"0.67771876",
"0.67643046",
"0.67338336",
"0.67335546",
"0.67253697",
"0.67253697",
"0.67253697",
"0.67253697",
"0.67253697",
"0.67253697",
"0.67253697",
"0.6715758",
"... | 0.84970343 | 0 |
Generate a zero filled tensor with shape [batch_size, state_size]. | def _generate_initial_state(self, inputs, batch_size_tensor, state_size, dtype):
if batch_size_tensor is None or dtype is None:
raise ValueError(
'batch_size and dtype cannot be None while constructing initial state: '
'batch_size={}, dtype={}'.format(batch_size_tenso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_zero_filled_state(batch_size_tensor, state_size, dtype):\n if batch_size_tensor is None or dtype is None:\n raise ValueError(\n 'batch_size and dtype cannot be None while constructing initial state: '\n 'batch_size={}, dtype={}'.format(batch_size_tensor, dtype))\n\n ... | [
"0.82252717",
"0.79629415",
"0.77364993",
"0.76719123",
"0.76478356",
"0.759651",
"0.7548186",
"0.749872",
"0.74112505",
"0.7396597",
"0.7326455",
"0.72330326",
"0.70730436",
"0.70656234",
"0.7061129",
"0.70604426",
"0.70336837",
"0.70201236",
"0.69754076",
"0.6944437",
"0.68... | 0.64747244 | 37 |
Generate a zero filled tensor with shape [batch_size, state_size]. | def _generate_initial_state(self, inputs, batch_size_tensor, state_size, dtype):
if batch_size_tensor is None or dtype is None:
raise ValueError(
'batch_size and dtype cannot be None while constructing initial state: '
'batch_size={}, dtype={}'.format(batch_size_tenso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_zero_filled_state(batch_size_tensor, state_size, dtype):\n if batch_size_tensor is None or dtype is None:\n raise ValueError(\n 'batch_size and dtype cannot be None while constructing initial state: '\n 'batch_size={}, dtype={}'.format(batch_size_tensor, dtype))\n\n ... | [
"0.8226394",
"0.7962468",
"0.77339524",
"0.767074",
"0.7648544",
"0.7595725",
"0.7547214",
"0.7499353",
"0.74099576",
"0.73946166",
"0.7326439",
"0.72346205",
"0.7071821",
"0.70660377",
"0.7060344",
"0.7060017",
"0.7034807",
"0.70209223",
"0.69753593",
"0.6942175",
"0.6887068... | 0.6471612 | 38 |
This is a simple function to find the peak position of each image in an event which will be used later in the Xmax calculation. Peak is found by taking the average position of the n hottest pixels in the image. | def get_brightest_mean(self, num_pix=3):
peak_x = np.zeros(
[len(self.pixel_x)]) # Create blank arrays for peaks
# rather than a dict (faster)
peak_y = np.zeros(peak_x.shape)
peak_amp = np.zeros(peak_x.shape)
# Loop over all tels to take we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_peaks_(image):\n\n height, width = image.shape[:2]\n img_matrix = [sum(i)/len(i) for i in image]\n x=[i for i in range(height)]\n y = [255-i for i in img_matrix]\n y = gaussian_filter(y, sigma=20)\n maxs, _ = find_peaks(y)\n maxs = maxs.tolist()\n\n return maxs",
"def extractPeak... | [
"0.6750598",
"0.67249197",
"0.6453754",
"0.6390456",
"0.62944907",
"0.6264261",
"0.61970085",
"0.61826694",
"0.6156825",
"0.61242944",
"0.60953903",
"0.60948026",
"0.60780567",
"0.60753757",
"0.60318786",
"0.60183823",
"0.59937274",
"0.5988625",
"0.5986431",
"0.59855926",
"0.... | 0.57201284 | 41 |
Function to calculate the depth of shower maximum geometrically under the assumption that the shower maximum lies at the brightest point of the camera image. | def get_shower_max(self, source_x, source_y, core_x, core_y, zen):
# Calculate displacement of image centroid from source position (in
# rad)
disp = np.sqrt(np.power(self.peak_x - source_x, 2) +
np.power(self.peak_y - source_y, 2))
# Calculate impact parameter of ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_depth_val():\n data = SUNRGBDTrainDataset(True)\n return max([data[0][i][-1].flatten().item() for i in range(len(data))])",
"def max_well(self):\n maxVal = np.max(self.get_well_depth_image())\n return maxVal",
"def get_max_dmag_from_depth(depth):\n return 2.5 * np.log10(depth... | [
"0.73425066",
"0.7101294",
"0.70019245",
"0.67223144",
"0.6652651",
"0.6513308",
"0.647637",
"0.63612825",
"0.63598853",
"0.63358736",
"0.6315489",
"0.6299625",
"0.6273884",
"0.6255971",
"0.6252053",
"0.6232153",
"0.6207453",
"0.6190515",
"0.617028",
"0.6162297",
"0.6138282",... | 0.59673893 | 30 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.