query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
Read a Map definition from a real file.
def test_reading_user_map_definition_from_file(): with open("tempfile.buf", "w") as f: f.write(""" 1. key : string 2. bpm : int """) with open("tempfile.buf") as f: assert Map( MapEntrySpec(1, "key", String), MapEntrySpec(2, "bpm", Unsigne...
[ "def test_reading_nested_user_map_definition_from_file():\n with open(\"definitions/Person.buf\") as f:\n Person = Map.from_open_file(f)\n\n expected = Map(\n MapEntrySpec(1, \"name\", String),\n MapEntrySpec(2, \"members\", List(Person))\n )\n\n with open(\"definitions/Club.buf\") ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test a few configurations of loading nested record definitions from a file. We're assuming that the loading of `Person` works fine as in the above test.
def test_reading_nested_user_map_definition_from_file(): with open("definitions/Person.buf") as f: Person = Map.from_open_file(f) expected = Map( MapEntrySpec(1, "name", String), MapEntrySpec(2, "members", List(Person)) ) with open("definitions/Club.buf") as f: assert e...
[ "def test_load_multiple_files():\n registry = Registry()\n\n schema_ids = registry.load(\n schema_for(\"data/address.json\"),\n schema_for(\"data/name.json\"),\n )\n assert_that(schema_ids, has_length(2))\n assert_that(schema_ids, has_item(ADDRESS_ID))\n assert_that(schema_ids, has_i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The `str` and `repr` of a user type should be clear and readable.
def test_user_type_repr(): Person = Map.from_file("definitions/Person.buf") me = Person(name="Bede Kelly", age=20) assert "Person(name='Bede Kelly', age=20)" == str(me) == repr(me)
[ "def show_type(self, arg):\n return (str(arg), str(type(arg)), arg)", "def test_str_only():\n ob = ReprTest.Bar()\n assert str(ob) == \"I implement ToString() but not __repr__()!\"\n assert \"<Python.Test.Bar object at \" in ob.__repr__()", "def _type(string, has_invisible=True, numparse=True):\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computing a missing type should raise a ValueError.
def test_value_error_for_computing_missing_type(): with pytest.raises(ValueError): compute_type("missing_type", {})
[ "def test__specification_type_to_python_type_unsupported_type(self):\n with self.assertRaises(TypeError):\n _specification_type_to_python_type(\"unsupported_type\")", "def test_none_type(self):\n\n expected = TypeError\n input_ = None\n with self.assertRaises(expected):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempting to read a nonexistent key should raise a KeyError.
def test_map_missing_key_encountered(): with pytest.raises(KeyError): Map().read_key(10, b"")
[ "def test_get_non_existing_doc_via_getitem(self):\n try:\n doc = self.db['no_such_doc']\n self.fail('Above statement should raise a KeyError')\n except KeyError:\n pass", "def test_getObjectByKey_raises_KeyError(self):\n try:\n self.tile_bucket.getObjec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After creating a user type, it should be possible to access attributes of any instance by name.
def test_user_type_attribute_access(): Person = Map.from_file("definitions/Person.buf") me = Person(name="Bede Kelly", age=20) assert 20 == me.age assert "Bede Kelly" == me.name
[ "def test_InstancesAttributes(self):\n self.assertTrue(hasattr(self.new_user, \"email\"))\n self.assertTrue(hasattr(self.new_user, \"password\"))\n self.assertTrue(hasattr(self.new_user, \"first_name\"))\n self.assertTrue(hasattr(self.new_user, \"last_name\"))", "def add_user(self, nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns first 'elite_count' fittest individuals from population
def _get_elite_individuals(self, elites): # 适应度在这里被attrgetter调用,会计算适应度并排序 return sorted(self._population, key=attrgetter("fitness"))[-elites:]
[ "def best_individual(self, population):\n\n best_fitness = -np.inf\n for individual in population:\n fitness = self.fitness(individual)\n if fitness > best_fitness:\n best_fitness = fitness\n best_individual = individual\n\n return best_indivi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the filters from the file with description of filters in ENA as a dictionary with the key being the filter id and the value a dictionary with related results, type of filter, filter description
def get_filters(filepath): filters = {} with open(filepath, "r") as f: reader = csv.DictReader(f, delimiter=';') for row in reader: filter_id = row["Filter Column"] filters.setdefault(filter_id, {}) filters[filter_id]["results"] = row["Result"].split(", ") ...
[ "def get_results(filepath, filters, return_fields):\n results = {}\n with open(filepath, \"r\") as f:\n reader = csv.DictReader(f, delimiter=';')\n for row in reader:\n result_id = row[\"Result\"]\n results.setdefault(result_id, {})\n results[result_id][\"descrip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the returnable fields for results from the file with description of filters in ENA as a dictionary with the key being the field id and the value a list of returnable fields
def get_return_fields(filepath): returnable_fields = {} with open(filepath, "r") as f: reader = csv.DictReader(f, delimiter=';') for row in reader: returnable_fields.setdefault( row["Result"], row["Returnable fields"].split(", ")) return returnable...
[ "def get_results(filepath, filters, return_fields):\n results = {}\n with open(filepath, \"r\") as f:\n reader = csv.DictReader(f, delimiter=';')\n for row in reader:\n result_id = row[\"Result\"]\n results.setdefault(result_id, {})\n results[result_id][\"descrip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format the file with description of results in ENA as a dictionary with the key being the result id and the value a dictionary with the result description, the filter fields, the returnable fields
def get_results(filepath, filters, return_fields): results = {} with open(filepath, "r") as f: reader = csv.DictReader(f, delimiter=';') for row in reader: result_id = row["Result"] results.setdefault(result_id, {}) results[result_id]["description"] = row["Des...
[ "def format_result(result):\n output = ''\n for item in result:\n text = item['text']\n date = item['date']\n status = item['status']\n author = item['author_name']\n line = (\n f'Кейс: {text}\\n'\n f'<code>Дата: {date}</code>\\n'\n f'Статус:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serialize the ENA data descriptors
def serialize_ena_data_descriptors(): filter_fields = get_filters("enasearch_data/ena_filter_columns.csv") return_fields = get_return_fields("enasearch_data/ena_result_returnable_fields.csv") results = get_results( "enasearch_data/ena_domain_results.csv", filter_fields, return_fields...
[ "def _serialise(self):\n # TODO (M Foley)\n pass", "def serialize(self):\n\t\t\n\t\treturn {\n\t\t'ocf_node_properties': {\n\t\t'uuid': self.uuid,\n\t\t'userUuid': self.userUuid,\n\t\t'name': self.name,\n\t\t'pipedreamCommand': self.pipedreamCommand,\n\t\t'priority': self.priority,\n\t\t},\n\t\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute the ghostscript command on the given in_file generating out raster and vector information with the given resolution. Width and height should be specified in pts.
def execute(in_file, resolution, width, height, raster_mode): raster_tmpfile = tempfile.NamedTemporaryFile() # Convert width and height to DPI. width = (width/72) * resolution height = (height/72) * resolution args = [config.gs, "-q", "-dBATCH", "-dNOPAUSE", ...
[ "def rsvg_export(input_file, output_file, dpi=90, rsvg_binpath=None):\n if not os.path.exists(input_file):\n log.error('File {} not found.'.format(input_file))\n raise IOError((0, 'File not found.', input_file))\n\n if rsvg_binpath is None:\n rsvg_binpath = which('rsvg-convert')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a raster mode return the ghostscript mode.
def raster_mode_to_ghostscript(mode): if mode == 'mono': return 'pngmono' if mode in ['gray', 'grey']: return 'pnggray' elif mode in ['color', 'colour']: return 'png16m' elif mode == 'none': return None else: log.crit("Invalid raster mode %s specified." % mode...
[ "def extract_pil_mode(psd):\n alpha = _get_alpha_use(psd)\n return get_pil_mode(psd.header.color_mode, alpha)", "def getmodebase(mode):\r\n return ImageMode().getmode(mode).basemode", "def gp_get_mode(self, pin):\n return self._hid_xfer(b\"\\x61\")[22 + pin] & 0x07", "def getmodetype(mode):\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return azimuthal angle btwn vv and v0, with v1 defining phi=0. Originally written by Ryan Rygg. This is a modified version.
def azimuth(vv, v0, v1): with np.errstate(divide='ignore', invalid='ignore'): n0 = np.cross(v0, v1) n0 /= np.dual.norm(n0, axis=-1)[..., np.newaxis] nn = np.cross(v0, vv) nn /= np.dual.norm(nn, axis=-1)[..., np.newaxis] azi = np.arccos(np.sum(nn * n0, -1)) if len(np.shape(az...
[ "def _angle(u, v, w, d='+'):\n vu = np.arctan2(u[1] - v[1], u[0] - v[0])\n vw = np.arctan2(w[1] - v[1], w[0] - v[0])\n phi = vw - vu\n if phi < 0:\n phi += 2 * np.pi\n if d == '-':\n phi = 2 * np.pi - phi\n return np.round(phi, 6)", "def vector_angle(v):\n assert len(v) == 2\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a polar tth corr map directly for all panels
def polar_tth_corr_map_rygg_pinhole(tth, eta, instrument, absorption_length, pinhole_thickness, pinhole_radius, num_phi_elements=60): panels = list(instrument.detectors.values()) return calc_tth_rygg_pinhole(panels, absorption_length, tth, ...
[ "def vehicle_polar_axes():\r\n ax = plt.subplot(111, polar=True)\r\n ax.set_thetagrids(np.arange(0, 360, 360.0 / 4), [\"fore\", \"left\", \"aft\", \"right\"])\r\n def name_gen(count):\r\n names = iter((\"fore\", \"left\", \"aft\", \"right\"))\r\n i = 0\r\n while i < count:\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates accuracy of classifier using crossvalidation
def accuracy(clf, x, y, cv=5): print_classification_info(clf, x, y) return cross_val_score(clf, x, y, cv=cv).mean() * 100
[ "def cross_validation_accuracy(clf, X, labels, k):\n ###TODO\n #pass\n cv = KFold(len(labels), k)\n accuracies = []\n for train_ind, test_ind in cv:\n clf.fit(X[train_ind], labels[train_ind])\n predictions = clf.predict(X[test_ind])\n accuracies.append(accuracy_score(labels[test_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates pipeline by scaling data before applying classifier
def create_pipeline(clf): return Pipeline([('scaler', MinMaxScaler()), ('clf', clf)])
[ "def build_pipe(self):\n graphs = list(zip(*self.dataset_a_train))[0]\n features = dgl.batch(graphs).ndata['node_attr'].numpy()\n pipe = Pipeline([('impute', SimpleImputer()), ('scale', StandardScaler())])\n pipe.fit(features)\n return pipe", "def run(self):\n pipeline = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs the EdgeProp algorithm on the given graph. returns the label distribution (|N|, |N|) matrix with scores between 1, 1 stating the calculated label distribution.
def _perform_edge_prop_on_graph(self, adj_mat: np.ndarray, y: np.ndarray, max_iter=100, tol=1e-1) -> np.ndarray: label_distributions = y.copy() l_previous = None D = np.sum(adj_mat, axis=0) D[D == 0] = 1 edge_exists = y.sum(axis=-1) > 0 ...
[ "def _create_label_link_pred(self, graph, edges, nodes=None):\n if self.G is not None:\n graph.edge_label_index = (\n self._edge_to_index(edges, nodes)\n )\n graph.edge_label = self._get_edge_attributes_by_key(\n edges,\n \"edge_la...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns set of unique words in the form of a dict.
def get_unique_words(allsents): allwords = [x[0] for sent in allsents for (x, iob) in sent] allwords = [w.lower() for w in allwords] # GloVe requires lowercase allwords = set(allwords) words = {} for word in allwords: words[word] = True return words
[ "def get_unique_words():\n # Unique words\n words_set = set()\n for i in range(1, 114+1):\n sura = quran.get_sura(i)\n for aya in sura:\n wordsList = aya.split(' ')\n for word in wordsList:\n words_set.add(word)\n\n return words_set", "def make_uniqu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the new target assignment that minimises the SSE between the minibatch feature space and the targets.
def calc_optimal_target_permutation(feats: np.ndarray, targets: np.ndarray) -> np.ndarray: # Compute cost matrix cost_matrix = np.zeros([feats.shape[0], targets.shape[0]]) # calc SSE between all features and targets for i in range(feats.shape[0]): cost_matrix[:, i] = np.sum(np.square(feats-targe...
[ "def get_hard_target_model_updates(target, source):\n target.set_weights(source.get_weights())\n\n return target", "def update_target(self):\n # raise NotImplementedError\n self.target.set_weights([(1 - self.tau) * self.target_params[i] + self.tau * self.model_params[i] for i in range(len(self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns (Ordinal Hint, Ordinal String)
def getOrdinal(self): hint = self['Ordinal Number'] return (hint, 'Ordinal%d'% hint) # microsoft-convention
[ "def GetOrdinalString(\n self,\n basic=0,\n truncation=0,\n ndp=0,\n zonePrecision=Precision.Complete,\n dp=\",\",\n tDesignator=\"T\"):\n return self.date.GetOrdinalString(basic, truncation) + tDesignator +\\\n self.time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dereferences Name into it's IMAGE_IMPORT_HINT structure
def dereference(self): offset = headers.calculateRelativeAddress(self, self['Name']) return self.p.p.new(IMAGE_IMPORT_HINT, __name__='ImportName', offset=offset)
[ "def get_image_by_name(self, name):", "def IMPORT_NAME(self, name):\n level, fromlist = self.vm.popn(2)\n frame = self.vm.frame\n\n if PYTHON_VERSION > 2.7:\n self.vm.push(importlib.__import__(name, frame.f_globals, frame.f_locals, fromlist, level))\n else:\n self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Since we only support a very restricted setup (single medium within a single bounding shape), we can extract the only medium pointer within the scene and use is for all subsequent method calls. This avoids expensive virtual function calls on array pointers.
def get_single_medium(scene): shapes = scene.shapes() assert len(shapes) == 1, f'Not supported: more than 1 shape in the scene (found {len(shapes)}).' medium = shapes[0].interior_medium() assert medium is not None, 'Expected a single shape with an interior medium.' return medium
[ "def test_get_medium(self):\n pass", "def _extract_medium(publication, default_medium=Edition.BOOK_MEDIUM):\n medium = default_medium\n\n if publication.metadata.type:\n medium = Edition.additional_type_to_medium.get(\n publication.metadata.type, default_medium\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flips a random neutral tile.
async def __auto_flip_tile(self) -> None: valid_tiles = self.__get_neutral_tiles() random_tile = roll(valid_tiles) await self.flip(random_tile)
[ "def random_flip(image ):\n if random.randint(0,1):\n image = flipud(image) # vertical flip\n if random.randint(0,1):\n image = fliplr(image) # horizontal flip\n return image", "def _randomly_negate_tensor(tensor):\n should_flip = np.floor(np.random.rand() + 0.5) >= 1\n final_tensor =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for address_to_bytes
def test_address_to_bytes(self): pass
[ "def test_raw_to_address(self):\n pass", "def test_address_to_raw(self):\n pass", "def test_to_Bytes(self) -> None:\n self.assertEqual(to_bytes('Hello'),\n bytearray('Hello', 'utf-8'),\n \"Check that to_bytes creates byte array when presented ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for address_to_tree
def test_address_to_tree(self): pass
[ "def test_ergo_tree_to_address(self):\n pass", "def test_raw_to_address(self):\n pass", "def test_address_to_raw(self):\n pass", "def test_Tree():", "def test_address_to_bytes(self):\n pass", "def test01(self):\n\n t = tree(\"a\", [tree(\"b\"), tree(\"c\")]);\n se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for execute_with_context
def test_execute_with_context(self): pass
[ "def execute(self, context, globals=None, inputs=None, outputs=None):", "def test_run_query(self):\n pass", "def TestExecutionContext():\n return ExecutionContext(\"test_execution_context_id\")", "def test_context_args(self):\n context = GraphQlContextWithEmail('foo@example.com')\n res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for script_p2_s_address
def test_script_p2_s_address(self): pass
[ "def test_script_p2_sh_address(self):\n pass", "def test_raw_to_address(self):\n pass", "def test_create_address(self):\n pass", "def test_retrieve_address(self):\n pass", "def test_check_address_validity(self):\n pass", "def test_address_info(self):\n from supvis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for script_p2_sh_address
def test_script_p2_sh_address(self): pass
[ "def test_script_p2_s_address(self):\n pass", "def scriptpubkey_to_p2sh_address(data: bytes) -> BTCAddress:\n if data[0:1] != OpCodes.op_hash160 or data[-1:] != OpCodes.op_equal:\n raise EncodingError(f'Invalid P2SH scriptpubkey: {data.hex()}')\n\n prefixed_hash = bytes.fromhex('05') + data[2:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a course with 3 orphan modules, one of which has a child that's also in the course tree.
def create_course_with_orphans(self, default_store): course = CourseFactory.create(default_store=default_store) # create chapters and add them to course tree chapter1 = self.store.create_child(self.user.id, course.location, 'chapter', "Chapter1") self.store.publish(chapter1.location, se...
[ "def test_create_parented_item(self):\r\n locator = BlockUsageLocator(\r\n CourseLocator(org='testx', offering='GreekHero', branch='draft'),\r\n 'chapter', block_id='chapter2'\r\n )\r\n original = modulestore().get_item(locator)\r\n\r\n locator = BlockUsageLocator(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asserts that we have the expected count of orphans for a given course_key
def assertOrphanCount(self, course_key, number): self.assertEqual(len(self.store.get_orphans(course_key)), number)
[ "def test_split_orphan(self):\r\n orphans = self.split_mongo.get_orphans(self.split_course_key)\r\n self.assertEqual(len(orphans), 3, \"Wrong # {}\".format(orphans))\r\n location = self.split_course_key.make_usage_key('chapter', 'OrphanChapter')\r\n self.assertIn(location, orphans)\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that the orphan handler deletes the orphans
def test_delete_orphans(self, default_store, max_mongo_calls, min_mongo_calls): course = self.create_course_with_orphans(default_store) orphan_url = reverse_course_url('orphan_handler', course.id) with check_mongo_calls_range(max_mongo_calls, min_mongo_calls): self.client.delete(orp...
[ "def test_mongo_orphan_delete(self):\r\n self.client.delete(self.orphan_url)\r\n orphans = json.loads(\r\n self.client.get(self.orphan_url, HTTP_ACCEPT='application/json').content\r\n )\r\n self.assertEqual(len(orphans), 0, \"Orphans not deleted {}\".format(orphans))", "def ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
r""" Make sure that path_to_location works with a component having multiple vertical parents, from which one of them is orphan. course | chapter | vertical vertical \ / html
def test_path_to_location_for_orphan_vertical(self, module_store): # Get a course with orphan modules course = self.create_course_with_orphans(module_store) # Fetch the required course components. vertical1 = self.store.get_item(BlockUsageLocator(course.id, 'vertical', 'Vertical1')) ...
[ "def test_path_to_location_for_orphan_chapter(self, module_store):\n # Get a course with orphan modules\n course = self.create_course_with_orphans(module_store)\n orphan_chapter = self.store.get_item(BlockUsageLocator(course.id, 'chapter', 'OrphanChapter'))\n chapter1 = self.store.get_it...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
r""" Make sure that path_to_location works with a component having multiple chapter parents, from which one of them is orphan course | chapter chapter | | vertical vertical \ / html
def test_path_to_location_for_orphan_chapter(self, module_store): # Get a course with orphan modules course = self.create_course_with_orphans(module_store) orphan_chapter = self.store.get_item(BlockUsageLocator(course.id, 'chapter', 'OrphanChapter')) chapter1 = self.store.get_item(BlockU...
[ "def test_path_to_location_for_orphan_vertical(self, module_store):\n # Get a course with orphan modules\n course = self.create_course_with_orphans(module_store)\n\n # Fetch the required course components.\n vertical1 = self.store.get_item(BlockUsageLocator(course.id, 'vertical', 'Vertic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if two angles are equal within accuracy.
def equal_angles(a1, a2, angular_accuracy=1e-12): # pragma: no cover return np.abs(np.fmod(a1 - a2, two_pi)) < angular_accuracy
[ "def equal_angles(cls, angle1, angle2):\n with warnings.catch_warnings():\n warnings.simplefilter('ignore', RuntimeWarning)\n return np.abs(np.fmod(angle1 - angle2, cls.two_pi)\n ) < cls.angular_accuracy", "def assert_angles_allclose(x, y, **kwargs):\n c2 =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the inverse cosine for an array of values
def acos_array(values): # pragma: no cover result = np.empty_like(values, dtype=nb.float64) flat_result = result.flat flat_values = values.flat for i in range(values.size): flat_result[i] = acos(flat_values[i]) return result
[ "def cos_inplace(a):", "def inverse_square(array):\n return 1/(array**2)", "def arccos_inplace(a):", "def cosine(arr1, arr2):\n\n if arr1 is None or arr2 is None:\n return np.NaN\n if not isinstance(arr1, list):\n arr1 = [arr1]\n if any(pd.isnull(arr1)):\n return np.NaN\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate a celestial pole based on a reference and native reference. The determination of a celestial pole may involve a few steps. The first is to determine the reference position about the native pole wrt the native reference. The next step involves finding the positions of the northern and southern poles. A number ...
def calculate_celestial_pole(native_reference_x, native_reference_cos_lat, native_reference_sin_lat, reference_x, reference_y, reference_cos_lat, reference_sin_lat, native_pole_x, native_pole_y, ...
[ "def calculate_celestial_pole_array(native_reference_x,\n native_reference_cos_lat,\n native_reference_sin_lat,\n reference_x, reference_y,\n reference_cos_lat, reference_sin_lat,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the celestial pole when one or more of the inputs are arrays.
def calculate_celestial_pole_array(native_reference_x, native_reference_cos_lat, native_reference_sin_lat, reference_x, reference_y, reference_cos_lat, reference_sin_lat, ...
[ "def getpviolcones(self,whichsol_,sub_,viol_):\n num_ = None\n if num_ is None:\n num_ = len(sub_)\n elif num_ != len(sub_):\n raise IndexError(\"Inconsistent length of array sub\")\n if sub_ is None:\n raise ValueError(\"Argument sub cannot be None\")\n if sub_ is None:\n raise V...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flight model builder. Creates an instantiation of Flight object with the environment configuration.
def build_flight_v0(env_config={}): config = { 'birds': 2, 'region': 25.0, 'max_speed': 1.0, 'min_speed': 0.5, 'acceleration': 0.1, 'max_relative_angle': 10.0, 'max_relative_angle_change': 5.0, 'collision_distance': 1.0, 'max_steps': 200, }...
[ "def flight_record_factory(self, new_record_url, new_flight_type):\n \n print(\"def flight_record_factory \"+ TimeStamp.timestamp()) #Elina 08-12-2020\n\n record_date = self.flight_date\n flight_code = new_record_url.split(\"/\")[-3]\n flight_type = new_flight_type\n\n orig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts resources/demo.mkv ti resources/demo.gif
def convert_gif(ctx): ctx.run( 'ffmpeg ' '-i resources/demo.mkv -filter_complex "[0:v] palettegen" ' 'resources/palette.png', pty=True ) ctx.run( 'ffmpeg -i resources/demo.mkv ' '-i resources/palette.png ' '-filter_complex "[0:v][1:v] paletteuse" ' ...
[ "def main():\n convert(\"env_100000.mp4\", TargetFormat.GIF)", "def AnimFromPng(name, gif=True, fps=15):\n if(gif):\n imgconvert = \"convert \" + \"-delay \" + str(int(1000/fps))\n imgconvert += \" -dispose None \" + name + \"*.png -loop 0 \" + name + \".gif\"\n system(imgconvert)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new field to this format. factory the FieldFactory to add rowIndex the row to add the field to colIndex the position in the row for the new field.
def addFactory(self, factory: ghidra.app.util.viewer.field.FieldFactory, rowIndex: int, colIndex: int) -> None: ...
[ "def addField(field):", "def add_field(self, f_name, f_type, f_len=10, code_blk=\"\", calc=\"\", alias=\"\"):\n if not alias:\n alias = f_name\n f_name = f_name.replace(\" \", \"_\")\n if f_type.upper() in [\"FLOAT\", \"DOUBLE\"]:\n f_len = 0\n try:\n a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the list factories valid for this format.
def getFactorys(self) -> List[ghidra.app.util.viewer.field.FieldFactory]: ...
[ "def factories(cls):\n base = cls.baseType\n if base:\n if hasattr(base, 'factories'):\n return base.factories()\n else:\n return base\n return ()", "def getFactorys(self, row: int) -> List[ghidra.app.util.viewer.field.FieldFactory]:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the FieldFactorys on a given row.
def getFactorys(self, row: int) -> List[ghidra.app.util.viewer.field.FieldFactory]: ...
[ "def getFactorys(self) -> List[ghidra.app.util.viewer.field.FieldFactory]:\n ...", "def row_factory(self):\n return self._hndl.row_factory", "def getNumFactorys(self, row: int) -> int:\n ...", "def addFactory(self, factory: ghidra.app.util.viewer.field.FieldFactory, rowIndex: int, colInde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the formatMgr that is managing this model.
def getFormatManager(self) -> ghidra.app.util.viewer.format.FormatManager: ...
[ "def getFormatter(self):\n\n return self.__formatter;", "def get_format(format_type):\n if settings.USE_L10N:\n for module in get_format_modules():\n try:\n return getattr(module, format_type)\n except AttributeError:\n pass\n return getattr(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of FieldFactorys on any given row.
def getNumFactorys(self, row: int) -> int: ...
[ "def _count_fields(self, ws):\n\n field_number = 1\n while ws.cell(row=1, column=field_number).value:\n field_number += 1\n\n return field_number", "def getFactorys(self, row: int) -> List[ghidra.app.util.viewer.field.FieldFactory]:\n ...", "def getNumRows(self) -> int:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of rows in the model.
def getNumRows(self) -> int: ...
[ "def row_count(self):\n return self.__row_count", "def get_num_records(self):\n return self.__num_records", "def getRowCount(self):\n return nRows", "def num_rows(self):\n return None if self.is_raw() else self.structure.num_rows", "def getNoOfRows(self):\n return _patchEx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notifies the formatMgr that this format model has changed.
def modelChanged(self) -> None: ...
[ "def shell_date_format_changed(self, date_format):\n raise NotImplementedError", "def modified(self):\n self.notify_observers(\"modified\")", "def notify_change(self):\r\n data = (self.busy, self.debug, self.profile)\r\n self.publish_msg( eng_messages.ENGINE_STATECHANGE+'.'+self.name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves the Field at (oldrow,oldCol) to (row,col) oldRowIndex the row containing the field to be moved. oldColIndex the column index of the field to be moved. newRowIndex the row to move to. newColIndex the column to move to. IllegalArgumentException thrown if any of the parameters don't map to a valid grid position.
def moveFactory(self, oldRowIndex: int, oldColIndex: int, newRowIndex: int, newColIndex: int) -> None: ...
[ "def can_move(self, row: int, col: int, row_new: int, col_new: int):\n \n # некорректная команда от игрока\n if not (0 <= col < self.FIELD_SIZE and 0 <= row < self.FIELD_SIZE and 0 <= col_new < self.FIELD_SIZE and 0 <= row_new < self.FIELD_SIZE):\n return False\n if row == row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notifies that the options have changed. options the Options object that changed. optionName the name of the property that changed. oldValue the old value of the property. newValue the new value of the property.
def optionsChanged(self, options: ghidra.framework.options.Options, optionName: unicode, oldValue: object, newValue: object) -> None: ...
[ "def _options_changed(self, name, old, new):\n if self.options_lock.acquire(False):\n try:\n self.options = new\n\n options = self._make_options(new)\n self._options_dict = {i[0]: i[1] for i in options}\n self._options_labels = [i[0] for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a field from the format. rowIndex the row index of the field to remove. colIndex the column index of the field to remove.
def removeFactory(self, rowIndex: int, colIndex: int) -> None: ...
[ "def del_field_pattern(self):\n self.ui.tableFields.removeRow(self.ui.tableFields.currentRow())", "def delete_column(self, idx=-1):\n if not isinstance(idx, int):\n raise TypeError('Must feet <int>')\n for row in self._tbl.tr_lst:\n row.tc_lst[idx].delete()\n self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the row currently at the given position. index the index of the row to remove.
def removeRow(self, index: int) -> None: ...
[ "def del_row(self, index):\n self.data.remove(self.data[index])", "def remove_row(self, index):\n _ = self.matrix.pop(index) ## Delete row\n self.matrix.append(self.empty_row.copy())", "def del_row(self, row_index):\n ...", "def remove(self, index):\n self.data.pop(index)", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restores the format for this model from XML. root the root XML element from which to get the format information.
def restoreFromXml(self, root: org.jdom.Element) -> None: ...
[ "def restoreXML(self, parser: ghidra.xml.XmlPullParser) -> None:\n ...", "def set_document_xml_from(data, format='kupu', request=None):", "def readVersion(self):\n ds = self.root.findall(\"[@format]\")[0]\n raw_format = ds.attrib['format']\n try:\n self.documentFormatVersi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves this format to XML.
def saveToXml(self) -> org.jdom.Element: ...
[ "def save_xml(self):\n pass", "def write(self):\n write_xml(self.path, self.xml(), pretty=True)\n self.__store()", "def save(self, pretty=True):\n self.endInstance()\n if pretty:\n _indent(self.root, whitespace=self._whiteSpace)\n tree = ET.ElementTree(self.r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notifies each row that the services have changed.
def servicesChanged(self) -> None: ...
[ "def notify(self):\n for customer in self.customers:\n customer.update()", "def UpdatesChanged(self):\n pklog.debug(\"Emitting UpdatesChanged signal\")", "def do_update(services):\n\n global running_update\n\n for service in services:\n feed = registry[service.name][0]\n try:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the base id for this model. Each row in a model gets an id which must be unique across all models. id the base id for this format.
def setBaseRowID(self, id: int) -> None: ...
[ "def set_id(self, id):\n self.data['id'] = id", "def set_id(self,new_id):\r\n self.__id=new_id", "def _setId(self, id):\n (self.name, self.res_id, self.res_ic) = id[0]", "def _setId(self, id):\n (self.at_id, self.alt_loc) = id[0]", "def setId(self, *args):\n return _libsbm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the fields on the given row. index the row to update.
def updateRow(self, index: int) -> None: ...
[ "def __set_row(self, index, new_row):\n self.__table[index] = new_row", "def updateRow(self, row):\n return super(UpdateCursor, self).updateRow(row)", "def do_update_row(args):\n cc = Client(args.file, args.sheetname)\n if args.rownum:\n cc.update_row_by_rownum(args.rownum, args.row)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts at the start of the LinkedList.
def insert_start(self, data): if self.head is None: self.head = ListNode(data) else: temp = self.head self.head = ListNode(data) self.head.next = temp
[ "def _first_insert(self, e):\n self._start = self._Node(e, None, None)\n self._start._prev = self._start\n self._start._next = self._start\n self._size += 1", "def __insert_node_at_beginning(\n self,\n new_node\n ):\n list_is_empty = self.size() == 0\n\n if list_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts at the end of the LinkedList.
def insert_end(self, data): if self.head is None: self.head = ListNode(data) else: temp = self.head while temp.next is not None: temp = temp.next temp.next = ListNode(data)
[ "def insertEnd(self, newNode):\n if self.head is None:\n self.head = newNode\n else:\n while True:\n lastNode = self.head\n if lastNode.next is None:\n break\n else:\n lastNode = lastNode.next\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download model from source to target directory
def download_model(source, target, filename): if not os.path.exists(target): os.mkdir(target) target_file = str(Path(target).joinpath(filename)) if os.path.exists(target_file): print('model already exists, skipping download') return print("Downloading from {} to {}".format(sourc...
[ "def download_model():\n destination_directory = FLAGS.MODEL_DIR\n if not os.path.exists(destination_directory):\n os.makedirs(destination_directory)\n\n file_name = DATA_URL.split('/')[-1]\n file_path = os.path.join(destination_directory, file_name)\n if not os.path.exists(file_path):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CreateCcRuleResponse The model defined in huaweicloud sdk
def __init__(self, name=None, id=None, policyid=None, url=None, prefix=None, mode=None, status=None, conditions=None, action=None, tag_type=None, tag_index=None, tag_condition=None, limit_num=None, limit_period=None, unlock_num=None, lock_time=None, domain_aggregation=None, region_aggregation=None, description=None, to...
[ "def CreateRule(self, request):\n try:\n params = request._serialize()\n headers = request.headers\n body = self.call(\"CreateRule\", params, headers=headers)\n response = json.loads(body)\n model = models.CreateRuleResponse()\n model._deseria...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the policyid of this CreateCcRuleResponse. Policy ID.
def policyid(self): return self._policyid
[ "def policy_id(self):\n return self._policy_id", "def policy_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"policy_id\")", "def policy_definition_id(self):\n return self._policy_definition_id", "def policy_definition_id(self) -> pulumi.Output[Optional[str]]:\n return pu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the policyid of this CreateCcRuleResponse. Policy ID.
def policyid(self, policyid): self._policyid = policyid
[ "def policy_id(self, policy_id):\n\n self._policy_id = policy_id", "def policy_id(self, policy_id):\n self._policy_id = policy_id", "def payment_policy_id(self, payment_policy_id):\n\n self._payment_policy_id = payment_policy_id", "def policy_definition_id(self, policy_definition_id):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the tag_type of this CreateCcRuleResponse.
def tag_type(self): return self._tag_type
[ "def getType(self):\n return _libsbml.Rule_getType(self)", "def getTypeCode(self):\n return _libsbml.Rule_getTypeCode(self)", "def get_category_type(self) -> Categories:\n return self._category", "def type(self):\n return self._getValue('type')", "def nic_tag_type(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the tag_type of this CreateCcRuleResponse.
def tag_type(self, tag_type): self._tag_type = tag_type
[ "def rule_condition_type(self, rule_condition_type):\n\n self._rule_condition_type = rule_condition_type", "def channels_set_type(self, room_id, a_type, **kwargs):\n return self.__call_api_post('channels.setType', roomId=room_id, type=a_type, kwargs=kwargs)", "def c_type(self, c_type):\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the tag_index of this CreateCcRuleResponse. 用户标识,当限速模式为用户限速(cookie或header)时,需要传该参数。 选择cookie时,设置cookie字段名,即用户需要根据网站实际情况配置唯一可识别Web访问者的cookie中的某属性变量名。用户标识的cookie,不支持正则,必须完全匹配。例如:如果网站使用cookie中的某个字段name唯一标识用户,那么可以选取name字段来区分Web访问者。 选择header时,设置需要防护的自定义HTTP首部,即用户需要根据网站实际情况配置可识别Web访问者的HTTP首部。
def tag_index(self): return self._tag_index
[ "def getZn3Idx(self):\n\n return self.zn3Idx", "def _cookie_id(self):\n\n if not self.__cookie_id:\n # Generate a cookie ID if one hasn't been made yet\n self.__cookie_id = self.get_argument(\"cookie_id\", None)\n\n if not self.__cookie_id:\n global co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the tag_index of this CreateCcRuleResponse. 用户标识,当限速模式为用户限速(cookie或header)时,需要传该参数。 选择cookie时,设置cookie字段名,即用户需要根据网站实际情况配置唯一可识别Web访问者的cookie中的某属性变量名。用户标识的cookie,不支持正则,必须完全匹配。例如:如果网站使用cookie中的某个字段name唯一标识用户,那么可以选取name字段来区分Web访问者。 选择header时,设置需要防护的自定义HTTP首部,即用户需要根据网站实际情况配置可识别Web访问者的HTTP首部。
def tag_index(self, tag_index): self._tag_index = tag_index
[ "def cat_features_idx(self, cat_features_idx):\n\n self._cat_features_idx = cat_features_idx", "def __setitem__(self, index, dxftag):\r\n # skip first tags = (100, 'AcDbXrecord'), (280, ...)\r\n self.content_tags[XRecord._adjust_index(index)] = dxftag", "def setIndexOfAgent(self,index):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the tag_condition of this CreateCcRuleResponse.
def tag_condition(self): return self._tag_condition
[ "def _get_condition(self):\n return self._condition", "def condition(self):\n return self._condition", "def condition(self) -> pulumi.Input['BucketLifecycleRuleConditionArgs']:\n return pulumi.get(self, \"condition\")", "def condition_name(self):\r\n return self.condition.tag.split...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the tag_condition of this CreateCcRuleResponse.
def tag_condition(self, tag_condition): self._tag_condition = tag_condition
[ "def condition(self, condition):\n\n self._condition = condition", "def condition(self, condition):\n self._condition = condition", "def tag_condition(self):\n return self._tag_condition", "def condition_description(self, condition_description):\n\n self._condition_description = co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the limit_num of this CreateCcRuleResponse. 限制频率,单位为次,范围为1~2147483647
def limit_num(self): return self._limit_num
[ "def message_count_limit(self) -> ConfigNodePropertyInteger:\n return self._message_count_limit", "def _determine_limit(self, limit):\n\n # Note: +1 is allowed here because it allows\n # the user to fetch one beyond to see if they\n # are at the end of the list\n if not limit:\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the limit_num of this CreateCcRuleResponse. 限制频率,单位为次,范围为1~2147483647
def limit_num(self, limit_num): self._limit_num = limit_num
[ "def limit_num_clients(self, limit_num_clients):\n\n self._limit_num_clients = limit_num_clients", "async def cclimit(self, ctx, limit_amount: int = None):\n if limit_amount is None:\n return await ctx.send_help()\n if limit_amount < 0:\n return await ctx.send(\"You need...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the limit_period of this CreateCcRuleResponse. 限速周期,单位为秒,范围1~3600
def limit_period(self): return self._limit_period
[ "def get_period(self):\n # res\n if self._cacheExpiration <= YAPI.GetTickCount():\n if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:\n return YPwmOutput.PERIOD_INVALID\n res = self._period\n return res", "def get_max_period(self):\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the limit_period of this CreateCcRuleResponse. 限速周期,单位为秒,范围1~3600
def limit_period(self, limit_period): self._limit_period = limit_period
[ "def limit_period(self):\n return self._limit_period", "def speed_limit_set_limit(self, limit: int) -> dict:\n\n url = '/command/speed_limit_set_limit'\n data = {\n 'limit_mph': limit\n }\n method = METHOD_POST\n return self._call(method, url, data)", "def se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the unlock_num of this CreateCcRuleResponse. 放行频率,单位为次,范围为0~2147483647。只有当防护动作类型为dynamic_block时,才需要传该参数。
def unlock_num(self): return self._unlock_num
[ "def get_perk_unlock_cost(cls, perk: Union[BucksPerk, int]) -> int:\n perk = cls.load_perk_by_guid(perk)\n if perk is None:\n return 0\n if hasattr(perk, 'unlock_cost'):\n return perk.unlock_cost\n return 0", "def unlockRequestCode(self)->str:\n from .core ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the unlock_num of this CreateCcRuleResponse. 放行频率,单位为次,范围为0~2147483647。只有当防护动作类型为dynamic_block时,才需要传该参数。
def unlock_num(self, unlock_num): self._unlock_num = unlock_num
[ "def unlock_num(self):\n return self._unlock_num", "def set_nblocks(self, nblocks):\n self.d.set_nblocks(nblocks)", "def manual_lockout(self, manual_lockout):\n\n self._manual_lockout = manual_lockout", "def lock_height(self, lock_height):\n\n self._lock_height = lock_height", "d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the lock_time of this CreateCcRuleResponse. 阻断时间,单位为秒,范围为0~65535。当"防护动作"选择"阻断"时,可设置阻断后恢复正常访问页面的时间。
def lock_time(self): return self._lock_time
[ "def lock_duration(self):\n return self._lock_duration", "def lock_duration(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"lock_duration\")", "def lockTime(self) -> str:\n return codecs.encode(self._lockTime, \"hex\").decode()", "def delete_lock_expire_time(self) -> st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the lock_time of this CreateCcRuleResponse. 阻断时间,单位为秒,范围为0~65535。当"防护动作"选择"阻断"时,可设置阻断后恢复正常访问页面的时间。
def lock_time(self, lock_time): self._lock_time = lock_time
[ "def lock_time(self, lock_time):\n\n self._lock_time = lock_time", "def lock_expiration_time(self, lock_expiration_time):\n\n self._lock_expiration_time = lock_expiration_time", "def set_lock_time():\n\n pass", "def lock_duration_in_seconds(self, lock_duration_in_seconds):\n\n self._lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the domain_aggregation of this CreateCcRuleResponse. 是否开启域名聚合统计。
def domain_aggregation(self): return self._domain_aggregation
[ "def query_aggregation(self) -> ConfigNodePropertyBoolean:\n return self._query_aggregation", "def aggregation_mode(self):\n return self._aggregation_mode", "def domainAuthModeEnabled(self):\n return getattr(self, '_domain_auth_mode', None)", "def domain_aggregation(self, domain_aggregati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the domain_aggregation of this CreateCcRuleResponse. 是否开启域名聚合统计。
def domain_aggregation(self, domain_aggregation): self._domain_aggregation = domain_aggregation
[ "def domain_aggregation(self):\n return self._domain_aggregation", "def query_aggregation(self, query_aggregation: ConfigNodePropertyBoolean):\n\n self._query_aggregation = query_aggregation", "def query_aggregation(self) -> ConfigNodePropertyBoolean:\n return self._query_aggregation", "d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the region_aggregation of this CreateCcRuleResponse. 是否开启全局计数。
def region_aggregation(self): return self._region_aggregation
[ "def region_status(self):\n return self._region_status", "def getAggregationMode(self) -> Aggregation:\n return self.__aggregationMode", "def region(self) -> bool:\n return self._region", "def aggregation_mode(self):\n return self._aggregation_mode", "def query_aggregation(self) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the region_aggregation of this CreateCcRuleResponse. 是否开启全局计数。
def region_aggregation(self, region_aggregation): self._region_aggregation = region_aggregation
[ "def region_aggregation(self):\n return self._region_aggregation", "def aggregation_mode(self, aggregation_mode):\n allowed_values = [\"roundrobin\", \"failover\", \"lacp\", \"fec\"]\n if aggregation_mode is not None and aggregation_mode not in allowed_values:\n raise ValueError(\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the total_num of this CreateCcRuleResponse. 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数
def total_num(self): return self._total_num
[ "def get_TotalCount(self):\n return self._output.get('TotalCount', None)", "def get_total_count(self):\n return self.total_count", "def _get_total_count(response):\n return int(response.headers.get(\"X-Total-Count\", 0))", "def rule_number(self) -> pulumi.Output[int]:\n return pulu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the total_num of this CreateCcRuleResponse. 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数
def total_num(self, total_num): self._total_num = total_num
[ "def total_num(self, total_num):\n\n self._total_num = total_num", "def total_count(self, total_count):\n self._total_count = total_count", "def total_cargo(self, total_cargo):\n\n self._total_cargo = total_cargo", "def total_num_not(self, total_num_not):\n\n self._total_num_not = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the unaggregation of this CreateCcRuleResponse. 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数
def unaggregation(self): return self._unaggregation
[ "def unaggregation(self, unaggregation):\n self._unaggregation = unaggregation", "def get_rule(self):\r\n\r\n rules = [rule.get_rule() for rule in self._rules_container.Controls]\r\n\r\n return ExcludeGroup(self._operator.SelectedItem, rules)", "def _get_aggregation(self):\n return self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the unaggregation of this CreateCcRuleResponse. 该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数
def unaggregation(self, unaggregation): self._unaggregation = unaggregation
[ "def unaggregation(self):\n return self._unaggregation", "def uncertainty(self, uncertainty):\n\n self._uncertainty = uncertainty", "def unapproved(self, unapproved):\n\n self._unapproved = unapproved", "def setUncertainty(self, uncertainty):\n self.uncertainty = uncertainty", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the aging_time of this CreateCcRuleResponse. 规则老化时间,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数
def aging_time(self): return self._aging_time
[ "def arrivaltime(self) -> datetime:\n return self._arrivaltime", "def create_time(self):\n return self._create_time", "def aging_time(self, aging_time):\n self._aging_time = aging_time", "def get_time(self):\n return self.sent_date.strftime('%H:%m - %Y %b %d')", "def created_time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the aging_time of this CreateCcRuleResponse. 规则老化时间,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数
def aging_time(self, aging_time): self._aging_time = aging_time
[ "def commissioning_time(self, commissioning_time):\n\n self._commissioning_time = commissioning_time", "def arrivaltime(self, arrivaltime: datetime):\n\n self._arrivaltime = arrivaltime", "def creation_time(self, creation_time):\n\n self._creation_time = creation_time", "def time_based_co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the producer of this CreateCcRuleResponse. 规则创建对象,该参数为预留参数,用于后续功能扩展,当前请用户忽略该参数
def producer(self, producer): self._producer = producer
[ "def producer(self, producer):\n\n self._producer = producer", "def __init__(self, name=None, id=None, policyid=None, url=None, prefix=None, mode=None, status=None, conditions=None, action=None, tag_type=None, tag_index=None, tag_condition=None, limit_num=None, limit_period=None, unlock_num=None, lock_time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Contour a threedimensional array.
def contour_array(self, a, masked_values=None, head=None, **kwargs): return self.__cls.contour_array(a=a, masked_values=masked_values, head=head, **kwargs)
[ "def points2contour(points):\n return points.reshape(-1, 1, 2)", "def data_contour(x,y,z):\n n_x=len(np.unique(x))\n n_y=len(np.unique(y))\n \n x=np.reshape(x,(n_y,n_x))\n y=np.reshape(y,(n_y,n_x))\n z=np.reshape(z,(n_y,n_x))\n \n return x,y,z", "def contour(image):\n return _apply...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a plot of inactive cells. If not specified, then pull ibound from the self.ml
def plot_inactive(self, ibound=None, color_noflow='black', **kwargs): if ibound is None: if self.mg.idomain is None: raise AssertionError("An idomain array must be provided") else: ibound = self.mg.idomain plotarray = np.zeros(ibound.shape, dtype=...
[ "def plot_ibound(self, ibound=None, color_noflow='black', color_ch='blue',\n color_vpt=\"red\", head=None, **kwargs):\n if ibound is None:\n if self.model is not None:\n if self.model.version == \"mf6\":\n color_ch = color_vpt\n\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a plot of ibound. If not specified, then pull ibound from the self.model
def plot_ibound(self, ibound=None, color_noflow='black', color_ch='blue', color_vpt="red", head=None, **kwargs): if ibound is None: if self.model is not None: if self.model.version == "mf6": color_ch = color_vpt if self.mg.idomain ...
[ "def plotModel(self):\n pass", "def plot_inactive(self, ibound=None, color_noflow='black', **kwargs):\n if ibound is None:\n if self.mg.idomain is None:\n raise AssertionError(\"An idomain array must be provided\")\n else:\n ibound = self.mg.idomain\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a LineCollection of the grid
def get_grid_line_collection(self, **kwargs): return self.__cls.get_grid_line_collection(**kwargs)
[ "def get_grid_lines(self):\n xmin = self.xedge[0]\n xmax = self.xedge[-1]\n ymin = self.yedge[-1]\n ymax = self.yedge[0]\n lines = []\n # Vertical lines\n for j in range(self.ncol + 1):\n x0 = self.xedge[j]\n x1 = x0\n y0 = ymin\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert rois into the torchvision format.
def _convert_boxes_to_roi_format(boxes): concat_boxes = boxes.view((-1, 4)) ids = torch.full_like(boxes[:, :, :1], 0) for i in range(boxes.shape[0]): ids[i, :, :] = i ids = ids.view((-1, 1)) rois = torch.cat([ids, concat_boxes], dim=1) return rois
[ "def test_convert2torchvision_format():\n boxes = [\n BBox2D(label=0, x=10, y=10, w=10, h=10),\n BBox2D(label=1, x=20, y=20, w=10, h=10),\n ]\n\n actual_targets = prepare_bboxes(boxes)\n expected_targets = {\n \"boxes\": torch.Tensor([[10, 10, 20, 20], [20, 20, 30, 30]]),\n \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether a nonpositive nu parameter raises a ValueError.
def test_nonpositive_nu_raises_exception(nu): with pytest.raises(ValueError): kernels.Matern(input_dim=1, nu=nu)
[ "def test_negative_values(self):\n rain = self.rain_prob_cube\n high_prob = self.high_prob_cube\n msg = \"Negative values of sleet probability have been calculated.\"\n with self.assertRaisesRegex(ValueError, msg):\n calculate_sleet_probability(rain, high_prob)", "def test_n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether a Matern kernel with nu large is close to an RBF kernel.
def test_nu_large_recovers_rbf_kernel(x0: np.ndarray, x1: np.ndarray, input_dim: int): lengthscale = 1.25 kernmat_rbf = kernels.ExpQuad(lengthscale=lengthscale, input_dim=input_dim) kernmat_matern = kernels.Matern(lengthscale=lengthscale, nu=15, input_dim=input_dim) np.testing.assert_allclose( k...
[ "def RBF_kernel(W,X,sigma):\n #TODO\n return(np.exp((-1) * distance.cdist(W, X, 'sqeuclidean')/(2*(sigma**2))))", "def kernel_test(l, v):\n\t\"Testing RBF and Matern kernels with: \"\n\tx = np.array([1,2,3,4])\n\ty = np.array([2,4,6])\n\tprint(x)\n\tprint(y)\n\tprint(\"RBF Kernel with l= \" + str(l) + \": \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Peform a search given a query and return all results as Event objects.
def make_search(self, query_text): query = metapy.index.Document() query.content(query_text) top_docs = self.ranker.score(self.idx, query, num_results=100) events = [] for num, (d_id, _) in enumerate(top_docs): events.append(Event(self.idx, d_id)) return event...
[ "def _search_events(self, query_string, rows=None, start=None, from_date=None, until_date=None,\n order=None, callback=None, output_format=None, fields=None):\n\n query_params = {\n 'q': query_string\n }\n\n if rows is not None:\n query_params['rows']...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds the plan. First, run the function to be converted in a plan in a context which activates the tracing and record the actions in trace.logs Second, store the result ids temporarily to helper ordering the output placeholders at return time Third, loop through the trace logs and replace the tensors found in the acti...
def build(self, *args, trace_autograd=False): # Reset previous build self.role.reset() def build_nested_arg(arg, leaf_function): if isinstance(arg, list): return [build_nested_arg(obj, leaf_function) for obj in arg] elif isinstance(arg, tuple): ...
[ "def build(self, *args):\n args = list(args)\n\n # Move the arguments of the first call to the plan and store their ids\n # as they will be included in the readable_plan: it should be updated\n # when the function is called with new args and that's why we keep the\n # refs self.ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a copy of a plan.
def copy(self): plan_copy = Plan( name=self.name, role=self.role.copy(), include_state=self.include_state, is_built=self.is_built, id=sy.ID_PROVIDER.pop(), owner=self.owner, tags=self.tags, input_types=self.input_typ...
[ "def copy(self):\n plan = Plan(\n sy.ID_PROVIDER.pop(),\n self.owner,\n self.name,\n arg_ids=self.arg_ids,\n result_ids=self.result_ids,\n readable_plan=self.readable_plan,\n is_built=self.is_built,\n )\n\n # TODO: we ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add new tensors or parameter attributes to the state and register them in the owner's registry
def __setattr__(self, name, value): if isinstance(value, torch.jit.ScriptModule): object.__setattr__(self, name, value) elif isinstance(value, FrameworkTensor): self.role.register_state_tensor(value) self.state_attributes[name] = value elif isinstance(value, F...
[ "def add_state(self, name, initial=None, attrs=None, **kwargs):\n if self._initialized is True:\n raise RuntimeError(\"cannot add stateful logic after intialization\")\n if name in self._variables:\n raise ValueError(\n \"stateful element already registered: {}\".f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send plan to locations. If the plan was not built locally it will raise an exception. If `force` = true plan is going to be sent either way.
def send(self, *locations: AbstractWorker) -> PointerPlan: if not self.is_built: raise RuntimeError("A plan needs to be built before being sent to a worker.") if len(locations) == 1: location = locations[0] # Check if plan was already sent at the location ...
[ "def send(self, *locations, force=False):\n if not self.is_built and not force:\n raise RuntimeError(\"A plan needs to be built before being sent to a worker.\")\n\n self.locations += [self.owner.get_worker(location).id for location in locations]\n\n # rm duplicates\n self.loc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns dummy arguments matching built Plan arguments' types
def create_dummy_args(self): if not self.is_built: raise RuntimeError("A plan needs to be built before input shapes can be known.") def traverse_nested_types(arg, leaf_function): if isinstance(arg, list): return [traverse_nested_types(obj, leaf_function) for obj ...
[ "def args(self):\r\n return [Type(self._ptr.getParamType(i)) for i in range(self.arg_count)]", "def gen_test_case_empty_argument(self):\n\n cases = []\n\n cases.append('\\n\\n;; Test operation with empty argument\\n')\n\n case_data = {\n 'op': '',\n 'extended_name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }