code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def test_search_category_user(self): <NEW_LINE> <INDENT> self.client.login(username='SearchViewTest', password='Test') <NEW_LINE> response = self.client.post(reverse('search'), {'search':self.category.categoryName}) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertJSONEqual( str(response.con... | test we can search for a category as a logged in user | 625941ed99fddb7c1c9de8ae |
def __init__(self, context): <NEW_LINE> <INDENT> self._context = context | Constructor.
Args:
context (sawtooth_sdk.processor.context.Context): Access to
validator state from within the transaction processor. | 625941ed3cc13d1c6d3c7897 |
def setCursorEnabled(self, *args): <NEW_LINE> <INDENT> return _soqt.SoQtFlyViewer_setCursorEnabled(self, *args) | setCursorEnabled(self, SbBool enable) | 625941edaad79263cf390f69 |
def close(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.client_socket.shutdown(socket.SHUT_RDWR) <NEW_LINE> <DEDENT> except socket.error as err: <NEW_LINE> <INDENT> if err.errno not in (errno.ENOTCONN, errno.EBADF): <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> <DEDENT> self.client_socket.close() <NEW_LINE> ... | Close connections | 625941ed796e427e537b0aeb |
def _openssl(args, input=None): <NEW_LINE> <INDENT> cmd = ['openssl'] + args <NEW_LINE> proc = Popen(cmd, stdin=PIPE) <NEW_LINE> (stdout, stderr) = proc.communicate(input) <NEW_LINE> if proc.returncode: <NEW_LINE> <INDENT> raise CalledProcessError(proc.returncode, cmd) <NEW_LINE> <DEDENT> return proc.returncode, stdout... | Execute a command in a subproces feeding stdin with the provided input.
:return: (returncode, stdout, stderr) | 625941edd10714528d600209 |
def __init__( self , overrides = () ): <NEW_LINE> <INDENT> from configparser import ConfigParser <NEW_LINE> config = ConfigParser( allow_no_value = True ) <NEW_LINE> try: <NEW_LINE> <INDENT> config.read_file( open( Config.FILE_NAME ) ) <NEW_LINE> <DEDENT> except FileNotFoundError: <NEW_LINE> <INDENT> raise FatalError( ... | Charge le fichier de configuration et vérifie que toutes les entrées
requises sont présentes.
:raises FatalError: le fichier n'existe pas, ou la configuration est incomplète | 625941ed3617ad0b5ed68416 |
def deactivate(self): <NEW_LINE> <INDENT> projItems = list(self.projectDataHandlers.keys()) <NEW_LINE> for projItem in projItems: <NEW_LINE> <INDENT> self.closeProjectUsingProjItem(projItem) <NEW_LINE> <DEDENT> showCC3DProjectPanel = self.configuration.setSetting("ShowCC3DProjectPanel", not self.cc3dProjectDock.isHidde... | Public method to deactivate this plugin. | 625941ed91f36d47f21aca18 |
def _status_update(self): <NEW_LINE> <INDENT> self._epoch_done = True if self._index == len(self._data_field) - 1 else False <NEW_LINE> pass | this function is call in the generate_data
update the status of the dataset after one sample is generate
such as update the self._epoch_done: if the sample is the last of the dataset, we should set the sale._epoch_done to True, ortherwise, set to False | 625941ed3346ee7daa2b3290 |
def _set_service_type(self, api_ver): <NEW_LINE> <INDENT> if api_ver in ['v1.0', 'v1.1', 'v1.2']: <NEW_LINE> <INDENT> self.service_type = LEGACY_REG_MDNSTYPE <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.service_type = REGISTRATION_MDNSTYPE | Set DNS-SD service type based on current api version in use | 625941ed379a373c97cfb067 |
def define_types(self, compiler, statements): <NEW_LINE> <INDENT> definition_count = 0 <NEW_LINE> for stmt in statements: <NEW_LINE> <INDENT> if isinstance(stmt, DefinitionStatement): <NEW_LINE> <INDENT> state = State(compiler, stmt.namespace, stmt) <NEW_LINE> state.add_to_graph(self._graph) <NEW_LINE> definition_count... | This is the first compiler stage that defines all types | 625941ed23e79379d52eea7d |
def buy_from_bank(self): <NEW_LINE> <INDENT> self.graphic_board.screen.blit(pygame.image.load("graphic/buy_trade.png"), (127, 127)) <NEW_LINE> pygame.display.update() <NEW_LINE> not_exit = 1 <NEW_LINE> while not_exit: <NEW_LINE> <INDENT> for event in pygame.event.get(): <NEW_LINE> <INDENT> cur = pygame.mouse.get_pos() ... | The function to choose what user want to buy from bank - house or hotel
:return: void only changes objects | 625941ed66673b3332b925b1 |
def nn_triage(self, wf, th): <NEW_LINE> <INDENT> nneigh = self.nneigh <NEW_LINE> n,R,C = wf.shape <NEW_LINE> if C < nneigh: <NEW_LINE> <INDENT> wf = np.concatenate( (wf,np.zeros((n,R,nneigh-C))), axis = 2) <NEW_LINE> <DEDENT> with tf.Session() as sess: <NEW_LINE> <INDENT> self.saver_triagenet.restore(sess, self.ckpt_lo... | Runs the triage network
Parameters:
-----------
wf: np.array
[number of data, temporal length, number of channels] waveforms extracted at the detection stage.
th: float
threshold for the output probability of the triage network.
Returns:
-----------
index: np.array
[number of data] returned b... | 625941edbe8e80087fb2115a |
def __report_diff(self, x): <NEW_LINE> <INDENT> return x[0] if x[0] == x[1] else '{} ---> {}'.format(*x) | Report data difference.
:param x:
:return: difference | 625941ed7b25080760e39976 |
def next_state(self, current_state, action): <NEW_LINE> <INDENT> s_row = int(current_state[0]) <NEW_LINE> s_col = int(current_state[1]) <NEW_LINE> next_row = s_row <NEW_LINE> next_col = s_col <NEW_LINE> if action == 0: next_row = max(0,s_row - 1) <NEW_LINE> if action == 1: next_row = min (self.gridsize-1, s_row+1) <NEW... | Next State
Determines the next state, given the current state and action as per the game rule.
Parameters
----------
current_state :(int, int)
A tuple of current state coordinate
action : int
Action index
Returns
-------
str
New state coded as str of coordinates | 625941ed0383005118ecfb00 |
def add_file(name_data, filename): <NEW_LINE> <INDENT> year = '' <NEW_LINE> line_num = 0 <NEW_LINE> with open(filename, 'r') as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> if line_num == 0: <NEW_LINE> <INDENT> year = line.strip() <NEW_LINE> line_num += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rank_... | Reads the information from the specified file and populates the name_data
dict with the data found in the file.
Input:
name_data (dict): dict holding baby name data
filename (str): name of the file holding baby name data
Output:
This function modifies the name_data dict to store information from
the p... | 625941ed50485f2cf553d2bc |
def good_tile_shape(shape, num_shards=-1): <NEW_LINE> <INDENT> if num_shards != -1: <NEW_LINE> <INDENT> tile_size = np.prod(shape) / num_shards <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> tile_size = DEFAULT_TILE_SIZE <NEW_LINE> <DEDENT> tile_shape = [1] * len(shape) <NEW_LINE> idx = len(shape) - 1 <NEW_LINE> while t... | Compute a tile_shape (tile_hint) for the array.
Args:
shape: tuple. the array's shape.
Returns:
list: tile_shape for the array | 625941ed5fdd1c0f98dc0755 |
def build_model_columns(): <NEW_LINE> <INDENT> (gender, race, education, marital_status, relationship, workclass, occupation, native_country, age, education_num, capital_gain, capital_loss, hours_per_week) = INPUT_COLUMNS <NEW_LINE> age_buckets = tf.feature_column.bucketized_column( age, boundaries=[18, 25, 30, 35, 40,... | Builds a set of wide and deep feature columns. | 625941ed8e7ae83300e4b4ee |
def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_color = (0, 0, 0) | Initialise the programs settings. | 625941ed24f1403a92601082 |
def _excel_quit(self): <NEW_LINE> <INDENT> if ExcelSpreadsheet_win32com._excel_app_ctr == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if ExcelSpreadsheet_win32com._excel_app_ctr > 1: <NEW_LINE> <INDENT> ExcelSpreadsheet_win32com._excel_app_ctr -= 1 <NEW_LINE> return ExcelSpreadsheet_win32com._excel_app_ctr <... | A method that quits from Excel after all spreadsheets are closed. | 625941ed091ae35668667476 |
def __init__(self, x, y, text, font, colour, width, height, x_offset, y_offset): <NEW_LINE> <INDENT> self.x, self.y = x, y <NEW_LINE> self.width, self.height = width, height <NEW_LINE> self.x_off, self.y_off = x_offset, y_offset <NEW_LINE> self.text = text <NEW_LINE> self.font = font <NEW_LINE> self.colou... | Set up with position, dimensions, caption text, font, and position,
and background colour | 625941ed99cbb53fe6793105 |
def nsplit(l, n): <NEW_LINE> <INDENT> avg = len(l) / n <NEW_LINE> out = [] <NEW_LINE> last = 0.0 <NEW_LINE> while last < len(l): <NEW_LINE> <INDENT> out.append(l[int(last):int(last + avg)]) <NEW_LINE> last += avg <NEW_LINE> <DEDENT> return out | from http://stackoverflow.com/questions/2130016/ | 625941edf8510a7c17cf9c20 |
def checkUnauthenticated(self): <NEW_LINE> <INDENT> for archive in self.obj.published_archives: <NEW_LINE> <INDENT> if not archive.private: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False | Check unauthenticated users.
Unauthenticated users can see the package as long as it's published
in a non-private archive. | 625941ed6fece00bbac2dc65 |
def getFailedToUnpackApps(self): <NEW_LINE> <INDENT> app_list = list() <NEW_LINE> sql = ('SELECT id, package_name, project_name, ' 'decoded_path, has_native, min_sdk_version, ' 'target_sdk_version, version_name, version_code, ' 'permission, debuggable, successfully_unpacked, ' 'shared_user_id, shared_user_label, allow_... | Return only the failed to unpack applications | 625941edab23a570cc2506a7 |
def deatomize(self, encoded: np.array) -> str: <NEW_LINE> <INDENT> for atom in META_ATOMS: <NEW_LINE> <INDENT> idx = self.vocab[atom] <NEW_LINE> encoded = encoded[encoded != idx] <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return ''.join(list(map(lambda x: self.decoder[x], encoded))) <NEW_LINE> <DEDENT> except KeyErro... | Translate atomized code back into a string.
Parameters
----------
encoded : np.array
Encoded vocabulary indices.
Returns
-------
str
Decoded text. | 625941ed1f5feb6acb0c506a |
@login_wrapper <NEW_LINE> def add(request, gid, count): <NEW_LINE> <INDENT> uid = request.session.get('user_id') <NEW_LINE> cart_set = CartInfo.objects.filter(user_id=uid, goods_id=gid) <NEW_LINE> count = int(count) <NEW_LINE> if cart_set.count() > 0: <NEW_LINE> <INDENT> gid_cart = cart_set[0] <NEW_LINE> gid_cart.count... | 增加特定商品数量 | 625941eddc8b845886cb5a57 |
def __init__(self): <NEW_LINE> <INDENT> self._lookupDict = { OBS_ROW_CONTENT : self._lookupRowContent, OBS_ROW_MISSING : self._lookupRowMissing, OBS_ROW_EMPTYPLC : self._lookupRowEmptyPlc, OBS_COL_CONTENT : self._lookupColContent, OBS_COL_MISSING : self._lookupColMissing, OBS_COL_EMPTYPLC : self._lookupColEmptyPlc, OBS... | Initialisations : dictionnaire de méthodes
| 625941edd58c6744b425817e |
def get_citation(self, identifier): <NEW_LINE> <INDENT> cli = Cli([identifier]) <NEW_LINE> cli.run() <NEW_LINE> return "\n".join(cli.output) | Return the bib entry using nathan grigg's arxiv2bib
(http://nathangrigg.github.io/arxiv2bib/) | 625941ed7b180e01f3dc4d12 |
@pytest.mark.parametrize( "uri,stargs_to_join,expected_joined_uri", [ ("s3://mybucket/path/to", ("thing",), "s3://mybucket/path/to/thing"), ("s3://mybucket/path/to/", ("thing",), "s3://mybucket/path/to/thing"), ("s3://mybucket/path/to", ("some/even/", "deeper", "thing",), "s3://mybucket/path/to/some/even/deeper/thing")... | test join uri for various uris | 625941ed566aa707497f4a82 |
def _validate_isvalid_history(self, isvalid_history, field, value): <NEW_LINE> <INDENT> history_type = value['type'] <NEW_LINE> if history_type.endswith('emission'): <NEW_LINE> <INDENT> history_type = 'emission' <NEW_LINE> <DEDENT> elif history_type.endswith('absorption'): <NEW_LINE> <INDENT> history_type = 'absorption... | Checks that the given time history is properly formatted.
Args:
isvalid_history (`bool`): flag from schema indicating units to be checked.
field (`str`): property associated with history in question.
value (`dict`): dictionary of values from file associated with this property.
The rule's arguments are val... | 625941ed5fdd1c0f98dc0756 |
def closestValue(self, root, target): <NEW_LINE> <INDENT> lower = self.lowerBound(root, target) <NEW_LINE> upper = self.upperBound(root, target) <NEW_LINE> if lower and upper: <NEW_LINE> <INDENT> if abs(lower.val - target) < abs(upper.val - target): <NEW_LINE> <INDENT> return lower.val <NEW_LINE> <DEDENT> else: <NEW_LI... | :type root: TreeNode
:type target: float
:rtype: int | 625941ed07d97122c4178db8 |
def remove(self, val): <NEW_LINE> <INDENT> f = val in self._s <NEW_LINE> if f: <NEW_LINE> <INDENT> self._s[val] -= 1 <NEW_LINE> self._sum -= 1 <NEW_LINE> if self._s[val] == 0: <NEW_LINE> <INDENT> del self._s[val] <NEW_LINE> <DEDENT> <DEDENT> return f | Removes a value from the collection. Returns true if the collection contained the specified element.
:type val: int
:rtype: bool | 625941ed6fb2d068a760f5c6 |
def test_009_interrupted_commit(self): <NEW_LINE> <INDENT> config = { 'name': 'root', 'pool': self.pool.name, 'save_on_stop': True, 'rw': True, 'revisions_to_keep': 2, 'size': qubes.config.defaults['root_img_size'], } <NEW_LINE> vm = qubes.tests.storage.TestVM(self) <NEW_LINE> volume = self.app.get_pool(self.pool.name)... | Test volume changes commit | 625941ed4428ac0f6e5bad17 |
def test_closing_plugin(findinfiles, qtbot, mocker): <NEW_LINE> <INDENT> path_selection_combo = findinfiles.findinfiles.find_options.path_selection_combo <NEW_LINE> path_selection_combo.clear_external_paths() <NEW_LINE> assert path_selection_combo.get_external_paths() == [] <NEW_LINE> expected_results = [ LOCATION, osp... | Test that the external paths listed in the combobox are saved and loaded
correctly from the spyder config file. | 625941ed507cdc57c6307208 |
def print_history(self): <NEW_LINE> <INDENT> header = ['time', 's', 'i', 'r'] <NEW_LINE> print('\t'.join(header)) <NEW_LINE> access_checkpoints = AccessCheckpoints(self.checkpoint_dir) <NEW_LINE> for checkpoint_time in access_checkpoints.list_checkpoints(): <NEW_LINE> <INDENT> chkpt = access_checkpoints.get_checkpoint(... | Print an SIR simulation's history
| 625941ed7cff6e4e81117ea6 |
def bypass(request): <NEW_LINE> <INDENT> urllib.request.socket.socket = default_socket <NEW_LINE> response = bypass_opener.open(request) <NEW_LINE> result = response.read().decode('utf-8') <NEW_LINE> response.close() <NEW_LINE> urllib.request.socket.socket = proxy_socket <NEW_LINE> return result | Temporaily turns off proxy for single request.
request (object): urllib.request request object
Restores the default urllib.request socket and uses the default opener to send request.
When finished restores the proxy socket. If using an http/s proxy the socket is
restored to the original, so it never changes anyway... | 625941edf548e778e58cdaa0 |
def ctxt(txt, color='yellow'): <NEW_LINE> <INDENT> return termcolor.colored(txt, color) | Print out colored text to stdout. | 625941ed6e29344779a62b31 |
def register_category_tree(categories, parent=-1): <NEW_LINE> <INDENT> last_item = parent <NEW_LINE> for c in categories: <NEW_LINE> <INDENT> if type(c) == str: <NEW_LINE> <INDENT> if c[0] == "_": <NEW_LINE> <INDENT> last_item = register_category(c[1:], parent, private=True) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT... | Designed for mass insertion, it takes a nested list as the categories argument and runs through it.
If the current item is a string it takes that to be a category, if it's a list then it's a recursive
call based on the previous item.
Any item prefixed by an underscore is considered to be a private category (non-search... | 625941ed82261d6c526ab9c8 |
def readSED_fnu(self, filename, name=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if filename.endswith('.gz'): <NEW_LINE> <INDENT> f = gzip.open(filename, 'r') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> f = open(filename, 'r') <NEW_LINE> <DEDENT> <DEDENT> except IOError: <NEW_LINE> <INDENT> try: <NEW_LINE> <I... | Read a file containing [lambda Fnu] (lambda in nm) (Fnu in Jansky).
Does not resample wavelen/fnu/flambda onto a grid; leaves fnu set. | 625941ed009cb60464c638ce |
def Run(self): <NEW_LINE> <INDENT> while not self._queue.empty(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cmd = self._queue.get(True, 1) <NEW_LINE> <DEDENT> except Queue.Empty: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> ret, msg = Function.RunCommand(cmd, True) <NEW_LINE> if ret != 0: <NEW_LINE> <INDENT> self._... | thread entrence function | 625941ed38b623060ff0b30e |
def ModifyRoType(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("ModifyRoType", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.ModifyRoTypeResponse() <NEW_LINE> m... | 修改只读实例类型,可以将普通只读实例变为延迟只读实例,或者将延迟只读实例变为普通只读实例。
:param request: Request instance for ModifyRoType.
:type request: :class:`tencentcloud.cdb.v20170320.models.ModifyRoTypeRequest`
:rtype: :class:`tencentcloud.cdb.v20170320.models.ModifyRoTypeResponse` | 625941edcc40096d61595e6f |
def getSpeed(self): <NEW_LINE> <INDENT> return hal.getPWMSpeed(self.handle) | Get the PWM value in terms of speed.
This is intended to be used by speed controllers.
.. note::
:func:`setBounds` must be called first.
:returns: The most recently set speed between -1.0 and 1.0.
:rtype: float | 625941ed21a7993f00bc821a |
def clear(self): <NEW_LINE> <INDENT> self.drawables = [] | Clear all the stuff we wanted to draw | 625941ed56b00c62f0f14b7d |
def load_image(self, img_path): <NEW_LINE> <INDENT> img = image.load_img(img_path, target_size=self.target_size) <NEW_LINE> x = image.img_to_array(img) <NEW_LINE> return self.prep_func(x) | load image given path and convert to an array
| 625941ed435de62698dfe16d |
def __init__(self, name=None, value=None): <NEW_LINE> <INDENT> self._name = None <NEW_LINE> self._value = None <NEW_LINE> self.discriminator = None <NEW_LINE> if name is not None: <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> if value is not None: <NEW_LINE> <INDENT> self.value = value | IoK8sApiCoreV1PodDNSConfigOption - a model defined in Swagger | 625941ed7d43ff24873a31c5 |
def make_batches_with_start_end(inputs, max_batch_size, token_item, pad_item): <NEW_LINE> <INDENT> inputs_it, labels_it = itertools.tee(inputs) <NEW_LINE> inputs_it = map(lambda inp: [token_item] + inp, inputs_it) <NEW_LINE> labels_it = map(lambda inp: inp + [token_item], labels_it) <NEW_LINE> inputs_batches_it = make_... | Args:
inputs: A python iterable of python lists of numbers
Returns:
batches: A python iterator of batches where each batch is a
tuple (inputs batch, labels batch) and each batch part
is a python list of lists of numbers | 625941ed851cf427c661aa2b |
def ProfileDeferredPolicyOptionParameter(vim, *args, **kwargs): <NEW_LINE> <INDENT> obj = vim.client.factory.create('ns0:ProfileDeferredPolicyOptionParameter') <NEW_LINE> if (len(args) + len(kwargs)) < 1: <NEW_LINE> <INDENT> raise IndexError('Expected at least 2 arguments got: %d' % len(args)) <NEW_LINE> <DEDENT> requi... | The ProfileDeferredPolicyOptionParameter data object contains information about
a single deferred parameter for host configuration.* The Server verifies
deferred parameter data when it calls the HostProfile.ExecuteHostProfile
method. * The client supplies deferred parameter data for host configuration
when it calls the... | 625941ed004d5f362079a850 |
def get_user(user_name): <NEW_LINE> <INDENT> if not user_name: <NEW_LINE> <INDENT> raise RuntimeError('Must provide valid user name') <NEW_LINE> <DEDENT> user = User.objects.get(username=user_name) <NEW_LINE> if user is None: <NEW_LINE> <INDENT> raise RuntimeError('Username does not exist!') <NEW_LINE> <DEDENT> return ... | Helper function to retreive User object from a username. | 625941edec188e330fd5acb5 |
def all_synsets_hypernyms(self, word): <NEW_LINE> <INDENT> synH = [] <NEW_LINE> for synset in self.dnouns[word]: <NEW_LINE> <INDENT> synH.extend(self.grels.get_ancestors(synset)) <NEW_LINE> <DEDENT> return set(synH) | Return all hypernyms of a certain word. It uses the
structure of the graph to find out all ascendents. | 625941ed377c676e912726c7 |
def tab_back(self): <NEW_LINE> <INDENT> if util.platform() == "linux": <NEW_LINE> <INDENT> current = self <NEW_LINE> while True: <NEW_LINE> <INDENT> sib = current.GetPrevSibling() <NEW_LINE> if sib is None: <NEW_LINE> <INDENT> self.tab_last() <NEW_LINE> break <NEW_LINE> <DEDENT> if sib.AcceptsFocusFromKeyboard(): <NEW_... | Tab backwards to the previous object. | 625941ed377c676e912726c8 |
def test_list_true_m(self): <NEW_LINE> <INDENT> self.data_in = [True] <NEW_LINE> self.expected = '_ = [];\n_[0] = true;' <NEW_LINE> self.assertEqual(self.schema.create_schema(self.data_in), self.expected) | Test [True] -m | 625941edbf627c535bc136f0 |
def call_after(self, callback: Callable[..., object], *args: Any, **kwargs: Any): <NEW_LINE> <INDENT> assert self.after_callbacks is not None <NEW_LINE> self.after_callbacks.append((callback, args, kwargs)) | Call the given callback on the main twisted thread after the
transaction has finished. Used to invalidate the caches on the
correct thread. | 625941ed63b5f9789fde7607 |
def register_models(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> engine = db_api.get_engine() <NEW_LINE> model.PowerVCMapping.metadata.create_all(engine) <NEW_LINE> <DEDENT> except sql.exc.OperationalError as e: <NEW_LINE> <INDENT> LOG.info(_("Database registration exception: %s"), e) | Register Models and create properties. | 625941ed71ff763f4b549bb6 |
def pyfp_print_get_data(*args): <NEW_LINE> <INDENT> return _pyfprint_swig.pyfp_print_get_data(*args) | pyfp_print_get_data(struct fp_print_data _print) | 625941ed07d97122c4178db9 |
def stop_robot(self): <NEW_LINE> <INDENT> self.send_command(Commands.STOP) | Send a stop command to the STM32. | 625941edcad5886f8bd274f9 |
def load_images(self): <NEW_LINE> <INDENT> pngs = listdir('pieces') <NEW_LINE> for file_name in pngs: <NEW_LINE> <INDENT> piece_image = tkinter.PhotoImage(file=f'pieces/{file_name}') <NEW_LINE> self.pieces[file_name[:2]] = piece_image | ładowanie zdjęć figur | 625941edb5575c28eb68e526 |
def testGETDebitMemoItemTypewithSuccess(self): <NEW_LINE> <INDENT> pass | Test GETDebitMemoItemTypewithSuccess | 625941ed8a349b6b435e8694 |
def obfuscator(filename, obfuscate=False, blanks=None, remove_comments=False): <NEW_LINE> <INDENT> variables = keyword_dictonary(get_identifieres(filename)) <NEW_LINE> loaded = load_file(filename) <NEW_LINE> return process(loaded, variables, obfuscate=obfuscate, blanks=blanks, rm_comments=remove_comments) | Using of the obfuscation tool
- Obfuscation
- Removing Comments
- Adding or Removing Blank lines ('add', 'remove')
Return: String - Obfuscated string | 625941edbaa26c4b54cb163b |
def test_norm_includes_begins_uncaught(): <NEW_LINE> <INDENT> rec = {"emailAddress": "test@test.com", "field1": "hijklmnop"} <NEW_LINE> rec_out, _ = DWM._norm_include(rec, {}) <NEW_LINE> assert rec_out['field1'] != 'goodvalue' | Ensure norm includes begins uncaught | 625941ed99fddb7c1c9de8af |
def sum_of_squared_errors(observed_freq, predicted_freq): <NEW_LINE> <INDENT> return np.sum((observed_freq - predicted_freq) ** 2) | Calculates the sum of squared errors for observed and predicted frequencies.
Args:
observed_freq (numpy.ndarray): observed frequencies
predicted_freq (numpy.ndarray): predicted frequencies
Returns:
float: sum of squared errors between observed and predicted frequencies | 625941ed8a43f66fc4b54581 |
def describe(group, recurse=False): <NEW_LINE> <INDENT> print(group.name) <NEW_LINE> if group.attrs: <NEW_LINE> <INDENT> print("\n attrs: {") <NEW_LINE> <DEDENT> for key, value in group.attrs.items(): <NEW_LINE> <INDENT> if key in ["comments", "history"]: <NEW_LINE> <INDENT> print(" %s:" % key) <NEW_LINE> for line ... | Describes a HDF5 group object
Parameters
----------
group : [type]
[description]
recurse : bool, optional
[description], by default False | 625941ed99cbb53fe6793106 |
def get_url_friendly(name): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> temp = '-'.join(name.lower().split()) <NEW_LINE> return ''.join(c for c in temp if c.isalnum() or c == '-') | Converts the name to a url friendly string for use in `str_id` | 625941ed15fb5d323cde1039 |
def _updateTicks(self, startDate, endDate, codes): <NEW_LINE> <INDENT> codes = self._getTicksByDays(startDate, endDate, codes) <NEW_LINE> if codes is None: <NEW_LINE> <INDENT> self._eventEngine.put(DyEvent(DyEventType.fail)) <NEW_LINE> return <NEW_LINE> <DEDENT> self._getTicks(codes) | only update ticks in days database but not in DB.
That means you should update days data firslty, and then update ticks data.
Otherwise, nothing will be updated for ticks data. | 625941ed4f6381625f114f5d |
def _compute_gradients_wrt_embedding_table(gradient_wrt_activation, embedding_table, feature_indices, feature_values, combiner): <NEW_LINE> <INDENT> if combiner not in ('mean', 'sum'): <NEW_LINE> <INDENT> raise ValueError('`combiner` must be mean or sum; got {}.'.format(combiner)) <NEW_LINE> <DEDENT> grads_shape = grad... | Compute gradients wrt embedding_table.
Args:
gradient_wrt_activation: `np.array` with shape `batch_size` by
embedding `dimension`.
embedding_table: `np.array` with shape `vocabulary_size` by embedding
`dimension`.
feature_indices: `indices` as used to construct `SparseTensor`.
feature_values: `values` ... | 625941edfb3f5b602dac3bba |
def first_hour_average(timeseries): <NEW_LINE> <INDENT> day = timedelta(days=1) <NEW_LINE> hour = timedelta(hours=1) <NEW_LINE> last_hour_threshold = timeseries[-1][0] - (day - hour) <NEW_LINE> startTime = last_hour_threshold - hour <NEW_LINE> series = pd.Series([x[1] for x in timeseries if x[0] >= startTime and x[0] <... | Calcuate the simple average over one hour, one day ago.
A timeseries is anomalous if the average of the last three datapoints
are outside of three standard deviations of this value. | 625941edbe7bc26dc91cdb17 |
def test_exit_active_on_error(self): <NEW_LINE> <INDENT> self.session.__enter__() <NEW_LINE> session = Mock() <NEW_LINE> session.__enter__ = Mock() <NEW_LINE> self.session.enlist(session) <NEW_LINE> session.status = SESSION_STATUS_ACTIVE <NEW_LINE> session.__exit__ = Mock() <NEW_LINE> session.connection.tpc_rollback.si... | There are active sessions enlisted and error is raised
while working with connection. | 625941edcb5e8a47e48b7fc3 |
def marshal(data, fields, envelope=None): <NEW_LINE> <INDENT> def make(cls, k, data): <NEW_LINE> <INDENT> if isinstance(cls, type): <NEW_LINE> <INDENT> return cls().output(k, data) <NEW_LINE> <DEDENT> return cls.output(k, data) <NEW_LINE> <DEDENT> if isinstance(data, (list, tuple)): <NEW_LINE> <INDENT> return ( Ordered... | Custom marshaller that ignores fields with None values. | 625941ed21a7993f00bc821b |
def __init__(self, default_variants:list=None, max_value=None): <NEW_LINE> <INDENT> if max_value is None: <NEW_LINE> <INDENT> max_value = 100000000000 <NEW_LINE> <DEDENT> self.default_variants = [[str(item) for item in line] for line in default_variants] <NEW_LINE> self.max_value = max_value <NEW_LINE> super().__init__... | поддерживаются только российские номера
:param name:
:param descry:
:param request: то, что будет показано пользователю в качестве просьбы ввода номера телефона
:param default_value: | 625941ed55399d3f05588bd9 |
def test_to_string_precision(self): <NEW_LINE> <INDENT> dt = UTCDateTime(1980, 2, 3, 12, 23, 34, precision=7) <NEW_LINE> self.assertEqual(str(dt), '1980-02-03T12:23:34.0000000Z') <NEW_LINE> dt = UTCDateTime(1980, 2, 3, 12, 23, 34, 500000, precision=7) <NEW_LINE> self.assertEqual(str(dt), '1980-02-03T12:23:34.5000000Z')... | Tests __str__ method while using a precision. | 625941ed3eb6a72ae02eca0d |
def _start_s2c_game(counter='', file_prefix='', remote_dir='', local_dir='', game_type='q3', client_num='', port='', src_port='', client='', pkt_interval='0.05', duration='', extra_params='', check='1', wait=''): <NEW_LINE> <INDENT> if client_num == '': <NEW_LINE> <INDENT> abort('Must specify number of clients with cli... | Start s2c game traffic flow | 625941ed30bbd722463cc2eb |
def update_animalcontrol_from_form(dbo, post, username): <NEW_LINE> <INDENT> l = dbo.locale <NEW_LINE> acid = post.integer("id") <NEW_LINE> if not db.check_recordversion(dbo, "animalcontrol", post.integer("id"), post.integer("recordversion")): <NEW_LINE> <INDENT> raise utils.ASMValidationError(_("This record has been c... | Updates an animal control incident record from the screen
data: The webpy data object containing form parameters | 625941ed0fa83653e46574d9 |
def activate_user(self, activation_key): <NEW_LINE> <INDENT> if SHA1_RE.search(activation_key): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> profile = self.get(activation_key=activation_key) <NEW_LINE> <DEDENT> except self.model.DoesNotExist: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if not profile.activatio... | Validate an activation key and activate the corresponding
``User`` if valid.
If the key is valid and has not expired, return the ``User``
after activating.
If the key is not valid or has expired, return ``False``.
If the key is valid but the ``User`` is already active,
return ``False``
To prevent reactivation of an... | 625941ed50485f2cf553d2bd |
def pendulum(thetaZero = 30, damp = 0, timeSpan = 20, length = 0.45, gravity = 9.8): <NEW_LINE> <INDENT> if (damp < 0 or timeSpan < 0 or length < 0 or gravity < 0): <NEW_LINE> <INDENT> raise ValueError("'damp', 'timeSpan', 'length', and 'gravity' must all be greater than zero.") <NEW_LINE> <DEDENT> thetaZero = np.deg2r... | This function calculates the realistic pendulum differential equation (Eq 1
in the homework document) by splitting it into two simpler differential
equations (as in Eq 3 in the homework doc). The differential equations are
solved, including the Jacobian in the solution, using the odeint solver.
For comparison, the sim... | 625941edbaa26c4b54cb163c |
def __init__(self, first, second): <NEW_LINE> <INDENT> if type(second) is int or type(second) is float: <NEW_LINE> <INDENT> nutrient_json = first["nutrients"] <NEW_LINE> to_del = [] <NEW_LINE> for n in nutrient_json: <NEW_LINE> <INDENT> if n["name"] not in recommended_amounts.keys(): <NEW_LINE> <INDENT> print("I actual... | Python does not support polymorphic constructors like C++ does
The workaround here is to take two arbitrary parameters
A Food object can be constructed with data from the database, or from hardcoded nutrients
>> For data from the database:
first is data, second is grams
>> For hardcoded nutrients (see ideal_day.yam... | 625941ed4e4d5625662d48f2 |
def inverse(self, x=None, n=6): <NEW_LINE> <INDENT> if x is None: <NEW_LINE> <INDENT> x = self.x <NEW_LINE> <DEDENT> if n is None: <NEW_LINE> <INDENT> return iter(self) <NEW_LINE> <DEDENT> if self._eval_term(0) is S.Zero: <NEW_LINE> <INDENT> raise ValueError("Constant coefficient should exist for an inverse of a formal... | Returns the truncated terms of the inverse of the formal power series,
up to specified `n`.
If `f` and `g` are two formal power series of two different functions,
then the coefficient sequence ``ak`` of the composed formal power series `fp`
will be as follows.
.. math::
\sum\limits_{k=0}^{n} (-1)^{k} x_0^{-k-1} B_{n... | 625941ed8c3a8732951588e3 |
def longestPalindrome(self, s): <NEW_LINE> <INDENT> s_all = get_all_str(s) <NEW_LINE> all_len = len(s_all) <NEW_LINE> p = [] <NEW_LINE> for i, t_s in enumerate(s_all): <NEW_LINE> <INDENT> p.append(0) <NEW_LINE> for j in range(i)[::-1]: <NEW_LINE> <INDENT> if ((2 * i - j) < all_len) and (s_all[j] == s_all[2 * i - j]): <... | :type s: str
:rtype: str | 625941edac7a0e7691ed45e4 |
def get_attributes(pobj): <NEW_LINE> <INDENT> if '__dict__' not in dir(pobj): <NEW_LINE> <INDENT> raise TypeError('A Python object with attributes is expected.') <NEW_LINE> <DEDENT> attrs = {k:v for k,v in pobj.__dict__.items() if not k.startswith('_')} <NEW_LINE> return [k for k, v in attrs.items() if type(v) != 'func... | Given any python object returns its data attributes.
Args:
pobj (:obj:`Maker`): A python object.
Returns:
(:obj:`list` of :obj:`str`): list of attribute names.
Raises:
TypeError: Raised if an object type without a __dict__ attribute is given. | 625941ed4f88993c3716c583 |
def eightbitize_nodes_recursively(self, current_node): <NEW_LINE> <INDENT> self.already_visited[current_node.name] = True <NEW_LINE> for input_node_name in current_node.input: <NEW_LINE> <INDENT> input_node_name = node_name_from_input(input_node_name) <NEW_LINE> if input_node_name in self.already_visited: <NEW_LINE> <I... | The entry point for transforming a graph into full eight bit. | 625941ed07f4c71912b119a7 |
def SetEmployer(self, person, business) : <NEW_LINE> <INDENT> self.AddEdge(SocialEdges.EmployedBy(person, business)) | Args:
person -- object of type SocialNodes.Person
business -- object of type SocialNodes.Business | 625941ed956e5f7376d7138d |
def intrinsic_reward(self, sp): <NEW_LINE> <INDENT> i_reward = 0 <NEW_LINE> if 'defined' in self.advice_scheme: <NEW_LINE> <INDENT> reward_transitions = None <NEW_LINE> if 'good' in self.advice_scheme: <NEW_LINE> <INDENT> reward_transitions = {(1, 1): (1, 2), (2, 1): (1, 1), (2, 2): (2, 1)} <NEW_LINE> <DEDENT> elif 'ba... | :param sp: next state
:return: expert advice for the state transition | 625941edeab8aa0e5d26e07c |
def benchmark(app, *args, **kwargs): <NEW_LINE> <INDENT> before = datetime.datetime.now() <NEW_LINE> data = wrapped(*args, **kwargs) <NEW_LINE> after = datetime.datetime.now() <NEW_LINE> app.tcex.log.debug( f'function: "{self.__class__.__name__}", benchmark_time: "{after - before}"' ) <NEW_LINE> return data | Iterate over data, calling the decorated function for each value.
Args:
app (class): The instance of the App class "self". | 625941edd10714528d60020b |
def list_to_html(data, has_header=True, table_format=None): <NEW_LINE> <INDENT> from tabulate import tabulate <NEW_LINE> if has_header: <NEW_LINE> <INDENT> header = data.pop(0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> header = () <NEW_LINE> <DEDENT> table_html = tabulate(data, headers=header, tablefmt='html', numa... | Convenience function to convert tables to html for attaching as message text.
:param data: Table data
:type data: list of lists
:param has_header: Flag whether data contains a header in the first row.
:type has_header: boolean
:param table_format: Dictionary representation of formatting for table elements. Eg. {'table... | 625941ed046cf37aa974d264 |
def Permission(vim, *args, **kwargs): <NEW_LINE> <INDENT> obj = vim.client.factory.create('ns0:Permission') <NEW_LINE> if (len(args) + len(kwargs)) < 4: <NEW_LINE> <INDENT> raise IndexError('Expected at least 5 arguments got: %d' % len(args)) <NEW_LINE> <DEDENT> required = [ 'group', 'principal', 'propagate', 'roleId' ... | This data object type provides assignment of some role access to a principal on
a specific entity. A ManagedEntity is limited to one permission per principal. | 625941ed566aa707497f4a83 |
def sync(self, customer=None): <NEW_LINE> <INDENT> account = self._get_account() <NEW_LINE> parent_customer = self._get_customer() <NEW_LINE> if customer and parent_customer and customer != parent_customer: <NEW_LINE> <INDENT> raise ValueError("Conflicting customer instances provided") <NEW_LINE> <DEDENT> customer = cu... | Flexibly syncs Charges from Stripe.
Can be called like this:
1) Charge.objects.sync(customer) - loads all customer's charges.
2) customer.charges.sync() - also loads all customer's charges.
3) account.charges.sync() - loads all account's charges
Does sanity checks (for example in case of
``customer_b.charges.sync(cust... | 625941ed3cc13d1c6d3c7899 |
def wave_data(data, bits=16, channels=1, rate=DEFAULT_SAMPLE_RATE): <NEW_LINE> <INDENT> bytes_per_sample = (bits + 7) // 8 <NEW_LINE> block_align = bytes_per_sample * channels <NEW_LINE> fmt_chunk = riff_chunk(b"fmt ", uint16pack(1), uint16pack(channels), uint32pack(rate), uint32pack(rate * block_align), uint16pack(blo... | Build a bytestring object with the full wave contents in data. | 625941ed3617ad0b5ed68418 |
def rightSideView(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> result = [] <NEW_LINE> queue = [(root, root.val)] <NEW_LINE> all_levels = self.bfs(root, queue, result) <NEW_LINE> return all_levels | :type root: TreeNode
:rtype: List[int] | 625941ed796e427e537b0aed |
@contextmanager <NEW_LINE> def decrypt_file(encrypted_path): <NEW_LINE> <INDENT> with open(encrypted_path) as f: <NEW_LINE> <INDENT> _, ext = os.path.splitext(encrypted_path) <NEW_LINE> if ext == ".yaml" or ext == ".yml": <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> encrypted_data = yaml.load(f) <NEW_LINE> <DEDENT> exc... | Provide secure temporary decrypted contents of a given file
If file isn't a sops encrypted file, we assume no encryption is used
and return the current path. | 625941ed009cb60464c638cf |
def get_complement(nucleotide): <NEW_LINE> <INDENT> compliment = None <NEW_LINE> if nucleotide == 'A': <NEW_LINE> <INDENT> compliment = 'T' <NEW_LINE> <DEDENT> elif nucleotide == 'T': <NEW_LINE> <INDENT> compliment = 'A' <NEW_LINE> <DEDENT> elif nucleotide == 'C': <NEW_LINE> <INDENT> compliment = 'G' <NEW_LINE> <DEDENT... | (str) -> str
Return the nucleotide's complement
note: complement pairs are [(A,T), (C,G)]
>>> get_complement('A')
'T'
>>> get_complement('G')
'C' | 625941edd53ae8145f87a787 |
@compiles(group_concat, 'mysql') <NEW_LINE> def _group_concat_mysql(element, compiler, **kw): <NEW_LINE> <INDENT> if len(element.clauses) == 2: <NEW_LINE> <INDENT> separator = compiler.process(element.clauses.clauses[1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> separator = u',' <NEW_LINE> <DEDENT> return u'GROUP_C... | Implémentation de la fonction group_concat pour MySQL | 625941ed0fa83653e46574da |
def __init__(self, memmap_filenames, wb_clusters_indices, wb_centroids, nb_points=20, slr_num_thread=1, rng=None): <NEW_LINE> <INDENT> self.memmap_filenames = memmap_filenames <NEW_LINE> self.wb_clusters_indices = wb_clusters_indices <NEW_LINE> self.centroids = wb_centroids <NEW_LINE> self.rng = rng <NEW_LINE> self.nb_... | Parameters
----------
memmap_filenames : tuple
tuple of filenames for the data, offsets and lengths.
wb_clusters_indices : list
List of lists containing the indices of streamlines per cluster.
wb_centroids : list of numpy.ndarray
List contaning the average streamline per cluster as obtained
from qbx.
nb... | 625941ed851cf427c661aa2c |
def OpenToolbarCollection(file): <NEW_LINE> <INDENT> tbfile = Rhino.RhinoApp.ToolbarFiles.Open(file) <NEW_LINE> if tbfile: return tbfile.Name | Opens a toolbar collection file
Parameters:
file = full path to the collection file
Returns:
Rhino-assigned name of the toolbar collection if successful
None if not successful
Example:
import rhinoscriptsyntax as rs
file = "C:\SteveBaer\AppData\Roaming\McNeel\Rhinoceros\5.0\UI\default.rui"
name = Rhino.IsTo... | 625941ed7b25080760e39978 |
def __init__(self, store, editor_class=None, interface=None, search_spec=None, hide_footer=True, title='', selection_mode=None, hide_toolbar=False, double_click_confirm=False, initial_string=''): <NEW_LINE> <INDENT> if selection_mode is None: <NEW_LINE> <INDENT> selection_mode = Gtk.SelectionMode.BROWSE <NEW_LINE> <DED... | Create a new SearchEditor object.
:param store:
:param search_spec:
:param editor_class:
:param interface: The interface which we need to apply to the objects in
kiwi list to get adapter for the editor.
:param search_spec:
:param hide_footer:
:param title:
:param selection_mode:
:param hide_toolbar:
:param double_cli... | 625941ed5fdd1c0f98dc0757 |
def test_people_exists(self): <NEW_LINE> <INDENT> response = self.client.get('/people/') <NEW_LINE> self.assertEqual(200,response.status_code) | Check that people page exists | 625941edfff4ab517eb2f962 |
def divide_data(sample: IData, background: IData) -> IData: <NEW_LINE> <INDENT> logging.debug("divide") <NEW_LINE> def divide_atomic(vn_out, vn_1, vn_2): <NEW_LINE> <INDENT> _eval("%s = %s ./ %s;" % (vn_out, vn_1, vn_2), nargout=0) <NEW_LINE> <DEDENT> ds1 = sample._get_datashape() <NEW_LINE> ds2 = background._get_datas... | Divide a calibration set, e.g. for normalization. | 625941edbd1bec0571d90b51 |
def png_name(fig: alt.Chart) -> str: <NEW_LINE> <INDENT> if fig.title: <NEW_LINE> <INDENT> fname = ( fig.title.strip() .replace(" ", "_") .replace("-", "") .replace(":", "") .lower() + ".png" ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError("In order to save the chart, it must have a title!") <NEW_LINE>... | Takes an altair chart, extracts the title and converts this
to a filename with a .png extension for saving.
Args:
fig (alt.Chart): Altair chart object to convert.
Returns:
str: Formatted filename (png). | 625941edc432627299f0516c |
def save(self): <NEW_LINE> <INDENT> url_kwargs = self.context['request'].parser_context['kwargs'] <NEW_LINE> post = Post.objects.get(id=url_kwargs.get('post_id')) <NEW_LINE> super(VoteSerializer, self).save( author=self.context["request"].user, post=post ) | Dynamically add author and post to saving data of new Vote object. | 625941edab23a570cc2506a9 |
def favorite(self, user_email, message="", name=None, website=None, target_url=None, permalink=None): <NEW_LINE> <INDENT> return Favorite.create(self.client, self.id, user_email, message, name, website, target_url, permalink) | Adds a favorite for the photo | 625941ed460517430c394699 |
def write_image_text(self, img_draw, font, text, img_w, text_width, text_y_pos, right_align=False): <NEW_LINE> <INDENT> y_pos = text_y_pos - self.margin <NEW_LINE> pos = (self.margin, y_pos) <NEW_LINE> if right_align: <NEW_LINE> <INDENT> pos = (img_w - text_width - self.margin, y_pos) <NEW_LINE> <DEDENT> img_draw.text(... | write image text. | 625941ed5f7d997b87174fbf |
def parse(self, nmea_str): <NEW_LINE> <INDENT> self._parse(nmea_str) <NEW_LINE> new_parts = [] <NEW_LINE> new_parts.extend(self.parts[0:5]) <NEW_LINE> new_parts.append(self.parts[5:]) <NEW_LINE> self.parts = new_parts <NEW_LINE> for index, item in enumerate(self.parts[1:]): <NEW_LINE> <INDENT> setattr(self, self.fields... | As the length of the sentence is variable (there can be many or few
waypoints), parse is overridden to do something special with the
different parts | 625941edb7558d58953c542b |
def SetYResolution(self, Resolution): <NEW_LINE> <INDENT> from PyApex.Constantes import APXXXX_ERROR_ARGUMENT_TYPE, APXXXX_ERROR_ARGUMENT_VALUE <NEW_LINE> from PyApex.Constantes import AP2XXX_MINYRES, AP2XXX_MAXYRES <NEW_LINE> from PyApex.Errors import ApexError <NEW_LINE> if not isinstance(Resolution, (float, int)): <... | Set the Y-axis power per division value
Resolution is expressed in the value of 'ScaleYUnit' | 625941edcc0a2c11143dd3b4 |
def _census_memory_requirement(self): <NEW_LINE> <INDENT> magic_number = 2.42 <NEW_LINE> memreq = self.history.nbytes <NEW_LINE> try: <NEW_LINE> <INDENT> memreq += self.surface.triangles.nbytes * 2 <NEW_LINE> memreq += self.surface.vertices.nbytes * 2 <NEW_LINE> memreq += self.surface.vertex_mapping.nbytes * 4 <NEW_LIN... | Guesstimate the memory required for this simulator.
Guesstimate is based on a census of the dominant arrays after the
simulator has been configured.
NOTE: Assumes returned/yeilded data is in some sense "taken care of" in
the world outside the simulator, and so doesn't consider it, making
the simulator's hist... | 625941ed507cdc57c6307209 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.