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 |
|---|---|---|---|---|---|---|
test office creation with invalid type. | def test_office_creation_with_invalid_type(self):
access_token = self.generate_admin_token()
create_office = {
"name":"Gubernatorial",
"Type": "2222091"
}
response = self.client.post(
"api/v2/admin/offices",
data=json.dumps(create_office),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_office_creation_with_invalid_name(self):\n access_token = self.generate_admin_token()\n office_data = {\n \"name\":\"222222#@\",\n \"Type\": \"federal\"\n }\n response = self.client.post(\n \"api/v2/admin/offices\",\n data=json.dumps(... | [
"0.71148586",
"0.6812392",
"0.6812392",
"0.67837626",
"0.6470105",
"0.64499825",
"0.63324136",
"0.6255242",
"0.6212232",
"0.61932534",
"0.61891943",
"0.617217",
"0.6141776",
"0.6111921",
"0.61115533",
"0.6096561",
"0.60926193",
"0.60824764",
"0.6071233",
"0.6068484",
"0.60537... | 0.80408037 | 0 |
testing office does not exist. | def test_office_does_not_exist(self):
access_token = self.generate_token()
response = self.client.get(
"api/v2/admin/office/200",
headers = {"content-type": "application/json",
"Authorization": f"Bearer {access_token}"}
)
self.assertEqual(resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_specific_office_not_found(self):\n url = '/api/v1/consultorios/AAA/'\n request = self.client.get(url)\n self.assertEqual(request.status_code, status.HTTP_404_NOT_FOUND)",
"def test_get_specific_office(self):\n url = '/api/v1/consultorios/{}/'.format(self.app_client.id)\n ... | [
"0.728482",
"0.68407035",
"0.65162516",
"0.644528",
"0.62505734",
"0.6213178",
"0.60399044",
"0.5956804",
"0.5956804",
"0.58342713",
"0.5818633",
"0.5814929",
"0.5784971",
"0.5781812",
"0.57669777",
"0.57438064",
"0.57429135",
"0.57223547",
"0.5689003",
"0.56777626",
"0.56736... | 0.79791325 | 0 |
DPMinimum Component Returns differentially private estimates of the minimum elements of each column of the data. | def dp_minimum(data, candidates=None, lower=None, upper=None, mechanism="Automatic", privacy_usage=None, **kwargs):
return Component(
"DPMinimum",
arguments={
'data': Component.of(data),
'candidates': Component.of(candidates),
'lower': Component.of(lower),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self):\n return self._summarize(DataFrameCpu._cmin)",
"def matrix_min(data):\n if is_SparseDataFrame(data):\n data = [np.min(data[col]) for col in data.columns]\n elif is_sparse_dataframe(data):\n data = [sparse_series_min(data[col]) for col in data.columns]\n elif isinstanc... | [
"0.69582605",
"0.69307077",
"0.6845297",
"0.67493725",
"0.6695501",
"0.66640407",
"0.66006297",
"0.65799034",
"0.6537866",
"0.65148956",
"0.64993054",
"0.6469134",
"0.64242935",
"0.63480365",
"0.63243157",
"0.6314989",
"0.6282098",
"0.6278526",
"0.62499225",
"0.6223569",
"0.6... | 0.7016547 | 0 |
Impute Component Replaces null values with draws from a specified distribution. If the `categories` argument is provided, the data are considered to be categorical regardless of atomic type and the elements provided in `null_value` will be replaced with those in `categories` according to `weights`. | def impute(data, lower=None, upper=None, categories=None, null_values=None, weights=None, distribution=None, shift=None, scale=None, **kwargs):
return Component(
"Impute",
arguments={
'data': Component.of(data),
'lower': Component.of(lower),
'upper': Component.of(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_extra_category_impute(make_missing_categories):\n ab.set_hyperseed(100)\n X, m, ncats = make_missing_categories\n X_true = np.copy(X)\n X_true[:, m[:, 0], 0] = ncats[0]\n X_true[:, m[:, 1], 1] = ncats[1]\n\n # This replicates the input layer behaviour\n def data_layer(**kwargs):\n ... | [
"0.5843646",
"0.5703534",
"0.56534433",
"0.53330684",
"0.51503074",
"0.51098883",
"0.5103439",
"0.5027979",
"0.46898478",
"0.464653",
"0.46087444",
"0.46075082",
"0.45855418",
"0.45746383",
"0.45719746",
"0.45481202",
"0.45344567",
"0.4522975",
"0.4521848",
"0.45034105",
"0.4... | 0.69118243 | 0 |
Maximum Component Find the maximum value of each column in the data. | def maximum(data, candidates=None, **kwargs):
return Component(
"Maximum",
arguments={
'data': Component.of(data),
'candidates': Component.of(candidates)
},
options={
},
constraints=kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Max(data):\n return data.max()",
"def get_max(self):\n max_value= self.df[self.col_name].max()\n return max_value",
"def max(self):\n return numpy.ma.max(self.data)",
"def max(self):\r\n return np.max(self.data_array)",
"def max(self):\n return self._reduce_for_stat_functi... | [
"0.7639471",
"0.74651176",
"0.74068457",
"0.73748827",
"0.7288054",
"0.72342914",
"0.72342485",
"0.72225535",
"0.72085446",
"0.7185807",
"0.7153377",
"0.7085026",
"0.69979435",
"0.6984802",
"0.69161564",
"0.69110006",
"0.688618",
"0.68475777",
"0.6833298",
"0.6833129",
"0.683... | 0.68577296 | 17 |
Minimum Component Find the minimum value of each column in the data. | def minimum(data, candidates=None, **kwargs):
return Component(
"Minimum",
arguments={
'data': Component.of(data),
'candidates': Component.of(candidates)
},
options={
},
constraints=kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_min(data):\n if is_SparseDataFrame(data):\n data = [np.min(data[col]) for col in data.columns]\n elif is_sparse_dataframe(data):\n data = [sparse_series_min(data[col]) for col in data.columns]\n elif isinstance(data, pd.DataFrame):\n data = np.min(data)\n elif isinstance... | [
"0.77326643",
"0.75248986",
"0.7514261",
"0.7485672",
"0.74042296",
"0.7334882",
"0.7311381",
"0.7263559",
"0.72224015",
"0.7207765",
"0.71996886",
"0.7061297",
"0.70022327",
"0.6993521",
"0.69879144",
"0.69703585",
"0.69274914",
"0.688212",
"0.68421286",
"0.6833069",
"0.6820... | 0.6537558 | 45 |
Quantile Component Get values corresponding to specified quantiles for each column of the data. | def quantile(data, alpha, candidates=None, interpolation="midpoint", **kwargs):
return Component(
"Quantile",
arguments={
'data': Component.of(data),
'candidates': Component.of(candidates)
},
options={
'alpha': alpha,
'interpolation': i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quantiles(self, column_name, quantiles):\n self.check_for_column(column_name)\n return list(self.data[column_name].quantile(quantiles))",
"def Quartiles(data):\n q = np.percentile(data, [25, 50, 75])\n\n return q[0], q[1], q[2]",
"def get_quantiles(data, quantiles):\n variables =... | [
"0.7723791",
"0.71955717",
"0.71177274",
"0.709959",
"0.7073731",
"0.7029196",
"0.69120234",
"0.67740047",
"0.6707667",
"0.6646069",
"0.6633467",
"0.6619459",
"0.6606744",
"0.6595048",
"0.6574982",
"0.6570927",
"0.6540677",
"0.65342575",
"0.65328175",
"0.6506613",
"0.6492949"... | 0.6383378 | 27 |
Reshape Component Reshapes a row vector into a matrix. | def reshape(data, shape, symmetric=False, layout='row', **kwargs):
return Component(
"Reshape",
arguments={
'data': Component.of(data)
},
options={
'symmetric': symmetric,
'layout': layout,
'shape': shape
},
constraints=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(v):\n return v.reshape((1, v.size))",
"def reshape(x, shape):\n return Reshape(shape)(x)",
"def relay_reshape(c, v, shp):\n nv = c.ref(v)\n assert shp.is_constant(tuple)\n trim = False\n if shp.value == ():\n shp = (1,)\n trim = True\n else:\n shp = shp.val... | [
"0.6900741",
"0.6811683",
"0.6622637",
"0.6507112",
"0.64353794",
"0.628789",
"0.62686",
"0.62366134",
"0.62168616",
"0.61947775",
"0.61918604",
"0.61802113",
"0.6178215",
"0.6139591",
"0.6139526",
"0.61285394",
"0.6126825",
"0.61071724",
"0.60722476",
"0.60699594",
"0.606448... | 0.56694686 | 47 |
ToFloat Component Cast data to a float atomic type. | def to_float(data, **kwargs):
return Component(
"ToFloat",
arguments={
'data': Component.of(data)
},
options={
},
constraints=kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asfloat(value):\n float_type = 'float32'\n\n if isinstance(value, (np.matrix, np.ndarray)):\n if value.dtype != np.dtype(float_type):\n return value.astype(float_type)\n\n return value\n\n elif isinstance(value, (tf.Tensor, tf.SparseTensor)):\n return tf.cast(value, tf.... | [
"0.69599676",
"0.6947573",
"0.69162434",
"0.68740153",
"0.6788781",
"0.67866516",
"0.6780354",
"0.67762655",
"0.67088765",
"0.6685503",
"0.66399074",
"0.6607561",
"0.6521487",
"0.65097505",
"0.6438368",
"0.6431341",
"0.6420081",
"0.63894767",
"0.6378874",
"0.6361583",
"0.6356... | 0.8099834 | 0 |
Handle an individual sequence, returns frame offsets unique to that sequence based on the output length. | def _generateSequence(self, classifications, detections):
det_len = len(detections)
# Convert classifications and detections to input required for network
seq_len = int(self.input_tensor.shape[1])
fea_len = int(self.input_tensor.shape[2])
input_data = np.zeros((seq_len,fea_len))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_sequence_length(self, frame_files):\n frame_diff = len(frame_files) - self.seq_length\n\n if frame_diff == 0:\n # No adjusting needed\n return frame_files\n elif frame_diff > 0:\n # Cuts off first few frames to shorten the video\n return f... | [
"0.62496144",
"0.6018629",
"0.5797323",
"0.57035273",
"0.5538109",
"0.54730046",
"0.54676616",
"0.54140294",
"0.54096365",
"0.5404373",
"0.5370025",
"0.5361999",
"0.534984",
"0.534074",
"0.5306048",
"0.5281904",
"0.5262537",
"0.5243066",
"0.52411693",
"0.521795",
"0.5208451",... | 0.4859664 | 98 |
Converts a MultiDiGraph to a DiGraph. This is not lossless. | def to_simple_edge_network(network):
simple_network = nx.DiGraph(crs=network.graph["crs"])
for node in network.nodes:
simple_network.add_node(node, **network.nodes[node])
for node, neighbors in network.adjacency():
for neighbor in neighbors:
simple_network.add_edge(node, neighbor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collapse_multigraph_to_nx(graph: Union[gr.MultiDiGraph, gr.OrderedMultiDiGraph]) -> nx.DiGraph:\n\n # Create the digraph nodes.\n digraph_nodes: List[Tuple[int, Dict[str, nd.Node]]] = ([None] * graph.number_of_nodes())\n node_id = {}\n for i, node in enumerate(graph.nodes()):\n digraph_nodes... | [
"0.74510324",
"0.6200519",
"0.6021186",
"0.57963204",
"0.5790773",
"0.56979305",
"0.5629782",
"0.55409557",
"0.5537737",
"0.5528657",
"0.55179363",
"0.5491196",
"0.5484487",
"0.5437468",
"0.5412226",
"0.53960115",
"0.5376957",
"0.53714126",
"0.53581613",
"0.5355225",
"0.53356... | 0.0 | -1 |
Splits a given network into two networks with disjoint edges randomly. | def split_test_from_training_data(network, ratio=0.1):
test_edges = random.sample(list(network.edges()), int(len(network.edges()) * ratio))
training_network = network.copy()
training_network.remove_edges_from(test_edges)
test_network = network.copy()
test_network.remove_edges_from(training_network.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_network(self):\n disconnect_nodes(self.nodes[1], 2)\n disconnect_nodes(self.nodes[2], 1)\n self.sync_all([self.nodes[:2], self.nodes[2:]])",
"def random_two_graph(n):\n return nx.fast_gnp_random_graph(n, 2/(n*n), directed=True)",
"def make_network(identity):\n network = []\... | [
"0.6870835",
"0.58356804",
"0.57925427",
"0.57220614",
"0.5662645",
"0.56111646",
"0.55763596",
"0.5571033",
"0.5569067",
"0.55261344",
"0.5498645",
"0.54774463",
"0.5461168",
"0.54593486",
"0.5452104",
"0.5449402",
"0.54340035",
"0.5363878",
"0.53611666",
"0.53298086",
"0.53... | 0.73719376 | 0 |
Returns a move that can be played in the game represented by the 'board' argument. Move selection is done using the 'minimax' function which uses the minimax algorithm with a depth of self.depth to decide on the best move to play. | def make_move(self, board: Board) -> int:
move, evalutation = self.minimax(board, -math.inf, math.inf, self._depth, 1)
return move | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self, board):\r\n self.start_time = time.time()\r\n disk_total = self.get_disk_count(self.my_color, board) + self.get_disk_count(self.opponent_color, board)\r\n\r\n if disk_total < 15:\r\n # In early-game, we can allow a deeper minimax search since there's not too many poss... | [
"0.79542685",
"0.79283834",
"0.7859559",
"0.78451806",
"0.7762921",
"0.7733113",
"0.7708824",
"0.7658644",
"0.7598491",
"0.75613964",
"0.752473",
"0.74973416",
"0.7475594",
"0.74668753",
"0.7449215",
"0.74386096",
"0.74046713",
"0.7392777",
"0.7391734",
"0.73862904",
"0.73629... | 0.7695812 | 7 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(self, optimizer, batch, learning_rate, steps, scales, batch_size):
lr = learning_rate
for i in range(len(steps)):
scale = scales[i] if i < len(scales) else 1
if batch >= steps[i]:
lr = lr * scale
if batch == steps[i]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.79134107",
"0.7906755",
"0.7850054",
"0.7775328",
"0.773414",
"0.7731414",
"0.77228016",
"0.7721925",
"0.77193093",
"0.77092254",
"0.76932764",
"0.76743245",
"0.7665481",
"0.7665481",
"0.7665481",
"0.7654962",
"0.76418406",
"0.7639415",
"0.76375794",
"0.7626146",
"0.762473... | 0.0 | -1 |
Returns the intermediate representation of the regex. `match` is of type `quepy.regex.Match` and is analogous to a python re match. It contains matched groups in the regular expression. When implementing a regex one must fill this method. | def interpret(self, match):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMatch(reMatch,group=0):\n if reMatch: return reMatch.group(group)\n else: return ''",
"def _tree_match_to_output_match(match, namespaces):\n out = dict()\n out[\"line_number\"] = _output_line_number(match)\n out[\"match\"] = _output_match(match, namespaces)\n out[\"value\"] = _output_val... | [
"0.65260977",
"0.6206823",
"0.61301637",
"0.6013107",
"0.600129",
"0.5925946",
"0.59169245",
"0.5843623",
"0.5822081",
"0.58141583",
"0.5734834",
"0.573191",
"0.5585897",
"0.55472225",
"0.55376583",
"0.54451925",
"0.5338242",
"0.5334164",
"0.53170955",
"0.51497495",
"0.513527... | 0.484355 | 42 |
Returns if the word is in the trie. | def search(self, word: str, curr=None) -> bool:
if not self.root:
return False
if not curr:
curr = self.root
for ind in range(len(word)):
if word[ind] == ".":
for key in curr.keys():
if "end" != key and self.search(w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.8386537",
"0.8149872",
"0.8123037",
"0.78559494",
"0.78300846",
"0.77929264",
"0.77922416",
"0.7763923",
"0.775279",
"0.77465785",
"0.77099645",
"0.76809365",
"0.76762706",
"0.766352",
"0.7650309",
"0.7633329",
"0.7627476",
"0.76109934",
"0.7576837",
"0.7568961",
"0.756020... | 0.0 | -1 |
Prepare self.ctx.static, a list of all the sites with static (full) occupancy. Prepare self.ctx.sites, a dictionary containing, for each type of partially occupied site, the list of site, with either the ion, or the vacancy site. | def initialize(self):
fixed_counts = {}
partial_counts = {}
self.ctx.static = []
self.ctx.partial = {}
self.ctx.select = []
self.ctx.compositions = []
self.ctx.sites_refactored = {}
# We collect the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sites(self):\n struc = self.structure\n pots = self.potentials\n shapes = self.shapes\n\n _, new_pots = self._check_for_CPA(struc, pots)\n site_list = []\n for j in range(len(struc.sites)):\n site_list.append({\n 'StructureDataSite': struc.sit... | [
"0.56925267",
"0.5310055",
"0.52103853",
"0.5208855",
"0.52086264",
"0.5143907",
"0.5099758",
"0.5097602",
"0.5046086",
"0.503777",
"0.4891652",
"0.48659876",
"0.4825206",
"0.482473",
"0.48072958",
"0.47979233",
"0.4744293",
"0.4733904",
"0.47282398",
"0.4727508",
"0.47185266... | 0.5572548 | 1 |
Return whether this exception equals another. | def __eq__(self, other):
return (type(self) is type(other) and
self.line == other.line and
self.line_num == other.line_num and
six.text_type(self) == six.text_type(other)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, AnalyticsErrorData):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n if not isinstance(other, AlertErrorGroupSummary):\n return False\n\n return self.to_dict() == other.to... | [
"0.7838597",
"0.737434",
"0.73329884",
"0.7310152",
"0.71994346",
"0.718141",
"0.71651614",
"0.71527827",
"0.71527827",
"0.71226144",
"0.709702",
"0.70956147",
"0.70479685",
"0.70289963",
"0.7027998",
"0.7013588",
"0.7010732",
"0.70104736",
"0.70104736",
"0.70104736",
"0.7010... | 0.0 | -1 |
Create list with 'n' slots | def list_generator(size: int) -> list:
libros = size * [None]
return libros | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_items(n, fmt, obj):\n if n == 0:\n return gen_item(fmt, obj)\n lst = [0] * n\n for i in range(n):\n lst[i] = gen_item(fmt, obj)\n return lst",
"def gen_items(n, fmt, obj):\n if n == 0:\n return gen_item(fmt, obj)\n lst = [0] * n\n for i in range(n):\n lst[... | [
"0.7450795",
"0.7450795",
"0.7020711",
"0.69280535",
"0.69105875",
"0.68483967",
"0.68276805",
"0.6777595",
"0.6733655",
"0.6727704",
"0.67031187",
"0.67031187",
"0.6701704",
"0.6700401",
"0.6700401",
"0.66940814",
"0.6665419",
"0.6646593",
"0.66400844",
"0.66388744",
"0.6634... | 0.0 | -1 |
Return boolean value True if isbn format is valid | def validate_isbn_format(isbn_code: str):
format_valid = False
isbn = list(isbn_code)
msj = ''
if len(isbn) == 13:
isbn_numbers = []
isbn_separator = []
index = 0
isbn_characters = []
for character in isbn:
if character in '0123456789':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_format(isbn):\n\n return len(isbn) == 10 and (isbn[-1] == \"X\" or isbn[-1].isdigit()) \\\n and all(digit.isdigit() for digit in isbn[:-1])",
"def is_valid(isbn: str) -> bool:\n no_dashes = isbn.replace('-', '')\n\n nums = []\n\n valid_num = False\n\n if no_dashes:\n for c... | [
"0.80440646",
"0.75025845",
"0.74354047",
"0.74281985",
"0.7312452",
"0.7196969",
"0.71772194",
"0.7138838",
"0.71299714",
"0.71211886",
"0.7052126",
"0.68939483",
"0.68916845",
"0.6603794",
"0.6603781",
"0.65762776",
"0.6460187",
"0.6444072",
"0.63961875",
"0.6367517",
"0.62... | 0.723948 | 5 |
Sets the netmask of this NodeInterfaceAlias. | def netmask(self, netmask):
self._netmask = netmask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNetmask(self, netmask):\n # type: (str)->None\n\n self._validator.validate_one(\n 'netmask', VALID_OPTS['netmask'], netmask)\n self._ifAttributes['netmask'] = netmask",
"def setNetmask(self):\n\t\tself.netmask = self.settings.getKeyValue('netmask')\n\t\tself.socket.send('se... | [
"0.79404473",
"0.73556066",
"0.6985128",
"0.6803436",
"0.6572765",
"0.6390518",
"0.6204599",
"0.61416304",
"0.599702",
"0.5927063",
"0.5927063",
"0.5569508",
"0.55434114",
"0.55363625",
"0.5507061",
"0.5441891",
"0.53779703",
"0.53711003",
"0.53678113",
"0.5301316",
"0.527144... | 0.8133332 | 0 |
Sets the ip_address of this NodeInterfaceAlias. | def ip_address(self, ip_address):
self._ip_address = ip_address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAddress(self, ip_address):\n # type: (str)->None\n\n self._validator.validate_one(\n 'address', VALID_OPTS['address'], ip_address)\n self._ifAttributes['address'] = ip_address",
"def ip(self, ip):\n\n self._ip = ip",
"def ip(self, ip):\n\n self._ip = ip",
... | [
"0.7535228",
"0.7147766",
"0.7147766",
"0.7087434",
"0.6989552",
"0.6956023",
"0.68806165",
"0.68451834",
"0.67728853",
"0.67325073",
"0.65992415",
"0.6476874",
"0.64717007",
"0.6461826",
"0.6343288",
"0.62721837",
"0.6271698",
"0.62490517",
"0.62092835",
"0.61837757",
"0.606... | 0.7574069 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, NodeInterfaceAlias):
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 |
Initializes self.chitchat_bot with some conversational model. | def create_chitchat_bot(self):
self.chatbot = ChatBot("Fresher's Friend")
self.chatbot.trainer2=ListTrainer(self.chatbot)
self.chatbot.trainer=ChatterBotCorpusTrainer(self.chatbot)
self.chatbot.trainer.train("chatterbot.corpus.english.greetings")
#self.chatbot.trainer.tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_chitchat_bot(self):\n\n # Hint: you might want to create and train chatterbot.ChatBot here.\n # It could be done by creating ChatBot with the *trainer* parameter equals \n # \"chatterbot.trainers.ChatterBotCorpusTrainer\"\n # and then calling *train* function with \"chatterbo... | [
"0.69043535",
"0.67929095",
"0.67929095",
"0.67672825",
"0.6641166",
"0.6511156",
"0.6511156",
"0.6435355",
"0.6302653",
"0.62517583",
"0.60971355",
"0.60947114",
"0.60165435",
"0.5970731",
"0.5947144",
"0.5945499",
"0.5942612",
"0.5897279",
"0.5893073",
"0.5875649",
"0.58617... | 0.67607635 | 4 |
Initialize a new instance of ``cls`` from the given ``mapping``. | def from_mapping(cls, mapping):
raise NotImplementedError('Subclasses of MapInitializable must implement from_mapping.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, mapping: Mapping[str, Any]) -> None:\n self.__dict__.update(mapping)",
"def __init__(self, mapping: Dict[int, int]):\n self.mapping = mapping",
"def fromdict(cls, mapping):\n ud = cls()\n for k in mapping:\n v = dict.__getitem__(mapping, k) # okay for ... | [
"0.74940765",
"0.72053355",
"0.71137536",
"0.709988",
"0.69840705",
"0.6830272",
"0.6763204",
"0.6717812",
"0.6669467",
"0.6434085",
"0.63913065",
"0.63913065",
"0.62930256",
"0.6198686",
"0.61934406",
"0.61261284",
"0.6090526",
"0.6090526",
"0.6090526",
"0.6090526",
"0.60905... | 0.8147797 | 0 |
String for representing the Model object (in Admin site etc.) | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str_... | [
"0.7801019",
"0.7709888",
"0.76735187",
"0.76735187",
"0.75235254",
"0.74023134",
"0.73974043",
"0.73762494",
"0.7326721",
"0.7269429",
"0.7242188",
"0.723378",
"0.7205664",
"0.7173438",
"0.71659935",
"0.71088326",
"0.70359325",
"0.70359325",
"0.7010714",
"0.6985456",
"0.6965... | 0.0 | -1 |
x has shape [seq length, batch], padding_mask has shape [batch, seq length] | def forward(self, emb, len_x=250, padding_mask=None):
#emb [bacth, max_sent_size, emb_size]
positions = torch.arange(len_x, device=emb.device).unsqueeze(-1)#len_x,1
h = emb + self.position_embeddings(positions).expand_as(emb)
h = self.dropout(h)
attn_mask = None
if self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_padding_mask(seq):\r\n seq = tf.cast(tf.math.equal(seq, 0), tf.float32)\r\n return seq[:, tf.newaxis, tf.newaxis, :] # (batch_size, 1, 1, seq_len)\r",
"def get_padding_mask(inputs, padding_value=0):\n mask = tf.cast(tf.equal(inputs, padding_value), 'float32') \n mask = mask[:, tf.newaxis, tf.... | [
"0.75731164",
"0.70298314",
"0.69030887",
"0.68127817",
"0.65745115",
"0.6567377",
"0.6481786",
"0.6462458",
"0.64518964",
"0.64113533",
"0.6398223",
"0.6381566",
"0.6378395",
"0.63447213",
"0.6338231",
"0.63317764",
"0.6314723",
"0.62982994",
"0.6293184",
"0.6286742",
"0.628... | 0.0 | -1 |
Converts a time string into unix | def getUnix(gpsTime):
yr = int(gpsTime[0:4])
mon = int(gpsTime[5:7])
mday = int(gpsTime[8:10])
hour = int(gpsTime[11:13])+D.tzOffset+D.dst # account for offset due to timezones
min = int(gpsTime[14:16])
sec = int(gpsTime[17:19])
wday = -1 # weekday: -1 for don't know.
yday = -1 # day of the year: -1 for don't... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_unix(evt_time):\n st = time.strptime(evt_time, '%Y-%m-%d %H:%M')\n return time.mktime(st)",
"def utc_to_unix_time(self, t):\n (y,m,d) = str(t).split('-')\n return datetime(int(y), int(m), int(d)).strftime('%s')",
"def make_unix_timestamp(date_string, time_string):\n format = '%Y... | [
"0.77871555",
"0.7515878",
"0.7422874",
"0.718827",
"0.715167",
"0.7126895",
"0.7038204",
"0.6877953",
"0.6871574",
"0.6832298",
"0.6825329",
"0.68185085",
"0.68029606",
"0.679469",
"0.67918897",
"0.676656",
"0.6705236",
"0.66919494",
"0.6691843",
"0.66401935",
"0.66200954",
... | 0.5870194 | 80 |
Get a random element from the collection. | def getRandom(self) -> int:
return choice(self.array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_element(self) -> 'PFElement':\n return random.choice(list(iter(self)))",
"def _rand_elem(self, iterable):\n\n lst = list(iterable)\n idx = self._rand_int(0, len(lst))\n return lst[idx]",
"def getRandom(self):\n random_index = randint(0, len(self.list_val)-1)\n ... | [
"0.7651958",
"0.7149041",
"0.70814615",
"0.7044879",
"0.70404017",
"0.7034526",
"0.6959262",
"0.69563407",
"0.68719393",
"0.68376184",
"0.6797525",
"0.670551",
"0.6697882",
"0.6692588",
"0.6692588",
"0.6692588",
"0.6692588",
"0.66815263",
"0.66744214",
"0.6673934",
"0.6651395... | 0.61053157 | 72 |
Check the name of the currently installed table definition. | def ofTable(self, tablename):
return tablename == self._table.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_table(self, name: str) -> bool:\n try:\n self.execute(\"select * from {table} limit 1\", name)\n return True\n except sqlite3.OperationalError:\n return False",
"def checkTable(self, in_table_name):\n phrase1 = \"SELECT count(*) FROM sqlite_master\"\n... | [
"0.68693244",
"0.67616963",
"0.67600906",
"0.67544353",
"0.67398244",
"0.6737316",
"0.65376353",
"0.64955884",
"0.6483068",
"0.6424202",
"0.641076",
"0.6409308",
"0.6385364",
"0.6372749",
"0.6359765",
"0.633788",
"0.63370806",
"0.6334842",
"0.6316244",
"0.63141674",
"0.631179... | 0.60474765 | 48 |
Parse start date and time. | def _parse_start(self, item):
try:
meeting_date = parse(item)
return datetime.combine(meeting_date.date(), time(13))
except ValueError:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_start(self, date_str):\n # TODO: Find start time\n return datetime.strptime(date_str.title(), \"%B %d, %Y\")",
"def _parse_start(self, response):\n date_str = response.css(\".date time::attr(datetime)\").extract_first()\n time_str = \"\".join(response.css(\"article.time::te... | [
"0.8012607",
"0.7956383",
"0.79541355",
"0.775254",
"0.7745357",
"0.7708766",
"0.7648467",
"0.7642984",
"0.74821883",
"0.7459805",
"0.7399587",
"0.7093819",
"0.697785",
"0.69141096",
"0.6728942",
"0.65998924",
"0.6470897",
"0.6462791",
"0.6380753",
"0.634331",
"0.6262659",
... | 0.754136 | 8 |
Apply accumulated gradients to the shared network and clear accumulated gradients. | def apply_gradients_to_shared_network(self):
feed_dict = {}
# Q/sarsa
if self.actor_learner_type == 0 or self.actor_learner_type == 1:
for i in xrange(len(self.accumulated_grads)):
if (self.optimizer_mode == "local"):
if (self.optimizer_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_and_accumulate(self, reduce: str = \"mean\") -> None:\n if reduce == \"mean\":\n reduction = torch.mean\n elif reduce == \"sum\":\n reduction = torch.sum\n else:\n raise ValueError(\n f\"'reduce' must be one of 'mean' or 'sum', got '{red... | [
"0.61880356",
"0.61864597",
"0.6143851",
"0.6082672",
"0.60781544",
"0.60781544",
"0.60781544",
"0.60481215",
"0.60116106",
"0.598573",
"0.5979478",
"0.5927112",
"0.5927112",
"0.5904418",
"0.5878214",
"0.58651006",
"0.5864109",
"0.57984",
"0.5796732",
"0.5778578",
"0.57525736... | 0.6959485 | 0 |
Rescale immediate reward by max reward encountered thus far. | def rescale_reward(self, reward):
if reward > self.max_reward:
_, self.max_reward = self.session.run([self.update_max_reward_op,
self.thread_max_reward],
feed_dict={self.thread_max_reward_placeholder: reward})
return reward/self.max_reward | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_rewards(reward,min_reward,max_reward,factor=10):\n span = (max_reward - min_reward) / 2\n sub = (max_reward+min_reward) / 2\n return ((reward-sub) / span) * factor",
"def update_reward(state, reward, max_reward, alpha=1, c=100, gamma=0.9):\n\t\t# update number of actions done so far to this st... | [
"0.6932845",
"0.69185096",
"0.67427933",
"0.62989753",
"0.61871755",
"0.61834866",
"0.6177571",
"0.6118756",
"0.60466236",
"0.59783274",
"0.59655595",
"0.5955039",
"0.5943445",
"0.5931755",
"0.59014183",
"0.5896534",
"0.5891751",
"0.5879372",
"0.58158135",
"0.58030826",
"0.58... | 0.80197644 | 0 |
Return the hidden layers in the model, if applicable. | def layer_names(self):
return self._layer_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden_layers(self):\n\t\tif self.hidden is None:\n\t\t\tself.hidden, self.inputs, self.weights_all, self.biases_all = [], [], [], []\n\t\t\tlast_hidden = self.x\n\t\t\tif self.covnet == 1:\n\t\t\t\ty_conv, self._drouput, self.hidden, self.inputs = deepnn(self.x)\n\t\t\telif self.covnet == 2:\n\t\t\t\ty_c, sel... | [
"0.775939",
"0.7407488",
"0.720062",
"0.7121522",
"0.7119102",
"0.6937549",
"0.6933334",
"0.6861195",
"0.66476566",
"0.66261524",
"0.6588278",
"0.64553165",
"0.6326623",
"0.63245225",
"0.6194957",
"0.61478955",
"0.6134804",
"0.6124031",
"0.6117281",
"0.6096762",
"0.6096107",
... | 0.0 | -1 |
Return the output of the specified layer for input `x`. `layer` is specified by layer index (between 0 and `nb_layers 1`) or by name. The number of layers can be determined by counting the results returned by calling `layer_names`. | def get_activations(self, x, layer, batch_size=128):
import keras.backend as k
from art import NUMPY_DTYPE
if isinstance(layer, six.string_types):
if layer not in self._layer_names:
raise ValueError('Layer name %s is not part of the graph.' % layer)
layer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layer_outputs(model, input_data, layer_name=None, layer_idx=None,\n layer=None, learning_phase=0):\n\n _validate_args(layer_name, layer_idx, layer)\n layer = get_layer(model, layer_name, layer_idx)\n if TF_KERAS:\n layers_fn = K.function([model.input], [layer.output])\n... | [
"0.68188757",
"0.6476081",
"0.63862973",
"0.610451",
"0.6092965",
"0.6092965",
"0.6087379",
"0.6026246",
"0.6017031",
"0.5997315",
"0.599621",
"0.59715414",
"0.59615916",
"0.59427017",
"0.59360677",
"0.5917803",
"0.581254",
"0.57995594",
"0.57995594",
"0.57934666",
"0.5781068... | 0.5244578 | 72 |
Return the hidden layers in the model, if applicable. | def _get_layers(self):
from keras.engine.topology import InputLayer
layer_names = [layer.name for layer in self._model.layers[:-1] if not isinstance(layer, InputLayer)]
logger.info('Inferred %i hidden layers on Keras classifier.', len(layer_names))
return layer_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden_layers(self):\n\t\tif self.hidden is None:\n\t\t\tself.hidden, self.inputs, self.weights_all, self.biases_all = [], [], [], []\n\t\t\tlast_hidden = self.x\n\t\t\tif self.covnet == 1:\n\t\t\t\ty_conv, self._drouput, self.hidden, self.inputs = deepnn(self.x)\n\t\t\telif self.covnet == 2:\n\t\t\t\ty_c, sel... | [
"0.7760711",
"0.72006637",
"0.7124429",
"0.7117808",
"0.69360596",
"0.6931592",
"0.685979",
"0.66463804",
"0.66217035",
"0.6587119",
"0.6456979",
"0.6329385",
"0.63250995",
"0.6197503",
"0.6145871",
"0.6130595",
"0.6122501",
"0.61189544",
"0.60988975",
"0.60988194",
"0.608900... | 0.74081975 | 1 |
Use to ensure `KerasClassifier` can be unpickled. | def __setstate__(self, state):
self.__dict__.update(state)
# Load and update all functionality related to Keras
import os
from art import DATA_PATH
from keras.models import load_model
full_path = os.path.join(DATA_PATH, state['model_name'])
model = load_model(st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__pickle_unpickle(self):\n pass",
"def test_default_serializer_cleanup():\n path = _dump([0])\n assert os.path.exists(path)\n list(_load(path))\n assert not os.path.exists(path)",
"def restore_classifier(pickle_file):\n if os.path.isfile(pickle_file):\n n_tuple = joblib.loa... | [
"0.5978574",
"0.55839074",
"0.55732924",
"0.5561597",
"0.55380505",
"0.5529262",
"0.5524372",
"0.5503287",
"0.54762274",
"0.54666734",
"0.5453719",
"0.538002",
"0.5377517",
"0.53402835",
"0.5323417",
"0.5259297",
"0.52471125",
"0.52405703",
"0.52405703",
"0.5239126",
"0.52323... | 0.0 | -1 |
Returns the number of direct subtrees. | def __len__(self):
return len(self.subtrees()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numNodes(T):\r\n n = 1\r\n if T.isLeaf:\r\n return n\r\n for i in range(len(T.child)):\r\n n += numNodes(T.child[i])\r\n return n",
"def n_trees(self):\n return len(self.data_kd)",
"def leaf_count(self) -> int:\n if self.children == []:\n return 1\n ... | [
"0.77615625",
"0.7559843",
"0.74153984",
"0.7380784",
"0.7334495",
"0.7328914",
"0.7243306",
"0.7234234",
"0.7213517",
"0.7191488",
"0.7165649",
"0.7127489",
"0.7071592",
"0.7048243",
"0.7046984",
"0.7026274",
"0.6986101",
"0.6965567",
"0.6965093",
"0.69378567",
"0.69266677",... | 0.75990516 | 1 |
Returns the syntactic head of this tree. This will be one of the children of this tree (unless this tree is a leaf in which case it is its own head). Requires a parsing model to be loaded (other you'll get a ValueError) since those include head finding information. | def head(self):
if not RerankingParser._parser_heads_loaded:
raise ValueError("You need to have loaded a parser model in "
"order to get the log probability.")
return self.__class__(self._tree.headTree()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self):\n return self._head",
"def head(self):\n return self._head",
"def header(self):\n if not self._ast:\n return None\n else:\n return self._ast[0]",
"def head(self) -> TaskHead:\n return self._model.head",
"def head(self):\n if se... | [
"0.61841905",
"0.61841905",
"0.6172447",
"0.61130303",
"0.6083801",
"0.6010015",
"0.60049856",
"0.5926663",
"0.58690697",
"0.5839139",
"0.58276486",
"0.5747515",
"0.57131845",
"0.5628753",
"0.5622687",
"0.56163764",
"0.5611119",
"0.56021464",
"0.5561352",
"0.55586714",
"0.553... | 0.637172 | 0 |
Returns the number of tokens in this sentence. | def __len__(self):
return len(self.sentrep) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_count(self, doc):\n\n return len(sent_tokenize(doc))",
"def length(self):\n return len(self.tokens)",
"def num_tokens(self, index):\r\n raise NotImplementedError",
"def __len__(self):\n return len(self._tokens)",
"def count(self, tokens):\n return self.counts[tok... | [
"0.7836106",
"0.7688214",
"0.7504052",
"0.74834204",
"0.74415344",
"0.7347082",
"0.73227507",
"0.7308001",
"0.7157055",
"0.71347266",
"0.7084988",
"0.7078545",
"0.70465213",
"0.69677114",
"0.6957916",
"0.6923655",
"0.6923655",
"0.6902223",
"0.6892427",
"0.68709505",
"0.687095... | 0.0 | -1 |
Returns a list of tokens in this sentence. | def tokens(self):
tokens = []
for index in range(len(self.sentrep)):
tokens.append(self.sentrep.getWord(index).lexeme())
return tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTokens(self):\n list = []\n for i in range(self.startIdx, self.endIdx + 1):\n token = self.sentence[i]\n list.append(token)\n return list",
"def get_tokens(self) -> List[str]:\n return self.tokens",
"def tokens(self):\n return self._sentrep.tokens... | [
"0.8909632",
"0.82979715",
"0.80948067",
"0.80017704",
"0.7964599",
"0.7964599",
"0.7964599",
"0.79554844",
"0.79067516",
"0.79067516",
"0.78814447",
"0.78568083",
"0.77948284",
"0.7701055",
"0.7551193",
"0.74970746",
"0.7430531",
"0.73834765",
"0.7330617",
"0.72796357",
"0.7... | 0.83423185 | 1 |
Return the number of parses in this list. | def __len__(self):
return len(self.parses) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self) -> int:\n return len(self.__fsmParses)",
"def count(self):\n return self.__tree.node_count",
"def count(self):\n return len(self._elements)",
"def count(self):\n return len(self.find())",
"def count(self):\n\t\treturn len(list(self.nodes))",
"def element_count(s... | [
"0.726463",
"0.69731474",
"0.69063157",
"0.69036376",
"0.685544",
"0.6815833",
"0.6801309",
"0.6801309",
"0.6801309",
"0.67861974",
"0.67789316",
"0.6778111",
"0.6742266",
"0.6738679",
"0.6729679",
"0.67293",
"0.672612",
"0.67230767",
"0.6721473",
"0.6721473",
"0.67160594",
... | 0.69914895 | 1 |
Represent this NBestList as a string. | def __repr__(self):
return repr(self.parses) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.list)",
"def __str__(self):\n return \"({},{},{})\".format(self.tail, self.head, self.weight)",
"def __str__(self):\n return list.__str__(self)",
"def __str__(self):\n s = \"--\\n\"\n for element in self:\n s += element.__str_... | [
"0.75465053",
"0.7505444",
"0.7324701",
"0.7319853",
"0.72757405",
"0.72620094",
"0.715769",
"0.7111798",
"0.7110414",
"0.7092671",
"0.70692897",
"0.7032134",
"0.7030495",
"0.7026046",
"0.70002466",
"0.6990324",
"0.6982765",
"0.69674486",
"0.6964508",
"0.69583267",
"0.6958326... | 0.0 | -1 |
Get the best parse in this nbest list according to the reranker. If there are no parses in this list, returns None. | def get_reranker_best(self):
if len(self.parses):
return min(self, key=lambda parse: parse.reranker_rank)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parser_best(self):\n if len(self.parses):\n return min(self, key=lambda parse: parse.parser_rank)\n else:\n return None",
"def get_best_candidate(self):\n if not self.scores:\n return None\n return self.te_list[self.scores.index(max(self.scores... | [
"0.8373511",
"0.65718275",
"0.6500075",
"0.64146477",
"0.62999225",
"0.6202989",
"0.60084933",
"0.5901182",
"0.5857812",
"0.57952964",
"0.5749076",
"0.5727109",
"0.56371915",
"0.557005",
"0.5550474",
"0.5528388",
"0.5527575",
"0.55199236",
"0.5472127",
"0.5466968",
"0.5464971... | 0.86023206 | 0 |
Get the tokens of this sentence as a sequence of strings. | def tokens(self):
return self._sentrep.tokens() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTokens(self):\n list = []\n for i in range(self.startIdx, self.endIdx + 1):\n token = self.sentence[i]\n list.append(token)\n return list",
"def tokens(self):\n tokens = []\n for index in range(len(self.sentrep)):\n tokens.append(self.sen... | [
"0.816749",
"0.77816635",
"0.76809406",
"0.76809406",
"0.7668489",
"0.73684907",
"0.73684907",
"0.73684907",
"0.73198664",
"0.72141314",
"0.7159835",
"0.70942134",
"0.7090057",
"0.7051247",
"0.7043043",
"0.7033877",
"0.6969542",
"0.69587606",
"0.6956135",
"0.6930485",
"0.6911... | 0.76357657 | 5 |
Displays the main screen | def start(self):
print("*"*20)
print("*" + " "*18 + "*")
print("*" + " "*4 + "Connect 4X" + " "*4 + "*")
print("*" + " " * 18 + "*")
print("*" * 20)
print("\nConsole Version 1.0.0\n")
self.print_menu()
self.get_input() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_main(self):\n self.clear_terminal()\n self.main_menu()\n self.handle_selection_main()",
"def run(self):\n self.ui['main_window'].widgets['main'].show_all()\n gtk.main()",
"def main(self):\n\n self.window.show_all()\n gtk.main()",
"def main():\n ... | [
"0.81365585",
"0.7576515",
"0.7477452",
"0.7360781",
"0.7338293",
"0.73135716",
"0.7170008",
"0.7133583",
"0.71250594",
"0.7106969",
"0.70939785",
"0.70913374",
"0.70472693",
"0.70471257",
"0.7015743",
"0.70154047",
"0.6996691",
"0.6958611",
"0.69513714",
"0.6949986",
"0.6933... | 0.0 | -1 |
Predefine a specific binding of an event to a handler by id. The event in this binding can be set to be listened for later on by simply using this id instead of having to set the details of the binding every single time. | def bind(self, binding_id, event_props, handler, arg_list=None, once=False):
args = (arg_list,) if arg_list else ()
self._bindings[binding_id] = (once, event_props, handler) + args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind(self, state_id, binding_id, event_props, event_handler):\n\n self.event_binder.bind(binding_id, event_props, event_handler)\n self._state_bindings[state_id].append(binding_id)",
"def _set_state_bindings(self, state_id):\n\n self.event_binder.accept(self._state_bindings[state_id], ex... | [
"0.6363393",
"0.58288777",
"0.57922",
"0.561555",
"0.5534807",
"0.5532453",
"0.5312405",
"0.5312405",
"0.52582514",
"0.5231969",
"0.5191159",
"0.5154052",
"0.50541383",
"0.50489116",
"0.5020392",
"0.5013019",
"0.49831635",
"0.49563533",
"0.4938433",
"0.49322563",
"0.4911449",... | 0.6501186 | 0 |
Remove the given binding. Note that, if the binding is currently active, this also stops the event in that binding being listened for! Returns True if successful or False if binding_id was not found. | def unbind(self, binding_id):
if binding_id not in self._bindings:
return False
event_props = self._bindings[binding_id][1]
del self._bindings[binding_id]
if event_props in self._active_bindings:
self.ignore(event_props)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_binding(ctx, binding_name):\n\n entryFound = False\n table = 'NAT_BINDINGS'\n key = binding_name\n\n if len(binding_name) > 32:\n ctx.fail(\"Invalid binding name. Maximum allowed binding name is 32 characters !!\")\n\n config_db = ConfigDBConnector()\n config_db.connect()\n\n ... | [
"0.7076661",
"0.57430536",
"0.5727326",
"0.57155985",
"0.5664812",
"0.549085",
"0.54687154",
"0.54090065",
"0.53977257",
"0.5387706",
"0.53198826",
"0.5283744",
"0.52211154",
"0.5221037",
"0.5219053",
"0.51463586",
"0.5106394",
"0.51028186",
"0.50739527",
"0.50698537",
"0.505... | 0.7853153 | 0 |
Stop listening for all events. | def ignore_all(self):
self._listener.ignore_all()
self._active_bindings = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self) -> None:\n if self._server:\n self._server.stop()\n _LOGGER.info(\"Stopped event server\")\n self._listeners = {}",
"def stop(self) -> None:\n for instance in self.instances:\n instance.listener = None\n instance.stop()",
"def _sto... | [
"0.76798916",
"0.7640488",
"0.7591344",
"0.7445824",
"0.74239284",
"0.73986095",
"0.7373083",
"0.7243395",
"0.71392226",
"0.71097994",
"0.7108672",
"0.7012575",
"0.696214",
"0.69604033",
"0.69300264",
"0.68996143",
"0.6873771",
"0.6873454",
"0.68661344",
"0.68476516",
"0.6772... | 0.0 | -1 |
Set cells in obstacle grid to be empty Reset zombie and human lists to be empty | def clear(self):
self._zombie_list = []
self._human_list = []
poc_grid.Grid.clear(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_obstacles(self):\n self.obstacles = np.array([])",
"def clear(self):\n poc_grid.Grid.clear(self)\n self._zombie_list = []\n self._human_list = []\n # need proof it works",
"def clear(self):\r\n poc_grid.Grid.clear(self)\r\n self._zombie_list = []\r\n ... | [
"0.7903046",
"0.77405584",
"0.77138525",
"0.77031183",
"0.76965207",
"0.76102734",
"0.7586986",
"0.74917936",
"0.7486784",
"0.74409497",
"0.7411356",
"0.7393945",
"0.7387012",
"0.73719716",
"0.73582643",
"0.7325802",
"0.72839963",
"0.72313416",
"0.72108424",
"0.7210384",
"0.7... | 0.76223475 | 5 |
Add zombie to the zombie list | def add_zombie(self, row, col):
self._zombie_list.append((row, col)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_zombie(self, entity):\n if entity not in self._entities['all']:\n self._entities['all'].append(entity)\n self._entities['zombies'].append(entity)\n self._entities[entity._team]['zombies'].append(entity)\n entity.set_id(self._entities[entity._team]['id'])\n self... | [
"0.8145755",
"0.7598467",
"0.7579104",
"0.59433466",
"0.5911907",
"0.58728415",
"0.58334374",
"0.5747301",
"0.5735042",
"0.5729783",
"0.5714266",
"0.56813896",
"0.56762284",
"0.5671887",
"0.5589427",
"0.5577833",
"0.5557215",
"0.5556951",
"0.553771",
"0.55231005",
"0.55041355... | 0.7627476 | 1 |
Provides a representation of the Transaction to allow full recreation of the object. | def __repr__(self):
return "%s(asset=%s, quantity=%s, dt=%s, " \
"price=%s, trans_id=%s, type=%s)" % (
type(self).__name__, self.asset.name,
self.quantity, self.timestamp,
self.price, self.trans_ID, self.type
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction(self):\n return Transaction(self)",
"def __repr__(self):\n return u'<Transaction id={i}, amount={a}>'.format(\n i=self.id,\n a=self.amount\n )",
"def transactions(self):\r\n return tx.Transactions(self)",
"def raw_transaction(self) -> CustomRa... | [
"0.74648994",
"0.74223006",
"0.690562",
"0.66901046",
"0.665314",
"0.665314",
"0.6570076",
"0.6510454",
"0.6472744",
"0.6438016",
"0.6425391",
"0.6399525",
"0.6398045",
"0.6389314",
"0.6387074",
"0.6386355",
"0.6386262",
"0.63572973",
"0.63535535",
"0.6340769",
"0.62804043",
... | 0.65446836 | 7 |
The basename of this run's comparison output file | def comparison_outfile(self):
return f"{self.name}.compare.out" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_output_filename(dataset_dir, split_name):\n return '%s/%s*.tfrecord' % (dataset_dir, split_name)",
"def __diff_filename(self):\n diff_dir = os.path.join(self.__folder, Reference.DIFF_OUT)\n if not os.path.exists(diff_dir):\n os.makedirs(diff_dir)\n return os.path.join(... | [
"0.724916",
"0.7180829",
"0.712557",
"0.71170336",
"0.7099507",
"0.70774126",
"0.706676",
"0.7050639",
"0.7023703",
"0.6979415",
"0.694758",
"0.6854372",
"0.6845246",
"0.68306226",
"0.6823736",
"0.6768582",
"0.6762195",
"0.67548233",
"0.67499095",
"0.6737838",
"0.67358494",
... | 0.7507315 | 0 |
Returns True if the global compile_only flag was set or this test is compileonly, False otherwise | def get_compile_test(self):
return self._compileTest or Test.compile_only | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isCompiled(self):\n return self.compiled",
"def isCompiled(self):\n return self.compiled",
"def is_valid(project: Project) -> bool:\n return bool(compileall.compile_dir(project.root, quiet=1))",
"def _c_optimizations_required():\n pure_env = os.environ.get('PURE_PYTHON')\n require_... | [
"0.6464506",
"0.6464506",
"0.6344039",
"0.6276564",
"0.61448205",
"0.61313295",
"0.60959446",
"0.60588104",
"0.60523546",
"0.6038912",
"0.59923583",
"0.5987128",
"0.5955495",
"0.5941639",
"0.59216696",
"0.59068334",
"0.59040093",
"0.5868585",
"0.5771224",
"0.56915176",
"0.566... | 0.6822172 | 0 |
Returns True if the global compile_only flag was set or this test is compileonly, False otherwise | def get_do_comparison(self):
return self._doComparison and not Test.skip_comparison | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_compile_test(self):\n\n return self._compileTest or Test.compile_only",
"def isCompiled(self):\n return self.compiled",
"def isCompiled(self):\n return self.compiled",
"def is_valid(project: Project) -> bool:\n return bool(compileall.compile_dir(project.root, quiet=1))",
"de... | [
"0.6824188",
"0.64660424",
"0.64660424",
"0.6346249",
"0.6277215",
"0.6145587",
"0.6132217",
"0.6096295",
"0.6059342",
"0.6054365",
"0.6039375",
"0.59922004",
"0.59875226",
"0.5955925",
"0.59420365",
"0.5921338",
"0.59090436",
"0.59042805",
"0.58710635",
"0.5772058",
"0.56931... | 0.55498034 | 33 |
Sets the testspecific absolute tolerance to the specified value. | def set_abs_tolerance(self, value):
self._abs_tolerance = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tolerance(rel_tolerance=1e-09, abs_tolerance=0.0):\n global REL_TOLERANCE, ABS_TOLERANCE\n REL_TOLERANCE = rel_tolerance\n ABS_TOLERANCE = abs_tolerance",
"def set_tolerance(self, tol):\n self.tolerance = tol",
"def set_tolerance(self, value):\n\n self._tolerance = value",
"def... | [
"0.7582184",
"0.7259427",
"0.71561307",
"0.71303403",
"0.7057077",
"0.68581104",
"0.6620214",
"0.66105586",
"0.6607541",
"0.65930724",
"0.64984727",
"0.64688385",
"0.6356821",
"0.63470626",
"0.62884426",
"0.613621",
"0.61237836",
"0.61077803",
"0.6067578",
"0.6047074",
"0.598... | 0.8241769 | 0 |
Sets the testspecific particle tolerance to the specified value. | def set_particle_tolerance(self, value):
self._particle_tolerance = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tolerance(self, tolerance: float) -> None:\n self._tolerance = tolerance",
"def set_tolerance(self, tol):\n self.tolerance = tol",
"def set_tolerance(self, value):\n\n self._tolerance = value",
"def tol(self, value):\n self._tol = value",
"def set_tolerance(self, tol):\n ... | [
"0.7447135",
"0.741869",
"0.7331127",
"0.7031548",
"0.69907933",
"0.69570714",
"0.67173755",
"0.6637055",
"0.6633346",
"0.65139985",
"0.6276457",
"0.6248293",
"0.6244987",
"0.614971",
"0.60737383",
"0.60336727",
"0.59862906",
"0.59683275",
"0.59660506",
"0.591808",
"0.5842602... | 0.83703387 | 0 |
Returns the number of past runs to include in the running runtime average. | def get_runs_to_average(self):
if Test.performance_params: return int(Test.performance_params[1])
elif self._check_performance: return self._runs_to_average
else: return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runtime(self):\n return self.tmax_epochs - self.tmin_epochs",
"def number_of_launches(self):\n return self._number_of_launches",
"def runtime(self):\n return self.stop_time - self.start_time",
"def seconds_before_next_run(self):\n period, last_start_time = self.period, self.la... | [
"0.6596683",
"0.6400447",
"0.6333939",
"0.63238794",
"0.63110125",
"0.62969416",
"0.6245464",
"0.62369865",
"0.6181699",
"0.61726147",
"0.6166713",
"0.6155285",
"0.61264575",
"0.60711217",
"0.6067969",
"0.60281026",
"0.6024463",
"0.6014393",
"0.5981797",
"0.5970396",
"0.59655... | 0.63618994 | 2 |
r""" Return the maximum number of expectationmaximization steps. | def max_em_iterations(self):
return self._max_em_iterations | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_steps(self) -> int:\n return pulumi.get(self, \"max_steps\")",
"def get_max_steps(self):\n return float(self.trainer_parameters[\"max_steps\"])",
"def get_max_steps(self):\n return float(self.trainer_parameters['max_steps'])",
"def get_max_steps(self) -> float:\n return fl... | [
"0.78330225",
"0.7377708",
"0.7363513",
"0.7304067",
"0.7259231",
"0.71325046",
"0.7094793",
"0.7078195",
"0.7005278",
"0.69071627",
"0.6897559",
"0.68686783",
"0.6839605",
"0.67332375",
"0.6714402",
"0.67111224",
"0.66572154",
"0.665481",
"0.66516376",
"0.66397923",
"0.66351... | 0.729889 | 4 |
Compute the logdet of the cholesky decomposition of matrices. | def _compute_log_det_cholesky(matrix_chol, covariance_type, n_features):
if covariance_type == 'full':
n_components, _, _ = matrix_chol.shape
log_det_chol = (np.sum(np.log(
matrix_chol.reshape(
n_components, -1)[:, ::n_features + 1]), 1))
elif covariance_type == 'tie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fast_logdet(matrix):\n sign, ld = np.linalg.slogdet(matrix)\n if not sign > 0:\n return -np.inf\n return ld",
"def pddet(A):\r\n L = jitchol(A)\r\n logdetA = 2*sum(np.log(np.diag(L)))\r\n return logdetA",
"def local_det_chol(node):\r\n if node.op == det:\r\n x, = node.inp... | [
"0.7355757",
"0.7214726",
"0.67879087",
"0.65485704",
"0.6523364",
"0.6494481",
"0.6338424",
"0.6192388",
"0.6150096",
"0.6149231",
"0.61332285",
"0.6108461",
"0.6065173",
"0.6063",
"0.6022569",
"0.6005327",
"0.5964",
"0.59611917",
"0.58553296",
"0.5854681",
"0.5842726",
"0... | 0.7837815 | 0 |
(Model) > NoneType Removes the model from the collection, if it has been saved. | def delete(self):
if self.iid is not None:
self.db().remove(self.iid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_model(self, model):\n assert isinstance(model, Model)\n\n self.model_list.remove(model)\n del self.model_dict[model.model_id]\n model.structure = None\n\n ## if the default model is being removed, choose a new default model\n ## if possible\n if model == ... | [
"0.695924",
"0.6812191",
"0.66286206",
"0.66125435",
"0.65402555",
"0.64539653",
"0.6375231",
"0.6375231",
"0.6375231",
"0.6319423",
"0.6221392",
"0.62168777",
"0.61965394",
"0.6183775",
"0.6157625",
"0.6157105",
"0.613652",
"0.6096627",
"0.6083554",
"0.60604393",
"0.6058133"... | 0.0 | -1 |
(Model) > string Gets this models' ID. | def get_id(self):
return self.iid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getId(self):\n return _libsbml.Model_getId(self)",
"def get_id(self):\n return self.id",
"def get_id(self):\n return self.id",
"def get_id(self):\n return self.id",
"def get_id(self):\n return self.id",
"def get_id(self):\n return self.id",
"def get_id(self... | [
"0.83877546",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.78950673",
"0.7858498",
"0.7843049",
... | 0.0 | -1 |
Test case to check if the values of variables are correctly being placed. | def test_check_instance_variables(self):
self.assertEquals(self.new_blog.title, "business blog")
self.assertEquals(self.new_blog.description, "asdfghjkl")
self.assertEquals(self.new_blog.user_id, self.new_user.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_variablepresentations_post(self):\n pass",
"def test_variables_post(self):\n pass",
"def test_my_inputs(self):\r\n tester = VariableTester(\r\n __file__,\r\n package_order=['urbansim'],\r\n test_data={\r\n 'gridcell':{\r\n ... | [
"0.7073967",
"0.68298763",
"0.67747873",
"0.66679686",
"0.6667237",
"0.6597304",
"0.6536712",
"0.6509868",
"0.6394894",
"0.63144284",
"0.63097435",
"0.6253922",
"0.62445027",
"0.6229036",
"0.6204029",
"0.61955863",
"0.61548215",
"0.6152034",
"0.61188954",
"0.6066865",
"0.6059... | 0.0 | -1 |
Compute bounding boxes from masks. | def extract_bboxes(mask):
boxes = np.zeros([mask.shape[-1],mask.shape[0], 2], dtype=np.int32)
for i in range(mask.shape[-1]):
# Bounding box.
for j in range(mask.shape[0]):
m = mask[j, :, i]
horizontal_indicies = np.where(m)[0]
if horizontal_indicies.shape[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_bboxes(mask):\r\n boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32)\r\n for i in range(mask.shape[-1]):\r\n m = mask[:, :, i]\r\n # Bounding box.\r\n horizontal_indicies = np.where(np.any(m, axis=0))[0]\r\n vertical_indicies = np.where(np.any(m, axis=1))[0]\r\n ... | [
"0.78467315",
"0.7821438",
"0.78130674",
"0.7462639",
"0.73268336",
"0.7318628",
"0.7165459",
"0.70358133",
"0.7027821",
"0.6983254",
"0.68408525",
"0.6769498",
"0.6769209",
"0.6680738",
"0.66408485",
"0.6610212",
"0.66068614",
"0.6589283",
"0.65518355",
"0.64983237",
"0.6495... | 0.77246463 | 3 |
Calculates overlap rate of the given box with the array of the given boxes. | def compute_overlap_rate(box, boxes):
# Calculate intersection areas
x1 = np.maximum(box[0], boxes[:, 0])
x2 = np.minimum(box[1], boxes[:, 1])
intersection = np.maximum(x2 - x1, 0)
boxes_area = boxes[:, 1] - boxes[:, 0]
overlap = intersection/boxes_area
return overlap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cal_overlaps(boxes1, boxes2):\n area1 = (boxes1[:, 0] - boxes1[:, 2]) * (boxes1[:, 1] - boxes1[:, 3]) # (Nsample, 1)\n area2 = (boxes2[:, 0] - boxes2[:, 2]) * (boxes2[:, 1] - boxes2[:, 3]) # (Msample, 1)\n\n overlaps = np.zeros((boxes1.shape[0], boxes2.shape[0])) # (Nsample, Msample)\n\n # calcu... | [
"0.683769",
"0.67385703",
"0.67338043",
"0.6639075",
"0.6631456",
"0.6564688",
"0.65451217",
"0.65451217",
"0.65451217",
"0.6464292",
"0.6441125",
"0.6440703",
"0.64187664",
"0.641289",
"0.6351331",
"0.6351331",
"0.6297871",
"0.61612046",
"0.6127457",
"0.6089508",
"0.60859644... | 0.85941243 | 0 |
Constructor browser reference to the browser window (HelpBrowser) parent reference to the parent widget (QWidget) | def __init__(self, browser, parent=None):
super(SiteInfoDialog, self).__init__(parent)
self.setupUi(self)
self.setWindowFlags(Qt.Window)
# put icons
self.tabWidget.setTabIcon(
0, UI.PixmapCache.getIcon("siteinfo-general.png"))
self.tabWidget.setTabIco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, engine, parent=None):\n super(HelpSearchWidget, self).__init__(parent)\n \n self.__engine = engine\n \n self.__layout = QVBoxLayout(self)\n \n self.__result = self.__engine.resultWidget()\n self.__query = self.__engine.queryWidget()\n ... | [
"0.66674954",
"0.6598266",
"0.65834486",
"0.6583403",
"0.64812154",
"0.6414591",
"0.6410956",
"0.6410956",
"0.6410956",
"0.6410956",
"0.6410956",
"0.6395357",
"0.6367763",
"0.63656765",
"0.6344497",
"0.6334291",
"0.6331163",
"0.6324489",
"0.6321797",
"0.6271439",
"0.62036306"... | 0.67742336 | 0 |
Show the image and wait for the user's input. This implementation refers to | def wait_continue(self, timeout=0, continue_key=' ') -> int: # noqa: E501
if self.is_inline:
# If use inline backend, interactive input and timeout is no use.
return
if self.fig_show.canvas.manager:
# Ensure that the figure is shown
self.fig_show.show()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_img(self):\n if self.image is not None:\n cv2.imshow(self.image_window, self.image)\n cv2.waitKey(1)\n else:\n rospy.loginfo(\"No image to show yet\")",
"def show(self):\n\n self.image.show()",
"def show(image):\n cv2.imshow('press ENTER to clos... | [
"0.70464724",
"0.6942489",
"0.68543565",
"0.6795744",
"0.67523015",
"0.66879356",
"0.66520196",
"0.66166127",
"0.66150707",
"0.6584849",
"0.6557377",
"0.6553896",
"0.65269804",
"0.65214586",
"0.6520507",
"0.65093404",
"0.6497416",
"0.6479195",
"0.64204687",
"0.6389722",
"0.63... | 0.0 | -1 |
If a course is added to a program with no position specified, it should be given the last position | def test_program_course_auto_position():
first_course = CourseFactory.create(position_in_program=None)
assert first_course.position_in_program == 1
second_course = CourseFactory.create(
program=first_course.program, position_in_program=None
)
assert second_course.position_in_program == 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_course(dept, num, text):\n\n # Course Title \n m = re.search(\"[\\d\\w]{5} - ([\\w ]*)\", text)\n title = m.group(1) if m else \"nomatch\"\n\n # Course Description\n m = re.search(\"\\.\\s(.*)\\sTypically\",text)\n des = m.group(1) if m else \"nomatch\"\n\n # Credit hours aren't fi... | [
"0.6059749",
"0.60214466",
"0.5971754",
"0.58582604",
"0.5850716",
"0.5834378",
"0.5585464",
"0.5498338",
"0.54754156",
"0.544179",
"0.5433476",
"0.54184014",
"0.5408004",
"0.5249713",
"0.5235485",
"0.5217162",
"0.51617837",
"0.51460004",
"0.5142971",
"0.5108315",
"0.5107247"... | 0.69066656 | 0 |
Test that the courseware_url property yields the correct values | def test_courseware_url(settings):
settings.OPENEDX_BASE_REDIRECT_URL = "http://example.com"
course_run = CourseRunFactory.build(courseware_url_path="/path")
course_run_no_path = CourseRunFactory.build(courseware_url_path=None)
assert course_run.courseware_url == "http://example.com/path"
assert cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_computed_url(self):\n t = self.create_request_object()\n self.assertEqual(\"studies\", t.url_path())",
"def test_url_tranform(self):\r\n response = self.client.get('/courses/edx/math101/2014/wiki/math101/')\r\n self.assertIn('/courses/edx/math101/2014/wiki/math101/_edit/', re... | [
"0.68515897",
"0.6769534",
"0.6680695",
"0.65622246",
"0.6526996",
"0.6499889",
"0.6406337",
"0.63644224",
"0.63492215",
"0.6336467",
"0.6320577",
"0.62524176",
"0.6228312",
"0.6142877",
"0.6140908",
"0.6072798",
"0.60564566",
"0.6036206",
"0.603611",
"0.60348505",
"0.6032429... | 0.79107726 | 0 |
Test that CourseRun.is_past returns the expected boolean value | def test_course_run_past(end_days, expected):
now = now_in_utc()
end_date = None if end_days is None else (now + timedelta(days=end_days))
assert CourseRunFactory.create(end_date=end_date).is_past is expected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_past_event(self):\n pass",
"def is_past(self) -> bool:\n return self.start < timezone.now()",
"def isPast(self):\n return (self._t < time())",
"def test_past_question(self):\n past_question = create_question(question_text='Past question', days=-30)\n response = sel... | [
"0.7304504",
"0.6898809",
"0.68628436",
"0.6848323",
"0.6815093",
"0.67340946",
"0.6658702",
"0.66432476",
"0.66301584",
"0.659276",
"0.65365636",
"0.65349257",
"0.6531136",
"0.6500227",
"0.64834046",
"0.64794445",
"0.6474354",
"0.6465263",
"0.6461419",
"0.64506",
"0.6431522"... | 0.75661534 | 0 |
Test that the get_program_run_enrollments helper method for CourseRunEnrollment returns the appropriate course run enrollments for a program | def test_get_program_run_enrollments(user):
programs = ProgramFactory.create_batch(2)
program = programs[0]
course_run_enrollments = CourseRunEnrollmentFactory.create_batch(
2,
user=user,
run__course__program=factory.Iterator([program, program, programs[1]]),
)
expected_run_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_enrollments_for_courses_in_program(user, program):\n course_keys = [\n CourseKey.from_string(key)\n for key in course_run_keys_for_program(program)\n ]\n return CourseEnrollment.objects.filter(\n user=user,\n course_id__in=course_keys,\n mode__in=[CourseMode.VERI... | [
"0.716674",
"0.6605928",
"0.6269143",
"0.6221132",
"0.59707457",
"0.5924151",
"0.5884932",
"0.5802704",
"0.57989705",
"0.5710633",
"0.5684599",
"0.5642243",
"0.56108344",
"0.55495614",
"0.55353355",
"0.5533046",
"0.5529943",
"0.5501822",
"0.5475876",
"0.54491967",
"0.5437152"... | 0.8249601 | 0 |
Checks the board for winner or tie. If there is a winner, returns the winner's mark. If there is a tie, returns "Tie". If none of these end conditions is met, returns None. | def checkWinner(self):
# Check horizontal and vertical lines.
for j in range(3):
if self.board[0][j] != " " and self.board[0][j] == self.board[1][j] == self.board[2][j]:
return self.board[0][j]
if self.board[j][0] != " " and self.board[j][0] == self.board[j][1] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner(board):\n\t#For X\n\tiswinnerX = winnerForPlayer(board, X)\n\tiswinnerO = winnerForPlayer(board, O)\n\n\tif iswinnerX:\n\t\treturn X\n\tif iswinnerO:\n\t\treturn O\n\n\treturn None",
"def winner(self, board):\n if self.any_legal_move(BLACK, board) or self.any_legal_move(WHITE,board):\n ... | [
"0.7684047",
"0.7614557",
"0.7586759",
"0.74370456",
"0.7408347",
"0.740621",
"0.74011075",
"0.736439",
"0.7356053",
"0.7311544",
"0.7291992",
"0.7282269",
"0.7280371",
"0.7276752",
"0.72161126",
"0.7209679",
"0.7178762",
"0.7143668",
"0.71123534",
"0.70941097",
"0.709376",
... | 0.78677267 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
plt.figure()
plt.imshow(cm, interpolation='neares... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194052",
"0.8095069",
"0.80293566",
"0.8018802",
"0.799371",
"0.7990971",
"0.7980545",
"0.7975993",
"0.79609",
"0.7957234",
"0.7937344",
"0.79343724",
"0.79341805",
"0.79310715",
"0.7926063",
"0.79241866",
"0.7923726",
"0.79229325",
"0.79226404",
"0.79218584",
"0.7917542"... | 0.0 | -1 |
return a list of all known neighbors | def getNeighbors(self):
return self.Neighbors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbours(self):\n return []",
"def get_neighbors(self):\n \n return [neighbor for neighbor,_ in self.neighbors.items()]",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n ... | [
"0.8391941",
"0.81786907",
"0.81600475",
"0.81600475",
"0.81600475",
"0.81600475",
"0.81265086",
"0.801169",
"0.79801375",
"0.794152",
"0.7904197",
"0.7852381",
"0.784753",
"0.78405887",
"0.78309107",
"0.78273046",
"0.7800181",
"0.7782491",
"0.7749291",
"0.7744155",
"0.774409... | 0.74715614 | 27 |
Return Pandas CustomBusinessDay based on .txt | def get_custom_date(self):
_hol_center = None
_config = __CFG__.Config()
if _config.add_section(__DEF__.CONFIG_SECTION_CALENDAR):
_cal = self.calendar.lower()
if _cal in _config:
try:
_file = os.path.join(__DEF__.ROOT_DATA, _config[_cal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_elia_cap(filename):\r\n df = pd.read_excel(filename,skiprows=0,parse_dates=False)\r\n \r\n #standaard datetime vorm omzetten\r\n df[\"Tendering Periodneww\"] = pd.to_datetime(df[\"Tendering Period\"],errors='coerce')\r\n df[\"Delivery Periodneww\"] = pd.to_datetime(df[\"Delivery Period\"],e... | [
"0.54792",
"0.5381545",
"0.5381313",
"0.5372838",
"0.5362254",
"0.5351883",
"0.5350997",
"0.53211653",
"0.5319699",
"0.5319156",
"0.5301872",
"0.5257496",
"0.5251457",
"0.52480364",
"0.5231774",
"0.5230262",
"0.52292466",
"0.522913",
"0.52251965",
"0.5224911",
"0.5220286",
... | 0.5747413 | 0 |
Returns the address of the mediaserver with regard to the currently chosen connection strategy. If no strategy was selected, None is returned. | def address(self):
if self.con_strategy == "local":
return self.address_local()
if self.con_strategy == "remote":
return self.address_remote()
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_extra_info(self, name, default=None):\n if name == 'sockname':\n return self.__relayed_address\n return default",
"def remote_addr(self):\r\n route = self.remote_route\r\n return route[0] if route else None",
"def getOsmHost(self):\n return self.osm_hos... | [
"0.57991",
"0.5788144",
"0.5709753",
"0.5571292",
"0.55416906",
"0.5538118",
"0.55268586",
"0.5515366",
"0.54939884",
"0.53704107",
"0.5354528",
"0.5354528",
"0.5348719",
"0.5332141",
"0.5331331",
"0.53152525",
"0.5312938",
"0.5258389",
"0.52337706",
"0.5224539",
"0.5206046",... | 0.71823025 | 0 |
Return a random first name consistent with a given seed. | def first_name(seed):
if consistent_hash(seed, 1):
first = femaleNames
else:
first = maleNames
return first[consistent_hash(seed, len(first))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_generator():\n firsts = [\"Albrecht\", \"Lysa\", \"Yvette\", \"Jésus\", \"Amanitus\"]\n lasts = [\"Andersson\", \"Natt och Dag\", \"av Pommern\", \"Krusmynta\"]\n\n random.seed()\n first = firsts[random.randint(0, len(firsts)-1)]\n last = lasts[random.randint(0, len(lasts)-1)]\n\n name =... | [
"0.73826253",
"0.71441495",
"0.7045821",
"0.6932578",
"0.6925943",
"0.6924926",
"0.6916525",
"0.6878518",
"0.6805603",
"0.6730048",
"0.6724545",
"0.67172307",
"0.6641586",
"0.6637091",
"0.65825343",
"0.65674067",
"0.65450186",
"0.6489816",
"0.64401555",
"0.6389313",
"0.636862... | 0.8186219 | 0 |
we define queryset by filter a data owned by current active user, we use this for all model extends bound to user, like todo model | def get_queryset(self):
filter_kwargs = {self.bound_to_user_field_name: self.request.auth.user}
return super(BoundToUserMixin, self).get_queryset().filter(**filter_kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwargs).filter(user=self.request.user)\n return qs",
"def get_queryset(self):\n return super().get_queryset().filter(user=self.request.user)",
"def get_queryset(self, request):\n qs = super().get_queryset(... | [
"0.8181547",
"0.808988",
"0.7956351",
"0.79547375",
"0.7918021",
"0.77009606",
"0.7622131",
"0.7557892",
"0.7548126",
"0.74452204",
"0.7420513",
"0.74070495",
"0.73972994",
"0.7336948",
"0.7336948",
"0.732518",
"0.7289943",
"0.72758704",
"0.7245939",
"0.72297513",
"0.72297317... | 0.8009748 | 2 |
Endpoint. Retrieve a list of articles. | def articles ():
offset = int (arg ('offset', '0', re_integer_arg))
limit = clip (arg ('limit', str (MAX_RESULTS), re_integer_arg), 1, MAX_RESULTS)
with current_app.config.dba.engine.begin () as conn:
res = execute (conn, r"""
SELECT no
FROM article
ORDER BY no
LIMI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list():\r\n articles = []\r\n if request.method == 'GET':\r\n # Get all articles\r\n response = table.scan()\r\n articles = response.get('Items')\r\n\r\n return render_template('article/articles.html', articles=articles, title='List Articles')",
"def list_articles():\n\n retu... | [
"0.834087",
"0.7946029",
"0.77411634",
"0.74669945",
"0.74529004",
"0.7433966",
"0.7422792",
"0.73798174",
"0.73665166",
"0.7209931",
"0.7209162",
"0.7087792",
"0.7065397",
"0.7005387",
"0.69917214",
"0.69782454",
"0.69404846",
"0.69230485",
"0.69015163",
"0.6899068",
"0.6811... | 0.74979204 | 3 |
Return the value of the state (computed in __init__). | def getValue(self, state):
return self.values[state] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n\t\traise NotImplementedError",
"def getValue(self, state):\n util.raiseNotDefined()",
"def getValue(self, state):\n util.raiseNotDefined()",
... | [
"0.83004",
"0.83004",
"0.825906",
"0.8086294",
"0.8086294",
"0.79571116",
"0.79308134",
"0.78029096",
"0.77365136",
"0.7735367",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0.7603885",
"0... | 0.7734854 | 20 |
The policy is the best action in the given state according to the values currently stored in self.values. You may break ties any way you see fit. Note that if there are no legal actions, which is the case at the terminal state, you should return None. | def computeActionFromValues(self, state):
"*** YOUR CODE HERE ***"
maxvalue = -100000000
bestaction = None
for action in self.mdp.getPossibleActions(state):
valueforthisaction = self.getQValue(state, action) # is this right?
if valueforthisaction > maxvalue:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n possibleActions = self.mdp.getPossibleActions(state)\n #checking for terminal state (no possible actions)\n if len(possibleActions) is 0: \n return None\n \n #attempt at using the Counter\n eValsActions = ut... | [
"0.77932984",
"0.77125514",
"0.761519",
"0.7606851",
"0.7493173",
"0.7467505",
"0.7373492",
"0.7342821",
"0.7341081",
"0.73393077",
"0.73349196",
"0.73109776",
"0.7310181",
"0.7295553",
"0.72748286",
"0.72445726",
"0.72445726",
"0.7156237",
"0.7089561",
"0.70827645",
"0.70623... | 0.7314243 | 11 |
Next zone serial number. Next serial is greater than current one. Serial is built using current data to follow common practive. | def get_next_serial(self):
T = time.gmtime()
base = T[0] * 10000 + T[1] * 100 + T[2]
s_base = self.serial // 100
if s_base < base:
return base * 100 # New day
else:
return self.serial + 1 # May cause future lap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_next_sequence_number(self):\n cur = self._next_sequence_number\n self._next_sequence_number += 1\n return cur",
"def _get_serial(self):\n with open(self.ca_dir + SERIAL_NAME, 'r+') as serial_file:\n fcntl.flock(serial_file, fcntl.LOCK_EX)\n serial = int(... | [
"0.6465065",
"0.6294775",
"0.61611086",
"0.6109975",
"0.6051333",
"0.60172594",
"0.59992635",
"0.5993045",
"0.59796476",
"0.58794314",
"0.58794314",
"0.58713484",
"0.585806",
"0.5823625",
"0.58135706",
"0.5806198",
"0.57873565",
"0.5781377",
"0.57158947",
"0.57105285",
"0.566... | 0.77350956 | 0 |
Get a list of notification groups to notify about zone changes | def get_notification_groups(self):
if self.notification_group:
return [self.notification_group]
if self.profile.notification_group:
return [self.profile.notification_group]
ng = SystemNotification.get_notification_group("dns.change")
if ng:
return [ng]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_notified_targetgroups(self):\r\n notified = db.leak[self.id].notified_groups\r\n if notified is None:\r\n return []\r\n else:\r\n return json.loads(notified)",
"def get_monitored_changes(self) -> List:\n pass",
"def groups(self):\n #return self.g... | [
"0.64347035",
"0.58877194",
"0.5824756",
"0.58240813",
"0.5785113",
"0.5726456",
"0.57208014",
"0.5693628",
"0.5691242",
"0.5624232",
"0.55486226",
"0.5536277",
"0.5532384",
"0.5531114",
"0.55070025",
"0.5504677",
"0.54586047",
"0.54154223",
"0.54148686",
"0.5399377",
"0.5379... | 0.7972055 | 0 |
Get the width in pixels of the frames this game renders. | def get_frame_size(self) -> Tuple[int, int]:
return self.__sim.frame_size() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWidth(self):\n return frameWidth",
"def get_frame_width(self) -> int:\n return self.__sim.frame_size()[0]",
"def get_width(self) -> int:\n return self.rsimulator.get_frame_width()",
"def frameWidth(self):\n return self._frame_width",
"def frame_width(self) -> int:\n ... | [
"0.8688647",
"0.8613795",
"0.8520266",
"0.8426821",
"0.8346426",
"0.8209329",
"0.78909",
"0.7611521",
"0.7594529",
"0.759402",
"0.75854415",
"0.75768906",
"0.7528958",
"0.74856",
"0.74758935",
"0.74758935",
"0.74511576",
"0.7443739",
"0.74220127",
"0.7415641",
"0.7415641",
... | 0.72729653 | 45 |
Get the width in pixels of the frames this game renders. | def get_frame_width(self) -> int:
return self.__sim.frame_size()[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWidth(self):\n return frameWidth",
"def get_width(self) -> int:\n return self.rsimulator.get_frame_width()",
"def frameWidth(self):\n return self._frame_width",
"def frame_width(self) -> int:\n pass",
"def get_width(self):\n return max(map(TextImage.get_width, self... | [
"0.86891806",
"0.85198593",
"0.8427314",
"0.8346614",
"0.8209053",
"0.78901935",
"0.7610554",
"0.7594967",
"0.75932884",
"0.7586037",
"0.7576318",
"0.7529654",
"0.74853146",
"0.74766475",
"0.74766475",
"0.7451439",
"0.74444026",
"0.7422578",
"0.74161416",
"0.74161416",
"0.741... | 0.8612898 | 1 |
Get the height in pixels of the frames this game renders. | def get_frame_height(self) -> int:
return self.__sim.frame_size()[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHeight(self):\n return frameHeight",
"def get_height(self) -> int:\n return self.rsimulator.get_frame_height()",
"def frame_height(self) -> int:\n pass",
"def frameHeight(self):\n return self._frame_height",
"def get_height(self):\n return max(map(TextImage.get_hei... | [
"0.8737532",
"0.858383",
"0.8386076",
"0.83400345",
"0.82720095",
"0.79945946",
"0.7796253",
"0.7796253",
"0.77437437",
"0.76917267",
"0.7630042",
"0.76270753",
"0.75525427",
"0.75489825",
"0.75448066",
"0.75448066",
"0.75448066",
"0.75448066",
"0.75314134",
"0.7521969",
"0.7... | 0.8675554 | 1 |
Get a JSON representation of the state. | def to_json(self) -> Dict[str, Any]:
return json.loads(self.get_state().to_json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_state_json(self) -> Dict[str, Any]:\n return self.state_to_json()",
"def state_to_json(self) -> Dict[str, Any]:\n return self.rstate.to_json()",
"def to_json(self):\n return {\n \"state_type\": self.state_type,\n \"state_id\": self.state_id,\n \"publ... | [
"0.87301415",
"0.85217005",
"0.8410326",
"0.8047187",
"0.7858633",
"0.74160475",
"0.73493433",
"0.72855616",
"0.72207755",
"0.70691967",
"0.7063533",
"0.69893986",
"0.69556314",
"0.69279844",
"0.69250184",
"0.69142",
"0.6911378",
"0.690467",
"0.68803036",
"0.6873965",
"0.6859... | 0.8407449 | 3 |
Get the height of the rendered game in pixels. | def get_height(self) -> int:
return self.rsimulator.get_frame_height() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_height(self) -> int:\n return int(self._surface.get_height())",
"def height(self):\n return(self.SCREEN_H)",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self._height",
"def height(self)... | [
"0.81684476",
"0.80634594",
"0.78612244",
"0.78612244",
"0.7832945",
"0.77984476",
"0.7766496",
"0.7761719",
"0.7737755",
"0.7736839",
"0.76962453",
"0.7694103",
"0.7622402",
"0.7622402",
"0.7622402",
"0.7622402",
"0.76040655",
"0.7603959",
"0.76033235",
"0.7601484",
"0.76001... | 0.7824396 | 5 |
Get the width of the rendered game in pixels. | def get_width(self) -> int:
return self.rsimulator.get_frame_width() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_width(self) -> int:\n return int(self._surface.get_width())",
"def width(self):\n return(self.SCREEN_W)",
"def getPlayerWidth(self):\n \n context = aq_inner(self.context)\n \n return context.getWidth()",
"def width(self) -> int:\r\n return self.rect_uv... | [
"0.8115016",
"0.79692084",
"0.77971774",
"0.76963514",
"0.76890427",
"0.76551825",
"0.7617467",
"0.7585239",
"0.75754964",
"0.7558717",
"0.7558717",
"0.7554131",
"0.75291353",
"0.7524967",
"0.7524733",
"0.75203687",
"0.7508959",
"0.74974203",
"0.74974203",
"0.74974203",
"0.74... | 0.75831 | 8 |
Get the state's JSON representation as a python object. | def state_to_json(self) -> Dict[str, Any]:
return self.rstate.to_json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(self) -> Dict[str, Any]:\n return json.loads(self.get_state().to_json())",
"def to_state_json(self) -> Dict[str, Any]:\n return self.state_to_json()",
"def __toJSON(self):\n context = jsonpickle.pickler.Pickler(unpicklable=True, warn=True, keys=True)\n json_state = conte... | [
"0.83683366",
"0.8212334",
"0.78208005",
"0.76950616",
"0.7276408",
"0.7193767",
"0.71107274",
"0.70564234",
"0.70532304",
"0.7030929",
"0.69553906",
"0.6923266",
"0.69154525",
"0.6816502",
"0.67719",
"0.67719",
"0.67662394",
"0.67638034",
"0.6703736",
"0.6650296",
"0.6649427... | 0.7937635 | 2 |
Removes duplicates in a sorted array of integers in place (i.e. the original array is modified). All entries up to a particular length of the array are sorted in increasing order and are not duplicated. Beyond that length, it does not matter what is stored in the array. This version uses two while loops to determine th... | def removeDuplicates(self, nums: List[int]) -> int:
lead = 0
trail = 0
nums_len = len(nums)
while lead < nums_len - 1:
while nums[lead] <= nums[trail]:
lead += 1
if lead >= nums_len:
break
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_duplicates_array(self, array: List) -> List:\n seen = set()\n seen_add = seen.add\n return [x for x in array if not (x in seen or seen_add(x))]",
"def remove_duplicates(nums: List[int]) -> int:\n\n if not nums:\n return 0\n\n slow = 0\n for fast in ... | [
"0.68854004",
"0.6849876",
"0.6775448",
"0.6752954",
"0.6712457",
"0.66421545",
"0.662587",
"0.64599824",
"0.64023757",
"0.62553763",
"0.6144159",
"0.61293685",
"0.6112883",
"0.6107234",
"0.6087302",
"0.6021101",
"0.6008951",
"0.6006148",
"0.60044",
"0.5992662",
"0.5977117",
... | 0.6525636 | 7 |
Removes duplicates in a sorted array of integers in place (i.e. the original array is modified). All entries up to a particular length of the array are sorted in increasing order and are not duplicated. Beyond that length, it does not matter what is stored in the array. A much shorter version using a for loop. | def removeDuplicates(self, nums: List[int]) -> int:
trail = 0
for i, n in enumerate(nums):
if nums[trail] != nums[i]:
trail += 1
nums[trail] = nums[i]
return trail + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_duplicates_array(self, array: List) -> List:\n seen = set()\n seen_add = seen.add\n return [x for x in array if not (x in seen or seen_add(x))]",
"def unique_of_an_array(an_array):\n temp_array=an_array.copy()\n u=[]\n for i in range(temp_array.shape[0]):\n for j i... | [
"0.7500093",
"0.7180552",
"0.71648175",
"0.70080674",
"0.6961687",
"0.6937332",
"0.6876349",
"0.6798919",
"0.6758164",
"0.66873443",
"0.66688263",
"0.6607664",
"0.6533917",
"0.65171826",
"0.6407602",
"0.6230464",
"0.62107706",
"0.6203199",
"0.6133676",
"0.6131479",
"0.6107336... | 0.6228829 | 16 |
Compute the array mapping monomials under multiplication by x_var | def indexarray(matrix_terms, which, var):
mults = matrix_terms[which].copy()
mults[:, var] += 1
return np.argmin(np.abs(mults[:, np.newaxis] - matrix_terms[np.newaxis]).sum(axis=-1), axis=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prob_map(self, x):\n d = self.manifold.shape[0]\n n = x.shape[1]\n maha = np.zeros(shape=(n, self.m))\n for w in range(self.m):\n mu = np.tile(self.manifold[:, w].reshape(d, 1),\n (1, n))\n maha[:, w] = np.sum((x-mu)**2, 0) / self.sigma... | [
"0.688784",
"0.63702035",
"0.6330995",
"0.61941296",
"0.6099713",
"0.6046073",
"0.59148383",
"0.588612",
"0.5858323",
"0.58422726",
"0.581216",
"0.573582",
"0.5702135",
"0.56995577",
"0.5675611",
"0.56696725",
"0.5643081",
"0.56386024",
"0.5636899",
"0.5633451",
"0.561626",
... | 0.5129997 | 78 |
Update url string to try to make sure that the proper url scheme (https, http) is used | def get_correct_url(request: flask.Request) -> str:
parsed_url = urlparse(request.url_root)
request_scheme = request.headers.get('X-Scheme')
if request_scheme is not None:
# use the same scheme that the request used
return parsed_url._replace(scheme=request_scheme).geturl()
elif parsed_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_prepare(url):\n if 'http://' in url or 'https://' in url:\n return url\n try:\n if requests.get('https://' + url):\n return 'https://' + url\n except Exception as ex:\n pprint(ex)\n return 'http://' + url",
"def fix_url(cls, url: str):\r\n ...",
"def _... | [
"0.77348053",
"0.7493406",
"0.73766786",
"0.7328102",
"0.7213342",
"0.71923023",
"0.7186089",
"0.7145018",
"0.7122136",
"0.7047641",
"0.70049304",
"0.6989341",
"0.69811887",
"0.6958153",
"0.6946653",
"0.69459736",
"0.68953645",
"0.6779411",
"0.6762922",
"0.6647423",
"0.663314... | 0.581559 | 85 |
Takes in a speech, tokenizes and breaks it out into sentences, lemmatizes and removes stop words and punctuation for each speech | def preprocess(clean_corpus):
# Create our list of punctuation marks
punctuations = '!"#$%&\'()’*+,-./:”;<=>?@[\\]^_`{|}~'
# Create our list of stopwords
stop_words = spacy.lang.en.stop_words.STOP_WORDS
# Establish weird words in our corpus to be filtered out
weird_words = ['abc', 'c'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, sentence):\n\n # selects onlt alphanumeric words\n words = self.tokenizer.tokenize(sentence)\n\n # lemmatize the words\n words = [self.lemmatizer.lemmatize(word) for word in words]\n\n # lowercase all the words and remove single characters\n words = [word... | [
"0.72735536",
"0.7171761",
"0.7118004",
"0.71071094",
"0.7104198",
"0.7082318",
"0.69064766",
"0.68198186",
"0.6813841",
"0.68095016",
"0.68062806",
"0.68042564",
"0.6797433",
"0.67923796",
"0.67888284",
"0.67711854",
"0.6768037",
"0.6767615",
"0.67422837",
"0.6728139",
"0.67... | 0.70303637 | 6 |
Returns if the word is in the trie. | def search(self, word):
node = self.root
for char in word:
if char in node.dict:
node = node.dict[char]
else:
return False
if node.end:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.838688",
"0.81506926",
"0.8123755",
"0.7855897",
"0.78300554",
"0.77929205",
"0.7792431",
"0.7764039",
"0.77527696",
"0.7747135",
"0.7710718",
"0.7681125",
"0.76765084",
"0.7663886",
"0.76334864",
"0.7627911",
"0.7610731",
"0.7577138",
"0.7569136",
"0.7560349",
"0.75594175... | 0.7650241 | 14 |
Copyright (c) 2012 by David WardeFarley Reads a partial array (contiguous chunk along the first axis) from an NPY file. | def read_npy_chunk(filename, start_row, num_rows):
assert start_row >= 0 and num_rows > 0
with open(filename, 'rb') as fhandle:
major, minor = np.lib.format.read_magic(fhandle)
shape, fortran, dtype = np.lib.format.read_array_header_1_0(fhandle)
assert not fortran, "Fortran order arrays ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_npy_file(filename):\n np_arr = np.load(filename)\n return np_arr",
"def fromunformatted(file,dtype='float32', shape=None, skip=-1, count=-1):\n if skip >= 0:\n endcount = 1\n else:\n endcount = -1\n\n try:\n file.seek(0,1)\n except AttributeError:\n file = o... | [
"0.6325949",
"0.6271587",
"0.6199003",
"0.61408424",
"0.6067401",
"0.5998804",
"0.5961009",
"0.5885518",
"0.5878145",
"0.5876129",
"0.5849605",
"0.58374834",
"0.58344537",
"0.58189416",
"0.5805925",
"0.57592756",
"0.5726147",
"0.56939596",
"0.5681636",
"0.5681636",
"0.5658396... | 0.7298586 | 0 |
__call__(self, x, c, finetune=False) Invokes the forward propagation of BatchNormalization. In training mode, the BatchNormalization computes moving averages of mean and variance for evaluatino during training, and normalizes the input using batch statistics. | def __call__(self, x, c, finetune=False, **kwargs):
if c.ndim == 2:
gamma_c = F.matmul(c, self.gammas.W)
beta_c = F.matmul(c, self.betas.W)
else:
gamma_c = self.gammas(c)
beta_c = self.betas(c)
return super(CategoricalConditionalBatchNormalization,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, x, **kwargs):\n argument.check_unexpected_kwargs(\n kwargs, test='test argument is not supported anymore. '\n 'Use chainer.using_config')\n finetune, = argument.parse_kwargs(kwargs, ('finetune', False))\n\n if hasattr(self, 'gamma'):\n gamma ... | [
"0.78120357",
"0.6609565",
"0.6519364",
"0.64857125",
"0.63217014",
"0.62920266",
"0.62697506",
"0.6240007",
"0.6204136",
"0.61848927",
"0.6183013",
"0.6145865",
"0.6096971",
"0.60799265",
"0.60720384",
"0.6063913",
"0.60437244",
"0.6033654",
"0.6029397",
"0.60261464",
"0.598... | 0.79198986 | 0 |
Resets the population count for collecting population statistics. This method can be skipped if it is the first time to use the finetuning mode. Otherwise, this method should be called before starting the finetuning mode again. | def start_finetuning(self):
self.N = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reinit(self):\n self.logger.info(\"Reinit called. Clear the population.\")\n self.set_init_population([], perf_name=None)\n self._gt_rollouts = []\n self._gt_scores = []",
"def reset_next_population(self):\n self.next_population = []",
"def reset(self):\n if not se... | [
"0.7370528",
"0.73314667",
"0.71854067",
"0.69929546",
"0.69929546",
"0.6989829",
"0.68576974",
"0.6851169",
"0.6805506",
"0.6776551",
"0.6727888",
"0.6719139",
"0.67131925",
"0.6656626",
"0.6646397",
"0.6635762",
"0.65523297",
"0.6549725",
"0.6549059",
"0.6544948",
"0.653123... | 0.6109606 | 61 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.