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 |
|---|---|---|---|---|---|---|
Get column values from row. | def get_row(self, index: Index, columns=None, as_list=False):
columns = if_none(columns, self._columns)
idx = self.index_location(index)
if as_list:
row = []
for column in columns:
col = self.column_location(column)
row.append(self._data[i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractValuesColumn(self, row):\n\n ret = []\n for j in range(self.shapeColumn):\n ret.append(self.buttons[row][j].text())\n\n return ret",
"def _get_column_values(self, col: str) -> ndarray:\n dtype, loc = self._get_col_dtype_loc(col) # type: str, int\n return ... | [
"0.7345508",
"0.72079426",
"0.7114128",
"0.71111465",
"0.709266",
"0.69657457",
"0.69155985",
"0.6825146",
"0.6765976",
"0.673627",
"0.66913944",
"0.66166276",
"0.6583556",
"0.64681995",
"0.6422054",
"0.63940936",
"0.6393969",
"0.6377255",
"0.63697493",
"0.63642657",
"0.63604... | 0.0 | -1 |
Iterate rows with values as lists. | def iter_lists(self, with_index=True):
for idx, row in zip(self.index, self._data):
if with_index:
yield idx, list(row)
else:
yield list(row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_rows(self, *args):\n\n raw_args = []\n for arg in args:\n if arg in self._column_translations:\n raw_args+=self._column_translations[arg].inputs()\n else:\n raw_args.append(arg)\n for raw_values in self.iter_rows_raw(*raw_args):\n ... | [
"0.73756903",
"0.71533924",
"0.7114714",
"0.6888027",
"0.6808713",
"0.67274874",
"0.67219156",
"0.65170556",
"0.6487671",
"0.64483136",
"0.64100844",
"0.63937354",
"0.6373241",
"0.63730186",
"0.6298312",
"0.62536573",
"0.62525684",
"0.6238389",
"0.61866456",
"0.61799157",
"0.... | 0.57509696 | 51 |
Iterate rows with values as dicts. | def iter_dicts(self, with_index=True) -> Generator[Dict[Column, Any], None, None]:
for index in self.index:
row = {"index": index} if with_index else {}
for column in self._columns:
row[column] = self.get_cell(index, column)
yield row | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_dict(self):\n\n itr = iter(self)\n\n headers = next(itr)\n\n for row in itr:\n yield dict(zip(headers, row))",
"def Result(row, schema):\r\n return dict(zip(schema.fields(), row))",
"def __iter__(self):\n columns = self.columns()\n if self._default_inde... | [
"0.69744766",
"0.6617032",
"0.65347224",
"0.64995223",
"0.64995223",
"0.64094275",
"0.64094275",
"0.63850874",
"0.6368406",
"0.6345039",
"0.6329642",
"0.63011974",
"0.630039",
"0.61753786",
"0.61750656",
"0.6167536",
"0.6159854",
"0.61181295",
"0.6091897",
"0.6058906",
"0.605... | 0.6602357 | 2 |
Convert table to list representation. | def to_list(self, with_index=True):
export = []
for index in self.index:
row = OrderedDict()
if with_index:
row["index"] = index
for column in self._columns:
row[column] = self.get_cell(index, column)
export.append(row)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_list_flat(self):\n return self.rep.entries()",
"def to_list(self):\n return SeriesDefault.register(pandas.Series.to_list)(self)",
"def to_list(self) -> list:\n return self.A.tolist()",
"def tolist(self):\n \n ret = []\n \n for e in self:\n re... | [
"0.64304966",
"0.635336",
"0.63334006",
"0.6188469",
"0.6163717",
"0.6119067",
"0.61180836",
"0.6104574",
"0.61043835",
"0.6098932",
"0.60836774",
"0.6069911",
"0.6054045",
"0.6023221",
"0.6018971",
"0.6001493",
"0.599934",
"0.5967079",
"0.59374005",
"0.5933858",
"0.592881",
... | 0.5661426 | 47 |
Group a table by ``column`` and return a list of grouped Tables. | def group_table_by_column(self, table: Table, column: Column) -> List[Table]:
self._requires_table(table)
groups = table.group_by_column(column)
self.logger.info("Found %s groups", len(groups))
return groups | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_by_column(self, column):\n ref = self.copy()\n ref.sort_by_column(column)\n\n col = self.column_location(column)\n groups = groupby(ref.data, itemgetter(col))\n\n result = []\n ref.clear()\n for _, group in groups:\n table = ref.copy()\n ... | [
"0.85513383",
"0.6532524",
"0.6312355",
"0.61600953",
"0.6026099",
"0.5568698",
"0.53542984",
"0.5292979",
"0.5158976",
"0.5114148",
"0.50809896",
"0.5067889",
"0.5056088",
"0.50313807",
"0.5024239",
"0.50111103",
"0.49159738",
"0.49159738",
"0.48787895",
"0.48526627",
"0.482... | 0.8990111 | 0 |
Remove all rows from a table which have only ``None`` values. | def filter_empty_rows(self, table: Table):
self._requires_table(table)
empty = []
for idx, row in table.iter_lists():
if all(value is None for value in row):
empty.append(idx)
table.delete_rows(empty) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_empty_rows(self, table: Table):\n self._requires_table(table)\n\n empty = []\n for idx in reversed(table.index):\n row = table[idx]\n if any(value is not None for value in row):\n break\n empty.append(idx)\n\n table.delete_rows(em... | [
"0.78526706",
"0.65610045",
"0.6503689",
"0.64150983",
"0.6410111",
"0.6358219",
"0.629917",
"0.6294147",
"0.6225571",
"0.6208026",
"0.5998382",
"0.598361",
"0.594039",
"0.5921602",
"0.5906316",
"0.58945847",
"0.5880637",
"0.58771354",
"0.5853974",
"0.5847558",
"0.5808685",
... | 0.818738 | 0 |
Remove all rows from the end of a table which have only ``None`` as values. | def trim_empty_rows(self, table: Table):
self._requires_table(table)
empty = []
for idx in reversed(table.index):
row = table[idx]
if any(value is not None for value in row):
break
empty.append(idx)
table.delete_rows(empty) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_empty_rows(self, table: Table):\n self._requires_table(table)\n\n empty = []\n for idx, row in table.iter_lists():\n if all(value is None for value in row):\n empty.append(idx)\n\n table.delete_rows(empty)",
"def filter(self):\n self.data = ... | [
"0.7964169",
"0.62886345",
"0.6188555",
"0.60982853",
"0.6042587",
"0.59561265",
"0.5938961",
"0.5919667",
"0.5919299",
"0.59012693",
"0.58940977",
"0.58505476",
"0.5836177",
"0.58201474",
"0.57514447",
"0.56925017",
"0.5658195",
"0.5619252",
"0.5596895",
"0.55947787",
"0.556... | 0.8001879 | 0 |
Create new untitled notebook at 'path' Server base URL is 'url' Returns name of the new notebook file. | def newnb(url, path, copy=None):
# See IPython/html/services/notebooks/handlers.py for API details.
# Compare directory contents before and after new notebook creation.
names = [nb['name'] for nb in get_nblist(url, path) if nb['type'] == 'notebook']
arg = path
if isinstance(arg, unicode):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_untitled(self, path=\"\", model_type=\"\", ext=\"\"):\n path = path.strip(\"/\")\n if not self.dir_exists(path):\n raise HTTPError(404, \"No such directory: %s\" % path)\n\n model = {}\n if model_type:\n model[\"type\"] = model_type\n\n if ext == \".... | [
"0.6608155",
"0.60415953",
"0.5997468",
"0.5932369",
"0.5903256",
"0.58528847",
"0.5790085",
"0.5648391",
"0.55989397",
"0.5560958",
"0.55255204",
"0.55201197",
"0.54570735",
"0.5451196",
"0.54240686",
"0.54012394",
"0.5374578",
"0.53085756",
"0.53085756",
"0.52815825",
"0.51... | 0.81313026 | 0 |
Return an iterator which yields the paths matching a pathname pattern. The pattern may contain simple shellstyle wildcards a la fnmatch. However, unlike fnmatch, filenames starting with a dot are special cases that are not matched by '' and '?' patterns. If recursive is true, the pattern '' will match any files and zer... | def _iglob(pathname):
dirname, basename = os.path.split(pathname)
if not _glob.has_magic(pathname):
if basename:
if os.path.lexists(pathname):
yield pathname
else:
raise FileNotFoundError
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive_glob(path, pattern):\n for root, dirnames, filenames in os.walk(path, followlinks=True):\n for filename in fnmatch.filter(filenames, pattern):\n yield os.path.join(root, filename)",
"def find_files(path, pattern):\n\n for root, dirnames, filenames in os.walk(path):\n ... | [
"0.7470483",
"0.724167",
"0.7206091",
"0.7170805",
"0.7144289",
"0.7060169",
"0.7059605",
"0.70567816",
"0.70107704",
"0.69938034",
"0.69640553",
"0.6933802",
"0.68447554",
"0.6841112",
"0.67750823",
"0.67699903",
"0.67241395",
"0.6652444",
"0.6640153",
"0.6589862",
"0.654365... | 0.63602096 | 31 |
Rotate the camera so that +z is up (Default vpython scene is +y up) | def convert_grid_to_z_up(scene): # pragma nocover
'''
There is an interaction between up and forward, the direction that the
camera is pointing. By default, the camera points in the -z direction
vector(0,0,-1). In this case, you can make the x or y axes (or anything
between) be the up vector, but ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCameraRotation3D(ang):\n dislin.vup3d(ang)",
"def rotateZUp(self):\n MV = self.MV\n MV[:3, 1] = 0, 0, 1 # 2nd col is up vector, make it point along z axis\n # set bottom left and bottom right z values to zero:\n MV[2, 0] = 0\n MV[2, 2] = 0\n a = MV[0, 0] # grab... | [
"0.7430334",
"0.7009169",
"0.7009169",
"0.64886934",
"0.6455609",
"0.64167166",
"0.6410739",
"0.63931197",
"0.6271744",
"0.6225299",
"0.6166877",
"0.6164807",
"0.6145292",
"0.6120838",
"0.6093956",
"0.6093271",
"0.6072405",
"0.60669416",
"0.6060744",
"0.60481805",
"0.60113543... | 0.66587967 | 3 |
Fill NaN with zero. | def fill_zero(df):
df = df.fillna(0)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_with_neg_inf(t):\r\n return t.float().fill_(float(\"-inf\")).type_as(t)",
"def convert_fill_zeros_like(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n dtype = op.attr(\"dtype\")\n dtype = _convert_dtype_value(dtype)\n value = _expr.const(0, dtype=dtype)\n out = _op.transform.fu... | [
"0.69296664",
"0.68928945",
"0.6783993",
"0.6768336",
"0.673804",
"0.66560954",
"0.6619058",
"0.6479309",
"0.6471661",
"0.638369",
"0.6302883",
"0.6270129",
"0.62374",
"0.6225682",
"0.6204576",
"0.619489",
"0.61801636",
"0.61632276",
"0.6141827",
"0.60993683",
"0.6081503",
... | 0.78565556 | 0 |
Fill NaN with previous values. | def fill_forward(df):
df = df.fillna(method='ffill')
df = df.fillna(method='bfill').fillna(0)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ffill_nans(df):\n return df.fillna(method='ffill', axis=0)",
"def fill_nan(A):\n\tinds = np.arange(A.shape[0])\n\tgood = np.where(np.isfinite(A))\n\tA[np.isnan(A)] = np.interp(inds[np.isnan(A)], inds[good], A[good])\n\treturn A",
"def fillna(\n self,\n value=None,\n meth... | [
"0.74325144",
"0.72073084",
"0.6924598",
"0.6811489",
"0.6752172",
"0.6750189",
"0.6748046",
"0.6673897",
"0.66647804",
"0.66059715",
"0.65565443",
"0.6540866",
"0.6376292",
"0.6331262",
"0.63224936",
"0.6284117",
"0.6249076",
"0.62287915",
"0.6224946",
"0.61513656",
"0.61431... | 0.7278524 | 1 |
Remove any type of punctuation and the words and then split on whitespace | def simple_tokenizer(text):
re_tok = re.compile(punctuation_string)
return re_tok.sub(' ', text).split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_words(text):\n splitter = re.compile('\\\\W*')\n return [s.lower() for s in splitter.split(text) if s != '']",
"def tokenizer(text):\n # remove punctuation from text - remove anything that isn't a word char or a space\n replace_punctuation = str.maketrans(string.punctuation, ' ' * len(st... | [
"0.7764153",
"0.7578712",
"0.74054563",
"0.7397258",
"0.739063",
"0.7379701",
"0.73594034",
"0.7351419",
"0.7346505",
"0.73402655",
"0.73402655",
"0.7331885",
"0.7299199",
"0.72888243",
"0.7285937",
"0.7225834",
"0.7219664",
"0.71976674",
"0.717803",
"0.71773326",
"0.71773326... | 0.7616074 | 1 |
Remove any type of punctuation and the words contained in the global variable common_words and then split on whitespace | def tokenize(text):
common_words_string = " | ".join(common_words)
re_tok = re.compile(punctuation_string + "| " + common_words_string + " ")
words = re_tok.sub(' ',re_tok.sub(' ',text)).split()
tokens = []
for i in range(len(words)-1):
first = words[i]
second = words[i+1]
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean(words):\r\n tokens = []\r\n try:\r\n for token in words:\r\n token = re.sub(r'[\\W\\d_]', \" \", token)\r\n tokens.append(token)\r\n except:\r\n token = \"\"\r\n tokens.append(token)\r\n \r\n return tokens",
"def separate_words(text):\n split... | [
"0.6997493",
"0.69969183",
"0.69742167",
"0.6832428",
"0.6822094",
"0.67601043",
"0.67574143",
"0.6756985",
"0.67543316",
"0.6739854",
"0.67051816",
"0.66922736",
"0.6691624",
"0.66914135",
"0.66914135",
"0.66914135",
"0.66914135",
"0.66914135",
"0.66914135",
"0.6681939",
"0.... | 0.70328444 | 0 |
Returns the last animation from motion folder. | def last_video(self) -> str:
return max(glob.glob(VIDEOS_DIR), key=os.path.getmtime) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_sprite(self) -> pygame.Surface:\n return self.__animation_dict[self.__animation_key][-1]",
"def last_move(self) -> str:\n return self.move_history[-1][0]",
"def getLast(self):\n if self.last != None:\n return self.last.filename\n else:\n return Non... | [
"0.70536137",
"0.6626715",
"0.64376235",
"0.6289931",
"0.62253004",
"0.6189322",
"0.6166485",
"0.6134241",
"0.61204666",
"0.6025072",
"0.60086966",
"0.60028607",
"0.5978436",
"0.5936558",
"0.59213287",
"0.5916931",
"0.591159",
"0.5884262",
"0.58586836",
"0.5853098",
"0.584963... | 0.61035115 | 9 |
Clears the gradients in all the modules parameters | def zero_grad(self):
for p, grad, v, square_grad_avg, delta_x_acc in self.params:
grad.zero_() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_grad(self):\r\n for param in self.params:\r\n param.grad = None",
"def zero_grad(self):\n for parameter in self.param():\n parameter.zero_grad()",
"def reset_grad(self):\n self.g_optimizer.zero_grad()\n self.d_optimizer.zero_grad()\n self.dr_opt... | [
"0.7699398",
"0.7374041",
"0.70619255",
"0.70145935",
"0.70145935",
"0.70145935",
"0.6994333",
"0.6987146",
"0.69703895",
"0.69299877",
"0.69264627",
"0.6923094",
"0.68966067",
"0.6819994",
"0.68010116",
"0.6771016",
"0.67652756",
"0.66285706",
"0.66206473",
"0.65345746",
"0.... | 0.6764791 | 17 |
Clears the gradients in all the modules parameters | def zero_grad(self):
for p, grad, v, square_grad_avg, delta_x_acc in self.params:
grad.zero_() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_grad(self):\r\n for param in self.params:\r\n param.grad = None",
"def zero_grad(self):\n for parameter in self.param():\n parameter.zero_grad()",
"def reset_grad(self):\n self.g_optimizer.zero_grad()\n self.d_optimizer.zero_grad()\n self.dr_opt... | [
"0.7699398",
"0.7374041",
"0.70619255",
"0.70145935",
"0.70145935",
"0.70145935",
"0.6994333",
"0.6987146",
"0.69703895",
"0.69299877",
"0.69264627",
"0.6923094",
"0.68966067",
"0.6819994",
"0.68010116",
"0.6771016",
"0.67652756",
"0.66285706",
"0.66206473",
"0.65345746",
"0.... | 0.6764791 | 18 |
Rotate an array to the right by k steps, where k is nonnegative. | def rotate1(nums, k):
n = len(nums)
if k == 0:
return nums
if n < 2:
return nums
k = k % n # In case k > len(nums), prevent redundant rotations
new_nums = [0] * n
for i in range(n):
j = (i + k) % n # Use modulo for wrap-around
new_nums[j] = nums[i]
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_array(arr, k):\r\n arr[:] = (arr[len(arr)-k:])+(arr[:len(arr)-k])",
"def rotate_array(arr: list, k: int):\n\n return arr[-k::] + arr[:(len(arr) - k)]",
"def rotate(nums, k):\n nums = nums[(len(nums) - k):] + nums[:(len(nums) - k)]",
"def rotate(self, nums, k):\n n = len(nums)\n ... | [
"0.7780756",
"0.76009965",
"0.7443216",
"0.73982453",
"0.7320614",
"0.7320594",
"0.73047745",
"0.7282702",
"0.72805387",
"0.723467",
"0.7169917",
"0.71453387",
"0.71260244",
"0.7113509",
"0.71068275",
"0.70753795",
"0.7065764",
"0.7056572",
"0.7026336",
"0.7025461",
"0.695917... | 0.67634064 | 39 |
Rotate an array to the right by k steps, where k is nonnegative. | def rotate2(nums, k):
n = len(nums)
if k == 0:
return nums
if n < 2:
return nums
k = k % n # In case k > len(nums), prevent redundant rotations
for _ in range(k):
last = nums[-1] # The extra O(1) space
for i in range(n):
# Since we're rotating element... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_array(arr, k):\r\n arr[:] = (arr[len(arr)-k:])+(arr[:len(arr)-k])",
"def rotate_array(arr: list, k: int):\n\n return arr[-k::] + arr[:(len(arr) - k)]",
"def rotate(nums, k):\n nums = nums[(len(nums) - k):] + nums[:(len(nums) - k)]",
"def rotate(self, nums, k):\n n = len(nums)\n ... | [
"0.77834535",
"0.76037943",
"0.7448569",
"0.7402826",
"0.73254246",
"0.73246807",
"0.7308889",
"0.7285865",
"0.72399133",
"0.7174651",
"0.7142849",
"0.71315426",
"0.7118598",
"0.71113163",
"0.7080308",
"0.70704305",
"0.706071",
"0.7030984",
"0.70298725",
"0.6963938",
"0.69579... | 0.7286706 | 7 |
Rotate an array to the right by k steps, where k is nonnegative. | def rotate3(nums, k):
n = len(nums)
if k == 0:
return nums
if n < 2:
return nums
k = k % n # In case k > len(nums), prevent redundant rotations
for i in range(k):
saved = nums[n - k + i] # The extra O(1) space
for j in range(n - k + i, i, -1):
# Since... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_array(arr, k):\r\n arr[:] = (arr[len(arr)-k:])+(arr[:len(arr)-k])",
"def rotate_array(arr: list, k: int):\n\n return arr[-k::] + arr[:(len(arr) - k)]",
"def rotate(nums, k):\n nums = nums[(len(nums) - k):] + nums[:(len(nums) - k)]",
"def rotate(self, nums, k):\n n = len(nums)\n ... | [
"0.7783005",
"0.7603265",
"0.7447755",
"0.74022603",
"0.73248863",
"0.73240596",
"0.730838",
"0.7285869",
"0.7284972",
"0.723879",
"0.7173743",
"0.7143822",
"0.7130628",
"0.7117726",
"0.70800036",
"0.7070019",
"0.7060243",
"0.7030299",
"0.7029191",
"0.6963482",
"0.6957627",
... | 0.7110545 | 14 |
Play random archived video. Chooses random archived video from selected channel and redirects to its detail page view. | def web_videos_random_archived(channel):
try:
choice = random.choice([
video['snippet']['resourceId']['videoId']
for video in yt_get_channel_videos(channel)
if video['archived'] is not None
])
except IndexError:
return flask.redirect(flask.url_for('vi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def web_videos_random_all(channel):\n\n try:\n choice = random.choice([\n video['snippet']['resourceId']['videoId']\n for video in yt_get_channel_videos(channel)\n ])\n except IndexError:\n return flask.redirect(flask.url_for('videos',\n channel = channel... | [
"0.7034829",
"0.6931877",
"0.69211984",
"0.6763168",
"0.6711558",
"0.6657283",
"0.6653861",
"0.6491873",
"0.64016736",
"0.5890076",
"0.5764354",
"0.57009566",
"0.56161135",
"0.5602274",
"0.5533277",
"0.55162233",
"0.55014026",
"0.54525715",
"0.53670835",
"0.53624773",
"0.5342... | 0.8072042 | 0 |
Play random video. Chooses random video from selected channel and redirects to its detail page view. | def web_videos_random_all(channel):
try:
choice = random.choice([
video['snippet']['resourceId']['videoId']
for video in yt_get_channel_videos(channel)
])
except IndexError:
return flask.redirect(flask.url_for('videos',
channel = channel
))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_random_video(self):\n\n print(\"play_random_video needs implementation\")",
"def play_random_video(self):\n num_videos = len(self._video_library.get_all_videos())\n videos = self._video_library.get_all_videos()\n random_index = randint(0, num_videos-1)\n self.play_vide... | [
"0.7648556",
"0.7557372",
"0.75215834",
"0.74750495",
"0.7418185",
"0.7326979",
"0.7265376",
"0.69038516",
"0.6407995",
"0.6363169",
"0.61298084",
"0.6126301",
"0.5969634",
"0.5944027",
"0.5845226",
"0.5799419",
"0.57790136",
"0.57275563",
"0.56893736",
"0.5664753",
"0.561203... | 0.74526733 | 4 |
Return the stringified version of the generated xml | def xml_string(self):
if self._xml_string is not None:
return self._xml_string
return etree.tostring(self._xml_node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_string(self):\r\n if self._xml_string is not None:\r\n return self._xml_string\r\n\r\n return etree.tostring(self._xml_node)",
"def get_xml(self):\n return etree.tostring(self.get_etree())",
"def __str__(self):\n result = xml.dom.minidom.parseString(\n xml.etre... | [
"0.753312",
"0.75139797",
"0.7353235",
"0.73077554",
"0.7274747",
"0.7248204",
"0.72342646",
"0.7181866",
"0.69974494",
"0.69351363",
"0.69069105",
"0.6809317",
"0.67827904",
"0.67502034",
"0.6738443",
"0.6717033",
"0.66888523",
"0.66888523",
"0.66042393",
"0.655296",
"0.6550... | 0.7555695 | 0 |
Convert a MKL sparse handle to CSR format | def _convert_to_csr(ref_handle, destroy_original=False):
csr_ref = sparse_matrix_t()
ret_val = MKL._mkl_sparse_convert_csr(ref_handle, _ctypes.c_int(10), _ctypes.byref(csr_ref))
try:
_check_return_value(ret_val, "mkl_sparse_convert_csr")
except ValueError:
try:
_destroy_mkl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pass_mkl_handle_csr_csc(data, handle_func):\n\n # Create a pointer for the output matrix\n ref = sparse_matrix_t()\n\n # Load into a MKL data structure and check return\n ret_val = handle_func(_ctypes.byref(ref),\n _ctypes.c_int(SPARSE_INDEX_BASE_ZERO),\n ... | [
"0.7503132",
"0.6884736",
"0.6833039",
"0.6737469",
"0.67181027",
"0.66780216",
"0.66586936",
"0.64889747",
"0.6419341",
"0.6368549",
"0.63611144",
"0.6345656",
"0.6335942",
"0.63115376",
"0.6233469",
"0.6230282",
"0.61900723",
"0.6182203",
"0.61719376",
"0.6149485",
"0.61394... | 0.80026007 | 0 |
Make a copy of the array as double precision floats or return the reference if it already is | def _cast_to_float64(matrix):
return matrix.astype(np.float64) if matrix.dtype != np.float64 else matrix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_as_float_array():\n X = np.ones((3, 10), dtype=np.int32)\n X = X + np.arange(10, dtype=np.int32)\n # Checks that the return type is ok\n X2 = as_float_array(X, copy=False)\n np.testing.assert_equal(X2.dtype, np.float32)\n # Another test\n X = X.astype(np.int64)\n X2 = as_float_arra... | [
"0.6045936",
"0.59793395",
"0.58334565",
"0.5811236",
"0.58041555",
"0.5803747",
"0.575333",
"0.5719215",
"0.56880665",
"0.5652057",
"0.55822545",
"0.5509963",
"0.54988366",
"0.5480099",
"0.5459266",
"0.54408836",
"0.54186636",
"0.5418037",
"0.54136366",
"0.53953546",
"0.5379... | 0.51354 | 41 |
Create an allzero matrix or check to make sure that the provided output array matches | def _out_matrix(shape, dtype, order="C", out_arr=None, out_t=False):
out_t = False if out_t is None else out_t
# If there's no output array allocate a new array and return it
if out_arr is None:
return np.zeros(shape, dtype=dtype, order=order)
# Check and make sure the order is correct
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution2(array):\n if not array:\n return\n\n n_rows = len(array)\n n_cols = len(array[0])\n\n # Since we are using first row and column as space to mark rows and columns to be zeroed,\n # first check whether they have any zeros or not\n first_row_zero = False\n first_column_zero =... | [
"0.6301234",
"0.62567663",
"0.6065526",
"0.6004522",
"0.59100115",
"0.5880008",
"0.57987255",
"0.5796987",
"0.5677778",
"0.5663355",
"0.56167245",
"0.5616022",
"0.56049746",
"0.55885136",
"0.55830944",
"0.55815345",
"0.5564158",
"0.55434084",
"0.55371547",
"0.5533879",
"0.553... | 0.0 | -1 |
Given a dictionary containing view parameters, calculate a transformation matrix. | def view_to_transform(view):
transform = view['ball'].matrix()
transform[0:3, 3] = view['center']
transform[0:3, 3] -= np.dot(transform[0:3, 0:3], view['center'])
transform[0:3, 3] += view['translation'] * view['scale'] * 5.0
return transform | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_transforms(self, view):\n raise NotImplementedError()\n # Todo: this method can be removed if we somehow enable the shader\n # to specify exactly which transform functions it needs by name. For\n # example:\n #\n # // mapping function is automatically defi... | [
"0.6074161",
"0.59667534",
"0.58879656",
"0.58708775",
"0.58666587",
"0.58450586",
"0.5839513",
"0.580901",
"0.57664406",
"0.5750556",
"0.573642",
"0.5719473",
"0.5676489",
"0.5676489",
"0.56622416",
"0.5610182",
"0.5576211",
"0.5572452",
"0.5564787",
"0.5563543",
"0.55423295... | 0.6559304 | 0 |
Render a preview of a scene to a PNG. | def render_scene(scene,
resolution=(1080, 1080),
visible=True,
**kwargs):
window = SceneViewer(scene,
start_loop=False,
visible=visible,
resolution=resolution,
**kwa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self, scene: scenes.Scene):\n\n logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)\n\n time_0 = time.time()\n logging.info(f\"Starting to render scene with size \"\n f\"{self.hsize}, {self.vsize}\")\n image = canvas.Canvas(self.hsize, self.vsize)\... | [
"0.7069312",
"0.70669353",
"0.667401",
"0.63631165",
"0.62678796",
"0.6248515",
"0.62171745",
"0.62115514",
"0.61851823",
"0.61533916",
"0.61349446",
"0.6119475",
"0.610541",
"0.60480416",
"0.60404766",
"0.60228",
"0.6015537",
"0.59994596",
"0.59963775",
"0.59657377",
"0.5931... | 0.6610991 | 3 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with Web Manager credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.7389793 | 46 |
The minimum distance between any two points. | def radius(self):
return self._radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min_distance(self):\n return round(min(self.combined_euclidian_distance))",
"def get_distance(first: Point, second: Point) -> Float:\n\n return sqrt(\n (second.x - first.x) ** 2\n +\n (second.y - first.y) ** 2\n )",
"def minimum_distance(object_1, object_2):\n\n # p... | [
"0.7398054",
"0.7347683",
"0.73398113",
"0.7249572",
"0.722252",
"0.7174279",
"0.71381766",
"0.71290714",
"0.7060147",
"0.7054031",
"0.70410913",
"0.70343655",
"0.7026882",
"0.7016064",
"0.69856024",
"0.697728",
"0.6972156",
"0.69611466",
"0.69021547",
"0.6897761",
"0.6891984... | 0.0 | -1 |
Creates distance vectors for calculating all neighbors from a given point. A neighbor can be only so far away from the original point and is dependent on the number of dimensions. We calculate every possible coordinate on the grid that the neighbor can be part of relative to a point and store that information for later... | def _create_neighbor_distances(self):
# --------------------------------
# Create Directions from Point
# --------------------------------
diff = [[0 for _ in range(self._dim)]]
curr = diff[0][:]
for i in range(self._dim):
# Each diff is a unit vector, only ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_neighbors_recursion(self, point):\n # Sanity checks\n if point is None:\n raise ValueError(\"Cannot operate on None\")\n\n neighbors = []\n # 1-dimension\n if len(point) == 1:\n neighbors.append([point[0] - 1]) # left\n neighbors.append... | [
"0.65392166",
"0.6530853",
"0.64982176",
"0.647947",
"0.64395267",
"0.6422998",
"0.6371299",
"0.6254602",
"0.620574",
"0.61816",
"0.6145644",
"0.61213267",
"0.6018979",
"0.600562",
"0.5987179",
"0.59797674",
"0.5978277",
"0.5973462",
"0.5934688",
"0.5930248",
"0.5919666",
"... | 0.7678559 | 0 |
Simply get a Row | def get(cls, session: Session = None, **kwargs):
sess = next(cls.session()) if not session else session
query = sess.query(cls)
for key, val in kwargs.items():
col = getattr(cls, key)
query = query.filter(col == val)
if query.count() > 1:
raise Except... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetRow(self, *args):\n return _table.Table_GetRow(self, *args)",
"def row(self):\n return self[\"row\"]",
"def row(self):\n\t\treturn self.__row",
"def getRow(self, row = None, *, returnContents = True, trailingNone = False, useForNone = \"\"):\n\n\t\t\t\tif (trailingNone):\n\t\t\t\t\t_row ... | [
"0.8060224",
"0.80254126",
"0.7956843",
"0.78516746",
"0.7504425",
"0.7501024",
"0.74961317",
"0.7454073",
"0.73828816",
"0.7316386",
"0.7264345",
"0.7218404",
"0.71670437",
"0.71424335",
"0.70871454",
"0.6997214",
"0.69430214",
"0.69357276",
"0.6900298",
"0.6865246",
"0.6862... | 0.0 | -1 |
Simply get a Row | def filter(cls, session: Session = None, **kwargs):
cond = []
for key, val in kwargs.items():
key = key.split("__")
if len(key) > 2:
col = getattr(cls, key[-2])
else:
continue
if len(key) == 1: cond.append((col == val))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetRow(self, *args):\n return _table.Table_GetRow(self, *args)",
"def row(self):\n return self[\"row\"]",
"def row(self):\n\t\treturn self.__row",
"def getRow(self, row = None, *, returnContents = True, trailingNone = False, useForNone = \"\"):\n\n\t\t\t\tif (trailingNone):\n\t\t\t\t\t_row ... | [
"0.80608964",
"0.80258733",
"0.79571295",
"0.7851937",
"0.75056285",
"0.7500683",
"0.74965936",
"0.74543816",
"0.7383244",
"0.73164743",
"0.72659916",
"0.7218317",
"0.7166832",
"0.7143129",
"0.7088893",
"0.69985425",
"0.69433063",
"0.69360405",
"0.69011056",
"0.6865461",
"0.6... | 0.0 | -1 |
Get directory where modules are stored | def get_modules_dir(self):
return self._modules_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetPackageDirectory():\n return os.path.dirname(__file__)",
"def module_directory(file_path):\n return os.path.dirname(os.path.realpath(file_path))",
"def default_module_dir(self):\n return os.path.dirname(self._modules['default'].path)",
"def module_path(self):\n return self.config['cwd'... | [
"0.8037318",
"0.79695654",
"0.791168",
"0.7835981",
"0.77839756",
"0.7754749",
"0.77420557",
"0.7610356",
"0.7568536",
"0.75120974",
"0.7503393",
"0.7500169",
"0.7392109",
"0.7383796",
"0.73750055",
"0.73674023",
"0.7365304",
"0.73419416",
"0.7288379",
"0.7278813",
"0.727033"... | 0.8287971 | 0 |
Better split function to extract keywords from a page | def split_string(source,splitlist):
spaces = " " * len(splitlist)
transtable = string.maketrans(splitlist, spaces)
source = string.translate(source, transtable)
return source.split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_keywords_for_movie(url):\n pass",
"def get_webpage_keywords(self, response):\n tags = response.xpath('//*/meta[@property=\"keywords\"]/@content').extract_first()\n tags1 = response.xpath('//*/meta[@name=\"keywords\"]/@content').extract_first()\n if tags:\n return tags.s... | [
"0.6272026",
"0.6218023",
"0.6199016",
"0.61652017",
"0.6137122",
"0.6055972",
"0.6046689",
"0.60393727",
"0.6039167",
"0.60223854",
"0.6017337",
"0.59776556",
"0.59697056",
"0.5919013",
"0.5918667",
"0.58741283",
"0.5849098",
"0.58092254",
"0.58048385",
"0.57927597",
"0.5785... | 0.0 | -1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(y_true, y_pred, classes,
normalize=False,
title=None,
cmap=plt.cm.Blues):
if not title:
if normalize:
title = 'Normalized confusion matrix'
else:
title = 'Confusion matrix,... | {
"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.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.0 | -1 |
If this session is anon or not. Clearly not. Will always be false. | def is_anonymous(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_anonymous():\n return False",
"def is_anonymous(self):\r\n return False",
"def is_anonymous(self):\n return False",
"def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed",
"def _is_anonymous_user(auth_info):\n auth_info = auth_info or _get_auth... | [
"0.8205281",
"0.80249506",
"0.76313406",
"0.74665135",
"0.71720505",
"0.67657197",
"0.67004937",
"0.6676598",
"0.6668741",
"0.66563576",
"0.6607069",
"0.6583967",
"0.65072757",
"0.65040714",
"0.6469018",
"0.6456573",
"0.6436853",
"0.6399897",
"0.63922125",
"0.63631505",
"0.63... | 0.81008756 | 19 |
Return offset of local zone from GMT | def _local_time_offset():
if time.localtime().tm_isdst and time.daylight:
return -time.altzone
else:
return -time.timezone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tzoffset(self):\n return _tzoffset(self._tz, self._t)",
"def get_utc_offset():\n timedelta = datetime.datetime.now() - datetime.datetime.utcnow()\n # XXX: `return -time.timezone`?\n return timedelta.total_seconds()",
"def timezone_offset():\r\n\r\n return _random.choice(\r\n [\r\n... | [
"0.7432826",
"0.7360823",
"0.7292204",
"0.72637445",
"0.7237618",
"0.7083396",
"0.6958518",
"0.69471073",
"0.67810845",
"0.67092437",
"0.6597678",
"0.65896887",
"0.64723",
"0.64647484",
"0.6375368",
"0.6350449",
"0.63273025",
"0.6307903",
"0.6293711",
"0.62897044",
"0.6239180... | 0.8144448 | 0 |
adds a comment using a post form to db and on get renders a comment form | def about(request):
data = {}
if request.method == "POST":
about = AboutForm(request.POST)
if about.is_valid():
about.save()
data['success']=1
data['message']='Comment successfully added'
return JsonResponse(data)
else:
data['su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_comment_to_post(request, pk):\n post = get_object_or_404(Post, pk=pk)\n if request.method == 'POST':\n form = CommentForm(request.POST)\n if form.is_valid():\n comment = form.save(commit=False)\n comment.post = post\n comment.save()\n return r... | [
"0.78893006",
"0.7775941",
"0.74676603",
"0.73683715",
"0.73549026",
"0.7261356",
"0.7188274",
"0.71627164",
"0.70982206",
"0.70022464",
"0.6964179",
"0.6948596",
"0.69456",
"0.6927394",
"0.67457163",
"0.6735499",
"0.6706368",
"0.6660312",
"0.66361904",
"0.659266",
"0.6552006... | 0.0 | -1 |
Declaration search space 'learning_rate' parameter | def _weight_boosting_learning_rate(name: str):
return hp.lognormal(name, np.log(0.01), np.log(10.0)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_learning_rate():\n return 0.00001",
"def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay is \"exponential\"):\n self.learning_rate = tf.train.exponential_decay(\n self.FLAGS.learning_rate,\n self.globa... | [
"0.78878564",
"0.68934196",
"0.6887224",
"0.6881099",
"0.6881099",
"0.68807626",
"0.6831222",
"0.6792651",
"0.6758702",
"0.6748529",
"0.6719029",
"0.66813684",
"0.6668818",
"0.6660004",
"0.66429275",
"0.66198725",
"0.66147786",
"0.66040796",
"0.66040796",
"0.6595177",
"0.6593... | 0.0 | -1 |
Get the day of the month (1, 2, 3, 4, 5, etc) | def day_of_month():
return datetime.date.today().day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_day_of_month(date):\n return date.day",
"def day_of_month(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"day_of_month\")",
"def day_of_month(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"day_of_month\")",
"def date_day(date):\n return date_day_of_month(date)",
... | [
"0.8311167",
"0.81161326",
"0.81161326",
"0.80362916",
"0.7710154",
"0.74247456",
"0.7126231",
"0.70446944",
"0.70041364",
"0.6935808",
"0.6885859",
"0.6820927",
"0.68159795",
"0.67683005",
"0.6750017",
"0.67277735",
"0.6714676",
"0.6682958",
"0.66780627",
"0.66780627",
"0.66... | 0.85066766 | 0 |
Returns the platform configuration details | def get_details(self):
return self.__config_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform_info(self):\n return self.msg.platform_info",
"def platform_info(self):\n return platform.uname()._asdict()",
"def get_platform():\n query = {\n \"type\": \"config\",\n \"action\": \"get\",\n \"xpath\": \"/config/devices/entry[@name='localhost.localdomain']/pl... | [
"0.79607385",
"0.7462969",
"0.739986",
"0.7112853",
"0.7013267",
"0.68938875",
"0.6773416",
"0.667299",
"0.65865666",
"0.6552953",
"0.6520043",
"0.6519496",
"0.6502041",
"0.65001327",
"0.6492422",
"0.64656544",
"0.6462208",
"0.645399",
"0.64523786",
"0.6449862",
"0.6424083",
... | 0.6537978 | 10 |
List of trio objects in this pedigree. | def trios(self):
return self._trios | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def samples(self):\n samples = set()\n for trio in self.trios:\n if trio.child is None or trio.mother is None or trio.father is None:\n continue\n samples.add(trio.father)\n samples.add(trio.mother)\n samples.add(trio.child)\n return l... | [
"0.6735502",
"0.6648545",
"0.6611865",
"0.6585326",
"0.6218765",
"0.61787325",
"0.6174128",
"0.6173725",
"0.6133093",
"0.6071013",
"0.60465074",
"0.6045711",
"0.60023105",
"0.59655607",
"0.59582776",
"0.59162223",
"0.59141374",
"0.58219033",
"0.5811836",
"0.57785505",
"0.5767... | 0.7676709 | 0 |
Searches and retrievs content items who use content items with invalid marketplaces. | def find_uses_paths_with_invalid_marketplaces(
self, pack_ids: List[str]
) -> List[BaseContent]:
with self.driver.session() as session:
results: Dict[str, Neo4jRelationshipResult] = session.execute_read(
validate_marketplaces, pack_ids
)
self._add_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_items_not_in_stock():\n try:\n return get_items_arent_on_stock(), 200\n except:\n return \"An error ocurred\", 404",
"def test_tags_content_search_invalid_tag(self):\n\n global NON_EXISTENT_TAG\n\n po = self.catalog.load_pageobject('TagsPage')\n\n self.browser.pro... | [
"0.58195615",
"0.5627373",
"0.55035573",
"0.5459549",
"0.54410607",
"0.54379165",
"0.5415119",
"0.53881055",
"0.5377376",
"0.5313664",
"0.5228413",
"0.5227499",
"0.5221384",
"0.5204558",
"0.5198988",
"0.51974964",
"0.5178793",
"0.5178141",
"0.51316184",
"0.51147646",
"0.51118... | 0.5012608 | 32 |
Decorator for `pytest` tests that mocks API requests by reading a file of pregenerated responses. Will generate responses file based on a real connection if pregenerated responses are not found. | def mock_api(
*, response_logs_dir: Optional[Union[str, Path]] = None, enforce_online_test=False
) -> Callable:
def wrap(test_function: Callable):
@wraps(test_function)
def wrapped(**kwargs):
response_log_path = _build_response_log_path(
test_func=test_function, res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_api():\n with open(os.path.join(HERE, 'response.json'), 'r') as fp:\n webargs_response = fp.read()\n # A valid package with a proper response\n responses.add(\n responses.GET,\n 'https://pypi.python.org/pypi/webargs/json',\n body=webargs_response,\n content_type... | [
"0.6632596",
"0.62995696",
"0.62875825",
"0.62727946",
"0.6137868",
"0.60731643",
"0.60573506",
"0.60062224",
"0.5961605",
"0.58436173",
"0.57388484",
"0.5680359",
"0.5671888",
"0.5644249",
"0.5599159",
"0.55649006",
"0.5552278",
"0.5529543",
"0.5524284",
"0.5520523",
"0.5498... | 0.5540769 | 17 |
Return rotation matrix. angle must be given in radians. axis should be of type vec3. | def rotation(self, angle, axis):
sqr_a = axis.x*axis.x
sqr_b = axis.y*axis.y
sqr_c = axis.z*axis.z
len2 = sqr_a+sqr_b+sqr_c
k2 = math.cos(angle)
k1 = (1.0-k2)/len2
k3 = math.sin(angle)/math.sqrt(len2)
k1ab = k1*axis.x*axis.y
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix( axis, angle ):\n\n # Trig factors.\n ca = cos(angle)\n sa = sin(angle)\n C = 1 - ca\n\n # Depack the axis.\n x, y, z = tuple( axis )\n\n # Multiplications (to remove duplicate calculations).\n xs = x*sa\n ys = y*sa\n zs = z*sa\n xC = x*C\n yC = y*C\n zC =... | [
"0.8426524",
"0.84087354",
"0.83624256",
"0.8335046",
"0.8282136",
"0.8043737",
"0.8040625",
"0.8022506",
"0.7993157",
"0.79801285",
"0.7879579",
"0.7819079",
"0.7764233",
"0.77037656",
"0.7693917",
"0.7659045",
"0.7602227",
"0.75998414",
"0.7553236",
"0.7531089",
"0.7527129"... | 0.8296097 | 4 |
Look from pos to target. The resulting transformation moves the origin to pos and rotates so that The zaxis points to target. The yaxis is as close as possible to the up vector. | def lookAt(self, pos, target, up=_vec3(0,0,1)):
dir = (target - pos).normalize()
up = up.normalize()
up -= (up * dir) * dir
try:
up = up.normalize()
except:
# We're looking along the up direction, so choose
# an arbitrary direction th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head_towards(self):\n dest = self.target_destination - self.location\n if dest.length() != 0:\n dest.scale_to_length(self.speed)\n dest.normalize()\n self.rect.left += dest.x\n self.rect.top += dest.y",
"def point_at(obj, target, roll=0):\n if not isinstan... | [
"0.63867235",
"0.6174689",
"0.6100806",
"0.60780716",
"0.60386586",
"0.6026328",
"0.6026328",
"0.5969622",
"0.5969622",
"0.5930626",
"0.5918353",
"0.582788",
"0.5806989",
"0.5760675",
"0.5746078",
"0.571055",
"0.5699697",
"0.5695556",
"0.55726534",
"0.55695117",
"0.5561427",
... | 0.7076027 | 0 |
Decomposes the matrix into a translation, rotation and scaling part. Returns a tuple (translation, rotation, scaling). The translation and scaling parts are given as vec3's, the rotation is still given as a mat4. | def decompose(self):
dummy = self.ortho()
dummy.setRow(3,_vec4(0.0, 0.0, 0.0, 1.0))
x = dummy.getColumn(0)
y = dummy.getColumn(1)
z = dummy.getColumn(2)
xl = x.length()
yl = y.length()
zl = z.length()
scale = _vec3(xl,yl,zl)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __compose_transformation(self):\n s = self.scale\n rotR = self.rotation\n t = self.translation\n T = np.eye(4)\n T[0:3, 3] = t\n R = np.eye(4)\n R[0:3, 0:3] = rotR\n M = T.dot(R)\n if s == 1:\n M = T.dot(R)\n else:\n S ... | [
"0.65959865",
"0.59985363",
"0.56775165",
"0.56729084",
"0.5643762",
"0.5516922",
"0.5491905",
"0.5479591",
"0.5413127",
"0.5405925",
"0.5361287",
"0.53541017",
"0.535323",
"0.53331834",
"0.53259045",
"0.5305544",
"0.5288668",
"0.52755517",
"0.5258584",
"0.523991",
"0.5236473... | 0.6354126 | 1 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=False):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
if self.is_bidir == True:
hidden = [
autograd.Variable(
torch.zeros(2 * self.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7421998",
"0.7421998",
"0.7421998",
"0.7411178",
"0.7411178",
"0.73938495",
"0.73049426",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.7253098",
"0.7253098",
... | 0.73020536 | 8 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=None):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
hidden = [
autograd.Variable(
torch.zeros(self.n_layers, batch_size, self.hidden_dim),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7421998",
"0.7421998",
"0.7421998",
"0.7411178",
"0.7411178",
"0.73938495",
"0.73049426",
"0.73020536",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.72000086"... | 0.7253098 | 21 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=False):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
hidden = [
autograd.Variable(
torch.zeros(2 * self.n_layers, batch_size, self.hidden_dim),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7421998",
"0.7421998",
"0.7421998",
"0.73938495",
"0.73049426",
"0.73020536",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.7253098",
"0.7253098",
"0.72000086"... | 0.7411178 | 4 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=False):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
hidden = [
autograd.Variable(
torch.zeros(self.n_layers, batch_size, self.hidden_dim),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7411178",
"0.7411178",
"0.73938495",
"0.73049426",
"0.73020536",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.7253098",
"0.7253098",
"0.72000086",
"0.6970245"... | 0.7421998 | 3 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=False):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
hidden = [
autograd.Variable(
torch.zeros(self.n_layers, batch_size, self.hidden_dim),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7411178",
"0.7411178",
"0.73938495",
"0.73049426",
"0.73020536",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.7253098",
"0.7253098",
"0.72000086",
"0.6970245"... | 0.7421998 | 2 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=None):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
hidden = [
autograd.Variable(
torch.zeros(self.n_layers, batch_size, self.hidden_dim),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7421998",
"0.7421998",
"0.7421998",
"0.7411178",
"0.7411178",
"0.73938495",
"0.73049426",
"0.73020536",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.72000086"... | 0.7253098 | 20 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=False):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
hidden = [
autograd.Variable(
torch.zeros(2 * self.n_layers, batch_size, self.hidden_dim),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7421998",
"0.7421998",
"0.7421998",
"0.73938495",
"0.73049426",
"0.73020536",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.7253098",
"0.7253098",
"0.72000086"... | 0.7411178 | 5 |
Initializes the hidden and memory cell with given batch size. | def init_hidden(self, batch_size, use_cuda=False):
# The axes semantics are (num_layers, minibatch_size, hidden_dim)
# The tuple reprensents hidden cell and memory cell.
hidden = [
autograd.Variable(
torch.zeros(self.n_layers, batch_size, self.hidden_dim),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.76831126",
"0.7411178",
"0.7411178",
"0.73938495",
"0.73049426",
"0.73020536",
"0.7278598",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7277387",
"0.7267112",
"0.7267112",
"0.7253098",
"0.7253098",
"0.72000086",
"0.6970245"... | 0.7421998 | 1 |
Get the height of the board. | def get_grid_height(self):
return self._grid_height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(self):\n return self.board.shape[0]",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self._height",
"def get_grid_height(self):\n return self._height",
"def get_grid_height(self):\n ... | [
"0.85061747",
"0.78280723",
"0.78280723",
"0.7791742",
"0.7788428",
"0.7788428",
"0.7768036",
"0.7768036",
"0.7768036",
"0.7768036",
"0.77661127",
"0.77627283",
"0.7760338",
"0.77541906",
"0.77423555",
"0.77375555",
"0.772147",
"0.76969934",
"0.76941025",
"0.76941025",
"0.769... | 0.76272714 | 29 |
This function calculates the confidence interval for a population proportion. | def ci_prop(p, n, conf_level=95):
# calculate significance level
alpha = np.round((1 - conf_level / 100), 2)
# standard error
std_error = np.sqrt(p * (1 - p) / n)
# find the z critical value
z_star = np.round(stats.norm.ppf(1 - alpha / 2), 3)
# margin of error
margin_of_error = np.round(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_confidence_interval(data):\n a = 1.0 * np.array(data)\n m = np.mean(a)\n std = np.std(a)\n pm = 1.96 * (std / np.sqrt(len(a)))\n return m, pm",
"def confidenceInterval(start,end,confidence):\n\n\tmean = 0.5*(end+start)\n\tstddev = getStdDev(0.5*(end-start), confidence)\n\n\treturn (mea... | [
"0.6508893",
"0.639346",
"0.638804",
"0.6352521",
"0.63073725",
"0.62562823",
"0.62539876",
"0.6225825",
"0.6165775",
"0.6103992",
"0.6073545",
"0.60363185",
"0.60099113",
"0.59602016",
"0.5904212",
"0.5887613",
"0.5869475",
"0.5854851",
"0.5843365",
"0.58110493",
"0.5808328"... | 0.6790471 | 0 |
Given a list of words, return list with duplicates removed. | def without_duplicates(words):
# initialize empty list where non duplicate words will be stored
non_duplicate_words = []
# iterate over list
for item in words:
# if an item in list is not already in list containing duplicate words..
if item != non_duplicate_words:
# append i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_duplicates(words):\n\n # the long way: add each item to a set through iteration\n #\n # duplicate_remover = set([])\n # for word in words:\n # duplicate_remover.add(word)\n # words = list(duplicate_remover)\n # return words\n\n # the quick version: convert to set removes dup... | [
"0.8782853",
"0.80357206",
"0.79982984",
"0.7957965",
"0.78726363",
"0.7813481",
"0.73638797",
"0.7334073",
"0.730446",
"0.7295227",
"0.7275074",
"0.7244554",
"0.7232783",
"0.71240723",
"0.7089221",
"0.7059419",
"0.7034976",
"0.70081365",
"0.7008079",
"0.69790393",
"0.6970064... | 0.8540177 | 1 |
Displays the median absolute error regression loss | def median_absolute_error(self):
print('Median absolute error regression loss: ' + str(median_absolute_error(self.model.dataset.get_y_test(),
self.model.get_predicted()))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median_absolute_error(y_true, y_pred, *, multioutput=..., sample_weight=...):\n ...",
"def stderr(predicted, actual):\n return np.sqrt(mse(predicted, actual))",
"def mean_absolute_error(self):\n print('Mean absolute error regression loss: ' + str(mean_absolute_error(self.model.dataset.get_y_te... | [
"0.70553166",
"0.64234465",
"0.6116956",
"0.6105252",
"0.6023425",
"0.60127705",
"0.59997356",
"0.59459203",
"0.59157705",
"0.59152037",
"0.5889653",
"0.58809096",
"0.58801013",
"0.58737195",
"0.5849917",
"0.5830612",
"0.5815691",
"0.5808731",
"0.5789277",
"0.5766636",
"0.571... | 0.81183386 | 0 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.6495618",
"0.6495618",
"0.6419755",
"0.63149667",
"0.6172381",
"0.6090327",
"0.6071634",
"0.6058726",
"0.59551233",
"0.59468347",
"0.59461504",
"0.59049726",
"0.5894608",
"0.58911955",
"0.5866699",
"0.5860648",
"0.58598876",
"0.5842271",
"0.58422166",
"0.58278775",
"0.5824... | 0.0 | -1 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.6495242",
"0.6495242",
"0.6416757",
"0.6314452",
"0.61695516",
"0.60905975",
"0.6070337",
"0.6058013",
"0.5952843",
"0.5946237",
"0.59452075",
"0.590337",
"0.58930206",
"0.58909506",
"0.58661455",
"0.58597255",
"0.5858653",
"0.58414435",
"0.58401704",
"0.5826763",
"0.58241... | 0.0 | -1 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.649152",
"0.649152",
"0.641769",
"0.63146424",
"0.61703354",
"0.609192",
"0.60708994",
"0.605838",
"0.5953424",
"0.59473985",
"0.5946169",
"0.5903995",
"0.5892615",
"0.5891698",
"0.58670944",
"0.5859888",
"0.5858642",
"0.5841311",
"0.5840207",
"0.5826886",
"0.582447",
"0... | 0.0 | -1 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.64949155",
"0.64949155",
"0.64175296",
"0.63147044",
"0.61690754",
"0.60915905",
"0.6071463",
"0.6057262",
"0.59535927",
"0.5946549",
"0.5945722",
"0.590366",
"0.58936554",
"0.58903956",
"0.5865374",
"0.58594966",
"0.5859206",
"0.5841075",
"0.5839968",
"0.5828068",
"0.5824... | 0.0 | -1 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.6495618",
"0.6495618",
"0.6419755",
"0.63149667",
"0.6172381",
"0.6090327",
"0.6071634",
"0.6058726",
"0.59551233",
"0.59468347",
"0.59461504",
"0.59049726",
"0.5894608",
"0.58911955",
"0.5866699",
"0.5860648",
"0.58598876",
"0.5842271",
"0.58422166",
"0.58278775",
"0.5824... | 0.0 | -1 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.6495242",
"0.6495242",
"0.6416757",
"0.6314452",
"0.61695516",
"0.60905975",
"0.6070337",
"0.6058013",
"0.5952843",
"0.5946237",
"0.59452075",
"0.590337",
"0.58930206",
"0.58909506",
"0.58661455",
"0.58597255",
"0.5858653",
"0.58414435",
"0.58401704",
"0.5826763",
"0.58241... | 0.0 | -1 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.649152",
"0.649152",
"0.641769",
"0.63146424",
"0.61703354",
"0.609192",
"0.60708994",
"0.605838",
"0.5953424",
"0.59473985",
"0.5946169",
"0.5903995",
"0.5892615",
"0.5891698",
"0.58670944",
"0.5859888",
"0.5858642",
"0.5841311",
"0.5840207",
"0.5826886",
"0.582447",
"0... | 0.0 | -1 |
Initializes the hidden state of the PitchContourAssessor module | def init_hidden(self, mini_batch_size):
self.hidden = Variable(torch.zeros(1, mini_batch_size, 200))
if torch.cuda.is_available():
self.hidden = self.hidden.cuda() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n pass",
"def init_hidden(self):\n pass",
"def __init__(self):\n\n self.points = None\n self.centroid_activation_frames = None\n self.noiseless_frames = None\n self.frames = None",
"def __init__(self):\n DetectLandmarks.__init__(self)\n ... | [
"0.64949155",
"0.64949155",
"0.64175296",
"0.63147044",
"0.61690754",
"0.60915905",
"0.6071463",
"0.6057262",
"0.59535927",
"0.5946549",
"0.5945722",
"0.590366",
"0.58936554",
"0.58903956",
"0.5865374",
"0.58594966",
"0.5859206",
"0.5841075",
"0.5839968",
"0.5828068",
"0.5824... | 0.0 | -1 |
Compute gradient of ReLU(x) | def d_relu(x):
return (x > 0) * 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grad_ReLU(self):\n y = self.x\n y[y<=0] = 0\n y[y>0] = 1\n return y\n raise NotImplementedError(\"ReLU gradient not implemented\")",
"def grad_ReLU(self):\n grad = np.where(self.x > 0, 1, 0)\n return grad",
"def relu_grad(self, X):\n X[X<=0]=0\n X[X>0]... | [
"0.8642592",
"0.8077327",
"0.7787572",
"0.7530858",
"0.7388087",
"0.73507303",
"0.7288786",
"0.7237895",
"0.7170173",
"0.70995605",
"0.70803183",
"0.70425916",
"0.7039082",
"0.70243317",
"0.7020456",
"0.6999789",
"0.69889843",
"0.6954855",
"0.68900347",
"0.6884166",
"0.687505... | 0.6759293 | 26 |
Convert multiple arrays containing sequences of token IDs to their sentences, optionally cutting them off at the endofsequence token. | def arrays_to_sentences(self, arrays: np.array, cut_at_eos=True) \
-> List[List[str]]:
sentences = []
for array in arrays:
sentences.append(
self.array_to_sentence(array=array, cut_at_eos=cut_at_eos))
return sentences | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_to_sentence(self, array: np.array, cut_at_eos=True) -> List[str]:\n sentence = []\n for i in array:\n s = self.itos[i]\n if cut_at_eos and s == EOS_TOKEN:\n break\n sentence.append(s)\n return sentence",
"def _ticks_to_sentences(ticks... | [
"0.673198",
"0.6581544",
"0.6515886",
"0.64929503",
"0.64929503",
"0.6448785",
"0.6409684",
"0.6307942",
"0.62738013",
"0.62008506",
"0.6192786",
"0.61842006",
"0.6183306",
"0.61517054",
"0.6142672",
"0.6117138",
"0.61081755",
"0.6088635",
"0.6079087",
"0.6078653",
"0.6069158... | 0.72692674 | 0 |
Return a Teacher object. | def __init__(self, folder="", images=[], labels=[], traces=[]):
self.folder = folder
self.images = []
self.explode_images = []
self.labels = []
self.explode_lbls = []
self.explode_labels = []
self.traces = []
self.explode_traces = []
self.explode_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teacher(self):\n if \"teacher\" in self._prop_dict:\n if isinstance(self._prop_dict[\"teacher\"], OneDriveObjectBase):\n return self._prop_dict[\"teacher\"]\n else :\n self._prop_dict[\"teacher\"] = EducationTeacher(self._prop_dict[\"teacher\"])\n ... | [
"0.75521684",
"0.6869073",
"0.6690313",
"0.6679629",
"0.64127475",
"0.6385466",
"0.5983519",
"0.5888586",
"0.5879739",
"0.58598655",
"0.5826567",
"0.5700139",
"0.5557518",
"0.55562115",
"0.55266756",
"0.5415086",
"0.53702646",
"0.53425205",
"0.5302528",
"0.5262525",
"0.525699... | 0.0 | -1 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038751",
"0.7924752",
"0.7923082",
"0.78850657",
"0.78771824",
"0.7815519",
"0.77652335",
"0.775546",
"0.77440816",
"0.77313656",
"0.77284646",
"0.77244157",
"0.770246",
"0.76888484",
"0.76888484",
"0.766384",
"0.7656689",
"0.7655605",
"0.7655605",
"0.76455575",
"0.764555... | 0.7448663 | 74 |
Return the queryset of pages to be filtered by this page. By default this includes only live pages and pages that live in the same Wagtail Site as this page. If this page cannot be mapped to a Wagtail site (for example, if it does not live under a site root), then it will not return any filterable results. The filter_c... | def get_filterable_queryset(self):
site = self.get_site()
if not site:
return self.get_model_class().objects.none()
queryset = self.get_model_class().objects.in_site(site).live()
filterable_list_block = self.get_filterable_list_wagtail_block()
if filterable_list_bl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n request = self.request\n # Allow pages to be filtered to a specific type\n page_type = request.GET.get('type', 'wagtailcore.Page')\n try:\n models = page_models_from_string(page_type)\n except (LookupError, ValueError):\n raise BadR... | [
"0.6996249",
"0.68621105",
"0.6222618",
"0.615874",
"0.612804",
"0.5968924",
"0.57828724",
"0.5772105",
"0.5768434",
"0.5738781",
"0.56695443",
"0.5567301",
"0.5491212",
"0.5459988",
"0.54599816",
"0.545539",
"0.54398525",
"0.5426571",
"0.5425202",
"0.53988904",
"0.53756344",... | 0.7274537 | 0 |
Returns the middle item in the number list (by position not value) picks lower middle index if number is even | def get_middle():
num_list = session_attributes[NUMBER_LIST_KEY]
return num_list[round(len(num_list) / 2) - 1] # Subtract 1 since arrays start at 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findMiddle(inList):\n middle = float(len(inList))/2\n if middle % 2 != 0:\n return int(middle - .5), inList[int(middle - .5)]\n else:\n return (int(middle), int(middle-1)), (inList[int(middle)], inList[int(middle-1)])",
"def mid(arr):\n\n \n arr_ln = len(arr)\n mid = arr_ln//2... | [
"0.762548",
"0.68348694",
"0.6707999",
"0.6486468",
"0.64032376",
"0.6217714",
"0.6140569",
"0.6090736",
"0.60830855",
"0.60313183",
"0.5982748",
"0.5931421",
"0.59305763",
"0.5910867",
"0.5903021",
"0.58987117",
"0.58973026",
"0.58823586",
"0.5881148",
"0.5853946",
"0.584717... | 0.76432437 | 0 |
Called when the user specifies an intent for this skill | def handle_intent(intent_name):
if intent_name in name_to_handler:
return name_to_handler[intent_name]()
else:
return question_answer(intent_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ... | [
"0.7143966",
"0.6956116",
"0.6949057",
"0.6905333",
"0.68928874",
"0.67641324",
"0.6754843",
"0.6722764",
"0.6720773",
"0.67161995",
"0.6699252",
"0.6691263",
"0.6670276",
"0.6645522",
"0.6642719",
"0.6638686",
"0.6607724",
"0.6594981",
"0.6575682",
"0.6570076",
"0.65620786",... | 0.59254783 | 51 |
return the max contour | def max_contour(contours):
if len(contours) == 0:
return []
else:
max_cnt = []
max_area = 0
for cnt in contours:
area = cv2.contourArea(cnt)
# print(area)
if area > 1000 and area > max_area:
max_area = area
max_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_biggest_contour(self):\n blurred = blur(self.data)\n bin_img = threshold(blurred, self.calcthresh(blurred))\n self.contour_exists, self.largest_cont = find_largest_contour(\n bin_img, self.data\n )",
"def find_max_contour(contours):\n if len(contours)==0:\n ... | [
"0.7914346",
"0.76383597",
"0.7450908",
"0.6993265",
"0.687721",
"0.6876506",
"0.6871764",
"0.66788846",
"0.665887",
"0.66540575",
"0.6652381",
"0.6639206",
"0.6624959",
"0.6543409",
"0.6501659",
"0.6479817",
"0.6478554",
"0.643942",
"0.6437575",
"0.64138454",
"0.63462716",
... | 0.74014544 | 3 |
MAC for switch client is connected to. | def sw_mac(self):
return self.raw.get('sw_mac') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac(self):\n return self.device.settings[\"device\"][\"mac\"]",
"def mac(self):\n return self.device.settings[\"device\"][\"mac\"]",
"def _get_mac(self):\n return self.__mac",
"def mac(self):\n mac = hexlify(WLAN().config('mac'), ':').decode()\n return mac.upper() # MAC-ad... | [
"0.7334382",
"0.7334382",
"0.7249836",
"0.7209311",
"0.7138228",
"0.71181077",
"0.69120127",
"0.6876553",
"0.68556935",
"0.68478584",
"0.68476963",
"0.6837324",
"0.67783827",
"0.67411906",
"0.67411906",
"0.6737539",
"0.67243445",
"0.67106557",
"0.66927296",
"0.66773087",
"0.6... | 0.6656926 | 21 |
Convert the gray image into a binary image with strong borders | def smooth_borders (gray , blur = 1 ) :
assert gray is not None
gray_borders = cv2.GaussianBlur(gray, (blur, blur), 0)
gray_borders = cv2.adaptiveThreshold(gray_borders, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 1)
# Some morphology to clean up image
kernel = np.ones((3,3), np.uint8)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_binary_image(grayscale_image):\n _, thresholded_image = cv2.threshold(grayscale_image, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)\n return thresholded_image",
"def image_binary(image_convert):\n image_bit=cv2.bitwise_not(image_convert)\n _, image_bina = cv2.threshold(image_bit, 125, 255, cv... | [
"0.750121",
"0.74794066",
"0.7308855",
"0.72124976",
"0.70580614",
"0.6957116",
"0.69106567",
"0.6906782",
"0.6841234",
"0.6726067",
"0.67149913",
"0.6684782",
"0.66712165",
"0.6663356",
"0.66417146",
"0.66363895",
"0.6624576",
"0.66027623",
"0.65310574",
"0.649718",
"0.64935... | 0.0 | -1 |
Ban user(temporarily or permanently) (banUsers) Ban user. | def ban_users(
body: Optional[UserBanRequest] = None,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request = BanUsers.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban(sock, user):\r\n chat(sock, \"/ban {}\".format(user))",
"async def ban(self, ctx, user: discord.Member, reason=\"Banned from guild by Talos\"):\n await user.ban(reason=reason)\n await self.bot.mod_log(ctx, \"ban\", user, reason)\n await ctx.send(f\"User {user} banned\")",
"def b... | [
"0.75992966",
"0.74105436",
"0.7396796",
"0.7266355",
"0.72023296",
"0.7168943",
"0.7119248",
"0.70580816",
"0.6892768",
"0.6846767",
"0.6842593",
"0.6823585",
"0.6822236",
"0.6801437",
"0.6789716",
"0.6784125",
"0.67358273",
"0.67217225",
"0.6616057",
"0.65626603",
"0.653238... | 0.67676955 | 16 |
Ban user(temporarily or permanently) (banUsers) Ban user. | async def ban_users_async(
body: Optional[UserBanRequest] = None,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban(sock, user):\r\n chat(sock, \"/ban {}\".format(user))",
"async def ban(self, ctx, user: discord.Member, reason=\"Banned from guild by Talos\"):\n await user.ban(reason=reason)\n await self.bot.mod_log(ctx, \"ban\", user, reason)\n await ctx.send(f\"User {user} banned\")",
"def b... | [
"0.7599607",
"0.74108607",
"0.73967344",
"0.72669256",
"0.72028416",
"0.71696013",
"0.71195334",
"0.70584726",
"0.6893309",
"0.6846221",
"0.68423283",
"0.6824143",
"0.68230546",
"0.68020815",
"0.67904055",
"0.6784512",
"0.6767531",
"0.6722689",
"0.6617149",
"0.6563216",
"0.65... | 0.6735395 | 17 |
Get configured actions (getActions) Get configured actions. | def get_actions(
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request = GetActions.create(
namespace=namespace,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions(self):\n return self.agent.get_actions()",
"def get_list_of_actions(self):\n return self.actions",
"def get_available_actions(self):\n return self.actions",
"def getActions(self):\n actions = self.actions[:]\n return actions",
"def actions(self):\n ... | [
"0.7586385",
"0.7483631",
"0.7408846",
"0.7385172",
"0.7357751",
"0.7294271",
"0.7215498",
"0.7206148",
"0.7206148",
"0.7206148",
"0.7199116",
"0.71847093",
"0.71735805",
"0.71735805",
"0.71146554",
"0.7076717",
"0.70647585",
"0.69222045",
"0.6913177",
"0.6840468",
"0.676129"... | 0.61483526 | 44 |
Get configured actions (getActions) Get configured actions. | async def get_actions_async(
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request = GetActions.create(
namespace=n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions(self):\n return self.agent.get_actions()",
"def get_list_of_actions(self):\n return self.actions",
"def get_available_actions(self):\n return self.actions",
"def getActions(self):\n actions = self.actions[:]\n return actions",
"def actions(self):\n ... | [
"0.758708",
"0.7483841",
"0.7408467",
"0.7385818",
"0.7357609",
"0.7293888",
"0.7215924",
"0.7205235",
"0.7205235",
"0.7205235",
"0.7199648",
"0.7184394",
"0.7173799",
"0.7173799",
"0.71155155",
"0.70763856",
"0.7063845",
"0.692191",
"0.69132286",
"0.68394077",
"0.67623335",
... | 0.0 | -1 |
Get user status (getUserStatus) Get user status. | def get_user_status(
user_id: str,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request = GetUserStatus.create(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_status(cls):\n return jsonify(status=cls._user_status())",
"def get_status(self, user_name):\n uri = self.base_uri + '/status'\n response = requests.get(uri)\n if response.status_code == 404:\n return None\n return response.json()",
"def getUserStatus(User... | [
"0.7524825",
"0.7263556",
"0.7105153",
"0.6696677",
"0.66392136",
"0.6631111",
"0.6631111",
"0.6631111",
"0.6592678",
"0.65907216",
"0.6560918",
"0.6544045",
"0.65141886",
"0.64635885",
"0.642155",
"0.63860106",
"0.6349994",
"0.6309848",
"0.6300332",
"0.62869126",
"0.62663734... | 0.6821228 | 3 |
Get user status (getUserStatus) Get user status. | async def get_user_status_async(
user_id: str,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request = GetUserStatus.cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_status(cls):\n return jsonify(status=cls._user_status())",
"def get_status(self, user_name):\n uri = self.base_uri + '/status'\n response = requests.get(uri)\n if response.status_code == 404:\n return None\n return response.json()",
"def getUserStatus(User... | [
"0.7523592",
"0.72634816",
"0.71049386",
"0.68216056",
"0.66957957",
"0.66370094",
"0.6630089",
"0.6630089",
"0.6630089",
"0.65911",
"0.6589884",
"0.65601075",
"0.6543499",
"0.65128976",
"0.64211106",
"0.6386346",
"0.6348905",
"0.6307903",
"0.6299674",
"0.628631",
"0.6265528"... | 0.64646393 | 14 |
Autoencoder transformer. Note that because sigmoid activation used at the final layer of the decoder the data must be in (0, 1) range for "binary_crossentropy" loss to get positive values. | def __init__(self, code_dim=30, dims=None, loss=None, fit_params=None):
super(AETransform, self).__init__()
self.code_dim = code_dim
self.dims = dims
if loss is None:
loss = 'mean_absolute_error'
self.loss = loss
self.fit_params = fit_params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_encoder(data: np.ndarray) -> np.ndarray:\n input_img = Input(shape=(784,))\n encoded = Dense(128, activation='relu')(input_img)\n encoded = Dense(64, activation='relu')(encoded)\n encoded = Dense(32, activation='relu')(encoded)\n\n decoded = Dense(64, activation='relu')(encoded)\n decode... | [
"0.7081701",
"0.7064469",
"0.6839215",
"0.66432196",
"0.6342909",
"0.63256764",
"0.6319528",
"0.6300737",
"0.6239154",
"0.6192529",
"0.618424",
"0.6128118",
"0.61113214",
"0.61069864",
"0.6093878",
"0.60930073",
"0.6068266",
"0.60606444",
"0.5981551",
"0.5980654",
"0.5948494"... | 0.0 | -1 |
Allow items to be randomly assigned to a specific door | def door_assignment():
doors = ['door-money.png', 'door-goat.png', 'door-trash.png']
GameScreen.door1_reveal = random.choice(doors)
doors.remove(GameScreen.door1_reveal)
GameScreen.door2_reveal = random.choice(doors)
doors.remove(GameScreen.door2_reveal)
GameScreen.door3... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_item_random(self, x, y):\n r = int(random() * 10)\n if 3 < r and r <= 6:\n self.put_fireitem(x, y)\n elif 6 < r and r <= 9:\n self.put_bombitem(x, y)",
"def randomly_spawn_mothership(self) -> None:\n return",
"def make_selection(self, num):\n oth... | [
"0.6729286",
"0.6421847",
"0.63770074",
"0.6332747",
"0.6300454",
"0.6246168",
"0.6197324",
"0.61616385",
"0.614601",
"0.61001724",
"0.60988545",
"0.607681",
"0.60475236",
"0.60334176",
"0.5995888",
"0.59947056",
"0.59499204",
"0.5910717",
"0.5909556",
"0.5908517",
"0.5888024... | 0.7309903 | 0 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# User input for cities (Chicago, New York City, Washington), using while loop to ensure valid city input, normalized with lower()
while True:
city = input("\nFor which city would you like to see data: Chicago, New York City, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
# load file into dataframe
df = pd.read_csv(CITY_DATA[city])
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
# month and day of week from Start Time, creating new columns. Return month name, not integer.
df['month... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81319666",
"0.81089365",
"0.8045794",
"0.80421233",
"0.8009013",
"0.8006819",
"0.79993606",
"0.799815",
"0.7988398",
"0.7978816",
"0.7973185",
"0.79605204",
"0.79559934",
"0.7946578",
"0.79459554",
"0.79077595",
"0.79076785",
"0.7903725",
"0.79003966",
"0.7892789",
"0.7888... | 0.76328045 | 76 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# display the most common month
frequent_month = df['month'].mode()[0]
print("The most common month for travel is ", frequent_month)
# display the most common day of week
frequent_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583438",
"0.7579... | 0.7625196 | 16 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# display most commonly used start station. idxmax returns the value in the row for the highest count
frequent_start = df['Start Station'].value_counts().idxmax()
print("The most commonly... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.70266914 | 72 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# display total travel time
travel_time = sum(df['Trip Duration'])
# divide time in seconds by seconds in a day to get days
print("The total travel time is ", travel_time/86400 , "days.")
# dis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7720885 | 62 |
Cleans document of stopwords and punctuation. Stopwords are specified at initialization of Processing. Lemmatizes for all languages except Chinese. | def cleaning(self, document):
remove_punct = ''.join(i for i in document.lower() if i not in self.punctuation)
tokenized = [i for i in remove_punct.split() if i not in self.stopwords]
if self.lang is not 'chinese':
# Lemmatizes if not chinese
tokenized = [self.lemmatize.l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_text(text):\n\n lemmizer = WordNetLemmatizer()\n stemmer = porter.PorterStemmer()\n\n stop = stopwords.words('english')\n stop += ['.', ',', ':', '...', '!\"', '?\"', \"'\", '\"', ' - ', ' — ', ',\"', '.\"', '!', ';', '♫♫', '♫', \\\n '.\\'\"', '[', ']', '—', \".\\'\", 'ok', 'okay'... | [
"0.7625325",
"0.7195707",
"0.70659137",
"0.70421284",
"0.70037323",
"0.6901292",
"0.68763566",
"0.68709326",
"0.68199193",
"0.6802392",
"0.6761715",
"0.6740753",
"0.673547",
"0.6725475",
"0.6722779",
"0.67183214",
"0.6692628",
"0.66864705",
"0.66829616",
"0.6656232",
"0.66502... | 0.7825676 | 0 |
Return all tokens retrieved from raw sql text. | def get_tokens(self, sql_text):
parsed = sqlparse.parse(sql_text)[0]
return parsed.tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tokens(self, text):\n\t\treturn tuple(self._compiled_pattern.findall(text))",
"def tokenize(raw_text):\n def _xop(tokens):\n def _(x):\n return xop(x, \"op\", tokens)\n return _\n \n raw_tokens=xversa_split(raw_text, tokens=Op_Tokens+Group_Tokens)\n tokens=map(xto... | [
"0.68761116",
"0.63889736",
"0.63438416",
"0.63347995",
"0.6324797",
"0.63004404",
"0.62028176",
"0.6189613",
"0.6175202",
"0.6122846",
"0.60931",
"0.60501766",
"0.6048735",
"0.60041136",
"0.59980965",
"0.59953356",
"0.5974618",
"0.59277856",
"0.59134954",
"0.58998233",
"0.58... | 0.86128026 | 0 |
The ID of the endpoint that the rule is associated with. | def resolver_endpoint_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resolver_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id... | [
"0.785335",
"0.785335",
"0.785335",
"0.7806635",
"0.7806635",
"0.7806635",
"0.7806635",
"0.7682396",
"0.7682396",
"0.76541483",
"0.7096072",
"0.7007405",
"0.70042694",
"0.6772167",
"0.672375",
"0.66834414",
"0.6635891",
"0.6635891",
"0.6635891",
"0.6635891",
"0.647098",
"0.... | 0.6888925 | 13 |
Get an existing ResolverRule resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'ResolverRule':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = ResolverRuleArgs.__new__(ResolverRuleArgs)
__props__.__dict__["arn"]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n direction: Optional[pulumi.Input[str]] = None,\n dry_run: Optional[pulumi.Input[bool]] = None,\n listener_id: Optional[pulumi.Input[str]] = None,\n ... | [
"0.6719511",
"0.6532681",
"0.6080831",
"0.6042104",
"0.5868561",
"0.57383907",
"0.5715684",
"0.5545571",
"0.5542033",
"0.552981",
"0.54866755",
"0.5480718",
"0.5468526",
"0.5452355",
"0.536813",
"0.53439337",
"0.5298328",
"0.5257922",
"0.52240974",
"0.52226216",
"0.5218783",
... | 0.74160874 | 0 |
The Amazon Resource Name (ARN) of the resolver rule. | def arn(self) -> pulumi.Output[str]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_rule_arn(self) -> str:\n return pulumi.get(self, \"config_rule_arn\")",
"def config_rule_arn(self) -> str:\n return pulumi.get(self, \"config_rule_arn\")",
"def rule_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"rule_name\")",
"def rule_name(self) -> str:\n ... | [
"0.77187914",
"0.77187914",
"0.72137314",
"0.7097859",
"0.7097859",
"0.70503056",
"0.70503056",
"0.70503056",
"0.70503056",
"0.70503056",
"0.7023936",
"0.7023936",
"0.6795353",
"0.6795353",
"0.6795353",
"0.6770597",
"0.675322",
"0.6746797",
"0.6746797",
"0.6746797",
"0.674679... | 0.71664274 | 21 |
The ID of the endpoint that the rule is associated with. | def resolver_endpoint_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "resolver_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id... | [
"0.785335",
"0.785335",
"0.785335",
"0.7806635",
"0.7806635",
"0.7806635",
"0.7806635",
"0.7682396",
"0.7682396",
"0.76541483",
"0.7096072",
"0.7007405",
"0.6888925",
"0.6772167",
"0.672375",
"0.66834414",
"0.6635891",
"0.6635891",
"0.6635891",
"0.6635891",
"0.647098",
"0.6... | 0.70042694 | 12 |
The ID of the endpoint that the rule is associated with. | def resolver_rule_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "resolver_rule_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id... | [
"0.785335",
"0.785335",
"0.785335",
"0.7806635",
"0.7806635",
"0.7806635",
"0.7806635",
"0.7682396",
"0.7682396",
"0.76541483",
"0.7096072",
"0.7007405",
"0.70042694",
"0.6888925",
"0.6772167",
"0.672375",
"0.66834414",
"0.6635891",
"0.6635891",
"0.6635891",
"0.6635891",
"0... | 0.64390117 | 23 |
Return a hashable object that represents the identity of the item. By default this returns the position of the item in the tree. You may want to override this to return the item label (if you know that labels are unique and don't change), or return something that represents the underlying domain object, e.g. a database... | def GetItemIdentity(self, item):
return self.GetIndexOfItem(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, item: int) -> int:\n return self.root[item].key",
"def get_key(self, item):\r\n return item[0]",
"def item_to_index(self, item_id):\n if item_id in self.item_dict:\n return self.item_dict[item_id]\n else:\n return -1",
"def get_item_inde... | [
"0.6718204",
"0.6554382",
"0.65462506",
"0.6530754",
"0.6441343",
"0.6328451",
"0.62762874",
"0.62707657",
"0.6197091",
"0.6179496",
"0.6170615",
"0.61524206",
"0.6140397",
"0.61041915",
"0.61041915",
"0.61041915",
"0.6083991",
"0.6075769",
"0.6046458",
"0.60321414",
"0.60292... | 0.72654194 | 0 |
Returns the checked/unchecked state of a tree item. | def GetCheckedStateOfItem(self, item):
listOfCheckedItems = []
if self._window.IsItemChecked(item):
listOfCheckedItems.append(self.GetItemIdentity(item))
listOfCheckedItems.extend(self.GetCheckedStateOfChildren(item))
return listOfCheckedIte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCheckedState(self):\n \n root = self._window.GetRootItem()\n if not root:\n return []\n if self._window.HasFlag(wx.TR_HIDE_ROOT):\n return self.GetCheckedStateOfChildren(root)\n else:\n return self.GetCheckedStateOfItem(root)",
"def get_c... | [
"0.69177413",
"0.6791844",
"0.678748",
"0.6771581",
"0.6743726",
"0.6448472",
"0.61242646",
"0.61118394",
"0.5986325",
"0.5969601",
"0.58343244",
"0.58270293",
"0.58140105",
"0.57682854",
"0.5758146",
"0.5758146",
"0.5758146",
"0.57553107",
"0.573678",
"0.5687317",
"0.5669797... | 0.7260089 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.