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 |
|---|---|---|---|---|---|---|
Instantiate a CalcInterface object. | def __init__(self, proj=None, model=None, run=None, ens_mem=None, var=None,
date_range=None, region=None, intvl_in=None, intvl_out=None,
dtype_in_time=None, dtype_in_vert=None, dtype_out_time=None,
dtype_out_vert=None, level=None, time_offset=None):
if run not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classFactory(iface): # pylint: disable=invalid-name\n #\n from .indicadores_geosaude import IndicadoresGeosaude\n return IndicadoresGeosaude(iface)",
"def createStandardInputObjFromCalcObjs(self, calcObjs):\n\t\treturn self._stdInpFromCalcObjs(self, calcObjs)",
"def __init__(self, calcGrad, calcC... | [
"0.55461043",
"0.54615575",
"0.5398776",
"0.53714937",
"0.53408873",
"0.52831453",
"0.5282024",
"0.5174737",
"0.5168434",
"0.5158829",
"0.51377535",
"0.5136189",
"0.5122206",
"0.50964415",
"0.5093284",
"0.5087388",
"0.50600004",
"0.5042441",
"0.5030675",
"0.5029526",
"0.50092... | 0.57148844 | 0 |
String representation of the object. | def __str__(self):
return "<aospy.Calc instance: " + ', '.join(
(self.name, self.proj.name, self.model.name, self.run.name)
) + ">" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_string(self):\n return self.__repr__()",
"def __str__(self):\n return str(self.serialize())",
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(self.__dict__)",
"... | [
"0.83436894",
"0.8340401",
"0.8336263",
"0.8253022",
"0.8253022",
"0.8253022",
"0.8253022",
"0.8253022",
"0.82241017",
"0.82012856",
"0.81919605",
"0.817993",
"0.81702906",
"0.81702906",
"0.8165669",
"0.8158028",
"0.8158028",
"0.8158028",
"0.8158028",
"0.8158028",
"0.8158028"... | 0.0 | -1 |
Return the current point size. | def pointsize(self):
return self.m_pointsize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self) -> Point:\n\t\treturn self._size",
"def getPointSize(self):\n l = [point.size for point in self.points]\n if l.count(l[0]) == len(l):\n return l[0]\n else:\n raise ValueError(\"The sizes of the points must be the same otherwise it makes no sense.\")",
"... | [
"0.8636495",
"0.82199454",
"0.75747615",
"0.74275225",
"0.7424574",
"0.7419275",
"0.73445594",
"0.73120743",
"0.7296886",
"0.7276074",
"0.72740424",
"0.7266581",
"0.7259557",
"0.7255099",
"0.7255099",
"0.72550595",
"0.72550595",
"0.72550595",
"0.7226226",
"0.7226226",
"0.7221... | 0.90453184 | 0 |
Function sigmoid(z) computes the sigmoid of z. | def sigmoid(z):
g = 1/(1 + np.exp(-z))
return g | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(z):\r\n \r\n return vSigmoid(z);",
"def sigmoid(z):\r\n \r\n return 1.0 / (1.0+np.exp(-z))",
"def sigmoid(z):\n\n\ts = 1 / (1 + np.exp(-z)) #definition of the sigmoid function\n\treturn s",
"def sigmoid(z):\n\treturn 1.0/(1.0+np.exp(-z))",
"def sigmoid(z):\n # print \"sigmoid i... | [
"0.93568915",
"0.9321927",
"0.9304995",
"0.9283649",
"0.9247952",
"0.9209828",
"0.9178846",
"0.91788304",
"0.9178057",
"0.91778785",
"0.9176682",
"0.9152285",
"0.91515875",
"0.9141371",
"0.913542",
"0.9134094",
"0.9106866",
"0.91055954",
"0.91010946",
"0.9090151",
"0.89898944... | 0.91526705 | 11 |
Ghost the given pad of element. Remove nonused elements. | def _wrapUp(self, element, pad):
if self._srcpad:
return
self._markValidElements(element)
self._removeUnusedElements(self.typefind)
self.log("ghosting pad %s" % pad.get_name())
self._srcpad = gst.GhostPad("src", pad)
self._srcpad.set_active(True)
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_padding(im, pad):\n\n return im[pad:-pad, pad:-pad]",
"def _removeUnusedElements(self, element):\n self.log(\"element:%r\" % element)\n for pad in element.src_pads():\n if pad.is_linked():\n peer = pad.get_peer().get_parent()\n self._removeUnus... | [
"0.60958475",
"0.5913197",
"0.5780126",
"0.57168174",
"0.5607434",
"0.5409166",
"0.5402955",
"0.53921175",
"0.5367817",
"0.5362773",
"0.5360787",
"0.53020066",
"0.52960426",
"0.5293717",
"0.5272031",
"0.5266434",
"0.52592355",
"0.52355856",
"0.5184225",
"0.51815903",
"0.51798... | 0.6121266 | 0 |
Tests correct formatting of the metadata mapping file | def test_format_mapping_file_to_js(self):
# regular case, no categories that can be animated
out_js_mapping_file_string = format_mapping_file_to_js(
self.mapping_file_data, self.mapping_file_headers,
self.good_columns)
self.assertEquals(out_js_mapping_file_string, MAPPIN... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_format_mapping_file(self):\r\n headers = ['SampleID', 'col1', 'col0', 'Description']\r\n samples =\\\r\n [['bsample', 'v1_3', 'v0_3', 'd1'],\r\n ['asample', 'aval', 'another', 'd2']]\r\n comments = ['this goes after headers', 'this too']\r\n self.assertEq... | [
"0.81252533",
"0.77929735",
"0.68259096",
"0.68225086",
"0.67228264",
"0.67196786",
"0.6685322",
"0.6678371",
"0.66389656",
"0.6632896",
"0.6579554",
"0.6577319",
"0.65668213",
"0.6541261",
"0.65284413",
"0.6520154",
"0.6518268",
"0.6512767",
"0.6467256",
"0.63763916",
"0.635... | 0.5605362 | 96 |
Retrieve a list of clients related to the authenticated partner account. | def test_list_clients(oauth_client, response):
response.get("https://api.mollie.com/v2/clients", "clients_list")
clients = oauth_client.clients.list()
assert_list_object(clients, Client) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_clients(self):\n\n return self.clients_info",
"def get(self):\n return get_clientes()",
"def get_clients(x_additional_headers: Optional[Dict[str, str]] = None, **kwargs):\n request = GetClients.create()\n return run_request(request, additional_headers=x_additional_headers, **kwargs... | [
"0.72691476",
"0.69450516",
"0.67034316",
"0.667238",
"0.6639581",
"0.66170955",
"0.6590979",
"0.65032333",
"0.6329494",
"0.6313128",
"0.62944096",
"0.62944096",
"0.62884516",
"0.6256368",
"0.62202156",
"0.611599",
"0.6072513",
"0.607005",
"0.6054188",
"0.60491896",
"0.603921... | 0.6000159 | 23 |
Creates a weight matrix using the uniform distribution. | def uniform_weight_init(
input_size: int,
output_size: int,
min_bounds: float = 0.0,
max_bounds: float = 1.0,
positive_ratio: Optional[float] = None,
) -> t.Tensor:
if input_size < 1:
raise ValueError("input_size must be a positive integer.")
if output_size < 1:
raise ValueEr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WeightInitializer():\n return np.random.uniform(-1, 1)",
"def uniform_weights(n):\n return np.ones((n, 1)) / n",
"def init_weights(self, dims):\n self.W = np.random.normal(size=dims) * 0.0001",
"def _generate_weights(self):\n weights = [random.uniform(0, 1) for x in range(self.num_weights... | [
"0.731233",
"0.7022645",
"0.6728774",
"0.6578294",
"0.65608436",
"0.6528946",
"0.64844614",
"0.64594007",
"0.64405286",
"0.6337693",
"0.6311915",
"0.6200327",
"0.61962575",
"0.6151905",
"0.61494744",
"0.61318254",
"0.6122181",
"0.6111972",
"0.6090846",
"0.6036704",
"0.6007917... | 0.6002809 | 21 |
Get the AssetKey associated with this InputDefinition for the given | def get_asset_key(self, context: "InputContext") -> Optional[AssetKey]:
if callable(self._asset_key):
return self._asset_key(context)
else:
return self.hardcoded_asset_key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"key\")",
"def key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"key\")",
"def key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"key\")",
"def key(self) -> pulumi.Input[str]:\n return pulumi.get(sel... | [
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6646105",
"0.6354836",
"0.6335745",
"0.6335745",
"0.63294554",
"0.63294554",
"0.6288275",
"0.6288275",
... | 0.739318 | 0 |
returns a list of neighbors returns a list of position objects with their directiontomoveto set to the direction that the empty square moved. | def neighbors(self):
# find 0 - blank square
x0 = None
y0 = None
for i in range(4):
for j in range(4):
if self.get_tile(i,j) == 0:
y0 = i
x0 = j
if x0 == None or y0 == None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbors(self):\n return list(map(self.game.square, [self.position - self.game.rules[\"row_len\"], self.position + 1, self.position + self.game.rules[\"row_len\"], self.position - 1]))",
"def empty_spots(self):\n\t\tret = []\n\t\tfor i in range(0, self.size):\n\t\t\tfor j in range(0, self.size):\... | [
"0.7583234",
"0.73333657",
"0.72945344",
"0.7293684",
"0.725854",
"0.72296697",
"0.72086686",
"0.71733797",
"0.71366847",
"0.71238005",
"0.707542",
"0.7062021",
"0.7032389",
"0.70102596",
"0.6965794",
"0.6941387",
"0.6917996",
"0.6900293",
"0.6844919",
"0.6826912",
"0.6825766... | 0.8379654 | 0 |
Assert length of tag list matches predicted quantity of tags. | def test_get_all_tags(self):
print(self.session.tags)
self.assertEqual(
len(self.session.tags),
(3 * len(self.session.wp_post_objects)) #3 tags added by default
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_len_eq(lists):\n # Sanity check\n max_len = max(len(p) for p in lists)\n for i, p in enumerate(lists):\n assert len(\n p\n ) == max_len, \"Length check failed!\\nl[{}] has {} elements != {} ({!r})\\n{!r}\".format(\n i, len(p), max_len, p, lists\n )",
... | [
"0.67258257",
"0.64614934",
"0.63946867",
"0.63662595",
"0.6324179",
"0.62705266",
"0.6249414",
"0.61755604",
"0.61721706",
"0.61600024",
"0.61600024",
"0.61499745",
"0.613764",
"0.613361",
"0.61323494",
"0.61097664",
"0.6078528",
"0.6044599",
"0.5993292",
"0.5992054",
"0.597... | 0.0 | -1 |
The constructor for MultichannelBitmap class. | def __init__(self, data, origin: PointLocation = None,
sly_id=None, class_id=None, labeler_login=None, updated_at=None, created_at=None):
super().__init__(data, origin, expected_data_dims=3,
sly_id=sly_id, class_id=class_id,
labeler_login=labele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n _gdi_.Bitmap_swiginit(self,_gdi_.new_Bitmap(*args, **kwargs))",
"def __init__(self, channels):\n super(PositionalEncodingPermute2D, self).__init__()\n self.penc = PositionalEncoding2D(channels)",
"def __init__(self, width=0, height=0):\n (self.... | [
"0.64733183",
"0.59830886",
"0.59610486",
"0.59391147",
"0.59309804",
"0.59085697",
"0.5882392",
"0.5847157",
"0.5834051",
"0.58274794",
"0.5782317",
"0.57106435",
"0.56661433",
"0.566226",
"0.5661463",
"0.5648278",
"0.5644686",
"0.5636765",
"0.5631496",
"0.56243837",
"0.5592... | 0.0 | -1 |
The function rotate render the bitmap within the full image canvas and rotate the whole canvas with a given rotator (ImageRotator class object contain size of image and angle to rotate) | def rotate(self, rotator):
full_img_data = np.zeros(rotator.src_imsize + self.data.shape[2:], dtype=self.data.dtype)
full_img_data[
self.origin.row:(self.origin.row + self.data.shape[0]),
self.origin.col:(self.origin.col + self.data.shape[1]), ...] = self.data[:, :, ...]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(self, image, angle):\n tmpImage = pygame.transform.rotate(image ,angle)\n imageCentreX = tmpImage.get_rect()[0] + tmpImage.get_rect()[2]/2\n imageCentreY = tmpImage.get_rect()[1] + tmpImage.get_rect()[3]/2\n\n targetWidth = tmpImage.get_rect()[2]\n targetHeight = tmpIm... | [
"0.7114526",
"0.6855607",
"0.685048",
"0.6798645",
"0.67613417",
"0.6659643",
"0.66030043",
"0.6512459",
"0.64869493",
"0.64115447",
"0.6395608",
"0.63924265",
"0.63760424",
"0.63394535",
"0.6326849",
"0.63236195",
"0.63056964",
"0.6284121",
"0.62591845",
"0.6254835",
"0.6252... | 0.7153731 | 0 |
Make a Java array of bytes from a string of hex digits. | def javaByteArray2(s):
a = array.array('B', binascii.unhexlify(s))
return javaByteArray(a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hex_str_to_bytes_arr(bytes_str: str) -> List[int]:\n return eval(f\"[{bytes_str}]\")",
"def hex_strings_to_bytes(data: Iterable[str]) -> bytes:\n byte_array = array('B')\n for hexstr in data:\n byte_array.extend(int(hexstr[index:index+2], 16) for index in range(0, len(hexstr), 2))\n return... | [
"0.7927396",
"0.7361433",
"0.7342364",
"0.7120569",
"0.70259345",
"0.69859344",
"0.6828026",
"0.678913",
"0.66144943",
"0.6564096",
"0.6556808",
"0.65337163",
"0.6523576",
"0.650345",
"0.6494254",
"0.6465633",
"0.6386992",
"0.63856035",
"0.6352984",
"0.6343163",
"0.6259075",
... | 0.67021126 | 8 |
Check for endpoint relative position and overlap. Used in scan_P__(). | def comp_edge(_P, P): # Used in scan_P_().
_x0 = _P['x0']
_xn = _x0 + _P['L']
x0 = P['x0']
xn = x0 + P['L']
if _xn < xn: # End-point relative position.
return True, x0 < _xn # Overlap.
else:
return False, _x0 < xn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _in_bounds(self, x, y):\r\n return 0 <= x < 8 and 0 <= y < 8",
"def is_valid_overlap_xy(dir_id, p1, p2, pattern_catalog, pattern_width, adjacency_directions):\n #dir_corrected = (0 - adjacency_directions[dir_id].x, 0 - adjacency_directions[dir_id].y)\n dir_corrected = (0 + adjacency_directions[d... | [
"0.6494828",
"0.61780626",
"0.61478144",
"0.61463255",
"0.61320376",
"0.6116703",
"0.61136043",
"0.6108635",
"0.60967755",
"0.606722",
"0.60669786",
"0.6033708",
"0.6022681",
"0.60138786",
"0.6001213",
"0.5966237",
"0.59654135",
"0.59575963",
"0.59564316",
"0.5953769",
"0.592... | 0.6398601 | 1 |
Sets the major_version of this NextUpgradeInfo. | def major_version(self, major_version):
self._major_version = major_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _major_version(self):\n version_tuple = StrictVersion(self.plugin.version).version\n major = '.'.join(map(str, version_tuple[:2]))\n\n return major",
"def minor_version(self, minor_version):\n\n self._minor_version = minor_version",
"def minor_version(self, minor_version):\n\n ... | [
"0.6609667",
"0.64588195",
"0.64588195",
"0.6412141",
"0.64004534",
"0.6383321",
"0.63680845",
"0.62749135",
"0.62064695",
"0.617141",
"0.6109517",
"0.60880303",
"0.6085801",
"0.60802436",
"0.6033241",
"0.5941284",
"0.5857889",
"0.57498246",
"0.5686118",
"0.56828374",
"0.5679... | 0.826978 | 0 |
Sets the mandatory of this NextUpgradeInfo. | def mandatory(self, mandatory):
self._mandatory = mandatory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required(self, required):\n\n self._required = required",
"def required(self, required):\n\n self._required = required",
"def required(self, required):\n\n self._required = required",
"def required(self, required):\n\n self._required = required",
"def explicitly_required(sel... | [
"0.6098085",
"0.6098085",
"0.6098085",
"0.6098085",
"0.5943629",
"0.5823603",
"0.5807848",
"0.57494354",
"0.5626224",
"0.55867773",
"0.54788595",
"0.53794473",
"0.53619933",
"0.5344923",
"0.53359044",
"0.52371824",
"0.5211088",
"0.51647735",
"0.5157812",
"0.51299804",
"0.5129... | 0.72124577 | 0 |
Sets the upgrade_time_epoch of this NextUpgradeInfo. | def upgrade_time_epoch(self, upgrade_time_epoch):
self._upgrade_time_epoch = upgrade_time_epoch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upgrade_time(self, upgrade_time):\n\n self._upgrade_time = upgrade_time",
"def set_epoch(self, epoch=None):\n params = {'epoch': epoch if epoch is not None else int(time.time())}\n return self._jadeRpc('set_epoch', params)",
"def set_epoch(self, epoch):\n self.epoch = epoch",
... | [
"0.71056724",
"0.58541226",
"0.58303434",
"0.56607425",
"0.5544668",
"0.55109674",
"0.5417715",
"0.5276821",
"0.5267726",
"0.5082459",
"0.5068214",
"0.5068214",
"0.50546193",
"0.50347763",
"0.5013292",
"0.4975316",
"0.49132764",
"0.49092776",
"0.48097897",
"0.47805026",
"0.47... | 0.85634923 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, NextUpgradeInfo):
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 |
Convert a scipy sparse matrix to a torch sparse tensor. | def sparse_mx_to_torch_sparse_tensor(self, adj_mat_sparse):
sparse_mx = adj_mat_sparse.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(spar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.8299787",
"0.8148542",
"0.8045949",
"0.80325705",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80134654",
"0.79973555",
"0.79973555",
... | 0.7713117 | 26 |
Converts a surface into a black and white equivalent. Note that we're using an 8x8 surface. The smaller the surface, the 'fuzzier' our image search will be. Returns a pygame surface | def greyscale(surface):
surface = pygame.transform.scale(surface, (8, 8))
greyscale = pygame.Surface((8, 8))
for y in range(surface.get_height()):
for x in range(surface.get_width()):
greyscale.set_at((x, y), return_average(surface.get_at((x,y))))
return greyscale | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toSurface(self):\n surface = pygame.Surface((self.getWidth(), self.getHeight()), 0, 8)\n surface.fill((255, 255, 255))\n black = surface.map_rgb((0, 0, 0))\n mapdata = pygame.PixelArray(surface)\n for pos in self._invalidPositions:\n try:\n mapdata... | [
"0.7113351",
"0.6475172",
"0.6382403",
"0.6193088",
"0.5890914",
"0.5872142",
"0.5680011",
"0.5566405",
"0.5492755",
"0.5389174",
"0.536041",
"0.5359246",
"0.53234607",
"0.5274279",
"0.5271185",
"0.52656245",
"0.5239494",
"0.52340454",
"0.5233165",
"0.52282625",
"0.5211115",
... | 0.5799836 | 6 |
Initialize a new api object. Pass in an API token or omit it to read SHIP_API_TOKEN from your environment. | def __init__(self, token=None, dry_run=False, server="https://api.realartists.com"):
self.API_VERSION = "20151105"
self.server = server
self.dry_run = dry_run
if token is not None:
self.setToken(token)
else:
self.setToken(os.getenv("SHIP_API_TOKEN... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, api_token):\n self.api_token = api_token",
"def __init__(self):\n self.api = Api(consumer_key=credentials[\"consumer_key\"],\n consumer_secret=credentials[\"consumer_secret\"],\n access_token_key=credentials[\"access_token_key\"],\n ... | [
"0.76010734",
"0.7525183",
"0.722535",
"0.7088558",
"0.70721453",
"0.7047599",
"0.7046031",
"0.70402014",
"0.70291555",
"0.69977075",
"0.69893444",
"0.69675446",
"0.6964283",
"0.69218373",
"0.6907305",
"0.68956125",
"0.68758976",
"0.686342",
"0.68540263",
"0.6840269",
"0.6838... | 0.7174984 | 3 |
Returns the first start state | def state_initial(self):
return self.states_initial()[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartState(self):\n\t\tutil.raiseNotDefined()",
"def getStartState(self):\n\t\tutil.raiseNotDefined()",
"def get_start_state(self):\r\n util.raiseNotDefined()",
"def getStartState(self):\r\n\t\tutil.raiseNotDefined()",
"def get_start_state(self):\n util.raiseNotDefined()",
"def getSt... | [
"0.78146416",
"0.78146416",
"0.77995217",
"0.7796046",
"0.77595437",
"0.7737565",
"0.7727937",
"0.7727937",
"0.7727937",
"0.7727937",
"0.7727937",
"0.7727937",
"0.7727937",
"0.7727937",
"0.7727937",
"0.7702525",
"0.7680203",
"0.7680203",
"0.7680203",
"0.7680203",
"0.7680203",... | 0.74150425 | 54 |
Returns the list of all start states | def states_initial(self):
return self.states("Initial = YES") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_states(self):\n return list(self.iter_initial_states())",
"def get_list_of_states(self):\n return self.states",
"def get_initial_states(self):\n raise NotImplementedError()",
"def get_all_states(self):\n return self._states",
"def initial_states(self):\n retur... | [
"0.7812152",
"0.77064127",
"0.74383473",
"0.73651737",
"0.73549896",
"0.73447025",
"0.7238955",
"0.7149239",
"0.70775056",
"0.70775056",
"0.7022461",
"0.6997304",
"0.69921184",
"0.6967993",
"0.69674057",
"0.69674057",
"0.69674057",
"0.69674057",
"0.69674057",
"0.69674057",
"0... | 0.6385656 | 95 |
Return the list of valid state transitions from state. | def state_transitions(self, state):
return self.states("ANY PreviousStates.identifier = '%s'" % _obj_id(state)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transitions(self, from_state=None):\n return list(self.iter_transitions(from_state))",
"def transitions(self, state):\n if len(set(state)) < len(state):\n yield self.STOP_STATE\n return\n for hidx in xrange(self.num_players):\n for lidx in xrange(hidx):\n... | [
"0.7897553",
"0.7058213",
"0.6909843",
"0.6835081",
"0.67144054",
"0.67064613",
"0.6659277",
"0.65004504",
"0.6473224",
"0.6464462",
"0.6434455",
"0.64069766",
"0.6357915",
"0.63360065",
"0.6276572",
"0.6270292",
"0.6219843",
"0.6212978",
"0.61455226",
"0.6142549",
"0.6134658... | 0.73548394 | 1 |
Access the list of comments on the requested problem. | def problem_comments(self, identifier):
return self._get("problems/%d/comments" % identifier).json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments(self):\n raise NotImplementedError",
"def get_comments(self):\n\t\treturn self._client.get_comments(self)",
"def comments(self):\r\n return IssueComments(self)",
"def comments(self):\r\n return IssueComments(self)",
"def comments(self) -> list:\n return self._no... | [
"0.7727881",
"0.7471885",
"0.73331463",
"0.73331463",
"0.73330116",
"0.73051596",
"0.73051596",
"0.73051596",
"0.7230867",
"0.7223843",
"0.7126679",
"0.7126679",
"0.7103531",
"0.7061553",
"0.7025779",
"0.70209825",
"0.6987613",
"0.68704796",
"0.68501776",
"0.68501776",
"0.685... | 0.8174743 | 0 |
Couns the number of overlapping subsequences of lenght between kmin kmax in a input sequence. | def count_subsequence_in_sliding_window(kmin, kmax, sequence):
if isinstance(sequence, str):
for n in range(kmin, kmax + 1):
for sub in zip(*(deque(itertools.islice(it, i), 0) or
it for i, it in enumerate(itertools.tee(sequence,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_overlapping(seq, subseq):\n \n pos, count = 0, 0\n while True:\n pos = seq.find(subseq, pos)\n if pos < 0:\n break\n pos += 1 \n count += 1\n return count",
"def _get_subsequence_counts(sequences, length, min_support=None):\n # type: (Union[List[s... | [
"0.6897632",
"0.66734475",
"0.66401356",
"0.61437935",
"0.6082373",
"0.60758173",
"0.6067477",
"0.6067079",
"0.60625184",
"0.60437757",
"0.59478396",
"0.591973",
"0.58829165",
"0.5873242",
"0.5867987",
"0.5842749",
"0.5830168",
"0.5733634",
"0.57134503",
"0.5704528",
"0.57030... | 0.72154963 | 0 |
Close the connection with the server. | def close(self):
try:
self.server_connection.send(b"Close Client Connection")
# Avoid an error when shutting down the server.
except ConnectionAbortedError:
pass
# The connection is closed.
self.is_connected = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n\n self._connection.close()\n print(\"Closed connection....\")",
"def close_connection(self):\n self.nodesocket.close()",
"def server_close(self):\n\t\tself.socket.close()",
"def closeConnection(self):\n print(\"closing connection...\")\n self.s... | [
"0.80540496",
"0.79681456",
"0.7927976",
"0.7917717",
"0.7871139",
"0.78591335",
"0.78568804",
"0.785326",
"0.7831794",
"0.78025514",
"0.7800077",
"0.7779498",
"0.7779498",
"0.77753264",
"0.7746152",
"0.7696268",
"0.7690827",
"0.76897186",
"0.7689619",
"0.768563",
"0.768563",... | 0.78453964 | 8 |
Creates and saves a superuser with the given username and password | def create_superuser(self, username, password=None):
user = self.create_user(username=username, password=password)
user.first_name = "StarNavi"
user.last_name = "Administrator"
user.is_active = True
user.is_superuser = True
user.is_staff = True
user.save(using=sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_superuser(username, email, password):\n if username and email and password:\n user, created = User.objects.get_or_create(pk=defaults.USERWARE_SUPERUSER_ID)\n if user:\n user.username = username\n user.email = email\n user.set_password(password)\n ... | [
"0.8250926",
"0.8204901",
"0.8163506",
"0.7995154",
"0.79900706",
"0.7984123",
"0.79756325",
"0.7969393",
"0.7966435",
"0.7962328",
"0.79583997",
"0.795261",
"0.7948134",
"0.7894423",
"0.7870674",
"0.7866577",
"0.7846542",
"0.7836975",
"0.7826227",
"0.78209513",
"0.7808987",
... | 0.7922277 | 13 |
write image array to a specified path | def write_csv_file(array, filename):
np.savetxt(filename, array, delimiter=",") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imwrite(image, path):\n\n if image.ndim == 3 and image.shape[2] == 1: # for gray image\n image = np.array(image, copy=True)\n image.shape = image.shape[0:2]\n\n imgarray=((image+1.0)*127.5).astype(np.uint8)\n img=Image.fromarray(imgarray)\n img.save(path)",
"def write(\n pat... | [
"0.80066776",
"0.7741862",
"0.7299954",
"0.7295875",
"0.7219931",
"0.70178884",
"0.70175165",
"0.6957188",
"0.6917627",
"0.68172497",
"0.68099856",
"0.6791467",
"0.67743456",
"0.67348915",
"0.6716998",
"0.6695909",
"0.66811734",
"0.6673537",
"0.66712034",
"0.66438454",
"0.663... | 0.0 | -1 |
Get the most recently completed quarter. | def last_quarter(today):
quarter_date = today - relativedelta(months=1)
while quarter_date.month % 3 != 0:
quarter_date = quarter_date - relativedelta(months=1)
return quarter_date.year, int(quarter_date.month / 3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quarter(self):\n\n self.quarter_nums = cal_data.calc_quarter(self.active_date[2],\n self.active_date[1])\n self.quarter = cal_data.get_quarter(self.active_date[2],\n self.active_date[1])",
"def get_q... | [
"0.71088463",
"0.707612",
"0.6610488",
"0.62302136",
"0.61252123",
"0.6114027",
"0.6114027",
"0.59712714",
"0.59192556",
"0.5904818",
"0.58135074",
"0.5625728",
"0.5509202",
"0.5447477",
"0.543879",
"0.54095525",
"0.54027873",
"0.5391544",
"0.53664136",
"0.53661287",
"0.53342... | 0.648525 | 3 |
Add special tokens to the tokenizer and the model if they have not already been added. | def add_special_tokens_(model, tokenizer, update_model=True):
orig_num_tokens = len(tokenizer)
num_added_tokens = tokenizer.add_special_tokens(ATTR_TO_SPECIAL_TOKEN) # doesn't add if they are already there
#print("coab::",len(tokenizer.vocab))
if (num_added_tokens > 0 and update_model):
model.en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_special_tokens_(model, tokenizer):\n orig_num_tokens = len(tokenizer.encoder)\n num_added_tokens = tokenizer.add_special_tokens(ATTR_TO_SPECIAL_TOKEN) # doesn't add if they are already there\n if num_added_tokens > 0:\n model.resize_token_embeddings(new_num_tokens=orig_num_tokens + num_adde... | [
"0.7694922",
"0.6634113",
"0.6582269",
"0.64322776",
"0.64064205",
"0.6263845",
"0.5975597",
"0.59564984",
"0.59484524",
"0.5922455",
"0.5899315",
"0.58885926",
"0.5843837",
"0.5829498",
"0.5825403",
"0.57836765",
"0.575896",
"0.5743932",
"0.57355046",
"0.5733764",
"0.5721004... | 0.7371381 | 1 |
Returns a normalized domain on rating.rating to select the records to include in count, avg, ... computation of current model. | def _rating_domain(self):
return ['&', '&', ('res_model', '=', self._name), ('res_id', 'in', self.ids), ('consumed', '=', True), ('website_published', '=', True)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_rating(self):\n queryset = ArticleRating.objects.filter(article_id=self.get_object())\n return queryset.aggregate(Avg('rate')).get(\"rate__avg\")",
"def average_ratings(self):\n return get_average_rate(\n model=Rating,\n article=self.pk\n )",
"d... | [
"0.55893254",
"0.55250335",
"0.54229623",
"0.53542584",
"0.533851",
"0.53040886",
"0.5296353",
"0.5279337",
"0.5270756",
"0.52280354",
"0.5141364",
"0.5106121",
"0.5101962",
"0.5076106",
"0.5063996",
"0.5055503",
"0.50505793",
"0.50104856",
"0.50104856",
"0.4995368",
"0.49942... | 0.6925912 | 0 |
Get the output of conv layer. | def conv_output(model, layer_name, img):
# this is the placeholder for the input images
input_img = model.input
try:
# this is the placeholder for the conv output
out_conv = model.get_layer(layer_name).output
except:
raise Exception('Not layer named {}!'.format(layer_name))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out",
"def get_output(self, prev_layers=None, **kwargs):\n if prev_layers is None:\n prev_layers = list()\n if self not in prev_layers:\n prev_layers += [self]\n ... | [
"0.74672776",
"0.6889656",
"0.67878616",
"0.6749953",
"0.67351806",
"0.6727751",
"0.6727751",
"0.6727751",
"0.6722555",
"0.6673674",
"0.66717416",
"0.65963495",
"0.6580103",
"0.6580103",
"0.65754825",
"0.65445495",
"0.64597344",
"0.6435824",
"0.63882506",
"0.6363812",
"0.6345... | 0.78071994 | 0 |
Creates an application instance. | def main(config=config):
root = Tk()
root.columnconfigure(0, weight=1)
root.wm_title("ayy lmap")
app = Application(master=root, config=config)
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n app = create_app()\n return app",
"def app():\n return create_app()",
"def create():\n\n return App()",
"def create_app(self):\n raise NotImplementedError",
"def create_app():\n\n # Create app\n app = Flask(__name__)\n app.config.from_object(\"nextbus.config.Config\... | [
"0.82125676",
"0.8049562",
"0.7990641",
"0.7957601",
"0.79345995",
"0.79204637",
"0.7866866",
"0.7789413",
"0.76408476",
"0.7574996",
"0.7545354",
"0.7543035",
"0.7524545",
"0.7511224",
"0.7504814",
"0.7466684",
"0.7461691",
"0.74588597",
"0.74511695",
"0.74446553",
"0.744214... | 0.0 | -1 |
Set the displayed value | def setValue(self, value: Optional[float]):
self.__valueWidget.setText(
"-" if value is None else "{:.5g}".format(value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def updateDisplayLabel(self, value=None):\n if value is None:\n value = self.param.value()\n self.displayLabel.setText(value.toString(self.param.opts['format']))",
"def do_display(self, arg):\n try:\n val... | [
"0.75660557",
"0.74704725",
"0.7208428",
"0.71023834",
"0.7051616",
"0.69994265",
"0.6939808",
"0.6833543",
"0.6817097",
"0.67852694",
"0.675615",
"0.6729464",
"0.6713439",
"0.6711805",
"0.66965985",
"0.6618711",
"0.65132284",
"0.64615804",
"0.6451515",
"0.6423694",
"0.639224... | 0.69301623 | 7 |
Return current value (None if never set). | def getValue(self) -> Optional[int]:
return self.__value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return None",
"def lazy_value(self):\n\n if self.state == Node.State.VALID:\n return self.value\n else:\n return None",
"def get_val(self):\n if self.val_obj is None:\n return None\n else:\n return self.val_ob... | [
"0.7257534",
"0.7249788",
"0.7055582",
"0.7000303",
"0.6930107",
"0.69264895",
"0.69188625",
"0.6803145",
"0.6796274",
"0.6786896",
"0.67536634",
"0.6746637",
"0.67311645",
"0.6686984",
"0.6682557",
"0.66619533",
"0.6619161",
"0.6605074",
"0.6594224",
"0.6587601",
"0.6576075"... | 0.6737951 | 12 |
Returns the current range of valid values | def getRange(self) -> Tuple[int, int]:
return self.validator().bottom(), self.validator().top() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _full_value_range(self):\n min_value, max_value = self._raw_data.data_range\n return max_value - min_value",
"def get_range(cls, data: tuple or list) -> float:\n cls._data_validation(data)\n max_ = cls.get_max(data)\n min_ = cls.get_min(data)\n return float(max_ - min_)",
... | [
"0.7685519",
"0.70607877",
"0.70454717",
"0.6991528",
"0.6965289",
"0.6962066",
"0.6859699",
"0.68507016",
"0.68431336",
"0.6823089",
"0.68209",
"0.6793608",
"0.66680664",
"0.6633512",
"0.66233736",
"0.6601982",
"0.65988374",
"0.6583819",
"0.6581041",
"0.65713406",
"0.6556152... | 0.73728305 | 1 |
Set default value when QLineEdit is empty | def setDefaultValue(self, value: int, extend_range: bool=False):
self.setPlaceholderText(str(self.__validate(value, extend_range)))
if self.getCurrentValue() is None:
self.__commitValue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setInitDefault(self, editText):\n self.initDefault = self.storedText(editText)[0]",
"def storeLineEditValue(self):\n\n\t\tcategory, attr = self.getWidgetMeta(self.sender())\n\t\tvalue = self.sender().text()\n\t\tself.storeValue(category, attr, value)",
"def __init__(self,name,value,*args,**kargs):\n... | [
"0.6774245",
"0.63679117",
"0.6257189",
"0.6217691",
"0.6217691",
"0.6156899",
"0.60253555",
"0.60147804",
"0.5989727",
"0.5972908",
"0.5926113",
"0.5916339",
"0.58828473",
"0.5874215",
"0.5823624",
"0.579161",
"0.5787442",
"0.5782044",
"0.5758079",
"0.57466",
"0.57270575",
... | 0.5842592 | 14 |
Set the currently displayed value | def setCurrentValue(self, value: int, extend_range: bool=False):
self.setText(str(self.__validate(value, extend_range)))
self.__commitValue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widget.setValue(value)\n elif hasattr(self.widget, \"se... | [
"0.7517344",
"0.72195286",
"0.7166089",
"0.7161742",
"0.71051836",
"0.6990629",
"0.6963904",
"0.6941204",
"0.68698484",
"0.6759688",
"0.6704535",
"0.66911966",
"0.66908795",
"0.66512775",
"0.66477036",
"0.6644606",
"0.66431236",
"0.66008025",
"0.65845007",
"0.6567886",
"0.656... | 0.59573585 | 88 |
Return the sample size of the dataset. | def get_n(cls, data: tuple or list) -> int:
cls._data_validation(data)
if isinstance(data, (type(None))):
# Some method calculations require 0 if data is None
return 0
return len(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _number_of_samples(self):\n return len(self._raw_data.samples)",
"def get_num_samples(self):\n return self._num_samples",
"def getSampleCount(self):\r\n return len(self._data)",
"def dataset_size(self):\n return self.dataset.size",
"def get_number_samples(self):\n return ... | [
"0.81428874",
"0.81080693",
"0.80751675",
"0.8050214",
"0.7949477",
"0.7818102",
"0.7805022",
"0.77956265",
"0.7685768",
"0.7674844",
"0.7588929",
"0.75433093",
"0.7531959",
"0.7527388",
"0.74927205",
"0.7460337",
"0.74502385",
"0.74107224",
"0.74008054",
"0.7396397",
"0.7383... | 0.0 | -1 |
Return the smallest value in the dataset. | def get_min(cls, data: tuple or list) -> float:
cls._data_validation(data)
return min(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Min(data):\n return data.min()",
"def min(self):\n least = self.data[0]\n \n for i in range(len(self.data)):\n if self.data[i] < least:\n least = self.data[i]\n return least",
"def min(self):\r\n return np.min(self.data_array)",
"def min(sel... | [
"0.8388574",
"0.8113218",
"0.77724975",
"0.7703427",
"0.7552608",
"0.75308305",
"0.75139034",
"0.75139034",
"0.7503829",
"0.75018495",
"0.7440851",
"0.7439115",
"0.74255264",
"0.74159944",
"0.73929495",
"0.73756987",
"0.7351193",
"0.7325096",
"0.7323254",
"0.7309081",
"0.7277... | 0.7722654 | 3 |
Return the largest value in the dataset. | def get_max(cls, data: tuple or list) -> float:
cls._data_validation(data)
return max(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Max(data):\n return data.max()",
"def max(self):\n most = self.data[0]\n \n for i in range(len(self.data)):\n if self.data[i] > least:\n most = self.data[i]\n return most",
"def max(self):\r\n return np.max(self.data_array)",
"def find_max(s... | [
"0.8291376",
"0.77494514",
"0.7716706",
"0.7686243",
"0.766863",
"0.7658812",
"0.7559072",
"0.74945927",
"0.7463959",
"0.7448346",
"0.7391621",
"0.7389968",
"0.73887724",
"0.7348853",
"0.734467",
"0.72959566",
"0.7274089",
"0.7269163",
"0.72608757",
"0.72440267",
"0.72375965"... | 0.7477757 | 8 |
Return a tuple of data's quartile information (Q1, Q2, Q3, IQR) If you arrange all valued in the dataset from smallest to largest, Q2 is the middlemost value (the median). If you divide the dataset in half from this median and find the middlemost value in these halves, Q1 is the middlemost value of the first half and Q... | def get_quartile_data(cls, data: tuple or list) -> tuple:
cls._data_validation(data)
# Sort the data
sorted_data = sorted(list(data))
# Get q2, which is the median
q2 = cls.get_median(data)
first_half_data = list()
second_half_data = list()
# add to first ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quartile_data(cls, data: tuple or list) -> tuple:\n cls._data_validation(data)\n from math import floor\n # Sort the data\n n = cls.get_n(data)\n if n == 0:\n # Empty dataset, returns zeroes\n return 0, 0, 0, 0\n sorted_data = sorted(list(data... | [
"0.86814016",
"0.7956387",
"0.73629045",
"0.7266403",
"0.72327554",
"0.6956993",
"0.6757972",
"0.668319",
"0.6638791",
"0.66310585",
"0.6606817",
"0.659038",
"0.6587118",
"0.6565645",
"0.65437573",
"0.6538354",
"0.6502364",
"0.64743066",
"0.64359903",
"0.63698876",
"0.636948"... | 0.8612872 | 1 |
Return a tuple of data's quartile information (Q1, Q2, Q3, IQR) If you arrange all valued in the dataset from smallest to largest, Q2 is the middlemost value (the median). If you divide the dataset in half from this median and find the middlemost value in these halves, Q1 is the middlemost value of the first half and Q... | def get_quartile_data(cls, data: tuple or list) -> tuple:
cls._data_validation(data)
from math import floor
# Sort the data
n = cls.get_n(data)
if n == 0:
# Empty dataset, returns zeroes
return 0, 0, 0, 0
sorted_data = sorted(list(data))
n_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quartile_data(cls, data: tuple or list) -> tuple:\n cls._data_validation(data)\n # Sort the data\n sorted_data = sorted(list(data))\n # Get q2, which is the median\n q2 = cls.get_median(data)\n first_half_data = list()\n second_half_data = list()\n # ... | [
"0.86127615",
"0.79561895",
"0.7363667",
"0.7266413",
"0.7234658",
"0.6957703",
"0.67579246",
"0.6683327",
"0.6639408",
"0.6631373",
"0.6607943",
"0.65904045",
"0.65866876",
"0.65661675",
"0.6544473",
"0.6537689",
"0.65024775",
"0.64734846",
"0.6436739",
"0.6370607",
"0.63698... | 0.8681264 | 0 |
Calculates the standard error of the data set | def get_sterr(cls, data: tuple or list, is_population=False) -> float:
cls._data_validation(data)
from math import sqrt
return cls.get_stdev(data, is_population) / sqrt(cls.get_n(data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _std_err(self):\n return np.sqrt(np.sum(np.square(self._resids), axis=-2) / self._df_err)",
"def stdDev(data):\r\n sum = 0\r\n ave = average(data)\r\n for i in data:\r\n sum += (i-ave)**2\r\n return math.sqrt(sum/len(data))",
"def _std(self, data):\n var = stats.var(data)\n... | [
"0.77618897",
"0.768102",
"0.76728016",
"0.75649065",
"0.74662703",
"0.74662703",
"0.7446708",
"0.74044746",
"0.7321665",
"0.7290237",
"0.72575426",
"0.7230004",
"0.7202542",
"0.71747965",
"0.7144455",
"0.7141724",
"0.7113322",
"0.710487",
"0.71007746",
"0.7083214",
"0.707827... | 0.745041 | 6 |
Returns the coefficient of variation | def get_cv(cls, data: tuple or list, is_population=False) -> float:
cls._data_validation(data)
return cls.get_stdev(data, is_population) / cls.get_mean(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficient_variation(self):\n std, mean = self.std()\n coefficient_variation = std/mean\n print(f\"Coefficient of Variation is: {coefficient_variation}\")\n return coefficient_variation",
"def coefficient(self) -> float:\n ...",
"def variation_coefficient(x):\n mean =... | [
"0.84608895",
"0.7711722",
"0.7174668",
"0.70127076",
"0.6875122",
"0.68737847",
"0.6774349",
"0.67135286",
"0.67047244",
"0.67001253",
"0.6636506",
"0.63786906",
"0.63384885",
"0.63047206",
"0.6302478",
"0.62440664",
"0.62195796",
"0.61804396",
"0.6176707",
"0.616883",
"0.61... | 0.0 | -1 |
Return a tuple of lower/upper confidence interval boundaries Calculates the lower mean estimation and upper mean estimation at confidence level = cl, default 0.95 (95% confidence). CI = mean \u00B1 tscore sterr | def get_ci(cls, data: tuple or list, cl=0.95,
is_population=False, tail="two") -> tuple:
cls._data_validation(data)
mean = cls.get_mean(data)
e = cls.get_moe(
data, cl=cl, is_population=is_population, tail=tail
)
return mean - e, mean + e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confidenceInterval(start,end,confidence):\n\n\tmean = 0.5*(end+start)\n\tstddev = getStdDev(0.5*(end-start), confidence)\n\n\treturn (mean,stddev)",
"def confidence_intervals(data):\r\n\r\n x_bar = np.nanmean(data) # Mean value\r\n s = np.nanstd(data) # Standard deviation\r\n n = len(data... | [
"0.67773163",
"0.6773945",
"0.6168441",
"0.6158361",
"0.6102381",
"0.60974455",
"0.60925126",
"0.609096",
"0.60724056",
"0.60198486",
"0.5991198",
"0.59691167",
"0.5966811",
"0.59360147",
"0.5885035",
"0.586279",
"0.5861269",
"0.5857327",
"0.5825069",
"0.5751472",
"0.5741298"... | 0.5543158 | 41 |
Add pressure vessel failure to leaks dict. Store failure rate, flow rate and expected time duration of the event for transfer line failure. Based on FESHM 4240. Failure modes are analyzed by `Volume.odh` method. | def pressure_vessel_failure(self, q_std_rupture, fluid=None):
# If fluid not defined use fluid of the Source
fluid = fluid or self.fluid
for case, parameters in TABLE_2['Vessel, pressure'].items():
name = 'Pressure vessel ' + case
if isinstance(parameters, dict):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def u_tube_failure(self, outer_tube, inner_tube, L, use_rate,\n fluid=None, N=1):\n # TODO Make areas adjustable, add info to docstring\n flow_path_cases = {'Small event': ht.piping.Annulus(outer_tube.ID,\n inner_tube.OD... | [
"0.5895279",
"0.58741015",
"0.58721024",
"0.57350564",
"0.5734858",
"0.5273407",
"0.5273209",
"0.5161501",
"0.5152299",
"0.50805694",
"0.50692445",
"0.50475574",
"0.50008637",
"0.50005174",
"0.49996737",
"0.49666536",
"0.49650532",
"0.49615368",
"0.49581695",
"0.49567917",
"0... | 0.666339 | 0 |
Calculate ODH fatality rate for given `Source`s. For each leak of each source ODH conditions are analyzed and fatality rates are calculated. The results are collected in fail_modes list. | def odh(self, sources, power_outage=False):
self.fail_modes = []
# Probability of power failure in the building:
# PFD_power if no outage, 1 if there is outage
PFD_power_build = (power_outage or
TABLE_1['Electrical Power Failure']['Demand rate'])
# Calc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fatality_fan_powered(self, source, leak, sol_PFD, PFD_power_build):\n (failure_mode_name, leak_failure_rate, q_leak, tau, N) = leak\n for (P_fan, Q_fan, N_fan) in self.Fan_flowrates:\n # Probability of power on, ODH system working, and m number of fans\n # with flow rate Q_... | [
"0.639882",
"0.61853623",
"0.5198145",
"0.48865837",
"0.4809793",
"0.4745529",
"0.47022194",
"0.4641142",
"0.4628895",
"0.45942694",
"0.4469745",
"0.4404132",
"0.43621033",
"0.43478933",
"0.43275335",
"0.43183514",
"0.431352",
"0.4298347",
"0.4293593",
"0.42874545",
"0.427791... | 0.7015947 | 0 |
Calculate the final oxygen concentration for continuous flow. Equivalent to conc_vent(V, R, Q, float('inf')). | def conc_final(V, R, Q):
if Q > 0:
C = 0.21/(Q+R)*Q
elif abs(Q) <= abs(R):
C = 0
elif abs(Q) > abs(R):
C = 0.21*(1-R/abs(Q))
return C | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conc_vent(V, R, Q, t):\n if Q > 0:\n C = 0.21/(Q+R) * (Q+R*math.e**-((Q+R)/V*t))\n elif abs(Q) <= R:\n C = 0.21*math.e**-(R/V*t)\n elif abs(Q) > R:\n C = 0.21*(1-R/abs(Q)*(1-math.e**-(abs(Q)*t/V)))\n return C",
"def conc_after(V, C_e, Q, t, t_e):\n C = 0.21-(0.21-C_e)*math... | [
"0.7371679",
"0.68841326",
"0.62628317",
"0.6067613",
"0.600988",
"0.5925458",
"0.58317536",
"0.57587767",
"0.57530713",
"0.57408696",
"0.55814916",
"0.55788034",
"0.5552848",
"0.5534186",
"0.5490134",
"0.5466125",
"0.5437804",
"0.5426694",
"0.542646",
"0.5424657",
"0.5414025... | 0.6911598 | 1 |
r""" Reinitializes all the parameters with the provided initialization function, defaulting to the normal distribution of standard deviation 0.01. | def init_parameters(
self, init_fun: Optional[NNInitFunc] = None, *, seed: Optional[PRNGKeyT] = None
):
if init_fun is None:
init_fun = normal(stddev=0.01)
rng = nkjax.PRNGSeq(nkjax.PRNGKey(seed))
def new_pars(par):
return jnp.asarray(
init_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_parameters(self):\n logger.info('===== Initialize %s with normal distribution =====' % self.__class__.__name__)\n for n, p in self.named_parameters():\n init_like_transformer_xl(n, p, std=0.02)",
"def reset_parameters(self, param_init):\n logger.info('===== Initialize %s... | [
"0.8164107",
"0.7780627",
"0.7583683",
"0.75018615",
"0.75018615",
"0.7494337",
"0.7231574",
"0.711186",
"0.7100888",
"0.7009165",
"0.6939912",
"0.69313055",
"0.69313055",
"0.6871336",
"0.68066937",
"0.6782162",
"0.6779364",
"0.6769492",
"0.67448604",
"0.67255175",
"0.6697283... | 0.6504089 | 24 |
Gets the list of DSS intrinsic classes (names of the classes). | def dss_classes(self) -> List[str]:
return Bridge.var_array_function(self.dss_obj.DSSV, 0, None, '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classes(self):\n return self._.d",
"def get_classes(self):\n query = read_query('structure exploration/classes')\n response = self._submit_query(query)\n\n return [elem['c']['value'].split('/')[-1] for elem in response]",
"def return_classes(self):\n\n\t\t \n\t\t \n\t\tretur... | [
"0.7254253",
"0.7246251",
"0.7050101",
"0.70027125",
"0.6805527",
"0.6803973",
"0.6769885",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
"0.6745064",
... | 0.6751635 | 7 |
Make a string or a list safe for Javascript | def js_sq_safe(sol, depth=1, escape_newlines = True):
if not sol:
return ''
if isinstance(sol, list):
l = []
for el in sol:
l.append(_js_sq_safe(el, depth, escape_newlines))
return l
else:
return _js_sq_safe(sol, depth, escape_newlines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safelist(listable):\n if type(listable) == str:\n return [listable]\n else:\n return listable.tolist()",
"def str_or_list(value):\n if isinstance(value, list):\n return value\n return [value]",
"def ensure_list(thing):\r\n\r\n if isinstance(thing, str_types):\r\n ... | [
"0.7269709",
"0.7240886",
"0.7158595",
"0.66801685",
"0.65822023",
"0.65314627",
"0.6517503",
"0.64495367",
"0.64410615",
"0.6424395",
"0.64048517",
"0.6404595",
"0.640062",
"0.6379977",
"0.63736075",
"0.6276771",
"0.6276673",
"0.62374765",
"0.62016916",
"0.61610067",
"0.6142... | 0.0 | -1 |
Make a string or a list safe for Javascript | def js_dq_safe(sol, depth=1):
if not sol:
return ''
if isinstance(sol, list):
l = []
for el in sol:
l.append(_js_dq_safe(el))
return l
else:
return _js_dq_safe(sol, depth) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safelist(listable):\n if type(listable) == str:\n return [listable]\n else:\n return listable.tolist()",
"def str_or_list(value):\n if isinstance(value, list):\n return value\n return [value]",
"def ensure_list(thing):\r\n\r\n if isinstance(thing, str_types):\r\n ... | [
"0.7269709",
"0.7240886",
"0.7158595",
"0.66801685",
"0.65822023",
"0.65314627",
"0.6517503",
"0.64495367",
"0.64410615",
"0.6424395",
"0.64048517",
"0.6404595",
"0.640062",
"0.6379977",
"0.63736075",
"0.6276771",
"0.6276673",
"0.62374765",
"0.62016916",
"0.61610067",
"0.6142... | 0.0 | -1 |
Parses a URL and truncates it after the domain part | def url_truncate(url):
url_tuple = urlparse.urlparse(url)
return url_tuple[0] + '://' + url_tuple[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domain_parse(url):\n url = url.lower()\n if not url.startswith('http://') and not url.startswith('https://'):\n url = '{schema}{host}'.format(schema='http://', host=url)\n url = urlparse(url)\n if not url.hostname:\n raise ValueError('Invalid domain provided')\n\n # Strip www prefi... | [
"0.7620176",
"0.7324768",
"0.7284738",
"0.7240761",
"0.7154701",
"0.70812964",
"0.7073174",
"0.70719314",
"0.706794",
"0.7067837",
"0.7048127",
"0.7047652",
"0.69829565",
"0.6875338",
"0.6874541",
"0.6873694",
"0.6865281",
"0.6862966",
"0.68619376",
"0.68316275",
"0.68275714"... | 0.76441383 | 0 |
Parses a URL and truncates it after the domain part | def url_get_domain(url):
url_tuple = urlparse.urlparse(url)
return url_tuple[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_truncate(url):\n \n url_tuple = urlparse.urlparse(url)\n return url_tuple[0] + '://' + url_tuple[1]",
"def domain_parse(url):\n url = url.lower()\n if not url.startswith('http://') and not url.startswith('https://'):\n url = '{schema}{host}'.format(schema='http://', host=url)\n url = u... | [
"0.76441383",
"0.7620176",
"0.7324768",
"0.7284738",
"0.7240761",
"0.7154701",
"0.70812964",
"0.7073174",
"0.70719314",
"0.706794",
"0.7067837",
"0.7048127",
"0.7047652",
"0.69829565",
"0.6875338",
"0.6874541",
"0.6873694",
"0.6865281",
"0.6862966",
"0.68619376",
"0.68316275"... | 0.6817899 | 23 |
Factory which returns a random image file name. | def create_random_file_name():
def random_file_name_factory():
length = random.randint(10, 15)
chars = string.ascii_letters + string.digits + "-_"
return f"{''.join(random.choice(chars) for _ in range(length))}.jpg"
return random_file_name_factory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename_generate(image_class, size=12, chars=string.ascii_uppercase + string.ascii_lowercase + string.digits):\n\tnew_filename = time.strftime(\"%d-%m-%Y_\")\n\tnew_filename = new_filename + ''.join(random.choice(chars) for _ in range(size))\n\tnew_filename = new_filename + \"_P\" + str(image_class)\n\treturn... | [
"0.7617596",
"0.71837944",
"0.7169918",
"0.7101182",
"0.70534843",
"0.698676",
"0.6965958",
"0.68606925",
"0.68600625",
"0.6857476",
"0.67635787",
"0.6722866",
"0.6721171",
"0.6692241",
"0.66776305",
"0.66626406",
"0.66584057",
"0.66395634",
"0.66275424",
"0.66211987",
"0.662... | 0.8460935 | 0 |
Do not return anything, modify head inplace instead. | def reorderList(self, head: ListNode) -> None:
if not head:
return None
slow = fast = head
while True: # find the middle node
if not fast.next or not fast.next.next:
break
fast = fast.next.next
slow = slow.next
head_1 = head... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self, head):\n\n self._head = head",
"def move_to_head(self, node):\n if node is self.head:\n return\n value = node.value\n self.delete(node)\n self.add_to_head(value)",
"def _move_to_head(self, node):\n self._remove_node(node)\n self._add_no... | [
"0.7218526",
"0.6802109",
"0.6732775",
"0.6622557",
"0.65217346",
"0.6466963",
"0.64551795",
"0.63585746",
"0.63523316",
"0.63093",
"0.6231313",
"0.622523",
"0.62005043",
"0.62005043",
"0.62005043",
"0.62005043",
"0.6198878",
"0.6193791",
"0.61740905",
"0.6149187",
"0.6120934... | 0.62923217 | 10 |
return path of best checkpoint in a model_dir | def best_checkpoint(model_dir, model_name):
filenames = glob.glob(os.path.join(model_dir,model_name+".*"))
best = 0
best_ckpt = ""
for fname in filenames:
tmp = float(fname.replace(os.path.join(model_dir,model_name+"."),""))
if best < tmp:
best = tmp
best_ckpt = f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_model(model_chkp_dir, mode='last'):\n\n if mode == 'last':\n file_name = sorted(os.listdir(model_chkp_dir))[-1]\n model_path = os.path.join(model_chkp_dir, file_name)\n\n elif mode == 'best':\n raise NotImplementedError\n\n return model_path",
"def _find_last_checkpoint(se... | [
"0.77047443",
"0.7275439",
"0.7243931",
"0.7167202",
"0.7096826",
"0.70633096",
"0.70490897",
"0.7047686",
"0.6949422",
"0.69273454",
"0.69082046",
"0.6876256",
"0.6825796",
"0.6814628",
"0.6799923",
"0.67915136",
"0.67452896",
"0.6720997",
"0.6715767",
"0.6666559",
"0.666464... | 0.7602403 | 1 |
Get the default trace codes mapping. | def default_trace_codes() -> Mapping[int, str]:
with open(Path(__file__).resolve().parent.joinpath('trace.codes'), 'r') as fd:
return from_trace_codes_text(fd.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_trace_codes_file(path: str) -> Mapping[int, str]:\n with open(path, 'r') as fd:\n return from_trace_codes_text(fd.read())",
"def forward_code_map(self):\n\n return { c.key:c.value for c in self.codes}",
"def codes(self, name):\n return self._get_valuemap(name, non_mapped='codes... | [
"0.6177796",
"0.6068879",
"0.60158306",
"0.58416814",
"0.5706858",
"0.5705263",
"0.563382",
"0.5626298",
"0.5607481",
"0.558467",
"0.549548",
"0.5402228",
"0.5259976",
"0.52537525",
"0.52353066",
"0.5230671",
"0.51013124",
"0.5097843",
"0.5085019",
"0.50778747",
"0.5073233",
... | 0.86958295 | 0 |
Checks if a file is an allowed extension. | def has_file_allowed_extension(filename, extensions):
return filename.lower().endswith(extensions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS",
"def allowed_file(filename, allowed_extension):\n return '.' in filename and get_file_ext(filename) in allowed_extension",
"def is_allowed_file(filename, allowed_ext):\n ext = filename.... | [
"0.895309",
"0.8786745",
"0.8764468",
"0.87614024",
"0.8612598",
"0.8612598",
"0.8612598",
"0.8612598",
"0.8612598",
"0.8612598",
"0.85555506",
"0.8541878",
"0.8525629",
"0.8525629",
"0.85190576",
"0.85190576",
"0.85155004",
"0.8498841",
"0.8496414",
"0.8496414",
"0.8496414",... | 0.85909545 | 10 |
Return a full name, neatly formatted. | def get_formatted_name(first_name, last_name):
# Describe the function
# The names are joined into full name
formatted_name = first_name + ' ' + last_name
# return the value, don't do anything with it yet
return formatted_name.title() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_name(self):\n full_name = '{0} {1} {2}'.format(self.last_name, self.first_name, self.patronymic)\n return full_name.strip()",
"def get_full_name(self):\n\t\tfull_name = '%s %s' % (self.first_name, self.last_name)\n\t\treturn full_name.strip()",
"def get_full_name(self):\r\n fu... | [
"0.87166595",
"0.86399925",
"0.860218",
"0.860218",
"0.8595642",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"0.8579464",
"... | 0.8075149 | 89 |
Get this project fodler's path based on the root project folder | def get_path(self):
definition = self.client._perform_json("GET", "/project-folders/%s" % self.project_folder_id)
parent_id = definition.get("parentId", None)
if parent_id is not None:
parent = DSSProjectFolder(self.client, parent_id)
path = parent.get_path()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_root() -> Path:\n return PROJECT_ROOT",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def get_project_root() ... | [
"0.8235499",
"0.8067117",
"0.8067117",
"0.8067117",
"0.8067117",
"0.8020036",
"0.80105877",
"0.798057",
"0.79498434",
"0.79498434",
"0.78684473",
"0.7840187",
"0.78349745",
"0.78298706",
"0.78261703",
"0.77194214",
"0.77119213",
"0.7646504",
"0.76464844",
"0.7615128",
"0.7538... | 0.67456156 | 80 |
Get this project folder's parent or None if it is the root project folder | def get_parent(self):
parent_id = self.client._perform_json("GET", "/project-folders/%s" % self.project_folder_id).get("parentId", None)
if parent_id is None:
return None
else:
return DSSProjectFolder(self.client, parent_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_folder(self):\n return self.properties.get(\"ParentFolder\",\n Folder(self.context, ResourcePath(\"ParentFolder\", self.resource_path)))",
"def parent_dir(self):\n parent = os.path.dirname(self.dirn)\n if self.is_subdir:\n parent = os.p... | [
"0.75956905",
"0.7526333",
"0.7380301",
"0.7366877",
"0.73337495",
"0.7214397",
"0.7214397",
"0.7214397",
"0.7214397",
"0.72093064",
"0.71505404",
"0.7147413",
"0.7147413",
"0.7107515",
"0.70951563",
"0.7071745",
"0.7060472",
"0.70595",
"0.70325863",
"0.7026057",
"0.70073944"... | 0.8148282 | 0 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'csa/about.html',
{
'title':'About',
'message':'Your application description page.',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.7697684 | 63 |
Release the play_lock, allowing this player to take action. | def release_play_lock(self) :
self.play_lock = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_play_lock(self) : \n self.play_lock = True",
"def release_lock(self):\n if self.lock:\n self.lock.release()",
"def _unload_player(self):\n if self.player is not None:\n Logger.info(\"VLCPlayer: Unloading player\")\n self.player.event_manager().eve... | [
"0.80757964",
"0.681601",
"0.6544812",
"0.6506472",
"0.6494424",
"0.64629257",
"0.6462893",
"0.64540225",
"0.6352633",
"0.6288496",
"0.62782377",
"0.62748384",
"0.62733674",
"0.6267041",
"0.62507015",
"0.6235214",
"0.6166721",
"0.6162678",
"0.6134564",
"0.6134564",
"0.611125"... | 0.89283556 | 0 |
Evaluate the performance of the model. | def evaluate(self, predicted_df):
logging.info("Evaluating model: {}".format(self.model_type))
y_true = predicted_df["user_label"].as_matrix()
y_pred = predicted_df["label"].as_matrix()
scores_cols = [col for col in predicted_df.columns if col.startswith("scores_")]
print("score... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self):\n\n\t\tself.model_score = self.model.evaluate(self.x_test, self.y_test, batch_size=2048)\n\t\tprint(\"%s score = %f\\n\" %(self.modelName, self.model_score[1]))\n\t\treturn self.model_score",
"def compute(self) -> None:\n \n self.model.eval()\n \n with torch.no_gra... | [
"0.7711942",
"0.73346895",
"0.71317655",
"0.7105579",
"0.70656854",
"0.70634615",
"0.69919205",
"0.6953733",
"0.6874777",
"0.6843255",
"0.6795231",
"0.6788053",
"0.67848986",
"0.676979",
"0.67637795",
"0.6749132",
"0.67285705",
"0.6721111",
"0.67133737",
"0.6701221",
"0.66856... | 0.6486224 | 47 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.7635831",
"0.7547... | 0.76458347 | 19 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.7635831",
"0.7547... | 0.76458347 | 20 |
Compute duration in minutes from the duration string | def compute_duration(duration_str, time_format='hour'):
assert time_format in ['hour', 'minute'], "Expected time_format should be either 'hour' or 'minute'"
duration = 0
hour_arr = re.findall(r'\d+h', duration_str)
if len(hour_arr) > 0:
if time_format == "minute":
duration += 60*int(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes(duration):\n if not duration:\n return 0\n try:\n h, m, s = duration_parts(duration)\n return m\n except (ValueError, TypeError):\n return 0",
"def parse_duration_str(self, duration):\n try:\n dl = duration.split(\":\")\n except Exception:... | [
"0.80631065",
"0.7621725",
"0.7601942",
"0.7085663",
"0.68833923",
"0.68659025",
"0.68131024",
"0.6806242",
"0.67452836",
"0.6689314",
"0.66808337",
"0.666538",
"0.6652465",
"0.6652354",
"0.6648438",
"0.6647693",
"0.6610369",
"0.66067535",
"0.65381604",
"0.6508078",
"0.647307... | 0.74521375 | 3 |
Add one or more links to the menu links collection. | def add_links(self, *args):
for link in args:
self.add_link(link) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_link(self, **kwgs):\n self.links.append(kwgs)",
"def links(self, links):\n\n self.container['links'] = links",
"def links(self, links):\n self._links = links",
"def links(self, links):\n if links is None:\n raise ValueError(\"Invalid value for `links`, must not ... | [
"0.73592496",
"0.72956747",
"0.6941168",
"0.69123816",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.67823446",
"0.6446638",
"0.63709253",
"0.6358212",
"0.6212924",
... | 0.8036747 | 0 |
> int Returns players strength. | def getStrength(self):
return self.st | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strength(self) -> int:\n return self._strength",
"def strength(self) -> float:\n ...",
"def get_strength(self):\n return 10 - self.get_agility()",
"def get_winStrength(self):\n if self.winStrength is None:\n self.calculate_my_win_strength()\n return self.winS... | [
"0.7872476",
"0.7800016",
"0.7472845",
"0.7226558",
"0.72069067",
"0.70619524",
"0.6963709",
"0.6867893",
"0.6865446",
"0.6847474",
"0.6814138",
"0.67945486",
"0.6460027",
"0.6458844",
"0.64280874",
"0.6405029",
"0.6339806",
"0.6296817",
"0.62956667",
"0.62922376",
"0.6289024... | 0.71575767 | 5 |
Adding a number of casualties. | def addCasualties(self, number):
self.casualties += number
self.ssp += (number * __SSP_CASUALTY__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCasualties(self):\n return self.casualties",
"def comply(self, counts):\n pass",
"def threes(dice):\n return sum([x for x in dice if x == 3])",
"def addCowWeight(list, cows):\r\n sum = 0.0\r\n for key in list:\r\n sum += cows[key]\r\n return sum",
... | [
"0.6208296",
"0.5390049",
"0.5363903",
"0.5341021",
"0.5328923",
"0.52360344",
"0.51885754",
"0.5157553",
"0.5156806",
"0.5020415",
"0.50171345",
"0.49978325",
"0.49969417",
"0.49969417",
"0.49925345",
"0.49781254",
"0.49718857",
"0.49669224",
"0.49357152",
"0.49299726",
"0.4... | 0.81291544 | 0 |
Returns a list of fingerprintable (option type, option value) pairs for the given scope. Note that this method only collects values for a single scope, NOT from all enclosing scopes as in the Options class! | def get_fingerprintable_for_scope(self, bottom_scope, include_passthru=False):
pairs = []
if include_passthru:
pu_args = self.passthru_args_for_scope(bottom_scope)
pairs.extend((str, arg) for arg in pu_args)
option_values = self.for_scope(bottom_scope)
for option_name, option_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_options(options, passthru_args=None, fingerprintable_options=None):\n fingerprintable = fingerprintable_options or defaultdict(dict)\n\n class FakeOptions(object):\n def for_scope(self, scope):\n # TODO(John Sirois): Some users pass in A dict of scope -> _FakeOptionValues instead of a\n #... | [
"0.6032837",
"0.57206696",
"0.54889756",
"0.5399676",
"0.53649104",
"0.5362223",
"0.53584826",
"0.5325002",
"0.5310102",
"0.5294651",
"0.5274094",
"0.5268435",
"0.5239358",
"0.52050084",
"0.5195042",
"0.51844776",
"0.5182056",
"0.5179435",
"0.51662195",
"0.5162545",
"0.509632... | 0.7801775 | 0 |
Get the total duration of an audio file | def getDuration(fn: str) -> float:
return QueryWav(fn).duration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\n with audioread.audio_open(self.path) as f:\n return f.duration",
"def audio_duration(self) -> float:\n\n for track in self.mi.tracks:\n if track.track_type == \"Audio\":\n return track.duration / 1000.0\n\n raise LookupError(\"Audio ... | [
"0.86111206",
"0.81228304",
"0.80015373",
"0.787591",
"0.7574908",
"0.7326772",
"0.72743034",
"0.7261533",
"0.71706825",
"0.7169626",
"0.71606094",
"0.71595025",
"0.7106858",
"0.70928776",
"0.6997085",
"0.69847584",
"0.69769484",
"0.69466114",
"0.69359106",
"0.69194454",
"0.6... | 0.68412036 | 22 |
Function for getting the response of a request. | def get_response(app: Flask, auth: list, callback: Callable, argument: str) -> str:
ARG: str = request.args.get(argument)
TOKEN = request.args.get('auth')
if not TOKEN in auth:
return jsonify({'ERROR': 'unauthorized'}), 401
resp, success = callback(ARG)
if isinsta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_response(request_url):\n return requests.get(request_url)",
"def get_response(self):\n result = self.get_response_impl()\n if self.log_dest is not None:\n is_error, response = result\n if is_error:\n response = \"? \" + response\n else:\n ... | [
"0.74265534",
"0.7274036",
"0.72116536",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71485066",
"0.71033055",
"0.70988005",
"0.70915437",
"0.6950993",
"0.6839979",
... | 0.0 | -1 |
Assigned a diagnoses string to each icd9_code value. Returns a string value to replace the icd9_code. | def icd9_descriptions(row):
if 1 <= row['icd9_code'] <= 139:
val = 'Parasitic_Disease'
elif 140 <= row['icd9_code'] <= 239:
val = 'Neoplasm'
elif 240 <= row['icd9_code'] <= 279:
val = 'Endocrine'
elif 280 <= row['icd9_code'] <= 289:
val = "Blood"
elif 290 <= row['icd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compress_icd9_codes(data):\n\n data.icd9_code = data.icd9_code.apply(lambda x: '.1' if 'V' in x else x)\n data.icd9_code = data.icd9_code.apply(lambda x: '.8' if 'M' in x else x)\n data.icd9_code = data.icd9_code.apply(lambda x: '.5' if 'E' in x else x)\n data.icd9_code = data.icd9_code.apply(lambd... | [
"0.6669377",
"0.6589875",
"0.56882864",
"0.56826764",
"0.562795",
"0.5608775",
"0.5569566",
"0.5561059",
"0.55242795",
"0.55080825",
"0.5497307",
"0.54821837",
"0.538534",
"0.5370571",
"0.5327301",
"0.5282071",
"0.527167",
"0.5270198",
"0.52388126",
"0.52322024",
"0.521477",
... | 0.5801784 | 2 |
Regularize alpha' and beta' to get alpha and beta. | def _get_alpha_beta(self):
alpha = tf.nn.softplus(self.alpha_prime)
beta = -alpha + tf.nn.softplus(self.beta_prime)
return alpha, beta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_alpha_beta(self, a, b):\n beta = a / b\n alpha = a * beta\n return alpha, beta",
"def getBeta(self, alpha):\n return 2.0*(2.0-alpha) + -4.0*np.sqrt(1.0-alpha)",
"def B(alpha, beta):\n return math.gamma(apha) * math.gamma(beta) / math.gamma(alpha + beta)",
"def B(alpha,... | [
"0.6881302",
"0.57053274",
"0.56613654",
"0.565913",
"0.565913",
"0.565913",
"0.5611329",
"0.5522475",
"0.54939735",
"0.5400471",
"0.53844523",
"0.5373884",
"0.5366616",
"0.5361639",
"0.53530854",
"0.53477436",
"0.53169733",
"0.5291241",
"0.52699775",
"0.5250733",
"0.5244091"... | 0.62813294 | 1 |
Builds a deep stack of affine flows. | def _make_affine_flow(dim, flow_depth):
bijectors = []
bijectors.append(tfp.bijectors.BatchNormalization())
for _ in range(flow_depth):
bijectors.append(
tfp.bijectors.Shift(tf.Variable(tf.zeros(dim), trainable=True)))
bijectors.append(
tfp.bijectors.ScaleMatvecDiag(
tf.Variabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_deep_flow(flow_type, flow_depth, flow_width, dim):\n if flow_type not in ['maf', 'radial', 'affine']:\n raise ValueError(f'Flow type {flow_type} is not maf, radial, or affine.')\n if flow_type == 'maf':\n return _make_maf_flow(flow_depth, flow_width)\n elif flow_type == 'radial':\n return _ma... | [
"0.59337586",
"0.5399486",
"0.5390985",
"0.5343883",
"0.53140175",
"0.51704687",
"0.5104873",
"0.50996596",
"0.5072876",
"0.50484717",
"0.5034771",
"0.50327533",
"0.5028579",
"0.50236404",
"0.4965254",
"0.4961731",
"0.49526247",
"0.49449387",
"0.4935633",
"0.49265182",
"0.492... | 0.6329806 | 0 |
function to return correctly formatted string according to time units | def __get_elapsed__(self):
elapsed = (self.__end_time - self.__start_time)
unit = "seconds"
if elapsed >= 3600:
unit = "minutes"
hours = elapsed / 3600
minutes = hours % 60
hours = floor(hours)
print(self.name, "took", str(hours), "hour... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_string(time_f: float) -> str:\n m, s = divmod(time_f, 60)\n h, m = divmod(m, 60)\n\n if h < 1:\n if m < 1 and s < 1:\n msec = int(s * 1000)\n return '{:=03d}msec'.format(msec)\n\n if m < 1:\n return '{:=02.0f}sec'.format(s)\n\n return '{:=02.0... | [
"0.7377603",
"0.72857213",
"0.7261869",
"0.72236234",
"0.7190604",
"0.7091166",
"0.7061665",
"0.70403826",
"0.70249295",
"0.6974717",
"0.696967",
"0.6968233",
"0.69529384",
"0.69443524",
"0.6900754",
"0.68987495",
"0.6884931",
"0.6883308",
"0.68191504",
"0.6818297",
"0.681611... | 0.0 | -1 |
Tests whether an object is allocated (is not None) | def exist(x):
return x is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allocate(self) -> bool:\n if hasattr(self.at_options, 'allocate'):\n return self.at_options.allocate == 1\n return False",
"def is_free(self):\n return self._size > 0",
"def is_single_allocation(self):\n return False",
"def allocated(self):\n if self.filename... | [
"0.673429",
"0.6577538",
"0.6454742",
"0.63901484",
"0.61998",
"0.61293757",
"0.61256206",
"0.60298693",
"0.59696543",
"0.59196436",
"0.5902429",
"0.5879166",
"0.58625203",
"0.58442664",
"0.5832015",
"0.5832015",
"0.5832015",
"0.5832015",
"0.5832015",
"0.58272415",
"0.5821599... | 0.0 | -1 |
The value of the configured API key. | def api_key(self):
# type () -> str
return self._api_key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"api_key\")",
"def api_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"api_key\")",
"def api_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"api_key\")",
"def api_key(self) -> pulumi.Input[str]:\n ... | [
"0.84604543",
"0.84604543",
"0.84604543",
"0.84604543",
"0.83680636",
"0.83680636",
"0.8286705",
"0.8273535",
"0.80353945",
"0.7971405",
"0.796341",
"0.7924865",
"0.78511596",
"0.78419137",
"0.7837885",
"0.7811335",
"0.7774548",
"0.77674556",
"0.77343494",
"0.77301174",
"0.77... | 0.8308566 | 6 |
Update the API key. This can be used when you've regenerated your service API key and want to update longlived clients. | def update_key(self, key):
self._api_key = key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"def set_api_key(new_api_key):\n global api_key\n api_key = new_api_key",
"def update_api_key(self, apikey_id, **kwargs):\n\n all_params = ['apikey_id', 'api_key']\n ... | [
"0.7447722",
"0.7447722",
"0.74372375",
"0.7170894",
"0.71437603",
"0.70787835",
"0.69710577",
"0.6895766",
"0.6862906",
"0.6694672",
"0.66607916",
"0.657263",
"0.6552993",
"0.6464547",
"0.64579034",
"0.64280456",
"0.6423422",
"0.6378686",
"0.6366006",
"0.63227934",
"0.632192... | 0.8198307 | 0 |
Find the bounding box of data. | def find_rect(self, data_3d):
datax = [i[0] for i in data_3d]
datay = [i[1] for i in data_3d]
return min(datax), max(datax), min(datay), max(datay) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounding_box(self):\n return None",
"def boundingBox(self):\n minx, miny, maxx, maxy = self.substrates.bounds\n return pcbnew.BOX2I(\n pcbnew.VECTOR2I(int(minx), int(miny)),\n pcbnew.VECTOR2I(int(maxx - minx), int(maxy - miny)))",
"def get_bounding_box(self):\n ... | [
"0.77076316",
"0.7513573",
"0.7454364",
"0.74021506",
"0.7401646",
"0.7384707",
"0.73705477",
"0.7338704",
"0.7338704",
"0.7314",
"0.73083025",
"0.7300773",
"0.7296764",
"0.72472554",
"0.72472554",
"0.7226854",
"0.72027403",
"0.71583563",
"0.7151969",
"0.71465003",
"0.7140096... | 0.0 | -1 |
checks if the y position set will be outside the circle and will hold it at that point | def checkYPos(self, *args):
x = self.initialXScale.get()
y = self.initialYScale.get()
if x ** 2 + y ** 2 > self.radius**2:
if y > 0:
self.initialYScale.set(np.sqrt(self.radius**2 - x ** 2))
else:
self.initialYScale.set(-np.sqrt(self.radius... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_boundary(self):\n\n\t\tif self.Bubble_initial_pos[0] <= self.Bubble_radius or self.Bubble_initial_pos[0] >= self.tk_pic.width - self.Bubble_radius:\n\t\t\tself.Bubble_vel[0] = -self.Bubble_vel[0]",
"def point_inside_circle(x,y,center_x,center_y,radius):\n return (x-center_x)**2 + (y - center_y)**2 < r... | [
"0.6409995",
"0.64027065",
"0.6278436",
"0.62465423",
"0.6142362",
"0.6125373",
"0.60288906",
"0.6002736",
"0.5950301",
"0.59413105",
"0.5895492",
"0.5886205",
"0.5884686",
"0.5869564",
"0.5853532",
"0.58382905",
"0.5837317",
"0.58295673",
"0.579188",
"0.57895184",
"0.5787874... | 0.72029173 | 0 |
Try to find the project root directory based on expected lists of files and/or directories it contains, recursively ascending from a given starting directory. Given a starting file assumed to be a descendent of the project root directory (or the root directory itself), examine that file to see if it is the project root... | def find_proj_root(self, descendant: Path, file_names: list, dir_names: list, max_levels: int = 25):
count_test_files = len(file_names) if isinstance(file_names, list) else 0
count_test_files += len(dir_names) if isinstance(dir_names, list) else 0
if count_test_files == 0:
raise Runt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_project_root_dir(target: Path) -> Path:\n p = Path(\".\").resolve()\n for _ in range(1000):\n try:\n candidate = _search_for_dir(target, p)\n return candidate.parent\n except DirectoryNotFoundException:\n p = p.parent\n raise DirectoryNotFoundExcept... | [
"0.6449977",
"0.63446194",
"0.59693354",
"0.589468",
"0.57563084",
"0.57514924",
"0.56900877",
"0.5676506",
"0.5509007",
"0.54974484",
"0.54620385",
"0.5414883",
"0.5392206",
"0.5351022",
"0.53417945",
"0.533628",
"0.53257906",
"0.53238785",
"0.52965724",
"0.52953446",
"0.528... | 0.6357597 | 1 |
Check if all the moves are on the board. Returns a tuple of booleans that map to the moves. True if valid, False if invalid | def validate_moves(moves):
valid_coords = []
for move in moves:
if move[0] in cc.VALID_RANKS and move[1] in cc.VALID_RANKS:
valid_coords.append(True)
else:
valid_coords.append(False)
return tuple(valid_coords) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_moves(self):\n # 2d matrix of true/false, true if something can be placed\n legal_move_board = []\n possible_move_list = []\n for row in range(self.size):\n move_row = []\n for col in range(self.size):\n empty = self.board[row][col].state == PegState.EMPTY\n move_row... | [
"0.78001523",
"0.766734",
"0.75982714",
"0.75587404",
"0.74753594",
"0.7397221",
"0.7394297",
"0.7388273",
"0.7386193",
"0.7369771",
"0.7319896",
"0.7297707",
"0.7287503",
"0.72816426",
"0.72715324",
"0.7268526",
"0.7248124",
"0.72416985",
"0.71910954",
"0.7183718",
"0.717262... | 0.74189585 | 5 |
Return filtered by search value queryset. | def get_queryset(self):
qs = super().get_queryset()
search_value = self.request.GET.get('search_box')
if search_value is not None:
qs = qs.search_by(search_value)
return qs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queryset(self, request, queryset):\n # Compare the requested value (either '80s' or 'other')\n # to decide how to filter the queryset.\n\n if self.value() is None:\n return queryset.all()\n\n return queryset.filter(firm__pk=self.value())",
"def get_queryset(self):\n ... | [
"0.715664",
"0.71247804",
"0.70761645",
"0.703622",
"0.7035118",
"0.68929595",
"0.6786135",
"0.67200524",
"0.669921",
"0.6685121",
"0.6676126",
"0.6639637",
"0.66092557",
"0.6591136",
"0.6586185",
"0.6503779",
"0.6502065",
"0.64994085",
"0.6464354",
"0.6445284",
"0.64293295",... | 0.791173 | 0 |
Constructor for a NotificationTypeModel | def __init__(self, source_entity_name: str, notification_description: str, entity_redirect_uri: str,
notification_type_id: int = None, created_on: str = None):
self.source_entity_name = source_entity_name
self.notification_description = notification_description
self.entity_redir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_notification_model(self, data: dict, **kwargs) -> 'NotificationTypeModel':\n try:\n return NotificationTypeModel(**data)\n except ValidationError as err:\n raise InvalidRequest(err)",
"def from_db(cls, db_model: 'NotificationTypeDBModel') -> 'NotificationTypeModel':\n... | [
"0.7389079",
"0.68408775",
"0.6283806",
"0.6283806",
"0.62733835",
"0.61120534",
"0.6072683",
"0.6057047",
"0.60151064",
"0.5931698",
"0.5931698",
"0.57694805",
"0.5736284",
"0.56996936",
"0.5698922",
"0.5698922",
"0.56896526",
"0.56463933",
"0.56296206",
"0.5611455",
"0.5591... | 0.619628 | 5 |
Constructor from a DB Model | def from_db(cls, db_model: 'NotificationTypeDBModel') -> 'NotificationTypeModel':
return NotificationTypeModel(db_model.source_entity_name, db_model.notification_description,
db_model.entity_redirect_uri, db_model.notification_type_id, db_model.created_on) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, model_cls, database):\n self.model = model_cls\n self._model_cls = model_cls\n self._database = database\n self._order_by = []\n self._where_q = Q()\n self._prewhere_q = Q()\n self._grouping_fields = []\n self._grouping_with_totals = False\... | [
"0.7377729",
"0.7319111",
"0.7150531",
"0.71168715",
"0.7074845",
"0.7055308",
"0.70251113",
"0.696238",
"0.69591254",
"0.69274324",
"0.69263077",
"0.68696994",
"0.68696994",
"0.68696994",
"0.68696994",
"0.68370414",
"0.6758262",
"0.6733917",
"0.67294717",
"0.6713421",
"0.659... | 0.0 | -1 |
gets an item from the read configuration. | def __getitem__(self, name):
return self.config[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item(self, key):\n return self.config[key] if key in self.config.keys() else None",
"def __getitem__(self, item):\n return self._config[item]",
"def __getitem__(self, key):\n return self.config[key]",
"def read_config(config, section, item):\n value = config.get(section, item)... | [
"0.7722142",
"0.75951964",
"0.6932821",
"0.6889499",
"0.6688419",
"0.6660884",
"0.66505265",
"0.65512353",
"0.6520645",
"0.646166",
"0.6432953",
"0.6432953",
"0.6432953",
"0.6412029",
"0.64076877",
"0.63988864",
"0.63988864",
"0.6372183",
"0.6345233",
"0.6318496",
"0.631397",... | 0.68387955 | 4 |
Return the TLE from sat_id | def get_tle(sat_id):
for sat in satellites:
if sat.name == sat_id:
return sat.tle
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tier(pkmn_id):\n if pkmn_id in tiers.TIERS[\"0\"]:\n return 0\n elif pkmn_id in tiers.TIERS[\"1\"]:\n return 1\n elif pkmn_id in tiers.TIERS[\"2\"]:\n return 2\n elif pkmn_id in tiers.TIERS[\"3\"]:\n return 3\n else:\n return 4",
"def _get_tier_color(pkm... | [
"0.54744244",
"0.5327852",
"0.5293958",
"0.5189246",
"0.5185192",
"0.5171703",
"0.51700526",
"0.51252013",
"0.5116307",
"0.5108249",
"0.5074463",
"0.49921268",
"0.4957534",
"0.49423563",
"0.49208283",
"0.49129754",
"0.48870516",
"0.48595324",
"0.4837113",
"0.4836963",
"0.4833... | 0.72863823 | 0 |
Create new navigation property to printerShares for print. Create new navigation property to printerShares for print. | def create_printer_shares(
self,
body, # type: "models.MicrosoftGraphPrinterShare"
**kwargs # type: Any
):
# type: (...) -> "models.MicrosoftGraphPrinterShare"
cls = kwargs.pop('cls', None) # type: ClsType["models.MicrosoftGraphPrinterShare"]
error_map = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_shares(\n self,\n body, # type: \"models.MicrosoftGraphPrinterShare\"\n **kwargs # type: Any\n ):\n # type: (...) -> \"models.MicrosoftGraphPrinterShare\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"models.MicrosoftGraphPrinterShare\"]\n error_map = ... | [
"0.57783026",
"0.5231743",
"0.50983196",
"0.4851825",
"0.48485887",
"0.47849977",
"0.47806564",
"0.45574224",
"0.45157352",
"0.44472182",
"0.44129157",
"0.4376351",
"0.4357706",
"0.4355947",
"0.43264663",
"0.4274848",
"0.42341945",
"0.4221774",
"0.41627723",
"0.41623652",
"0.... | 0.6013365 | 0 |
Update the navigation property printerShares in print. Update the navigation property printerShares in print. | def update_printer_shares(
self,
printer_share_id, # type: str
body, # type: "models.MicrosoftGraphPrinterShare"
**kwargs # type: Any
):
# type: (...) -> None
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_shares(\n self,\n printer_share_id, # type: str\n body, # type: \"models.MicrosoftGraphPrinterShare\"\n **kwargs # type: Any\n ):\n # type: (...) -> None\n cls = kwargs.pop('cls', None) # type: ClsType[None]\n error_map = {\n 401: Client... | [
"0.60168207",
"0.58797425",
"0.5139873",
"0.50018686",
"0.49725",
"0.489075",
"0.47493216",
"0.46902797",
"0.46506637",
"0.4645971",
"0.44011953",
"0.43775907",
"0.43299082",
"0.4329202",
"0.43075097",
"0.42506906",
"0.42386127",
"0.42100638",
"0.4194462",
"0.41872737",
"0.41... | 0.613246 | 0 |
Delete navigation property printerShares for print. Delete navigation property printerShares for print. | def delete_printer_shares(
self,
printer_share_id, # type: str
if_match=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_shares(\n self,\n printer_share_id, # type: str\n if_match=None, # type: Optional[str]\n **kwargs # type: Any\n ):\n # type: (...) -> None\n cls = kwargs.pop('cls', None) # type: ClsType[None]\n error_map = {\n 401: ClientAuthenticationE... | [
"0.5683588",
"0.5448751",
"0.5174152",
"0.5008662",
"0.49760768",
"0.49688616",
"0.4931828",
"0.4845979",
"0.48247477",
"0.47982392",
"0.47931978",
"0.47914562",
"0.4761925",
"0.47239703",
"0.46946055",
"0.46627745",
"0.46516562",
"0.46299604",
"0.46165127",
"0.46001336",
"0.... | 0.5776565 | 0 |
Get shares from print. Get shares from print. | def list_shares(
self,
orderby=None, # type: Optional[List[Union[str, "models.Enum85"]]]
select=None, # type: Optional[List[Union[str, "models.Enum86"]]]
expand=None, # type: Optional[List[Union[str, "models.Enum87"]]]
**kwargs # type: Any
):
# type: (...) -> Iter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sharelist():\n # Get field to order by for displaying shares\n if(request.args.get('orderby')):\n orderby = request.args.get('orderby')\n else:\n orderby = None\n # Get order for displaying shares\n if(request.args.get('order')):\n order = request.args.get('order')\n else... | [
"0.60573435",
"0.5950028",
"0.56314605",
"0.5524979",
"0.54956424",
"0.53943574",
"0.53872436",
"0.5378993",
"0.5375874",
"0.5361",
"0.5328359",
"0.5290046",
"0.52795523",
"0.5273767",
"0.5261887",
"0.5250271",
"0.52376777",
"0.5140319",
"0.50697047",
"0.5061405",
"0.5057775"... | 0.573291 | 2 |
Get shares from print. Get shares from print. | def get_shares(
self,
printer_share_id, # type: str
select=None, # type: Optional[List[Union[str, "models.Enum88"]]]
expand=None, # type: Optional[List[Union[str, "models.Enum89"]]]
**kwargs # type: Any
):
# type: (...) -> "models.MicrosoftGraphPrinterShare"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sharelist():\n # Get field to order by for displaying shares\n if(request.args.get('orderby')):\n orderby = request.args.get('orderby')\n else:\n orderby = None\n # Get order for displaying shares\n if(request.args.get('order')):\n order = request.args.get('order')\n else... | [
"0.60573435",
"0.5950028",
"0.573291",
"0.5524979",
"0.54956424",
"0.53943574",
"0.53872436",
"0.5378993",
"0.5375874",
"0.5361",
"0.5328359",
"0.5290046",
"0.52795523",
"0.5273767",
"0.5261887",
"0.5250271",
"0.52376777",
"0.5140319",
"0.50697047",
"0.5061405",
"0.5057775",
... | 0.56314605 | 3 |
Return an instance constructed from a dictionary. Instantiate an object whose attributes and the corresponding values are given as a dictionary. | def from_dict(cls: Type[BaseType], dict_: Mapping) -> BaseType:
kwargs = {}
for attr, attr_type in cls._attributes.items():
value = dict_.get(attr)
if value is None:
if attr in cls._optional_attributes:
continue
raise TypeError(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def from_dict(cls, d):\n return cls(**d)",
"def from_dict(cls, dictionary: Dict[str, Any]):\n return cls(**dictionary)",
"def from_dict(cls, dct):\n retur... | [
"0.8181267",
"0.8181267",
"0.8059025",
"0.8037172",
"0.7989341",
"0.7878392",
"0.7878042",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.77579594",
"0.... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.