code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def extract_tags(self, sentence, topK=20, withWeight=False, allowPOS=(), withFlag=False): <NEW_LINE> <INDENT> if allowPOS: <NEW_LINE> <INDENT> allowPOS = frozenset(allowPOS) <NEW_LINE> words = self.postokenizer.cut(sentence) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> words = self.tokenizer.cut(sentence, cut_all=Fals...
Extract keywords from sentence using TF-IDF algorithm. Parameter: - topK: return how many top keywords. `None` for all possible words. - withWeight: if True, return a list of (word, weight); if False, return a list of words. - allowPOS: the allowed POS list eg. ['ns', 'n', 'vn', 'v','nr']....
625941d53eb6a72ae02ec6f4
@api_view(['POST']) <NEW_LINE> @authentication_classes((TokenAuthentication,)) <NEW_LINE> @permission_classes((AllowAll,)) <NEW_LINE> def balance(request): <NEW_LINE> <INDENT> data ={} <NEW_LINE> if settings.DEBUG: <NEW_LINE> <INDENT> print ("Input: {\"function\":\"",str(sys._getframe().f_code.co_name),"} ",end="") <NE...
Retorna o valor de saldo da conta do usuário.
625941d5d58c6744b4257e72
def test_handle_already_requeued(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with self.response.handle(): <NEW_LINE> <INDENT> self.response.req(10) <NEW_LINE> raise ValueError('foo') <NEW_LINE> <DEDENT> <DEDENT> except ValueError: <NEW_LINE> <INDENT> self.assertEqual(self.response.connection.req.call_count, 1)
If we've already requeued a message, doesn't requeue it again
625941d538b623060ff0b001
def handle_event(self, view): <NEW_LINE> <INDENT> global settings <NEW_LINE> if not settings.enabled: <NEW_LINE> <INDENT> SublimeWritingStyleListener.disable() <NEW_LINE> return <NEW_LINE> <DEDENT> file_name = view.file_name() <NEW_LINE> ext = '' <NEW_LINE> if file_name: <NEW_LINE> <INDENT> ext = os.path.splitext(file_...
determines if the package status changed. marks words when turned on.
625941d5e76e3b2f99f3aa1c
def _dummy_cb(self, win, event): <NEW_LINE> <INDENT> return True
Does nothing
625941d5a05bb46b383eca34
def test_404(self): <NEW_LINE> <INDENT> res = self.client().get('/company/abcdefghijk') <NEW_LINE> data = json.loads(res.data) <NEW_LINE> self.assertEqual(res.status_code, 404) <NEW_LINE> self.assertIn('error', data) <NEW_LINE> self.assertEqual(data['success'], False)
Test 404 error handler is API'd
625941d5e64d504609d74a53
def update_node_search_domains(self, body, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.update_node_search_domains_with_http_info(body, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.update_node_searc...
Update the NSX Manager's Search Domains # noqa: E501 Modifies the list of domain names that the NSX Manager node uses to complete unqualified host names. If DHCP is configured, this method returns a 409 CONFLICT error, because DHCP manages the list of name servers. # noqa: E501 This method makes a synchronous HTTP ...
625941d55510c4643540f5f4
def generate_hexagonal_lattice(maxv1, minv1, maxv2, minv2, mindist): <NEW_LINE> <INDENT> if minv1 > maxv1: <NEW_LINE> <INDENT> raise ValueError("Invalid input to function.") <NEW_LINE> <DEDENT> if minv2 > maxv2: <NEW_LINE> <INDENT> raise ValueError("Invalid input to function.") <NEW_LINE> <DEDENT> v1s = [minv1] <NEW_LI...
This function generates a 2-dimensional lattice of points using a hexagonal lattice. Parameters ----------- maxv1 : float Largest value in the 1st dimension to cover minv1 : float Smallest value in the 1st dimension to cover maxv2 : float Largest value in the 2nd dimension to cover minv2 : float Smalle...
625941d53346ee7daa2b2f80
def __init__(self, volume_driver=None, service_name=None, *args, **kwargs): <NEW_LINE> <INDENT> super(VolumeManager, self).__init__(service_name='volume', *args, **kwargs) <NEW_LINE> self.configuration = Configuration(volume_manager_opts, config_group=service_name) <NEW_LINE> self._tp = GreenPool() <NEW_LINE> self.stat...
Load the driver from the one specified in args, or from flags.
625941d50a366e3fb873ea2f
def _id_map(minion_id, dns_name): <NEW_LINE> <INDENT> bank = "digicert/minions" <NEW_LINE> cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR) <NEW_LINE> dns_names = cache.fetch(bank, minion_id) <NEW_LINE> if not isinstance(dns_names, list): <NEW_LINE> <INDENT> dns_names = [] <NEW_LINE> <DEDENT> if dns_name not in d...
Maintain a relationship between a minion and a dns name
625941d5f548e778e58cd792
def download_dms_file_with_http_info(self, download_dms_file_request, **kwargs): <NEW_LINE> <INDENT> all_params = ['download_dms_file_request'] <NEW_LINE> all_params.append('async') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_req...
download_dms_file # noqa: E501 DMS파일다운로드 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.download_dms_file_with_http_info(download_dms_file_request, async=True) >>> result = thread.get() :param async bool :param Down...
625941d57b180e01f3dc4a0e
def _exists_local(self, path): <NEW_LINE> <INDENT> if path is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if not os.path.isdir(path): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
Returns true if the given bundle path exists in valid local cached form This can be reimplemented in derived classes to have more complex validation, like ensuring that the bundle is fully downloaded.
625941d5d486a94d0b98e35a
def reduce_box_vectors(rvecs): <NEW_LINE> <INDENT> assert is_lower_triangular(rvecs) <NEW_LINE> rvecs[2, :] = rvecs[2, :] - rvecs[1, :] * np.round(rvecs[2, 1] / rvecs[1, 1]) <NEW_LINE> rvecs[2, :] = rvecs[2, :] - rvecs[0, :] * np.round(rvecs[2, 0] / rvecs[0, 0]) <NEW_LINE> rvecs[1, :] = rvecs[1, :] - rvecs[0, :] * np.r...
Uses linear combinations of box vectors to obtain the reduced form The reduced form of a cell matrix is lower triangular, with additional constraints that enforce vector b to lie mostly along the y-axis and vector c to lie mostly along the z axis. Parameters ---------- rvecs : array_like (3, 3) array with box ve...
625941d526238365f5f0f084
def __init__(self, directory, iteration, event_name, comm=None): <NEW_LINE> <INDENT> self._directory = directory <NEW_LINE> if not os.path.exists(self._directory): <NEW_LINE> <INDENT> os.makedirs(self._directory) <NEW_LINE> <DEDENT> self._synthetic_tag = iteration <NEW_LINE> self._event_name = event_name <NEW_LINE> sel...
:param directory: The directory of the windows. :param iteration: The iteration name. :param event_name: The event name. :param comm: The communicator instance. Can be none, but required for some operations.
625941d5796e427e537b07db
def abort(self): <NEW_LINE> <INDENT> self.__process.terminate()
Abort the Job process
625941d5851cf427c661a721
@app.route('/users/<username>') <NEW_LINE> def secret_page(username): <NEW_LINE> <INDENT> form = LoginUser() <NEW_LINE> if "username" not in session: <NEW_LINE> <INDENT> flash("Unauthorized. Please register/login first.") <NEW_LINE> return redirect('/login') <NEW_LINE> <DEDENT> user = User.query.filter_by(username=user...
Only way to access this route is through registering or logging in a registered User
625941d55fdd1c0f98dc0447
def copy_templates(modeladmin, request, queryset): <NEW_LINE> <INDENT> ids = ",".join(str(template.id) for template in queryset.all()) <NEW_LINE> return HttpResponseRedirect(reverse("template.copy") + "?ids=%s" % ids)
Copy application template to a different course.
625941d5a934411ee37518a7
def __init__(self, repo_cache): <NEW_LINE> <INDENT> self._cache = repo_cache
constructor
625941d532920d7e50b283e5
def __init__(self, screen): <NEW_LINE> <INDENT> self._screen = screen <NEW_LINE> self._x = 0 <NEW_LINE> self._y = 0 <NEW_LINE> self._rate = 0 <NEW_LINE> self._char = None <NEW_LINE> self._reseed()
:param screen: The Screen being used for the Scene.
625941d530c21e258bdfa6b2
def is_child(members, user): <NEW_LINE> <INDENT> member = get_member(members, user) <NEW_LINE> if member: <NEW_LINE> <INDENT> return member.managed <NEW_LINE> <DEDENT> return False
Given a list of members, is the given user a child (managed)
625941d5379a373c97cfad5a
def getSelected(menu, url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> this_view = resolve(url).func <NEW_LINE> <DEDENT> except Resolver404: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> this_view = ".".join((_get_module(this_view).__name__, this_view.__name__)) <NEW_LINE> views = dict((view, lbl) for lbl, view in m...
Return label of selected item
625941d57b25080760e3966c
def _get_layers(self) -> list: <NEW_LINE> <INDENT> raise NotImplementedError
Return the hidden layers in the model, if applicable. :return: The hidden layers in the model, input and output layers excluded.
625941d5925a0f43d254a08c
def permuteUnique(self, nums): <NEW_LINE> <INDENT> permutes = [] <NEW_LINE> self.permute(nums, [], permutes) <NEW_LINE> return permutes
type nums: List[int] rtype: List[List[int]]
625941d5ad47b63b2c50a193
def make_sentence(): <NEW_LINE> <INDENT> correct = "methinks it is like a weasel" <NEW_LINE> alphabet = it.permutations("abcdefghijklmnopqrstuvwxyz ") <NEW_LINE> sentence = "" <NEW_LINE> i = 0 <NEW_LINE> while sentence is not correct: <NEW_LINE> <INDENT> sentence = reduce( lambda j, k: j+k, next(alphabet)) <NEW_LINE> i...
Makes and compares the sentence
625941d54f6381625f114c4f
def to_hex_string(self): <NEW_LINE> <INDENT> result = "" <NEW_LINE> for index in range(len(self._map)): <NEW_LINE> <INDENT> tile_id = self._map[index] <NEW_LINE> result += "%02X" % tile_id <NEW_LINE> if (index + 1) % self._width == 0: <NEW_LINE> <INDENT> result += "\n" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> resu...
Returns the tilemap as an hexadecimal-encoded string. :rtype: str e.g. (4x4 tiles):: 00 00 00 00 00 01 02 00 00 03 04 00 00 00 00 00
625941d5ec188e330fd5a9b0
def last_support(entry): <NEW_LINE> <INDENT> last_support = None <NEW_LINE> for season in entry[:-1]: <NEW_LINE> <INDENT> if 'support' in season['interaction'].values(): <NEW_LINE> <INDENT> last_support = season['season'] <NEW_LINE> <DEDENT> <DEDENT> return last_support
This function returns the last season of friendship. The code is inspired by the provided code from the authors
625941d563d6d428bbe44704
def reset(): <NEW_LINE> <INDENT> timer.stop() <NEW_LINE> global currentms <NEW_LINE> global currenttry <NEW_LINE> global currentattempts <NEW_LINE> global success <NEW_LINE> currentms=0 <NEW_LINE> success=0 <NEW_LINE> currenttry=0 <NEW_LINE> currentattempts="0/0"
Stop timer and reset all global variables
625941d516aa5153ce36268b
def status(name, sig=None): <NEW_LINE> <INDENT> if _service_is_upstart(name): <NEW_LINE> <INDENT> cmd = 'status {0}'.format(name) <NEW_LINE> return 'start/running' in __salt__['cmd.run'](cmd) <NEW_LINE> <DEDENT> if sig: <NEW_LINE> <INDENT> return bool(__salt__['status.pid'](sig)) <NEW_LINE> <DEDENT> cmd = '/sbin/servic...
Return the status for a service, returns a bool whether the service is running. CLI Example: .. code-block:: bash salt '*' service.status <service name>
625941d5167d2b6e31218da9
def get_desired_state_definition(self): <NEW_LINE> <INDENT> record_type = self.desired_state_definition.get("Type") <NEW_LINE> if record_type == "A" and len(self.parents) > 0: <NEW_LINE> <INDENT> ec2_instance_parents = list(filter(lambda x: isinstance(x, EC2Instance), self.parents)) <NEW_LINE> if len(ec2_instance_paren...
Returns the desires state definition. If Route53 Record has parents that are EC2 instances then ip addresses of those instances are automatically added to the resource_records in the desired state definition. :return: desired_state_definition
625941d550812a4eaa59c534
def alertPeople(message): <NEW_LINE> <INDENT> sendToTelegram(message)
Alert people
625941d5be8e80087fb20e55
def _generate_cancel_lease_transaction(self, transaction_id, transaction_fee, timestamp): <NEW_LINE> <INDENT> if timestamp == 0: <NEW_LINE> <INDENT> timestamp_param = int(time.time() * 1000) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> timestamp_param = timestamp <NEW_LINE> <DEDENT> sign_data = [ TRANSACTION_TYPE_CANC...
Prepare data for cancel lease transaction :param transaction_id: :param transaction_fee: :param timestamp: :return:
625941d51b99ca400220acc6
def __init__(self, in_queue, out_queue): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._in_queue = in_queue <NEW_LINE> self._out_queue = out_queue
:param queue.Queue in_queue: The incoming queue :param queue.Queue out_queue: The outgoing queue
625941d560cbc95b062c6757
def test_eq_false_id(self): <NEW_LINE> <INDENT> other = Sample('1.SKD8.640184', self.sample_template) <NEW_LINE> self.assertFalse(self.tester == other)
Equality returns false if ids are different
625941d5236d856c2ad449f0
def forward(self, *input): <NEW_LINE> <INDENT> x = input[0] <NEW_LINE> x = self.squeeze(x) <NEW_LINE> for l in self.scene_layers: <NEW_LINE> <INDENT> x = l(x) <NEW_LINE> <DEDENT> x_scene = x <NEW_LINE> x_scene = torch.squeeze(x_scene) <NEW_LINE> x = input[1] <NEW_LINE> x = self.squeeze(x) <NEW_LINE> for l in self.defor...
input is two features: full image feature and context feature :param x_c: scene feature (B, C, N, H, W) :return:
625941d5d164cc6175782f62
def _find_trunk_adapter(self, pvid, lpar_id, vswitch_id, k2_bridge_entry): <NEW_LINE> <INDENT> search = './LoadGroups/LoadGroup' <NEW_LINE> k2_ld_grps = k2_bridge_entry.element.findall(search) <NEW_LINE> for k2_ld_grp in k2_ld_grps: <NEW_LINE> <INDENT> port_vid = k2_ld_grp.findtext('PortVLANID') <NEW_LINE> if str(pvid)...
Finds the appropriate TrunkAdapter (represents a VEA) for the provided input. :param pvid: The primary VLAN id of the Trunk Adapter :param lpar_id: The LPAR identiier that the Trunk Adapter is on. :param vswitch_id: The K2 vSwitch identifier for the Trunk Adapter. :param k2_bridge_entry: The K2 NetworkBridge that cont...
625941d5eab8aa0e5d26dd6c
def test_parallel_database_mapper_blat(self): <NEW_LINE> <INDENT> params = {'refseqs_fp': self.refseqs1_fp, 'min_percent_id': 0.97, 'evalue': 1e-10, 'max_accepts': 1, 'max_rejects': 32, 'queryalnfract': 0.35, 'targetalnfract': 0.0, 'observation_metadata_fp': None } <NEW_LINE> app = ParallelDatabaseMapperBlat() <NEW_LIN...
parallel_database_mapper_blat functions as expected
625941d521a7993f00bc7f06
def copy_to_clipboard(text): <NEW_LINE> <INDENT> win32clipboard.OpenClipboard() <NEW_LINE> win32clipboard.EmptyClipboard() <NEW_LINE> win32clipboard.SetClipboardText(text) <NEW_LINE> win32clipboard.CloseClipboard()
Copies the specified text to the clipboard :param text: The text to be copied
625941d5627d3e7fe0d69065
def test_blocking_buffer_not_int(): <NEW_LINE> <INDENT> with pytest.raises(TypeError): <NEW_LINE> <INDENT> create_blocking_buffer('a')
WHEN n is not an integer. EXPECT Throws a TypeError.
625941d599cbb53fe6792dfb
def test_initialize(self): <NEW_LINE> <INDENT> test.player_test.test_player_should_save_table(self, self.player, self.table)
The constructor should save all parameters correctly.
625941d50383005118ecf7f6
def save_file(schedule): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> date = datetime.datetime.today().strftime('%d-%m-%Y') <NEW_LINE> format = get_file_fmt() <NEW_LINE> filename = f"{date} schedule.{format}" <NEW_LINE> if format == 'txt': <NEW_LINE> <INDENT> save_file = File(filename, schedule) <NEW_LINE> save_...
Save file as: format. **returns filename to then send it to user's email.
625941d53c8af77a43ae39b5
def __init__(self, target_func, num_cores=None): <NEW_LINE> <INDENT> if num_cores is None: <NEW_LINE> <INDENT> num_cores = mp.cpu_count() <NEW_LINE> <DEDENT> self.total_jobs = 0 <NEW_LINE> self.jobs = mp.JoinableQueue() <NEW_LINE> self.results = mp.Queue() <NEW_LINE> tup = (self.jobs, self.results) <NEW_LINE> self.num_...
Class to wrap multiprocessing arbitrary task. Call sequence: 1) Instantiate a multiprocess object. 2) Add jobs to job queue using add_job method. 3) Call multiprocess objects close_out method. 4) Deal with the results in whatever foul, depraved way you deem fit.
625941d5e76e3b2f99f3aa1d
def _get_unique_slug(self): <NEW_LINE> <INDENT> slug_unique = False <NEW_LINE> counter = 1 <NEW_LINE> slug = self.slug <NEW_LINE> while not slug_unique: <NEW_LINE> <INDENT> if self.id: <NEW_LINE> <INDENT> images = Image.objects.filter(slug=slug). exclude(pk=self.id) <NEW_LINE> <DEDENT> else: <NEW_LIN...
Makes slug unique, if it is not already, and returns it as a string.
625941d53317a56b86939e69
def has_exotic_animals(animals): <NEW_LINE> <INDENT> if "hippo" in animals or "platpypus" in animals: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Determine whether a list of animals contains exotic animals. Put runtime here: ----------------- [ O(n) ]
625941d5a934411ee37518a8
def call_fn(self, fn_name, args): <NEW_LINE> <INDENT> self.fields('*')._set_token_value('FROM__FN', fn_name) <NEW_LINE> token = self._get_token('FROM__FN') <NEW_LINE> token.subtoken.value = args <NEW_LINE> return self
Call user-defined function, like SELECT * FROM my_function('param1', 2, True) :param fn_name: str: function name :param args: tuple: function arguments tuple :return: function result
625941d5099cdd3c635f0e6f
def printfasta (out,name,seq): <NEW_LINE> <INDENT> out.write(">%s\n"%(name)) <NEW_LINE> n=0; <NEW_LINE> w="" <NEW_LINE> for s in seq: <NEW_LINE> <INDENT> w += s <NEW_LINE> n+=1 <NEW_LINE> if n == 80: <NEW_LINE> <INDENT> out.write("%s\n"%(w)) <NEW_LINE> n=0 <NEW_LINE> w="" <NEW_LINE> <DEDENT> <DEDENT> if n>0: out.write(...
Print Fasta format
625941d58a349b6b435e8388
def nextf(x): <NEW_LINE> <INDENT> if math.isnan(x) or (math.isinf(x) and x > 0): <NEW_LINE> <INDENT> return x <NEW_LINE> <DEDENT> if x == 0.0: <NEW_LINE> <INDENT> x = 0.0 <NEW_LINE> <DEDENT> n = struct.unpack('=i', struct.pack('=f', x))[0] <NEW_LINE> if n >= 0: <NEW_LINE> <INDENT> n += 1 <NEW_LINE> <DEDENT> else: <NEW_...
Get the floating point value right after x
625941d555399d3f055888c9
def get_from_ingest_time(days_delta, hours_delta): <NEW_LINE> <INDENT> if days_delta is not None: <NEW_LINE> <INDENT> time = "{}Z".format((datetime.datetime.utcnow() - datetime.timedelta(days=days_delta)).isoformat()) <NEW_LINE> <DEDENT> elif hours_delta is not None: <NEW_LINE> <INDENT> time = "{}Z".format((datetime.da...
calculated bos ingest time based on delta in days or hours :param days_delta: :param hours_delta: :return:
625941d556b00c62f0f1486f
def get_failed(self): <NEW_LINE> <INDENT> return [test_id for test_id in self.statuses if self.statuses[test_id] == "fail"]
Returns the ids of the tests that raised a failureException during their execution.
625941d56e29344779a62825
def check_template_changed(self, template_ids, template_groups, link_templates, clear_templates, template_macros, template_content, template_type): <NEW_LINE> <INDENT> changed = False <NEW_LINE> if template_content is not None and template_type == 'xml': <NEW_LINE> <INDENT> existing_template = self.dump_template(templa...
Compares template parameters to already existing values if any are found. template_json - JSON structures are compared as deep sorted dictionaries, template_xml - XML structures are compared as strings, but filtered and formatted first, If none above is used, all the other arguments are compared to their existing coun...
625941d53539df3088e2e55f
def c_uci(self): <NEW_LINE> <INDENT> model = CoherenceModel(topics=self.topic_list, texts=self.bow, dictionary=self.dictionary, coherence='c_uci') <NEW_LINE> return model.get_coherence()
Calculates the UCI coherence score.
625941d550812a4eaa59c535
def textFromValue(self, p_int): <NEW_LINE> <INDENT> pass
QSpinBox.textFromValue(int) -> QString
625941d54c3428357757c53c
def get_known_checktags(self): <NEW_LINE> <INDENT> checktags=set([]) <NEW_LINE> for v in self.checktag_rules.itervalues(): <NEW_LINE> <INDENT> checktags|=set([x for x in v]) <NEW_LINE> <DEDENT> return checktags
Getter for all known checktags
625941d5851cf427c661a722
def move_match_position(self, direction, refcol): <NEW_LINE> <INDENT> direction = int(direction) <NEW_LINE> if direction < 0: <NEW_LINE> <INDENT> direction = -1 <NEW_LINE> <DEDENT> elif direction > 0: <NEW_LINE> <INDENT> direction = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> old_pos...
Move the match position in steps, matching first if neeeded. :param direction: Direction for moving, positive or negative :type direction: int:, ``1`` or ``-1`` :param refcol: Reference color, used for initial mathing when needed. :type refcol: lib.color.UIColor :returns: the color newly matched, if the match position...
625941d53d592f4c4ed1d27f
def get_environment_prefix(self): <NEW_LINE> <INDENT> return self.prefix
Returns the active environment prefix.
625941d54f6381625f114c50
def _save_data(self): <NEW_LINE> <INDENT> self.data.to_csv('data/c&le/{}'.format(self.name))
Saves the file in the file strategy
625941d599fddb7c1c9de5a5
def search(self, album, limit=None, page=None): <NEW_LINE> <INDENT> return self._call('GET', 'search', auth=False, album=album, limit=limit, page=page)
Search for an album by name. Returns album matches sorted by relevance. Authorization not required. http://www.last.fm/api/show/album.search :param album: required (Required) : The album name :param limit: optional (Optional) : The number of results to fetch per page. Defaults to 30. :param page: optional ...
625941d57b180e01f3dc4a0f
def abnt2_abre_chave(): <NEW_LINE> <INDENT> if press_key(ABNT2_ABRE_COLCHETE) and press_shift(): <NEW_LINE> <INDENT> return True
Retorna True ENQUANTO um dos SHIFTS e a tecla abre colchete estiverem pressionadas.
625941d5046cf37aa974cf5b
def translate_line(inputStr: str, translator) -> str: <NEW_LINE> <INDENT> hits = re.findall(u"[" + CHINESE_RANGE + u"].*", inputStr) <NEW_LINE> if len(hits) == 0: <NEW_LINE> <INDENT> return inputStr <NEW_LINE> <DEDENT> elif len(hits) > 1: <NEW_LINE> <INDENT> raise Exception("More than one hit???") <NEW_LINE> <DEDENT> e...
Returns the translation of a given string using the given translator client If the line doesn't contain Chinese characters, it is returned as is
625941d599fddb7c1c9de5a6
def affichageFinal(tauxInteret,capitalPret,duree,tauxAssurance): <NEW_LINE> <INDENT> assurance = round(capitalPret*(tauxAssurance/100),2) <NEW_LINE> assuranceMois = round(assurance/duree,2) <NEW_LINE> interet = round(capitalPret*(tauxInteret/100),2) <NEW_LINE> total = capitalPret+interet <NEW_LINE> totalMois = round(to...
Entrée : les données récupérées de l'utilisateur Sortie : l'affichage des données
625941d566673b3332b922a6
def getACL(self): <NEW_LINE> <INDENT> if not self._repository.getCapabilities()['ACL']: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> aclEls = self._xmlDoc.getElementsByTagNameNS(CMIS_NS, 'acl') <NEW_LINE> aclUrl = self._getLink(ACL_REL) <NEW_LINE> if len(aclEls) == 1: <NEW_LINE> <INDENT> return AtomPubACL(aceList=acl...
Gets the :class:`ACL` object that is included with this Change Entry.
625941d529b78933be1e58be
def close(self): <NEW_LINE> <INDENT> pass
! @brief Close WTP connection with WISP.
625941d55fc7496912cc3b93
def main(): <NEW_LINE> <INDENT> calc_ipv4_1 = CalcIPv4(ip='192.168.0.128', prefixo=30) <NEW_LINE> print(f'IP: {calc_ipv4_1.ip}') <NEW_LINE> print(f'Máscara: {calc_ipv4_1.mascara}') <NEW_LINE> print(f'Rede: {calc_ipv4_1.rede}') <NEW_LINE> print(f'Broadcast: {calc_ipv4_1.broadcast}') <NEW_LINE> print(f'Prefixo: {calc_ip...
Exemplos de Uso
625941d5fbf16365ca6f63da
def test_30_depends_extension(self): <NEW_LINE> <INDENT> mother = self.env['test.inherit.mother'] <NEW_LINE> field = mother._fields['surname'] <NEW_LINE> self.assertItemsEqual(field.depends, ['name', 'field_in_mother'])
check that @depends on overridden compute methods extends dependencies
625941d55fcc89381b1e18d5
def wait_for_rpc_connection(self): <NEW_LINE> <INDENT> poll_per_s = 4 <NEW_LINE> for _ in range(poll_per_s * self.rpc_timeout): <NEW_LINE> <INDENT> assert self.process.poll() is None, "cashgoldcoind exited with status %i during initialization" % self.process.returncode <NEW_LINE> try: <NEW_LINE> <INDENT> self.rpc = get...
Sets up an RPC connection to the cashgoldcoind process. Returns False if unable to connect.
625941d56fece00bbac2d955
def test_read_with_no_uid(self): <NEW_LINE> <INDENT> payload = get_attribute_list.GetAttributeListResponsePayload() <NEW_LINE> self.assertRaisesRegexp( exceptions.InvalidKmipEncoding, "expected uid encoding not found", payload.read, self.encoding_without_uid_with_names)
Test that an InvalidKmipEncoding error gets raised when attempting to read a GetAttributeList response encoding with no ID data.
625941d5bf627c535bc133e4
def normalize_signals(self, signals): <NEW_LINE> <INDENT> mean = np.mean(signals) <NEW_LINE> delta = np.std(signals) <NEW_LINE> return (signals - mean) / delta
N(0, 1) normalization of input signals
625941d5956e5f7376d71081
def hangman(secret_word): <NEW_LINE> <INDENT> pass
secret_word: string, the secret word to guess. Starts up an interactive game of Hangman. * At the start of the game, let the user know how many letters the secret_word contains and how many guesses s/he starts with. * The user should start with 6 guesses * Before each round, you should display to the user how ma...
625941d515fb5d323cde0d27
def urlencode(items): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return urllib.urlencode(items) <NEW_LINE> <DEDENT> except UnicodeEncodeError: <NEW_LINE> <INDENT> return urllib.urlencode([(k, smart_str(v)) for k, v in items])
A Unicode-safe URLencoder.
625941d58e71fb1e9831d9be
def getNewComputerMove(brd): <NEW_LINE> <INDENT> nvm = len(validMoves(brd.b)) <NEW_LINE> mdict = scoreMoves(brd.b, 'O', nvm) <NEW_LINE> (mm, ms) = minScore(mdict) <NEW_LINE> if dbg: print(mdict) <NEW_LINE> return mm
Get the best move for the computer :rtype : object :param brd:
625941d5e8904600ed9f2144
def add_reduce_margin(self, **kwargs): <NEW_LINE> <INDENT> return self._submit_request( method='GET', path=self.endpoint + '/private/linear/position/add-margin', query=kwargs, auth=True )
For linear markets only. Add margin. :param kwargs: See https://bybit-exchange.github.io/docs/linear/#t-addmargin. :returns: Request results as dictionary.
625941d557b8e32f524836b1
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.header is None: <NEW_LINE> <INDENT> self.header = std_msgs.msg.Header() <NEW_LINE> <DEDENT> end = 0 <NEW_LINE> _x = self <NEW_LINE> start = end <NEW_LINE> end += 12 <NEW_LINE> (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) =...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941d5187af65679ca5334
def __eq__(self, other): <NEW_LINE> <INDENT> if type(other) is type(self): <NEW_LINE> <INDENT> return self.__dict__ == other.__dict__ <NEW_LINE> <DEDENT> return NotImplemented
Overrides the default implementation, want to check if semantics are equal
625941d56fb2d068a760f2b5
@login_required <NEW_LINE> def productCreationView(request): <NEW_LINE> <INDENT> if request.method == "POST": <NEW_LINE> <INDENT> form = ProductCreationForm(request.user.id, request.POST, files=request.FILES) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> form.save() <NEW_LINE> messages.success(request, "Product Ad...
This view handles the get and post method of product creation form.
625941d54a966d76dd551226
def get_incident_extra_data( self, incident_id: int, alerts_limit: int = DEFAULT_ALERT_LIMIT ) -> Dict[str, Any]: <NEW_LINE> <INDENT> if not incident_id or not isinstance(incident_id, int): <NEW_LINE> <INDENT> self._helper.log_debug("Invalid incident ID (must be a positive integer) ID: {0}".format(incident_id)) <NEW_LI...
Gets extra incident data (i.e. alerts) given an incident ID
625941d53539df3088e2e560
def __init__(self, train_dataset, validation_dataset, model, optimizer, lr_schedule ): <NEW_LINE> <INDENT> current_time = dt.datetime.now().strftime("%Y%m%d-%H%M") <NEW_LINE> self.__log_dir = os.path.join(os.getcwd(),'classifier_logs',current_time) <NEW_LINE> self.__checkpoint_dir = os.path.join(os.getcwd(),'classifier...
__init__ method. Instantiates logs and checkpoint directories, as well as relevant callbacks to be used for training :params: tf.keras.Dataset train_dataset: Training dataset tf.keras.Dataset validataion_dataset: Training dataset tf.keras.Model model: Classifier Model. Typically one pre-trained on Imagenet...
625941d52ae34c7f2600d346
def get_all(self, **kwargs): <NEW_LINE> <INDENT> all_params = ['page_index', 'page_size', 'sort', 'q'] <NEW_LINE> all_params.append('callback') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> if key not in all_params: <NEW_LINE> <INDENT> raise TypeError( "Got an ...
Gets all Product Milestones This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_all(callback=callback_functio...
625941d5dd821e528d63b3bd
def test_change_t0(self): <NEW_LINE> <INDENT> Tlist = np.array([300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) <NEW_LINE> k0list = np.array([self.arrhenius.get_rate_coefficient(T) for T in Tlist]) <NEW_LINE> self.arrhenius.change_t0(300) <NEW_LINE> self.assertEqual(self.arrhenius.T0.value_si, 3...
Test the Arrhenius.change_t0() method.
625941d5fff4ab517eb2f651
def edit_document_docx_replace_paragraph(self, req_config, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.edit_document_docx_replace_paragraph_with_http_info(req_config, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>...
Replace matching paragraphs in a Word DOCX document # noqa: E501 Returns the edited Word Document (DOCX) format file with the matching paragraphs replaced as requested. Replace a paragraph with another object such as an image. Useful for performing templating operations. # noqa: E501 This method makes a synchronou...
625941d5566aa707497f477b
def make_dist2_prox(f): <NEW_LINE> <INDENT> return lambda v,s: (f + (v / s)) / (1+1./s)
Creates proximal operator for the function
625941d576d4e153a657ed47
def get_coverage_by_job_ids(job_ids): <NEW_LINE> <INDENT> if not job_ids: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> return FileCoverage.query.filter( FileCoverage.job_id.in_(job_ids) )
Returns the coverage associated with some jobs. The dictionary maps file names to a string of the form 'UNCCCNCU', where U means 'uncovered', C means 'covered' and 'N' means 'no coverage info'.
625941d58e7ae83300e4b1e2
def created_previous_week(self): <NEW_LINE> <INDENT> one_week_delta = timedelta(days=7) <NEW_LINE> one_week_before = now() - one_week_delta <NEW_LINE> two_weeks_before = one_week_before - one_week_delta <NEW_LINE> return self.filter(date_created__lte=one_week_before, date_created__gte=two_weeks_before)
Return items created between 8 and 14 days inclusive.
625941d5d18da76e235326ed
def get_arn(name, region=None, key=None, keyid=None, profile=None): <NEW_LINE> <INDENT> if name.startswith("arn:aws:sns:"): <NEW_LINE> <INDENT> return name <NEW_LINE> <DEDENT> account_id = __salt__["boto_iam.get_account_id"]( region=region, key=key, keyid=keyid, profile=profile ) <NEW_LINE> return "arn:aws:sns:{}:{}:{}...
Returns the full ARN for a given topic name. CLI Example: .. code-block:: bash salt myminion boto_sns.get_arn mytopic
625941d5bd1bec0571d90845
def get_allele_frequency(self, pop_pos, locus_name): <NEW_LINE> <INDENT> if len(self.__allele_frequency) == 0: <NEW_LINE> <INDENT> geno_freqs = self._controller.calc_allele_genotype_freqs(self._fname) <NEW_LINE> pop_iter, loc_iter = geno_freqs <NEW_LINE> for locus_info in loc_iter: <NEW_LINE> <INDENT> if locus_info[0] ...
Calculate the allele frequency for a certain locus on a population.
625941d550485f2cf553cfb0
def mad(data, axis=None, sigma=False): <NEW_LINE> <INDENT> mad = np.median(np.absolute(data - np.median(data, axis)), axis) <NEW_LINE> if sigma: <NEW_LINE> <INDENT> mad *= 1.4826 <NEW_LINE> <DEDENT> return mad
Median absolute deviation. Parameters ---------- x : array_like The sample values. w : array_like, optional Weights for sample values. sigma : boolean Convert to 1-sigma estimate.
625941d53eb6a72ae02ec6f6
def disable_tags(self): <NEW_LINE> <INDENT> if not self.id: <NEW_LINE> <INDENT> raise InvalidObjectError("missing Watchlist ID") <NEW_LINE> <DEDENT> url = "/threathunter/watchlistmgr/v3/orgs/{}/watchlists/{}/tag".format( self._cb.credentials.org_key, self.id ) <NEW_LINE> self._cb.delete_object(url)
Disable tagging for this watchlist. :raise InvalidObjectError: if `id` is missing
625941d5283ffb24f3c55b15
def get_pref_dir(xy, index): <NEW_LINE> <INDENT> xy_affine = np.subtract(xy, xy[index]) <NEW_LINE> vectors = np.delete(xy_affine, index, axis=0) <NEW_LINE> norms = np.apply_along_axis(np.linalg.norm,1,vectors) <NEW_LINE> normalized = (vectors.T/norms).T <NEW_LINE> pref_dir_normalized = np.sum(normalized,0)/float(len(no...
input: [[4,1],[7,-3],[5,1],[6,3]], 0 output: [ 0.76903559, -0.03096441]
625941d591f36d47f21ac709
def read_data_model ( self, file_name ): <NEW_LINE> <INDENT> if (file_name[-5:].lower() == '.json'): <NEW_LINE> <INDENT> print ( "Opening a JSON file" ) <NEW_LINE> f = open ( file_name, 'r' ) <NEW_LINE> json_model = f.read() <NEW_LINE> data_model = json.loads ( json_model ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>...
Return a data model read from a named file
625941d576e4537e8c351889
def valid_packet(data): <NEW_LINE> <INDENT> global packet_count <NEW_LINE> packet_count += 1
Callback to handle arrival of a valid packet
625941d5cc40096d61595b65
def optimizeJob(self, jid, jobState): <NEW_LINE> <INDENT> result = jobState.getAttribute("JobType") <NEW_LINE> if not result["OK"]: <NEW_LINE> <INDENT> self.jobLog.error("Could not retrieve job type", result["Message"]) <NEW_LINE> return result <NEW_LINE> <DEDENT> jobType = result["Value"] <NEW_LINE> if jobType in Oper...
This is the method that needs to be implemented by each and every Executor This optimizer will run if and only if it is needed: - it will run only if there are input files - for production jobs this can be skipped, since the logic is already applied by the transformation system, via the TaskManagerPlugins
625941d591af0d3eaac9bc30
def __getitem__(self, index): <NEW_LINE> <INDENT> return self.tasks[index]
Returns the created or registered task at the specified `index`
625941d5d6c5a10208144261
def print_register(register_name): <NEW_LINE> <INDENT> register = find_register(register_name) <NEW_LINE> if not register: <NEW_LINE> <INDENT> print("No register with name: " + register_name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> reset_all_register_instructions() <NEW_LINE> print(register.evaluate())
Prints the value of the given register by calling evaluate()
625941d510dbd63aa1bd2db8
def limited_int(x): <NEW_LINE> <INDENT> return min(max(int(round(x)), minint), maxint)
Limit the value of integers. Return the value of the input argument converted to an integer and limited to C longs.
625941d53346ee7daa2b2f82
def is_stressful(subj): <NEW_LINE> <INDENT> Bool = False <NEW_LINE> l = ["\S*".join(word) for word in ["help", "asap", "urgent"]] <NEW_LINE> for i in l : <NEW_LINE> <INDENT> pattern = re.compile(i) <NEW_LINE> match = pattern.search(subj.lower()) <NEW_LINE> if match : <NEW_LINE> <INDENT> Bool = True <NEW_LINE> <DEDENT>...
recoognise stressful subject
625941d57d847024c06be4d4
def clique_unions(clique_indices, limit): <NEW_LINE> <INDENT> combos = [] <NEW_LINE> for l in range(1, limit + 1): <NEW_LINE> <INDENT> for combo in itertools.combinations(clique_indices, l): <NEW_LINE> <INDENT> combos.append(tuple(combo)) <NEW_LINE> <DEDENT> <DEDENT> return combos
clique_unions Create combinations of cliques up to limit. Parameters ---------- clique_indices : :obj:`iter` of :obj:`int` List of indices of cliques. limit : :obj:`int` The maximum number of cliques in each union. Returns ------- combos : :obj:`iter` of :obj:`iter` of :obj:`int` Tuples o...
625941d5a05bb46b383eca37
def show_collection(collection_id): <NEW_LINE> <INDENT> result = musicbrainzngs.get_releases_in_collection(collection_id, limit=25) <NEW_LINE> collection = result['collection'] <NEW_LINE> release_list = collection['release-list'] <NEW_LINE> if "release-count" in collection: <NEW_LINE> <INDENT> release_count = collectio...
Show the list of releases in a given collection.
625941d5f8510a7c17cf9912
def test_update_conference(self): <NEW_LINE> <INDENT> estimated_request = { 'state': 'completed', 'mute': None, 'hold': None, 'callbackUrl': None, 'callbackTimeout': None, 'callbackHttpMethod': None, 'fallbackUrl': None, 'tag': None } <NEW_LINE> with patch('requests.request', return_value=create_response(200)) as p: <N...
update_conference() should update a conference
625941d5851cf427c661a723
def test_0(self): <NEW_LINE> <INDENT> error_output = 'file lab7i.py cannot be found(HINT: make sure you AND your file are in the correct directory)' <NEW_LINE> self.assertTrue(os.path.exists('./lab7i.py'), msg=error_output)
[Lab 7] - [Investigation 3] - [Part 3] - Local/Global Scope - Test for file creation: ./lab7i.py
625941d5097d151d1a22306e
def createnote(self, note_title, note_content): <NEW_LINE> <INDENT> with self.connection: <NEW_LINE> <INDENT> self.cursor.execute( "INSERT INTO NotesEntries(time_created,note_title,note_content) VALUES ('{}','{}','{}')".format( datetime.now(), note_title, note_content))
Inserting a note into the database :rtype: object :param note_content: :param note_title:
625941d5a934411ee37518a9
def get_value_sync(self, timeout=None, default=None, error_on_fail=True, error_on_skip=True, pass_exception=True): <NEW_LINE> <INDENT> res=QThreadNotifier.get_value_sync(self,timeout=timeout) <NEW_LINE> if res is not None: <NEW_LINE> <INDENT> kind,value=res <NEW_LINE> if kind=="result": <NEW_LINE> <INDENT> return value...
Wait (with the given `timeout`) for the value passed by the notifier If ``error_on_fail==True`` and the controlled thread notifies of a fail (usually, if it's stopped before it executed the call), raise :exc:`.qt.thread.threadprop.NoControllerThreadError`; otherwise, return `default`. If ``error_on_skip==True`` and th...
625941d5287bf620b61d3c79
def random_id(request): <NEW_LINE> <INDENT> uniqueID = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(16)) <NEW_LINE> return JsonResponse({'id': uniqueID})
:param request: :return: Returns a random string of 16 characters
625941d5be7bc26dc91cd813