code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def do_showDiffWithServer( self, dummy ): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> diffData = self.modificator.showCurrentDiff() <NEW_LINE> print("Diff with latest from server ( + local - remote )") <NEW_LINE> for line in diffData: <NEW_LINE> <INDENT> if line[0] in ( '-' ): <NEW_LINE> <INDENT> print(colorize(line, ...
Shows diff with lastest version in server Usage: showDiffWithServer
625941e48e05c05ec3eea78d
def handle_help_error(sql, sql_arr, dbms_settings, static_string): <NEW_LINE> <INDENT> print("Help:" + static_string.COMMAND_ERROR)
处理 help 命令出现错误
625941e44f88993c3716c478
def compareSimWithDesign(self, sim_output_file: str = "output_results.txt", plot: bool = True) -> bool: <NEW_LINE> <INDENT> self.data_out = import_binary(self.sim_dir + sim_output_file, self.output_width, self.output_ss) <NEW_LINE> print(self.data_out) <NEW_LINE> if (self.data_out == self.data_out_exp).all: <NEW_LINE> ...
compare HDL simulation data with the expected design output data. Parameters ---------- sim_output_file : str file name of the output data from HDL simulation plot : bool when True, plot the comparision between simulation and design Returns ------- pass_exam : bool
625941e4187af65679ca5535
def test_created_new_align_software_minimal(self): <NEW_LINE> <INDENT> test_software = SequenceAlignmentSoftware(name = "Test Software", version="1.0.1") <NEW_LINE> test_software.save() <NEW_LINE> self.assertEqual(test_software.pk, 1)
This test that a :class:`~experiments.models.SequenceAlignmentSoftware` can be created.
625941e4dc8b845886cb594c
def mobilenetv3_large_w5d4(**kwargs): <NEW_LINE> <INDENT> return get_mobilenetv3(version="large", width_scale=1.25, model_name="mobilenetv3_large_w5d4", **kwargs)
MobileNetV3 Large 224/1.25 model from 'Searching for MobileNetV3,' https://arxiv.org/abs/1905.02244. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which to load the pretrained weights. root : str, default '~/....
625941e47b180e01f3dc4c0a
@cli.group(short_help="RAID Recipe") <NEW_LINE> def raid(): <NEW_LINE> <INDENT> pass
Group for all RAID recipe functions
625941e431939e2706e4d279
def mix_different_time(Q, number_opinion, x): <NEW_LINE> <INDENT> mix_vector = np.zeros((number_opinion, number_opinion-1)) <NEW_LINE> mix_vector[:, 0] = x[-1] * (1-Q[-1]) + (sum(x[-1]) -x[-1]) * Q[-1] <NEW_LINE> for i in range(number_opinion): <NEW_LINE> <INDENT> mask = np.ones(np.size(Q, 1), dtype = bool) <NEW_LINE> ...
TODO: Docstring for function. :arg1: TODO :returns: TODO
625941e4a4f1c619b28b0445
def fake_KATCP_client_resource_factory( KATCPClientResourceClass, fake_options, resource_spec, *args, **kwargs): <NEW_LINE> <INDENT> allow_any_request = fake_options.get('allow_any_request', False) <NEW_LINE> class FakeKATCPClientResource(KATCPClientResourceClass): <NEW_LINE> <INDENT> def inspecting_client_factory(self...
Create a fake KATCPClientResource-like class and a fake-manager Parameters ---------- KATCPClientResourceClass : class Subclass of :class:`katcp.resource_client.KATCPClientResource` fake_options : dict Options for the faking process. Keys: allow_any_request : bool, default False (TODO not imple...
625941e416aa5153ce36288d
def test_views_floors_types(self): <NEW_LINE> <INDENT> kwargs = {'uri': '{}types/'.format(self.base_uri)} <NEW_LINE> response = self.get_items(**kwargs) <NEW_LINE> assert response.status_code == 200 <NEW_LINE> assert len(response.json) > 0 <NEW_LINE> etag_value = response.headers.get('etag', None) <NEW_LINE> response =...
Test get_list floor types api endpoint
625941e482261d6c526ab8bb
def OnTokenEdit(self, evt): <NEW_LINE> <INDENT> snum, toknum = evt.index <NEW_LINE> startchar, charlength = self.charspans[toknum] <NEW_LINE> senttoken = self.text[startchar:startchar+charlength] <NEW_LINE> if not senttoken == evt.token: <NEW_LINE> <INDENT> self.UpdateText(startchar, startchar+charlength, evt.token, sn...
update sentence text after token edit
625941e4796e427e537b09df
@jit <NEW_LINE> def gcd(*a): <NEW_LINE> <INDENT> if len(a) > 1: <NEW_LINE> <INDENT> return reduce(gcd2, a) <NEW_LINE> <DEDENT> if hasattr(a[0], "__iter__"): <NEW_LINE> <INDENT> return reduce(gcd2, a[0]) <NEW_LINE> <DEDENT> return a[0]
Greatest common divisor. Usage: gcd([ 2, 4, 6 ]) or: gcd(2, 4, 6)
625941e4e8904600ed9f2348
def csv_to_df(file): <NEW_LINE> <INDENT> df = pd.read_csv(file.name, parse_dates=True) <NEW_LINE> df = df.dropna(axis=1, how='all') <NEW_LINE> return df
Create df from csv.
625941e466656f66f7cbc5c2
def test_anonymous_has_not_view_perm_of_draft(self): <NEW_LINE> <INDENT> obj = AnnouncementFactory(pub_state='draft') <NEW_LINE> user = AnonymousUser() <NEW_LINE> self.assertFalse(user.has_perm('announcements.view_announcement', obj))
非ログインユーザ-は下書きお知らせを見ることができない
625941e4379a373c97cfaf5c
def get_prefix(self, prefix): <NEW_LINE> <INDENT> key = prefix + self.SEPARATOR <NEW_LINE> if len(key) != self.PREFIX_FIXED_LEN: <NEW_LINE> <INDENT> Log.fatal("Invalid prefixed key length, got {v}", v=len(key)) <NEW_LINE> <DEDENT> return key
Prefix getter. Appends a separator and returns prefix. Args: prefix (str): The prefix to return. Raises: Exception: If size of prefix exceeds. Returns: str: New string of prefix with separator.
625941e4ff9c53063f47c607
def listenBoard(): <NEW_LINE> <INDENT> sysHotkey = pyhk.pyhk() <NEW_LINE> sysHotkey.addHotkey(['Ctrl','Alt','Z'], emitShowSig) <NEW_LINE> sysHotkey.addHotkey(['Ctrl','Alt','F12'], emitQuitSig) <NEW_LINE> sysHotkey.start()
监听键盘线程
625941e46aa9bd52df0371bc
def _is_in_graph(tensor_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> tf.get_default_graph().get_tensor_by_name(tensor_name) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
Checks whether a given tensor does exists in the graph.
625941e4c432627299f0505e
def is_eligible_for(self, task_type: str) -> bool: <NEW_LINE> <INDENT> assert task_type, 'Empty parameter `task_type` passed' <NEW_LINE> return self.admin or task_type in chain(*(g.allowed_types for g in self.groups))
Check that user is authorized to work with this tasks type :param task_type: Tasks type name :type task_type: str :return: True if user is eligible :rtype: bool :raises: AssertionError - if no `task_type` specified
625941e4d8ef3951e3243953
def start_requests(self): <NEW_LINE> <INDENT> yield Request(self.user_url.format(user=self.start_user, include=self.user_query), self.parse_user) <NEW_LINE> yield Request(self.followers_url.format(user=self.start_user, include=self.followers_query, offset=0, limit=20), callback=self.parse_followers) <NEW_LINE> yield Re...
spider中初始的request是通过调用start_requests()来获取的
625941e4f7d966606f6aa41e
def compute_predictions(self, test_data): <NEW_LINE> <INDENT> sorties = [] <NEW_LINE> sorties = self.fprop(test_data.T) <NEW_LINE> return sorties
Appelle fprop pour prédire la sortie d'une matrice de données
625941e426068e7796caf0fa
def handle_exception(exc, *, _Done=Done, _type=type, _getframe=sys._getframe, _isinstance=isinstance, _Word=Word, _clear_cstack=clear_cstack): <NEW_LINE> <INDENT> if _isinstance(exc, _Done): <NEW_LINE> <INDENT> raise Done() <NEW_LINE> <DEDENT> f = _getframe(1) <NEW_LINE> cstack = _clear_cstack(f) <NEW_LINE> print( 'tra...
Handle exceptions that are raised during phorth operations. Parameters ---------- exc : Exception The exception that was raised. Notes ----- This normally just prints the exception and restarts jumps us to the start of the repl with a clean stack. If ``exc`` is an instance of ``Done``, this will reraise the excep...
625941e4d58c6744b4258074
def train(self, epochs=100, batch_size=4): <NEW_LINE> <INDENT> data_loader_train = DataLoader(self.train_set, batch_size=batch_size, shuffle=True, collate_fn=self.train_set.collate_fn_yolo) <NEW_LINE> data_loader_val = DataLoader(self.valid_set, batch_size=1, shuffle=False, collate_fn=self.valid_set.collate_fn_yolo) <N...
Train network function Arguments: @param net: network model @param epochs: number of training epochs (int) @param batch_size: batch size (int)
625941e4b57a9660fec33c9f
def getOutcome(self, examples, trueHypothesis, lambda_noise = 0.05): <NEW_LINE> <INDENT> self.exampleSpace = list() <NEW_LINE> trueHypothesis = set(trueHypothesis) <NEW_LINE> for i in range(len(examples)): <NEW_LINE> <INDENT> self.exampleSpace.append(self.getExampleSpace(examples[i])) <NEW_LINE> if any([set([e]).issubs...
Returns the examples, tagged with whether they would turn the blicket detector on or off. Used as a helper function for the updaters. Params: examples - a list of block examples e.g. ['A','B','C',['A','B'],['AB']] trueHypothesis - the combination that turns on the blicket detector e.g. ['AB'] lambda_noise ...
625941e4236d856c2ad44bf5
def delete_firewall_address(self, version, address_name): <NEW_LINE> <INDENT> api_url = self.urlapi + 'address-objects/' + version + '/name/' + address_name <NEW_LINE> if not self.does_exist(api_url): <NEW_LINE> <INDENT> return 404 <NEW_LINE> <DEDENT> result = self.delete(api_url) <NEW_LINE> if result == 200: <NEW_LINE...
Delete firewall address record :param version: Type of address objects. Expected values are ipv4, ipv6, mac, fqdn :param address_name: Address record to be deleted :return: HTTP status code returned from DELETE operation
625941e48c3a8732951587d5
def __init__(self): <NEW_LINE> <INDENT> self.BizAppId = None <NEW_LINE> self.CallId = None <NEW_LINE> self.Src = None <NEW_LINE> self.StartTimeStamp = None <NEW_LINE> self.EndTimeStamp = None
:param BizAppId: 业务appid :type BizAppId: str :param CallId: 回拨请求响应中返回的 callId,按 callId 查询该话单详细信息 :type CallId: str :param Src: 查询主叫用户产生的呼叫话单,如填空表示拉取这个时间段所有话单 :type Src: str :param StartTimeStamp: 话单开始时间戳 :type StartTimeStamp: str :param EndTimeStamp: 话单结束时间戳 :type EndTimeStamp: str
625941e43539df3088e2e761
def normalize_dataset(dataset): <NEW_LINE> <INDENT> columns = dataset.columns <NEW_LINE> array = dataset.values <NEW_LINE> scaler = StandardScaler() <NEW_LINE> array = scaler.fit_transform(array) <NEW_LINE> return pd.DataFrame(data=array, columns=columns), scaler
Function to normalize dataset with StandardScaler. :param dataset: pd.DataFrame
625941e4507cdc57c63070f9
def test_admin_page_type_changelist_page(self): <NEW_LINE> <INDENT> response = self.client.get(reverse('admin:ninecms_pagetype_changelist')) <NEW_LINE> self.assertContains(response, '<th class="field-name"><a href="%s">%s</a></th>' % ( reverse('admin:ninecms_pagetype_change', args=(self.node_rev_basic.node.page_type_id...
Test that page type changelist page renders properly :return: None
625941e4f8510a7c17cf9b14
def operation(strict=True): <NEW_LINE> <INDENT> def decorator(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapper(self, index, *args, **kwargs): <NEW_LINE> <INDENT> if self.reference: <NEW_LINE> <INDENT> result = getattr(self.pointee, func.__name__)(index, *args, **kwargs) <NEW_LINE> <DEDENT> elif ...
Decorator to handle the entries as a tree. Entries are seen as a tree, and the goal entry is designated with a list of keys. This decorator assures the finding of the good entry before the operation is done
625941e48a349b6b435e8588
def test_move_detection_with_replace_lines(self): <NEW_LINE> <INDENT> self._test_move_detection( [ 'this is line 1, and it is sufficiently long', '-------------------------------------------', '-------------------------------------------', 'this is line 2, and it is sufficiently long', ], [ 'this is line 2, and it is s...
Testing diff viewer move detection with replace lines
625941e463f4b57ef0001523
def validate_path(self, path): <NEW_LINE> <INDENT> valid = True <NEW_LINE> if not path: <NEW_LINE> <INDENT> valid = False <NEW_LINE> return valid <NEW_LINE> <DEDENT> if not os.path.isfile(path): <NEW_LINE> <INDENT> valid = False <NEW_LINE> return valid <NEW_LINE> <DEDENT> if not os.stat(path).st_size: <NEW_LINE> <INDEN...
validate a given path is ok to perform operations on - namely that it: 1) is not blank/none 2) is indeed a file (as opposed to a directory) 3) is not empty :param path: string full path to obj :return: valid :rtype: bool
625941e4d7e4931a7ee9e334
@deprecated(details="Deprecated: Use SSE for IEX Cloud") <NEW_LINE> def ssrStatusWS(symbols=None, on_data=None): <NEW_LINE> <INDENT> symbols = _strToList(symbols) <NEW_LINE> sendinit = ({"symbols": symbols, "channels": ["ssr"]},) <NEW_LINE> return _stream(_wsURL("deep"), sendinit, on_data)
https://iextrading.com/developer/docs/#short-sale-price-test-status
625941e429b78933be1e5abc
def register_app_blueprints(app): <NEW_LINE> <INDENT> from app.mod_home import home <NEW_LINE> app.register_blueprint(home)
Registers the application blueprints :param app: the current flask app
625941e4cc40096d61595d65
def load_example_posts(self, new_user, total_posts=10): <NEW_LINE> <INDENT> post_words = ['In', 'the', 'story', 'there', 'was', 'stuff'] <NEW_LINE> for post_item in range(total_posts): <NEW_LINE> <INDENT> random.shuffle(post_words) <NEW_LINE> body = ' '.join(post_words) <NEW_LINE> body += ' Post number: %s' % post_item...
App context is already established, so connect to the db directly and add a variety of example posts.
625941e4b7558d58953c5321
def reset(self): <NEW_LINE> <INDENT> self.__board = [[0 for _ in range(15)] for _ in range(15)]
Clear the board (set all position to 0).
625941e55fcc89381b1e1ad7
def __init__(self, net: WaterMark, data_loader: DataLoader, out_inv=100, device='cpu'): <NEW_LINE> <INDENT> self.net = net <NEW_LINE> self.data_loader = data_loader <NEW_LINE> self.vis = visdom.Visdom() <NEW_LINE> self.out_inv = out_inv <NEW_LINE> self.device = device
The trainer for watermark net :param net: main network :param data_loader: data loader to load images :param out_inv: define output interval between each train :param device: the device use to train the network
625941e4c4546d3d9de72e4d
def fetchMessage(self, messageIdx): <NEW_LINE> <INDENT> return self.__messages[messageIdx]
Fetch the Message with index messageIdx.
625941e499fddb7c1c9de7a4
def climbStairs(self, n): <NEW_LINE> <INDENT> def jc(num): <NEW_LINE> <INDENT> r = 1 <NEW_LINE> for i in range(2,num+1): <NEW_LINE> <INDENT> r *= i <NEW_LINE> <DEDENT> return r <NEW_LINE> <DEDENT> i = 2 <NEW_LINE> re = 1 <NEW_LINE> while i <= n: <NEW_LINE> <INDENT> re += (jc(n-i+(i>>1)) / jc(i>>1) / jc(n-i)) <NEW_LINE>...
:type n: int :rtype: int
625941e4167d2b6e31218faa
def __setitem__(self, tablename, joins): <NEW_LINE> <INDENT> master = self.tablename <NEW_LINE> joins_dict = self.joins <NEW_LINE> tables = current.db._adapter.tables <NEW_LINE> joins_dict[tablename] = joins <NEW_LINE> if len(joins) > 1: <NEW_LINE> <INDENT> for join in joins: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT...
Update the joins for a table Args: tablename: the tablename joins: the list of joins for this table
625941e4167d2b6e31218fab
def _get_source_model(source_file, inv_time, simple_mesh_spacing=10.0, complex_mesh_spacing=10.0, mfd_spacing=0.1, area_discretisation=20.): <NEW_LINE> <INDENT> conv = SourceConverter(inv_time, simple_mesh_spacing, complex_mesh_spacing, mfd_spacing, area_discretisation) <NEW_LINE> parser = SourceModelParser(conv) <NEW_...
Read and build a source model from an xml file :parameter source_file :parameter inv_time: :paramater simple_mesh_spacing: :parameter complex_mesh_spacing: :parameter mfd_spacing: :parameter area_discretisation: :returns:
625941e415baa723493c438e
def invite_user(slack_id, channel): <NEW_LINE> <INDENT> data = { 'token': ACCESS_TOKEN, 'channel': channel, 'user': slack_id } <NEW_LINE> response = requests.post("https://slack.com/api/channels.invite", headers= HEADERS, data=data) <NEW_LINE> print(response.text)
# invites a user to a channel :param slack_id: the id of the user to invite :param channel: the channel to invite to :return: N/A
625941e4ac7a0e7691ed44da
def GetNumSubSections(self): <NEW_LINE> <INDENT> return _lldb.SBSection_GetNumSubSections(self)
GetNumSubSections(SBSection self) -> size_t
625941e507f4c71912b1189a
def join(params: Dict, **data: Dict) -> Dict: <NEW_LINE> <INDENT> crd1 = data.get('crd1',{}) <NEW_LINE> crd2 = data.get('crd2',{}) <NEW_LINE> crd3 = data.get('crd3',{}) <NEW_LINE> im1 = data.get('imfound1', None) <NEW_LINE> im2 = data.get('imfound2', None) <NEW_LINE> im3 = data.get('imfound3', None) <NEW_LINE> images =...
Joins find tempalte results Parameters: - params: - data: imfound1: ndarray; the image from the location on the input image imfound2: ndarray; the image from the location on the input image imfound3: ndarray; the image from the location on the input image crd1: Dict[str,str]={}; 1-st coordinates s...
625941e59b70327d1c4e11ed
def make_post_check(data_width, sign): <NEW_LINE> <INDENT> def post_check(output_path): <NEW_LINE> <INDENT> expected = ", ".join([str(data_width), str(sign).lower()]) + "\n" <NEW_LINE> output_file = join(output_path, "generics.txt") <NEW_LINE> print("Post check: %s" % output_file) <NEW_LINE> with open(output_file, "r")...
Return a check function to verify test case output
625941e5be7bc26dc91cda0e
def pick(self, target): <NEW_LINE> <INDENT> count=0 <NEW_LINE> idx=0 <NEW_LINE> for i in range(len(self.n)): <NEW_LINE> <INDENT> if self.n[i]!=target: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> count+=1 <NEW_LINE> k=random.randint(1,count) <NEW_LINE> if k==1: <NEW_LINE> <INDENT> idx=i <NEW_LINE> <DEDENT> <DEDENT>...
:type target: int :rtype: int
625941e5d486a94d0b98e55d
def _get_set_bit_on_boot(self): <NEW_LINE> <INDENT> return self.__set_bit_on_boot
Getter method for set_bit_on_boot, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/global/lsp_bit/overload_bit/state/set_bit_on_boot (boolean) YANG Description: When set to true, the IS-IS overload bit is set on system boot.
625941e5498bea3a759b9ec4
def to_polar_coordinates(x, y): <NEW_LINE> <INDENT> theta = math.atan2(y, x) <NEW_LINE> if theta < 0: <NEW_LINE> <INDENT> theta = theta + 2 * math.pi <NEW_LINE> <DEDENT> return math.hypot(x, y), theta
Convert the 2D pixel coordinates to polar coordinates :param x: x coordinate of the point :param y: y coordinate of the point :returns: tuple -- (r,phi) of the point as polar coordinates
625941e5d164cc6175783165
def concept_id(patientID, start_date, number_of_day=1, mode='all', whether_print=False, ): <NEW_LINE> <INDENT> anno_list = list() <NEW_LINE> end_boundry = start_date-number_of_day <NEW_LINE> pre_date = start_date-1 <NEW_LINE> if mode == 'all': <NEW_LINE> <INDENT> input_path = 'Clinical_Note/'+str(patientID)+'/csv_all_e...
用以比較病例,從未出現過的CUI,才會被標注 Args: patientID (int): 輸入病人ID start_date (str): 目標病例,輸入第幾天 number_of_days (int, optional): 欲往前比較天數. Defaults to 1. mode (str, optional):選擇比較模式 whether_print(bool, optional):要不要列印出比較結果 Returns: list: 傳回要標注的新資訊位置 行, 字元
625941e599fddb7c1c9de7a5
def getHotKeyFromEvent(self, event): <NEW_LINE> <INDENT> key = event.key() <NEW_LINE> txt = str(event.text()) <NEW_LINE> mods = int(event.modifiers()) <NEW_LINE> keytxt = None <NEW_LINE> if key < 255: <NEW_LINE> <INDENT> keytxt = chr(key).lower() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> keytxt = special_keys.get(k...
A utility to retrieve the keystr from a QT keystroke event.
625941e5b57a9660fec33ca0
def delete_token(self, token_id): <NEW_LINE> <INDENT> token_id = urllib.quote_plus(str(token_id)) <NEW_LINE> path = '/admin/v1/tokens/' + token_id <NEW_LINE> self.json_api_call('DELETE', path, {})
Deletes a token. If the token is already deleted, does nothing. token_id - Token ID Returns nothing on success.
625941e58a43f66fc4b54477
def to_words(ids, vocabs, delimiter=""): <NEW_LINE> <INDENT> return delimiter.join(vocabs[x] for x in ids)
将id表示的内容转换为文字
625941e566673b3332b924a7
def get_all_nearest_neighbors(method, structure): <NEW_LINE> <INDENT> if isinstance(structure, Structure): <NEW_LINE> <INDENT> structure = IStructure.from_sites(structure) <NEW_LINE> <DEDENT> return _get_all_nearest_neighbors(method, structure)
Get the nearest neighbor list of a structure Args: method (NearNeighbor) - Method used to compute nearest neighbors structure (IStructure) - Structure to study Returns: Output of `method.get_all_nn_info(structure)`
625941e54c3428357757c73c
def ListeMoyenneEleve(idSequence, idClasse): <NEW_LINE> <INDENT> liste = [] <NEW_LINE> listeEleve = ListeEleveClasse(idClasse) <NEW_LINE> for eleve in listeEleve: <NEW_LINE> <INDENT> liste.append((eleve, GetMoyenneEleve(idEleve, idSequence))) <NEW_LINE> <DEDENT> return liste
Recupere toutes les moyennes de tout les eleves d'une classe pour une sequence
625941e5fff4ab517eb2f854
def _get_package(package) -> ModuleType: <NEW_LINE> <INDENT> if hasattr(package, '__spec__'): <NEW_LINE> <INDENT> if package.__spec__.submodule_search_locations is None: <NEW_LINE> <INDENT> raise TypeError('{!r} is not a package'.format( package.__spec__.name)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return packa...
Take a package name or module object and return the module. If a name, the module is imported. If the passed or imported module object is not a package, raise an exception.
625941e592d797404e3045a2
def parents(self, vertex): <NEW_LINE> <INDENT> return [self.tail(edge) for edge in self.in_edges(vertex)]
Return the list of immediate parents of this vertex.
625941e50fa83653e46573ce
def _(text, disambiguation=None, context='Image'): <NEW_LINE> <INDENT> return qt.QCoreApplication.translate(context, text, disambiguation)
Translate text.
625941e52eb69b55b151cccb
def chhome(name, home): <NEW_LINE> <INDENT> pre_info = info(name) <NEW_LINE> if not pre_info: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if home == pre_info['home']: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> cmd = ['net', 'user', name, '/homedir:{0}'.format(home)] <NEW_LINE> if __salt__['cmd.retcode...
Change the home directory of the user CLI Example: .. code-block:: bash salt '*' user.chhome foo \\fileserver\home\foo
625941e57b180e01f3dc4c0b
def test_get_last_item_field(self): <NEW_LINE> <INDENT> items = json.loads(read_file('data/git.json')) <NEW_LINE> elastic = ElasticSearch(self.es_con, self.target_index, GitOcean.mapping) <NEW_LINE> new_items = elastic.bulk_upload(items, field_id="uuid") <NEW_LINE> self.assertEqual(new_items, 11) <NEW_LINE> last_date =...
Test whether the date/offset of the last item is correctly returned
625941e521a7993f00bc810d
def __get_cords(): <NEW_LINE> <INDENT> return ask_xy(player=True), ask_xy(player=True)
This function is used to call ask_xy twice. just because I can. :return: Returns the values of ask_xy
625941e555399d3f05588acd
def start_stream(request: HttpRequest) -> dict: <NEW_LINE> <INDENT> stream_type = request.POST.get('type') <NEW_LINE> if stream_type is 'hls': <NEW_LINE> <INDENT> return start_hls_stream(request) <NEW_LINE> <DEDENT> raise NotImplementedError
Prepare for a new stream on behalf of the request's author. This involves provisioning remote storage for the stream media and returning any necessary data for the streaming client. :param request: :return:
625941e5d6c5a10208144464
def get_ngrams(inputfile, n=1, use_transcript=False, use_vtt=False): <NEW_LINE> <INDENT> words = [] <NEW_LINE> if use_transcript: <NEW_LINE> <INDENT> for s in audiogrep.convert_timestamps(inputfile): <NEW_LINE> <INDENT> for w in s['words']: <NEW_LINE> <INDENT> words.append(w[0]) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> el...
Get ngrams from a text Sourced from: https://gist.github.com/dannguyen/93c2c43f4e65328b85af
625941e5a934411ee3751aab
def panic() -> None: <NEW_LINE> <INDENT> pass
Put micro:bit in panic() mode and display an unhappy face. Press the reset button to exit panic() mode.
625941e573bcbd0ca4b2c48b
def _check_counts(self, counts): <NEW_LINE> <INDENT> counts = ops.convert_to_tensor(counts, name="counts") <NEW_LINE> if not self.validate_args: <NEW_LINE> <INDENT> return counts <NEW_LINE> <DEDENT> candidate_n = math_ops.reduce_sum(counts, reduction_indices=[-1]) <NEW_LINE> return control_flow_ops.with_dependencies([ ...
Check counts for proper shape, values, then return tensor version.
625941e55e10d32532c5f33c
def largestTriangleArea(self, points): <NEW_LINE> <INDENT> import math <NEW_LINE> def get_area(p0, p1, p2): <NEW_LINE> <INDENT> def get_length(p0, p1): <NEW_LINE> <INDENT> return math.sqrt((p0[0]-p1[0])**2 + (p0[1]-p1[1])**2) <NEW_LINE> <DEDENT> a, b, c = get_length(p0,p1), get_length(p1,p2), get_length(p2,p0) <NEW_LIN...
:type points: List[List[int]] :rtype: float
625941e53eb6a72ae02ec8fe
def callback_func(context, response, ex): <NEW_LINE> <INDENT> print(context, response, ex)
:param context: HttpContext对象,内部封装了请求相关信息 :param response: 请求响应内容 :param ex: 是否出现异常(如果有异常则值为异常对象;否则值为None) :return:
625941e557b8e32f524838b4
@json_response <NEW_LINE> def get_tags(request): <NEW_LINE> <INDENT> query = request.GET.get('q', '') <NEW_LINE> tags = Tag.objects.filter( Q(name__startswith=query) | Q(name__contains=' ' + query) ).annotate(entry_count=Count('entries'), event_count=Count('events')) <NEW_LINE> return {'results': [ { 'id': t.name, 'tex...
Return a tag list suitable for select2.
625941e5a8ecb033257d34e2
def CalculateDigitsSum(number): <NEW_LINE> <INDENT> base = 10 <NEW_LINE> digit = 0 <NEW_LINE> total = 0 <NEW_LINE> n = number <NEW_LINE> while n > 0: <NEW_LINE> <INDENT> digit = n % base <NEW_LINE> total += digit <NEW_LINE> n //= base <NEW_LINE> <DEDENT> return total;
(int) -> int Return number's digits summation. >>> CalculateDigitsSum(2002) 4 >>> CalculateDigitsSum(123) 6 >>> CalculateDigitsSum(10401) 6 >>> CalculateDigitsSum(84001) 13
625941e5d6c5a10208144465
def put(self, key, value, **kw): <NEW_LINE> <INDENT> self.impl.put(key, value, **self._get_cache_kw(kw))
Place a value in the cache. :param key: the value's key. :param value: the value :param \**kw: cache configuration arguments.
625941e58e7ae83300e4b3e4
def shorten(self, link, provider, link_type, user_repo, value, url, hash_size): <NEW_LINE> <INDENT> label = PROVIDER_INFO[provider]['provider'] <NEW_LINE> prov_class = 'magiclink-%s' % provider <NEW_LINE> class_attr = link.get('class', '') <NEW_LINE> class_name = class_attr.split(' ') if class_attr else [] <NEW_LINE> i...
Shorten url.
625941e50fa83653e46573cf
def driver_list(p_engine, p_username, format, driver_name): <NEW_LINE> <INDENT> ret = 0 <NEW_LINE> logger = logging.getLogger() <NEW_LINE> logger.debug("driver_name {}".format(driver_name)) <NEW_LINE> enginelist = get_list_of_engines(p_engine, p_username) <NEW_LINE> if enginelist is None: <NEW_LINE> <INDENT> return 1 ...
Print list of file formats param1: p_engine: engine name from configuration param2: format: output format param3: drver_name: driver name return 0 if environment found
625941e560cbc95b062c695a
def clean_output(s): <NEW_LINE> <INDENT> return re.sub('\n( *\n)+', '\n', s).replace(' ', ' ')
Remove double newlines with whitespace in between and reduce the level of indentation
625941e55fdd1c0f98dc064c
def get_pseudos(options): <NEW_LINE> <INDENT> exts=("psp8",) <NEW_LINE> paths = options.pseudos <NEW_LINE> if len(paths) == 1 and os.path.isdir(paths[0]): <NEW_LINE> <INDENT> top = paths[0] <NEW_LINE> paths = find_exts(top, exts, exclude_dirs="_*") <NEW_LINE> <DEDENT> pseudos = [] <NEW_LINE> for p in paths: <NEW_LINE> ...
Find pseudos in paths, return :class:`PseudoTable` object sorted by atomic number Z. Accepts filepaths or directory.
625941e51d351010ab855f31
def bow(sentence): <NEW_LINE> <INDENT> _bow = [0 for _ in range(dir_len())] <NEW_LINE> original_words = spliter.original_words(sentence) <NEW_LINE> for word in original_words: <NEW_LINE> <INDENT> _bow[words_dir[word]] = 1 <NEW_LINE> <DEDENT> return _bow
辞書と照らし合わせてBag of Wordsを返す :param sentence: 英語文章 <class: 'str'> :return: Bag of Wordsのリスト
625941e544b2445a339324aa
def initialize_logging(logger, stream_level=logging.WARNING, output_filepath=None, file_level=None): <NEW_LINE> <INDENT> log_formatter = logging.Formatter( "%(levelname)7s - %(asctime)s - %(name)s.%(funcName)s - %(message)s" ) <NEW_LINE> stream_handler = logging.StreamHandler() <NEW_LINE> stream_handler.setFormatter(lo...
Standard logging initialization. :param logger: Logger instance to initialize :type logger: logging.Logger :param stream_level: Logging level to set for the stderr stream formatter. :type stream_level: int :param output_filepath: Output logging from the given logger to the provided file path. Currently, we log t...
625941e516aa5153ce36288e
def with_select(function_object: Callable[["TaborChannelTuple", Any], Any]) -> Callable[["TaborChannelTuple"], Any]: <NEW_LINE> <INDENT> @functools.wraps(function_object) <NEW_LINE> def selector(channel_tuple: "TaborChannelTuple", *args, **kwargs) -> Any: <NEW_LINE> <INDENT> channel_tuple._select() <NEW_LINE> return fu...
Asserts the channel pair is selcted when the wrapped function is called
625941e5596a897236089ed2
def binary(self): <NEW_LINE> <INDENT> if isinstance(self.value, int): <NEW_LINE> <INDENT> return b_chr(_TAG_ATOM_CACHE_REF) + b_chr(self.value) <NEW_LINE> <DEDENT> elif isinstance(self.value, TypeUnicode): <NEW_LINE> <INDENT> value_encoded = self.value.encode('utf-8') <NEW_LINE> length = len(value_encoded) <NEW_LINE> i...
return encoded representation
625941e5cdde0d52a9e5344c
def create_network(self): <NEW_LINE> <INDENT> return Chain(max_size=3)
Create a new network.
625941e5de87d2750b8601ad
def get_num_joueur_courant(participants): <NEW_LINE> <INDENT> return participants["courant"]
retourne le numéro du joueur courant :param participants: les participants :return: un nombre entre 1 et 4 indiquant le numéro du joueur courant
625941e5cc0a2c11143dd2a9
def encode_directory(directory): <NEW_LINE> <INDENT> path = pathlib.Path(directory) <NEW_LINE> for child in path.iterdir(): <NEW_LINE> <INDENT> if child.suffix != '.txt': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> with open(child) as f: <NEW_LINE> <INDENT> text = f.read() <NEW_LINE> <DEDENT> text = '~' + text + '...
For every .txt file in this directory, write a .encode file according to our scheme.
625941e54e4d5625662d47e9
def subset(self, size=None, **kwargs): <NEW_LINE> <INDENT> if size is None: <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> return OrderedSetPartitions(size, **kwargs)
Return the subset of ordered set partitions of a given size and additional keyword arguments. EXAMPLES:: sage: P = OrderedSetPartitions() sage: P.subset(4) Ordered set partitions of {1, 2, 3, 4}
625941e538b623060ff0b204
def element_decode(self, data, xsd_element, xsd_type=None, level=0): <NEW_LINE> <INDENT> xsd_type = xsd_type or xsd_element.type <NEW_LINE> result_dict = self.dict() <NEW_LINE> if level == 0 and xsd_element.is_global() and not self.strip_namespaces and self: <NEW_LINE> <INDENT> schema_namespaces = set(xsd_element.names...
Converts a decoded element data to a data structure. :param data: ElementData instance decoded from an Element node. :param xsd_element: the `XsdElement` associated to decoded the data. :param xsd_type: optional `XsdType` for supporting dynamic type through xsi:type or xs:alternative. :param level: the level re...
625941e556ac1b37e62645de
def get_observation(self, physics): <NEW_LINE> <INDENT> obs = collections.OrderedDict() <NEW_LINE> obs['orientations'] = physics.orientations() <NEW_LINE> obs['height'] = physics.torso_height() <NEW_LINE> obs['velocity'] = physics.velocity() <NEW_LINE> return obs
Returns an observation of body orientations, height and velocites.
625941e5dc8b845886cb594d
def hasSameDirection2Vector(self, vec): <NEW_LINE> <INDENT> return self.hasVectorSameDirection2Vector(vec1=self, vec2=vec)
Wrapper method for class instances
625941e53317a56b8693a065
def SingleChannelLPDDR3_1600(size: Optional[str] = "256MB") -> SingleChannel: <NEW_LINE> <INDENT> return SingleChannel("LPDDR3_8Gb_x32_1600", size)
A single channel LPDDR3_1600. :param size: The size of the memory system. Default value of 256MB.
625941e5b7558d58953c5322
def compare_data_sub(data_a, data_b): <NEW_LINE> <INDENT> if isinstance(data_a, dict): <NEW_LINE> <INDENT> if len(data_a.keys()) == len(data_b.keys()): <NEW_LINE> <INDENT> for key in data_a.keys(): <NEW_LINE> <INDENT> if isinstance(data_a[key], list) or isinstance(data_a[key], dict): <NEW_LINE> <INDENT> compare_data_su...
数据比对 :param data_a: 接口返回数据或自己设置的预期数据 :param data_b: 数据库查询结果 :return:
625941e55166f23b2e1a5570
def destroy(self, request, *args, **kwargs): <NEW_LINE> <INDENT> return super(EventViewSet, self).destroy(request, *args, **kwargs)
Удалить событие.
625941e5460517430c394591
def loadTarget(urn, urlopener): <NEW_LINE> <INDENT> pass
Load the provided urn with the urlopener in order to register the urn with the urlopener
625941e54527f215b584c86a
def __iter__(self): <NEW_LINE> <INDENT> for sp in SetPartitionsBk_k.__iter__(self): <NEW_LINE> <INDENT> if is_planar(sp): <NEW_LINE> <INDENT> yield self.element_class(self, sp)
TESTS:: sage: SetPartitionsTk(3).list() #random [{{1, -3}, {2, 3}, {-1, -2}}, {{2, -2}, {3, -3}, {1, -1}}, {{1, 2}, {3, -3}, {-1, -2}}, {{-3, -2}, {2, 3}, {1, -1}}, {{1, 2}, {3, -1}, {-3, -2}}]
625941e5435de62698dfe064
def sec_to_hm_str(t): <NEW_LINE> <INDENT> h, m, s = sec_to_hm(t) <NEW_LINE> return "{:02d}h{:02d}m{:02d}s".format(h, m, s)
Convert time in seconds to a nice string e.g. 10239 -> '02h50m39s'
625941e57cff6e4e81117d9d
def action_deposite_receive(self): <NEW_LINE> <INDENT> for rent in self: <NEW_LINE> <INDENT> if rent.deposit_amt < 1: <NEW_LINE> <INDENT> raise Warning(_("Deposit amount should not be zero.\n" "Please Enter Deposit Amount.")) <NEW_LINE> <DEDENT> deposit_inv_ids = self.env['account.move'].search([ ('fleet_rent_id', '=',...
Method to open the related payment form view.
625941e53346ee7daa2b3186
def fac(n): <NEW_LINE> <INDENT> assert type(n) is int and n >= 0 <NEW_LINE> r = 1 <NEW_LINE> for i in range(2, n + 1): <NEW_LINE> <INDENT> r *= i <NEW_LINE> <DEDENT> return r
calculate factorial of n
625941e5a79ad161976cc55d
def _fetch_image(context, session, instance, name_label, image_id, image_type, image_handler): <NEW_LINE> <INDENT> if image_type == ImageType.DISK_VHD: <NEW_LINE> <INDENT> vdis = _fetch_vhd_image(context, session, instance, image_id, image_handler) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if CONF.xenserver.indepen...
Fetch image from glance based on image type. Returns: A single filename if image_type is KERNEL or RAMDISK A list of dictionaries that describe VDIs, otherwise
625941e52eb69b55b151cccc
def handle_bot_command(self, command, argument, channel, player_id): <NEW_LINE> <INDENT> args = locals() <NEW_LINE> del args["self"] <NEW_LINE> del args["command"] <NEW_LINE> del args["channel"] <NEW_LINE> if command not in self.commands: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> (command_func, desc) = self.comman...
Forwards commands to the game engine using a commands dict for the mapping. :param command: The first word of the intercepted message. :param argument: A string containing the rest of the intercepted message. :param channel: Channel id from witch the message was received. :param player_id: Id of the player that emitte...
625941e5a17c0f6771cbe467
def check_fleet_edges(ai_seetings, aliens): <NEW_LINE> <INDENT> for alien in aliens.sprites(): <NEW_LINE> <INDENT> if alien.check_edges(): <NEW_LINE> <INDENT> change_fleet_direction(ai_seetings,aliens) <NEW_LINE> break
如果有外星人到大边缘
625941e57d43ff24873a30ba
def test_result_valid(): <NEW_LINE> <INDENT> results = run_filter('playartist', 'beatl') <NEW_LINE> nose.assert_equal(results[0]['valid'], 'yes')
artist result should be actionable
625941e515fb5d323cde0f2c
def get_move(self, game, time_left): <NEW_LINE> <INDENT> self.time_left = time_left <NEW_LINE> legalMoves = game.get_legal_moves() <NEW_LINE> if not legalMoves: <NEW_LINE> <INDENT> return (-1,-1) <NEW_LINE> <DEDENT> randomMovePosition = random.randint(0,len(legalMoves)-1) <NEW_LINE> best_move = legalMoves[randomMovePos...
Search for the best move from the available legal moves and return a result before the time limit expires. Modify the get_move() method from the MinimaxPlayer class to implement iterative deepening search instead of fixed-depth search. ********************************************************************** NOTE: If ti...
625941e526238365f5f0f28b
def git_fsencode(filename): <NEW_LINE> <INDENT> if sys.platform.startswith('win32'): <NEW_LINE> <INDENT> return filename.encode('utf-8') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return fsencode(filename)
Encode filename from str into git input.
625941e5796e427e537b09e1
def merge(self, nums1, m, nums2, n): <NEW_LINE> <INDENT> if m == 0: <NEW_LINE> <INDENT> for i in range(n): <NEW_LINE> <INDENT> nums1[i] = nums2[i] <NEW_LINE> <DEDENT> return <NEW_LINE> <DEDENT> ix = 0 <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> while nums2[i] > nums1[ix] and ix < m+i: <NEW_LINE> <INDENT> ix += 1 ...
:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.
625941e5099cdd3c635f1070
@check_init <NEW_LINE> def abnormal_record_insert(record): <NEW_LINE> <INDENT> _IMPL.abnormal_record_insert(record)
Insert abnormal record
625941e566656f66f7cbc5c4
def estimates_from_combinations(ar, r, *, q=from_data, estimator='nsb', subset=None): <NEW_LINE> <INDENT> estimator = as_estimator(estimator) <NEW_LINE> if not isinstance(ar, DataArray): <NEW_LINE> <INDENT> ar = DataArray(ar) <NEW_LINE> <DEDENT> p = ar.shape[0] <NEW_LINE> feature_combinations = zip(combinations(range(p...
Apply the estimator function `func` to combinations of data features. Parameters ---------- ar : array-like p-by-n data array. r : int, optional; ; 1<=r<=p. Length of feature combinations. q : callable, optional A callable returning the quantity to be estimated from data estimator : str or entropy estimato...
625941e5ff9c53063f47c609
def _is_valid(self, value): <NEW_LINE> <INDENT> return self._contained_type.istypeof(value)
Check if this is a valid object to add to the list. Subclasses can override this function, but it's probably better to modify the istypeof function on the _contained_type.
625941e5c432627299f05060
def lance_aprocess(df, cb): <NEW_LINE> <INDENT> with Pool(1) as tp: <NEW_LINE> <INDENT> rep = tp.apply_async(fc, [df], callback=cb) <NEW_LINE> return rep.get()
Calcul dans une version thread la somme de tous les nombre de df[0] à df[1] (df[1] non compris)
625941e5d8ef3951e3243955