code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _convert_to_indexer(self, obj, axis=0, is_setter=False): <NEW_LINE> <INDENT> labels = self.obj._get_axis(axis) <NEW_LINE> obj = self._convert_scalar_indexer(obj, axis) <NEW_LINE> is_int_index = labels.is_integer() <NEW_LINE> is_int_positional = com.is_integer(obj) and not is_int_index <NEW_LINE> try: <NEW_LINE> <IN...
Convert indexing key into something we can use to do actual fancy indexing on an ndarray Examples ix[:5] -> slice(0, 5) ix[[1,2,3]] -> [1,2,3] ix[['foo', 'bar', 'baz']] -> [i, j, k] (indices of foo, bar, baz) Going by Zen of Python? "In the face of ambiguity, refuse the temptation to guess." raise AmbiguousIndexError...
625941ddd486a94d0b98e46a
def EndInvoke(self,result): <NEW_LINE> <INDENT> pass
EndInvoke(self: AsyncCallback,result: IAsyncResult)
625941dd507cdc57c6307004
def get_resource(self): <NEW_LINE> <INDENT> if self.resource is None: <NEW_LINE> <INDENT> self.resource = self.client.get_resource(self.href) <NEW_LINE> <DEDENT> return self.resource
Fetches the XML representation of the provider vdc from vCD. Will serve cached response if possible. :return: object containing EntityType.PROVIDER_VDC XML data representing the concerned provider vdc. :rtype: lxml.objectify.ObjectifiedElement
625941dd26068e7796caf006
def read_csv_and_prep(): <NEW_LINE> <INDENT> all_col_names = ['id', 'diagnosis'] + FEATURES <NEW_LINE> data = pd.read_csv('data/wdbc.data', header=None, names=all_col_names) <NEW_LINE> data['diagnosis'].replace('B', 0, inplace=True) <NEW_LINE> data['diagnosis'].replace('M', 1, inplace=True) <NEW_LINE> data_file = data....
Reads the .csv file and preps it for further processing :return data_formatted: This is the data_without_class stacked with the intercept_template :return data_without_class: The data file without the classification :return data_class_only: The classification in a vector :return data_file: The data including the class...
625941dd97e22403b379d2be
def get_group(self, name): <NEW_LINE> <INDENT> connection = sqlite3.connect(self.directory + self.database_name) <NEW_LINE> cursor = connection.cursor() <NEW_LINE> cursor.execute("SELECT * FROM groups WHERE name = ?", [name]) <NEW_LINE> group = cursor.fetchone() <NEW_LINE> connection.close() <NEW_LINE> return group
Method that returns a tuple containing an specific group, given its name. Parameter: id_person (int) : the group name. Returns : a tuple containing the group.
625941ddb57a9660fec33bab
def construct_extension(ext): <NEW_LINE> <INDENT> if not isinstance(ext, rfc2459.Extension): <NEW_LINE> <INDENT> raise errors.X509Error("extension has incorrect type") <NEW_LINE> <DEDENT> ext_class = EXTENSION_CLASSES.get(ext['extnID'], X509Extension) <NEW_LINE> return ext_class(ext)
Construct an extension object of the right type. While X509Extension can provide basic access to the extension elements, it cannot parse details of extensions. This function detects which type should be used based on the extension id. If the type is unknown, generic X509Extension is used instead.
625941dd50812a4eaa59c642
def changed_files(oldrev, newrev): <NEW_LINE> <INDENT> output = commands.getoutput('git diff --name-only %s %s' % (oldrev, newrev)) <NEW_LINE> return output.splitlines()
Get the files changed from newrev to oldrev.
625941dde64d504609d74b63
def test_code_cb_ee(gb): <NEW_LINE> <INDENT> gb.cpu.register.set_hl(0x8010) <NEW_LINE> gb.memory.write_8bit(0x8010, 0b00000000) <NEW_LINE> cycle = op.code_cb_ee(gb) <NEW_LINE> assert cycle == 16 <NEW_LINE> assert_registers(gb, H=0x80, L=0x10) <NEW_LINE> assert_memory(gb, {0x8010: 0b00100000}) <NEW_LINE> gb.memory.write...
SET 5,(HL) - Set the specified bit
625941ddd58c6744b4257f81
def add_transaction(self, transaction): <NEW_LINE> <INDENT> self.transactions.append(transaction) <NEW_LINE> self.sum += transaction.amount <NEW_LINE> if transaction.amount >= 0: <NEW_LINE> <INDENT> self.sum_in += transaction.amount <NEW_LINE> self.trans_in.append(transaction) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE...
Add a new transaction to the report.
625941dd6fece00bbac2da65
def empty_raw_dataset(self): <NEW_LINE> <INDENT> self.raw_dataset = None
Remove raw dataset once it's transformed, no need to waste memory :return: None
625941dd57b8e32f524837c0
def copy(self): <NEW_LINE> <INDENT> new_configobj = ConfigObj(self.config.copy(), configspec=self.config.configspec, default_encoding='utf-8') <NEW_LINE> for section in self.config: <NEW_LINE> <INDENT> new_configobj[section] = self.config[section].copy() <NEW_LINE> <DEDENT> return TriblerConfig(new_configobj)
Return a TriblerConfig object that has the same values.
625941dd8e05c05ec3eea69a
def forward(self, z_i, z_j): <NEW_LINE> <INDENT> local_rank = comm.get_rank() <NEW_LINE> if comm.get_world_size() > 1: <NEW_LINE> <INDENT> group = comm._get_global_gloo_group() <NEW_LINE> zi_large = [torch.zeros_like(z_i) for _ in range(comm.get_world_size())] <NEW_LINE> zj_large = [torch.zeros_like(z_j) for _ in range...
We do not sample negative examples explicitly. Instead, given a positive pair, similar to (Chen et al., 2017), we treat the other 2(N − 1) augmented examples within a minibatch as negative examples.
625941dda8ecb033257d33ef
def createBrain(): <NEW_LINE> <INDENT> return brain.FeedForwardBrain(sz)
Create a random network of the given size
625941ddd58c6744b4257f82
def save_type(dct): <NEW_LINE> <INDENT> value = dct.get('type') <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> return tuple(value) <NEW_LINE> <DEDENT> return value
save type
625941dd92d797404e3044ae
def blur_image(image, radius=(1.0, 1.1)): <NEW_LINE> <INDENT> return np.array(Image.fromarray(np.array(image)) .filter(ImageFilter.GaussianBlur(radius=uniform(*radius))))
Blur given image using 'Gaussian Blur' :param radius: radius parameter for 'Gaussian Blur' :param image: image to be blurred :return: blurred
625941dd01c39578d7e7515f
def get_simplices_by_step(self, step): <NEW_LINE> <INDENT> simplices = self._get_core(step) <NEW_LINE> unique_faces, counted_faces = self.count_faces(simplices) <NEW_LINE> return unique_faces[counted_faces == 1]
Given a step returns the faces that make the surface at that step Parameters ---------- step : int Step of Perseus's simtop method Returns ------- numpy array Faces that make the surface
625941dd4f6381625f114d5f
def create_user(self, **attrs): <NEW_LINE> <INDENT> return self._create(_user.User, **attrs)
Create a new user from attributes :param dict attrs: Keyword arguments which will be used to create a :class:`~openstack.identity.v3.user.User`, comprised of the properties on the User class. :returns: The results of user creation :rtype: :class:`~openstack.identity.v3.user.User`
625941dd8a349b6b435e8496
def send(self, data): <NEW_LINE> <INDENT> bytes_sent = 0 <NEW_LINE> while bytes_sent < len(data): <NEW_LINE> <INDENT> bytes_sent_this_round = self._connection.send(data[bytes_sent:]) <NEW_LINE> if bytes_sent_this_round is not None: <NEW_LINE> <INDENT> bytes_sent += bytes_sent_this_round <NEW_LINE> <DEDENT> <DEDENT> ret...
Send data to the target. Only valid after calling open! :param data: Data to send. :rtype int :return: Number of bytes actually sent.
625941dd046cf37aa974d069
def Transformed(mat): <NEW_LINE> <INDENT> return Op(Transform, mat)
Perform a transformation.
625941ddec188e330fd5aabd
def _extract_value_index(line, start=0): <NEW_LINE> <INDENT> shortline = line.rstrip() <NEW_LINE> return len(shortline)
Returns position of last non-whitespace character
625941dd92d797404e3044af
def _split_privs(privspec): <NEW_LINE> <INDENT> (usr, prvgrant) = privspec.split('=') <NEW_LINE> if usr == '': <NEW_LINE> <INDENT> usr = 'PUBLIC' <NEW_LINE> <DEDENT> (privcodes, grantor) = prvgrant.split('/') <NEW_LINE> return (usr, privcodes, grantor)
Split the aclitem into three parts :param privspec: privilege specification (aclitem) :return: tuple with grantee, privilege codes and granto
625941dd566aa707497f4888
def _balance(self): <NEW_LINE> <INDENT> while len(self.front) < len(self.back): <NEW_LINE> <INDENT> self.front.append(self.back.popleft()) <NEW_LINE> <DEDENT> while len(self.front) > len(self.back) + 1: <NEW_LINE> <INDENT> self.back.appendleft(self.front.pop())
Keep len(self.front) >= len(self.back)
625941dd1b99ca400220add6
def get_nowait(self): <NEW_LINE> <INDENT> if self.empty(): <NEW_LINE> <INDENT> raise QueueWouldBlock("Queue is empty!") <NEW_LINE> <DEDENT> return self._pop()
Try to get from the queue immediately, raises `QueueWouldBlock` on failure
625941dd63d6d428bbe44813
def _release_teleop(self, rocon_uri): <NEW_LINE> <INDENT> request = concert_service_msgs.CaptureTeleopRequest() <NEW_LINE> request.rocon_uri = rocon_uri <NEW_LINE> request.release = True <NEW_LINE> self.captured_teleop_rocon_uri = rocon_uri <NEW_LINE> msg_id = self.capture_teleop(request, timeout=rospy.Duration(15.0), ...
caputre the robot with rocon uri @param rocon_uri: robot information as uri type @type rocon_uri class
625941ddbaa26c4b54cb1440
def cv(data: dict, real: dict, reducer: AbstractReducer = EuclideanReducer()) -> dict: <NEW_LINE> <INDENT> res = { 'data': {}, 'labels': list(data['labels']), 'slots': list(data['slots']) } <NEW_LINE> for k in data['data']: <NEW_LINE> <INDENT> X, y = data['data'][k], real['data'][k].T <NEW_LINE> row, _ = y.shape <NEW_L...
Calculate cross validation error between produced ``data`` and the real one :param data: newly produced data :param real: actual data :param reducer: how to calculate error
625941dd6fb2d068a760f3c5
def insert_at(self, node, i): <NEW_LINE> <INDENT> if i < 0 or i >= self.count: <NEW_LINE> <INDENT> raise Exception("The index you provided as an argument is out of bounds.") <NEW_LINE> <DEDENT> j = 0 <NEW_LINE> current = self.head <NEW_LINE> while j < i - 1: <NEW_LINE> <INDENT> current = current.next_node <NEW_LINE> j ...
We can speed up this function by determining whether the index is closer to the end or to the begining but since this is not a doubly-linked list we should pretty much be satisfied with the current implementation
625941ddaad79263cf390d69
def test_default_options(self): <NEW_LINE> <INDENT> self.set_postmark_response(b"") <NEW_LINE> self.assert_response("/max_retries/", b"0")
Check if default values were used to initialize postmark client.
625941dd10dbd63aa1bd2ec6
def setUp(self): <NEW_LINE> <INDENT> n_f = 6 <NEW_LINE> self.n_f = n_f <NEW_LINE> self.freq = 10. + np.arange(n_f) <NEW_LINE> Beam = pol_beam.SimpleBeam(self.freq) <NEW_LINE> self.width = 0.9 + (np.arange(n_f) / 5. / n_f) <NEW_LINE> self.sigma = self.width / (2 * np.sqrt(2 * np.log(2))) <NEW_LINE> Beam.set_width(self.w...
Set up constructs a beam of known parameters.
625941ddd164cc6175783072
def play (self): <NEW_LINE> <INDENT> if self.play_var.get (): <NEW_LINE> <INDENT> if self.step_after is None and self.synced: <NEW_LINE> <INDENT> self.step () <NEW_LINE> <DEDENT> self.step_button.configure (state = DISABLED) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if self.step_after is not None: <NEW_LINE> <INDEN...
Activate auto-steping.
625941dd2eb69b55b151cbd7
def __init__(self, width, height): <NEW_LINE> <INDENT> self.id = c_uint(_uid()) <NEW_LINE> try: glGenFramebuffersEXT(1, byref(self.id)) <NEW_LINE> except: <NEW_LINE> <INDENT> raise Exception("offscreen buffer not supported.") <NEW_LINE> <DEDENT> self.texture = None <NEW_LINE> self._viewport = (None, None, None, None)...
"FBO" is an OpenGL extension to do "Render to Texture", drawing in an offscreen buffer. It is useful as a place to chain multiple shaders, since each shader has its own program and we can only install one program at a time.
625941dd23e79379d52ee884
def init_system(): <NEW_LINE> <INDENT> switch_case: Dict[str, bool] = { "systemd": os.path.exists("/run/systemd/system"), "upstart": os.path.exists("/usr/share/upstart"), "sysvinit": os.path.exists("/etc/init.d") } <NEW_LINE> for init_name, check in switch_case.items(): <NEW_LINE> <INDENT> if check: <NEW_LINE> <INDENT>...
Checks for the init system of a linux system :return: init system
625941dd32920d7e50b284f6
def test_get_current_artifacts(self): <NEW_LINE> <INDENT> project = ProjectFactory.create() <NEW_LINE> job = JobFactory.create() <NEW_LINE> dependency = DependencyFactory.create(job=job) <NEW_LINE> ProjectDependency.objects.create( project=project, dependency=dependency) <NEW_LINE> build1 = BuildFactory.create(job=job)...
Project.get_current_artifacts returns the current set of artifacts for this project.
625941dda934411ee37519b8
def _deal_with_update(template: str) -> str: <NEW_LINE> <INDENT> up_template = template.upper() <NEW_LINE> index_update = up_template.find("UPDATE") <NEW_LINE> index_where = up_template.find("WHERE") <NEW_LINE> if index_update != -1 and index_where != -1: <NEW_LINE> <INDENT> index_where -= 1 <NEW_LINE> while index_wher...
For the patch of UPDATE statement, avoid redundant commas in update set :param template: Template :return: Results after treatment
625941dd99cbb53fe6792f0a
def read_in_txt_file(filename): <NEW_LINE> <INDENT> if not filename.endswith(".txt"): <NEW_LINE> <INDENT> raise Exception("Invalid file format.") <NEW_LINE> <DEDENT> with open(filename, 'r') as file: <NEW_LINE> <INDENT> return file.read()
Read in file and return file content as string.
625941dd4f88993c3716c389
def task_in_list_until_done(task: Union[asyncio.Task, asyncio.Future], list_of_tasks: list): <NEW_LINE> <INDENT> def remove_task(*args): <NEW_LINE> <INDENT> with contextlib.suppress(ValueError): <NEW_LINE> <INDENT> list_of_tasks.remove(task) <NEW_LINE> <DEDENT> <DEDENT> list_of_tasks.append(task) <NEW_LINE> task.add_do...
Add a task to a list and a callback which removes it from the list once it's done
625941dd44b2445a339323b8
def update_batch_momentum(self, x, f, y, yr, class_mem, ns_new, pre_loss): <NEW_LINE> <INDENT> if self.net.log: <NEW_LINE> <INDENT> print() <NEW_LINE> print("* Updating Prototype *") <NEW_LINE> <DEDENT> unique_labels = torch.unique(y).squeeze() <NEW_LINE> for label_idx in range(unique_labels.size(0)): <NEW_LINE> <INDEN...
Take momentum of current batch avg with prev prototype (based on prev batches).
625941dd30dc7b7665901c87
def rgb2hex(line): <NEW_LINE> <INDENT> s = line.split("rgb(") <NEW_LINE> rgb = s[-1].replace(");", "").split(",") <NEW_LINE> r = hex(int(rgb[0]))[2:] <NEW_LINE> g = hex(int(rgb[1]))[2:] <NEW_LINE> b = hex(int(rgb[2]))[2:] <NEW_LINE> return "{}{}{}".format(fmt(r), fmt(g), fmt(b))
convert rgb values to a 6-digit hex string
625941dd1f037a2d8b946521
def __init__(self): <NEW_LINE> <INDENT> super(Player, self).__init__() <NEW_LINE> self.image = pygame.Surface([20, 20]) <NEW_LINE> self.image.fill(RED) <NEW_LINE> self.rect = self.image.get_rect()
Set up the player on creation.
625941dd3346ee7daa2b3092
def install_all_dependency(self): <NEW_LINE> <INDENT> log.info("install rely") <NEW_LINE> def install(server: Server): <NEW_LINE> <INDENT> return server.install_dependency() <NEW_LINE> <DEDENT> return self.executor(install, self.server_list)
Installation dependence
625941dddc8b845886cb585a
def on_atom_clicked2(self, index): <NEW_LINE> <INDENT> ( self.transitionsin_parsed, self.transitionsin_count, ) = self.get_transition_table( self.last_line_in, self.ions_in[index][0], self.ions_in[index][1] ) <NEW_LINE> ( self.transitionsout_parsed, self.transitionsout_count, ) = self.get_transition_table( self.last_li...
Create and show transition table for the clicked item in the dialog created by the spectrum widget.
625941dd21a7993f00bc8019
def testHash(self): <NEW_LINE> <INDENT> status = self._GetSampleStatus() <NEW_LINE> self.assertEqual(hash(status), hash(status.id))
Test the twitter.Status __hash__ method
625941ddcdde0d52a9e53359
def on_train_epoch_start(self, training_network: nn.HybridBlock) -> None: <NEW_LINE> <INDENT> pass
Hook that is called prior to each training epoch. Parameters ---------- training_network The network that is being trained.
625941dd56ac1b37e62644ee
def query(self, view_kwargs): <NEW_LINE> <INDENT> query_ = self.session.query(Faq) <NEW_LINE> query_ = event_query(self, query_, view_kwargs) <NEW_LINE> if view_kwargs.get('faq_type_id') is not None: <NEW_LINE> <INDENT> faq_type = safe_query(self, FaqType, 'id', view_kwargs['faq_type_id'], 'faq_type_id') <NEW_LINE> que...
query method for different view_kwargs :param view_kwargs: :return:
625941dd5e10d32532c5f24a
def _make_request(self, conn, method, url, timeout=_Default, **httplib_request_kw): <NEW_LINE> <INDENT> self.num_requests += 1 <NEW_LINE> if timeout is _Default: <NEW_LINE> <INDENT> timeout = self.timeout <NEW_LINE> <DEDENT> conn.timeout = timeout <NEW_LINE> conn.request(method, url, **httplib_request_kw) <NEW_LINE> co...
Perform a request on a given httplib connection object taken from our pool.
625941ddad47b63b2c50a2a2
def openImage(fileName): <NEW_LINE> <INDENT> return cv2.imread(INPUT_DIRECTORY + fileName + IMAGE_FILE_EXTENSION, 0)
Opens the image in the input directory with the filename given.
625941dde1aae11d1e749fde
def do(self, blob, ignore_missing=True, exception_handlers=None): <NEW_LINE> <INDENT> res = super(Underdo, self).do(blob, ignore_missing, exception_handlers) <NEW_LINE> order = [ 'leader', 'control_number', 'fixed_length_data_elements', 'international_standard_book_number', 'other_standard_identifier', 'system_control_...
Translate blob values and instantiate new model instance.
625941dd377c676e912724cc
def split_apply(self, func): <NEW_LINE> <INDENT> return
------------------------------------------------------- Splits list into two parts. target1 contains all the values where the result of calling func(value) is True, target2 contains the remaining values. At finish, self is empty. Order of values in targets is maintained. Use: target1, target2 = source.split_apply(fun...
625941dd15baa723493c429c
def fetch_seqid_by_accession(self, dbid, name): <NEW_LINE> <INDENT> sql = "select bioentry_id from bioentry where accession = %s" <NEW_LINE> fields = [name] <NEW_LINE> if dbid: <NEW_LINE> <INDENT> sql += " and biodatabase_id = %s" <NEW_LINE> fields.append(dbid) <NEW_LINE> <DEDENT> self.execute(sql, fields) <NEW_LINE> r...
Return the internal id for a sequence using its accession. Arguments: - dbid - the internal id for the sub-database - name - the accession of the sequence. Corresponds to the accession column of the bioentry table of the SQL schema
625941ddc432627299f04f6c
def set_setting(key, value): <NEW_LINE> <INDENT> settings = _get_settings() <NEW_LINE> settings.setValue(key, value)
Set a value in the persistent cache. :param key: Hash key :param value: Value to store
625941dd57b8e32f524837c1
def sample_interpolate(x, coords): <NEW_LINE> <INDENT> indices_left = tf.cast(tf.floor(coords), tf.int32) <NEW_LINE> indices_right = tf.cast(tf.ceil(coords), tf.int32) <NEW_LINE> interpolation = coords - tf.cast(indices_left, tf.float32) <NEW_LINE> vals_left = tf.gather_nd(x, batch_indices(indices_left)) <NEW_LINE> val...
Samples input tensor x by coords with interpolation :param x: input tensor of shape [batch_size, sequence_len] :param coords: batch coordinates of shape [batch_size, sequence_len] :return:
625941dd711fe17d82542689
def _test_reconciliation_customer_and_supplier_flows( self, amount, amount_currency, counterpart_amount, journal_currency, foreign_currency, counterpart_currency, expected_liquidity_values, expected_counterpart_values): <NEW_LINE> <INDENT> self._test_statement_line_reconciliation( self.bank_journal_2, amount, amount_cu...
Test '_test_statement_line_reconciliation' using the customer (positive amounts) & the supplier flow (negative amounts). :param amount: The amount in journal's currency. :param amount_currency: The amount in the foreign currency. :param counterpart_amount: The amount of the inv...
625941dd4428ac0f6e5bab18
def __init__(self, character_id=0): <NEW_LINE> <INDENT> self._hero_no = 0 <NEW_LINE> self._level = 1 <NEW_LINE> self._exp = 0 <NEW_LINE> self._break_level = 0 <NEW_LINE> self._refine = 0 <NEW_LINE> self._character_id = character_id <NEW_LINE> self._is_guard = False <NEW_LINE> self._is_online = False <NEW_LINE> self._aw...
:field _level: 等级 :field _break_level: 突破等级 :field _exp: 当前等级的经验 :field _refine: 炼体 :field _is_guard: 是否驻守,秘境相关
625941dde8904600ed9f2255
def __editorTabnanny(self): <NEW_LINE> <INDENT> editor = e5App().getObject("ViewManager").activeWindow() <NEW_LINE> if editor is not None: <NEW_LINE> <INDENT> if editor.checkDirty() and editor.getFileName() is not None: <NEW_LINE> <INDENT> from CheckerPlugins.Tabnanny.TabnannyDialog import TabnannyDi...
Private slot to handle the tabnanny context menu action of the editors.
625941ddd53ae8145f87a58f
def close(self): <NEW_LINE> <INDENT> self._workbook.release_resources()
Calls :meth:`~xlrd.book.Book.release_resources`.
625941dd009cb60464c636d4
def _message_receive_bounce(self, email, partner): <NEW_LINE> <INDENT> pass
Called by ``message_process`` when a bounce email (such as Undelivered Mail Returned to Sender) is received for an existing thread. The default behavior is to do nothing. This method is meant to be overridden in various modules to add some specific behavior like blacklist management or mass mailing statistics update. c...
625941dd4f6381625f114d60
def countBits(self, num): <NEW_LINE> <INDENT> if num == 0: <NEW_LINE> <INDENT> return [0] <NEW_LINE> <DEDENT> count = [0] * (num + 1) <NEW_LINE> exp = 0 <NEW_LINE> for i in range(1, num+1): <NEW_LINE> <INDENT> if i == 2 ** exp: <NEW_LINE> <INDENT> count[i] = 1 <NEW_LINE> exp += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <I...
:type num: int :rtype: List[int]
625941dd56b00c62f0f1497f
def __init__(self): <NEW_LINE> <INDENT> global RESULT_FILE <NEW_LINE> RESULT_FILE = create_result_file(result_file_name='zoominfo.csv') <NEW_LINE> ''' 2. Make a multiple-processing pool ''' <NEW_LINE> cpu_cnt = cpu_count() <NEW_LINE> self.pool = mp.Pool(100, maxtasksperchild=150)
1. Create a Result file
625941dd63b5f9789fde740a
def __init__(self, type=None, host=None, port=None, name=None, user=None, password=None): <NEW_LINE> <INDENT> self._type = None <NEW_LINE> self._host = None <NEW_LINE> self._port = None <NEW_LINE> self._name = None <NEW_LINE> self._user = None <NEW_LINE> self._password = None <NEW_LINE> self.discriminator = None <NEW_L...
ExternalDatabase - a model defined in Swagger
625941ddac7a0e7691ed43eb
def test_generate_1arg(self): <NEW_LINE> <INDENT> RSATest.test_generate_1arg(self)
RSA (_fastmath implementation) generated key (1 argument)
625941dddc8b845886cb585b
def glInitRescaleNormalEXT(): <NEW_LINE> <INDENT> from OpenGL import extensions <NEW_LINE> return extensions.hasGLExtension( _EXTENSION_NAME )
Return boolean indicating whether this extension is available
625941dd8c0ade5d55d3ece2
def dataset_to_train_using_dates(dataset, trainDates, testDates, predicting = 'close', binary = False, shiftFeatures = False, shiftTarget = False): <NEW_LINE> <INDENT> if shiftFeatures==True and shiftTarget==True: <NEW_LINE> <INDENT> raise ValueError("Features and Target cannot be shifted at the same time") <NEW_LINE> ...
Parameter --------------------- - dataset: dataframe containing all available columns for a set of dates - trainDates: list containing the start training day and end training day - testDates: list containing the start training day and end testing day - namesToRemove: partial names to search to remove those columns - co...
625941dd8e71fb1e9831dacc
def login_by_code(self, code: str): <NEW_LINE> <INDENT> pass
通过微信登录code进行登录 :param code: :return:
625941dd23849d37ff7b33b1
def _change_fleet_direction(self): <NEW_LINE> <INDENT> for alien in self.aliens.sprites(): <NEW_LINE> <INDENT> alien.rect.y += self.settings.fleet_drop_speed <NEW_LINE> <DEDENT> self.settings.fleet_direction *= -1
Опускает весь флот и меняет направление флота.
625941dd94891a1f4081bdcf
def run(self, func, *args, **kw): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> result = func(*args, **kw) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> self.failed() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.completed(result)
Invoke a function, the return value will be the result of the task. completed() is called on success, or failed() if an exception is raised.
625941dd23849d37ff7b33b2
def fetchall_to_dict(cursor): <NEW_LINE> <INDENT> columns = [col[0] for col in cursor.description] <NEW_LINE> return [ dict(zip(columns, row)) for row in cursor.fetchall() ][:10]
Return all rows from a cursor as a dict
625941dd26068e7796caf007
def server_loop(self): <NEW_LINE> <INDENT> self.comm = MPI.COMM_WORLD <NEW_LINE> self.rank = self.comm.Get_rank() <NEW_LINE> self.nodes = self.comm.Get_size() - 1 <NEW_LINE> self.ctx = neptune.Context() <NEW_LINE> self.params = self.ctx.params <NEW_LINE> self.job_queue = deque() <NEW_LINE> self.working = True <NEW_LINE...
Server loop.
625941dd6fece00bbac2da66
def __init__(self, additional_id=None, gid=None, group_sid=None, ifs_restricted=None, local_address=None, on_disk_group_id=None, on_disk_user_id=None, privilege=None, protocol=None, remote_address=None, uid=None, user_sid=None, zid=None, zone_id=None): <NEW_LINE> <INDENT> self._additional_id = None <NEW_LINE> self._gid...
AuthIdNtoken - a model defined in Swagger
625941ddf7d966606f6aa32c
@bottle.route('/validate_registration/:registration_code') <NEW_LINE> def validate_registration(registration_code): <NEW_LINE> <INDENT> authenticator.validate_registration(registration_code) <NEW_LINE> return 'Thanks. <a href="/login">Go to login</a>'
Validate registration, create user account
625941ddf7d966606f6aa32d
def test_multi_dim_weighted_train_create_loss(self): <NEW_LINE> <INDENT> head = head_lib.MultiLabelHead(n_classes=3, weight_column='weights') <NEW_LINE> logits = np.array([[[-10., 10., -10.], [10., -10., 10.]], [[-12., 12., -12.], [12., -12., 12.]]], dtype=np.float32) <NEW_LINE> labels = np.array([[[1, 0, 0], [1, 0, 0]...
Logits and labels of shape [2, 2, 3], weights [2, 2].
625941dd3cc13d1c6d3c769e
def find_pyrasterframes_jar_dir() -> str: <NEW_LINE> <INDENT> jar_dir = None <NEW_LINE> from importlib.util import find_spec <NEW_LINE> try: <NEW_LINE> <INDENT> module_home = find_spec("pyrasterframes").origin <NEW_LINE> jar_dir = os.path.join(os.path.dirname(module_home), 'jars') <NEW_LINE> <DEDENT> except ImportError...
Locates the directory where JVM libraries for Spark are stored. :return: path to jar director as a string
625941dd82261d6c526ab7c8
def is_alert_not_present(self, timeout=None): <NEW_LINE> <INDENT> is_alert_not_present = True <NEW_LINE> timeout = self.default_timeout if timeout is None else timeout <NEW_LINE> try: <NEW_LINE> <INDENT> WebDriverWait(self.context.driver, timeout).until(EC.alert_is_present()) <NEW_LINE> alert = self.context.driver.swit...
Verify if alert does not present :param timeout: wait time before throwing any exception. If None, timeout is set to default timeout. :return: True if alert does not present else False.
625941ddfb3f5b602dac39bb
def remove_managed_store(self, store_id): <NEW_LINE> <INDENT> if store_id in self.managed_stores: <NEW_LINE> <INDENT> self.managed_stores.remove(store_id) <NEW_LINE> return True, 'Store id: ' + str(store_id) + ' is not managed by ' + self.username + ' anymore.' <NEW_LINE> <DEDENT> return False, 'Store id: ' + str(store...
:param store_id: :return: if store_id is in managed_stores, remove and return True. Otherwise, return False
625941dd462c4b4f79d1d9f5
def eval_model(model: torch.nn.Module, loader: torch.utils.data.dataloader.DataLoader, epoch: int, writer: Optional[torch.utils.tensorboard.writer.SummaryWriter] = None, device: torch.device = torch.device("cuda"), dataset_type: str = 'eval', verbose: bool = True) -> float: <NEW_LINE> <INDENT> model.eval() <NEW_LINE> t...
Validation loop (no backprop) Evaluate model on validation data based on dice coefficient score
625941ddd10714528d60000b
def test_displacy_render_wrapper(en_vocab): <NEW_LINE> <INDENT> def wrapper(html): <NEW_LINE> <INDENT> return "TEST" + html + "TEST" <NEW_LINE> <DEDENT> displacy.set_render_wrapper(wrapper) <NEW_LINE> doc = Doc(en_vocab, words=["But", "Google", "is", "starting", "from", "behind"]) <NEW_LINE> doc.ents = [Span(doc, 1, 2,...
Test that displaCy accepts custom rendering wrapper.
625941dd16aa5153ce36279d
def create_query(self): <NEW_LINE> <INDENT> return _DBSession.query(*self.queried_column_mapping_attrs)
Called in the _build_query_base() template method.
625941ddbe8e80087fb20f63
def push(sensor_id, trigger_id, source_ids, data): <NEW_LINE> <INDENT> if clique.context(PUSH_KEY): <NEW_LINE> <INDENT> clique.context(PUSH_KEY)({__SENSOR_ID__: sensor_id, __TRIGGER_ID__: trigger_id, __SOURCE_IDS__: source_ids, __DATA__: data})
Push the sensor data to the ambiency with the key and value pre-defined by the sensor data type. :param string sensor_id: Sensor ID :param string trigger_id: Trigger ID :param list source_ids: Source IDs, Suppose that you used chilren in a source, enumerate it from a parent source ID to a child source ID in a list :p...
625941ddcc40096d61595c74
def t390002_x8(): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> call = t390002_x6() <NEW_LINE> assert IsClientPlayer() == 1 <NEW_LINE> call = t390002_x7() <NEW_LINE> assert not IsClientPlayer() <NEW_LINE> <DEDENT> """Unused""" <NEW_LINE> return 0
State 0
625941dd71ff763f4b5499b6
def getCustomer(self): <NEW_LINE> <INDENT> return self._Customer
Customer owning this end device.
625941dd23e79379d52ee885
def final_strategy(score, opponent_score): <NEW_LINE> <INDENT> if (score + opponent_score) % 7 == 0: <NEW_LINE> <INDENT> if 100 - score < 10: <NEW_LINE> <INDENT> return make_roll_until_plan(100 - score) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return make_roll_until_plan(10) <NEW_LINE> <DEDENT> <DEDENT> elif 100 -...
Write a brief description of your final strategy. *** YOUR DESCRIPTION HERE ***
625941ddd99f1b3c44c678af
def send_recent_messages(count=100): <NEW_LINE> <INDENT> recent_message_ids = redis_db.zrange('messages:global', 0, count, desc=True) <NEW_LINE> message_list = [] <NEW_LINE> for message_id in reversed(recent_message_ids): <NEW_LINE> <INDENT> bytes_message = redis_db.hgetall(b'message:' + message_id) <NEW_LINE> message ...
Used on a new connection to send the 'count' most recent chat messages to the connected user.
625941ddd18da76e235327fe
def initialize_board(self): <NEW_LINE> <INDENT> if self.n < 2: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> coord1 = int(self.n / 2 - 1) <NEW_LINE> coord2 = int(self.n / 2) <NEW_LINE> initial_squares = [(coord1, coord2), (coord1, coord1), (coord2, coord1), (coord2, coord2)] <NEW_LINE> for i in range(len(initial_squar...
Method: initialize_board Parameters: self Returns: nothing Does: Draws the first 4 tiles in the middle of the board (the size of the board must be at least 2x2).
625941dd99cbb53fe6792f0b
def get_amp_hist(shotlist, detector_sn, p, th, n_bins=200): <NEW_LINE> <INDENT> client = sshfn.Client() <NEW_LINE> for shot in shotlist: <NEW_LINE> <INDENT> client.add_job(get_amps, shot, detector_sn, p, th) <NEW_LINE> <DEDENT> amps_list = client.run_jobs() <NEW_LINE> amps = np.concatenate(amps_list) <NEW_LINE> hist, e...
Get an amplitude histogram for the given detector. Arguments: shotlist -- List of shots to pull data from. detector_sn -- Detector's serial number. p -- The characteristic pulse shape. th -- The amplitude threshold. n_bins -- Number of bins to use. Return: A histogram of the amplitudes foun...
625941ddfbf16365ca6f64ee
def roll_dice(num_rolls, dice=six_sided): <NEW_LINE> <INDENT> assert type(num_rolls) == int, 'num_rolls must be an integer.' <NEW_LINE> assert num_rolls > 0, 'Must roll at least once.' <NEW_LINE> sum_of_outcomes = 0 <NEW_LINE> pig_out = 0 <NEW_LINE> while (num_rolls != 0): <NEW_LINE> <INDENT> num_rolls = num_rolls - 1...
Roll DICE for NUM_ROLLS times. Return either the sum of the outcomes, or 1 if a 1 is rolled (Pig out). This calls DICE exactly NUM_ROLLS times. num_rolls: The number of dice rolls that will be made; at least 1. dice: A zero-argument function that returns an integer outcome.
625941ddd4950a0f3b08c670
def process(self, inputs, outputs): <NEW_LINE> <INDENT> for input, output in zip(inputs, outputs): <NEW_LINE> <INDENT> output = output["sem_seg"].argmax(dim=0).to(self._cpu_device) <NEW_LINE> pred = np.array(output, dtype=np.int) <NEW_LINE> gt_filename = self.input_file_to_gt_file[input["file_name"]] <NEW_LINE> gt = se...
Args: inputs: the inputs to a model. It is a list of dicts. Each dict corresponds to an image and contains keys like "height", "width", "file_name". outputs: the outputs of a model. It is either list of semantic segmentation predictions (Tensor [H, W]) or list of dicts with key "sem_seg"...
625941dd851cf427c661a831
def _val_exp_loss_prem(x, y, z): <NEW_LINE> <INDENT> if not all([isinstance(i, six.string_types) for i in (x, y)]): <NEW_LINE> <INDENT> raise TypeError('exposure and loss must be strings or unicode') <NEW_LINE> <DEDENT> if z is not None: <NEW_LINE> <INDENT> if not isinstance(z, six.string_types): <NEW_LINE> <INDENT> ra...
Takes three strings (or unicode) and cleans them for indexing an H2OFrame. Parameters ---------- x : str exp name y : str loss name z : str premium name Returns ------- out : tuple exp : str The name of the exp feature (``x``) loss : str The name of the loss feature (``y``) ...
625941dd2ae34c7f2600d456
def get_bundle_content(self): <NEW_LINE> <INDENT> content = [] <NEW_LINE> raw = self.get_raw_content() <NEW_LINE> for line in raw.splitlines(): <NEW_LINE> <INDENT> match = re.match(r"^\s*#.*$", line, flags=re.UNICODE) <NEW_LINE> if not match: <NEW_LINE> <INDENT> content.append(line) <NEW_LINE> <DEDENT> <DEDENT> return ...
Return content of the method, which is the cfengine code without comments
625941dd283ffb24f3c55c23
def get_mult_by_primary_uuids(self, primary_uuid_list): <NEW_LINE> <INDENT> return self.getSession().query(self.table).filter(self.table.primary_uuid.in_(primary_uuid_list)).all()
Get multiple objects by primary_uuids primary_uuid_list: a list of primary_uuids selected
625941ddcad5886f8bd272fe
def redirect(self, url=None, **kwargs): <NEW_LINE> <INDENT> return self.append(Redirect(url, **kwargs))
Return a newly created :class:`Redirect` verb, nested inside this :class:`Response`
625941ddfb3f5b602dac39bc
def nondst_folds(self): <NEW_LINE> <INDENT> for (_, prev_ti), (t, ti) in pairs(zip(self.ut, self.ti)): <NEW_LINE> <INDENT> shift = ti[0] - prev_ti[0] <NEW_LINE> if shift < ZERO and ti[1] == prev_ti[1]: <NEW_LINE> <INDENT> yield datetime.utcfromtimestamp(t), -shift, prev_ti[2], ti[2]
Find all folds with the same value of isdst on both sides of the transition.
625941dd15fb5d323cde0e39
def test_find_shortest_paths(self): <NEW_LINE> <INDENT> expected = '24 3 15' <NEW_LINE> edges = [[1, 2, 24], [1, 4, 20], [3, 1, 3], [4, 3, 12]] <NEW_LINE> s = 1 <NEW_LINE> g = make_undirected_weighted_graph(edges) <NEW_LINE> dijkstra_search = DijkstraSearch(g) <NEW_LINE> sorted_weights_str = dijkstra_search.str_of_sort...
Graph: 1 2 24 1 4 20 3 1 3 4 3 12
625941dd0a50d4780f6671ba
def get_user_elements_attribute_iterator(self): <NEW_LINE> <INDENT> for element in self.get_user_elements(): <NEW_LINE> <INDENT> yield element.get_default_attribute()
Returns an iterator over the main attribute of each user element. :return: an iterator over the main attribute of each user element. :rtype: iter< :class:`~sardana.sardanaattribute.SardanaAttribute` >
625941dd1f5feb6acb0c4e70
@pytest.mark.parametrize("test_input,test_output", FAIL_CASES) <NEW_LINE> def test_fail_patterns(test_input, test_output): <NEW_LINE> <INDENT> pass_test, errors = validate(test_input, stix_version='2.0', ret_errs=True, print_errs=True) <NEW_LINE> assert errors[0].startswith(test_output) <NEW_LINE> assert pass_test is F...
Validate that patterns fail as expected.
625941dda79ad161976cc46a
def filter(self, work_db, _args): <NEW_LINE> <INDENT> @lru_cache() <NEW_LINE> def file_contents(file_path): <NEW_LINE> <INDENT> with file_path.open(mode="rt") as handle: <NEW_LINE> <INDENT> return handle.readlines() <NEW_LINE> <DEDENT> <DEDENT> re_is_mutate = re.compile(r".*#.*pragma:.*no mutate.*") <NEW_LINE> for item...
Mark lines with "# pragma: no mutate" as SKIPPED For all work_item in db, if the LAST line of the working zone is marked with "# pragma: no mutate", This work_item will be skipped.
625941dd91af0d3eaac9bd41
def delete_middle_node_from_linked_list(linked_list): <NEW_LINE> <INDENT> if isinstance(linked_list, LinkedList) is False: <NEW_LINE> <INDENT> print("Please pass in a LinkedList Object") <NEW_LINE> return 2 <NEW_LINE> <DEDENT> sizeoflist = 0 <NEW_LINE> middle = linked_list.head <NEW_LINE> if middle is None: <NEW_LINE> ...
This function deletes the middle node from a singley LinkedList. Args: linked_list - LinkedList object to be passed in. Returns: Success - LinkedList Object with the middle object deleted False - Empty LinkedList and nothing can be deleted 2 - Arg given is not a LinkedList Object
625941dd66656f66f7cbc4d1
def get_block_offset(self, block_index: int) -> int: <NEW_LINE> <INDENT> key = self.get_key_for_block(block_index) <NEW_LINE> raw_data = self.db.get(key) <NEW_LINE> if raw_data is None: <NEW_LINE> <INDENT> raise BlockNotFoundError( "Unable to find block {}".format(block_index)) <NEW_LINE> <DEDENT> return unpackint(raw_...
Get the file offset for the specified block.
625941ddac7a0e7691ed43ec
def get_object(self, queryset=None): <NEW_LINE> <INDENT> if queryset is None: <NEW_LINE> <INDENT> queryset = self.get_queryset() <NEW_LINE> pk = self.kwargs.get('pk', None) <NEW_LINE> organisation_slug = self.kwargs.get('organisation_slug', None) <NEW_LINE> if pk and organisation_slug: <NEW_LINE> <INDENT> certifying_or...
Get the object for this view. :param queryset: A query set :type queryset: QuerySet :returns: Queryset which is filtered to only show a course type within the organisation. :rtype: QuerySet :raises: Http404
625941dd097d151d1a22317d
def execute(self, X): <NEW_LINE> <INDENT> node = self.program[0] <NEW_LINE> if isinstance(node, torch.FloatTensor): <NEW_LINE> <INDENT> return node <NEW_LINE> <DEDENT> if isinstance(node, int): <NEW_LINE> <INDENT> return X[:, node:node+1] <NEW_LINE> <DEDENT> valid_length = self._get_valid_length() <NEW_LINE> program_va...
执行此program
625941dde64d504609d74b65
def _refresh(self, op, context, *args): <NEW_LINE> <INDENT> self.get_job_list() <NEW_LINE> return {'FINISHED'}
The execute method for the history.refresh operator. Re-loads the current job data. :Args: - op (:class:`bpy.types.Operator`): An instance of the current operator class. - context (:class:`bpy.types.Context`): The current blender context. :Returns: - Blender-specific value {'FINISHED'} to indi...
625941dd0383005118ecf907
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, BodyPartMediaType): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941dd460517430c3944a3
def commit(self): <NEW_LINE> <INDENT> return self.session.post(VMEMActionRequest("/mgmtd/db/save").to_xml())
Commits database changes on VMEM container.
625941dd21a7993f00bc801a