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 |
|---|---|---|---|---|---|---|
List collections Display a list of existing collections. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def list(self, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.list_with_http_info(**kwargs)
else:
(data) = self.list_with_http_info(**kwargs)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collections():\n\tcollections = models.Collection.query.all()\n\tif not collections:\n\t\tabort(404)\n\tresponse = { 'collections': [c.dictionary() for c in collections] }\n\treturn jsonify(response)",
"def collections(self):\r\n\t\tself.fetch_collections()\r\n\t\treturn self._collection_names",
"async def... | [
"0.687399",
"0.6670072",
"0.65718067",
"0.6497074",
"0.6462622",
"0.6398085",
"0.6235848",
"0.61633456",
"0.6152709",
"0.5926859",
"0.5909252",
"0.5888537",
"0.57888347",
"0.57332945",
"0.5718907",
"0.5655634",
"0.559593",
"0.5558346",
"0.5372456",
"0.5315632",
"0.528751",
... | 0.0 | -1 |
List collections Display a list of existing collections. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def list_with_http_info(self, **kwargs):
all_params = []
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collections():\n\tcollections = models.Collection.query.all()\n\tif not collections:\n\t\tabort(404)\n\tresponse = { 'collections': [c.dictionary() for c in collections] }\n\treturn jsonify(response)",
"def collections(self):\r\n\t\tself.fetch_collections()\r\n\t\treturn self._collection_names",
"async def... | [
"0.68751884",
"0.6670905",
"0.6572735",
"0.64980125",
"0.63992363",
"0.6236276",
"0.61640674",
"0.6154084",
"0.59264326",
"0.59097755",
"0.5889103",
"0.57901573",
"0.5735336",
"0.5720144",
"0.565685",
"0.55974907",
"0.55583745",
"0.5374072",
"0.5315794",
"0.52878034",
"0.5251... | 0.6463537 | 4 |
List collection status Display status information about an existing collection. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def status(self, collection_id, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.status_with_http_info(collection_id, **kwargs)
else:
(data) = self.status_with_http_info(collection_id, **kwargs)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_collection_status(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"data_collection_status\"), kwargs)",
"def status_all_with_http_info(self, **kwargs):\n\n all_params = []\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n ... | [
"0.7318824",
"0.7295206",
"0.7102955",
"0.65757906",
"0.648761",
"0.63682735",
"0.6271686",
"0.61010176",
"0.5650195",
"0.5554575",
"0.55134416",
"0.5458567",
"0.5368529",
"0.52405345",
"0.5231259",
"0.51703393",
"0.51604354",
"0.515305",
"0.5146796",
"0.514557",
"0.5134877",... | 0.7648862 | 0 |
List collection status Display status information about an existing collection. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def status_with_http_info(self, collection_id, **kwargs):
all_params = ['collection_id']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self, collection_id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.status_with_http_info(collection_id, **kwargs)\n else:\n (data) = self.status_with_http_info(collection_id, **kwargs)\n return data",... | [
"0.76498777",
"0.7320169",
"0.72965443",
"0.65744203",
"0.64882004",
"0.63670534",
"0.62746984",
"0.60993844",
"0.56501114",
"0.5556244",
"0.5510795",
"0.5457642",
"0.5371547",
"0.5237347",
"0.5229406",
"0.5170643",
"0.5160109",
"0.5157322",
"0.5149478",
"0.51472837",
"0.5138... | 0.7105015 | 3 |
Normalize all embedding vectors. | def normalize(self):
self.desc += ", normalize"
self._vecs /= np.linalg.norm(self._vecs, axis=1)[:, np.newaxis]
self.reindex() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self):\n self._vectors = [vector.normalized() for vector in self._vectors]",
"def normalize_all(self):\n #for i, vector in enumerate(self.real_vectors):\n # self.real_vectors[i] /= np.linalg.norm(vector)\n self.vectors /= np.linalg.norm(self.vectors, axis=1).reshape(-... | [
"0.83022803",
"0.8190909",
"0.76430595",
"0.7528466",
"0.7522329",
"0.7250075",
"0.7131215",
"0.70423526",
"0.70193696",
"0.70022327",
"0.69961923",
"0.69843614",
"0.68938184",
"0.6850721",
"0.68306935",
"0.68139774",
"0.6787083",
"0.6719784",
"0.67014503",
"0.67006713",
"0.6... | 0.7572883 | 3 |
Inits a community op for validation and processing. | def __init__(self, actor, date):
self.date = date
self.valid = False
self.action = None
self.op = None
self.actor = actor
self.actor_id = None
self.community = None
self.community_id = None
self.account = None
self.account_id = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,evo_conf,net_conf,obs_shape,action_shape):\n\n self.evo_conf = evo_conf\n self.net_conf = net_conf\n self.obs_shape = obs_shape\n self.action_shape = action_shape\n self.n_agents = self.evo_conf['n_agents']\n self.p_mut_loc = self.evo_conf['p_mut_loc']\n ... | [
"0.5946777",
"0.58446604",
"0.5822245",
"0.5821072",
"0.5739244",
"0.5703562",
"0.5647407",
"0.5594654",
"0.5584765",
"0.5563906",
"0.5560737",
"0.55473965",
"0.5546222",
"0.5529387",
"0.5528188",
"0.5517544",
"0.5511102",
"0.55073804",
"0.5505127",
"0.5500903",
"0.54945",
... | 0.0 | -1 |
Get the environment variable that shows where a Rez package lives ondisk. | def get_root_key(name):
return "REZ_{name}_ROOT".format(name=name.upper()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetSystemPath():\n return encoding_util.GetEncodedValue(os.environ, \"PATH\")",
"def path(self):\n installed_packages_folder_path = site.getsitepackages()[0]\n return f'{installed_packages_folder_path}/{SITE_PACKAGES_FOLDER_NAME}'",
"def _get_config_path():\n return os.path.join(os.pat... | [
"0.6655901",
"0.65827096",
"0.6528853",
"0.6505154",
"0.6501025",
"0.6441061",
"0.6440439",
"0.64317113",
"0.64275205",
"0.6423109",
"0.64148045",
"0.6382649",
"0.63643265",
"0.63437146",
"0.63311845",
"0.6327205",
"0.63137686",
"0.63108826",
"0.630365",
"0.6297852",
"0.62862... | 0.0 | -1 |
Computes the accuracy over the k top predictions for the specified values of k | def cal_accuracy(self, output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8330957",
"0.8284237",
"0.82376367",
"0.8229314",
"0.8219836",
"0.81859726",
"0.8184298",
"0.8174704",
"0.8170969",
"0.8169349",
"0.81659627",
"0.81640005",
"0.8163328",
"0.8161707",
"0.8161707",
"0.8161707",
"0.8161707",
"0.8161707",
"0.8161707",
"0.8161707",
"0.8161707",... | 0.0 | -1 |
Whether nonNone DB settings are set on this instance. | def db_settings_set(self) -> bool:
return self._db_settings is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_settings(self) -> DBSettings:\n if self._db_settings is None:\n raise ValueError(\"No DB settings are set on this instance.\")\n return not_none(self._db_settings)",
"def has_configuration_set():\r\n return getattr(settings, \"MICROSITE_CONFIGURATION\", False)",
"def in_smart... | [
"0.8010844",
"0.6257641",
"0.61342895",
"0.6113809",
"0.6091597",
"0.60814935",
"0.6062348",
"0.60489297",
"0.6039835",
"0.60359865",
"0.5959397",
"0.5921009",
"0.5916373",
"0.5904241",
"0.5895474",
"0.5873816",
"0.5869111",
"0.5860813",
"0.58566284",
"0.5839428",
"0.58338577... | 0.86004394 | 0 |
Draws a straight line to pyglet window with the current stroke color and strokewidth. | def pygDraw(self, **kwargs):
# --> following code from nodebox.context
#fill, stroke, strokewidth, strokestyle = color_mixin(**kwargs)
#if stroke is not None and strokewidth > 0:
# glColor4f(stroke[0], stroke[1], stroke[2], stroke[3] * _alpha)
# glLineWidth(strokewidth)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_line(color, start_pos, end_pos, width=1):\n pygame.draw.line(screen, color, start_pos, end_pos, width)",
"def wdraw_line(self, wx0, wy0, wx1, wy1, color, arrow):\r\n dx0, dy0 = self.w_to_d(wx0, wy0)\r\n dx1, dy1 = self.w_to_d(wx1, wy1)\r\n self.canvas.create_line(dx0, dy0, dx... | [
"0.7118551",
"0.7040961",
"0.692802",
"0.69200665",
"0.6827558",
"0.6821803",
"0.67982286",
"0.6713829",
"0.66723406",
"0.6666433",
"0.6637436",
"0.65532446",
"0.6507654",
"0.6501411",
"0.64963406",
"0.6488183",
"0.6483741",
"0.64747334",
"0.6469857",
"0.6451863",
"0.64367175... | 0.6600538 | 11 |
Expects either limit and value or at least one of lower_limit or upper_limit. If limit and value are set lower_limit and upper_limit are ignored. | def __init__(self, limit:Limit=None, value:Union[int, float]=None,
lower_limit:Union[int, float]=None, upper_limit:Union[int, float]=None,
band:Band=None):
super().__init__()
self.__band = band
self.__has_lower:bool = False
self.__has_upper:bool = False
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limitValue(self, value, lowerLimit, upperLimit):\n if value > upperLimit:\n return upperLimit\n elif value < lowerLimit:\n return lowerLimit\n else:\n return value",
"def constrain(inputVal, lower_limit, upper_limit):\n \n if (inputVal < lower_limit... | [
"0.74107367",
"0.7370407",
"0.7243274",
"0.71609575",
"0.66584694",
"0.6617967",
"0.6563175",
"0.6437654",
"0.63925624",
"0.6381473",
"0.6375579",
"0.6371062",
"0.63150847",
"0.6292891",
"0.62810653",
"0.62739414",
"0.6271589",
"0.62288606",
"0.61238295",
"0.6119051",
"0.6085... | 0.69533974 | 4 |
Evaluates an ondiagonal 2nd derivative term | def diff_2nd_xx(fp, f0, fm, eps):
return (fp - 2.0*f0 + fm)/eps**2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dKdiag_dtheta(self,dL_dKdiag,X,target):\r\n target[0] += np.sum(dL_dKdiag)",
"def _evalAndDer(self, x):\n m = len(x)\n fx = np.zeros((m, self.funcCount))\n for j in range(self.funcCount):\n fx[:, j] = self.functions[j](x)\n i = self.argcompare(fx, axis=1)\n ... | [
"0.63147616",
"0.6291587",
"0.6291587",
"0.6290171",
"0.6249235",
"0.62457573",
"0.6211949",
"0.6206728",
"0.61930454",
"0.6161145",
"0.61384857",
"0.61339617",
"0.61339617",
"0.6131549",
"0.61272603",
"0.61156124",
"0.61079675",
"0.60915077",
"0.603382",
"0.6026479",
"0.6016... | 0.0 | -1 |
Evaluates an offdiagonal 2nd derivative term | def diff_2nd_xy(fpp, fpm, fmp, fmm, eps1, eps2):
return (fpp - fpm - fmp + fmm)/(4.0*eps1*eps2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def second_derivative(self,show=False):\n\n df = [None]\n d2f = [None]\n\n # Take first difference: f1 = (f(x+dx)-f(x))/dx\n for i in range(0,len(self.ans)-1,1):\n df += [int((self.ans[i+1][1] - self.ans[i][1]) / (self.ans[i+1][0] - self.ans[i][0]))]\n\n for i in range... | [
"0.6565482",
"0.64000416",
"0.63166684",
"0.63166684",
"0.62802076",
"0.62552905",
"0.62384117",
"0.6202465",
"0.6193154",
"0.6174099",
"0.61361754",
"0.6095791",
"0.60910845",
"0.608055",
"0.6074318",
"0.6015509",
"0.60114175",
"0.6006348",
"0.60008484",
"0.5968598",
"0.5966... | 0.0 | -1 |
Returns the derivative of output_name with respect to wrt. | def get_derivative(self, output_name, wrt):
return self.gradient[wrt][output_name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_2nd_derivative(self, output_name, wrt):\n \n return self.hessian[wrt[0]][wrt[1]][output_name]",
"def find_derivative(name: str):\n return _derivatives[name]",
"def _derivative_(self, x, diff_param=None):\n return 2*exp(-x**2)/sqrt(pi)",
"def get_gradient(self, output_name=None... | [
"0.794627",
"0.6320714",
"0.6095984",
"0.60070467",
"0.5971002",
"0.5934078",
"0.58912855",
"0.57599115",
"0.5751379",
"0.57422125",
"0.5739002",
"0.57238007",
"0.5716149",
"0.5715266",
"0.5707183",
"0.56966895",
"0.56966895",
"0.56966895",
"0.56966895",
"0.56952906",
"0.5676... | 0.8644599 | 0 |
Retrieve the entities that are linked to this equipment. This is a convenience around the session find_entity method. | def find_entity(self, filter_expr=None, limit=None,
single=False, callback=None):
equip_ref = hszinc.dump_scalar(self.id)
if filter_expr is None:
filter_expr = 'equipRef==%s' % equip_ref
else:
filter_expr = '(equipRef==%s) and (%s)' % (equip_ref, filter_expr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entities(self):\n return self._entities",
"def get_all_entities(self):\n return Artifact.get_all()",
"def get_entities(self):\n return list(self._entities.values())",
"def get_entities(self, row_id):\n return self.get(row_id).entities",
"def get_entities():\n entities... | [
"0.68776244",
"0.645709",
"0.6314943",
"0.6108176",
"0.6002822",
"0.59412587",
"0.5895537",
"0.58570576",
"0.5789227",
"0.57545155",
"0.5671522",
"0.5669392",
"0.55909073",
"0.55658805",
"0.548643",
"0.54675347",
"0.5464098",
"0.5456616",
"0.5394486",
"0.5380945",
"0.5379679"... | 0.5427879 | 18 |
Get the value of the indexth node in the linked list. If the index is invalid, return 1. | def get(self, index: int) -> int:
node = self.get_node(index)
if node:
return node.val
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index: int) -> int:\n cnt = 0\n cur = self.head \n while cur != None:\n if(cnt == index):\n return cur.val\n cur = cur.next \n cnt += 1\n return -1",
"def get(self, index):\n cur = self.head\n while cur and in... | [
"0.82228374",
"0.810132",
"0.798225",
"0.797223",
"0.7966857",
"0.7952263",
"0.7949584",
"0.7928148",
"0.79057187",
"0.78002805",
"0.7736932",
"0.77319723",
"0.7650963",
"0.75840414",
"0.7507434",
"0.74747777",
"0.7453931",
"0.7387386",
"0.7387386",
"0.7384746",
"0.73363584",... | 0.83084565 | 0 |
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list. | def addAtHead(self, val: int) -> None:
if self.head:
temp_node = MyListNode(val, next_node=self.head, prev_node=None)
self.head.prev = temp_node
self.head = temp_node
self.node_count += 1
else:
self.head = MyListNode(val)
self.node_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_node",
"def addAtHead(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n node.next = self.head\n self.head = ... | [
"0.7890199",
"0.7812391",
"0.77156895",
"0.7667366",
"0.7633173",
"0.7596094",
"0.75860196",
"0.75715685",
"0.75026643",
"0.7480735",
"0.74631685",
"0.7429043",
"0.74087286",
"0.73821265",
"0.7349201",
"0.7349201",
"0.72856104",
"0.72476804",
"0.72358054",
"0.7174488",
"0.714... | 0.74938554 | 9 |
Append a node of value val to the last element of the linked list. | def addAtTail(self, val: int) -> None:
'''node = self.head
if node:
while True:
if node.next:
node = node.next
else:
node.next = MyListNode(val,next_node=None,prev_node=node)
break
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, val):\n inserted_node = DblNode(val, previous_node=self.tail)\n self.tail.next_node = inserted_node\n self.tail = inserted_node",
"def addAtTail(self, val):\n if self.head is None:\n self.addAtHead(val)\n else:\n new_node = Node(val)\n ... | [
"0.80130863",
"0.79794717",
"0.78928936",
"0.7879162",
"0.7879162",
"0.7856019",
"0.7782996",
"0.7744707",
"0.77368987",
"0.7721728",
"0.76904315",
"0.7632201",
"0.76267153",
"0.7550089",
"0.7521708",
"0.74483246",
"0.7416057",
"0.73196465",
"0.72394246",
"0.7223336",
"0.7216... | 0.7530205 | 14 |
Add a node of value val before the indexth node in the linked list. If index equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted. | def addAtIndex(self, index: int, val: int) -> None:
if 0 < index < self.node_count:
prev_neighbor = self.get_node(index - 1)
next_neighbor = prev_neighbor.next
temp_node = MyListNode(val)
prev_neighbor.next = temp_node
temp_node.next = next_neighbor
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addAtIndex(self, index, val):\n if index < 0:\n new_node = ListNode(val)\n new_node.next = self.head\n self.head = new_node\n\n if index <= self.length:\n prev = None\n curr = self.head\n for i in range(1, index + 1):\n ... | [
"0.80046964",
"0.79041296",
"0.78416246",
"0.78006274",
"0.77555406",
"0.77421355",
"0.77419406",
"0.77292615",
"0.7707864",
"0.7617294",
"0.7611701",
"0.7611701",
"0.75009197",
"0.7281883",
"0.720867",
"0.7153189",
"0.7090287",
"0.70244604",
"0.70220435",
"0.7016665",
"0.692... | 0.75959724 | 12 |
Plots a confusion matrix of the model predictions to evaluate accuracy | def plot_confusion_matrix(self):
interp = ClassificationInterpretation.from_learner(self.learn)
interp.plot_confusion_matrix() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(name, trained_predictor, X_test, y_test):\n\n fig, ax = plt.subplots()\n fig.tight_layout()\n cm = confusion_matrix(y_test, trained_predictor.predict(X_test), normalize=\"all\")\n ConfusionMatrixDisplay(cm, display_labels=[\"False\", \"True\"]).plot(\n ax=ax\n )\n ... | [
"0.7954949",
"0.79269266",
"0.7894503",
"0.7827766",
"0.78108096",
"0.7801344",
"0.7790977",
"0.77880204",
"0.7729956",
"0.7723762",
"0.77151185",
"0.76916933",
"0.76525074",
"0.7649402",
"0.7639235",
"0.7628763",
"0.75990075",
"0.7597474",
"0.7595721",
"0.7591373",
"0.758781... | 0.8134829 | 0 |
Add app messages to context. | def messages(request):
ctx = {}
messages = get_messages(request)
if messages:
ctx['mesgs'] = messages
return ctx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_app(self):\n \n pass",
"def get_app_message(self):\n return self.messages[\"app\"].get()",
"def init_app(self, app):\n\n if not hasattr(app, 'extensions'):\n app.extensions = {}\n app.extensions['mixconn'] = self\n app.context_processor(lambda: {'mix... | [
"0.6293802",
"0.59380424",
"0.5907387",
"0.5889862",
"0.5763125",
"0.5606945",
"0.56038916",
"0.5568187",
"0.556246",
"0.55386215",
"0.55042225",
"0.54550314",
"0.54425555",
"0.5426857",
"0.54005486",
"0.53776485",
"0.5357521",
"0.5357521",
"0.5357521",
"0.53525347",
"0.53438... | 0.6333382 | 0 |
Override the == operator | def __eq__(self, oth):
return int(self) != oth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pas... | [
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269872",
"0.8269062",
"0.8269062",
"0.8269062",
"0.8269062",
"0.8269062",
"0.8269062",
"0.8269062",
"0.8269062",
"0.8269062",
"0.8269062",
"... | 0.7525679 | 78 |
Override the != operator | def __ne__(self, oth):
return int(self) == oth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return not (self == other) # opposite of __eq__",
"def __ne__(self,other):\n return not self == other",
"def __ne__(self,other):\n return not (self == other)",
"def __ne__(self, other):\n return not (self == other) # opposite of __e... | [
"0.8577962",
"0.8519671",
"0.8512088",
"0.85000825",
"0.84777975",
"0.8471436",
"0.8471436",
"0.84658766",
"0.84658766",
"0.84611464",
"0.84611464",
"0.84611464",
"0.8452583",
"0.8452583",
"0.8452583",
"0.8452583",
"0.84486645",
"0.8438222",
"0.843811",
"0.84201473",
"0.84174... | 0.0 | -1 |
Returns True if the input array is zero (smaller than machine precision) everywhere. Useful for determining if tilt angle is zero everywhere (i.e. LFM file is in GSM coordinates). | def __isZeroEverywhere(self, array):
epsilon = numpy.finfo( type(array[0]) ).eps
boolList = numpy.less_equal(numpy.abs(array), epsilon)
for b in boolList:
if not b:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iszero(a: float) -> bool:\n return np.isclose(a, 0.0, atol=1.0e-12, rtol=0.0)",
"def is_zero(self):\n for t in self:\n if t != TRIT_ZERO:\n return False\n return True",
"def is_close_to_zero(value: Union[float, np.ndarray]) -> Union[bool, np.ndarray]:\n ret... | [
"0.7329743",
"0.71980375",
"0.7180356",
"0.6959584",
"0.68835986",
"0.6858602",
"0.6843292",
"0.6754056",
"0.67275715",
"0.6671207",
"0.66645455",
"0.66500664",
"0.6643579",
"0.6640681",
"0.6592677",
"0.6558841",
"0.64952725",
"0.64739907",
"0.6471248",
"0.64580184",
"0.63760... | 0.7982687 | 0 |
Function that takes an image and slices it into multiple smaller images return in a numpy array | def slice_image(img, width, height=None, step_size=1):
if height is None:
height = width # make it a square
img = np.array(img)
nrows, ncols = img.shape[0], img.shape[1]
output_size = floor((ncols - width)/step_size) \
* floor((nrows - height)/step_size)
res = np.zeros([height, wid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def img_to_slices(img):\n res = []\n\n for i, slice_img in enumerate(img):\n res.append(slice_img)\n return res",
"def slice_array():\n img = Image.open(\"flamingo.jpg\")\n image_as_array = np.array(img)\n width, height, depth = image_as_array.shape\n\n red_channel = image_as_array[:,... | [
"0.7572069",
"0.72821856",
"0.7207373",
"0.68874985",
"0.67716527",
"0.6730279",
"0.6572376",
"0.64996713",
"0.64352185",
"0.6386494",
"0.6274756",
"0.62692267",
"0.62281674",
"0.6210625",
"0.62043405",
"0.62037164",
"0.6188291",
"0.6188291",
"0.6184772",
"0.6123642",
"0.6096... | 0.6509245 | 7 |
Convert a full, detailed profile into a more general summarized one using conversion table stored in the database | def convert_profile(condition_to_tissue, profile_data, use_means=True):
tissues = list(set(condition_to_tissue["conversion"].values()))
output = {}
for t in tissues:
valid_conditions = [
k
for k in profile_data["data"]
if k in conditi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_profiles(profiles):\n # keep_attributes = str.split(\"user_id public completion_percentage gender region last_login registration age\")\n # p2=profiles[keep_attributes]\n p2 = profiles\n p2['region'] = p2['region'].astype('category')\n p2['public'] = p2['public'].astype('category')\n ... | [
"0.611189",
"0.56424725",
"0.55239695",
"0.5443105",
"0.5416968",
"0.53870475",
"0.5322993",
"0.52558523",
"0.52462614",
"0.5241005",
"0.52230895",
"0.52125657",
"0.52013993",
"0.5186525",
"0.5165514",
"0.5153287",
"0.51437217",
"0.511586",
"0.50937396",
"0.50918144",
"0.5077... | 0.51387066 | 17 |
Returns True if the customer has not reached the checkout for the second time yet, False otherwise. | def is_active(self):
if self.state[0] == 'checkout':
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_active(self):\n return self.state_after != 'checkout'",
"def is_checked_out(self):\n return self._checkout_date is not None",
"def is_active(self):\n if self.state != 'checkout':\n return True \n if self.state == 'checkout':\n return False",
"def is_a... | [
"0.64943844",
"0.6471514",
"0.63238454",
"0.6076517",
"0.60423493",
"0.6021483",
"0.5993252",
"0.59383565",
"0.5879028",
"0.5874628",
"0.5846856",
"0.5832326",
"0.5771171",
"0.5763445",
"0.5666333",
"0.56604666",
"0.56538415",
"0.5634491",
"0.5615523",
"0.5596557",
"0.5588341... | 0.6362742 | 2 |
Returns selected="selected" if the option value matches field's default Used directly in widget templates | def is_option_selected(option, field):
if field.attr.default and option[0] == field.attr.default: # and option[0] != self.empty:
return ' selected="selected"'
else:
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_SelectChoiceDefault(request):\n schema = schemaish.Structure()\n schema.add('mySelect', schemaish.Integer())\n options = [(1,'a'),(2,'b'),(3,'c')]\n\n form = formish.Form(schema, 'form')\n form['mySelect'].widget = formish.SelectChoice(options)\n form['mySelect'].default = 2\n return ... | [
"0.65975666",
"0.6416188",
"0.6191291",
"0.6049021",
"0.604218",
"0.5977653",
"0.597259",
"0.5937122",
"0.5825413",
"0.5796056",
"0.5770259",
"0.5767324",
"0.5749384",
"0.5735948",
"0.5734999",
"0.57267016",
"0.56422603",
"0.56007797",
"0.5600718",
"0.55645937",
"0.55640537",... | 0.84386253 | 0 |
Instanciate an API client | def api_authentication(token, secret):
api = twitter.Twitter(auth=twitter.OAuth(token, secret,
CONSUMER_KEY, CONSUMER_SECRET))
if not api:
print("Authentication failed, try running the script one more time")
# delete data from the configuration file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_client() -> APIClient:\n return APIClient()",
"def __init__(self, app_key=None, app_sid=None, base_url=None,\n api_version=None, debug=False, proxy=None):\n configuration = Configuration(app_key=app_key,\n app_sid=app_sid,\n ... | [
"0.7688457",
"0.76408595",
"0.76347566",
"0.7618678",
"0.7615188",
"0.75733507",
"0.75380224",
"0.7436252",
"0.7421815",
"0.72405326",
"0.722453",
"0.7191436",
"0.7185233",
"0.71746737",
"0.7174336",
"0.70632106",
"0.7032717",
"0.70269567",
"0.69906324",
"0.6939836",
"0.69269... | 0.0 | -1 |
edge detection using skimage canny | def edge_detec(img,sigma_val):
edges = feature.canny(img, sigma=sigma_val)
return edges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canny_edge(self):\n self.frame = cv.Canny(self.frame, 100, 200)",
"def canny(self,img):\n return cv2.Canny(img, self.low_threshold, self.high_threshold)",
"def run_canny_edge_detection(image, min_threshold=100, max_threshold=150):\n return cv2.Canny(image, min_threshold, max_threshold)",
... | [
"0.7585274",
"0.75431675",
"0.749728",
"0.7467745",
"0.74551463",
"0.7448235",
"0.7442619",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
"0.7410827",
... | 0.66760707 | 35 |
An optional description of this resource. | def description(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "description") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optio... | [
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823"... | 0.0 | -1 |
Name of the resource. Provided by the client when the resource is created. The name must be 163 characters long, and comply with RFC1035. Specifically, the name must be 163 characters long and match the regular expression `az?` which means the first character must be a lowercase letter, and all following characters mus... | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self, name):\n return super(KeyVaultTestCase, self).get_resource_name(\"livekvtest{}\".format(name))",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def name(self):\n return self.raw_resource[\"name\"]",
"def resource_name(self) -> Optional[st... | [
"0.62733287",
"0.6190639",
"0.6170485",
"0.6089961",
"0.6089961",
"0.60240793",
"0.60240793",
"0.60240793",
"0.60240793",
"0.60240793",
"0.599506",
"0.5944701",
"0.5908471",
"0.5860821",
"0.5829856",
"0.5823604",
"0.5823604",
"0.5801978",
"0.5798875",
"0.5595935",
"0.5581064"... | 0.0 | -1 |
Creates a unique name beginning with the specified prefix. Conflicts with `name`. | def name_prefix(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name_prefix") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.format(prefix, suffix)",
"def prefix_id(self, name):\n if \":\" in name: return name\n return self.prefix + \":\" + name",
"def _prefix_name(self, name: str) -> str:\n name_to_check: str = name.split(\".\", ... | [
"0.8195386",
"0.7412632",
"0.7311378",
"0.7266671",
"0.72004753",
"0.7194196",
"0.71685916",
"0.704199",
"0.7006226",
"0.69408906",
"0.6851571",
"0.6812473",
"0.6740329",
"0.6735273",
"0.6682095",
"0.6674863",
"0.66349596",
"0.66146654",
"0.660699",
"0.65408987",
"0.6521067",... | 0.5849593 | 94 |
Creation timestamp in RFC3339 text format. | def creation_timestamp(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "creation_timestamp") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_time_str(self):\n return \"%Y/%m/%d %I:%M:%S\".format(self.creation_time)",
"def creation_time(self) -> str:\n return pulumi.get(self, \"creation_time\")",
"def creation_time(self) -> str:\n return pulumi.get(self, \"creation_time\")",
"def creation_time(self) -> str:\n ... | [
"0.8173928",
"0.78463787",
"0.78463787",
"0.78463787",
"0.7843217",
"0.7843217",
"0.7843217",
"0.7641064",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
"0.7421001",
... | 0.7116159 | 38 |
An optional description of this resource. | def description(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "description") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optio... | [
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856",
"0.77535856"... | 0.0 | -1 |
Expire time of the certificate in RFC3339 text format. | def expire_time(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "expire_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def getCertificateExpireDate(self):\n cert = self.get... | [
"0.73293155",
"0.73293155",
"0.73293155",
"0.71716243",
"0.70710856",
"0.70710856",
"0.69550985",
"0.66104823",
"0.6462175",
"0.6302252",
"0.62939817",
"0.62465584",
"0.62312704",
"0.613301",
"0.61103344",
"0.60917413",
"0.60483515",
"0.59664065",
"0.59664065",
"0.5936878",
"... | 0.6550289 | 9 |
Name of the resource. Provided by the client when the resource is created. The name must be 163 characters long, and comply with RFC1035. Specifically, the name must be 163 characters long and match the regular expression `az?` which means the first character must be a lowercase letter, and all following characters mus... | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self, name):\n return super(KeyVaultTestCase, self).get_resource_name(\"livekvtest{}\".format(name))",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def name(self):\n return self.raw_resource[\"name\"]",
"def resource_name(self) -> Optional[st... | [
"0.62737674",
"0.6191146",
"0.617125",
"0.6090576",
"0.6090576",
"0.60244405",
"0.60244405",
"0.60244405",
"0.60244405",
"0.60244405",
"0.5996516",
"0.5946341",
"0.59084123",
"0.58605087",
"0.5830729",
"0.58246714",
"0.58246714",
"0.5802521",
"0.5798447",
"0.55972546",
"0.558... | 0.0 | -1 |
Creates a unique name beginning with the specified prefix. Conflicts with `name`. | def name_prefix(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name_prefix") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.format(prefix, suffix)",
"def prefix_id(self, name):\n if \":\" in name: return name\n return self.prefix + \":\" + name",
"def _prefix_name(self, name: str) -> str:\n name_to_check: str = name.split(\".\", ... | [
"0.8195386",
"0.7412632",
"0.7311378",
"0.7266671",
"0.72004753",
"0.7194196",
"0.71685916",
"0.704199",
"0.7006226",
"0.69408906",
"0.6851571",
"0.6812473",
"0.6740329",
"0.6735273",
"0.6682095",
"0.6674863",
"0.66349596",
"0.66146654",
"0.660699",
"0.65408987",
"0.6521067",... | 0.5849593 | 93 |
Creation timestamp in RFC3339 text format. | def creation_timestamp(self) -> pulumi.Output[str]:
return pulumi.get(self, "creation_timestamp") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_time_str(self):\n return \"%Y/%m/%d %I:%M:%S\".format(self.creation_time)",
"def creation_time(self) -> str:\n return pulumi.get(self, \"creation_time\")",
"def creation_time(self) -> str:\n return pulumi.get(self, \"creation_time\")",
"def creation_time(self) -> str:\n ... | [
"0.81731606",
"0.784541",
"0.784541",
"0.784541",
"0.7841992",
"0.7841992",
"0.7841992",
"0.76399773",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0.7419638",
"0... | 0.7400766 | 27 |
An optional description of this resource. | def description(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "description") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optional[str]:\n return pulumi.get(self, \"description\")",
"def description(self) -> Optio... | [
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823",
"0.77533823"... | 0.0 | -1 |
Expire time of the certificate in RFC3339 text format. | def expire_time(self) -> pulumi.Output[str]:
return pulumi.get(self, "expire_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def getCertificateExpireDate(self):\n cert = self.get... | [
"0.7328243",
"0.7328243",
"0.7328243",
"0.71711046",
"0.69547725",
"0.66100824",
"0.6548652",
"0.6548652",
"0.6461065",
"0.63018787",
"0.6292543",
"0.62472194",
"0.6230739",
"0.6132218",
"0.611096",
"0.60904545",
"0.60512906",
"0.5966119",
"0.5966119",
"0.5936379",
"0.5919215... | 0.70698017 | 5 |
Name of the resource. Provided by the client when the resource is created. The name must be 163 characters long, and comply with RFC1035. Specifically, the name must be 163 characters long and match the regular expression `az?` which means the first character must be a lowercase letter, and all following characters mus... | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self, name):\n return super(KeyVaultTestCase, self).get_resource_name(\"livekvtest{}\".format(name))",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def name(self):\n return self.raw_resource[\"name\"]",
"def resource_name(self) -> Optional[st... | [
"0.62743795",
"0.6191303",
"0.61712724",
"0.6090316",
"0.6090316",
"0.6024405",
"0.6024405",
"0.6024405",
"0.6024405",
"0.6024405",
"0.59956753",
"0.59458935",
"0.5909366",
"0.5860528",
"0.58303773",
"0.582491",
"0.582491",
"0.5803337",
"0.5798448",
"0.55974835",
"0.5581133",... | 0.0 | -1 |
Creates a unique name beginning with the specified prefix. Conflicts with `name`. | def name_prefix(self) -> pulumi.Output[str]:
return pulumi.get(self, "name_prefix") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.format(prefix, suffix)",
"def prefix_id(self, name):\n if \":\" in name: return name\n return self.prefix + \":\" + name",
"def _prefix_name(self, name: str) -> str:\n name_to_check: str = name.split(\".\", ... | [
"0.8196156",
"0.741393",
"0.73123384",
"0.726756",
"0.72011584",
"0.71964794",
"0.71705973",
"0.7043072",
"0.70082206",
"0.69417495",
"0.6853965",
"0.68137413",
"0.6742179",
"0.6736858",
"0.66841197",
"0.66773605",
"0.66360354",
"0.6615448",
"0.660757",
"0.6542703",
"0.652160... | 0.5883708 | 76 |
should set `model` to owner when instance is None | def test_sets_model_to_owner(self):
self.assertEqual(self.Test.foo.model, self.Test) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self, request, obj, form, change):\n try:\n owner = form.instance.owner\n except models.Application.owner.RelatedObjectDoesNotExist:\n form.instance.owner = request.user\n\n super().save_model(request, obj, form, change)",
"def pre_save(self, obj):\n ... | [
"0.7634998",
"0.67302233",
"0.66623086",
"0.66623086",
"0.66623086",
"0.64856637",
"0.64180213",
"0.64180213",
"0.64180213",
"0.64180213",
"0.63496315",
"0.6301929",
"0.62846565",
"0.62515026",
"0.62515026",
"0.62515026",
"0.62515026",
"0.6190546",
"0.61800027",
"0.6162175",
... | 0.7304472 | 1 |
Generate a weight variable of a given shape. | def _weight_variable(self, shape, name="", dtype=tf.float32):
# weights are drawn from a normal distribution with std 0.1 and mean 0.
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial, dtype=dtype, name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_weight_variable(shape):\n\n\tinitial = tf.truncated_normal(shape, stddev=0.1)\n\treturn tf.Variable(initial)",
"def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)",
"def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n ret... | [
"0.8355896",
"0.82821894",
"0.82712024",
"0.8241647",
"0.8236564",
"0.8236564",
"0.8236564",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.8217846",
"0.82067746",
"0.8167463",
"0.... | 0.8145685 | 20 |
Generate a weight variable of a given shape. | def weight_variable(self, shape, name="", dtype=tf.float32):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial,dtype=dtype,name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_weight_variable(shape):\n\n\tinitial = tf.truncated_normal(shape, stddev=0.1)\n\treturn tf.Variable(initial)",
"def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)",
"def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n ret... | [
"0.8355896",
"0.82821894",
"0.82712024",
"0.8241647",
"0.8236564",
"0.8236564",
"0.8236564",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.82341045",
"0.8217846",
"0.82067746",
"0.8167463",
"0.... | 0.79618084 | 24 |
Return a 2d convolution layer with full stride. | def conv2d(self, x, W, name=""):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding="VALID", name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _conv2d(self, x, W):\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def conv2d(x, W):\r\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def conv2d(x, W):\r\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def _conv2d(x, W):\n ... | [
"0.751631",
"0.74794585",
"0.74794585",
"0.74736035",
"0.74505603",
"0.74505603",
"0.74505603",
"0.74505603",
"0.73997504",
"0.7391001",
"0.7386517",
"0.73344606",
"0.7302042",
"0.7262597",
"0.72488296",
"0.7228992",
"0.7227194",
"0.7226937",
"0.72096276",
"0.7184229",
"0.717... | 0.7236857 | 15 |
Gets the next trash day for a given date | def next_regular_trash_day(date: str) -> str:
parsed_date = parser.parse(date)
day_of_week = parsed_date.weekday()
if day_of_week < TRASH_DAY:
delta = TRASH_DAY - day_of_week
elif day_of_week == TRASH_DAY:
delta = 0
else:
delta = 7 - (day_of_week - TRASH_DAY)
next_trash... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_day(date):\n return date + datetime.timedelta(days=1)",
"def next_day(date):\n return date + datetime.timedelta(days=1)",
"def _next_trading_day(self, day):\n next_day = self._trading_days.shift(-1)[day]\n return next_day if not pd.isnull(next_day) else None",
"def get_next_day(s... | [
"0.76969635",
"0.76969635",
"0.70977765",
"0.704082",
"0.66516757",
"0.6224729",
"0.6222216",
"0.61540645",
"0.6137545",
"0.6133715",
"0.6121568",
"0.59999067",
"0.59967107",
"0.59871405",
"0.59871405",
"0.5984374",
"0.58846253",
"0.58306783",
"0.579761",
"0.57365865",
"0.569... | 0.82727396 | 0 |
gets the next trash day taking holidays into consideration | def next_trash_day(date: str, holidays: list) -> dict:
next_regular = next_regular_trash_day(date)
weekdays = get_weekdays(next_regular)
default_trash_day = {'type': 'default', 'schedule': calendar.day_name[TRASH_DAY]}
if holiday.contains_holiday(weekdays):
holiday_name = holiday.get_holiday(wee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_day(self):\n pass",
"def next_regular_trash_day(date: str) -> str:\n parsed_date = parser.parse(date)\n day_of_week = parsed_date.weekday()\n\n if day_of_week < TRASH_DAY:\n delta = TRASH_DAY - day_of_week\n elif day_of_week == TRASH_DAY:\n delta = 0\n else:\n ... | [
"0.70619345",
"0.69836265",
"0.69702566",
"0.6622131",
"0.64956003",
"0.6239636",
"0.6239636",
"0.6213379",
"0.61707443",
"0.61419547",
"0.61302257",
"0.61245453",
"0.6110192",
"0.6090458",
"0.6057315",
"0.60220957",
"0.6020746",
"0.60141313",
"0.5966333",
"0.5921652",
"0.590... | 0.7244827 | 0 |
Yield successive nsized chunks from lst. | def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"de... | [
"0.83071756",
"0.81939614",
"0.81910837",
"0.81910837",
"0.8190213",
"0.81267184",
"0.80773693",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",... | 0.81218547 | 7 |
Return the device state attributes. | def extra_state_attributes(self) -> dict[str, Any] | None:
return {"fault_code": self._heater.status["fault_code"]} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self._attrs",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self... | [
"0.93173087",
"0.9245708",
"0.92207897",
"0.92147964",
"0.92147964",
"0.9210798",
"0.9210798",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
... | 0.0 | -1 |
Get `Tokenizer` and `Model` for a model name. | def get_tokenizer_and_model(model_name: str):
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name)
model.output_hidden_states = True
return tokenizer, model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model(model):\n all_models = cmd.get_object_list()\n\n if len(all_models) == 0:\n logging.parser_error('No models are opened.')\n return\n\n model = model.lower()\n\n if model and (model in all_models):\n return model\n\n if len(all_models) > 1:\n logging.parser_e... | [
"0.7199492",
"0.7023352",
"0.6884367",
"0.68522125",
"0.68059415",
"0.679673",
"0.678864",
"0.67526037",
"0.6655757",
"0.6638868",
"0.6599854",
"0.655437",
"0.6554283",
"0.65510416",
"0.6477091",
"0.6466176",
"0.64611083",
"0.64491063",
"0.6438798",
"0.6429388",
"0.64275306",... | 0.7214922 | 0 |
Get parameters for a model, potentially excluding the embedding layer. | def get_prunable_parameters(
model: Module,
only_matrices: bool = True,
# TODO: Replace exclude with a filter function per model.
exclude: List[str] = ["embed", "decoder.", "pooler.", "shared."],
) -> List[Parameter]:
# names = [name for name, _ in model.named_parameters()]
# import pdb; ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_params(self):\n params_dict = vars(self).copy()\n exclude_params = ['input_size',\n 'model',\n 'train_generator',\n 'val_generator',\n 'callbacks',\n 'save_to_dir... | [
"0.7674309",
"0.7436587",
"0.7294265",
"0.72044444",
"0.7090381",
"0.7038122",
"0.6839631",
"0.6745029",
"0.6744087",
"0.6740476",
"0.6725307",
"0.66457915",
"0.66193455",
"0.6599832",
"0.6596613",
"0.65812725",
"0.6551182",
"0.6549866",
"0.65431637",
"0.6536824",
"0.65232897... | 0.7238273 | 3 |
Get a list of parameters tied to the embedding layer. | def get_embed_params(model) -> List:
return [param for name, param in model.named_parameters() if "embed" in name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameters(self):\n params = []\n for layer in (self.conv1, self.conv2, self.conv3, self.conv4, self.dense1, self.dense2):\n params += list(layer.parameters)\n return params",
"def get_params(self) -> torch.Tensor:\n params = []\n for pp in list(self.net.paramete... | [
"0.7535987",
"0.7381716",
"0.7132315",
"0.704354",
"0.7043289",
"0.7009622",
"0.7009622",
"0.70040184",
"0.6953776",
"0.691929",
"0.69050103",
"0.68977284",
"0.68977284",
"0.68977284",
"0.68977284",
"0.68977284",
"0.6875893",
"0.68742156",
"0.68739325",
"0.6872487",
"0.684921... | 0.78168494 | 0 |
Get dictionary of parameters partitioned by layer number. | def get_params_by_layer(model) -> Dict:
layers = defaultdict(list)
for name, param in model.named_parameters():
pieces = name.split(".")
if pieces[0] == "encoder" and pieces[1] == "block":
layer = int(pieces[2])
layers[layer].append(param)
return layers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameters_dict(self):\n return dict(zip(self.parameters_names(), self.parameters_list))",
"def get_all_params(layer):\n layers = get_all_layers(layer)\n params = sum([l.get_params() for l in layers], [])\n return utils.unique(params)",
"def get_layer_params(self):\n return self.laye... | [
"0.6692574",
"0.65567654",
"0.64245135",
"0.6398583",
"0.6372712",
"0.6344212",
"0.62882966",
"0.62654275",
"0.62573886",
"0.6213964",
"0.6201111",
"0.619871",
"0.6188635",
"0.61766535",
"0.6173816",
"0.6171546",
"0.61674243",
"0.6164119",
"0.6154546",
"0.6140772",
"0.6101595... | 0.70265716 | 0 |
Returns gaussian profile. 1/sqrt(2pi) / gamma exp((x/gamma)2 / 2) | def gauss(x, gamma):
return 1 / np.sqrt(2*np.pi) / gamma * np.exp(-(x/gamma)**2 / 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gauss(x, x0, gamma):\n sigma = gamma / sqrt(2.0)\n \n A = 1/ (sigma * sqrt(2*pi))\n return (A * exp (-0.5 * (x-x0)**2/sigma**2))",
"def gaussian(x, mu, sigma):\n return (np.exp(-(x - mu)**2 / 2.0 / sigma**2) /\n np.sqrt(2.0 * np.pi) / sigma)",
"def gaussian(x, mean, sigma):\n r... | [
"0.75206435",
"0.71392494",
"0.6998809",
"0.6952576",
"0.69341147",
"0.68784",
"0.679881",
"0.67568934",
"0.6733555",
"0.6725777",
"0.6718593",
"0.6709496",
"0.6703196",
"0.6626777",
"0.6625177",
"0.6618803",
"0.6614837",
"0.65624034",
"0.6553338",
"0.6513534",
"0.65014327",
... | 0.7844662 | 0 |
Plot a image grids of the dataset. If dataset is labeld it will generate one row of images per class and if it's unlabeled it will generate a bidimentional (almost square) grid of images sampled from dataset | def show_imagegrid_dataset(dataset,
num=10,
shuffle=True,
classes='auto',
figsize=None,
fontsize=20,
image_attr={'cmap': plt.cm.Greys_r}):
sample = datase... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_images(images, labels, nrows, ncols, cls_true=None, cls_pred=None, grey=False):\n fig, axes = plt.subplots(nrows, ncols, figsize=(16, 2*nrows))\n\n for i, ax in enumerate(axes.flat): \n if grey:\n ax.imshow(images[i,:,:,0], cmap='binary')\n else:\... | [
"0.7369182",
"0.7340669",
"0.73215216",
"0.722925",
"0.7174287",
"0.7159908",
"0.7060308",
"0.7036506",
"0.7008614",
"0.70057887",
"0.70050985",
"0.69809043",
"0.6962196",
"0.6962196",
"0.6871114",
"0.6860198",
"0.6790377",
"0.6773561",
"0.67644835",
"0.67433405",
"0.670146",... | 0.7943561 | 0 |
Translates a JSON dictionary into a corresponding grammar node, based on the 'type' entry. Returns 'dct' itself when 'dct' has no type entry or has an unrecognized type entry. We use Treesitter's conventions for representing a grammar in JSON form. | def json_hook(grammar,memo,tokens_only,dct):
def memoize(memo,name,node):
if name in memo:
return memo[name]
memo[name] = node
return node
result = dct
if "type" in dct:
type_entry = dct["type"]
if isinstance(type_entry,str):
if type_entry =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CustomTypeDecoder(dct):\n if len(dct) == 1:\n type_name, _ = dct.items()[0]\n type_name_stripped = type_name.strip('_')\n if type_name_stripped in TYPES:\n obj = TYPES[type_name_stripped]()\n obj.__dict__ = dct[type_name]\n return obj\n return dct",
... | [
"0.6035078",
"0.5538951",
"0.5173711",
"0.49358642",
"0.49114808",
"0.48749194",
"0.48417294",
"0.48001817",
"0.47498053",
"0.4648304",
"0.4629172",
"0.4613406",
"0.4605138",
"0.45951557",
"0.45777294",
"0.4507989",
"0.4484301",
"0.44649675",
"0.44622406",
"0.4459265",
"0.445... | 0.614961 | 0 |
Returns a new SymbolName, unique up to equivalence of its string name. | def MakeSymbolName(self,content):
return self.register(SymbolName(content,reg=self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internName(self, name):\n if name in self.names:\n return self.names[name]\n else:\n new = self.nameidx\n self.names[name] = new\n self.invnames[new] = name\n self.nameidx += 1\n return new",
"def symbol_name(string):\n return... | [
"0.66554004",
"0.66413283",
"0.6358413",
"0.5970123",
"0.59338284",
"0.59157276",
"0.59157133",
"0.5904528",
"0.58963996",
"0.5851957",
"0.5758179",
"0.56907475",
"0.55619925",
"0.5549361",
"0.5548271",
"0.55477536",
"0.5520622",
"0.5475762",
"0.5468113",
"0.5465598",
"0.5451... | 0.6105098 | 3 |
Returns the names of rules, in order, based on the preorder traversal starting from the LANGUAGE start node. Assumes the grammar is in canonical form | def preorder(self):
assert self.is_canonical
# Names of visited nodes
visited = set()
# Names of nodes to visit
worklist = [LANGUAGE]
result = []
while len(worklist) > 0:
successors = []
for rule_name in worklist:
if rule_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rule_names(self):\n return self.rules.keys()",
"def extract_rule_names(self):\n if self.scanner == YARA:\n return sorted({result['rule'] for result in self.results})\n if self.scanner == CUSTOMS and 'matchedRules' in self.results:\n return self.results['matchedR... | [
"0.60005575",
"0.58476996",
"0.55949664",
"0.55783236",
"0.5526621",
"0.5481297",
"0.5413346",
"0.5225151",
"0.5198539",
"0.5161763",
"0.5130225",
"0.51194996",
"0.5093414",
"0.5093071",
"0.5053559",
"0.5044478",
"0.5043568",
"0.5019573",
"0.5008506",
"0.5006204",
"0.49716237... | 0.7482429 | 0 |
Returns whether or not this MPCFramework supports the given game | def supports_game(cls, game: Game) -> bool:
return game in cls.SUPPORTED_GAMES | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_support(mode: int) -> bool:\n return mode in supported_modes\n pass",
"def isValid(self, game):\n return True",
"def is_supported():\n return not isinstance(_the_app, StubApp)",
"def platform_supported(self):\n return platform.system().lower() in self.platforms if self.platforms... | [
"0.65107864",
"0.62987363",
"0.6131972",
"0.61076665",
"0.6079678",
"0.60238105",
"0.5971767",
"0.5921434",
"0.58807635",
"0.57579356",
"0.574543",
"0.57257944",
"0.57189626",
"0.5686974",
"0.5674633",
"0.5671523",
"0.56437093",
"0.5639276",
"0.56391764",
"0.5628202",
"0.5610... | 0.86261773 | 0 |
Return the top value of the stack without popping. | def peek(self):
return self.top.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(stack):\n if empty_stack(stack):\n raise IndexError(\"Stack is empty!\")\n else:\n return stack.top.value",
"def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]",
"def top(self):\n if self.stack:\n return self.stack[... | [
"0.9050651",
"0.8435066",
"0.8398459",
"0.8373688",
"0.8304483",
"0.82895845",
"0.8283464",
"0.82824063",
"0.821702",
"0.8195804",
"0.81816",
"0.817463",
"0.817463",
"0.81669104",
"0.81545913",
"0.80897546",
"0.8059494",
"0.7987436",
"0.78667957",
"0.78505516",
"0.7848447",
... | 0.73281485 | 40 |
Specific to Starships. Both films and pilots parameters of the Starship responses will be a list of endpoints. If the system has not cached those values, this will replace the endpoints with actual values. Returns the title of films, and the name of pilots. | def clean_value(value, key):
values = []
if key in ["films", "pilots"] and detect_if_url(value):
for val in value:
if key == "films":
values.append(get_request(val)['title'])
if key == "pilots":
values.append(get_request(val)['name'])
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_ships(self):\n r = requests.get(self.base_url + f'/users/{self.username}/ships', headers=self.auth_header)\n return r.text",
"def location_ships_info(self, symbol):\n r = requests.get(self.base_url + f'/game/locations/{symbol}/ships', headers=self.auth_header)\n return r.text",... | [
"0.5181903",
"0.49881867",
"0.48190263",
"0.47933248",
"0.47418043",
"0.46728072",
"0.4665454",
"0.46339023",
"0.4620509",
"0.45402846",
"0.4529254",
"0.44990838",
"0.44728097",
"0.4446412",
"0.44434893",
"0.44434625",
"0.4437177",
"0.44347763",
"0.44176322",
"0.44082454",
"0... | 0.0 | -1 |
Returns the CODATA recommended value with unit of the requested physical constant. | def physical_constants(key: str, with_variance: bool = False) -> Variable:
from scipy.constants import physical_constants as _cd
value, unit, uncertainty = _cd[key]
args = {'value': value, 'unit': unit.replace(' ', '*')}
if with_variance:
stddev = uncertainty
args['variance'] = stddev *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cu(self):\n c_undrained=0\n #group_index = self._data['GI']\n if self.is_clayey():\n c_undrained = self.qu(self._data[SoilProperty.N60])/2\n #c_undrained=_clamp(c_undrained, 10, 103)\n # Plasix calculation needs very small c_undrained\n #if c_undrai... | [
"0.61868954",
"0.6132413",
"0.605815",
"0.58931077",
"0.589065",
"0.5814609",
"0.57374376",
"0.57374376",
"0.57374376",
"0.56209207",
"0.5611018",
"0.5611018",
"0.5607602",
"0.5553922",
"0.5553922",
"0.5543335",
"0.5538798",
"0.5506754",
"0.5497807",
"0.5469998",
"0.54668",
... | 0.51238084 | 61 |
Cleans the text into a form that works for processing by removing tabs and linefeeds, and punctuation is extended_alphabet = False, along with making the text uniformly lowercase and transforming it into asciicompatible characters. | def _clean(self, text):
if len(self.alph) == 26:
text = sub('[\n\t ' + string.punctuation + ']+?', '', text)
else:
text = sub('[\n\t]+?', '', text)
text = text.lower()
text = text.encode('ascii', 'ignore').decode()
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_cleaning(self, text):\n # remove string formatting '\\n' or '\\t'\n tmp_text = re.sub(r'\\n+', '. ', text)\n tmp_text = re.sub(r'\\t+', '. ', text)\n # remove words with non-ascii characters\n tmp_text = \" \".join([word for word in tmp_text.split() if self.is_ascii(word... | [
"0.7089762",
"0.7030888",
"0.7011495",
"0.6901245",
"0.68705463",
"0.68348545",
"0.68348545",
"0.68334574",
"0.67861676",
"0.67735624",
"0.6761075",
"0.673244",
"0.6727343",
"0.6723118",
"0.6716831",
"0.67066026",
"0.6696384",
"0.6644331",
"0.6644331",
"0.6644331",
"0.6644331... | 0.7909278 | 0 |
Remove each element from `rng` for which `pred` evaluates to true by swapping them to the end of the sequence. The function returns the number of elements retained. | def remove_if(rng, pred):
j = 0
for i, x in enumerate(rng):
if pred(x):
continue
if i != j:
rng[i], rng[j] = rng[j], rng[i]
j += 1
return j | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(pred):\n def _remove_xducer(step):\n def _remove_step(r=Missing, x=Missing):\n if r is Missing: return step()\n if x is Missing:\n return step(r)\n return step(r, x) if not pred(x) else r\n return _remove_step\n return _remove_xducer",
... | [
"0.5970162",
"0.59182113",
"0.57885057",
"0.55329347",
"0.5454982",
"0.54516405",
"0.51788163",
"0.5175403",
"0.5148423",
"0.51355696",
"0.50446457",
"0.50325125",
"0.50101095",
"0.49965248",
"0.49878272",
"0.49708146",
"0.49496216",
"0.4939983",
"0.491285",
"0.48891592",
"0.... | 0.7627244 | 0 |
Returns a shallow copy of the container. | def copy(self):
return TodoList(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n attrs = {k: self.__dict__[k].copy() for k in self.containers}\n attrs.update({k: cp.deepcopy(self.__dict__[k]) for k in self.shared})\n return self.__class__(**attrs)",
"def clone(self):\n return shallow_clone(self)",
"def copy(self):\n\t\treturn pythoncopy.deepcop... | [
"0.7788241",
"0.76535076",
"0.7606447",
"0.7604285",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.7549966",
"0.75445724",
... | 0.0 | -1 |
Yield key value pairs in sorted order. | def items(self):
for key in self._sorted:
yield key, self._map[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n if self._len_keys == 1:\n yield from self._dict.keys()\n else:\n for key in self._dict.keys():\n yield tuple(sorted(list(key)))",
"def __iter__(self):\n for key in sorted(self.keys):\n yield key, self[key]",
"def __iter_... | [
"0.7231955",
"0.7230859",
"0.7198143",
"0.69616336",
"0.68760335",
"0.6718476",
"0.6356944",
"0.6347301",
"0.63008046",
"0.6227649",
"0.61887306",
"0.618329",
"0.61615235",
"0.6150183",
"0.6142618",
"0.6128285",
"0.6111235",
"0.6091085",
"0.60533196",
"0.60402775",
"0.6022792... | 0.7067611 | 3 |
Return a shallow copy the interval set. | def copy(self):
return IntervalSet(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return sppasInterval(self.__begin.copy(), self.__end.copy())",
"def copy(self) -> 'RangeSet':\n return RangeSet(self)",
"def copy(self):\n return State([r[:] for r in self.values], empty_loc=self.empty_loc)",
"def copy(self):\n r = SubsSet()\n r.rewrites =... | [
"0.782539",
"0.73891133",
"0.6887479",
"0.67976564",
"0.6712033",
"0.66005105",
"0.64806855",
"0.6475658",
"0.6470166",
"0.6459816",
"0.6395403",
"0.6345681",
"0.63421625",
"0.6339084",
"0.6339084",
"0.6339084",
"0.6339084",
"0.6339084",
"0.6339084",
"0.6339084",
"0.6339084",... | 0.8764039 | 0 |
'132456' > [(1, 'path1.jpg'), (2, 'path2.jpg'), (3, 'path3.jpg')] | def img_filenames(self, matricule):
proj, sid = next((proj, proj.Matricule(matricule).to('AmcStudentId'))
for proj in self.projects_by_serie.values()
if proj.Matricule(matricule).exists('AmcStudentId'))
return [
(int(num), filename.replace('%... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_list(path: str) -> list:\n\n return list(os.path.join(path, f)\n for f in os.listdir(path)\n if f.endswith('.jpg'))",
"def path_elements(path):\n result = []\n (head, tail) = os.path.split(path)\n while tail != \"\":\n result.insert(0, tail)\n ... | [
"0.6150268",
"0.6139573",
"0.6003196",
"0.5991646",
"0.596883",
"0.5840479",
"0.58061945",
"0.57994175",
"0.57634705",
"0.5670809",
"0.5631022",
"0.5612925",
"0.56098044",
"0.5597413",
"0.55380136",
"0.5520958",
"0.5518147",
"0.5514622",
"0.5502538",
"0.5502388",
"0.550027",
... | 0.0 | -1 |
Initialize an ImageGenerator instance. | def __init__(self, x, y):
# TODO: Your ImageGenerator instance has to store the following information:
# x, y, num_of_samples, height, width, number of pixels translated, degree of rotation, is_horizontal_flip,
# is_vertical_flip, is_add_noise. By default, set boolean values to
self.x =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, generate_image_pyramid: bool = True):\n if not os.path.exists(MANIFEST_OUTPUT_DIR):\n os.makedirs(MANIFEST_OUTPUT_DIR)\n self._manifest_factory = ManifestFactory()\n self._manifest_factory.set_base_prezi_uri(MANIFEST_BASE_URL)\n self._manifest_factory.set_b... | [
"0.66102874",
"0.6580374",
"0.6580374",
"0.6580374",
"0.6358682",
"0.623037",
"0.61523485",
"0.614599",
"0.61459565",
"0.61243206",
"0.612273",
"0.60627025",
"0.6054077",
"0.6020868",
"0.59752",
"0.59713435",
"0.5951723",
"0.5897793",
"0.5897079",
"0.5884362",
"0.5856622",
... | 0.58529454 | 21 |
Generator function to convert a PIL image to 16bit 565 RGB bytes. | def image_to_data(image):
pixels = image.convert('RGB').load()
width, height = image.size
for y in range(height):
for x in range(width):
r,g,b = pixels[(x,y)]
color = rgb(r, g, b)
yield (color >> 8) & 0xFF
yield color & ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_pixels_8bit(image):\n\n w, h = image.size\n for y in range(h):\n for x in range(w):\n value = pack_argb8(image.getpixel((x, y)))\n yield value\n\n raise StopIteration",
"def _pack_bitmap(self, w, h, image):\n CHUNKS = math.ceil(w / 8)\n img_bytes =... | [
"0.620823",
"0.5748702",
"0.5568134",
"0.54716986",
"0.5466298",
"0.54249287",
"0.5348286",
"0.5305571",
"0.530067",
"0.5288059",
"0.5280445",
"0.52762127",
"0.5229831",
"0.5223723",
"0.5220092",
"0.51701254",
"0.51684964",
"0.51524526",
"0.51485884",
"0.5146951",
"0.5143614"... | 0.6660582 | 0 |
Clear the image buffer to the specified RGB color (default black). | def clear(self, color=(0,0,0)):
width, height = self.buffer.size
self.buffer.putdata([color]*(width*height)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self, *args):\n\n black = (0, 0, 0) # default\n\n if len(args) == 0:\n colour = black\n elif len(args) == 1:\n colour = args[0]\n elif len(args) == 3:\n colour = args\n else:\n raise ValueError('Pixel arguments must be given ... | [
"0.74264044",
"0.7001992",
"0.68183446",
"0.67490363",
"0.6591455",
"0.64442015",
"0.6412805",
"0.6224743",
"0.62203544",
"0.62005705",
"0.6143208",
"0.5934447",
"0.5922529",
"0.58492565",
"0.5807059",
"0.5781866",
"0.5771528",
"0.5742031",
"0.5732281",
"0.5732281",
"0.572022... | 0.79759204 | 0 |
Return a PIL ImageDraw instance for 2D drawing on the image buffer. | def draw(self):
return ImageDraw.Draw(self.buffer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Draw(im, mode=None):\r\n # try:\r\n # return im.getdraw(mode)\r\n # except AttributeError:\r\n # return ImageDraw(im, mode)\r\n return ImageDraw(im)",
"def get_image(self):\n image = Image.new('1', (8, 16))\n draw = ImageDraw.Draw(image)\n for x in xrange(8):\n ... | [
"0.6389655",
"0.57493675",
"0.5472395",
"0.5449045",
"0.54278857",
"0.5398147",
"0.5348836",
"0.53315246",
"0.5250177",
"0.5240005",
"0.5211034",
"0.516861",
"0.51537",
"0.5129788",
"0.51280314",
"0.50953037",
"0.5077803",
"0.502071",
"0.5018067",
"0.49811712",
"0.49748406",
... | 0.67710567 | 0 |
Path to the AGASC directory. This returns the ``AGASC_DIR`` environment variable if defined, otherwise ``$SKA/data/agasc``. | def default_agasc_dir():
if 'AGASC_DIR' in os.environ:
out = Path(os.environ['AGASC_DIR'])
else:
out = Path(os.environ['SKA'], 'data', 'agasc')
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_awg_dir():\n path = os.path.join(get_pycqed_appdata_dir(), 'awg')\n os.makedirs(path, exist_ok=True)\n return path",
"def fasta_dir(self):\n return op.join(self.root_dir, 'fasta')",
"def getapache_srcdir():\n return os.getenv(\"APACHESRC\")",
"def get_apk_path():\n ROOT_... | [
"0.6418201",
"0.61758137",
"0.6166837",
"0.6136397",
"0.59707874",
"0.5955374",
"0.582124",
"0.57593846",
"0.55971885",
"0.5539885",
"0.55095124",
"0.5486886",
"0.54800457",
"0.5461718",
"0.54264665",
"0.5392617",
"0.53507036",
"0.53011197",
"0.52564883",
"0.5245962",
"0.5216... | 0.8444948 | 0 |
Implement gradient descent using full value of the gradient. | def gradient_descent(X, Y, epsilon=1e-6, l=1, step_size=1e-4, max_steps=1000):
beta = np.zeros(X.shape[1])
for s in range(max_steps):
# TODO: Implement iterations.
pass
return beta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gradient_descent(self, X, y, epochs, learning_rate, batch_size):\n num_feats = X.shape[1]\n num_samples = X.shape[0]\n\n y = y.reshape(num_samples, 1)\n W = np.random.rand(num_feats, 1)\n training_loss_epochs = []\n\n for ix in range(epochs):\n shuffled_ix ... | [
"0.76011115",
"0.7493477",
"0.7356732",
"0.7341731",
"0.7323074",
"0.7304009",
"0.7295334",
"0.71896416",
"0.7178144",
"0.7173646",
"0.71432936",
"0.71413267",
"0.7133647",
"0.7102578",
"0.7095757",
"0.7084161",
"0.70731115",
"0.70658535",
"0.70337963",
"0.70021755",
"0.70001... | 0.7044809 | 18 |
Implement gradient descent using stochastic approximation of the gradient. | def stochastic_gradient_descent(X, Y, epsilon=0.0001, l=1, step_size=0.01,
max_steps=1000):
beta = np.ones(X.shape[1])
for s in range(max_steps):
# TODO: Implement iterations.
pass
return beta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient_descent(self, X ,eta, tol,iter):\n gd=[]\n gd_x=[X]\n iteration=0\n # current_pt=X\n first_derivative=sym.diff(self.gdfunc)\n #print(first_derivative)\n x=sym.Symbol('x')\n first_derivative=sym.lambdify(x,first_derivative)\n learn_rate=eta... | [
"0.7556287",
"0.7508106",
"0.7506085",
"0.75046176",
"0.74654555",
"0.74149",
"0.7373778",
"0.7299866",
"0.71730685",
"0.7159873",
"0.7131653",
"0.7109182",
"0.70791435",
"0.70521635",
"0.70216507",
"0.6963935",
"0.6935528",
"0.6903045",
"0.6898706",
"0.6883422",
"0.6876296",... | 0.7193556 | 8 |
Set value of the widget | def set_val(self, value):
self._value = value if value is not None else deepcopy(self._default)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widget.setValue(value)\n elif hasattr(self.widget, \"se... | [
"0.8263928",
"0.8263786",
"0.80649376",
"0.7906129",
"0.78084457",
"0.7661165",
"0.7550678",
"0.7547526",
"0.7527618",
"0.74979734",
"0.7495041",
"0.74928564",
"0.74928564",
"0.74928564",
"0.7449767",
"0.7374522",
"0.7352217",
"0.7297942",
"0.7292586",
"0.7270159",
"0.7268026... | 0.0 | -1 |
Get UID of the widget | def uid(self) -> str:
return self._uid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uid(self):\n return safeInt(self.tag(\"uid\"))",
"def uid (self):\n return self.__uid",
"def UID(self):\r\n return self._uid",
"def UID(self):\r\n return self._uid",
"def get_id(self):\n return self.uid",
"def uid(self):\n\n return self._uid",
"def uid(self... | [
"0.7162705",
"0.70754755",
"0.7059123",
"0.7059123",
"0.69492716",
"0.68965566",
"0.6842303",
"0.6821234",
"0.67746645",
"0.67746645",
"0.67746645",
"0.6753258",
"0.6745724",
"0.6687966",
"0.668614",
"0.6642791",
"0.6642791",
"0.6588152",
"0.65770674",
"0.6452688",
"0.6425834... | 0.67902994 | 8 |
Get stack secrets from AWS Secrets Manager | def get_secrets(session, secret_id):
secretsmanager = session.client('secretsmanager')
secrets = json.loads(secretsmanager.get_secret_value(SecretId=secret_id)['SecretString'])
formatted_secrets = []
for (key, value) in secrets.items():
skipped_secrets = [ # cloudformation doesn't need these, so... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_secrets(token):\n try:\n return get_keycloak_client().userinfo(token)['attributes'].get('secrets')\n except KeycloakError as ke:\n logger.error(\"Keycloak error: {0}\").format(ke)\n raise exceptions.TransferError\n except KeyError as ke:\n logger.error(\"Secrects not fo... | [
"0.687092",
"0.6862838",
"0.67613345",
"0.67612904",
"0.6738275",
"0.6707533",
"0.6665517",
"0.6653283",
"0.6589323",
"0.6560593",
"0.65263146",
"0.64855266",
"0.6449559",
"0.6406883",
"0.63925076",
"0.639028",
"0.6369368",
"0.63691497",
"0.6348001",
"0.6340888",
"0.6338398",... | 0.7030895 | 0 |
Take the block size and determine the block range for the subnet in question | def find_block(int_svip, comp_block):
print("-" * 20 + " find_block started")
bsz = comp_block
outsz = 0
bsdict = {}
bsdict [0] = bsz
# Build the dictionary of the host networks
while outsz < 255:
outsz = outsz + bsz
bsdict[outsz] = (outsz + bsz) -1
#print(outsz)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_block_sizes(resnet_size):\n choices = {\n 18: [2, 2, 2, 2],\n 34: [3, 4, 6, 3],\n 50: [3, 4, 6, 3],\n 101: [3, 4, 23, 3],\n 152: [3, 8, 36, 3],\n 200: [3, 24, 36, 3]\n }\n\n try:\n return choices[resnet_size]\n except KeyError:\n err = ('Could not find layers for se... | [
"0.67389846",
"0.6703691",
"0.66716045",
"0.64908487",
"0.6447412",
"0.6374348",
"0.6291459",
"0.6086949",
"0.6078042",
"0.58520687",
"0.58262855",
"0.5826254",
"0.58185756",
"0.5774167",
"0.5772086",
"0.57550997",
"0.57529444",
"0.5722806",
"0.5673859",
"0.56660384",
"0.5660... | 0.66279286 | 3 |
/ Home (welcome msg) | def root():
if request.headers['Accept'] == 'application/json':
return "Welcome\n\n", 200
else:
return redirect(url_for('index')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n return \"Hello!\"",
"def home():\n print('This is the root')\n return 'Manga root, this is where some front end would go on a server'",
"def home():\n return \"hello, world\"",
"def home():\n return render_template(\n 'index.html',\n title='Automation Center',\n ... | [
"0.7886187",
"0.78705454",
"0.7813651",
"0.7776198",
"0.77555084",
"0.7721609",
"0.7721187",
"0.7576359",
"0.7569369",
"0.7485951",
"0.7485951",
"0.74841505",
"0.74787974",
"0.7476996",
"0.7475403",
"0.74575335",
"0.74482054",
"0.7435764",
"0.74253047",
"0.74192727",
"0.74190... | 0.0 | -1 |
/about Display about page | def about():
logger.debug('[FLASKWEB /about]')
if request.headers['Accept'] == 'application/json':
return redirect(url_for('staticFile', filename="rest.txt"))
else:
return render_template('about.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def about():\n return render_template('about.html', title='About')",
"def about():\r\n return render_template(\"/home/about.html\")",
"def about():\n retu... | [
"0.82070446",
"0.82011676",
"0.8172304",
"0.8054953",
"0.80515885",
"0.79975355",
"0.7979664",
"0.7973242",
"0.7937197",
"0.7935347",
"0.79228884",
"0.79041106",
"0.79041106",
"0.79041106",
"0.79041106",
"0.79041106",
"0.79041106",
"0.79041106",
"0.79041106",
"0.79041106",
"0... | 0.0 | -1 |
Get the well to index mapping for the supplied layout | def layout_well2index(self, layout_name):
return {k:tuple(v) for k,v in self['well2coord'][self['layout_format'][layout_name]].items()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index2well(self, layout_name: str) -> dict:\n return {v:k for k,v in self['well2index'][self['layout_format'][layout_name]].items() }",
"def get_index_from_well(self, well):\n pass",
"def layout_method_mapper(self):\n return {\n \"kamada_kawai_layout\": kamada_kawai_layout,\... | [
"0.7496455",
"0.6372463",
"0.58999753",
"0.5649408",
"0.5591524",
"0.5395",
"0.5260546",
"0.5252853",
"0.52322894",
"0.5229908",
"0.5173371",
"0.5148311",
"0.5147562",
"0.5130854",
"0.5120828",
"0.5115123",
"0.51135224",
"0.51135224",
"0.510836",
"0.50952727",
"0.50927615",
... | 0.76162016 | 0 |
Merchant Benchmark This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def postmerchant_benchmark(self, merchant_benchmarkpost_payload, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.postmerchant_benchmark_with_http_info(merchant_benchmarkpost_payload, **kwargs)
else:
(data) = self.postmerchant_benc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postmerchant_benchmark_with_http_info(self, merchant_benchmarkpost_payload, **kwargs):\n\n all_params = ['merchant_benchmarkpost_payload']\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n all_params.append('_preload_content')\n all_params.append... | [
"0.6901482",
"0.57959634",
"0.5379906",
"0.50862104",
"0.5032575",
"0.4949778",
"0.49355474",
"0.478718",
"0.47678483",
"0.47242725",
"0.46478084",
"0.4641266",
"0.46314514",
"0.45942405",
"0.45714748",
"0.4453758",
"0.44234872",
"0.44184527",
"0.44178113",
"0.44111922",
"0.4... | 0.56433696 | 2 |
Merchant Benchmark This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def postmerchant_benchmark_with_http_info(self, merchant_benchmarkpost_payload, **kwargs):
all_params = ['merchant_benchmarkpost_payload']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def benchmark(self):\n logger.info(self.benchmark.__doc__)\n return self.run(self.benchmark_profile())",
"def postmerchant_benchmark(self, merchant_benchmarkpost_payload, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.postmer... | [
"0.57964253",
"0.56427693",
"0.5378593",
"0.5085103",
"0.5032316",
"0.4949648",
"0.49344343",
"0.47874528",
"0.47683173",
"0.47250286",
"0.4648016",
"0.4639908",
"0.4631494",
"0.45932716",
"0.4573163",
"0.44536352",
"0.44227803",
"0.44188625",
"0.4417919",
"0.44099665",
"0.44... | 0.6901023 | 0 |
Accept a string that is a number that contains commas in it as input, and return as number as output. 1. if want to check that input is string type, if false print "Please enter a string" return boolean False value 2. else reassign x to a copy with replace method to change commas to underscores. This will allow python ... | def handle_commas(x):
if type(x) != str:
print ("Please enter a string")
return False
else:
x = float(x.replace(",",""))
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comma_separated_int(s):\n\n s = s.replace(',','')\n return int(s)",
"def is_number(value):\n try:\n float(value.replace(',', ''))\n except ValueError:\n return False\n return True",
"def string_to_digit(string, output):\n string = strip_space(string)\n if not string[0].is... | [
"0.6456841",
"0.62302864",
"0.6201075",
"0.60826397",
"0.60624504",
"0.6061707",
"0.5982972",
"0.5977725",
"0.5946921",
"0.59380096",
"0.5930463",
"0.588775",
"0.58409303",
"0.58380115",
"0.5825016",
"0.58159345",
"0.5809624",
"0.5802421",
"0.58023137",
"0.5790378",
"0.577046... | 0.7331774 | 0 |
Retrieves the SSH entry's passphrase (from the Keepass password field) >>> entry = KP_DB.find_entries_by_path('embedded_keys/id_rsa')[0] >>> ssh_entry = SshEntry(KP_DB,entry) >>> ssh_entry.passphrase.decode() == entry.password True | def passphrase(self):
password = self.entry.password
if password:
return self.entry.password.encode('UTF-8')
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key_from_keyring(self):\n private_key = keyring.get_password(self.keyring_service_name, \"private_key\")\n\n if private_key is not None:\n return base64.b64decode(private_key)\n else:\n return None",
"def passphrase(password):\n\tnow = int(time.time())\n\tkey = ... | [
"0.6186439",
"0.580254",
"0.5719748",
"0.57165724",
"0.5687516",
"0.5640266",
"0.55456614",
"0.5474176",
"0.5474158",
"0.5451181",
"0.5404241",
"0.54017514",
"0.5397471",
"0.5372742",
"0.5372742",
"0.537041",
"0.5367618",
"0.5357364",
"0.5343646",
"0.5339588",
"0.53367853",
... | 0.731931 | 0 |
Calculate the traffic concentration at the point (x, y). | def traffic_concentration(rFile, sheets, x, y, pollutant):
p = Point(x, y)
road, dis = nearest_road(p, rFile)
# step 1. check whether this location is within the calculation range. If so, go on. Otherwise exit.
if dis > 60: # I think we dont have to consider points that are too far from the st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cid(x, y):\n assert(len(x.shape) == 2 and x.shape == y.shape) # time series must have same length and dimensionality\n ce_x = np.sqrt(np.sum(np.square(np.diff(x, axis=0)), axis=0) + 1e-9)\n ce_y = np.sqrt(np.sum(np.square(np.diff(y, axis=0)), axis=0) + 1e-9)\n d = np.sqrt(np.sum(np.square(x - y), ... | [
"0.63421494",
"0.6219757",
"0.6176237",
"0.6103111",
"0.5964228",
"0.59570724",
"0.59099114",
"0.5883368",
"0.58019954",
"0.5774858",
"0.57275665",
"0.5700003",
"0.56933373",
"0.5689955",
"0.56575173",
"0.56562144",
"0.56527644",
"0.5638766",
"0.5619432",
"0.56060815",
"0.560... | 0.5707611 | 11 |
Round a number to n decimal places (same as 'rounddown' in excel). | def round_down(n, decimals=0):
multiplier = 10 ** decimals
return int(n * multiplier) / multiplier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round_to(n, precision):\n correction = 0.5 if n >= 0 else -0.5\n return int(n / precision + correction) * precision",
"def float_round(num, n):\n num = float(num)\n num = round(num, n)\n return num",
"def round_to_n(x, n=8):\n n = 1 + n - int(np.floor(np.log10(abs(x) + .1)))\n\n return... | [
"0.7621153",
"0.7491323",
"0.7403502",
"0.7221512",
"0.7186418",
"0.71188676",
"0.706864",
"0.7044281",
"0.6993371",
"0.69815147",
"0.69485044",
"0.6904951",
"0.6862087",
"0.6807377",
"0.6804079",
"0.67433345",
"0.67120963",
"0.66838527",
"0.6665037",
"0.6659999",
"0.66458374... | 0.75088334 | 1 |
Compute empirical cumulative distribution function values for one sample as input | def calc(self,newValue):
idx=np.searchsorted(self.quantiles, newValue, side="left")
if idx>=self.n-1:
return idx/self.n
if np.abs(newValue - self.quantiles[idx-1]) < np.abs(newValue - self.quantiles[idx]):
return (idx-1)/self.n
else:
return idx/self.n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumulative_distribution(self, X):\n raise NotImplementedError",
"def compute_cdf(ordered_weights):\n return numpy.cumsum(ordered_weights) - 0.5 * ordered_weights",
"def ecdf(x0, w=None):\n n = len(x0)\n\n if w is None:\n w = np.ones(n) / n\n else:\n w = w / np.sum(w)\n p... | [
"0.7397517",
"0.70215935",
"0.6962007",
"0.68533665",
"0.6810133",
"0.6802023",
"0.67893445",
"0.67620194",
"0.66876876",
"0.6686204",
"0.66311973",
"0.6596355",
"0.659541",
"0.65828246",
"0.6574668",
"0.65650684",
"0.6555707",
"0.65441126",
"0.6542468",
"0.653091",
"0.652146... | 0.0 | -1 |
Compute empirical cumulative distribution function values for an array as input | def calcECDF(self,arr):
res=np.zeros_like(arr)
for index, value in np.ndenumerate(arr):
res[index]=self.calc(value)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ecdf(arr, **kwargs):\n\t\"\"\" arr is assumed to be a single dimension array \"\"\"\n\t\n\tissortedVal = True\n\tzdispVal = False\n\n\tif \"issorted\" in kwargs:\n\t\tissortedVal = kwargs[\"issorted\"]\n\t\n\tif \"zdisp\" in kwargs:\n\t\tzdispVal = kwargs[\"zdisp\"]\n\t\n\tif issortedVal == False:\n\t\tarr.sor... | [
"0.72021645",
"0.70709264",
"0.7043568",
"0.7021855",
"0.6992865",
"0.6975908",
"0.6858684",
"0.6761031",
"0.6702512",
"0.6680964",
"0.6610432",
"0.65475047",
"0.64706975",
"0.6442887",
"0.6425232",
"0.6404292",
"0.6349571",
"0.6334768",
"0.6333572",
"0.63296044",
"0.6327689"... | 0.64799535 | 12 |
Compute empirical cumulative distribution function values for one sample as input | def calc(self,newValue):
return np.sum(self.values<=newValue)/self.n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumulative_distribution(self, X):\n raise NotImplementedError",
"def compute_cdf(ordered_weights):\n return numpy.cumsum(ordered_weights) - 0.5 * ordered_weights",
"def ecdf(x0, w=None):\n n = len(x0)\n\n if w is None:\n w = np.ones(n) / n\n else:\n w = w / np.sum(w)\n p... | [
"0.739791",
"0.7022486",
"0.69615877",
"0.6851785",
"0.6809857",
"0.6801702",
"0.6791322",
"0.67625046",
"0.6689006",
"0.6686785",
"0.66317624",
"0.6597271",
"0.6596943",
"0.6582494",
"0.65751916",
"0.65666974",
"0.65557766",
"0.6545425",
"0.6542906",
"0.65301275",
"0.6522582... | 0.0 | -1 |
Compute empirical cumulative distribution function values for an array as input | def calcECDF(self,arr):
res=np.zeros_like(arr)
for index, value in np.ndenumerate(arr):
res[index]=self.calc(value)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ecdf(arr, **kwargs):\n\t\"\"\" arr is assumed to be a single dimension array \"\"\"\n\t\n\tissortedVal = True\n\tzdispVal = False\n\n\tif \"issorted\" in kwargs:\n\t\tissortedVal = kwargs[\"issorted\"]\n\t\n\tif \"zdisp\" in kwargs:\n\t\tzdispVal = kwargs[\"zdisp\"]\n\t\n\tif issortedVal == False:\n\t\tarr.sor... | [
"0.7201239",
"0.7069232",
"0.70435184",
"0.7019728",
"0.6992622",
"0.6974017",
"0.68579507",
"0.67597365",
"0.67012197",
"0.6678614",
"0.6608768",
"0.65473616",
"0.6469565",
"0.64429563",
"0.64256",
"0.6402631",
"0.6347513",
"0.63332605",
"0.633326",
"0.63282186",
"0.63270676... | 0.6479759 | 13 |
Basic HTTP auth decorator | def basic_http_auth(f):
def wrap(request, *args, **kwargs):
if request.META.get('HTTP_AUTHORIZATION', False):
authtype, auth = request.META['HTTP_AUTHORIZATION'].split(' ')
auth = base64.b64decode(auth)
username, password = auth.split(':')
user = authenticate(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_basic_auth(func):\r\n\t@wraps(func)\r\n\tdef _decorator(request, *args, **kwargs):\r\n\r\n\t\tif request.META.has_key('HTTP_AUTHORIZATION'):\r\n\t\t\ttry:\r\n\t\t\t\tauthmeth, auth = request.META['HTTP_AUTHORIZATION'].split(' ', 1)\r\n\t\t\t\tif authmeth.lower() == 'basic':\r\n\t\t\t\t\tauth = auth.strip(... | [
"0.8461793",
"0.79010516",
"0.7828926",
"0.78109825",
"0.7766358",
"0.7603452",
"0.7481247",
"0.7302498",
"0.7254346",
"0.7246135",
"0.721293",
"0.7180321",
"0.7180321",
"0.7162722",
"0.7149473",
"0.71488553",
"0.71381325",
"0.7052642",
"0.70506674",
"0.7043808",
"0.6986596",... | 0.79767287 | 1 |
Record damage on this chunk. | def damage(self, coords):
if self.all_damaged:
return
x, y, z = coords
self.damaged.add(coords)
# The number 176 represents the threshold at which it is cheaper to
# resend the entire chunk instead of individual blocks.
if len(self.damaged) > 176:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Hit(self, damage):\n self.health -= damage",
"def damage(self, damage):\n return self.damage",
"def take_damage(self, dmg, dtype = 1):\n self.game.hit_sound.play()\n \n #DR% = 1 - (100 / x). \n damageMultiplier = 100.0 / float(self.defense)\n #Apply defense ... | [
"0.6881888",
"0.6878773",
"0.68268955",
"0.673835",
"0.6554855",
"0.6454833",
"0.644536",
"0.643693",
"0.63263965",
"0.6299233",
"0.6298182",
"0.62979186",
"0.6210596",
"0.62057006",
"0.61965513",
"0.6145803",
"0.6117639",
"0.60664845",
"0.60441244",
"0.60277826",
"0.60209",
... | 0.6006483 | 21 |
Stop the message bus. This bus may not be started again. Client threads blocked reading on the bus will return immediately with no message. | def stop(self, timeout=None):
with self._lock:
if not self.started:
return
self.started = False
self._logger.debug(
"Stopping MessageBus (%s) on endpoint %s",
self.busIdentity,
self._listeningEndpoint,
)
self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self):\n\n # Set the running flag to false, the listener won't actually stop until\n # the next message is received, or a timeout is reached.\n self.keep_running = False",
"def stop(self) -> None:\n self._stream.stop()",
"def stop_messenger(self):\n if self.connected:\n ... | [
"0.7468119",
"0.7179653",
"0.71201897",
"0.7048666",
"0.7034218",
"0.7004553",
"0.69817847",
"0.6973032",
"0.6940277",
"0.69327986",
"0.6923509",
"0.68819636",
"0.6865356",
"0.68459666",
"0.6816966",
"0.677514",
"0.6772402",
"0.67719364",
"0.6770047",
"0.6761974",
"0.6757493"... | 0.64135045 | 62 |
Forward pass of a full RNN, containing one or many single or bidirectional layers. Implemented for an abstract cell type. | def forward(
self,
input: Union[Tensor, PackedSequence],
state_init: Optional[Union[Tensor, Tuple[Tensor, Tensor]]] = None,
) -> Tuple[Union[Tensor, PackedSequence], Union[Tensor, Tuple[Tensor, Tensor]]]:
num_directions = 2 if self.bidirectional else 1
is_packed = isinstance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forward(self):\n\n tf.summary.image(\"image\", tensor=tf.reshape(self.x, (self.batch_size, 28, 28, 1)), max_outputs=10)\n x = self.x\n\n # x = layers.dropout(self.x, keep_prob=0.7)\n # with tf.variable_scope(\"layer1\") as scope:\n h = tf.nn.relu(layers.fully_connected(x, nu... | [
"0.64724463",
"0.6471909",
"0.6341677",
"0.6338651",
"0.6336419",
"0.6327723",
"0.6233987",
"0.62312984",
"0.6222129",
"0.6217563",
"0.62062126",
"0.6196325",
"0.6195106",
"0.6194396",
"0.6184599",
"0.6183137",
"0.617987",
"0.6168586",
"0.6159904",
"0.6144455",
"0.61414677",
... | 0.0 | -1 |
Forward pass of a single RNN layer (one direction). Implemented for an abstract cell type. | def forward_layer(
self,
x: Union[Tensor, PackedSequence],
h_0: Tensor,
c_0: Optional[Tensor],
batch_sizes: Tensor,
cell: DPRNNCellBase,
max_batch_size: int,
seq_length: int,
is_packed: bool,
reverse_layer: bool,
) -> Tuple[Union[Tensor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inp):\n self.rnn.flatten_parameters() # Enables faster multi-GPU training.\n\n rnn_output, _ = self.rnn(inp.transpose(1, -1))\n rnn_output = self.dropout(rnn_output)\n\n return rnn_output.transpose(1, -1)",
"def forward_tensor(self, x):\n pass",
"def forwar... | [
"0.64538944",
"0.64123833",
"0.6403103",
"0.639455",
"0.6351451",
"0.6337982",
"0.6325215",
"0.63068134",
"0.62835765",
"0.6283454",
"0.6267648",
"0.6265044",
"0.62573594",
"0.62373537",
"0.62228364",
"0.6177547",
"0.6145351",
"0.614506",
"0.61440986",
"0.61334467",
"0.613231... | 0.0 | -1 |
File duration in sec | def _duration(self):
if getattr(self, '_duration_cache', None):
return self._duration_cache
duration = extractMetadata(guessParser(\
InputIOStream(self))).get('duration')
if not duration:
raise Exception(u'Not an audio file')
else:
duration... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(file_path):\n command = [\"ffprobe\", \"-show_entries\", \"format=duration\", \"-i\", file_path]\n pipe = sp.Popen(command, stdout=sp.PIPE, stderr=sp.STDOUT)\n out, error = pipe.communicate()\n match_object = None if error else DURATION_REGEX.search(out.decode('utf-8'))\n if match_objec... | [
"0.73763436",
"0.7301986",
"0.71262586",
"0.7058381",
"0.7028466",
"0.7028466",
"0.70093304",
"0.6955006",
"0.68991596",
"0.6896644",
"0.6864266",
"0.6848633",
"0.682311",
"0.6816091",
"0.67986226",
"0.6766182",
"0.67458665",
"0.67339003",
"0.6714814",
"0.67144924",
"0.667723... | 0.6974663 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.