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
Mean of ``tensor``, accounting for optional mask ``valid``, optionally along a dimension.
def valid_mean(tensor, valid=None, dim=None): dim = () if dim is None else dim if valid is None: return tensor.mean(dim=dim) valid = valid.type(tensor.dtype) # Convert as needed. return (tensor * valid).sum(dim=dim) / valid.sum(dim=dim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean(tensor, axis=None):\n raise NotImplementedError", "def mean_flat(tensor):\n return tensor.mean(dim=list(range(1, len(tensor.shape))))", "def mean_flat(tensor):\n return tensor.mean(axis=list(range(1, len(tensor.shape))))", "def dim_zero_mean(x: Tensor) ->Tensor:\n return torch.mean(x...
[ "0.7679913", "0.6994597", "0.6904162", "0.682697", "0.66383904", "0.66383904", "0.66006225", "0.6579483", "0.654301", "0.6321002", "0.62278557", "0.60989386", "0.6081952", "0.60429454", "0.6030726", "0.60115385", "0.5966949", "0.59658927", "0.5963768", "0.5937968", "0.5853985...
0.8405047
0
Reshapes ``tensors`` (one or `tuple`, `list`) to to have ``lead_dim`` leading dimensions, which will become [], [B], or [T,B]. Assumes input tensors already have a leading Batch dimension, which might need to be removed. (Typically the last layer of model will compute with leading batch dimension.) For use in model ``f...
def restore_leading_dims(tensors, lead_dim, T=1, B=1): is_seq = isinstance(tensors, (tuple, list)) tensors = tensors if is_seq else (tensors,) if lead_dim == 2: # (Put T dim.) tensors = tuple(t.view((T, B) + t.shape[1:]) for t in tensors) if lead_dim == 0: # (Remove B=1 dim.) assert B ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_leading_dims(tensor, dim):\n lead_dim = tensor.dim() - dim\n assert lead_dim in (0, 1, 2)\n if lead_dim == 2:\n T, B = tensor.shape[:2]\n else:\n T = 1\n B = 1 if lead_dim == 0 else tensor.shape[0]\n shape = tensor.shape[lead_dim:]\n return lead_dim, T, B, shape", ...
[ "0.59834355", "0.5854006", "0.58246666", "0.57571334", "0.55620784", "0.5543693", "0.5543693", "0.55036896", "0.54670763", "0.5463506", "0.5463506", "0.54592496", "0.54231507", "0.5417873", "0.53861934", "0.53786975", "0.5363996", "0.5361716", "0.5360054", "0.5354292", "0.534...
0.79533124
0
Mark this device token as inactive
def deregister(self, device_token): url = DEVICE_TOKEN_URL + device_token status, response = self._request('DELETE', '', url, None) if status != 204: raise AirshipFailure(status, response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_inactive(self):\n self.active = False", "def inactive(self, inactive):\n\n self._inactive = inactive", "def mark_inactive(self):\n self.status = str(FormProcessMapperStatus.Inactive.value)\n self.commit()", "def deactivate(self):\n self._is_active = False", "def s...
[ "0.738691", "0.70586723", "0.6603758", "0.652174", "0.6453767", "0.63452756", "0.6344401", "0.6344401", "0.62886935", "0.628517", "0.62510043", "0.61353964", "0.60926884", "0.60926884", "0.6013582", "0.6013582", "0.600347", "0.5989051", "0.59444267", "0.593443", "0.5927014", ...
0.545848
55
Slices a given sequence.
def apply_slice(*, value : Any, slice : slice) -> Any: return value[slice]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slicer(seq, start=None, stop=None, step=None):\n return seq[start:stop:step]", "def SliceView(sequence, start=None, stop=None, step=1):\n start, stop, step = slice(start, stop, step).indices(len(sequence))\n for i in range(start, stop, step):\n yield sequence[i]", "def __setslice__(self,i,j...
[ "0.7565839", "0.7000143", "0.6260772", "0.62014407", "0.61427855", "0.6135608", "0.6114228", "0.60215783", "0.60061896", "0.58757776", "0.5842776", "0.5790632", "0.57842124", "0.57186073", "0.5718141", "0.56927025", "0.5638814", "0.56345797", "0.5631927", "0.56202394", "0.557...
0.0
-1
Slices a given sequence.
def slice_value(*, value : Any, stop : Optional[int] = None, start : Optional[int] = None, step : Optional[int] = None) -> Any: slice_object = slice(start, stop, step) return value[slice_object]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slicer(seq, start=None, stop=None, step=None):\n return seq[start:stop:step]", "def SliceView(sequence, start=None, stop=None, step=1):\n start, stop, step = slice(start, stop, step).indices(len(sequence))\n for i in range(start, stop, step):\n yield sequence[i]", "def __setslice__(self,i,j...
[ "0.7565839", "0.7000143", "0.6260772", "0.62014407", "0.61427855", "0.6135608", "0.6114228", "0.60215783", "0.60061896", "0.58757776", "0.5842776", "0.5790632", "0.57842124", "0.57186073", "0.5718141", "0.56927025", "0.5638814", "0.56345797", "0.5631927", "0.56202394", "0.557...
0.0
-1
Get length of the object.
def length(*, value : Any) -> Any: return len(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n # TODO: Is this method used?\n return self._info['length']", "def __len__(self):\n return self.__length", "def __len__(self):\n return self._length", "def __len__(self):\n return self._length", "def __len__(self):\n return self._length", "de...
[ "0.8329417", "0.8290465", "0.82706577", "0.82706577", "0.82706577", "0.82453144", "0.82380617", "0.82380617", "0.82030606", "0.81846595", "0.8176546", "0.81458044", "0.8143594", "0.8143594", "0.8143594", "0.8143594", "0.8143594", "0.8143594", "0.81432724", "0.81408983", "0.81...
0.0
-1
creates a dataset in the selected project name.
def create_dataset(project, dataset_name): dataset = dataset_name get_dataset = project.datasets.get(dataset_name=dataset) project.datasets.create(dataset_name=dataset_name) return get_dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset(dataset_name, project=None):\n bigquery_client = bigquery.Client(project=project)\n\n dataset = bigquery_client.dataset(dataset_name)\n\n dataset.create()\n\n print('Created dataset {}.'.format(dataset_name))", "def make_dataset(dataset_name):\n return {\n\n 'duc': DUCDat...
[ "0.75255114", "0.7364713", "0.7167282", "0.7166049", "0.7128386", "0.69960713", "0.68857396", "0.68323624", "0.6823805", "0.6704574", "0.6698785", "0.6646213", "0.6638728", "0.66347", "0.6632622", "0.65881044", "0.6533653", "0.6507332", "0.65019923", "0.64525557", "0.6451693"...
0.839208
0
QDate.longMonthName(int) > QString QDate.longMonthName(int, QDate.MonthNameType) > QString
def longMonthName(self, p_int, QDate_MonthNameType=None): # real signature unknown; restored from __doc__ with multiple overloads return QString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortMonthName(self, p_int, QDate_MonthNameType=None): # real signature unknown; restored from __doc__ with multiple overloads\r\n return QString", "def longDayName(self, p_int, QDate_MonthNameType=None): # real signature unknown; restored from __doc__ with multiple overloads\r\n return QString...
[ "0.8119586", "0.7305312", "0.6805598", "0.6763028", "0.6714535", "0.6706246", "0.6659595", "0.6582731", "0.6529906", "0.64669055", "0.6414376", "0.63960433", "0.6355838", "0.63456184", "0.63108504", "0.6283241", "0.6197185", "0.61628836", "0.6145461", "0.6120725", "0.6110693"...
0.872299
0
QDate.shortMonthName(int) > QString QDate.shortMonthName(int, QDate.MonthNameType) > QString
def shortMonthName(self, p_int, QDate_MonthNameType=None): # real signature unknown; restored from __doc__ with multiple overloads return QString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longMonthName(self, p_int, QDate_MonthNameType=None): # real signature unknown; restored from __doc__ with multiple overloads\r\n return QString", "def shortDayName(self, p_int, QDate_MonthNameType=None): # real signature unknown; restored from __doc__ with multiple overloads\r\n return QString...
[ "0.8096401", "0.7479471", "0.6847974", "0.67790824", "0.67188096", "0.6677522", "0.66605014", "0.6650857", "0.663079", "0.6575811", "0.65327126", "0.6449423", "0.64425427", "0.6411958", "0.6409632", "0.6384981", "0.63693124", "0.62323594", "0.6216138", "0.6156598", "0.6133817...
0.8803248
0
x.__nonzero__() x != 0
def __nonzero__(self): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __nonzero__(self):\n for e in self:\n if e != 0:\n return True\n return False", "def __nonzero__(self):\n return self.value.__nonzero__()", "def __nonzero__(self):\n return self.__nonzero", "def __nonzero__(self):\n return self.__nonzero", "def _...
[ "0.77507436", "0.76362675", "0.74977964", "0.74977964", "0.749715", "0.7277969", "0.71057385", "0.70980686", "0.7076215", "0.7038673", "0.7013006", "0.69773006", "0.6971467", "0.69356734", "0.6927782", "0.6920768", "0.690163", "0.6892301", "0.6864851", "0.6852248", "0.6836008...
0.62630165
67
Queries the DB specified when instantiating the PostgresConnection class, and converts to a pandas dataframe.
def get_db_data(self, sql_string): connection_string = f""" host='{self.host}' dbname='{self.db_name}' user='{self.user}' password='{self.password}' port='{self.port}' """ with psycopg2.connect(connection_string) as connection: cursor = co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_to_df(db, sql):\n conn_string = return_connection(db)\n with pg2.connect(conn_string) as conn:\n return psql.read_sql(sql, conn)", "def get_df_from_db(self, query):\n cursor = self.conn.cursor()\n cursor.execute(\"set hive.execution.engine = tez\")\n cursor.execute(\"s...
[ "0.78250766", "0.7680017", "0.7658916", "0.756852", "0.7562651", "0.75219756", "0.742555", "0.73704416", "0.7311497", "0.72347236", "0.7154484", "0.7026267", "0.7014643", "0.69704944", "0.69424963", "0.69386744", "0.6922062", "0.6856436", "0.6843526", "0.6806937", "0.6796212"...
0.7612127
3
Removes prefixes from test names.
def RemoveAllPrefixesFromGTestName(test): test_name_start = max(test.find('.'), 0) if test_name_start == 0: return test test_suite = test[:test_name_start] test_name = test[test_name_start + 1:] for prefix in _GTEST_PREFIXES: while test_name.startswith(prefix): test_name = test_name[len(prefix...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _RemoveAllPrefixes(test):\n test_name_start = max(test.find('.'), 0)\n if test_name_start == 0:\n return test\n\n test_suite = test[: test_name_start]\n test_name = test[test_name_start + 1 :]\n pre_position = test_name.find(_PRE_TEST_PREFIX)\n while pre_position == 0:\n test_name = test_name[len(_...
[ "0.8227372", "0.69030935", "0.6859826", "0.68071437", "0.6736649", "0.6658638", "0.6626187", "0.6616739", "0.6531914", "0.6497006", "0.6382004", "0.63483375", "0.63406336", "0.63406336", "0.63406336", "0.6307576", "0.6233944", "0.61911243", "0.6154941", "0.61205137", "0.61137...
0.7828494
1
Returns the test suite name of the given test in the given test step.
def GetTestSuiteName(normalized_test_name, step_ui_name): # For Webkit layout tests, the suite name is the immediate directory. if 'webkit_layout_tests' in step_ui_name: index = normalized_test_name.rfind('/') if index > 0: return normalized_test_name[:index] return None # For gtests, the suite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_suite_name(self) -> str:\n return pulumi.get(self, \"test_suite_name\")", "def test_suite_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"test_suite_name\")", "def test_name(self):\r\n parts = []\r\n if self.test.__module__ != '__main__':\r\n ...
[ "0.7873189", "0.76935846", "0.6758782", "0.64228725", "0.6417142", "0.63702446", "0.63538593", "0.63142025", "0.618164", "0.61170906", "0.6090364", "0.60693425", "0.60507196", "0.6020569", "0.59852755", "0.5974127", "0.5967955", "0.5927294", "0.59228104", "0.5906943", "0.5859...
0.76409906
2
Wraps a message based on max length without breaking html tags
def xmlwrap(cls, message, width): parts = [] tag = None for part in cls.tag_re.split(message): if not part or part == tag: continue try: tag = cls.tag_re.search(part).group(2) parts.append(part) except AttributeE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_message(message, width=MAX_LINE_LENGTH):\r\n lines = message.split('\\n')\r\n wrapped_lines = [textwrap.fill(\r\n line, width, expand_tabs=False, replace_whitespace=False, drop_whitespace=False, break_on_hyphens=False\r\n ) for line in lines]\r\n wrapped_message = '\\n'.join(wrapped_lin...
[ "0.71610236", "0.7059762", "0.6873872", "0.68430346", "0.67660695", "0.67434514", "0.6636488", "0.6518014", "0.6289828", "0.62600785", "0.6258054", "0.62074363", "0.6202228", "0.6191224", "0.6170161", "0.6110801", "0.6087548", "0.6066549", "0.6032713", "0.5987324", "0.5973213...
0.6056112
18
Initalize the queue chain.
def __init__(self, values=[]): self.priority_queue = {} if isinstance(values, list): try: for value, priority in values: self.insert(value, priority) except ValueError: raise TypeError("You need to tuplize your priorities") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_queues(self):\n for step in self.get_children():\n if step.kind == StepKinds.queue:\n step.init_object(self.context, None)", "def on_init(self, queue=None, **kwargs):\n self.queue = queue if queue else Queue()", "def __init__(self) -> None:\n self._queue ...
[ "0.77027583", "0.7436326", "0.71771425", "0.69117963", "0.68876004", "0.68876004", "0.68876004", "0.68876004", "0.68876004", "0.6874265", "0.68710995", "0.68520725", "0.6841972", "0.67942554", "0.6763624", "0.6763624", "0.6751312", "0.67453885", "0.6688666", "0.6583382", "0.6...
0.0
-1
Insert value into Priority Queue based on Priority.
def insert(self, value, priority=2): if not isinstance(priority, int): raise TypeError("Priority must be an integer") if priority in self.priority_queue: self.priority_queue[priority].append(value) else: self.priority_queue[priority] = [value] print(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enqueue(self, priority, value, key=None):\n key = key if key else value\n if key in self._index:\n self._update(priority, key)\n return\n self._heap.append(Item(priority, value, key))\n self._size = len(self._heap)\n self._index[key] = self._size - 1\n ...
[ "0.77664816", "0.7650623", "0.75169355", "0.74929976", "0.7325537", "0.72414196", "0.7231142", "0.71178186", "0.70612884", "0.7009537", "0.6946739", "0.6926697", "0.67742336", "0.676792", "0.6760499", "0.67394555", "0.67261064", "0.6715826", "0.6684557", "0.6637918", "0.66347...
0.8411199
0
Get the bounding box coordinates of the route.
def bbox(self): lower = (self.x.min(), self.y.min()) upper = (self.x.max(), self.y.max()) return (lower, upper)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(self):\n lon, lat = self.coordinates\n\n ll = (np.min(lon),np.min(lat))\n ul = (np.min(lon),np.max(lat))\n ur = (np.max(lon),np.max(lat))\n lr = (np.max(lon),np.min(lat))\n\n return (ll, ul, ur, lr)", "def bounding_box(self):\n latlon00 = self...
[ "0.78813577", "0.75658303", "0.7505888", "0.7444925", "0.7432373", "0.7415383", "0.7312216", "0.7312216", "0.7267688", "0.72331226", "0.71832114", "0.7171054", "0.7171054", "0.71427965", "0.7141005", "0.71064836", "0.70815676", "0.707229", "0.7069887", "0.70391697", "0.702487...
0.6951756
24
Calulate the Euclidean distance between two (x, y) points.
def distance_between_two_points(p1, p2): return math.sqrt((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(x, y):\n return sqrt(sum(pow(a - b, 2) for a, b in zip(x, y)))", "def euclidean_distance(x, y):\n x1, y1 = x\n x2, y2 = y\n return sqrt((x1 - x2)**2 + (y1 - y2)**2)", "def euclidean_distance(x1, y1, x2, y2):\n distance = math.sqrt(((x2 - x1) ** 2) + ((y2 - y1) ** 2))\n...
[ "0.8517095", "0.84594375", "0.838708", "0.8360094", "0.83576274", "0.83377624", "0.8269389", "0.8262849", "0.825804", "0.82316667", "0.82144594", "0.8151548", "0.81298333", "0.8097156", "0.8045504", "0.80287313", "0.8014617", "0.80068916", "0.798643", "0.7945548", "0.7933624"...
0.0
-1
Align a corner of Route extents to the origin.
def align_to_origin(self, origin=(0, 0), align_corner='bottomleft'): # Options: bottomleft, bottomright, topleft, topright if align_corner == 'bottomleft': corner = self.bbox()[0] elif align_corner == 'topright': corner = self.bbox()[1] elif align_corner == 'bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corners(self):\n x0, y0, width, height = self._rect_bbox\n xc = x0, x0 + width, x0 + width, x0\n yc = y0, y0, y0 + height, y0 + height\n transform = self._get_rotation_transform()\n coords = transform.transform(np.array([xc, yc]).T).T\n return coords[0], coords[1]", ...
[ "0.55878043", "0.55499834", "0.5539987", "0.54635084", "0.53804696", "0.53744626", "0.5358029", "0.52739376", "0.52736217", "0.5268263", "0.5205606", "0.51797235", "0.5171029", "0.5166876", "0.51094055", "0.5090577", "0.50369626", "0.5029089", "0.50289994", "0.5004285", "0.50...
0.7219897
0
Return the percept that the agent sees at this point. (Implement this.)
def percept(self, agent): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_percept(self):\n return self.percept", "def percept2(self, agent):\n percepts = [self.time_step]\n for thing in self.things_near(agent.location):\n if isinstance(thing, Gold):\n if agent.location == thing.location:\n percepts.append('Gold')\n...
[ "0.68214196", "0.65139747", "0.6464292", "0.64046663", "0.6393646", "0.6323314", "0.63021415", "0.6169189", "0.6167573", "0.6146681", "0.6146681", "0.61011004", "0.6039692", "0.6024401", "0.60152596", "0.59965676", "0.5925975", "0.5896995", "0.5878816", "0.5835684", "0.583568...
0.6654491
2
A new chat has been created. Chat details in trigger_context param. Expects HTTP200 to acknowledge event received.
def on_chat_start(self, request, trigger_context): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_chat_open(self, request, trigger_context):\n raise NotImplementedError", "def test_join_new_chat(self):\n rsp = self.client.post('/join/join-here', data={'name': 'bob'})\n rsp_json = json.loads(rsp.data)\n\n self.assertEqual(200, rsp.status_code)\n self.assertTrue(rsp_js...
[ "0.72705764", "0.6338712", "0.6266178", "0.5909621", "0.5878425", "0.5859184", "0.58451647", "0.58202666", "0.58083785", "0.58035034", "0.57817173", "0.5744734", "0.573879", "0.57045364", "0.56933945", "0.56765413", "0.56672204", "0.56501293", "0.56338274", "0.5628506", "0.56...
0.71536446
1
Use 2 layers in the model.
def generate_cnn_model(num_classes, num_words): def cnn_model(features, target): # Create embeddings and map target = tf.one_hot(target, num_classes, 1, 0) word_vectors = tf.contrib.layers.embed_sequence( features, vocab_size=num_words, embed_dim=EMBEDDING_SIZE, scope='words') wor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_layers(self):\n if self.args.model == \"exact\":\n self.layer = PPNPLayer\n else:\n self.layer = APPNPLayer\n self.setup_layer_structure()", "def sub_model_net(self):\r\n # define input\r\n x = keras.Input(shape=(960,), name='input')\r\n f...
[ "0.66570485", "0.6646728", "0.6495386", "0.6459275", "0.6446237", "0.64114165", "0.6406592", "0.63998836", "0.6260509", "0.624939", "0.6242556", "0.6210736", "0.6164048", "0.6156275", "0.612726", "0.60931474", "0.6083043", "0.6061994", "0.60524416", "0.60449994", "0.60273755"...
0.0
-1
returns the player of this node/board
def player(self): return self._node._player
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_node(self) -> MazeCell:\n return self._player_node", "def player(self):\n return self.players[self.tictactoe.turn]", "def getPlayer(self):\n return self.currentPlayer", "def getCurrentPlayer(self):\n if self.__currentnode__ is None:\n return None\n ...
[ "0.84974694", "0.80049855", "0.79447407", "0.7940067", "0.7929702", "0.7929702", "0.7923402", "0.78918636", "0.778249", "0.7725013", "0.77157575", "0.7715062", "0.7708579", "0.7669748", "0.763802", "0.7631774", "0.7610814", "0.7450632", "0.74350625", "0.7434214", "0.7427992",...
0.85981476
0
Return True if other is a Position representing the same location.
def __eq__(self, other): return type(other) is type(self) and other._node is self._node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n return self.longitude == other.getLongitude() and self.latitude == other.getLatitude()", "def is_same_as(self, other) -> bool:\n return self.x == other.x and self.y == other.y", "def __eq__(self, o...
[ "0.83753794", "0.79628336", "0.76793855", "0.76793855", "0.76535684", "0.7578589", "0.74645853", "0.73438454", "0.7314408", "0.7313857", "0.72921956", "0.72802025", "0.7278196", "0.72429216", "0.7228173", "0.7227905", "0.71943545", "0.7183101", "0.7164673", "0.715504", "0.713...
0.0
-1
allows len() to give the total number of nodes in the tree
def __len__(self): return self._size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return len(self.subtrees())", "def __len__(self):\n return self.tree.filled_size()", "def __len__(self) -> int:\n return len(self.nodes)", "def __len__(self):\n return len(self.node)", "def __len__(self) -> int:\r\n return len(self._nodes)", "def __...
[ "0.81875", "0.7934719", "0.78868026", "0.7808678", "0.7803183", "0.77667797", "0.77379775", "0.7722224", "0.7664113", "0.76318455", "0.7583294", "0.7498763", "0.74767023", "0.7470636", "0.74250937", "0.7401783", "0.7390233", "0.7324213", "0.7316254", "0.7295157", "0.7289576",...
0.0
-1
Return a numpy array with the central values of all fit parameters.
def get_central_fit_parameters(self): return np.asarray([self.parameters_central[p] for p in self.fit_parameters])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_central_nuisance_parameters(self):\n return np.asarray([self.parameters_central[p] for p in self.nuisance_parameters])", "def get_random_start(self):\n arr = np.zeros(self.dimension)\n n_fit_p = len(self.fit_parameters)\n n_nui_p = len(self.nuisance_parameters)\n arr[:n...
[ "0.6811158", "0.629768", "0.5862129", "0.5841815", "0.58381426", "0.58371836", "0.5734695", "0.56314385", "0.5509437", "0.55020016", "0.54803395", "0.5404403", "0.5391076", "0.53788275", "0.53776425", "0.5371762", "0.5366532", "0.5366532", "0.53558236", "0.53553015", "0.53442...
0.80297726
0
Convert a 1D numpy array of floats to a dictionary of fit parameters, nuisance parameters, and Wilson coefficients.
def array_to_dict(self, x): d = {} n_fit_p = len(self.fit_parameters) n_nui_p = len(self.nuisance_parameters) n_wc = len(self.fit_wc_names) d['fit_parameters'] = { p: x[i] for i, p in enumerate(self.fit_parameters) } d['nuisance_parameters'] = { p: x[i + n_fit_p] for i, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortarray_to_dict(self, x):\n d = {}\n n_fit_p = len(self.fit_parameters)\n n_wc = len(self.fit_wc_names)\n d['fit_parameters'] = { p: x[i] for i, p in enumerate(self.fit_parameters) }\n d['fit_wc'] = { p: x[i + n_fit_p] for i, p in enumerate(self.fit_wc_names) }\n re...
[ "0.6699103", "0.6092116", "0.58943063", "0.5734628", "0.5551426", "0.5487225", "0.5356745", "0.5352365", "0.5334167", "0.53135186", "0.5299158", "0.5269368", "0.52289736", "0.51430196", "0.51107275", "0.5056791", "0.50396186", "0.50333154", "0.503249", "0.5025911", "0.5006376...
0.7371965
0
Load the SM covariance from a pickle file.
def load_sm_covariance(self, filename): with open(filename, 'rb') as f: data = pickle.load(f) self.load_sm_covariance_dict(d=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pickle(filename):\n try:\n with open(filename, 'rb') as handle:\n obj = joblib.load(handle)\n return obj\n except:\n print(\"File {} not found. This is ok if about to generate cov matrices\".format(filename))\n return np.nan", "def load_exp_central_covariance...
[ "0.6869299", "0.6702878", "0.66240215", "0.6419365", "0.63671595", "0.6265688", "0.62655413", "0.6226587", "0.6139825", "0.6124369", "0.60798174", "0.5977576", "0.5908022", "0.5902734", "0.5883481", "0.58490777", "0.578287", "0.57825226", "0.5765771", "0.5728937", "0.5718042"...
0.8537413
0
Initialize the fit by producing a pseudomeasurement containing both experimental uncertainties as well as theory uncertainties stemming from nuisance parameters.
def make_measurement(self, N=100, Nexp=5000, threads=1, force=False, force_exp=False): central_exp, cov_exp = self.get_exp_central_covariance(Nexp, force=force_exp) cov_sm = self.get_sm_covariance(N, force=force, threads=threads) covariance = cov_exp + cov_sm # add the Pseudo-measurement...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, fit_input:dict=None):\n if fit_input is not None:\n self.fit_input = fit_input\n self.spatial_only = True # spatial only until energy likelihoods are given", "def __init__(self):\n self.configuration = None\n self.initial_guess = self.default_initial_gues...
[ "0.60763663", "0.5942937", "0.586952", "0.58634394", "0.58315694", "0.57959574", "0.5767581", "0.5759208", "0.57584196", "0.57354707", "0.57218474", "0.57214063", "0.57097745", "0.57036626", "0.5670787", "0.5666616", "0.5653664", "0.5638877", "0.5634654", "0.5616419", "0.5614...
0.0
-1
Computer LN given an input tensor. We get in an input of shape [N X D] and with LN we compute the mean and var for each individual training point across all it's hidden dimensions rather than across the training batch as we do in BN. This gives us a mean and var of shape [N X 1].
def ln(inputs, epsilon=1e-5, scope=None): mean, var = tf.nn.moments(inputs, [-1], keep_dims=True) with tf.variable_scope(scope + 'LN'): scale = tf.get_variable('alpha', shape=[inputs.get_shape()[-1]], initializer=tf.constant_initializer(1))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NLL(sample, params):\n mu = params[:,:,0]\n logsigma = params[:,:,1]\n \n c = normalization.to(mu.device)\n inv_sigma = torch.exp(-logsigma)\n tmp = (sample - mu) * inv_sigma\n return torch.mean(0.5 * (tmp * tmp + 2 * logsigma + c))", "def gaussian_nll(x, mean, ln_var):\n\n x_prec...
[ "0.6814969", "0.6087507", "0.60163474", "0.6015389", "0.59040576", "0.58562744", "0.58349335", "0.58075494", "0.5805271", "0.5801089", "0.579217", "0.5745171", "0.5718494", "0.57097584", "0.570159", "0.5698866", "0.56974626", "0.56872356", "0.5686488", "0.56854874", "0.567622...
0.62436026
1
Convert degrees to quaternions
def to_quaternion(self,roll=0.0, pitch=0.0, yaw=0.0): t0 = math.cos(math.radians(yaw * 0.5)) t1 = math.sin(math.radians(yaw * 0.5)) t2 = math.cos(math.radians(roll * 0.5)) t3 = math.sin(math.radians(roll * 0.5)) t4 = math.cos(math.radians(pitch * 0.5)) t5 = math.sin(math....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate", "def angle_to_quaternion(angle):\n\treturn Quaternion(*tf.transformations.quaternion_from_euler(0, 0, angle))", "def angle_to_quaternion(angle):\n return Quaternion(*tf.transformations.quaternion_from_eul...
[ "0.7152074", "0.7079169", "0.6979342", "0.68902564", "0.688503", "0.6838166", "0.68257564", "0.6786422", "0.6782196", "0.67521816", "0.6745304", "0.67351747", "0.6730065", "0.6655554", "0.6650059", "0.66377956", "0.66352797", "0.66168916", "0.6613836", "0.6551517", "0.6550865...
0.61208457
57
Sets the id of this Ifc.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id):\n self.__id = id", "def set_id(self, id_):\n\n self.id_ = id_", "def SetId(self, id):\n self.id = int(id)", "def setID(self, idf):\n self.id = idf", "def setID(self, id):\n self._id = id\n return self.callRemote('setID', id)", "def set_id(se...
[ "0.76008344", "0.7511835", "0.74858737", "0.74378175", "0.7314446", "0.72957957", "0.72513235", "0.72513235", "0.72513235", "0.72513235", "0.72513235", "0.7187202", "0.7187202", "0.7187202", "0.7187202", "0.7187202", "0.7187202", "0.7187202", "0.7187202", "0.7187202", "0.7187...
0.0
-1
Sets the name of this Ifc.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetName(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n ...
[ "0.7725708", "0.7713939", "0.7713939", "0.7713939", "0.7713939", "0.7713939", "0.7670829", "0.76555294", "0.76546746", "0.76546746", "0.7631281", "0.7594796", "0.7575419", "0.75295275", "0.75295275", "0.7510359", "0.7463271", "0.7463271", "0.7420806", "0.7409372", "0.7387007"...
0.0
-1
Sets the creator of this Ifc.
def creator(self, creator): self._creator = creator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creator(self, creator):\n self._creator = creator", "def setCreator(self,value):\n self.PDFreactorConfiguration.in1[\"creator\"] = value", "def creator(self, creator):\n if creator is None:\n raise ValueError(\"Invalid value for `creator`, must not be `None`\")\n if c...
[ "0.7606479", "0.735835", "0.6725008", "0.6552184", "0.6552184", "0.6474695", "0.6474695", "0.6261486", "0.6261486", "0.6261486", "0.6261486", "0.60966516", "0.5994482", "0.5994032", "0.5994032", "0.5994032", "0.5994032", "0.5994032", "0.5994032", "0.59151036", "0.58840555", ...
0.7554864
3
Sets the document_id of this Ifc.
def document_id(self, document_id): if document_id is None: raise ValueError("Invalid value for `document_id`, must not be `None`") # noqa: E501 self._document_id = document_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_id(self, document_id):\n\n self._document_id = document_id", "def set_DocumentId(self, value):\n super(DownloadDocumentInputSet, self)._set_input('DocumentId', value)", "def document(self, document):\n\n self._document = document", "def document(self, document):\n\n s...
[ "0.7987925", "0.68970627", "0.6335244", "0.6335244", "0.6158855", "0.60930973", "0.5961394", "0.5961394", "0.5961394", "0.58780915", "0.57487065", "0.5728034", "0.57201034", "0.5649035", "0.5642965", "0.5613018", "0.5599558", "0.55312896", "0.55197525", "0.54867023", "0.54698...
0.74769324
1
Sets the project_id of this Ifc.
def project_id(self, project_id): if project_id is None: raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 self._project_id = project_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_project_id(self, project_id):\n self._project_id = project_id", "def project_id(self, project_id):\n\n self._project_id = project_id", "def project_id(self, project_id):\n\n self._project_id = project_id", "def set_project(project_id):\n return fluent.set_project(project_id)",...
[ "0.80719465", "0.79470223", "0.79470223", "0.7137763", "0.64405227", "0.64154065", "0.64154065", "0.6399169", "0.6399169", "0.6399169", "0.6399169", "0.6292466", "0.6039423", "0.596651", "0.5870742", "0.5691129", "0.56828415", "0.5616093", "0.55805403", "0.55805403", "0.55299...
0.71029145
4
Sets the zones of this Ifc.
def zones(self, zones): self._zones = zones
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svc_set_zone_config(self, **kwargs) -> None:\n self._call_client_api(self._device.set_config, **kwargs)", "def setZoneRecords(self, records):\n self._dump_data['zone'] = records", "def enable_zones(self, zones):\r\n if isinstance(zones, str) or isinstance(zones, unicode):\r\n zo...
[ "0.5961863", "0.58072215", "0.57445395", "0.56828344", "0.5639419", "0.56248623", "0.53573406", "0.53573406", "0.53573406", "0.53573406", "0.53573406", "0.53293926", "0.5326192", "0.5322497", "0.5322497", "0.5251255", "0.51601774", "0.51601774", "0.51457953", "0.50787395", "0...
0.78344804
1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Ifc): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Reset for floats/arrays. Should probably be NaN, but avoids having to check for min/max being set can optionally set the value
def reset(self): if self.allowable_max < self.allowable_min: raise ValueError("{0} max less than min".format(self)) self.min_found = self.allowable_max * 1e6 self.max_found = self.allowable_min * 1e-6 self.avg_found = self.allowable_min * 0.0 self.count = 0 se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.value = self.min_value", "def reset(self):\n if np.any(self.val != self.valinit):\n self.set_val(self.valinit)", "def invalidate_min_max(self):\n self.max_amplitude = None\n self.min_amplitude = None\n self.max_wavenumber = None\n sel...
[ "0.7635695", "0.7409053", "0.7145911", "0.7055829", "0.69432485", "0.6926571", "0.6916363", "0.6910671", "0.68368423", "0.6725203", "0.67122966", "0.66524297", "0.66411924", "0.6640234", "0.66135174", "0.65856117", "0.6512947", "0.6490947", "0.6423494", "0.6412114", "0.638969...
0.76782066
0
Returns list of size `count` of integers >= 0, summing to `sum_`.
def uniform_non_negative_integers_with_sum(count, sum_): positive = uniform_positive_integers_with_sum(count, sum_ + count) return [i - 1 for i in positive]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniform_positive_integers_with_sum(count, sum_):\n assert sum_ >= 0\n if count > sum_:\n raise ValueError('Cannot find {} numbers >= 1 with sum {}'\n .format(count, sum_))\n if count == 0:\n return []\n # Select `count - 1` numbers from {1, ..., sum_ - 1}\n separators = random.sa...
[ "0.7122004", "0.58127195", "0.5766803", "0.5760794", "0.57237494", "0.57139254", "0.5681232", "0.5644841", "0.5587792", "0.5581283", "0.5526674", "0.5477838", "0.5465219", "0.54242647", "0.5357632", "0.532043", "0.53089404", "0.5290919", "0.5278949", "0.52256936", "0.52032185...
0.73194647
0
Test that the ``react_all`` function works in parallel using Python multiprocessing
def test_react_all_parallel(self): import rmgpy.rmg.main rmgpy.rmg.main.maxproc = 2 procnum = 2 spcs = [ Species().from_smiles('C=C'), Species().from_smiles('[CH3]'), Species().from_smiles('[OH]'), Species().from_smiles('CCCCCCCCCCC') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_react_parallel(self):\n import rmgpy.rmg.main\n rmgpy.rmg.main.maxproc = 2\n procnum = 2\n\n spc_a = Species().from_smiles('[OH]')\n spcs = [Species().from_smiles('CC'), Species().from_smiles('[CH3]')]\n spc_tuples = [((spc_a, spc), ['H_Abstraction']) for spc in s...
[ "0.74236333", "0.64298403", "0.6035447", "0.5993434", "0.5977387", "0.5972954", "0.59582156", "0.5947237", "0.5939132", "0.59300476", "0.5864078", "0.5851499", "0.58441734", "0.5818219", "0.58164334", "0.58138275", "0.5751171", "0.57474524", "0.57349277", "0.57294875", "0.570...
0.77412826
0
Infinite generator of odd numbers
def odd(): num = 0 while True: yield num * (num & 1) num += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infinite_odd_generator():\n current = 1\n while True:\n yield current\n current = current + 2", "def odd_generator(limit):\n current = 1\n while current < limit:\n yield current\n current = current + 2", "def test_generator_method(self):\n for i in range(0...
[ "0.88493246", "0.81755483", "0.6933841", "0.691744", "0.68216807", "0.6724125", "0.6643856", "0.66391385", "0.65874535", "0.65512615", "0.65505296", "0.6539977", "0.65232295", "0.64730626", "0.63426095", "0.6312148", "0.62507874", "0.6227739", "0.6209182", "0.6192163", "0.616...
0.838798
1
`fixed_sequence_length` is important when training on TPU
def create_sentence_pairs_collate_fn(PAD_token, fixed_sequence_length=None): if fixed_sequence_length: logger.info(f"Using fixed sequence lengths of {fixed_sequence_length} tokens.") def collate_fn(indexed_sentence_pairs): # Why is the sort required? # ==> This is a CuDNN requirement ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_length(self, new_seq_length):\n self._sequence_length = new_seq_length\n self.tensors = [torch.tensor(\n generate_batches(x, self._sequence_length, self._sequence_stride)).float()\n for x in [self.inputs, self.outputs]]", "def paddingSequence(X_train, ...
[ "0.63949543", "0.61093545", "0.6096601", "0.60559607", "0.5999081", "0.596477", "0.5943129", "0.59129125", "0.5911029", "0.59061813", "0.5824285", "0.58112943", "0.58056337", "0.5795621", "0.5773663", "0.5757414", "0.5723625", "0.5685834", "0.5642662", "0.56293774", "0.562581...
0.0
-1
An optional textual description of the instance group manager.
def description(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "description")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region_instance_group_manager(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"region_instance_group_manager\")", "def global_replication_group_description(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"global_replication_group_description\")", "def global_replicati...
[ "0.65178996", "0.6464517", "0.6464517", "0.6442011", "0.6410427", "0.6318157", "0.6292289", "0.62709075", "0.6173922", "0.6125568", "0.60044706", "0.5989081", "0.5984832", "0.591561", "0.59003466", "0.59003466", "0.58930343", "0.5857529", "0.58334965", "0.58273524", "0.581043...
0.0
-1
The distribution policy for this managed instance
def distribution_policy_zones(self) -> pulumi.Output[List[str]]: return pulumi.get(self, "distribution_policy_zones")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_policy(self):\n\n return", "def get_policy(self):\n return self.agent.get_policy()", "def policy(self) -> HwPolicy:\n return self._policy", "def allocation_policy(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"allocation_policy\")", "def policy(self) ...
[ "0.7115384", "0.68115056", "0.6785003", "0.67210287", "0.6669487", "0.66248345", "0.65664035", "0.65664035", "0.65664035", "0.6464327", "0.64581394", "0.6453168", "0.6453168", "0.64279705", "0.64247775", "0.64247775", "0.6357863", "0.6357863", "0.6319181", "0.6309273", "0.630...
0.0
-1
The full URL of the instance group created by the manager.
def instance_group(self) -> pulumi.Output[str]: return pulumi.get(self, "instance_group")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url(self):\n return url_for('/admin/groups/{}'.format(self.key))", "def getURI(self, *args):\n return _libsbml.GroupsExtension_getURI(self, *args)", "def getURI(self):\n return _libsbml.GroupsPkgNamespaces_getURI(self)", "def instance_group(self):\n return self._instance_group...
[ "0.80278784", "0.687729", "0.63816345", "0.614715", "0.6109407", "0.6109407", "0.6109407", "0.6109407", "0.6109407", "0.6109407", "0.6109407", "0.6109407", "0.6107233", "0.6074248", "0.6037666", "0.6023866", "0.60043365", "0.5988312", "0.5968529", "0.5968529", "0.59629446", ...
0.65258294
2
The region where the managed instance group resides.
def region(self) -> pulumi.Output[str]: return pulumi.get(self, "region")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(self) -> str:\n return self.__region", "def region(self):\n return self.config.region", "def region(self):\n return self._get(\"region\")", "def region(self):\n return self._region", "def region(self):\n return self._region", "def endpoint_group_region(self) ...
[ "0.8010288", "0.80065036", "0.7990133", "0.79279643", "0.79279643", "0.791069", "0.7864398", "0.7864398", "0.7864398", "0.7864398", "0.7864398", "0.7864398", "0.7843217", "0.7775644", "0.75909287", "0.7505919", "0.7472873", "0.7472873", "0.7472873", "0.7472873", "0.7452914", ...
0.74855524
21
haversine formula to get distance in meters
def haversine(origin, destination): lat1, lon1 = origin lat2, lon2 = destination radius = 6371000 dlat = math.radians(lat2 - lat1) dlon = math.radians(lon2 - lon1) a = math.sin(dlat / 2) * math.sin(dlat / 2) + math.cos(math.radians(lat1)) * math.cos( math.radians(lat2)) * math.sin(dlon /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_distance_haversine(coord1, coord2):\n lat1, lon1 = coord1\n lat2, lon2 = coord2\n # approximate radius of earth in km\n R = 6373.0\n\n lat1 = radians(lat1)\n lon1 = radians(lon1)\n lat2 = radians(lat2)\n lon2 = radians(lon2)\n\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n\n ...
[ "0.7616866", "0.7604827", "0.7284842", "0.72253686", "0.7183302", "0.71782696", "0.7176504", "0.7175498", "0.7149683", "0.7105009", "0.7102541", "0.7088861", "0.7067372", "0.7063075", "0.7056165", "0.7052046", "0.7029711", "0.7018232", "0.70083225", "0.6997249", "0.69937575",...
0.72226274
4
Evaluate (possibly unnormalized) pdf over a meshgrid.
def evaluate_bivariate_pdf(p_z, range, npoints, sess): side = np.linspace(range[0], range[1], npoints) z1, z2 = np.meshgrid(side, side) z = np.hstack([z1.reshape(-1, 1), z2.reshape(-1, 1)]) prob = sess.run(tf.exp(p_z), feed_dict={z_0:z}) return z1, z2, prob
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf(self, grid, dataSegment):\n temp = grid[0][:] # make copy of parameter grid\n temp[temp > 1.] = 0. # p < 1\n temp[temp < 0.] = 0. # p > 0\n\n if dataSegment[0]:\n pass # pdf = p\n else:\n temp = 1. - temp # pdf = 1 - p\n\n return temp", ...
[ "0.7058078", "0.69139713", "0.67356205", "0.6659197", "0.6632267", "0.65002656", "0.6487024", "0.6469658", "0.63438135", "0.6311072", "0.6195196", "0.6159534", "0.61580455", "0.61118317", "0.60907745", "0.59862655", "0.5977282", "0.59643334", "0.59522116", "0.59150136", "0.59...
0.64887494
6
Evaluate (possibly unnormalized) pdf over a meshgrid.
def evaluate_bivariate_pdf_transformed(p_z, z_k, range, npoints, sess): side = np.linspace(range[0], range[1], npoints) z1, z2 = np.meshgrid(side, side) z = np.hstack([z1.reshape(-1, 1), z2.reshape(-1, 1)]) prob = sess.run(tf.exp(p_z), feed_dict={z_0:z}) z_k = sess.run(z_k, feed_dict={z_0: z}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf(self, grid, dataSegment):\n temp = grid[0][:] # make copy of parameter grid\n temp[temp > 1.] = 0. # p < 1\n temp[temp < 0.] = 0. # p > 0\n\n if dataSegment[0]:\n pass # pdf = p\n else:\n temp = 1. - temp # pdf = 1 - p\n\n return temp", ...
[ "0.7056964", "0.69126225", "0.67344403", "0.66581446", "0.6632508", "0.6498774", "0.6488121", "0.6485571", "0.6468177", "0.63422906", "0.631023", "0.6159422", "0.6156919", "0.6111721", "0.6088595", "0.59863585", "0.59757966", "0.59640026", "0.59523505", "0.59150285", "0.59100...
0.6195063
11
Deprecated since muzika supports ethereum and ontology protocol. This only checks the address is ethereum account format, so use `check_eth_address_format` if checking ethereum account or use `check_ont_address_format` to check ontology account format.
def check_address_format(address): if len(address) != 42 or address[:2] != '0x': return False for ch in address[2:]: if ch not in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890": return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_eth_address_format(address):\n if len(address) != 42 or address[:2] != '0x':\n return False\n\n for ch in address[2:]:\n if ch not in \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\":\n return False\n\n return True", "def validate_address(address:str)...
[ "0.70649725", "0.6952313", "0.66243076", "0.65986884", "0.6579121", "0.65078485", "0.6411364", "0.6313796", "0.62809724", "0.6163311", "0.6159437", "0.6132673", "0.5932768", "0.5889719", "0.58688897", "0.57983047", "0.5786431", "0.5784806", "0.5719249", "0.5712209", "0.565022...
0.6787064
2
ORG / Organization Registry
def org(): ADMIN = current.session.s3.system_roles.ADMIN SECTORS = "Clusters" if current.deployment_settings.get_ui_label_cluster() \ else "Sectors" return M(c="org")( M("Organizations", f="organisation")( M("Create", m="...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atlas_organizations():\n pass", "def org():\n\n settings = current.deployment_settings\n ADMIN = current.session.s3.system_roles.ADMIN\n SECTORS = \"Clusters\" if settings.get_ui_label_cluster() \\\n else \"Sectors\"\n stats = lambda i: settings.has_...
[ "0.6763007", "0.6492382", "0.6429063", "0.6282557", "0.6249889", "0.6188225", "0.61638963", "0.6094433", "0.6059302", "0.6025161", "0.59956837", "0.5980094", "0.59651905", "0.5891342", "0.58489025", "0.5847773", "0.58200425", "0.5746552", "0.573843", "0.573843", "0.573843", ...
0.6183897
6
Serializes this instance to a Python dictionary.
def to_dict(self): output = copy.deepcopy(self.__dict__) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dumpd(self)", "def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\r\n return self.__dict__", "def to_dict(self):\n return s...
[ "0.8421195", "0.84043926", "0.8362277", "0.83090377", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.8236021", "0.82179517", "0.82133806", "0.82032114", "0.8181652", "0.8179579", "0.81732064", "0.81534773", "0.8118078", "0.8090142", "0....
0.0
-1
Serializes this instance to a JSON string.
def to_json_string(self): return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> st...
[ "0.88999254", "0.8837045", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.87147456", "0.8637419", "0.8619328", "0.8598524", "0.8572258", "0.8568808", "0.8568808", "0.8446259", "0.8446259", "0.8446259", ...
0.0
-1
Converts a raster to a line shapefile, where ``pixel_value`` determines line start and end points.
def raster2line(raster_file_name, out_shp_fn, pixel_value): # calculate max. distance between points # ensures correct neighbourhoods for start and end pts of lines raster, array, geo_transform = raster2array(raster_file_name) pixel_width = geo_transform[1] max_distance = np.ceil(np.sqrt(2 * pixel_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curve_to_line(self):\n return _unary_geo(arctern.ST_CurveToLine, self)", "def raster_linify(channel):\n k_lines = []\n right = True\n for X in range(channel.shape[0]):\n linestart = None\n inline = False\n if right == True:\n Y=0\n while (Y < channel...
[ "0.56106436", "0.5516042", "0.5451473", "0.5190002", "0.5074397", "0.5016553", "0.4998306", "0.49609667", "0.4947257", "0.4936952", "0.49210402", "0.49196485", "0.49100143", "0.486752", "0.4864957", "0.48588872", "0.48572835", "0.48303378", "0.48156807", "0.47999814", "0.4770...
0.7735919
0
Returns the default value for this field. The default implementation on models.Field calls force_str on the default, which means you can't set arbitrary Python objects as the default. To fix this, we just return the value without calling force_str on it. Note that if you set a callable as a default, the field will stil...
def get_default(self): if self.has_default(): if callable(self.default): return self.default() return self.default # If the field doesn't have a default, then we punt to models.Field. return super().get_default()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_value(self):\r\n if callable(self._default):\r\n return self._default()\r\n return self._default", "def default(self):\n if callable(self._default):\n return self._default()\n\n return self._default", "def default(self):\r\n if callable(self....
[ "0.7965407", "0.7419583", "0.7417374", "0.73321116", "0.7253449", "0.72530806", "0.7237861", "0.7228919", "0.7202137", "0.7202137", "0.70342", "0.70094585", "0.699183", "0.698915", "0.6929237", "0.6925097", "0.6892102", "0.68819267", "0.68565226", "0.68365496", "0.683512", ...
0.8100797
0
Pickle and b64encode the object, optionally compressing it. The pickling protocol is specified explicitly (by default 2), rather than as 1 or HIGHEST_PROTOCOL, because we don't want the protocol to change over time. If it did, ``exact`` and ``in`` lookups would likely fail, since pickle would now be generating a differ...
def get_db_prep_value(self, value, connection=None, prepared=False): if value is not None and not isinstance(value, PickledObject): # We call force_str here explicitly, so that the encoded string # isn't rejected by the postgresql backend. Alternatively, # we could have just ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(Value):\n return base64.b64encode(zlib.compress(pickle.dumps(Value),9))", "def pickle(obj):\n return pickletools.optimize(cPickle.dumps(obj))", "def compress(value):\n pickled = pickle_util.dump(value)\n return zlib.compress(pickled)", "def object_to_param_str(obj):\n return...
[ "0.64942366", "0.63257295", "0.6108462", "0.60170376", "0.6001938", "0.5934139", "0.59209794", "0.5910281", "0.58863634", "0.5847116", "0.58158183", "0.58074975", "0.5764063", "0.576124", "0.57034963", "0.56393117", "0.5603462", "0.5589314", "0.55165863", "0.5498033", "0.5495...
0.0
-1
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81450045", "0.7863265", "0.76322985", "0.76064754", "0.75978696", "0.75965863", "0.75944835", "0.75720793", "0.75630087", "0.7555095", "0.7528691", "0.7517629", "0.7492963", "0.7467739", "0.7452678", "0.7434477", "0.73914117", "0.7357736", "0.73484355", "0.73318124", "0.73...
0.0
-1
Returns True if lst contains elements in nondecreasing order as determined by the < operator. Returns False if the elements of lst are not in order. Throws an exception if lst is not a list or its elements are not compatible with the < operator.
def is_ascending(lst): for i in range(len(lst) - 1): for j in range(i + 1, len(lst)): if lst[i] > lst[j]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateListIsIncreasing(lst):\n if not type(lst) == list:\n return \"false\"\n if len(lst) == 0:\n return \"false\"\n for i in range(1, len(lst), 1):\n # allow only bigger or equal elements following\n if(lst[i] < lst[i - 1]):\n return \"false\"\n return \"tr...
[ "0.7242137", "0.72214943", "0.71870613", "0.6505474", "0.64767545", "0.64602256", "0.62692374", "0.6202587", "0.6191283", "0.6131461", "0.609136", "0.6067486", "0.6058845", "0.604702", "0.60416913", "0.600323", "0.5940561", "0.5922674", "0.59025216", "0.5895114", "0.5876886",...
0.70731837
3
Returns True if lst contains elements in nondecreasing order as determined by the < operator. Returns False if the elements of lst are not in order. Throws an exception if lst is not a list or its elements are not compatible with the < operator.
def is_ascending2(lst): for i in range(len(lst) - 1): if lst[i] > lst[i + 1]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateListIsIncreasing(lst):\n if not type(lst) == list:\n return \"false\"\n if len(lst) == 0:\n return \"false\"\n for i in range(1, len(lst), 1):\n # allow only bigger or equal elements following\n if(lst[i] < lst[i - 1]):\n return \"false\"\n return \"tr...
[ "0.7240756", "0.72196025", "0.7072868", "0.65040433", "0.6475344", "0.6459152", "0.6268099", "0.62014914", "0.6190897", "0.6130084", "0.60925406", "0.606699", "0.60579705", "0.6045748", "0.6041074", "0.60017866", "0.5939485", "0.5922428", "0.5901148", "0.58933014", "0.5875714...
0.7186721
2
Compares the performance of the is_ascending and is_ascending2 functions on lists of various sizes.
def main(): data1, data2 = [], [] # Compute results for sizes in the range 0...40,000 max_size = 40000 # Sizes used are 0**2 = 0, 20**2 = 400, 40**2 = 1600, 60**2 = 3600, # etc. up to 200**2 = 40,000 for size in (x**2 for x in range(0, round(sqrt(max_size)) + 1, 20)): compute_time(size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ascending2(lst):\n for i in range(len(lst) - 1):\n if lst[i] > lst[i + 1]:\n return False\n return True", "def compute_time(size, data1, data2):\n\n print(\"List size:\", size)\n my_list = list(range(size)) # Make list [0, 1, 2, 3, ..., size - 1]\n start = clock() ...
[ "0.6841603", "0.6778285", "0.6720954", "0.6471349", "0.62942326", "0.62434614", "0.6209229", "0.6006006", "0.58396053", "0.57390577", "0.56763923", "0.56508017", "0.56479293", "0.5615024", "0.56118643", "0.55878514", "0.5576921", "0.5559624", "0.5528558", "0.5514989", "0.5506...
0.0
-1
Returns ``True`` if value is a builtin numeric object (e.g. ``int``, ``float``, ``long``, ``Decimal``, etc.).
def is_number(value, allow_bool=False): if isinstance(value, bool): return allow_bool return isinstance(value, _Number)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeric(obj):\n return isinstance(obj, (int, float, complex))", "def isNumeric(obj):\n return isinstance(obj, (int, float, bool))", "def isNumeric(obj):\n # type: (Any) -> bool\n return isinstance(obj, numbers.Number)", "def is_numeric(value):\n return isinstance(value, int) or isin...
[ "0.7451208", "0.7300595", "0.72985935", "0.7213701", "0.71166027", "0.7105885", "0.7054803", "0.70390123", "0.70143133", "0.7000625", "0.69475585", "0.6895886", "0.67697465", "0.6760952", "0.6737889", "0.6728114", "0.6724493", "0.67034614", "0.66412693", "0.66246176", "0.6542...
0.65920866
20
Returns ``True`` if value is an iterable container (e.g. ``list`` or ``tuple`` but not a generator).
def is_iterable(value): # noinspection PyUnresolvedReferences return hasattr(value, '__iter__') and hasattr(value, '__getitem__')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_iterable_container(value):\n # strings are iterable too so we have to treat them as a special case\n return not isinstance(value, str) and isinstance(value, collections.Iterable)", "def isIterable(value):\n try:\n iter(value)\n return True\n except:\n return False", "def...
[ "0.88312304", "0.87683564", "0.8710786", "0.81222916", "0.7924384", "0.79081273", "0.7863658", "0.7796763", "0.7740734", "0.77300227", "0.7717659", "0.7715914", "0.7699153", "0.76303655", "0.75888765", "0.75461113", "0.7543443", "0.7426666", "0.740164", "0.73852044", "0.73464...
0.8564635
3
Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the
def get_distance_metres(aLocation1, aLocation2): dlat = aLocation2.lat - aLocation1.lat dlong = aLocation2.lon - aLocation1.lon return math.sqrt((dlat * dlat) + (dlong * dlong)) * 1.113195e5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance_metres(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5", "def get_distance_metres(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aL...
[ "0.66148055", "0.66148055", "0.66148055", "0.66148055", "0.66148055", "0.6583338", "0.6557492", "0.6514061", "0.6269064", "0.6211089", "0.6161022", "0.6104028", "0.60677063", "0.60477495", "0.5999031", "0.59411407", "0.58524305", "0.58501494", "0.5795043", "0.5736", "0.570463...
0.65862477
5
If the canvas has annotations, add them to the response. A call to check whether there are any annotations at all for this manifest is performed in the `Manifest` serializer, and the result is passed down here as an optimization, so that we don't have to check every canvas in Solr for annotations when the bulk of our m...
def get_other_content(self, obj: SolrResult) -> Optional[List]: has_annotations = self.context.get("has_annotations") if not has_annotations and not self.context.get('direct_request'): return None # check if the canvas has any non-image annotation pages sid = obj["id"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, request, *args, **kwargs): # pylint: disable = unused-argument\n # manifest = self.get_queryset()[0].id\n # annotators = User.objects.filter(annotation__canvas__manifest__id=manifest).distinct()\n annotators = []\n if request.user.is_authenticated:\n annotators....
[ "0.60319895", "0.5791774", "0.5398183", "0.53976905", "0.5371988", "0.53216404", "0.5279495", "0.52498215", "0.52149117", "0.5168656", "0.5050367", "0.49932328", "0.4982622", "0.49709442", "0.49023166", "0.49001253", "0.4881371", "0.48783773", "0.48612964", "0.4859963", "0.48...
0.5645073
2
Returns a url using the preferred domain name for this app instance.
def rewrite_url(url, project=None): parts = list(urlparse.urlsplit(url)) new_domain = get_preferred_domain(project=project, default_to_appid=False) if new_domain: parts[1] = new_domain return urlparse.urlunsplit(parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application_host_url(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"application_host_url\")", "def app_url(self):\n return self.request.host_url", "def application_url(self) -> Optional[str]:\n return pulumi.get(self, \"application_url\")", "def url(self):\n return self.h...
[ "0.7205508", "0.71394145", "0.6919664", "0.67903703", "0.67515934", "0.66990566", "0.66172755", "0.6597922", "0.6586575", "0.6578005", "0.656904", "0.65622306", "0.65060335", "0.65028477", "0.64580435", "0.6456479", "0.6446549", "0.64229774", "0.64213884", "0.6419966", "0.641...
0.0
-1
This function instantiates the tool logic Turntable class with the values given by the user.
def init_turn(self): sender = self.sender() cur_settings = self.setting_dropdown.currentText() if sender: cur_disp = self.rad_grp.checkedButton() self.start_frm = self.start_frm_le.text() self.end_frm = self.end_frm_le.text() file_path = self.save...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, flowchart=None, extension=None):\n logger.debug(\"Creating Table {}\".format(self))\n\n # Initialize our parent class\n super().__init__(\n flowchart=flowchart, title=\"Table\", extension=extension, logger=logger\n )\n\n # This needs to be after init...
[ "0.5998906", "0.5993782", "0.59766316", "0.59378535", "0.58716434", "0.585806", "0.5857164", "0.58565325", "0.58433634", "0.58353734", "0.58146834", "0.5732648", "0.5724465", "0.5720131", "0.5706572", "0.56990594", "0.5698365", "0.5698007", "0.56845826", "0.5674405", "0.56584...
0.61193466
0
Get the value for a session variable.
def get(self, key, default=None): return self.data.get(key, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvar(request, field_name, setsession=False):\n if request.method == 'GET':\n if field_name in request.GET:\n val = request.GET[field_name]\n else:\n val = ''\n\n if request.method == 'POST':\n if field_name in request.POST:\n val = request.POST[fiel...
[ "0.714", "0.67871875", "0.65893376", "0.6372777", "0.61924124", "0.6153164", "0.6137498", "0.61363316", "0.6080506", "0.6062471", "0.603673", "0.59926516", "0.5946611", "0.59447896", "0.59431493", "0.59375715", "0.5936777", "0.5929405", "0.59130853", "0.59109", "0.5869733", ...
0.0
-1
Testing the POST reviewrequests//reviews//replies//diffcomments/ API with a local site and Permission Denied error
def test_post_reply_with_diff_comment_and_local_site_no_access(self): self.test_post_reply_with_diff_comment_and_local_site(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_review_detail_other_method_not_allowed(self):\n client = Client()\n client.login(username='TEST_USER_1',\n email='TEST_EMAIL_1', password='TEST_PW_1')\n response = client.post('/api/review/1/')\n self.assertEqual(response.status_code, 405)", "def test_revi...
[ "0.703492", "0.68783784", "0.68386877", "0.6725568", "0.67050797", "0.6553093", "0.6524634", "0.6513208", "0.6505711", "0.64795756", "0.64781076", "0.6427316", "0.64147395", "0.6345302", "0.6296733", "0.629124", "0.62561035", "0.6231691", "0.62144536", "0.61530113", "0.610549...
0.6985187
1
Testing the PUT reviewrequests//reviews//replies//diffcomments/ API with a local site
def test_put_reply_with_diff_comment_and_local_site(self): new_comment_text = 'My new comment text' rsp = self.test_post_reply_with_diff_comment_and_local_site()[0] reply_comment = Comment.objects.get(pk=rsp['diff_comment']['id']) rsp = self.apiPut( rsp['diff_comment']['li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_put_reply_with_diff_comment_and_local_site_no_access(self):\n new_comment_text = 'My new comment text'\n\n rsp = self.test_post_reply_with_diff_comment_and_local_site()[0]\n\n self._login_user()\n rsp = self.apiPut(\n rsp['diff_comment']['links']['self']['href'],\n ...
[ "0.65393895", "0.62735087", "0.62373966", "0.62256247", "0.622363", "0.6219342", "0.6142737", "0.6079739", "0.60715234", "0.6055641", "0.6004901", "0.5975592", "0.5970512", "0.5959325", "0.5943743", "0.5939068", "0.5916239", "0.5909859", "0.5894517", "0.5879853", "0.5844074",...
0.6731006
0
Testing the PUT reviewrequests//reviews//replies//diffcomments/ API with a local site and Permission Denied error
def test_put_reply_with_diff_comment_and_local_site_no_access(self): new_comment_text = 'My new comment text' rsp = self.test_post_reply_with_diff_comment_and_local_site()[0] self._login_user() rsp = self.apiPut( rsp['diff_comment']['links']['self']['href'], {'t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_review_list_other_method_not_allowed(self):\n client = Client()\n client.login(username='TEST_USER_1',\n email='TEST_EMAIL_1', password='TEST_PW_1')\n response = client.put('/api/review/')\n\n self.assertEqual(response.status_code, 405)", "def test_friend_...
[ "0.74524605", "0.7369447", "0.7042684", "0.68080676", "0.6805147", "0.67291796", "0.6693361", "0.66036", "0.65175873", "0.6505507", "0.64481777", "0.64085996", "0.636916", "0.636572", "0.6351788", "0.6256875", "0.6243114", "0.62029725", "0.6167138", "0.6135885", "0.6131305", ...
0.7121502
2
Testing the DELETE reviewrequests//reviews//replies//diffcomments// API with a local site
def test_delete_diff_comment_with_local_site(self): rsp, comment, diff_comments_url = \ self.test_post_reply_with_diff_comment_and_local_site() self.apiDelete(rsp['diff_comment']['links']['self']['href']) rsp = self.apiGet( diff_comments_url, expected_mimety...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_diff_comment_with_local_site_no_access(self):\n rsp, comment, diff_comments_url = \\\n self.test_post_reply_with_diff_comment_and_local_site()\n\n local_site = LocalSite.objects.get(name=self.local_site_name)\n local_site.users.add(User.objects.get(username='grumpy')...
[ "0.7115937", "0.70493656", "0.65635026", "0.6481386", "0.6317205", "0.62271863", "0.61020267", "0.6066379", "0.60471386", "0.601186", "0.5999376", "0.5950964", "0.5926336", "0.59192765", "0.58725566", "0.587128", "0.58556515", "0.58488834", "0.58433807", "0.58416235", "0.5825...
0.7395336
0
Testing the DELETE reviewrequests//reviews//replies//diffcomments// API and Permission Denied
def test_delete_diff_comment_no_access(self): rsp, comment, diff_comments_url = \ self.test_post_reply_with_diff_comment() self.client.login(username="doc", password="doc") self.apiDelete(rsp['diff_comment']['links']['self']['href'], expected_status=403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_review_fail(self):\n client = Client()\n response = client.delete('/api/review/1/')\n self.assertEqual(response.status_code, 401)\n client.login(username='TEST_USER_2',\n email='TEST_EMAIL_2', password='TEST_PW_2')\n review1_id = Review.objects...
[ "0.7722728", "0.68038464", "0.6767059", "0.674099", "0.67268115", "0.66270083", "0.6607972", "0.6509051", "0.6465626", "0.6410654", "0.6401929", "0.6329626", "0.6321542", "0.6282685", "0.6272163", "0.622151", "0.61871433", "0.6179466", "0.6174567", "0.6128577", "0.6122068", ...
0.74173397
1
Testing the DELETE reviewrequests//reviews//replies//diffcomments// API with a local site and Permission Denied
def test_delete_diff_comment_with_local_site_no_access(self): rsp, comment, diff_comments_url = \ self.test_post_reply_with_diff_comment_and_local_site() local_site = LocalSite.objects.get(name=self.local_site_name) local_site.users.add(User.objects.get(username='grumpy')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_review_fail(self):\n client = Client()\n response = client.delete('/api/review/1/')\n self.assertEqual(response.status_code, 401)\n client.login(username='TEST_USER_2',\n email='TEST_EMAIL_2', password='TEST_PW_2')\n review1_id = Review.objects...
[ "0.7435997", "0.70852906", "0.68192095", "0.67302656", "0.6682973", "0.66386664", "0.6632861", "0.6543811", "0.64640075", "0.6424813", "0.6377879", "0.6350746", "0.6343499", "0.6323213", "0.62912786", "0.6283507", "0.62450844", "0.6236664", "0.62185425", "0.6218418", "0.62133...
0.735104
1
Creates one layer of blocks for the ResNet model.
def block_layer(inputs, filters, bottleneck, block_fn, blocks, strides, training, name, data_format): # Bottleneck blocks end with 4x the number of filters as they start with filters_out = filters * 4 if bottleneck else filters def projection_shortcut(inputs): return conv3d_fixed_padding( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _construct_block(self, block_info):\n layer_name = block_info[0]\n if layer_name=='Conv2d':\n in_channels, out_channels, kernel_size = block_info[1:]\n return nn.Conv2d(in_channels=in_channels,\n out_channels=out_channels,\n ...
[ "0.7114202", "0.6935391", "0.6902413", "0.6796541", "0.67576265", "0.66630286", "0.6659504", "0.6652309", "0.6605723", "0.65342194", "0.65328145", "0.6521818", "0.65129703", "0.65042573", "0.6484469", "0.64513564", "0.6448056", "0.64360905", "0.6433016", "0.6414449", "0.64110...
0.0
-1
Creates variables in fp32, then casts to fp16 if necessary. This function is a custom getter. A custom getter is a function with the same signature as tf.get_variable, except it has an additional getter parameter. Custom getters can be passed as the `custom_getter` parameter of tf.variable_scope. Then, tf.get_variable ...
def _custom_dtype_getter(self, getter, name, shape=None, dtype=DEFAULT_DTYPE, *args, **kwargs): if dtype in CASTABLE_TYPES: var = getter(name, shape, tf.float32, *args, **kwargs) return tf.cast(var, dtype=dtype, name=name + '_cast') else: return getter(name, shape, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float32_variable_storage_getter(getter, name, shape=None, dtype=None,\n initializer=None, regularizer=None,\n trainable=True,\n *args, **kwargs):\n storage_dtype = tf.float32 if trainable else dtype\n ...
[ "0.77795357", "0.67645115", "0.6704484", "0.61997455", "0.60959065", "0.5969402", "0.5952168", "0.59272265", "0.5917217", "0.5720231", "0.5573573", "0.5573573", "0.5479989", "0.5459602", "0.54420453", "0.5352729", "0.5308366", "0.5292199", "0.52698094", "0.5214639", "0.519207...
0.67778546
2
Get a list of all argument parsers for different model architectures.
def get_all_parsers(): return [OptimizerFactory.get_parser(optimizer) for optimizer in OptimizerFactory.optimizers]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parsers(self):\n return tuple([getattr(self, '_{}'.format(i)) for i in self.parsers_available])", "def list_parsers(self, *args):\n print('==== Available parsing modules: ====\\n')\n for parser in sorted(self.parse_modules):\n print(self.parse_modules[parser].name.ljust(16...
[ "0.64710873", "0.63360703", "0.61863166", "0.5759768", "0.5703689", "0.5690336", "0.5671616", "0.5653616", "0.56281376", "0.55892754", "0.5567633", "0.55602854", "0.5538482", "0.55301464", "0.5435778", "0.5428988", "0.5418918", "0.5381313", "0.5334482", "0.5308304", "0.529495...
0.6872784
0
Test Case if ISBN is more than 2018
def test_func(): app = QtWidgets.QApplication(sys.argv) connection = sqlite3.connect("bookstore.db") bk1 = QtWidgets.QMainWindow() ui = Ui_bk1() ui.strID = "201732" ui.strName = "sfsdfsdff" ui.strAuthor = "sfsdssdfsdff" ui.setupUi(bk1) bk1.show() assert ui.Check() == True, "Passe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_book_isbn_length_must_be_ten(self):\n\n\t\twith self.client:\n\t\t\tadd_book = {\n\t\t\t\t'title': 'Hello Books',\n\t\t\t\t'isbn': '56987451'\n\t\t\t}\n\t\t\tlogin_data = self.login_test_user()\n\t\t\ttoken = login_data['auth_token']\n\t\t\tres = self.client.post(\n\t\t\t\tf'{URL_BOOKS}',\n\t\t\t\theaders...
[ "0.6891028", "0.6798891", "0.66314703", "0.6473494", "0.6465209", "0.6461685", "0.6426222", "0.6417605", "0.6371115", "0.6362519", "0.6298861", "0.627626", "0.62513804", "0.6208889", "0.62032527", "0.61627626", "0.6139083", "0.60967565", "0.60695046", "0.60666174", "0.5915922...
0.0
-1
Test Case if ISBN is more than 2018 and ISBN is alphanumeric
def test_func2(): app = QtWidgets.QApplication(sys.argv) connection = sqlite3.connect("bookstore.db") bk1 = QtWidgets.QMainWindow() ui = Ui_bk1() ui.strID = "2013323-3237" ui.strName = "sfsdfsdff" ui.strAuthor = "sfsdssdfsdff" ui.setupUi(bk1) bk1.show() assert ui.Check() == True,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isISBN(code):\n if not (\n isinstance(code, str) and # code must be a string\n len(code) == 10 and # code must contain 10 characters\n code[:9].isdigit() # first nine characters must be digits\n ):\n return False\n\n # check the check digit\n return check...
[ "0.7430671", "0.729918", "0.7227162", "0.71988314", "0.71624607", "0.7123375", "0.7045668", "0.69561946", "0.6954606", "0.694155", "0.6940872", "0.68667877", "0.6756499", "0.6752202", "0.66526", "0.6638115", "0.6578213", "0.65466887", "0.65393585", "0.65143967", "0.64424735",...
0.0
-1
Returns a list with unique elements. Element order is preserved.
def UniqueSequence(seq): seen = set() return [i for i in seq if i not in seen and not seen.add(i)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unique(li):\n return list(set(li))", "def unique(x):\n\n return list(set(x))", "def unique(self) -> 'List':\n return List(sorted(set(self), key=self.index))", "def uniq(elements):\n us = set()\n ret = []\n for e in elements:\n if e not in us:\n ret.append(e)\n ...
[ "0.82260644", "0.81040245", "0.80342937", "0.792012", "0.78931963", "0.78393555", "0.7805021", "0.75787956", "0.75278294", "0.74820083", "0.74297607", "0.72862655", "0.71654284", "0.7155846", "0.71120095", "0.710231", "0.7087201", "0.7076306", "0.70703614", "0.70582753", "0.7...
0.6857055
35
Return a string representation of this queue
def __repr__(self): return 'Queue({})'.format(self.length())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"QUEUE { \" + \", \".join(data_str) + \" }\"", "def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"QUEUE { \" + \", \".join(data_str) + \" }\"", "def __repr__(self):\n return str(self....
[ "0.86297184", "0.86297184", "0.84890676", "0.84257925", "0.83468837", "0.82116026", "0.81604195", "0.79041636", "0.75660646", "0.7252216", "0.71169853", "0.71070284", "0.705042", "0.70462453", "0.70307136", "0.7029424", "0.692038", "0.6887717", "0.6789598", "0.6788302", "0.67...
0.8117447
7
Return True if this queue is empty, or False otherwise
def is_empty(self): return self.list.length == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty(self) -> bool:\n if self.queue.empty():\n return True\n else:\n return False", "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def ...
[ "0.92782605", "0.9264186", "0.9250871", "0.9232645", "0.9232645", "0.9211169", "0.9152629", "0.91398877", "0.9106354", "0.90970117", "0.9096138", "0.90830916", "0.9038943", "0.9038943", "0.89983535", "0.8991305", "0.8975037", "0.89432716", "0.8929816", "0.8884646", "0.8839164...
0.0
-1
Return the number of items in this queue
def length(self): return self.list.length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n return len(self._queue_items)", "def size(self):\r\n return len(self.queue)", "def size(self):\r\n return len(self.queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(sel...
[ "0.86521995", "0.84490716", "0.84490716", "0.84321076", "0.84321076", "0.84321076", "0.84321076", "0.84284943", "0.8319467", "0.81469434", "0.80077547", "0.79834735", "0.7970964", "0.7948229", "0.79026383", "0.7889641", "0.7852448", "0.7847581", "0.7840703", "0.78324467", "0....
0.0
-1
Return the next item in this queue without removing it, or None if this queue is empty
def peek(self): return self.list.head.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self):\n if not self.empty():\n return self.queue[-1]\n return None", "def peek(self):\r\n if self.size():\r\n return self.queue[0]\r\n else:\r\n return None", "def pop(self): # O(1)\n if not self.queue:\n ...
[ "0.79958284", "0.7948415", "0.7715121", "0.7696945", "0.76208586", "0.7589365", "0.75859004", "0.7576772", "0.753899", "0.7526722", "0.74943453", "0.74383914", "0.74362516", "0.7435367", "0.7385404", "0.7370799", "0.7362173", "0.73245704", "0.73212403", "0.73144525", "0.72964...
0.0
-1
Dummy Player for testing purpose
def action(self, chipsToCall : int, thisGameActions : dict): nChip = self._getCurrentStack(thisGameActions) if self.position < 2: return 'CALL' , chipsToCall elif chipsToCall < nChip: return 'CALL', chipsToCall else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_player(self):\n pass", "def newPlayer():\r\n pass", "def __init__(self, player):\n self.player = player", "def __init__(self, player):\n\t\tself.player = player", "def setUp(self):\n self.player = Player()", "def test_create_player(self):\n self.assertIsInstanc...
[ "0.800795", "0.77485996", "0.73499453", "0.73354167", "0.7334626", "0.7004354", "0.6837552", "0.68149734", "0.6814686", "0.6708004", "0.6582129", "0.65373075", "0.644043", "0.64336175", "0.6403548", "0.63949955", "0.6382478", "0.63695663", "0.636351", "0.63284665", "0.6294344...
0.0
-1
Adds the given file extension to all filenames.
def add_file_extension(cur_dir, new_ext, sub_dirs=False): if sub_dirs: for root, dirs, files in os.walk(cur_dir): for filename in files: oldname = os.path.join(root, filename) os.rename(oldname, oldname+new_ext) else: files = os.listdir(cur_dir) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_file_extension(file_name: str, extension: str) -> str:\n fname = file_name.strip()\n slice_offset = -1 * (len(extension) + 1)\n if fname[slice_offset:] != f\".{extension}\":\n fname = fname + f\".{extension}\"\n return fname", "def addExtension(self, ext):\n sel...
[ "0.7885789", "0.740145", "0.7129056", "0.7041572", "0.6988067", "0.6948824", "0.6839631", "0.68263507", "0.6707717", "0.66177124", "0.66167444", "0.6549159", "0.65384877", "0.6509691", "0.6457053", "0.6391767", "0.63874304", "0.6323345", "0.6311844", "0.6286336", "0.6255184",...
0.72599715
2
Find whether a number x is even or odd.
def even_or_odd(x=0): # if not specified, x should take value 0. ##(x=0, set a default) if x % 2 == 0: #The conditional if return "%d is Even!" % x return "%d is Odd!" % x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_odd(x):\n return x % 2 != 0", "def is_odd(self, x):\n return x%2", "def is_odd(x):\n if (x%2==1):\n return True\n else:\n return False", "def is_even(self, x):\n return x%2 == 0", "def is_odd(number):\r\n return number % 2 != 0", "def is_even(x):\n return x ...
[ "0.86570466", "0.8609981", "0.85489213", "0.8304667", "0.8270656", "0.8255687", "0.8225956", "0.82019943", "0.8166767", "0.8161098", "0.80527854", "0.8014786", "0.7964804", "0.7961647", "0.79579276", "0.7927341", "0.7905143", "0.7856013", "0.783515", "0.7824759", "0.7797989",...
0.75661665
28
Find whether an integer is prime.
def is_prime(x=70): for i in range(2, x): # "range" returns a sequence of integers if x % i == 0: #if x can be divided by any number between 2 and x, it is not a prime print("%d is not a prime: %d is a divisor" % (x, i)) return False print("%d is a prime!" % x) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isprime(n):\r\n\treturn is_prime(n)", "def isprime(n):\n\treturn is_prime(n)", "def is_prime_number(number_):\n flag = 0\n for values in range(2, number_//2):\n if number_ % values == 0:\n flag += 1\n if flag == 1:\n return True\n else:\n return False", "def is...
[ "0.7807052", "0.7804872", "0.77613205", "0.77219856", "0.7666641", "0.7658232", "0.7622274", "0.7619329", "0.760555", "0.7604763", "0.7597515", "0.7545018", "0.75210387", "0.7519876", "0.7502933", "0.74986833", "0.7483188", "0.7480578", "0.74703336", "0.7452868", "0.74477863"...
0.0
-1
Input text should have one sentence per line, where each word and every symbol is separated from the following by a space. No token should be included, as they are automatically integrated during tokenization.
def generate(self, path, language, textgrid): activations = [] self.model.eval() iterator = tokenize(path, language, path_like=True, train=False) if self.generation == 'bucket': # Here, we give as input the text line by line. for line in iterator: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(self, text):\n\n text = convert_to_unicode(text)\n\n output_tokens = []\n for token in whitespace_tokenize(text):\n chars = list(token)\n if len(chars) > self.max_input_chars_per_word:\n output_tokens.append(self.unk_token)\n continue\n\n is_bad = False\n sta...
[ "0.744548", "0.737341", "0.72835636", "0.7197461", "0.71374947", "0.713586", "0.7081092", "0.7068462", "0.7036946", "0.69594884", "0.6953292", "0.6952878", "0.69524664", "0.6938421", "0.6905543", "0.6895613", "0.6888006", "0.6871931", "0.68489134", "0.6838066", "0.6835906", ...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(sslDebug_Data, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.id is None: self.id = '' if self.line is None: self.line = [] if self.circle is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77949196", "0.77207184", "0.77207184", "0.7687274", "0.7626665", "0.75640404", "0.7440775", "0.7417612", "0.7351781", "0.7308563", "0.7280241", "0.7237561", "0.7227551", "0.72248346", "0.72248346", "0.7218737", "0.721217", "0.721217", "0.721217", "0.721217", "0.721217", ...
0.65939045
88
Get IMU quaternion data.
def _get_quaternion_data(self, msg): alpha, beta, gamma = PIDController.get_euler_angle_from_quat(msg.quaternion.w, msg.quaternion.x, msg.quaternion.y, msg.quaternion.z) self._actual_euler["alpha"], self._actual_euler["beta"], self._ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_quaternion(self, method: str = 'chiaverini', **kw) -> np.ndarray:\n q = np.array([1., 0., 0., 0.])\n if method.lower()=='hughes':\n q = hughes(self.A)\n if method.lower()=='chiaverini':\n q = chiaverini(self.A)\n if method.lower()=='shepperd':\n q...
[ "0.6497413", "0.6465483", "0.64419043", "0.63285935", "0.6241631", "0.62351096", "0.6226867", "0.6223118", "0.60809404", "0.6079437", "0.607731", "0.6055358", "0.60515714", "0.60381126", "0.602743", "0.6004139", "0.5990623", "0.5957624", "0.5928451", "0.5921927", "0.590923", ...
0.73813695
0
Compute the forward movement error's magnitude and direction.
def _compute_forward_movement_error(self): if (self._actual_euler["gamma"] >= 0 and self._target_euler["gamma"] >= 0) \ or (self._actual_euler["gamma"] < 0 and self._target_euler["gamma"] < 0): error = math.fabs(self._target_euler["gamma"] - self._actual_euler["gamma"]) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff_of_errors(self):\n self.e_of_e = self.azimuth_error - self.altitude_error\n return self.e_of_e", "def _get_forward_speed(self):\n\n velocity = self._vehicle.get_velocity()\n transform = self._vehicle.get_transform()\n vel_np = np.array([velocity.x, velocity.y, velocity...
[ "0.65332645", "0.63869256", "0.62648004", "0.6214192", "0.61566556", "0.61517024", "0.5919428", "0.59182143", "0.5898777", "0.58685994", "0.5810975", "0.57779574", "0.5679071", "0.56699055", "0.5627375", "0.56236976", "0.56115025", "0.55813056", "0.55461293", "0.55414844", "0...
0.7499794
0
Lightning DataModule function that will be used to load/download data, build inputs with padding and to store everything as TensorDatasets.
def prepare_data(self): data = self._get_dataset(self.hparams.dataset_path) label_encoder = data["label_encoder"] del data["label_encoder"] click.secho("Building inputs and labels.", fg="yellow") datasets = { "train": defaultdict(list), "valid": defaultdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataloader(self):\n\n # load / split data\n train_data = self.data.get_train_data()\n if self.args.use_dev:\n train_data, dev_data = self.data.split_data(train_data)\n test_data = self.data.get_test_data()\n\n #print(train_data[0])\n #print(dev_data[0])\n ...
[ "0.6873716", "0.6639242", "0.6520996", "0.65046436", "0.6444532", "0.6399065", "0.63780624", "0.6370381", "0.6295697", "0.6276135", "0.6267019", "0.6262347", "0.62592757", "0.6250741", "0.62428886", "0.6235736", "0.623328", "0.62176967", "0.6200053", "0.61929667", "0.617903",...
0.6330145
8
Gets an Item or an Asset count. If an Asset is supplied and the Item property exists on the Asset, returns the Asset's value. Otherwise returns the Item's value
def get_count(self, asset=None): if asset is None or 'pc:count' not in asset.properties: return self.item.properties.get('pc:count') else: return asset.properties.get('pc:count')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self, item):\n if item in self: \n return self[item]\n else: \n return 0", "def amountOfItem(self, itemType):\n if not isinstance(itemType, str):\n itemType = itemType.value\n if itemType not in self.__inventory__:\n return 0\n ...
[ "0.631754", "0.5968896", "0.58651865", "0.575089", "0.5655662", "0.5640428", "0.5639301", "0.5538555", "0.5538213", "0.55373865", "0.5444125", "0.5389861", "0.5355822", "0.5355822", "0.5322278", "0.53084165", "0.5305974", "0.52934504", "0.5244712", "0.52349585", "0.5234713", ...
0.65153563
0
Set an Item or an Asset type. If an Asset is supplied, sets the property on the Asset. Otherwise sets the Item's value.
def set_type(self, type, asset=None): self._set_property('pc:type', type, asset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, item, **attrs):\n attrs[self.type] = item\n self.graph._setattrs(self.parent.handle, **attrs)", "def SetItem(self, item):\r\n\r\n self._item = item", "def set_item(self, item):\n self.item = item", "def set_item(self, item):\n self.item = item", "def set(sel...
[ "0.6979795", "0.6473676", "0.6391404", "0.6391404", "0.63342154", "0.62450093", "0.6146867", "0.598644", "0.57871044", "0.57216907", "0.5686747", "0.5636702", "0.5589119", "0.55816865", "0.5494609", "0.54538804", "0.535442", "0.5332314", "0.5255934", "0.5238573", "0.5226765",...
0.6126265
7
Gets an Item or an Asset encoding. If an Asset is supplied and the Item property exists on the Asset, returns the Asset's value. Otherwise returns the Item's value
def get_encoding(self, asset=None): if asset is None or 'pc:encoding' not in asset.properties: return self.item.properties.get('pc:encoding') else: return asset.properties.get('pc:encoding')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(self, item: Inventory) -> Optional[OrderItem]:\n return self.orderitem_set.filter(item=item).first()", "def _get_asset_info(item, name):\n\n if name in item.assets:\n return item.assets[name]\n elif name.replace(\"B\", \"B0\") in item.assets:\n # Bx -> B0x\n return ...
[ "0.65281934", "0.6428244", "0.6140832", "0.6115069", "0.6096708", "0.6043309", "0.59257525", "0.5913768", "0.5816586", "0.58123714", "0.5811142", "0.5811142", "0.5794498", "0.57623315", "0.573949", "0.5733423", "0.5727326", "0.57111824", "0.5692701", "0.5674517", "0.567443", ...
0.5691916
19
Gets an Item or an Asset projection geometry. If an Asset is supplied and the Item property exists on the Asset, returns the Asset's value. Otherwise returns the Item's value
def get_schemas(self, asset=None): if asset is None or 'pc:schemas' not in asset.properties: schemas = self.item.properties.get('pc:schemas') return [PointcloudSchema(s) for s in schemas] else: return [PointcloudSchema.create(s) for s in asset.properties.get('pc:schem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(self, item: Inventory) -> Optional[OrderItem]:\n return self.orderitem_set.filter(item=item).first()", "def get(self, item):\n return self.graph._get(self.parent.handle,\n **{self.type: item})", "def getItem(self) -> Optional[items.Item]:\n return...
[ "0.58524823", "0.5682184", "0.5660678", "0.55180055", "0.55180055", "0.5487199", "0.5476112", "0.54565114", "0.54291147", "0.5422782", "0.5374927", "0.5349047", "0.52836835", "0.5257133", "0.5222732", "0.5184037", "0.5168532", "0.51581115", "0.51377934", "0.5120273", "0.51082...
0.0
-1
Gets an Item or an Asset density. If an Asset is supplied and the Item property exists on the Asset, returns the Asset's value. Otherwise returns the Item's value
def get_density(self, asset=None): if asset is None or 'pc:density' not in asset.properties: return self.item.properties.get('pc:density') else: return asset.properties.get('pc:density')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(self, item: Inventory) -> Optional[OrderItem]:\n return self.orderitem_set.filter(item=item).first()", "def _get_asset_info(item, name):\n\n if name in item.assets:\n return item.assets[name]\n elif name.replace(\"B\", \"B0\") in item.assets:\n # Bx -> B0x\n return ...
[ "0.62330085", "0.62283593", "0.60144854", "0.6013892", "0.5928274", "0.59101117", "0.588648", "0.5782146", "0.5762245", "0.5722571", "0.570541", "0.56849575", "0.5671143", "0.5641411", "0.5633211", "0.5612373", "0.5592273", "0.55438894", "0.5534137", "0.5533826", "0.5533826",...
0.6706623
0
Gets an Item or an Asset centroid. If an Asset is supplied and the Item property exists on the Asset, returns the Asset's value. Otherwise returns the Item's value
def get_statistics(self, asset=None): if asset is None or 'pc:statistics' not in asset.properties: stats = self.item.properties.get('pc:statistics') if stats: return [PointcloudStatistic(s) for s in stats] else: return None else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, item):\n return self._attributes[item]", "def __getitem__(self, item):\n return self._metadata[item]", "def get(self, item):\n return self.graph._get(self.parent.handle,\n **{self.type: item})", "def get_avg_item(items):\n category = ite...
[ "0.5885468", "0.5658157", "0.5630972", "0.5584024", "0.55645895", "0.5543892", "0.5482141", "0.548178", "0.5390869", "0.5349245", "0.5317511", "0.53054625", "0.53054625", "0.52887195", "0.5263388", "0.52405083", "0.5214525", "0.51991475", "0.5193334", "0.5189578", "0.517344",...
0.0
-1