code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def custom(image_array): <NEW_LINE> <INDENT> return rouge(image_array)
Cette fonction est associée au bouton Custom. 1. Pour commencer, tu peux essayer d'autres fonctions définies plus bas (par exemple, `niveaux_de_gris`, `subimage`...) à la place de la fonction `rouge`. 2. Essaie de définir et d'appeler ta propre fonction. Par exemple, définis une fonction `vert` en t'inspirant de la fon...
625941e966656f66f7cbc647
def isspace(self): <NEW_LINE> <INDENT> return self._native.isspace()
Return true if there are only whitespace characters in the string and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent.
625941e976e4537e8c351b11
def __unicode__(self): <NEW_LINE> <INDENT> return u'(soundcloud_user_id={}, username={})'.format( self.soundcloud_user_id, self.username )
Returns the printed name for this entity :rtype: str or unicode
625941e9462c4b4f79d1db6a
def split(self, data): <NEW_LINE> <INDENT> years = np.sort(np.unique(data[self.year_col])) <NEW_LINE> assert len(years) >= self.folds + 1, ("Cannot fold {} times with only {} years in" " the data".format(self.folds, len(years))) <NEW_LINE> splits = [years[len(years) - i] for i in range(1, self.folds + 1)] <NEW_LINE> fo...
Split the data into train and test sets over `self.folds` number of folds. Parameters ---------- data: pd.DataFrame The data to split. year_col: str, default='YEAR' The column in data that specifies the year. Yields ------- (train, test): pd.DataFrames Tuples of train and test splits.
625941e99f2886367277ad24
def logit(beta,x): <NEW_LINE> <INDENT> tbeta = beta.transpose() <NEW_LINE> tx = x.transpose() <NEW_LINE> the_exp = np.exp(-np.dot(tbeta,tx)) <NEW_LINE> ind_inf = np.isinf(the_exp) <NEW_LINE> res = 1/(1 + np.exp(-np.dot(tbeta,tx))) <NEW_LINE> res[ind_inf] = 0.0 <NEW_LINE> return np.ravel(res)
Computes the probability values 1/(1+exp(-(beta[0] + beta[1:]*x))) Note: This function is safe for high values of tx*beta, values are replaced. In: x (NxD+1): Input matrix beta (D+1 x 1): Parameter vector Where N and D are respectively the number of samples and dimension of input vectors Out: Probability values (Nx...
625941e9d486a94d0b98e5e1
def sqlerror(self, error): <NEW_LINE> <INDENT> if error.value[0] in (1146, 1406): <NEW_LINE> <INDENT> log.msg("output_mysql: MySQL Error: {}".format(error.value)) <NEW_LINE> log.msg("MySQL schema maybe misconfigured, doublecheck database!") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> log.err("output_mysql: MySQL Erro...
1146, "Table '...' doesn't exist" 1406, "Data too long for column '...' at row ..."
625941e9de87d2750b860232
def __init__(self, audio_type, raw_data, transcript, audio_format=None, sample_id=None): <NEW_LINE> <INDENT> super().__init__(audio_type, raw_data, audio_format=audio_format, sample_id=sample_id) <NEW_LINE> self.transcript = transcript
Parameters ---------- audio_type : str See util.audio.Sample.__init__ . raw_data : binary See util.audio.Sample.__init__ . transcript : str Transcript of the sample's utterance audio_format : tuple See util.audio.Sample.__init__ . sample_id : str Tracking ID - should indicate sample's origin as prec...
625941e9851cf427c661a9a5
def singleton(ref_): <NEW_LINE> <INDENT> return _fn({"singleton": ref_})
See the `docs <https://docs.fauna.com/fauna/current/api/fql/functions/singleton>`__.
625941e955399d3f05588b52
def epsilon(et): <NEW_LINE> <INDENT> return 23.439 - 0.013 * T0(et)
The obliquity of the ecliptic in degrees
625941e9b57a9660fec33d25
def get_all_items(self, only_active=False): <NEW_LINE> <INDENT> if only_active: <NEW_LINE> <INDENT> return self.dsession.query(Items).filter( Items.isActive == true()).order_by(Items.name).all() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.dsession.query(Items).order_by(Items.id).all()
Returns a list of all the Categories from the DB. Arguments: only_active: default is False searches for all items.If True searches only active items
625941e9a219f33f34628dfe
def add_person(): <NEW_LINE> <INDENT> first_name = tkinter.StringVar() <NEW_LINE> last_name = tkinter.StringVar() <NEW_LINE> L1 = tkinter.Label(m, text="First Name:").grid(row=1, column=2) <NEW_LINE> E1 = tkinter.Entry(m, textvariable=first_name).grid(row=1, column=3) <NEW_LINE> L2 = tkinter.Label(m, text="Last Name:")...
Adds labels and entries and a submit button to allow user input for the person table :return: none
625941e97b25080760e398f1
def list(self): <NEW_LINE> <INDENT> return [x for x in self]
Create a list of the elements by using the iterator. EXAMPLES:: sage: RC = HighestWeightRiggedConfigurations(['D', 4, 1], [[2, 2]]) sage: len(RC.list()) == RC.cardinality() True sage: sorted(RC.list()) # random [ (/) <BLANKLINE> (/) <BLANKLINE> (/) <BLANKLINE> (/) ...
625941e9a4f1c619b28b04c9
def get_or_create(model, defaults=None, session=None, **kwargs): <NEW_LINE> <INDENT> from flask import g <NEW_LINE> from sqlalchemy.sql.expression import ClauseElement <NEW_LINE> session = session or g.session <NEW_LINE> instance = session.query(model).filter_by(**kwargs).first() <NEW_LINE> if instance: <NEW_LINE> <IND...
Get model with options. If such a model not exists, create model with options. :returns: model and boolean value that indicates created bound by tuple (model, created) :rtype: :class:`tuple` Example:: from meetytools.utils.model import get_or_create from meetytools.model import SomeModel
625941e90a366e3fb873ecb9
def metadata(key=None, exclude=[]): <NEW_LINE> <INDENT> _metadata = dict() <NEW_LINE> conf = current_app.config <NEW_LINE> conf_metadata = conf.get('JSONDASH', {}).get('metadata') <NEW_LINE> if key is not None: <NEW_LINE> <INDENT> if key in conf_metadata: <NEW_LINE> <INDENT> return conf_metadata[key]() <NEW_LINE> <DEDE...
An abstraction around misc. metadata. This allows loose coupling for enabling and setting metadata for each chart. Args: key (None, optional): A key to look up in global config. exclude (list, optional): A list of fields to exclude when retrieving metadata. Returns: _metadata (dict): The metadata...
625941e9ff9c53063f47c68c
def user_which(self, user): <NEW_LINE> <INDENT> d_user = Designer_User.objects.filter(user=user).exists() <NEW_LINE> if (d_user): <NEW_LINE> <INDENT> return 'D' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> v_user = Vender_User.objects.filter(user=user).exists() <NEW_LINE> if (v_user): <NEW_LINE> <INDENT> return 'V' <N...
description:判断哪种用户 params: user对象 return: D or V
625941e916aa5153ce362913
def binarize_belongs_to_collection(df): <NEW_LINE> <INDENT> df['belongs_to_collection'] = df['belongs_to_collection'].apply(lambda x: 0 if pd.isnull(x) else 1) <NEW_LINE> return df
Performs binarization of belongs_to_collection 1 if movie belonds to a collection, 0 if not Args: df (DataFrame): Pandas dataframe Returns: DataFrame: Modified dataframe
625941e94f6381625f114ed6
def cat(filep: str) -> List[str]: <NEW_LINE> <INDENT> lines: List[str] = [] <NEW_LINE> with open(filep, 'r', encoding='utf8') as file: <NEW_LINE> <INDENT> for line in file: <NEW_LINE> <INDENT> lines.append(line) <NEW_LINE> <DEDENT> <DEDENT> return lines
Akin to cat(1), but returns a list of strings containing the contents of the provided file. Raises OSError or IOError on error.
625941e9a8370b7717052d38
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ProxyActionsubscribeResponse): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941e9e5267d203edce132
def test(testloader, criterion, epoch, net): <NEW_LINE> <INDENT> net.eval() <NEW_LINE> net.eval() <NEW_LINE> loss_sum = 0 <NEW_LINE> accuracy = 0 <NEW_LINE> pred_y_all = np.array([]) <NEW_LINE> target_y_all = np.array([]) <NEW_LINE> for (images, labels) in testloader: <NEW_LINE> <INDENT> x = Variable(images) <NEW_LINE>...
Function to test the model Arguments: testloader: Dataloader for test dataset criterion : loss function net: Network instance Returns: loss: mean test loss after 1 pass over the entire test data acc: mean test accuracy after 1 pass over the entire test data TO-DO: 1. Enumerate...
625941e92eb69b55b151cd51
def match(self, block_cell_names, origin_block_cell_name=None, paths=None): <NEW_LINE> <INDENT> match_methods = [self._absolute_match, self._relative_match, self._index_match] <NEW_LINE> for match_method in match_methods: <NEW_LINE> <INDENT> result = match_method(block_cell_names, origin_block_cell_name) <NEW_LINE> if ...
Return a set with block_cell_names that match with NodeDeclaration. block_cell_names -> list containing all BCN to match against. origin_block_cell_name -> BCN that requires this NodeDeclaration. There are three ways to solve this matching: 1.Absolute path. ex: "fran/noderedis/client.js" 2.Relative Path. ex: ".lib/p...
625941e9ac7a0e7691ed455e
def make_snapshot(self): <NEW_LINE> <INDENT> pass
Use camera to make a snapshot
625941e915fb5d323cde0fb1
def test_matchbox_indexed_match(): <NEW_LINE> <INDENT> ob = IndexedObject('x') <NEW_LINE> matchbox = MatchBox('characteristic') <NEW_LINE> matchbox.add(ob) <NEW_LINE> assert ob.characteristic in matchbox.index, "characteristic value should result in an entry in index." <NEW_LINE> assert matchbox.index[ob.characteristic...
Check simple adding object to index if it does match characteristic's value.
625941e9377c676e91272642
def start_game(): <NEW_LINE> <INDENT> marbles = 17 <NEW_LINE> return marbles
Short function to start the game. Sets the 'jar' to contain 17 marbles, prints an opening message, and returns the 17 marbles.
625941e95e10d32532c5f3c0
def train(epoch, train_loader, generator, executor, soft, criterion, optimizer, opt): <NEW_LINE> <INDENT> generator.train() <NEW_LINE> executor.train() <NEW_LINE> def set_bn_eval(m): <NEW_LINE> <INDENT> classname = m.__class__.__name__ <NEW_LINE> if classname.find('BatchNorm') != -1: <NEW_LINE> <INDENT> m.eval() <NEW_L...
one epoch guided adaptation
625941e996565a6dacc8fb65
def detect(face_model, img, tmp_path=None, tmp_key="", img_list=None, title_list=None): <NEW_LINE> <INDENT> return face_model.detect(img, tmp_path, tmp_key, img_list, title_list)
人脸图片识别 @:param face_model 人脸识别对象 @:param img 图片 @:param tmp_path 临时目录 @:param tmp_key 临时关键词 @:param img_list 图片列表 @:param title_list 标题列表 @return: 人脸信息,矩阵列表
625941e98a43f66fc4b544fb
def __init__(self): <NEW_LINE> <INDENT> self.numbers = [] <NEW_LINE> self.MaxHeap = [] <NEW_LINE> self.MinHeap = []
initialize your data structure here.
625941e994891a1f4081bf47
def test_filter_entries(har_data): <NEW_LINE> <INDENT> init_data = har_data("chrome.har") <NEW_LINE> page = HarPage(PAGE_ID, har_data=init_data) <NEW_LINE> entries = page.filter_entries(request_type='.*ET') <NEW_LINE> assert len(entries) == 41 <NEW_LINE> for entry in entries: <NEW_LINE> <INDENT> assert entry.request.me...
Tests ability to filter entries, with or without regex
625941e96e29344779a62aab
@cwl.to_tool( inputs=dict( bam_file=cwl.File(secondary_files=['.bai']), bed_file=cwl.File() ), outputs=dict(out=cwl.File(glob='gc_content.txt')), docker='images.sbgenomics.com/filip_tubic/ubuntu1604pysam' ) <NEW_LINE> def gc_content(bam_file, bed_file): <NEW_LINE> <INDENT> bam_file = bam_file['path'] <NEW_LINE> bed_fil...
Calculate GC content.
625941e944b2445a3393252e
def __init__(self, parameter=None): <NEW_LINE> <INDENT> self.name = 'tophat2' <NEW_LINE> self.threads = int(multiprocessing.cpu_count() - 2) <NEW_LINE> self.parameters = parameter <NEW_LINE> if parameter is None: <NEW_LINE> <INDENT> self.parameters = []
:param parameters: these are straight command line parameters to bowtie2 e.g. [-N 5] :return:
625941e92c8b7c6e89b35c59
def davaj_seznam_databází(): <NEW_LINE> <INDENT> for adresář in os.listdir(NEO4J_ADRESÁŘ_DATABÁZÍ): <NEW_LINE> <INDENT> yield adresář
spouštím funkci main()
625941e931939e2706e4d2ff
def write_dhcp_file(self): <NEW_LINE> <INDENT> settings_file = "/etc/dnsmasq.conf" <NEW_LINE> template_file = "/etc/cobbler/dnsmasq.template" <NEW_LINE> try: <NEW_LINE> <INDENT> f2 = open(template_file,"r") <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise CX(_("error writing template to file: %s") % template_file)...
DHCP files are written when manage_dhcp is set in /var/lib/cobbler/settings.
625941e9796e427e537b0a65
def get_dims(self): <NEW_LINE> <INDENT> return (self.getNX(), self.getNY(), self.getNZ(), self.getNumActive())
A tuple of four elements: (nx, ny, nz, nactive).
625941e93c8af77a43ae3c41
def dt_eulerangles_to_angular_velocity(self, dtEuler, EulerAngles): <NEW_LINE> <INDENT> return np.dot(self.angular_rotation_matrix(EulerAngles), dtEuler)
Euler angles derivatives TO angular velocities dtEuler = np.array([dphi/dt, dtheta/dt, dpsi/dt])
625941e94e4d5625662d486d
def start(self): <NEW_LINE> <INDENT> if not self.is_started: <NEW_LINE> <INDENT> self.server = ServerHandler(self.port + self.server_count, name=self.name, log_file=path.join( self.dir, "server_log.txt")) <NEW_LINE> self.server_count = self.server_count + 1 <NEW_LINE> self.server.start() <NEW_LINE> self.is_started = Tr...
wrapper for server handler Will start sml server if not already up
625941e98c0ade5d55d3ee5a
def event_m10_10_1000(): <NEW_LINE> <INDENT> assert event_m10_10_x40(z81=10100417, z82=100000, z83=110000079) <NEW_LINE> RestartMachine() <NEW_LINE> Quit()
King's door
625941e9187af65679ca55bb
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, SchoolItem): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941e97d847024c06be75b
def wavelet_coefs_dict(self): <NEW_LINE> <INDENT> out_dict = self.wavelet_details <NEW_LINE> out_dict[self.levels+1] = self.region_collection_at_level[self.levels+1].values <NEW_LINE> return(out_dict)
Returns a dictionary with the wavelet detail coefficients for every level plus the wavelet approximation coefficients at the end
625941e9ac7a0e7691ed455f
def get_chatroom_clients(self, chatroom_name): <NEW_LINE> <INDENT> session = self._generate_session() <NEW_LINE> query_chatroom_id = session.query(Chatroom.id).filter(Chatroom.name == chatroom_name).first() <NEW_LINE> if query_chatroom_id is None: <NEW_LINE> <INDENT> raise SQLErrorNotFound(chatroom_name) <NEW_LINE> <DE...
Gets the list of logins of chatroom participants. @param chatroom_name: chatroom name. @return: list of logins of chatroom participants.
625941e9009cb60464c63849
def _evaluate_predictions_on_crowdhuman(gt_path, dt_path, target_key="box", mode=0): <NEW_LINE> <INDENT> database = Database(gt_path, dt_path, target_key, None, mode) <NEW_LINE> database.compare() <NEW_LINE> AP, recall, _ = database.eval_AP() <NEW_LINE> mMR, _ = database.eval_MR() <NEW_LINE> return AP, mMR, recall
Evaluate the coco results using COCOEval API.
625941e9de87d2750b860233
def match(napp): <NEW_LINE> <INDENT> username = napp.get('username', napp.get('author')) <NEW_LINE> strings = ['{}/{}'.format(username, napp.get('name')), napp.get('description')] + napp.get('tags') <NEW_LINE> return any(pattern.match(string) for string in strings)
Whether a NApp metadata matches the pattern.
625941e95166f23b2e1a55f4
@bp.route('/people/<int:uid>/follow', methods=['POST']) <NEW_LINE> @UserPermission() <NEW_LINE> @jsonify <NEW_LINE> def follow(uid): <NEW_LINE> <INDENT> user = User.query.get_or_404(uid) <NEW_LINE> follow_user = g.user.followings.filter(FollowUser.following_id == uid).first() <NEW_LINE> if follow_user: <NEW_LINE> <INDE...
关注 & 取消关注某用户
625941e9baa26c4b54cb15b6
def _relax_matrix(self, n=1): <NEW_LINE> <INDENT> for i in range(n): <NEW_LINE> <INDENT> self.level.mid.reshape(-1)[:] = self.R_w.dot(self.level.mid.reshape(-1)) + self.omega * self.level.rhs / self.D
Using sparse matrix for the iteration steps
625941e9aad79263cf390ee4
def allocate_gpindices(self, startingIndex, parent): <NEW_LINE> <INDENT> num_new_params = self.embedded_gate.allocate_gpindices(startingIndex, parent) <NEW_LINE> _gatesetmember.GateSetMember.set_gpindices( self, self.embedded_gate.gpindices, parent) <NEW_LINE> return num_new_params
Sets gpindices array for this object or any objects it contains (i.e. depends upon). Indices may be obtained from contained objects which have already been initialized (e.g. if a contained object is shared with other top-level objects), or given new indices starting with `startingIndex`. Parameters ---------- starti...
625941e9dd821e528d63b641
def tables(): <NEW_LINE> <INDENT> rows = execute("SELECT name FROM sqlite_master WHERE type='table';", fetch_all=True) <NEW_LINE> return [row['name'] for row in rows]
Returns list of tables.
625941e95fcc89381b1e1b5e
def occam_razor() -> None: <NEW_LINE> <INDENT> print("WARNING! Mode three activated. Time to complete may be several minutes") <NEW_LINE> temp = [] <NEW_LINE> global example <NEW_LINE> backup = example.copy() <NEW_LINE> for x in range(shape): <NEW_LINE> <INDENT> for y in range(shape): <NEW_LINE> <INDENT> conflict_count...
This is mode three. The system has now determined that it cannot solve it with the rules available and needs to start guessing. Creates a list of all cells left in conflict and does one last test. If crossing one with the most conflicts doesn't solve it, it switches mode into a depth first search function that iterates...
625941e929b78933be1e5b42
def setattr(self, req, ino, attr, to_set, fi): <NEW_LINE> <INDENT> self.reply_err(req, errno.EROFS)
Set file attributes Valid replies: reply_attr reply_err
625941e9b5575c28eb68e4a0
def p_expression(p): <NEW_LINE> <INDENT> pass
expression : simple_expression | simple_expression relop simple_expression
625941e97cff6e4e81117e21
def p_picklay11(p): <NEW_LINE> <INDENT> p[0] = '1' + p[8] + p[2] + p[6] + '0' + p[9]
main : FROM rack PICK movelay TO rack ITEM fulltype id
625941e9462c4b4f79d1db6b
def add_acl_to_role(self, rolename, acl): <NEW_LINE> <INDENT> if type(acl) != ACLRoleEntry: <NEW_LINE> <INDENT> raise ACLException(C.make_error("ATTRIBUTE_INVALID", "acl", type(acl).__name__)) <NEW_LINE> <DEDENT> if rolename not in self.acl_roles: <NEW_LINE> <INDENT> raise ACLException(C.make_error("ROLE_NOT_FOUND", ro...
Adds an ACLRoleEntry-object to an existing ACLRole. ============== ============= Key Description ============== ============= rolename The name of the role we want to add this ACLRoleEntry to. acl The ACLRoleEntry object we want to add. ============== =============
625941e992d797404e304628
def set_project_config(self, project, config_info): <NEW_LINE> <INDENT> url = self.gerrit.url('PROJECT_CONFIG', project_name=project) <NEW_LINE> r = Request( method='PUT', url=url, auth=self.gerrit.auth, headers={'Content-Type': 'application/json; charset=UTF-8'}, data=config_info) <NEW_LINE> return self.gerrit.dispatc...
Sets the configuration of a project.
625941e9ff9c53063f47c68d
def get_serializer_class(self): <NEW_LINE> <INDENT> if (self.request.method == "GET" and self.request.query_params.get("nested")): <NEW_LINE> <INDENT> return serializers.ItemNestedSerializer <NEW_LINE> <DEDENT> return super().get_serializer_class()
Override! Using custom nested serializer when requested.
625941e9d99f1b3c44c67a22
def test_graphic_result_zero(self): <NEW_LINE> <INDENT> data = { 'weight': 9.44, 'age': 3, 'gender': 'M', 'interval': 'years' } <NEW_LINE> url = reverse('weight:curve-result') <NEW_LINE> graphic = self.get_graphic() <NEW_LINE> result = graphic.result(9.44, 3) <NEW_LINE> response = self.client.post(url, data) <NEW_LINE>...
Result that says the child is of good weight.
625941e97b25080760e398f2
def clean(self, conduit): <NEW_LINE> <INDENT> NAME = 'clean' <NEW_LINE> report = DispatchReport() <NEW_LINE> for typeid, handler in self.container.all(): <NEW_LINE> <INDENT> method = getattr(handler, NAME, 0) <NEW_LINE> if not callable(method): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> r...
Notify all handlers to clean up artifacts. Dispatch clean() to ALL handlers. @param conduit: A handler conduit. @type conduit: L{pulp.agent.lib.conduit.Conduit} @return: A dispatch report. @rtype: L{DispatchReport}
625941e926238365f5f0f311
def testTimeTransaction(self): <NEW_LINE> <INDENT> model = swagger_client.models.time_transaction.TimeTransaction()
Test TimeTransaction
625941e9be7bc26dc91cda93
def __init__(self): <NEW_LINE> <INDENT> raise NotImplementedError
We're an abstract class and shouldn't be instanciated
625941e9167d2b6e31219031
def getGuessedWord(secretWord, lettersGuessed): <NEW_LINE> <INDENT> string_new = '' <NEW_LINE> for char_1 in secretWord: <NEW_LINE> <INDENT> if char_1 in lettersGuessed: <NEW_LINE> <INDENT> string_new += char_1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> string_new += '_' <NEW_LINE> <DEDENT> <DEDENT> return string_ne...
secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: string, comprised of letters and underscores that represents what letters in secretWord have been guessed so far.
625941e9046cf37aa974d1df
def check_null_or_valid(row_data): <NEW_LINE> <INDENT> no_na = row_data.dropna()[1:-1] <NEW_LINE> numeric = pd.to_numeric(no_na,errors='coerce') <NEW_LINE> ge0 = numeric >= 0 <NEW_LINE> return ge0
Function that takes a row of data, drops all missing values, and checks if all remaining values are greater than or equal to 0
625941e97d43ff24873a3140
def test_TC_MEMKIND_autohbw_calloc_and_free(self): <NEW_LINE> <INDENT> command = (self.test_prefix + self.cmd_helper.get_command_path(self.binary) + " calloc") <NEW_LINE> print("Executing command: {0}".format(command)) <NEW_LINE> output, retcode = self.cmd_helper.execute_cmd(command, sudo=False) <NEW_LINE> assert retco...
This test executes ./autohbw_test_helper with LD_PRELOAD that is overriding calloc() and free() to equivalent autohbw functions
625941e938b623060ff0b289
def test_required_creds(self): <NEW_LINE> <INDENT> bad_creds = [ {}, { 'username': 'user1', 'strategy': 'keystone', 'password': 'pass' }, { 'password': 'pass', 'strategy': 'keystone', 'auth_url': 'http://localhost/v1' }, { 'username': 'user1', 'strategy': 'keystone', 'auth_url': 'http://localhost/v1' }, { 'username': '...
Test that plugin created without required credential pieces raises an exception
625941e901c39578d7e752d7
def delete_file(self, path, prefixed_path, source_storage): <NEW_LINE> <INDENT> if self.storage.exists(prefixed_path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> target_last_modified = self.storage.get_modified_time(prefixed_path) <NEW_LINE> <DEDENT> except (OSError, NotImplementedError, AttributeError): <NEW_LINE> <...
Checks if the target file should be deleted if it already exists
625941e95fc7496912cc3e1a
def get(self, flavor_id): <NEW_LINE> <INDENT> return self.storage.get(flavor_id)
get. ":param flavor_id :return flavor id
625941e901c39578d7e752d8
def prepare(self) -> bytes: <NEW_LINE> <INDENT> request = [f'{self.method} {self.path} HTTP/1.1'] <NEW_LINE> request.extend(f'{k}: {v}' for k, v in self.headers.items()) <NEW_LINE> request.append('\r\n') <NEW_LINE> if self.body is not None: <NEW_LINE> <INDENT> request.append(self.body) <NEW_LINE> <DEDENT> return b'\r\n...
Encodes the request into a bytes object.
625941e9a934411ee3751b31
def ParseManifest(contents): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for l in contents.split("\n"): <NEW_LINE> <INDENT> entry = ManifestEntry(*(l.strip().split(" "))) <NEW_LINE> result[entry.installpath] = entry <NEW_LINE> <DEDENT> return result
Parses a dexmanifest file. Args: contents: the contents of the manifest file to be parsed. Returns: A dict of install path -> ManifestEntry.
625941e93617ad0b5ed68393
def object_build(self, node, obj): <NEW_LINE> <INDENT> if obj in self._done: <NEW_LINE> <INDENT> return self._done[obj] <NEW_LINE> <DEDENT> self._done[obj] = node <NEW_LINE> for name in dir(obj): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> member = getattr(obj, name) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LIN...
recursive method which create a partial ast from real objects (only function, class, and method are handled)
625941e90383005118ecfa7d
def iter_subelements(element): <NEW_LINE> <INDENT> for n in element.childNodes: <NEW_LINE> <INDENT> if n.nodeType == n.ELEMENT_NODE: <NEW_LINE> <INDENT> yield n
Return an iterator over all child nodes that are elements
625941e9a8ecb033257d3568
def __init__(self, code=None, withdraw_fee=None, is_coin=None, wallet_state=None, wallet_support=None): <NEW_LINE> <INDENT> self._code = None <NEW_LINE> self._withdraw_fee = None <NEW_LINE> self._is_coin = None <NEW_LINE> self._wallet_state = None <NEW_LINE> self._wallet_support = None <NEW_LINE> self.discriminator = N...
Currency - a model defined in Swagger
625941e9c4546d3d9de72ed4
def isUgly(self, num): <NEW_LINE> <INDENT> if num <= 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> for div in [2, 3, 5]: <NEW_LINE> <INDENT> while num % div == 0: <NEW_LINE> <INDENT> num = num / div <NEW_LINE> <DEDENT> <DEDENT> return num == 1
:type num: int :rtype: bool
625941e9eab8aa0e5d26dff6
def executer(self): <NEW_LINE> <INDENT> navire = self.navire <NEW_LINE> matelot = self.matelot <NEW_LINE> personnage = matelot.personnage <NEW_LINE> salle = personnage.salle <NEW_LINE> direction = self.direction <NEW_LINE> nav_direction = navire.direction.direction <NEW_LINE> if not hasattr(salle, "gouvernail") or sall...
Exécute l'ordre : vire sur bâbord.
625941e94e696a04525c98ea
def list_range(array): <NEW_LINE> <INDENT> length = len(array) <NEW_LINE> if length == 0: <NEW_LINE> <INDENT> raise Exception <NEW_LINE> <DEDENT> if length % 2 == 0: <NEW_LINE> <INDENT> head = array[0:2] <NEW_LINE> m, n = head if head[0] > head[1] else head[::-1] <NEW_LINE> start = 2 <NEW_LINE> <DEDENT> else: <NEW_LINE...
get the min and max of the list array must not be empty return (min, max) -- time T(n) = 3*(n/2)
625941e9d4950a0f3b08c7e5
def _pathway_protein(self, url: Optional[str] = None) -> None: <NEW_LINE> <INDENT> pathways_proteins_df = get_procesed_proteins_pathways_df(url=url) <NEW_LINE> missing_reactome_ids = set() <NEW_LINE> missing_hgnc_info = set() <NEW_LINE> protein_info_df = pathways_proteins_df[ ['uniprot_id', 'uniprot_accession', 'hgnc_i...
Populate UniProt tables. :param url: url from pathway protein file
625941e96fece00bbac2dbe1
def OnChildKillFocus(self, event): <NEW_LINE> <INDENT> if self._child_with_focus is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self._child_with_focus.Bind(wx.EVT_KILL_FOCUS, None) <NEW_LINE> self._child_with_focus = None <NEW_LINE> receiver = event.GetWindow() <NEW_LINE> if receiver == self or IsAncestorOf(se...
Handles the ``wx.EVT_KILL_FOCUS`` event for children of :class:`RibbonPanel`. :param `event`: a :class:`FocusEvent` event to be processed.
625941e95510c4643540f875
def get_ad_group(client, customer_id, ad_group_resource_name): <NEW_LINE> <INDENT> ga_service = client.get_service('GoogleAdsService', version='v2') <NEW_LINE> query = ('SELECT ad_group.id, ad_group.name, ad_group.resource_name ' 'FROM ad_group WHERE ad_group.resource_name = "{}" ' .format(ad_group_resource_name)) <NEW...
Retrieves a google.ads.googleads_v2.types.AdGroup instance. Args: client: A google.ads.google_ads.client.GoogleAdsClient instance. customer_id: (str) Customer ID associated with the account. ad_group_resource_name: (str) Resource name associated with the newly created Ad group. Returns: An ins...
625941e97b180e01f3dc4c90
def GetAuxiliaryAliveValues(self): <NEW_LINE> <INDENT> return _itkFastMarchingExtensionImageFilterPython.itkFastMarchingExtensionImageFilterID2UC1ID2_GetAuxiliaryAliveValues(self)
GetAuxiliaryAliveValues(self) -> itkVectorContainerUIVUC1
625941e9711fe17d825427fd
def solve(self): <NEW_LINE> <INDENT> start = datetime.now() <NEW_LINE> made_replacement = True <NEW_LINE> run = 0 <NEW_LINE> while made_replacement: <NEW_LINE> <INDENT> run += 1 <NEW_LINE> if self.debug: <NEW_LINE> <INDENT> print("Run", run) <NEW_LINE> <DEDENT> made_replacement = self.searchForNakedSingle() <NEW_LINE> ...
Wrapper die alle oplossingsstrategieen uitvoert
625941e926068e7796caf183
def set_configuration(self, data): <NEW_LINE> <INDENT> self.bus.write_word_data( self.device_address, self.REGISTER_CONFIGURATION, data )
The MCP9808 has a 16-bit Configuration register (CONFIG) that allows the user to set various functions for a robust temperature monitoring system. Bits 10 through 0 are used to select the temperature alert output hysteresis, device shutdown or Low-Power mode, temperature boundary and critical temperature lock, and temp...
625941e97cff6e4e81117e22
def __init__(self, name = "Ultimaker"): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.extruders = list()
Initialization of the Machine instance
625941e9cc0a2c11143dd32e
def accept(resp: requests.Response, s: requests.Session) -> bool: <NEW_LINE> <INDENT> s.headers.update({"Referer": resp.url}) <NEW_LINE> data = resp.text <NEW_LINE> log.debug(s.headers) <NEW_LINE> log.info("Checking for flixbus Portal") <NEW_LINE> parsed = soup(data, features="html.parser") <NEW_LINE> getdata = {} <NEW...
resp: the initial response of the internet get request s: the requests session for opening new http connections return True if successful, else False
625941e950812a4eaa59c7b9
def recommendations(name,items,ratings,size): <NEW_LINE> <INDENT> d= {} <NEW_LINE> weightavgs = similarities(name, ratings) <NEW_LINE> for x in range(size): <NEW_LINE> <INDENT> tup = weightavgs[x] <NEW_LINE> person = tup[0] <NEW_LINE> multiplier = tup[1] <NEW_LINE> origratings = ratings[person] <NEW_LINE> weightedlist ...
creates new dictionary of size "size" (parameter) and calls both similarities and averages function. similarities function returns weighted scores whcich is used to multiply original ratings lists to create a new weighted ratings list. Returns weighted recommendations of things in items(parameter)
625941e999fddb7c1c9de82b
def test_create_user_profile_duplicate_email(self): <NEW_LINE> <INDENT> response = self.client.post(reverse('rest-auth:users-list'), self._get_user_profile_data( username='TEST_CREATE_USER_DUP_EMAIL' ), format='json') <NEW_LINE> self._assert_response_equal_status(response, status.HTTP_400_BAD_REQUEST)
Tests creating user with a duplicate email results in HTTP 400 BAD REQUEST
625941e90a50d4780f667332
def show_file(self, path=None, **options): <NEW_LINE> <INDENT> if path is None: <NEW_LINE> <INDENT> if "file" in options: <NEW_LINE> <INDENT> warnings.warn( "The 'file' argument is deprecated and will be removed in Pillow " "10 (2023-07-01). Use 'path' instead.", DeprecationWarning, ) <NEW_LINE> path = options.pop("fil...
Display given file. Before Pillow 9.1.0, the first argument was ``file``. This is now deprecated, and ``path`` should be used instead.
625941e9596a897236089f57
def itertuples(self, index=True, name='Pandas', batch_size=1000, session=None): <NEW_LINE> <INDENT> return self._data.itertuples(batch_size=batch_size, session=session, index=index, name=name)
Iterate over DataFrame rows as namedtuples. Parameters ---------- index : bool, default True If True, return the index as the first element of the tuple. name : str or None, default "Pandas" The name of the returned namedtuples or None to return regular tuples. Returns ------- iterator An object to it...
625941e976e4537e8c351b13
def set_Album(self, value): <NEW_LINE> <INDENT> super(GetShoutsInputSet, self)._set_input('Album', value)
Set the value of the Album input for this Choreo. ((conditional, string) The album title. Required unless providing MbID.)
625941e9462c4b4f79d1db6c
def preorder_travel(self, node): <NEW_LINE> <INDENT> if node is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> print(node.elem, end=" ") <NEW_LINE> self.preorder_travel(node.l_child) <NEW_LINE> self.preorder_travel(node.r_child)
深度遍历--先序遍历(根→左→右)
625941e90a50d4780f667333
def getH0(self): <NEW_LINE> <INDENT> return self.H0
generated source for method getH0
625941e9cc0a2c11143dd32f
def __checkTransportSanity(self): <NEW_LINE> <INDENT> if not self.__initStatus['OK']: <NEW_LINE> <INDENT> return self.__initStatus <NEW_LINE> <DEDENT> retVal = gProtocolDict[self.__URLTuple[0]]['sanity'](self.__URLTuple[1:3], self.kwargs) <NEW_LINE> if not retVal['OK']: <NEW_LINE> <INDENT> return retVal <NEW_LINE> <DED...
Calls the sanity check of the underlying Transport object and stores the result in self.__idDict. It is checked at the creation of the BaseClient, and when connecting if the use of the certificate has changed.
625941e9d486a94d0b98e5e3
def get_release_string(chroot): <NEW_LINE> <INDENT> rel_name = None <NEW_LINE> rel_ver = None <NEW_LINE> sysroot = chroot <NEW_LINE> try: <NEW_LINE> <INDENT> rel_arch = blivet_util.capture_output(["arch"], root=sysroot).strip() <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <INDENT> rel_arch = None <NEW_LINE> <DEDENT> ...
Identify the installation of a Linux distribution. Attempt to identify the installation of a Linux distribution by checking a previously mounted filesystem for several files. The filesystem must be mounted under the target physical root. :returns: The machine's arch, distribution name, and distribution version or No...
625941e9bde94217f3683289
def tags(self): <NEW_LINE> <INDENT> catalog = api.portal.get_tool('portal_catalog') <NEW_LINE> tags = set(catalog.uniqueValuesFor('Subject')) <NEW_LINE> tool = PLONESOCIAL.microblog <NEW_LINE> if tool: <NEW_LINE> <INDENT> tags.update(tool._tag_mapping.keys()) <NEW_LINE> <DEDENT> tags = sorted(tags) <NEW_LINE> search_st...
Get available tags, both from Plone's keyword index and the microblog utility Applies very basic text searching
625941e94428ac0f6e5bac93
def eigenvector_centrality_numpy(G, weight='weight'): <NEW_LINE> <INDENT> import scipy as sp <NEW_LINE> from scipy.sparse import linalg <NEW_LINE> if len(G) == 0: <NEW_LINE> <INDENT> raise nx.NetworkXException('Empty graph.') <NEW_LINE> <DEDENT> M = nx.to_scipy_sparse_matrix(G, nodelist=G.nodes(), weight=weight, dtype=...
Compute the eigenvector centrality for the graph G. Parameters ---------- G : graph A networkx graph weight : None or string, optional The name of the edge attribute used as weight. If None, all edge weights are considered equal. Returns ------- nodes : dictionary Dictionary of nodes with eigenvector centr...
625941e938b623060ff0b28a
def test_place_piece(): <NEW_LINE> <INDENT> test_placements = [("J", (7, -1, 2)), ("S", (1, -1, 2)), ("O", (8, 1, 2)), ("L", (7, 2, 0)), ("I", (4, 0, 1)), ("T", (-1, 0, 1)), ("Z", (0, 1, 2))] <NEW_LINE> field = [[0] * 10 for __ in range(20)] <NEW_LINE> for piece, placement in test_placements: <NEW_LINE> <INDENT> setupf...
Unit test for place_piece.
625941e9bd1bec0571d90acb
def check_method_or_accessor_override_for_base(self, defn, base): <NEW_LINE> <INDENT> if base: <NEW_LINE> <INDENT> if defn.name() != '__init__': <NEW_LINE> <INDENT> base_method = base.get_method(defn.name()) <NEW_LINE> if base_method and base_method.info == base: <NEW_LINE> <INDENT> typ = method_type(defn) <NEW_LINE> o...
Check that function definition is compatible with any overridden definition in the specified supertype.
625941e915baa723493c4416
def get_export_columns(self): <NEW_LINE> <INDENT> serializer = self.get_serializer() <NEW_LINE> fields = serializer._readable_fields <NEW_LINE> columns = {} <NEW_LINE> for field in fields: <NEW_LINE> <INDENT> field_name = field.field_name <NEW_LINE> if not field.style.get("column_visible", True): <NEW_LINE> <INDENT> co...
获取导出列信息 :return:
625941e9d486a94d0b98e5e4
def test_inventory_1(self): <NEW_LINE> <INDENT> self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 100) <NEW_LINE> self.assertEqual(len(self.env['stock.quant']._gather(self.product1, self.stock_location)), 1.0) <NEW_LINE> self.assertEqual(self.env['stock.quant']._get_available_quanti...
Check that making an inventory adjustment to remove all products from stock is working as expected.
625941e9627d3e7fe0d692ee
def test_response_for_validate_token_with_admin_and_observer_role(self): <NEW_LINE> <INDENT> core, root = core_and_root([ExampleAPI()]) <NEW_LINE> token = get_presets["identity"]["admin_role"][0] <NEW_LINE> (response, json_body) = self.successResultOf(json_request( self, root, "GET", "http://mybase/identity/v2.0/tokens...
Test to verify :func: `validate_token` when the tenant_id provided is of an admin role, as specified in `mimic_presets`.
625941e9656771135c3ebd11
def initialize_recipe(recipe_name): <NEW_LINE> <INDENT> logger.info('Recipe object initialization...') <NEW_LINE> try: <NEW_LINE> <INDENT> logger.info('Recipe object successfully initialized.') <NEW_LINE> return Recipe(recipe_name) <NEW_LINE> <DEDENT> except MozbitbarRecipeException as re: <NEW_LINE> <INDENT> logger.cr...
Initializes the Recipe object. Given a path to the recipe file, this method will initialize and return an instance of the Recipe object, containing within it required project parameters for interacton with Bitbar. Also contained within this object is the internal representation of the tasks to be executed. Args: ...
625941e956ac1b37e6264663
def go_to_yuqixinxiweihu(driver): <NEW_LINE> <INDENT> actions = ActionChains(driver) <NEW_LINE> try: <NEW_LINE> <INDENT> WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//a[text()='贷后管理']"))) <NEW_LINE> el1 = driver.find_element_by_xpath("//a[text()='贷后管理']") <NEW_LINE> el2 = driver.find_el...
逾期信息维护
625941e93d592f4c4ed1d4fe
def _update_installed(self, task): <NEW_LINE> <INDENT> task.status = STATUS_INSTALLED <NEW_LINE> self._flag_installed(task.pkg, task.dependents)
Mark the task as installed and ensure dependent build tasks are aware. Args: task (BuildTask): the build task for the installed package
625941e9a79ad161976cc5e2
def __log(self): <NEW_LINE> <INDENT> mean = statistics.mean(pop.value for pop in self.population) <NEW_LINE> deviation = statistics.stdev(pop.value for pop in self.population) <NEW_LINE> self.mean_list.append(mean) <NEW_LINE> self.deviation_list.append(deviation) <NEW_LINE> self.tournament_size_history.append(self.tour...
Log some important statistic of current generation :return: None
625941e991af0d3eaac9beba
def minReorder(self, n: int, connections: List[List[int]]) -> int: <NEW_LINE> <INDENT> pass
put solution here
625941e992d797404e304629
def addActionHandler(self, actionHandler): <NEW_LINE> <INDENT> raise NotImplementedError
Registers a new action handler for this container @param actionHandler: the new handler to be added.
625941e92eb69b55b151cd53
def check_job_exists(self): <NEW_LINE> <INDENT> host = self._cfg['host'] <NEW_LINE> endpoint = os.path.join(host, 'mozart/api/ci/job-builder') <NEW_LINE> data = { 'repo': self.repo, } <NEW_LINE> if self.branch: <NEW_LINE> <INDENT> data['branch'] = self.branch <NEW_LINE> <DEDENT> req = requests.get(endpoint, params=data...
Check if job is registered in Jenkins :return: True/False
625941e973bcbd0ca4b2c512