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 |
|---|---|---|---|---|---|---|
Create fresh default params for each test. | def setUp(self):
self._hash_bins = 10
self._embedding_dim = 2
self._default_config = {
"hash_bins": self._hash_bins,
"embedding_dim": self._embedding_dim
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n self.source_params[key] = value",
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n ... | [
"0.7084804",
"0.7084804",
"0.6948217",
"0.69428045",
"0.6912112",
"0.6837694",
"0.6760249",
"0.6721745",
"0.67165357",
"0.6589998",
"0.6585546",
"0.65653926",
"0.65105915",
"0.64741606",
"0.6468277",
"0.6466075",
"0.6455949",
"0.6452453",
"0.64466023",
"0.64295346",
"0.640045... | 0.0 | -1 |
Create fresh default params for each test. | def setUp(self):
self._hash_bins = 10
self._hash_embedding_dim = 4
self._embedding_dim = 2
self._default_config = {
"hash_bins": self._hash_bins,
"hash_embedding_dim": self._hash_embedding_dim,
"embedding_dim": self._embedding_dim
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n self.source_params[key] = value",
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n ... | [
"0.70830435",
"0.70830435",
"0.6947099",
"0.69417375",
"0.69112927",
"0.683767",
"0.6759182",
"0.67209136",
"0.6715178",
"0.6588773",
"0.65840137",
"0.6564113",
"0.65097696",
"0.64730877",
"0.64657325",
"0.6465535",
"0.64550704",
"0.6451787",
"0.64458114",
"0.6427905",
"0.640... | 0.59104574 | 82 |
Create fresh default params for each test. | def setUp(self):
self._default_call_inputs = (
np.array([[1,2,3], [4,5,6]]),
None
)
self._hash_bins = 10
self._hash_embedding_dim = 4
self._embedding_dim = 2
self._masking = False
self._default_config = {
"hash_bins": self._ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n self.source_params[key] = value",
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n ... | [
"0.7084804",
"0.7084804",
"0.6948217",
"0.69428045",
"0.6912112",
"0.6837694",
"0.6760249",
"0.6721745",
"0.67165357",
"0.6589998",
"0.6585546",
"0.65653926",
"0.65105915",
"0.64741606",
"0.6468277",
"0.6466075",
"0.6455949",
"0.6452453",
"0.64466023",
"0.64295346",
"0.640045... | 0.60769683 | 51 |
Create fresh default params for each test. | def setUp(self):
self._default_call_inputs = (
np.array([["one", "two", "three"],
["four", "five", "six"]]),
None
)
self._hash_bins = 10
self._hash_embedding_dim = 4
self._embedding_dim = 2
self._attention_heads = 4
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n self.source_params[key] = value",
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n ... | [
"0.7084804",
"0.7084804",
"0.6948217",
"0.69428045",
"0.6912112",
"0.6837694",
"0.6760249",
"0.6721745",
"0.67165357",
"0.6589998",
"0.6585546",
"0.65653926",
"0.65105915",
"0.64741606",
"0.6468277",
"0.6466075",
"0.6455949",
"0.6452453",
"0.64466023",
"0.64295346",
"0.640045... | 0.0 | -1 |
Create fresh default params for each test. | def setUp(self):
self._default_call_inputs = (
np.array([["one", "two", "three"],
["four", "five", "six"]]),
None
)
self._hash_embedding_dim = 4
self._embedding_dim = 2
self._default_config = {
"hash_embedding_dim": self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n self.source_params[key] = value",
"def _initialize_defaults(self):\n for key, value in defaults.items():\n if key not in self.source_params:\n ... | [
"0.7084804",
"0.7084804",
"0.6948217",
"0.69428045",
"0.6912112",
"0.6837694",
"0.6760249",
"0.6721745",
"0.67165357",
"0.6589998",
"0.6585546",
"0.65653926",
"0.65105915",
"0.64741606",
"0.6468277",
"0.6466075",
"0.6455949",
"0.6452453",
"0.64466023",
"0.64295346",
"0.640045... | 0.62123364 | 30 |
This function takes an array as a parameter and determines if it is in either ascending or descending order. If the array is in strictly ascending order, it returns a 1. If it is in strictly a descending order, it returns a a 2. If the array is neither ascending nor descending, it returns a 0. | def is_sorted(arr: StaticArray) -> int:
num = 0 # Num variable is what helps determine if the array is in either ascending or descending order
for index in range(arr.size()-1):
if arr[index] < arr[index + 1]:
num += 1
elif arr[index] > arr[index + 1]:
num -= 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sorted(arr: StaticArray) -> int:\n length = arr.size() - 1\n\n # If only one element in the array\n if arr.size() == 1:\n return 1\n\n # Compares each element with the one after it to check for ascending order\n elif arr.get(length) > arr.get(0):\n for index in range(length):\n ... | [
"0.75460577",
"0.665151",
"0.6512768",
"0.63535976",
"0.62995005",
"0.6169687",
"0.6088557",
"0.60608983",
"0.5998626",
"0.59830683",
"0.5974278",
"0.59544045",
"0.59316635",
"0.5878022",
"0.5862382",
"0.5858056",
"0.57523626",
"0.57448494",
"0.57240885",
"0.5691567",
"0.5671... | 0.7700246 | 0 |
Replaces the capital letter in a string with an underscore plus the corresponding lowercase character. | def ReplaceCapitals(string):
newString = ""
for char in string:
if char.isupper():
newString += "_%s"%char.lower()
else:
newString += char
return newString | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def underscore(string):\n # NOTE(retr0h): Taken from jpvanhal/inflection\n # https://github.com/jpvanhal/inflection\n string = re.sub(r\"([A-Z]+)([A-Z][a-z])\", r\"\\1_\\2\", string)\n string = re.sub(r\"([a-z\\d])([A-Z])\", r\"\\1_\\2\", string)\n string = string.replace(\"-\", \"_\")\n\n return... | [
"0.8106429",
"0.79863095",
"0.78607017",
"0.78437763",
"0.7801613",
"0.7739209",
"0.77090186",
"0.76975006",
"0.7685407",
"0.76765305",
"0.76561886",
"0.7605381",
"0.75864893",
"0.75793535",
"0.7548218",
"0.7505781",
"0.7505781",
"0.7422077",
"0.7352805",
"0.73521876",
"0.733... | 0.7778281 | 5 |
Removes all the HTML tags from a string. | def RemoveHTMLTags(data):
p = re.compile(r'<[^<]*?>')
return p.sub('', data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_html_tags(text):\n print('VOU REMOVER AS TAGS DA STRING')\n clean = re.compile('<.*?>')\n print('',re.sub(clean, '', text))\n return re.sub(clean, '', text)",
"def remove_html_tags(text):\r\n clean = re.compile('<.*?>')\r\n return re.sub(clean, '', text)",
"def remove_html_tags(sel... | [
"0.832426",
"0.83123696",
"0.8309658",
"0.8276707",
"0.8276707",
"0.82485414",
"0.82025677",
"0.81804734",
"0.81608266",
"0.81452125",
"0.8058922",
"0.8008934",
"0.7985116",
"0.7858819",
"0.7825074",
"0.7821691",
"0.7794228",
"0.7786889",
"0.7748151",
"0.77306396",
"0.7691341... | 0.76549923 | 26 |
Finds the windows styles and events in the input text. | def FindWindowStyles(text, originalText, widgetName):
winStyles, winEvents, winExtra, winAppearance = {}, {}, {}, {}
inStyle = inExtra = inEvent = False
for line in text:
if "following styles:" in line:
inStyle = True
continue
elif "Event macros" in line:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_textbox(orig_img, mask=None):\n masks = []\n shapes = []\n bboxes = []\n # extract each painting's mask\n if mask is None:\n masks = [np.ones(orig_img.shape[:2])]\n else:\n masks = extract_paintings_from_mask(mask)\n \n # we try to extract one textbox per paint... | [
"0.52320445",
"0.52099043",
"0.5187266",
"0.5186747",
"0.5067392",
"0.5056679",
"0.5014723",
"0.4997169",
"0.49930683",
"0.49846172",
"0.4948824",
"0.49455315",
"0.4944237",
"0.4870316",
"0.48489735",
"0.4840947",
"0.48322406",
"0.4815203",
"0.48110422",
"0.47910228",
"0.4786... | 0.7803555 | 0 |
Generate next slug for a series. Some docstore types will use slugs (see above) as document ids. To | def increment_slug(s):
slug_parts = s.split('-')
# advance (or add) the serial counter on the end of this slug
# noinspection PyBroadException
try:
# if it's an integer, increment it
slug_parts[-1] = str(1 + int(slug_parts[-1]))
except:
# there's no counter! add one now
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_slug(self):\n slug = slugify(self.title)\n new_slug = slug\n s = 1\n while Article.objects.filter(slug=new_slug).exists():\n \"\"\"increase value of slug by one\"\"\"\n new_slug = f'{slug}-{s}'\n s += 1\n return new_slug",
"def crea... | [
"0.74758935",
"0.70766634",
"0.6603589",
"0.6458452",
"0.64131266",
"0.63058513",
"0.6235616",
"0.61121005",
"0.60668",
"0.60103345",
"0.6007335",
"0.5985873",
"0.5950447",
"0.59290826",
"0.5905601",
"0.5900304",
"0.5888091",
"0.58615845",
"0.5850018",
"0.58442956",
"0.583906... | 0.64641285 | 3 |
Retrieve the code point (and name, if possible) for a given character | def get_codepoint_name(char):
# Get the hex value for the code point, and drop the 0x from the front
point = hex(ord(char))[2:]
# Make the hex 4 characters long with preceding 0s, and all upper case
point = point.rjust(4, '0').upper()
# get codepoint's name
name = None
try:
name = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getChar(self,code):\r\n return chr(code)",
"def code(char):\n return int(char) if char.isdigit() else letter_code(char)",
"def character(m) -> str:\n return m[0]",
"def _charToIndex(self,ch): \n return self.char_dict[ch]",
"def codepoint(bot, trigger):\n arg = trigger.gr... | [
"0.70392036",
"0.69892913",
"0.6939479",
"0.69278216",
"0.67811435",
"0.6749114",
"0.6748337",
"0.6743649",
"0.671647",
"0.66394585",
"0.6532811",
"0.65252894",
"0.65148807",
"0.6408459",
"0.63989043",
"0.6394356",
"0.6390539",
"0.63881636",
"0.6368716",
"0.6345202",
"0.63213... | 0.797366 | 0 |
Returns the sum of values in the dictionary, multiplied by the key. | def dict_sum(d):
return sum(k*v for k, v in d.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_sum(my_dict):\n \n # Enter code here\n a = 0\n for key in my_dict:\n a += my_dict[key]\n return a",
"def sum(self, key, value):\n self._metrics[key] += value",
"def sum(self):\n return sum(self.items())",
"def _sum(self):\n s = 0\n for element, valu... | [
"0.7136462",
"0.6947277",
"0.6148286",
"0.613472",
"0.61048305",
"0.6070206",
"0.6021336",
"0.5848089",
"0.57663286",
"0.57318485",
"0.57271093",
"0.57159823",
"0.5708767",
"0.57075435",
"0.57024837",
"0.5675388",
"0.5628674",
"0.5617226",
"0.5617226",
"0.55755126",
"0.553838... | 0.7977705 | 0 |
A Graph will be a dictionary containing nodes. Theses nodes will be a dictionary of neighbor nodes. The node's dict. key will be the neighbor node and it's value will be 1. Return the updated Graph. | def make_link(Graph, node1, node2):
if node1 not in Graph:
Graph[node1] = {}
(Graph[node1])[node2] = 1
if node2 not in Graph:
Graph[node2] = {}
(Graph[node2])[node1] = 1
return Graph | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph():\n graph = Graph()\n graph.insert(1, 2)\n graph.insert(0, 2, 3)\n graph.insert(0, 1, 3)\n graph.insert(1, 2)\n return graph",
"def get_neighbors(graph):\n neighbor_dict = dict()\n for node in graph:\n neighbor_dict[node] = set(graph[node])\n return neighbor_dict",
... | [
"0.67597896",
"0.6747098",
"0.6730532",
"0.66754925",
"0.6587945",
"0.6534464",
"0.65105206",
"0.64979035",
"0.64935845",
"0.64871734",
"0.64559376",
"0.6408517",
"0.6394802",
"0.63878345",
"0.6382639",
"0.6329476",
"0.6297377",
"0.6279599",
"0.627638",
"0.62745154",
"0.62661... | 0.6556757 | 5 |
The Scene renders its background and all the Buttons in it. | def render(self, screen):
# print("Drawing scene {}".format(self.imgname))
screen.fill(self.color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize(self):\n app = QtGui.QApplication([''])\n SceneGUI(self)\n app.exec_()",
"def draw(self):\n self.scene.draw(self.screen)",
"def show(self):\n self.scene().show()",
"def on_show_view(self):\n self.window.background_color = arcade.color.WHITE",
"def on_... | [
"0.7279688",
"0.6920006",
"0.6769451",
"0.674643",
"0.6743966",
"0.6719392",
"0.6715012",
"0.6629936",
"0.65488505",
"0.6458212",
"0.64518845",
"0.6417654",
"0.641748",
"0.64147025",
"0.6306125",
"0.63050514",
"0.6264611",
"0.6264611",
"0.6240117",
"0.6212275",
"0.6186123",
... | 0.68309635 | 2 |
To setup a mock environment for integration tests. | def integration_test_setup(request):
configs = configholder.table_func_retrieve_additional_configs(
ACTION_IDENTIFIER, request.function.__name__
)
load_configs(configholder, configs)
os.mkdir(ARCHIVE_TARGET)
os.mkdir(MODEL_TARGET)
def integration_test_teardown():
os.chdir(ROOT_D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def SetupEnvironment(self):\n pass",
"def setup_env(mocker, request):\n env_dir = USER_ENVS_DIR / ENV_NAME\n mocker.patch(\n \"conda_env_tracker.history.debug.get_pip_version\",\n mocker.Mock(return_value=\"18.1\"),\n )\n mocker.patch(\... | [
"0.76192766",
"0.75442636",
"0.72970414",
"0.6954678",
"0.69247216",
"0.69247216",
"0.68744165",
"0.68683124",
"0.6867738",
"0.6842817",
"0.6842817",
"0.6842817",
"0.6842817",
"0.6842817",
"0.6842817",
"0.68261814",
"0.67550683",
"0.67275566",
"0.66984767",
"0.6698443",
"0.66... | 0.0 | -1 |
To setup a mock environment for unit tests. | def unit_test_setup(request):
configs = configholder.table_func_retrieve_additional_configs(
ACTION_IDENTIFIER, request.function.__name__
)
load_configs(configholder, configs)
os.mkdir(ARCHIVE_TARGET)
def unit_test_teardown():
shutil.rmtree(ARCHIVE_TARGET)
request.addfinalizer(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def SetupEnvironment(self):\n pass",
"def setUp(self):\n self.tempdir = to_str(tempfile.mkdtemp())\n self.repo = os.path.join(self.tempdir, 'throwaway')\n src_dir = os.path.join(self.repo, 'src')\n pkg_dir = os.path.join(self.repo, 's... | [
"0.76727325",
"0.761966",
"0.72570455",
"0.71592396",
"0.71592396",
"0.71447587",
"0.71447587",
"0.71447587",
"0.71447587",
"0.71447587",
"0.71447587",
"0.707504",
"0.6951138",
"0.6914217",
"0.6903038",
"0.6898129",
"0.6895484",
"0.6895484",
"0.6874645",
"0.6760716",
"0.67050... | 0.0 | -1 |
Return the preorder attached to a tuple of decreasing runs. This is a directed graph, whose vertices correspond to the runs. There is an edge from a run `R` to a run `S` if `R` is before `S` in the list of runs and the two intervals defined by the initial and final indices of `R` and `S` overlap. This only depends on t... | def shard_preorder_graph(runs):
N = len(runs)
dg = DiGraph(N)
dg.add_edges((i, j) for i in range(N - 1)
for j in range(i + 1, N)
if runs[i][-1] < runs[j][0] and runs[j][-1] < runs[i][0])
return dg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preorder(node, pred, succ, res):\n if node is None:\n return res\n res = min(res, node.val - pred)\n res = min(res, succ - node.val)\n res = preorder(node.left, pred, node.val, res)\n res = preorder(node.right, node.val, succ, res)\n ... | [
"0.5808303",
"0.56872976",
"0.543639",
"0.54127073",
"0.54092705",
"0.54040706",
"0.5346316",
"0.5301817",
"0.525702",
"0.52446",
"0.52263755",
"0.5211526",
"0.5144954",
"0.5142816",
"0.51006716",
"0.50385964",
"0.5034277",
"0.50258607",
"0.5009282",
"0.4975866",
"0.497342",
... | 0.7209996 | 0 |
Activation function used to make the computation nonlinear. | def sigmoid(self, x):
return 1 / (1 + np.exp(-x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_func(x):\r\n a = -1\r\n return 1/(1+np.exp(-a*x))",
"def activation_function(X):\n\tz = np.sum(w*x+b)\n\treturn z",
"def activation(x):\n # return np.tanh(x)\n return np.maximum(0,x)",
"def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))",
"def activation_f... | [
"0.73881924",
"0.7015444",
"0.69931483",
"0.69677925",
"0.6956979",
"0.6941395",
"0.68878514",
"0.68824553",
"0.68034184",
"0.67013854",
"0.66763216",
"0.66624486",
"0.6558964",
"0.6525159",
"0.6464747",
"0.6464747",
"0.64573675",
"0.64533484",
"0.6437978",
"0.6403247",
"0.63... | 0.0 | -1 |
Apply fourpoint perspective transformation based on the largest rectangle This requires clear edges can be seen in original image (paper edge or single table edge) | def _preprocess(self, ori_img: np.ndarray, p_trans=False, adjust_angle=False, p_trans_options='traditional') -> (np.ndarray, np.ndarray):
flagged = None
if p_trans:
ori_img, flagged = preprocess(ori_img, hed_model=self.hed_model if p_trans_options == 'hed' else None)
if adjust_angle:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def four_point_transform(image, pts):\n\n\tmax_x, max_y = np.max(pts[:, 0]).astype(np.int32), np.max(pts[:, 1]).astype(np.int32)\n\n\tdst = np.array([\n\t\t[0, 0],\n\t\t[image.shape[1] - 1, 0],\n\t\t[image.shape[1] - 1, image.shape[0] - 1],\n\t\t[0, image.shape[0] - 1]], dtype=\"float32\")\n\n\twarped = cv2.warpPe... | [
"0.73207504",
"0.72104484",
"0.7093376",
"0.7051215",
"0.6742092",
"0.668488",
"0.66180426",
"0.6594701",
"0.65680933",
"0.6560847",
"0.65263116",
"0.64774203",
"0.6452571",
"0.6438915",
"0.6438006",
"0.63114893",
"0.629864",
"0.6251271",
"0.62262195",
"0.62211895",
"0.621456... | 0.0 | -1 |
The `aggplot` function aggregates a single column of data. To begin, choose the column you would like to aggregate and set it as the `agg` parameter. The behavior of `aggplot` changes based on the type of variable used for `agg`. For numeric columns, the average of the values are calculated by default. Use the `aggfunc... | def aggplot(agg, groupby=None, data=None, hue=None, row=None, col=None, kind='bar', orient='v',
sort=False, aggfunc='mean', normalize=None, wrap=None, stacked=False,
figsize=None, rot=0, title=None, sharex=True, sharey=True, xlabel=None,
ylabel=None, xlim=None, ylim=None, xscale='lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotting_to_agg():\n plt.switch_backend(\"agg\")",
"def aggregate_statistics(self, stat_col, stat_agg):\n self.module.aggregate_statistics(stat_col, stat_agg)",
"def get_column_grouped_aggregations(column: str, agg_column: str) -> List[str]:\n config = current_app.config\n\n table_name = co... | [
"0.6556604",
"0.5894976",
"0.56561595",
"0.55943143",
"0.55494064",
"0.54318064",
"0.52974194",
"0.52227765",
"0.521299",
"0.51891077",
"0.5175804",
"0.5153407",
"0.51276535",
"0.51015145",
"0.50962293",
"0.50662667",
"0.5062059",
"0.5040034",
"0.5039574",
"0.50376403",
"0.50... | 0.73945475 | 0 |
Initializes a new instance of `DelimitedList`. | def __init__(self, cls_or_instance, delimiter=None, **kwargs):
self.delimiter = delimiter or self.delimiter
super().__init__(cls_or_instance, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset_dir, listfile=None, period_length=48.0):\n Reader.__init__(self, dataset_dir, listfile)\n self._data = [line.split(',') for line in self._data]\n self._data = [(x, int(y)) for (x, y) in self._data]\n self._period_length = period_length",
"def __init__(self, ... | [
"0.6351916",
"0.63286346",
"0.6073249",
"0.6069085",
"0.6066679",
"0.60654104",
"0.60586375",
"0.59758747",
"0.5970006",
"0.57886076",
"0.5729101",
"0.5689722",
"0.56842387",
"0.56532264",
"0.56505466",
"0.5637155",
"0.56207365",
"0.56111157",
"0.5609024",
"0.56035763",
"0.55... | 0.5452885 | 36 |
Returns the TestInstance with the highest test score. Test The test to search on. TestInstance Returns the TestInstance with the highest mark. | def get_highest(self, test):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MaxTestStat(self):\n return max(self.test_stats)",
"def max_score_test(self):\n max_score_tuple = self.results.max_score(molecules=[\"DDSPDLPK\"])\n assert max_score_tuple[0] == 1 # score\n assert max_score_tuple[3].scaling_factor == 100 # intensity\n\n assert self.result... | [
"0.6191",
"0.5935445",
"0.5848735",
"0.583945",
"0.5661902",
"0.56588334",
"0.5609801",
"0.5570459",
"0.5528323",
"0.5500633",
"0.5484255",
"0.5484255",
"0.5464198",
"0.546089",
"0.5427418",
"0.5416364",
"0.54107034",
"0.5400609",
"0.5393983",
"0.5380028",
"0.5380028",
"0.5... | 0.776497 | 0 |
Returns the average mark for that question in the ResultCollection Question The question object to search on. Float The average as a float. | def get_average_for_question(self, question):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_mark(self, test):\n return",
"def getAverage(self):\n return sum(self.scores) / len(self.scores)",
"def get_average(self) -> float:\n return sum(self._scores) / len(self._scores)",
"def average(entry):\n return entry['total time (s)'] / float(entry['correct answers'] +... | [
"0.6969687",
"0.681243",
"0.67895615",
"0.6781547",
"0.6685621",
"0.6678893",
"0.6602149",
"0.65996724",
"0.6584481",
"0.6543306",
"0.6542311",
"0.6525554",
"0.6457996",
"0.6424753",
"0.6366771",
"0.6354886",
"0.6333808",
"0.6295789",
"0.621484",
"0.6214591",
"0.6201228",
"... | 0.765214 | 0 |
Get the contribution of a radar target at distance 'r' to the radar signal at distance 'R'. Assuming a rectangular pulse and a matched filter with the same shape as the radar pulse. Assuming that the radar receiver is not averaging over multiple samples around R. The contribution is linear with 1 at the r=R and 0 if |r... | def range_weights(rangemap, rr, pulselength, db=False):
dr = rangemap - rr
fr = 1. - np.abs(dr) / pulselength
ind0 = fr < 0
fr[ind0] = 0.
fr[~ind0] = fr[~ind0] * (rr / rangemap[~ind0]) ** 4
if db:
fr = 10. * np.log10(fr)
return fr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_radial_distance(p1,p2,R):\r\n d = np.sqrt((p1[0]-p2[0])**2.0 + (p1[1]-p2[1])**2.0)\r\n if d < 0.1*R:\r\n d = 0.0\r\n elif d > R:\r\n d = R\r\n return d",
"def _radial_distortion(self, r2: np.ndarray) -> np.ndarray:\n # dr = (1 + k1 * r^2 + k2 * r^4 + k3 * r^6)/(1 + k4 * r... | [
"0.6143687",
"0.61179066",
"0.59602964",
"0.59377915",
"0.58542746",
"0.57122797",
"0.5702554",
"0.56927216",
"0.5654261",
"0.5641617",
"0.5591905",
"0.557652",
"0.55634683",
"0.55347043",
"0.55118114",
"0.5496401",
"0.54962355",
"0.54443663",
"0.5427681",
"0.54244155",
"0.54... | 0.0 | -1 |
Gets the type of this Edge. | def type(self) -> str:
return self._type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEdgeClass(self) -> Type[Edge]:\n return Edge",
"def get_type(self):\n return self._type",
"def get_type(self):\n return self._type",
"def get_type(self):\n return self.type",
"def get_type(self):\n return self.type",
"def getType(self):\n return self.type"... | [
"0.77014464",
"0.7386493",
"0.7386493",
"0.73694944",
"0.73694944",
"0.73590636",
"0.7354326",
"0.73450327",
"0.72769415",
"0.72625196",
"0.72342557",
"0.72342557",
"0.72342557",
"0.72342557",
"0.72342557",
"0.72342557",
"0.72342557",
"0.72342557",
"0.72342557",
"0.72342557",
... | 0.67835873 | 52 |
Gets the source_id of this Edge. | def source_id(self) -> str:
return self._source_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_id(self):\n return self._source_id",
"def source_id(self) -> Optional[str]:\n return pulumi.get(self, \"source_id\")",
"def source_identifier(self) -> str:\n return pulumi.get(self, \"source_identifier\")",
"def source_identifier(self) -> str:\n return pulumi.get(self, ... | [
"0.8353196",
"0.7616793",
"0.73005426",
"0.73005426",
"0.7126976",
"0.70501673",
"0.69017637",
"0.6896565",
"0.68724036",
"0.6868325",
"0.6719404",
"0.6719404",
"0.66690457",
"0.66642016",
"0.66642016",
"0.6619652",
"0.6619652",
"0.6565619",
"0.6564552",
"0.6534099",
"0.65000... | 0.80689883 | 1 |
Sets the source_id of this Edge. | def source_id(self, source_id: str):
self._source_id = source_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_id(self, source_id):\n\n self._source_id = source_id",
"def source_id(self, source_id):\n\n self._source_id = source_id",
"def source_id(self, source_id):\n if source_id is None:\n raise ValueError(\"Invalid value for `source_id`, must not be `None`\") # noqa: E501\n... | [
"0.8323536",
"0.8323536",
"0.77019185",
"0.76357174",
"0.71467566",
"0.6955889",
"0.68063855",
"0.6733369",
"0.66714",
"0.6580405",
"0.6525541",
"0.65252924",
"0.64849746",
"0.63345164",
"0.63345164",
"0.63345164",
"0.63345164",
"0.63345164",
"0.63345164",
"0.63345164",
"0.63... | 0.82825005 | 2 |
Gets the target_id of this Edge. | def target_id(self) -> str:
return self._target_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_id(self):\n\n return self._target_id",
"def target_id(self):\n\n return self._target_id",
"def target_id(self) -> Optional[str]:\n return pulumi.get(self, \"target_id\")",
"def getTarget(self):\n\n return self._target",
"def getTarget(self):\n return self._targ... | [
"0.84236455",
"0.84236455",
"0.7544687",
"0.7402949",
"0.7381373",
"0.72254324",
"0.71793425",
"0.7028704",
"0.69628483",
"0.69628483",
"0.69628483",
"0.69628483",
"0.6905934",
"0.6898833",
"0.68835086",
"0.67877525",
"0.67372745",
"0.67151636",
"0.6690697",
"0.6634487",
"0.6... | 0.8066729 | 2 |
Gets the confidence of this Edge. | def confidence(self) -> float:
return self._confidence | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confidence(self):\n return self._confidence",
"def confidence(self):\n return self._confidence",
"def detection_confidence(self):\n return self._detection_confidence",
"def confidence(self) -> float:\n return float(self.class_scores[self.class_num])",
"def get_medie_confiden... | [
"0.82446605",
"0.82446605",
"0.75413597",
"0.7531451",
"0.7021972",
"0.69704044",
"0.68751204",
"0.64923465",
"0.6394811",
"0.61826706",
"0.60284585",
"0.5976302",
"0.5928962",
"0.5928962",
"0.5882306",
"0.5866227",
"0.5853637",
"0.58353096",
"0.57790434",
"0.57473636",
"0.57... | 0.83678156 | 0 |
Sets the confidence of this Edge. | def confidence(self, confidence: float):
self._confidence = confidence | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confidence(self, confidence):\n self._confidence = confidence",
"def confidence(self, confidence):\n self._confidence = confidence",
"def confidence(self, confidence):\n\n self._confidence = confidence",
"def confidence(self, confidence):\n\n self._confidence = confidence",
... | [
"0.7658268",
"0.7658268",
"0.76316774",
"0.76316774",
"0.65808713",
"0.6486767",
"0.6316895",
"0.6316895",
"0.6310309",
"0.6310309",
"0.59642947",
"0.59642947",
"0.5793888",
"0.57051516",
"0.56410503",
"0.5388331",
"0.53471136",
"0.50288314",
"0.5011456",
"0.49679616",
"0.496... | 0.77904624 | 0 |
Gets the origin_list of this Edge. | def origin_list(self) -> List[Origin]:
return self._origin_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def origin_nodes(self):\n return self.nodes_where({\"type\": \"_origin\"})",
"def origin(self) -> Union[Vector, List[Vector]]:\n\t\tif len(self._all_objects) == 1:\n\t\t\treturn self._meshes[0].location\n\n\t\telse:\n\t\t\treturn [m.location for m in self._all_objects]",
"def origin(self):\n retu... | [
"0.6989685",
"0.6672081",
"0.65931445",
"0.6470805",
"0.6375844",
"0.6375844",
"0.6375844",
"0.6375844",
"0.63471115",
"0.6330713",
"0.6330713",
"0.6330713",
"0.6287998",
"0.6254168",
"0.6212144",
"0.6108557",
"0.60903174",
"0.6078891",
"0.59888077",
"0.5951632",
"0.5907581",... | 0.83698314 | 0 |
Sets the origin_list of this Edge. | def origin_list(self, origin_list: List[Origin]):
self._origin_list = origin_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_origin(self, origin):\n self.origin = origin\n self.__symbol_set.update(origin)",
"def _set_origin_value(self, origin):\n self.origin_value = origin",
"def origin(self, origin):\n\n\t\tif len(self._all_objects) == 1:\n\t\t\ttry:\n\t\t\t\tvec = handle_vec(origin)\n\t\t\texcept Value... | [
"0.66144395",
"0.6605791",
"0.65860593",
"0.65421236",
"0.63207364",
"0.62332445",
"0.6131502",
"0.61017925",
"0.60516495",
"0.5801835",
"0.55896753",
"0.5555271",
"0.55421543",
"0.55095637",
"0.5496221",
"0.54719216",
"0.53929377",
"0.53432083",
"0.532739",
"0.5323936",
"0.5... | 0.8287914 | 0 |
Retrieve a dictionary of all the initial savers for the models. | def retrieve_init_savers(hparams):
## Dictionary of init savers.
init_savers = {}
## Load Generator weights from MaskGAN checkpoint.
if FLAGS.maskgan_ckpt:
gen_vars = [
v for v in tf.trainable_variables() if v.op.name.startswith('gen')
]
print(gen_vars)
#input('WAIT')
variables_in_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_saveables(self):\n\n saveables = dict()\n for i in range(self.bootstraps):\n saveables[f'forward_model_{i}'] = self.forward_models[i]\n saveables[f'forward_model_optim_{i}'] = self.forward_model_optims[i]\n return saveables",
"def get_saveables(self):\n\n ... | [
"0.72189075",
"0.68774223",
"0.6614466",
"0.6424699",
"0.6191726",
"0.5910672",
"0.5900638",
"0.58960474",
"0.5844799",
"0.5767187",
"0.5710479",
"0.5702803",
"0.56635547",
"0.5520287",
"0.5520236",
"0.54995507",
"0.5499016",
"0.54902303",
"0.5464077",
"0.54610056",
"0.541439... | 0.6785531 | 2 |
Convert a string to raw bytes without encoding | def rawbytes(s):
outlist = []
for cp in s:
num = ord(cp)
if num < 255:
outlist.append(struct.pack('B', num))
elif num < 65535:
outlist.append(struct.pack('>H', num))
else:
b = (num & 0xFF0000) >> 16
H = num & 0xFFFF
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n return bytes(s, encoding='latin_1')",
"def asbytes(s):\n if isinstance(s, bytes):\n return s\n else:\n return s.encode('utf-8')",
"def as_bytes(string):\n return same_string_type_as(b\"\", string)",
"def str_to_byte... | [
"0.7809434",
"0.777581",
"0.7731383",
"0.76541096",
"0.75558203",
"0.7517334",
"0.74570334",
"0.7431554",
"0.7420785",
"0.73332804",
"0.73037195",
"0.72042966",
"0.71964186",
"0.7194585",
"0.7186927",
"0.710661",
"0.7010463",
"0.6987726",
"0.6983025",
"0.6978843",
"0.68831444... | 0.63554955 | 52 |
Returns the shortest first name (str). You can assume there is only one shortest name. | def shortest_first_name(names):
names = dedup_and_title_case_names(names)
split_names = [name.split(' ') for name in names]
first_name = [first for first, last in split_names]
shortest = first_name[0]
for name in first_name:
if len(name) < len(shortest):
shortest = name
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_first_name(names):\n names = dedup_and_title_case_names(names)\n return sorted([name.split()[0] for name in names], key=len)[0]",
"def shortest_first_name(names):\n names = dedup_and_title_case_names(names)\n names_splitted = [name.split() for name in names]\n names_splitted.sort(key=... | [
"0.8428619",
"0.8404725",
"0.8364506",
"0.8177982",
"0.7852414",
"0.7568942",
"0.74276435",
"0.7413328",
"0.7411074",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.72857755",
"0.7... | 0.8494851 | 0 |
The Ninja file name, not including the path. The ``file_name`` if set, or else the project's ``file_name``, or else ``ninja.file_name`` in the context. | def file_name(self):
file_name = stringify(self._file_name)
if file_name is None:
file_name = stringify(self._project.file_name)
if file_name is None:
with current_context() as ctx:
file_name = stringify(ctx.get('ninja.file_name', DEFAULT_NAME))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name(self):\n return str(self.get_file())",
"def file_name(self):\n return self.__file_name",
"def file_name(self):\n return self._file_name",
"def file_name(self):\n return self._file_name",
"def file_name(self):\n return self._file_name",
"def file_name(s... | [
"0.6862871",
"0.6821923",
"0.6780874",
"0.6780874",
"0.6780874",
"0.6780874",
"0.6780874",
"0.67774653",
"0.67221814",
"0.6681954",
"0.66731834",
"0.66604793",
"0.665372",
"0.6601857",
"0.65991676",
"0.64560074",
"0.64455944",
"0.64350414",
"0.6395356",
"0.6378014",
"0.636455... | 0.8838724 | 0 |
Represents the motion of the robot as a tuple of (left_motor_speed, right_motor_speed) with ``(1, 1)`` representing full speed backwards, ``(1, 1)`` representing full speed forwards, and ``(0, 0)`` representing stopped. | def value(self):
return super(Robot, self).value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_motor_states(self, latency=None):\n if latency is None:\n latency = self._pd_latency\n buffer = self._observation_buffer.get_delayed_value(latency)\n angle_vel_t0 = buffer.value_0\n angle_vel_t1 = buffer.value_1\n coeff = buffer.coeff\n\n pos_idx = 0\n motor_angles = angle_vel_t0[... | [
"0.6404549",
"0.6383511",
"0.6377588",
"0.63195384",
"0.6191144",
"0.6166157",
"0.6148196",
"0.6143877",
"0.6143877",
"0.5977456",
"0.5893539",
"0.5885124",
"0.586815",
"0.5866859",
"0.58444405",
"0.57365614",
"0.571465",
"0.5705497",
"0.5700656",
"0.5665157",
"0.5606702",
... | 0.0 | -1 |
Make the robot turn left by running the right motor forward and left motor backward. | def left(self, speed=1):
self.right_motor.forward(speed)
self.left_motor.backward(speed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_turn(self, left_speed, right_speed):\n self.left_motor.run_forever(speed_sp=-left_speed)\n self.right_motor.run_forever(speed_sp=right_speed)",
"def turn_left(self, duration):\n self.set_motor(self.left_motor, 'right', 0.5)\n self.set_motor(self.right_motor, 'right', 0.5)\n ... | [
"0.8367836",
"0.82325584",
"0.82071596",
"0.7955436",
"0.7905188",
"0.7867365",
"0.7856764",
"0.77784896",
"0.7736242",
"0.7723731",
"0.76935196",
"0.76763123",
"0.7669001",
"0.7648285",
"0.76079524",
"0.7592718",
"0.75881743",
"0.7563013",
"0.7556141",
"0.75213104",
"0.74584... | 0.81400263 | 3 |
Gets configurations specified in environment variables | def get_environment_configuration():
try:
time_limit = int(os.getenv('AUTOBOT_POST_TIMELIMIT'))
except TypeError:
time_limit = None
# if we're using Redis Labs
redis_cloud_url = os.getenv('REDISCLOUD_URL')
if redis_cloud_url:
url = urlparse.urlparse(redis_cloud_url)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_environ_config_vars():\n # only allow secret key and database uri for now\n envvars = [\"SQLALCHEMY_DATABASE_URI\", \"SECRET_KEY\"]\n results = {}\n for key in envvars:\n if key in os.environ:\n results[key] = os.environ[key]\n return results",
"def get_environment_vars(... | [
"0.7568432",
"0.69236165",
"0.6785328",
"0.67599154",
"0.66753757",
"0.6656892",
"0.66141677",
"0.6613348",
"0.66114944",
"0.65880424",
"0.65459496",
"0.65253323",
"0.6490109",
"0.6487907",
"0.6485184",
"0.6476511",
"0.64750063",
"0.6452016",
"0.6450357",
"0.64474964",
"0.644... | 0.7082892 | 1 |
Determine if a submission should be removed based on a timelimit for submissions for a subreddit. | def reject_submission_by_timelimit(self, submission):
now = int(time.time())
# We get submissions in ascending order (so, oldest ones first from last hour).
# We want to find the most recent post (as in the oldest timestamp)
user_posts = self.get_last_subreddit_submissions(submission.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _submission_allowed(self):\n window = dt.timedelta(\n self.plugin_config.get(\"days\", 0),\n self.plugin_config.get(\"seconds\", 0),\n self.plugin_config.get(\"microseconds\", 0),\n self.plugin_config.get(\"milliseconds\", 0),\n self.plugin_config.g... | [
"0.6230805",
"0.60662574",
"0.58598995",
"0.54777527",
"0.54694813",
"0.54386884",
"0.5422206",
"0.5316543",
"0.52469164",
"0.5190849",
"0.5156124",
"0.5130995",
"0.50212896",
"0.5000586",
"0.49960807",
"0.4987447",
"0.49816403",
"0.49687356",
"0.4968083",
"0.49518338",
"0.49... | 0.7748419 | 0 |
Create a frequency dict for each word in each sentence | def create_freq_dict(sents, lang):
ix = 0
freq_dict_all = []
stop_words = set(stopwords.words(lang))
for sent in sents:
ix += 1
freq_dict = {}
words = word_tokenize(sent)
for word in words:
word = word.lower()
if word not in stop_words:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_freq_dict(corpus, doc_info):\n for idx, content in enumerate(corpus):\n word_freq_table = {}\n splitted_sentence = content.split()\n for word in splitted_sentence:\n word = word.lower()\n if word not in word_freq_table:\n word_freq_table[word]... | [
"0.79711366",
"0.79527897",
"0.7908529",
"0.7777378",
"0.7764787",
"0.77180594",
"0.76513875",
"0.76359123",
"0.76249355",
"0.7596326",
"0.75680953",
"0.7553133",
"0.7537017",
"0.751068",
"0.7508638",
"0.7505452",
"0.74757135",
"0.74597096",
"0.7450388",
"0.74488664",
"0.7445... | 0.76205397 | 9 |
Constructor for the SqlScript class | def __init__(self, sql=None, statements=None, filename=None):
assert atmost_one(sql, statements, filename), 'Multiple initializer'
if sql is None:
sql = ''
if filename:
with open(filename, 'r') as f:
sql = f.read()
self._raw_sql = sql
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, sql_config = {}, verbose = True):\n\n self.sql_config = sql_config\n self.verbose = verbose\n self._setup()",
"def __init__(self, sqlSys, sql):\n self.__sqlSys = sqlSys\n self.__sql = sql\n self.__dboid = {}\n self.__log = Core.Log.File(debug = ... | [
"0.6580076",
"0.6535674",
"0.6435368",
"0.6341725",
"0.63100696",
"0.6273383",
"0.61767197",
"0.61626273",
"0.6098039",
"0.6029547",
"0.600575",
"0.5950744",
"0.59398955",
"0.59075767",
"0.58935577",
"0.5878379",
"0.5870004",
"0.5861395",
"0.58329135",
"0.58288145",
"0.582583... | 0.75042313 | 0 |
Generate a random hexadecimal color. | def random_hex_color():
r = randint(0, 255)
g = randint(0, 255)
b = randint(0, 255)
return '#%x%x%x' % (r, g, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_color():\n r = lambda: random.randint(0, 255)\n color = ('%02X%02X%02X' % (r(), r(), r()))\n return color",
"def rand_color(x):\n random.seed(x)\n color = random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)\n color = '#%02x%02x%02x' % color\n return color",
"d... | [
"0.8337782",
"0.8103713",
"0.8002443",
"0.7842385",
"0.7706916",
"0.7702511",
"0.76586133",
"0.76327544",
"0.76219046",
"0.75414705",
"0.7536235",
"0.7518359",
"0.7246073",
"0.7236561",
"0.72259396",
"0.6992444",
"0.6987446",
"0.69873047",
"0.69667095",
"0.69249886",
"0.68958... | 0.8987302 | 0 |
Returns the top k scores and their locations in a feature map. Given a feature map, the top k values (based on activation) are returned. If `per_channel` is True, the top k values per channel are returned. Note that when k equals to 1, ths function uses reduce_max and argmax instead of top_k to make the logics more eff... | def top_k_feature_map_locations(feature_map, max_pool_kernel_size=3, k=100,
per_channel=False):
if not max_pool_kernel_size or max_pool_kernel_size == 1:
feature_map_peaks = feature_map
else:
feature_map_max_pool = tf.nn.max_pool(
feature_map, ksize=max_pool_kernel_si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _my_top_k(x, k):\n if k > 10:\n return tf.nn.top_k(x, k)\n values = []\n indices = []\n depth = tf.shape(x)[1]\n for i in range(k):\n values.append(tf.reduce_max(x, 1))\n argmax = tf.argmax(x, 1)\n indices.append(argmax)\n if i + 1 < k:\n x += tf.one... | [
"0.6592115",
"0.6507373",
"0.6224164",
"0.60698926",
"0.6007896",
"0.59689146",
"0.5933333",
"0.58616215",
"0.578878",
"0.57196707",
"0.5717367",
"0.57147366",
"0.5682592",
"0.564274",
"0.56185186",
"0.56170315",
"0.5611449",
"0.56047094",
"0.56021655",
"0.55982447",
"0.55807... | 0.8377617 | 0 |
Converts CenterNet classcenter, offset and size predictions to boxes. | def prediction_tensors_to_boxes(y_indices, x_indices, height_width_predictions,
offset_predictions):
batch_size, num_boxes = _get_shape(y_indices, 2)
_, height, width, _ = _get_shape(height_width_predictions, 4)
height, width = tf.cast(height, tf.float32), tf.cast(width, tf.float32... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_cellboxes(predictions, S=7, B=1, C=20):\n\n predictions = predictions.to(\"cpu\")\n batch_size = predictions.shape[0]\n predictions = predictions.reshape(batch_size, 7, 7, C + 5 * B) \n bounding_box = predictions[..., 21:25] # x, y , width, height # N x 7 x 7 x 4\n \n confidence = pre... | [
"0.66696256",
"0.6457735",
"0.6166483",
"0.6146884",
"0.6101151",
"0.6066482",
"0.6040257",
"0.5931713",
"0.5915805",
"0.59139097",
"0.58973694",
"0.5864586",
"0.58191866",
"0.5809209",
"0.579106",
"0.57779515",
"0.5767868",
"0.57614696",
"0.57466847",
"0.56594473",
"0.562562... | 0.0 | -1 |
Returns the peak locations in the feature map. | def argmax_feature_map_locations(feature_map):
batch_size, _, width, num_channels = _get_shape(feature_map, 4)
feature_map_flattened = tf.reshape(
feature_map, [batch_size, -1, num_channels])
peak_flat_indices = tf.math.argmax(
feature_map_flattened, axis=1, output_type=tf.dtypes.int32)
# Get x and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peak(self):\n pass",
"def peak_indices(self, **kwargs):\n kwarg_defaults = {\n 'width': 5, # ensure small spikes are ignored\n }\n kwarg_defaults.update(kwargs)\n return signal.find_peaks(self.ys, **kwarg_defaults)",
"def peak(self):\n return self.peak"... | [
"0.7124702",
"0.69831157",
"0.69458896",
"0.6929998",
"0.686022",
"0.68202764",
"0.67856073",
"0.6673581",
"0.6580902",
"0.6426965",
"0.64131725",
"0.6304347",
"0.6297897",
"0.6277954",
"0.6267204",
"0.6251393",
"0.61178255",
"0.6088294",
"0.60567784",
"0.6034188",
"0.5994749... | 0.60801893 | 18 |
Scatter keypoint elements into tensors with full keypoints dimension. | def _pad_to_full_keypoint_dim(keypoint_coords, keypoint_scores, keypoint_inds,
num_total_keypoints):
batch_size, num_instances, _, _ = (
shape_utils.combined_static_and_dynamic_shape(keypoint_coords))
kpt_coords_transposed = tf.transpose(keypoint_coords, [2, 0, 1, 3])
kpt_score... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _scatter_keypoints_to_batch(self, num_ind, kpt_coords_for_example,\n kpt_scores_for_example,\n instance_inds_for_example, max_detections,\n total_num_keypoints):\n def left_fn(kpt_coords_for_example, kpt_score... | [
"0.58437914",
"0.5619918",
"0.55627185",
"0.5471832",
"0.53888893",
"0.5385725",
"0.53598475",
"0.5353065",
"0.5341097",
"0.5273707",
"0.5224507",
"0.5214747",
"0.5206002",
"0.5203803",
"0.5191775",
"0.51893026",
"0.51863223",
"0.51685894",
"0.51624995",
"0.51624995",
"0.5153... | 0.5735176 | 1 |
Get the index in a flattened array given row and column indices. | def flattened_indices_from_row_col_indices(row_indices, col_indices, num_cols):
return (row_indices * num_cols) + col_indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_to_flat_array_index(row, column, matrix):\n return row * matrix.cols + column",
"def row_col_indices_from_flattened_indices(indices, num_cols):\n # Avoid using mod operator to make the ops more easy to be compatible with\n # different environments, e.g. WASM.\n row_indices = indices // num_cols\... | [
"0.70470023",
"0.6841234",
"0.67944235",
"0.6068162",
"0.60540545",
"0.6015931",
"0.59483933",
"0.5940562",
"0.59401965",
"0.5921309",
"0.5878177",
"0.5865502",
"0.58032405",
"0.57696074",
"0.57521003",
"0.5745357",
"0.5736519",
"0.57156724",
"0.56989694",
"0.5693325",
"0.565... | 0.7084804 | 0 |
Computes row and column indices from flattened indices. | def row_col_indices_from_flattened_indices(indices, num_cols):
# Avoid using mod operator to make the ops more easy to be compatible with
# different environments, e.g. WASM.
row_indices = indices // num_cols
col_indices = indices - row_indices * num_cols
return row_indices, col_indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flattened_indices_from_row_col_indices(row_indices, col_indices, num_cols):\n return (row_indices * num_cols) + col_indices",
"def row_col_channel_indices_from_flattened_indices(indices, num_cols,\n num_channels):\n # Be careful with this function when runn... | [
"0.76962125",
"0.69372326",
"0.65656954",
"0.6412977",
"0.6409309",
"0.6362281",
"0.6282446",
"0.6254227",
"0.6243074",
"0.6205609",
"0.6205609",
"0.61754763",
"0.61700946",
"0.6162989",
"0.6157726",
"0.6134845",
"0.612376",
"0.6114761",
"0.61069834",
"0.6098009",
"0.6095147"... | 0.770593 | 0 |
Converts predictions in the output space to normalized boxes. Boxes falling outside the valid image boundary are clipped to be on the boundary. | def convert_strided_predictions_to_normalized_boxes(boxes, stride,
true_image_shapes):
# Note: We use tf ops instead of functions in box_list_ops to make this
# function compatible with dynamic batch size.
boxes = boxes * stride
true_image_shapes = tf.tile(tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postprocess_boxes(pred_bbox, original_image, train_input_size, score_threshold):\n \n # valid scle for box\n valid_scale=[0, np.inf]\n \n # turn bbox to array\n pred_bbox = np.array(pred_bbox)\n \n # obtain predicted x, y, w, h, objectiveness score, class probabilities\n pred_xywh = ... | [
"0.6927519",
"0.6032502",
"0.60321534",
"0.6005985",
"0.59957296",
"0.59805876",
"0.5977652",
"0.5957716",
"0.59525234",
"0.59525234",
"0.59134144",
"0.59043366",
"0.5885123",
"0.5881061",
"0.58708304",
"0.58558375",
"0.5847216",
"0.58302593",
"0.58251995",
"0.5813832",
"0.58... | 0.66293097 | 1 |
Get a binary mask based on the true_image_shape. | def mask_from_true_image_shape(data_shape, true_image_shapes):
mask_h = tf.cast(
tf.range(data_shape[1]) < true_image_shapes[:, tf.newaxis, 0],
tf.float32)
mask_w = tf.cast(
tf.range(data_shape[2]) < true_image_shapes[:, tf.newaxis, 1],
tf.float32)
mask = tf.expand_dims(
mask_h[:, :,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_binary_mask(op_weights):\n return op_weights[\"mask\"]",
"def binary_mask_fn(input_shape, masking, mask_state):\n if masking == 'channel':\n assert(input_shape[-1] % 2 == 0)\n sub_shape = np.copy(input_shape)\n sub_shape[-1] = sub_shape[-1] // 2\n ... | [
"0.7314231",
"0.72467536",
"0.721366",
"0.7103919",
"0.68422514",
"0.6689708",
"0.65040886",
"0.64361787",
"0.6377487",
"0.63279504",
"0.62411875",
"0.6238968",
"0.6181999",
"0.6160379",
"0.61556774",
"0.6147906",
"0.61357814",
"0.6120786",
"0.6107119",
"0.60915846",
"0.60798... | 0.7624891 | 0 |
Constructor with default values for KeypointEstimationParams. | def __new__(cls,
task_name,
class_id,
keypoint_indices,
classification_loss,
localization_loss,
keypoint_labels=None,
keypoint_std_dev=None,
keypoint_heatmap_loss_weight=1.0,
keypoint_offset_los... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _default_params(self) -> Dict[str, Any]:\n normal_params = {\n \"temperature\": self.temperature,\n \"max_tokens\": self.max_tokens,\n \"top_p\": self.top_p,\n \"frequency_penalty\": self.frequency_penalty,\n \"presence_penalty\": self.presence_pena... | [
"0.6326441",
"0.61696416",
"0.61296284",
"0.6096377",
"0.6028413",
"0.59721375",
"0.5937659",
"0.5856142",
"0.5798654",
"0.5762538",
"0.57485515",
"0.5737541",
"0.5726405",
"0.57173795",
"0.5708204",
"0.57026994",
"0.56904453",
"0.56760514",
"0.5674629",
"0.56727535",
"0.5668... | 0.75414157 | 0 |
Constructor with default values for ObjectCenterParams. | def __new__(cls,
classification_loss,
object_center_loss_weight,
heatmap_bias_init=-2.19,
min_box_overlap_iou=0.7,
max_box_predictions=100,
use_labeled_classes=False,
keypoint_weights_for_center=None,
center_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, arg=None, lat=None, lon=None, **kwargs):\n super(Center, self).__init__('center')\n\n # Validate arg\n # ------------\n if arg is None:\n arg = {}\n elif isinstance(arg, self.__class__):\n arg = arg.to_plotly_json()\n elif isinstanc... | [
"0.65126693",
"0.64442813",
"0.64120215",
"0.6382552",
"0.62089264",
"0.62089264",
"0.6121873",
"0.61152476",
"0.60240114",
"0.60150814",
"0.59646875",
"0.5844486",
"0.58266115",
"0.5799514",
"0.5764491",
"0.57587016",
"0.5746857",
"0.57246876",
"0.5711876",
"0.570779",
"0.56... | 0.72394943 | 0 |
Constructor with default values for DensePoseParams. | def __new__(cls,
class_id,
classification_loss,
localization_loss,
part_loss_weight=1.0,
coordinate_loss_weight=1.0,
num_parts=24,
task_loss_weight=1.0,
upsample_to_input_res=True,
upsample_meth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, model, dtype='float32', default_rand_init=True, **kwargs):\n\n super(ProjectedGradientDescent, self).__init__(model, dtype, **kwargs)\n\n self.feedable_kwargs = ('eps', 'eps_iter', 'y', 'y_target', 'clip_min',\n 'clip_max')\n \n self.str... | [
"0.57730305",
"0.57355505",
"0.56963676",
"0.56741416",
"0.5664964",
"0.56580156",
"0.56519955",
"0.5641403",
"0.56298965",
"0.56287926",
"0.56287926",
"0.56287926",
"0.55856663",
"0.55497724",
"0.5531959",
"0.5525097",
"0.551054",
"0.550414",
"0.5471807",
"0.5458993",
"0.545... | 0.69459635 | 0 |
Indent the given text prefix times the count. | def indent(text, count=1, prefix=" "):
lines = text.split("\n")
return "\n".join("{}{}".format(prefix * count, line)
for line in lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent(text, prefix, predicate=...): # -> str:\n ...",
"def indent(text, n=4):\n if not text:\n return \"\"\n i = \" \" * n\n return i + text.replace(\"\\n\", \"\\n\" + i)",
"def indent(text, prefix):\n lines = text\n newline = u\"\"\n if isinstance(text, basestring):\n ... | [
"0.70524496",
"0.6688712",
"0.6681651",
"0.65118563",
"0.63054717",
"0.6267578",
"0.6140967",
"0.60808975",
"0.60648084",
"0.5938501",
"0.59088534",
"0.58794975",
"0.58726597",
"0.5854092",
"0.5853451",
"0.5728327",
"0.57262546",
"0.5720973",
"0.5699911",
"0.56855994",
"0.568... | 0.8066405 | 0 |
Performs addition operation between 'a' and 'b' | def addition(a, b):
return a + b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, a, b):\n return a + b",
"def addition(a, b):\r\n\r\n result = a + b\r\n return result",
"def addition(self, a, b):\n if not check_arguments(a, b): # check if arguments are numbers\n self.last_result = a + b",
"def suma(a, b):\n\n\ttotal = a + b\n\treturn total",
... | [
"0.88074195",
"0.8665997",
"0.8521075",
"0.8360497",
"0.83090293",
"0.8269015",
"0.8199621",
"0.8199621",
"0.8199621",
"0.8199621",
"0.8199621",
"0.8199621",
"0.819245",
"0.81675714",
"0.81421155",
"0.8128696",
"0.8095128",
"0.8088269",
"0.80671597",
"0.80671597",
"0.8044679"... | 0.8388559 | 3 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194052",
"0.8095069",
"0.80293566",
"0.8018802",
"0.799371",
"0.7990971",
"0.7980545",
"0.7975993",
"0.79609",
"0.7957234",
"0.7937344",
"0.79343724",
"0.79341805",
"0.79310715",
"0.7926063",
"0.79241866",
"0.7923726",
"0.79229325",
"0.79226404",
"0.79218584",
"0.7917542"... | 0.7828608 | 75 |
Encodes an image represented by data to be stored | def to_internal_value(self, data):
if isinstance(data, str) and data.startswith('data:image'):
# Found image is encoded, and must be decoded
format, imgstr = data.split(';base64,')
ext = format.split('/')[-1] # Extract file extension
id = uuid.uuid4()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(self, encode_data, image):\r\n raise NotImplementedError(\"Not Implemented\")",
"def encode(self, image) -> bytes:\n raise NotImplementedError()",
"def encode(cls, data):\n t, img = data\n # Cast double time into eight 8-bit integers\n#\t\tta=np.array(binary_cast([t],'d',... | [
"0.78759325",
"0.74357474",
"0.727732",
"0.70388955",
"0.6823004",
"0.67699176",
"0.6729693",
"0.6713367",
"0.6687987",
"0.66818",
"0.6642446",
"0.6613655",
"0.6594858",
"0.65698963",
"0.65198404",
"0.6492285",
"0.64891654",
"0.64409333",
"0.64092356",
"0.63354933",
"0.632612... | 0.5880453 | 46 |
Get current method name | def current_method_name():
return inspect.currentframe().f_back.f_code.co_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getcurrentmethod(self):\n if self._methodname == None:\n print(\"No method defined.\")\n else:\n return self._methodname",
"def get_method_name(self):\n\t\treturn self.method_name",
"def _getMethodName(self):\n return self.id().split('.')[-1]",
"def method_name(... | [
"0.8912065",
"0.86348504",
"0.8338036",
"0.8009314",
"0.7711408",
"0.75289285",
"0.74549943",
"0.7418739",
"0.73832",
"0.73784715",
"0.7303027",
"0.7098494",
"0.7065827",
"0.70405465",
"0.70405465",
"0.69836044",
"0.692058",
"0.69116104",
"0.69064444",
"0.69064444",
"0.690553... | 0.8985083 | 0 |
Plot the train loss history. | def plot_train_history(self):
plt.figure()
plt.xlabel('Epochs')
plt.ylabel('Loss')
plt.plot(self.train_history.history['loss'])
plt.plot(self.train_history.history['val_loss'])
plt.legend(['Training', 'Validation'])
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_loss (history):\n \n history_dict = history.history\n loss_values = history_dict['loss']\n val_loss_values = history_dict['val_loss']\n epochs = range(1, len(loss_values) + 1)\n\n plt.plot (epochs, loss_values, 'bo', label='Training loss')\n plt.plot (epochs, val_loss_values, 'b', lab... | [
"0.84829634",
"0.8376945",
"0.8123238",
"0.809312",
"0.8064787",
"0.8059174",
"0.7892785",
"0.7846723",
"0.7832487",
"0.7650594",
"0.7634367",
"0.7618088",
"0.75950384",
"0.75878763",
"0.7586431",
"0.75783485",
"0.7569401",
"0.75667506",
"0.7561455",
"0.7550722",
"0.7547934",... | 0.8324721 | 2 |
Simulate conversion from BGR to RC (red, cyan). cyan=(255,255,0)[b,g,r] By averaging the B and G channels and storing the result in both B and G, we effectively collapse these two channels into one, C. The source and destination images must both be in BGR format. Blues and greens are replaced with cyans. | def recolorRC(src,dst):
b,g,r=cv2.split(src)
cv2.addWeighted(b,0.5,g,0.5,0,b) #arguements(in order):first src array,a weight applied
# to array, scnd src array, a weight applied to array
# a constant added to the result and a destination ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recolorCMV(src,dst):\n b,g,r=cv2.split(src)\n cv2.max(b,g,b) # max() function computes the per-element maximum of the first two arguments\n # and writes them to the third argument\n cv2.max(b,r,b)\n cv2.merge((b,g,r),dest) # b is modified to the maximum of b,g,r at every pixel",
... | [
"0.6434185",
"0.6341991",
"0.62636405",
"0.61978644",
"0.61424154",
"0.6118831",
"0.6077466",
"0.5904606",
"0.5904496",
"0.5881785",
"0.58265376",
"0.574658",
"0.5737955",
"0.57183975",
"0.56990814",
"0.5662847",
"0.56550765",
"0.563879",
"0.5581333",
"0.55711246",
"0.5552231... | 0.72491884 | 0 |
Simulate conversion from BGR to CMV (cyan, magenta, value). cyan=(255,255,0)[b,g,r] magenta=(255,0,255)[b,g,r] We can see that we can make g and r zero instead we will make b values to the per pixel maximum of b,g,r The source and destination images must both be in BGR format. | def recolorCMV(src,dst):
b,g,r=cv2.split(src)
cv2.max(b,g,b) # max() function computes the per-element maximum of the first two arguments
# and writes them to the third argument
cv2.max(b,r,b)
cv2.merge((b,g,r),dest) # b is modified to the maximum of b,g,r at every pixel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recolorRC(src,dst):\n b,g,r=cv2.split(src)\n cv2.addWeighted(b,0.5,g,0.5,0,b) #arguements(in order):first src array,a weight applied\n # to array, scnd src array, a weight applied to array\n # a constant added to the result and a desti... | [
"0.6370757",
"0.62468106",
"0.61991376",
"0.5912684",
"0.59091175",
"0.5905958",
"0.5875388",
"0.583433",
"0.58161944",
"0.57871413",
"0.5685489",
"0.5661672",
"0.56478614",
"0.5617613",
"0.55945027",
"0.55628467",
"0.5562018",
"0.5525438",
"0.54802823",
"0.5459247",
"0.54561... | 0.7281409 | 0 |
Initialize accessor with a Dataset. | def __init__(self, dataset):
self._dataset = dataset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
"def __init__(self):\n self.__dataset = None",
"def init(*args):\n global dataset\n dataset = args[0]",
"def __init__(self, *, dataset=None, aliases=None):\n self._datasets = [] if dataset is None else [dataset]\n ... | [
"0.74960923",
"0.6855466",
"0.668396",
"0.66589653",
"0.65567744",
"0.63864666",
"0.6380035",
"0.6326089",
"0.6297453",
"0.6257068",
"0.62465817",
"0.6234815",
"0.6178068",
"0.617278",
"0.61309654",
"0.6099543",
"0.6093648",
"0.60880464",
"0.6079303",
"0.60724175",
"0.6045078... | 0.73623616 | 1 |
Format time as a string. | def strftime(self, date_format):
import pandas as pd
values = self._obj.data
values_as_series = pd.Series(values.ravel())
strs = values_as_series.dt.strftime(date_format)
return strs.values.reshape(values.shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.842258",
"0.83668035",
"0.81711084",
"0.81049335",
"0.8006714",
"0.80047226",
"0.7895059",
"0.7810921",
"0.7801373",
"0.7782294",
"0.77581376",
"0.7755513",
"0.7754482",
"0.7693149",
"0.7673583",
"0.76196873",
"0.76065665",
"0.7569692",
"0.7566087",
"0.7559189",
"0.7472915... | 0.0 | -1 |
Performs the sigmoid calc which is simply a log curve forcing stuff to 1 or 0. | def sigmoid(x):
return 1/(1+np.exp(-1*x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 +... | [
"0.8177993",
"0.8149338",
"0.8149159",
"0.8133941",
"0.8133941",
"0.8132432",
"0.812955",
"0.81267005",
"0.81267005",
"0.8118901",
"0.8099625",
"0.8099625",
"0.8099625",
"0.8099625",
"0.8099625",
"0.8099625",
"0.8076784",
"0.8055159",
"0.8052514",
"0.80504465",
"0.8047998",
... | 0.80970746 | 16 |
Calculates the derivative of the sigmoid | def sigmoid_derivative(x):
return x * (1-x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))",
"def sigmoid_derivative(x):\n\n s = sigmoid(x)\n ds = s * (1 - s... | [
"0.8770965",
"0.8770965",
"0.8719737",
"0.8636591",
"0.8565048",
"0.8330988",
"0.80823755",
"0.7974485",
"0.78995675",
"0.76882166",
"0.76329345",
"0.759594",
"0.75946647",
"0.75756216",
"0.7547313",
"0.75168264",
"0.7476577",
"0.7460008",
"0.7421539",
"0.7409479",
"0.7386532... | 0.8787589 | 0 |
Factory method for instantiation of zone objects. | def zoneFactory(shape, data):
return {
"rectangle": lambda: RectangleZone(tuple(data[0:2]), tuple(data[2:4]))
}.get(shape)() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_zone(self, zone, serial=None):\r\n return self.service.createObject({\r\n 'name': zone,\r\n 'serial': serial or strftime('%Y%m%d01'),\r\n \"resourceRecords\": {}})",
"def _create_zones(self, output_path):\n for z_id in self.zone_ids:\n Z = Zone... | [
"0.68519974",
"0.66414034",
"0.6498009",
"0.6407287",
"0.6404417",
"0.63414884",
"0.6290651",
"0.62644726",
"0.62245905",
"0.6216729",
"0.6188987",
"0.6163726",
"0.61038697",
"0.6081126",
"0.60764706",
"0.5975301",
"0.59680533",
"0.59409827",
"0.5870873",
"0.5841197",
"0.5811... | 0.69934225 | 0 |
Make sure that GET is not allowed | def test_login_get(self):
resp = self.client.get(reverse('login'))
assert resp.status_code == 405 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_request_should_not_work(self):\n response = self.client.get(reverse('user-list'))\n self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)",
"def test_GET(self):\n if not self.url:\n return\n response = self.client.get(self.url, {}, format='... | [
"0.74227524",
"0.7140724",
"0.6873133",
"0.68514895",
"0.6805958",
"0.6777566",
"0.67481834",
"0.67239285",
"0.6612739",
"0.6607161",
"0.65955997",
"0.6589049",
"0.6583075",
"0.64686555",
"0.6459274",
"0.6400381",
"0.63924265",
"0.63924265",
"0.63924265",
"0.63924265",
"0.638... | 0.0 | -1 |
Verify authentication fails if password doesn't match. | def test_login_with_bad_password(self):
resp = self.client.post(
reverse('login'),
json.dumps({
"username": self.USERNAME,
"password": "",
}),
content_type="application/json"
)
assert resp.status_code == 403, resp.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_auth_password(self, username, password):\n return AUTH_FAILED",
"def test_authenticate_invalid_password(self):\r\n print(\"Authenticate user invalid password (wrong)\")\r\n username = \"admin\"\r\n password = \"password9999\"\r\n\r\n self.assertEqual(self.system.authe... | [
"0.8216879",
"0.7689805",
"0.7601966",
"0.7508238",
"0.7498868",
"0.74869287",
"0.741139",
"0.7397016",
"0.7390816",
"0.7359774",
"0.7290976",
"0.727555",
"0.72753644",
"0.72474205",
"0.7243857",
"0.72296757",
"0.72296757",
"0.72296757",
"0.72296757",
"0.72296757",
"0.7229675... | 0.0 | -1 |
Make sure we return a 400 for a missing username instead of a KeyError. | def test_login_missing_username(self):
resp = self.client.post(
reverse('login'),
json.dumps({
"password": "pass",
}),
content_type="application/json"
)
assert resp.status_code == 400, resp.content.decode('utf-8')
assert not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_missing_username(self):\n self.missing_username = {\n \"email\": \"remmyk@testcom\",\n \"password\": \"@Password123\"\n }\n\n response = self.client.post(\n self.reg_url,\n self.missing_username,\n format=\"json\")\n\n self... | [
"0.7004479",
"0.6869294",
"0.6819762",
"0.6799306",
"0.678476",
"0.6712847",
"0.668959",
"0.668959",
"0.663637",
"0.66212285",
"0.6590559",
"0.65881634",
"0.65742224",
"0.6541022",
"0.6477209",
"0.64700973",
"0.6444277",
"0.6402775",
"0.63950336",
"0.63941705",
"0.6377617",
... | 0.60773265 | 53 |
Make sure we return a 400 for a missing password instead of a KeyError. | def test_login_missing_password(self):
resp = self.client.post(
reverse('login'),
json.dumps({
"password": "pass",
}),
content_type="application/json"
)
assert resp.status_code == 400, resp.content.decode('utf-8')
assert not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_missing_password(self):\n self.missing_password = {\n \"username\": \"remmyk\",\n \"email\": \"remmyk@testcom\",\n }\n\n response = self.client.post(\n self.reg_url,\n self.missing_password,\n format=\"json\")\n\n self.asse... | [
"0.70529884",
"0.69168615",
"0.68055457",
"0.6789656",
"0.6721607",
"0.67146176",
"0.6698821",
"0.6682129",
"0.6671746",
"0.6650365",
"0.6623279",
"0.6617398",
"0.6586975",
"0.6584557",
"0.6574018",
"0.6563001",
"0.6561791",
"0.6547099",
"0.65407294",
"0.6529697",
"0.65223056... | 0.632588 | 38 |
here we write a csv file and append the new df | def history_clones(file, ht_df):
if os.path.isfile(file):
# if the file exists, we merge
print(file + ' found, merging')
df_file = pd.read_csv(file)
ht_df['timestamp'] = pd.to_datetime(ht_df['timestamp']).dt.date
df_file = pd.concat([df_file, ht_df])
df_file['timest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_tocsv(file_name, dataframe) :\n print(\"\\nSaved result to {}\\n\".format(file_name))\n dataframe.to_csv(file_name, mode='a', header=False,index=False)",
"def __append_to_csv(self, path, data):\n header = False\n mode = 'a'\n if not os.path.isfile(path):\n header =... | [
"0.7284383",
"0.71933794",
"0.7167674",
"0.7158895",
"0.7141537",
"0.71330255",
"0.7104108",
"0.7051559",
"0.7036192",
"0.69473386",
"0.69014895",
"0.6889519",
"0.6838267",
"0.6836123",
"0.68274474",
"0.6808247",
"0.6728177",
"0.6700714",
"0.67002994",
"0.6700218",
"0.6690945... | 0.0 | -1 |
If an ignore pattern matches the given URL, returns that pattern as a string. Otherwise, returns False. | def ignores(self, url, **kwargs):
pu = re.escape(kwargs.get('primary_url', ''))
ph = re.escape(kwargs.get('primary_netloc', ''))
for pattern in self.patterns:
regexp = pattern
if '{' in regexp:
regexp = regexp.replace('{primary_url}', pu).replace('{primary_netloc}', ph)
try:
if re.search(regexp,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def looks_like_fallback(url_name):\r\n return (url_name is not None\r\n and url_name.startswith(tag)\r\n and re.search('[0-9a-fA-F]{12}$', url_name))",
"def validaURL(url: AnyStr) -> bool:\n\n return re.compile(patternURL).search(url) !=... | [
"0.63519007",
"0.628549",
"0.6227969",
"0.5978178",
"0.593844",
"0.5917339",
"0.5856786",
"0.5809014",
"0.58066875",
"0.58064705",
"0.5751329",
"0.569955",
"0.56993437",
"0.5662606",
"0.56358796",
"0.563531",
"0.56188005",
"0.56082547",
"0.5605044",
"0.55984634",
"0.5575875",... | 0.742814 | 0 |
Returns a random female first name that wasn't picked before. | def get_random_female_name ():
return db_random_pop_default(DB_FIRST_FEMALE, "Jane") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name():\r\n return _random.choice([male_first(), female_first()])",
"def get_random_first_name (gender = None):\n if not gender:\n gender = random.choice(('f', 'm'))\n\n if gender == 'f':\n return get_random_female_name()\n else:\n return get_random_male_name()",
"def get_f... | [
"0.84660816",
"0.8274884",
"0.81976444",
"0.8129596",
"0.8000003",
"0.7958191",
"0.78103733",
"0.76430744",
"0.76098883",
"0.7502388",
"0.74839896",
"0.74768054",
"0.7447566",
"0.7420696",
"0.7387404",
"0.7293566",
"0.71816593",
"0.7177478",
"0.713162",
"0.71182656",
"0.71165... | 0.8522209 | 0 |
Returns a random first name that wasn't picked before. | def get_random_first_name (gender = None):
if not gender:
gender = random.choice(('f', 'm'))
if gender == 'f':
return get_random_female_name()
else:
return get_random_male_name() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_lastname_simple ():\n return db_random_pop_default(DB_LAST_SIMPLE, \"Doe\")",
"def first_name(seed):\n if consistent_hash(seed, 1):\n first = femaleNames\n else:\n first = maleNames\n return first[consistent_hash(seed, len(first))]",
"def get_random_lastname_scottish ()... | [
"0.76587445",
"0.7564253",
"0.75423384",
"0.745298",
"0.73753834",
"0.7364643",
"0.73629403",
"0.7304379",
"0.72581416",
"0.717504",
"0.71540433",
"0.7068221",
"0.70368266",
"0.69942725",
"0.6973891",
"0.6932114",
"0.68732244",
"0.68359023",
"0.68331355",
"0.6815434",
"0.6782... | 0.7264142 | 8 |
Returns a random simple last name that wasn't picked before. | def get_random_lastname_simple ():
return db_random_pop_default(DB_LAST_SIMPLE, "Doe") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_lastname_irish ():\n name = db.get_database(DB_LAST_GAELIC1).random_pop()\n if not name:\n return get_random_lastname_simple()\n return \"O'%s\" % name",
"def get_random_lastname_scottish ():\n name = db.get_database(DB_LAST_GAELIC2).random_pop()\n if not name:\n retur... | [
"0.8558808",
"0.8515264",
"0.84768635",
"0.8367983",
"0.7955368",
"0.7852522",
"0.77852225",
"0.77784175",
"0.7754999",
"0.77360153",
"0.7670817",
"0.7563988",
"0.75513554",
"0.74315995",
"0.74279505",
"0.7412499",
"0.73463833",
"0.73088163",
"0.728377",
"0.716057",
"0.710752... | 0.87215626 | 0 |
Returns a random previously unused last name ending in "s" or "son". | def get_random_lastname_nameson ():
name = db.get_database(DB_LAST_NAMESON).random_pop()
if not name:
return get_random_lastname_simple()
if name.endswith('s'):
if coinflip():
return name
else:
return "%son" % name
return "%sson" % name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_lastname_scottish ():\n name = db.get_database(DB_LAST_GAELIC2).random_pop()\n if not name:\n return get_random_lastname_simple()\n return \"%s%s\" % (random.choice(('Mc', 'Mac')), name)",
"def get_random_lastname_irish ():\n name = db.get_database(DB_LAST_GAELIC1).random_pop()\... | [
"0.8328427",
"0.81612444",
"0.7936665",
"0.78246605",
"0.7723479",
"0.76011044",
"0.75019383",
"0.7440383",
"0.7367983",
"0.7331526",
"0.73309994",
"0.7313142",
"0.7267424",
"0.7206761",
"0.6973546",
"0.69267553",
"0.6874338",
"0.68077594",
"0.68073535",
"0.6799533",
"0.67977... | 0.8447073 | 0 |
Returns a random previously unused last name beginning with "Mc" or "Mac". | def get_random_lastname_scottish ():
name = db.get_database(DB_LAST_GAELIC2).random_pop()
if not name:
return get_random_lastname_simple()
return "%s%s" % (random.choice(('Mc', 'Mac')), name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_lastname_irish ():\n name = db.get_database(DB_LAST_GAELIC1).random_pop()\n if not name:\n return get_random_lastname_simple()\n return \"O'%s\" % name",
"def get_random_lastname_nameson ():\n name = db.get_database(DB_LAST_NAMESON).random_pop()\n if not name:\n return... | [
"0.74314326",
"0.7297949",
"0.7290387",
"0.7281949",
"0.72708905",
"0.71713763",
"0.71152836",
"0.7024333",
"0.69304436",
"0.6918931",
"0.68641996",
"0.67817867",
"0.66758996",
"0.6629671",
"0.6513364",
"0.65100974",
"0.6480897",
"0.6475814",
"0.6469981",
"0.6469981",
"0.6469... | 0.826318 | 0 |
Returns a random full name, consisting of previously unused first and last names. | def get_random_fullname(gender = None, style = None):
firstname = get_random_first_name(gender)
lastname = get_random_last_name(style)
return "%s %s" % (firstname, lastname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_generator():\n firsts = [\"Albrecht\", \"Lysa\", \"Yvette\", \"Jésus\", \"Amanitus\"]\n lasts = [\"Andersson\", \"Natt och Dag\", \"av Pommern\", \"Krusmynta\"]\n\n random.seed()\n first = firsts[random.randint(0, len(firsts)-1)]\n last = lasts[random.randint(0, len(lasts)-1)]\n\n name =... | [
"0.8089306",
"0.78649807",
"0.7838972",
"0.78366333",
"0.7778385",
"0.7668927",
"0.75365156",
"0.74941",
"0.7483574",
"0.73958254",
"0.73237354",
"0.72833693",
"0.7280617",
"0.7259603",
"0.7258548",
"0.72478527",
"0.7227823",
"0.71428335",
"0.7097943",
"0.709538",
"0.70347327... | 0.76658833 | 6 |
Creates the dataset in temp folder. | def __enter__(self):
if self.seed:
np.random.seed(self.seed)
self._generate_dataset()
return self.root_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_temp_file():\n global TEST_DATA_PATH\n TEST_DATA_PATH = tempfile.mkstemp()",
"def _create_data_directory(self):\n self.src_data_dir.mkdir(exist_ok=True, parents=True)",
"def make_data(sess, data, data_dir):\n if FLAGS.is_train:\n #savepath = os.path.join(os.getcwd(), os.path.join('che... | [
"0.7280577",
"0.72483134",
"0.6918342",
"0.68888146",
"0.68499994",
"0.6743607",
"0.6693515",
"0.66885734",
"0.6623224",
"0.66179",
"0.6599566",
"0.6575475",
"0.65655",
"0.6559218",
"0.6518149",
"0.65124595",
"0.65077233",
"0.6486087",
"0.6484165",
"0.64721483",
"0.64694077",... | 0.0 | -1 |
Using the attributes of the ``self`` object, compute the coherence function of the central spin. | def compute_result(self):
result = compute_dm(self.dm0, self.cluster_hamiltonian, self.timespace, self.pulses,
as_delay=self.as_delay, states=self.states)
result = (self.alpha.conj() @ result @ self.beta) / self.zero_cluster
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coherence(self):\r\n coherence = np.abs(self.coherency ** 2)\r\n\r\n return coherence",
"def coherence(self):\r\n return np.abs(self.coherency) ** 2",
"def coherence(self):\r\n\r\n #XXX Calculate this from the standard output, instead of recalculating\r\n #the coherence:\... | [
"0.65795195",
"0.6552064",
"0.63380206",
"0.6220494",
"0.6019793",
"0.59983945",
"0.5980744",
"0.5847032",
"0.5832424",
"0.577845",
"0.576808",
"0.57624596",
"0.57449037",
"0.5740018",
"0.5731175",
"0.5687492",
"0.5673578",
"0.56608987",
"0.565903",
"0.5645997",
"0.5640379",
... | 0.0 | -1 |
Sends buy order to broker for given symbol, returns success state | def attempt_market_buy(self, decision: Decision, available_capital: float, state: Series, is_backtest: bool = False, crypto: bool = False) -> Transaction:
try: latest_price = self.latest_price(decision.symbol, state, is_backtest, crypto)
except:
print('Error retrieving latest price')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def buy(self, ctx, quantity: int, symbol: str):\r\n symbol = symbol.upper()\r\n author = ctx.author\r\n with DB() as db:\r\n company = await self.get_active_company(ctx, db, author)\r\n await self.market_open_check(ctx)\r\n await self.stock_symbol_check(c... | [
"0.7514002",
"0.7180023",
"0.70324147",
"0.6878416",
"0.68088603",
"0.67659944",
"0.67659855",
"0.6753466",
"0.6706539",
"0.664516",
"0.66325426",
"0.66146505",
"0.65942913",
"0.6571259",
"0.6568077",
"0.65575254",
"0.6479498",
"0.6472742",
"0.6470964",
"0.646399",
"0.6454741... | 0.0 | -1 |
Sends sell order to broker for given symbol, returns success state. | def attempt_market_sell(self, decision: Decision, state: Series, is_backtest: bool = False, crypto: bool = False) -> Transaction:
# Currently, selling will only support closing out our entire position
# TODO: support partial sells in the future
share_quantity = decision.quantity
try: lat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def sell(self, ctx, quantity: int, symbol: str):\r\n symbol = symbol.upper()\r\n author = ctx.author\r\n with DB() as db:\r\n company = await self.get_active_company(ctx, db, author)\r\n await self.market_open_check(ctx)\r\n await self.stock_symbol_check(... | [
"0.7174134",
"0.68435913",
"0.6778413",
"0.66953456",
"0.66870344",
"0.66473544",
"0.6621918",
"0.6569551",
"0.6565892",
"0.6542232",
"0.65211064",
"0.6424309",
"0.64109814",
"0.6370919",
"0.6340031",
"0.6320709",
"0.6288445",
"0.6273346",
"0.6262726",
"0.6215408",
"0.6171178... | 0.60634655 | 25 |
Must be a nonempty nonblank string | def non_empty_string(value):
return value and bool(value.strip()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_nonblank(value):\n return value",
"def not_set(string):\n if string is None:\n return True\n elif string == '':\n return True\n return False",
"def blank(string):\n if not string:\n return True\n else:\n return False",
"def non_empty(val):\n r... | [
"0.7557952",
"0.7427602",
"0.74087876",
"0.73724514",
"0.73544484",
"0.7348853",
"0.73143756",
"0.72413874",
"0.722367",
"0.7191773",
"0.71871674",
"0.7176619",
"0.7168436",
"0.7119794",
"0.71196413",
"0.7072993",
"0.70062375",
"0.6993206",
"0.69823974",
"0.69482905",
"0.6934... | 0.6928098 | 22 |
Assert contents of `path` in `root_path` are `expected_content`. | def assertFile(self, root_path, path, expected_content):
full_path = os.path.join(root_path, path)
self.assertFilePresent(root_path, path)
with open(full_path) as f:
content = f.read()
self.assertEqual(content, expected_content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_root_path(self) -> None:\n path = \"/\"\n with self.assertRaises(AccessDeniedException):\n verify_file_path(path)",
"def assertFilePresent(self, root_path, path):\n full_path = os.path.join(root_path, path)\n self.assertTrue(os.path.exists(full_path))",
"def as... | [
"0.62006307",
"0.6163525",
"0.6130045",
"0.60874295",
"0.5980868",
"0.5912824",
"0.58533156",
"0.57849663",
"0.57225424",
"0.56982803",
"0.56092465",
"0.5600641",
"0.5579937",
"0.55682886",
"0.5567567",
"0.5560551",
"0.5544771",
"0.5543555",
"0.5541671",
"0.55392265",
"0.5526... | 0.78971124 | 0 |
Assert `path` is not present in `root_path`. | def assertFileAbsent(self, root_path, path):
full_path = os.path.join(root_path, path)
self.assertFalse(os.path.exists(full_path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_root_path(self) -> None:\n path = \"/\"\n with self.assertRaises(AccessDeniedException):\n verify_file_path(path)",
"def assert_path(self, root: Node, path: str) -> None:\n\n if not self.__assert_path(root, path):\n raise Exception('Path \\'{}\\' not found in... | [
"0.75850636",
"0.7408851",
"0.67874944",
"0.67869896",
"0.6759113",
"0.6606713",
"0.65724665",
"0.65483767",
"0.65401334",
"0.65242654",
"0.6420914",
"0.64062566",
"0.63820213",
"0.6381146",
"0.63468784",
"0.62594914",
"0.6249793",
"0.6225411",
"0.6222038",
"0.6195861",
"0.61... | 0.76562804 | 0 |
Return a queryset of messages that are ready to be delivered. | def ready_for_delivery(self, *args, **kwargs):
return self.get_queryset().exclude(success=True).filter(
success=None, # doen't re-send failed messages
deliver_on__lte=timezone.now()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pending_messages(self):\n if self.connected and self.messenger.ready:\n new_messages = self.messenger.consume_messages()\n self.message_history += new_messages\n return new_messages\n return []",
"def get_waiting(self):\n msgs = []\n \n ... | [
"0.69016236",
"0.6606385",
"0.62710285",
"0.62710285",
"0.62710285",
"0.6136623",
"0.6113664",
"0.6107268",
"0.6103875",
"0.60931855",
"0.6036345",
"0.60313576",
"0.60288304",
"0.60288304",
"0.6014249",
"0.5991784",
"0.59796697",
"0.59796697",
"0.59570104",
"0.59486276",
"0.5... | 0.80254704 | 0 |
define vector operator as dot product or scalar | def __mul__(self,other):
if type(other) is Vector:
return(self.x*other.x + self.y*other.y + self.z*other.z)
else:
return(Vector(self.x*other,self.y*other,self.z*other)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(self, vec):\n pass",
"def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,v2)",
"def dot(self, vec):\n if not isinstance(vec, self.__class__):\n raise TypeError('Dot product operand must be a vector')\n return np.dot(self, vec)",
"def dot(self, vec):\n if not is... | [
"0.7941709",
"0.7821929",
"0.7814032",
"0.7771766",
"0.7611574",
"0.75766295",
"0.7528535",
"0.7527974",
"0.75144047",
"0.7458226",
"0.7396566",
"0.7375419",
"0.7368828",
"0.73565847",
"0.73394775",
"0.7274829",
"0.72701234",
"0.72254664",
"0.72183454",
"0.7216319",
"0.721231... | 0.6651737 | 81 |
takes hero dict and turns it into a json file in the temp directory | def temp_dump(self, session_id):
f = open(pathlib.Path(basedir).joinpath('static', 'temp', session_id, 'hero_pickle_storage.json'), 'w')
stored_info = jsonpickle.encode(self)
f.write(stored_info)
f.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_heroes(self):\n _save_dict_to_file(self.get_heroes(), \"heroes.json\")",
"def dict_to_json(videoJson, id_gloss, id_instance):\n path = \"/home/nmiguens/JSON/WLASL\"\n name = \"{}_\".format(id_gloss) + \"{}.json\".format(id_instance)\n with open(os.path.join(path, name), 'w') as fout:\n... | [
"0.7091039",
"0.64003867",
"0.63901",
"0.6322018",
"0.6248704",
"0.6216564",
"0.61909115",
"0.615786",
"0.61325943",
"0.6104164",
"0.60974294",
"0.6094752",
"0.6065597",
"0.6045562",
"0.60314107",
"0.5992805",
"0.5977145",
"0.5930217",
"0.5929588",
"0.59137434",
"0.59133977",... | 0.633614 | 3 |
Ask the user to open a file via the Open File dialog. Then open it in the tree, editor, and HTML preview windows. | def openFile(self, path=None):
if not path:
dialog = OpenDialog()
dialog.set_folders_only(False)
path = dialog.getOpenFileName(
self,
"Open File",
'',
"ReStructuredText Files (*.rst *.txt)"
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_file(self, event=None):\n file = fd.askopenfile(title=\"Choose file to open\",\n filetypes=[(\"Python(default)\", \"*.py\"), (\"Text\", \"*.txt\"),\n (\"Java\", \"*.java\"), (\"JavaScript\", \"*.js\"),\n ... | [
"0.7868996",
"0.76055104",
"0.75471425",
"0.73290884",
"0.7291483",
"0.72549504",
"0.7214934",
"0.7197818",
"0.71649337",
"0.7132247",
"0.70865434",
"0.7062686",
"0.70012957",
"0.6994414",
"0.6954499",
"0.6931873",
"0.6923955",
"0.6894769",
"0.6885217",
"0.6880751",
"0.687749... | 0.749412 | 3 |
Get the 'total_mass' property. | def total_mass(self):
return self._total_mass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mass(self):\n return self.m",
"def mass(self):\n return self._mass",
"def mass(self):\n return self._mass",
"def getMass(self):\n return self.mass",
"def mass(self):\n return self._getAttribute(Attribute.mass)",
"def total_mass_amu(self):\n return np.sum(self.mas... | [
"0.81825846",
"0.81785804",
"0.81785804",
"0.8053945",
"0.7845945",
"0.777968",
"0.76520854",
"0.7629462",
"0.7562145",
"0.75518584",
"0.7527855",
"0.7512084",
"0.7467601",
"0.73203284",
"0.72395074",
"0.7159955",
"0.7106058",
"0.699542",
"0.6983396",
"0.697798",
"0.67684656"... | 0.9032452 | 0 |
Get the 'total_mass_above_sea' property. | def total_mass_above_sea(self):
return self._total_mass_above_sea | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_mass_above_sea(self, value):\n self._total_mass_above_sea = round(value, 1)",
"def total_mass_above_sea(self):\n del self._total_mass_above_sea",
"def total_volume_above_sea(self):\n return self._total_volume_above_sea",
"def total_area_above_sea(self):\n return self._to... | [
"0.8014195",
"0.7866183",
"0.7470331",
"0.7286598",
"0.65447605",
"0.6517148",
"0.6453972",
"0.64294297",
"0.64294297",
"0.62697697",
"0.6083846",
"0.6026579",
"0.60094625",
"0.58360475",
"0.5780632",
"0.5757544",
"0.5717984",
"0.5670524",
"0.5670524",
"0.56397665",
"0.561308... | 0.90614235 | 0 |
Set the 'total_mass_above_sea' property. | def total_mass_above_sea(self, value):
self._total_mass_above_sea = round(value, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_mass_above_sea(self):\n del self._total_mass_above_sea",
"def total_mass_above_sea(self):\n return self._total_mass_above_sea",
"def total_volume_above_sea(self, value):\n self._total_volume_above_sea = round(value, 1)",
"def total_area_above_sea(self, value):\n self._to... | [
"0.801395",
"0.79372126",
"0.70492",
"0.6721706",
"0.6615291",
"0.6535065",
"0.6448502",
"0.61706585",
"0.61224073",
"0.5684014",
"0.55303913",
"0.5493042",
"0.5399108",
"0.5228619",
"0.5200366",
"0.5183193",
"0.5096595",
"0.5065484",
"0.5056304",
"0.5051122",
"0.49942833",
... | 0.8650432 | 0 |
Get the 'total_area' property. | def total_area(self):
return self._total_area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_area(self):\n return self._area",
"def total_area(self):\n del self._total_area",
"def area(self):\n return self._ned_shape.area",
"def total_area(self, value):\n self._total_area = round(value, 1)",
"def total_area(self):\n return numpy.prod([r[1] - r[0] for r in... | [
"0.76201904",
"0.75542617",
"0.7248894",
"0.72220933",
"0.7217345",
"0.7199437",
"0.7151308",
"0.7137436",
"0.70518804",
"0.70509887",
"0.7047602",
"0.7042837",
"0.70369375",
"0.70031387",
"0.69883364",
"0.6932094",
"0.69226706",
"0.6914554",
"0.6913905",
"0.6913905",
"0.6878... | 0.8885013 | 0 |
Change Email Allows users to change their email, gerating a key | def change_email(self, email):
self.active = False
self.other_email = email
self.key = EmailManager.generate_key()
self.save()
send_change_email(self, email)
return self.key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def change_email(self, new_email, password):\n data = {\"password\": password, \"emailAddress\": new_email}\n e = await self.request.request(url='https://accountsettings.roblox.com/v1/email', method='post', data=data)\n return e",
"def change_email(self, new_email):\n self.email... | [
"0.77543944",
"0.7717144",
"0.7304878",
"0.73043334",
"0.7243221",
"0.7100855",
"0.7028244",
"0.7019656",
"0.6944241",
"0.68884945",
"0.6860998",
"0.68605965",
"0.6792212",
"0.678921",
"0.66576815",
"0.6651717",
"0.65884143",
"0.6544074",
"0.6544074",
"0.6544074",
"0.6544074"... | 0.838225 | 0 |
Specifies an authentication password for use with a channel. Supported by the `webhook` channel type. | def auth_password(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "auth_password") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password(self, password):\n self.authentication.password = password",
"def set_password(self, password):\n self.PASSWORD = password",
"def set_password(self, password):\n self.password = password",
"def set_password(self, password):\n self.PASS = password",
"async def pa... | [
"0.6505954",
"0.6486821",
"0.6430074",
"0.6369605",
"0.63317364",
"0.6326619",
"0.6266032",
"0.62502366",
"0.62502366",
"0.62502366",
"0.62502366",
"0.62247205",
"0.610026",
"0.6059215",
"0.60388404",
"0.60054445",
"0.5978962",
"0.5950073",
"0.59436834",
"0.5934922",
"0.59262... | 0.56436694 | 75 |
The Slack channel to send notifications to. | def channel(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "channel") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channel(self):\n return self._channel",
"def channel(self):\n return self._channel",
"def getChannel(self):\r\n return self.channel",
"def channel_name(self) -> str:\n return self._channel_name",
"def channel(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"ch... | [
"0.6705566",
"0.6705566",
"0.6692836",
"0.66245717",
"0.6553343",
"0.6460896",
"0.64477235",
"0.64332014",
"0.63898563",
"0.634747",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
"0.6229075",
... | 0.6435009 | 7 |
Specifies the service key for integrating with Pagerduty. | def service_key(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _key(\n service=None, # type: Optional[str]\n env=None, # type: Optional[str]\n ):\n # type: (...) -> str\n service = service or \"\"\n env = env or \"\"\n return \"service:\" + service + \",env:\" + env",
"def SetAPIKey(self, api_key):\n self._api_key = api_... | [
"0.62504685",
"0.5933657",
"0.5933657",
"0.583351",
"0.5787485",
"0.5742066",
"0.57167065",
"0.56381017",
"0.56173515",
"0.55880064",
"0.55748916",
"0.55575144",
"0.5555992",
"0.5555111",
"0.5554082",
"0.5538826",
"0.5503481",
"0.5495286",
"0.5495286",
"0.5455244",
"0.5452111... | 0.6408023 | 0 |
The notification property key. | def key(self) -> pulumi.Input[str]:
return pulumi.get(self, "key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nifi_property_key(self, key):\n return key",
"def key(self):\n if \"key\" in self._prop_dict:\n return self._prop_dict[\"key\"]\n else:\n return None",
"def notification_id(self):\n return self._notification_id",
"def name(self):\n return self.prop... | [
"0.78613734",
"0.73021436",
"0.6791879",
"0.66511375",
"0.6646349",
"0.6603074",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
"0.6587076",
... | 0.0 | -1 |
The notification property value. | def value(self) -> pulumi.Input[str]:
return pulumi.get(self, "value") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notification(self):\n return self._notification",
"def notification_state(self) -> Optional[pulumi.Input['AssetPropertyNotificationState']]:\n return pulumi.get(self, \"notification_state\")",
"def value(self) -> any:\r\n\r\n return self.__value",
"def properties(self) -> pulumi.Outp... | [
"0.72827655",
"0.67489874",
"0.65632963",
"0.6533609",
"0.6511561",
"0.6489571",
"0.6479237",
"0.64791584",
"0.64791584",
"0.64608765",
"0.64608765",
"0.64608765",
"0.64403623",
"0.64403623",
"0.6426338",
"0.64220726",
"0.64201236",
"0.64201236",
"0.64201236",
"0.64151996",
"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.