code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def do_save(self, path: str): <NEW_LINE> <INDENT> fountain.write(path, self._paragraphs) <NEW_LINE> self._path = path
Save screenplay to path.
625941d8462c4b4f79d1d94e
@pytest.mark.parametrize( "permissions,allowed", [ (["change_datatemplate", "change_study"], True), (["change_study"], False), (["change_datatemplate"], False), ([], False), ], ) <NEW_LINE> def test_add_templates_to_studies(db, permission_client, permissions, allowed): <NEW_LINE> <INDENT> user, client = permission_clie...
Test the addTemplatesToStudies mutation in the normal case Users without the change_datatemplate permission should not be allowed to perform this operation
625941d8956e5f7376d710ea
def fit(self, phi, data, bootstrap=10000): <NEW_LINE> <INDENT> w, err = self._fit(phi, data) <NEW_LINE> if bootstrap > 0: <NEW_LINE> <INDENT> self.pvalue = self.significance(phi, data, bootstrap) <NEW_LINE> <DEDENT> self.w = w <NEW_LINE> return self
Fits the tuning curve to data. Args: phi: angles in radians data: responses Returns:
625941d87cff6e4e81117c03
def unlock_delete_temp_clients(self): <NEW_LINE> <INDENT> pattern = p4gf_const.P4GF_REPO_TEMP_CLIENT.format(server_id=p4gf_util.get_server_id(), repo_name=self.ctx.config.repo_name, uuid='*') <NEW_LINE> clients = [client['client'] for client in self.ctx.p4gfrun('clients', '-e', pattern)] <NEW_LINE> options = re.sub('lo...
Unlock the temp clients so the user may consequently delete them.
625941d8046cf37aa974cfc4
def maybe_download_and_extract(): <NEW_LINE> <INDENT> dataset_maybe_download_and_extract(url=data_url, download_dir=data_path)
Download and extract the CIFAR-10 data-set if it doesn't already exist in data_path (set this variable first to the desired path).
625941d866673b3332b9230f
def refresh(self): <NEW_LINE> <INDENT> if (self.joint.controller.controller_category == "position"): <NEW_LINE> <INDENT> self.slider.setSliderPosition(self.current_value) <NEW_LINE> self.slider.setValue(self.current_value) <NEW_LINE> self.target.setText("Tgt: " + str(self.current_value))
Refresh the current position of the slider with index = self.current_controller_index
625941d8460517430c3943fe
def __init__(self, args): <NEW_LINE> <INDENT> skytools.DBScript.__init__(self, 'pgqadm', args) <NEW_LINE> self.set_single_loop(1) <NEW_LINE> if len(self.args) < 2: <NEW_LINE> <INDENT> print("need command") <NEW_LINE> sys.exit(1) <NEW_LINE> <DEDENT> int_cmds = { 'create': self.create_queue, 'drop': self.drop_queue, 'reg...
Initialize pgqadm.
625941d8dd821e528d63b425
@signals.registered_handler("viewer/invert") <NEW_LINE> def invert(slide_space, _app): <NEW_LINE> <INDENT> slide = slide_space.get_children()[0] <NEW_LINE> if slide.image_buffer is None: <NEW_LINE> <INDENT> slide.image_buffer = image.ImageBuffer() <NEW_LINE> <DEDENT> slide.image_buffer.invert()
Apply a color invert effect to the photo. :param slide_space: container with the pisak slide instance inside
625941d87047854f462a1685
def wait_for(func, timeout, step=1.0, args=None, kwargs=None): <NEW_LINE> <INDENT> if args is None: <NEW_LINE> <INDENT> args = [] <NEW_LINE> <DEDENT> if kwargs is None: <NEW_LINE> <INDENT> kwargs = {} <NEW_LINE> <DEDENT> end_time = time.time() + timeout <NEW_LINE> while time.time() < end_time: <NEW_LINE> <INDENT> outpu...
Wait until func() evaluates to True. If func() evaluates to True before timeout expires, return the value of func(). Otherwise return None. :param timeout: Timeout in seconds :param first: Time to sleep before first attempt :param step: Time to sleep between attempts in seconds :param text: Text to print while waitin...
625941d81f037a2d8b94647b
def stressB(self, verbose=False, **kwargs): <NEW_LINE> <INDENT> return self._calcStress(self._hookStressB, verbose, **kwargs)
Calculates the stress on the point B of the springs's hook based on the given force. Or calculates the force based on the given stress.
625941d856ac1b37e626444a
def search_for_variables_in_src(self, variables: List[str], folder: str) -> Optional[List[str]]: <NEW_LINE> <INDENT> vmc_path = self.path / folder <NEW_LINE> used_variables = set() <NEW_LINE> for file_path in vmc_path.rglob("*.f"): <NEW_LINE> <INDENT> s = get_variables_in_file(file_path, variables) <NEW_LINE> used_vari...
Check what the variables in the common block are use in the `.f` source files.
625941d8711fe17d825425e4
def is_player_active(self, player): <NEW_LINE> <INDENT> return (player in self.players.all() and player not in self.players_lost.all())
Return whether a player is active.
625941d801c39578d7e750b9
@pytest.fixture(scope="function") <NEW_LINE> def token_response(client, oauth_client): <NEW_LINE> <INDENT> return tests.utils.oauth2.get_token_response(client, oauth_client)
Return the token response from the end of the OAuth procedure from ``/oauth2/token``.
625941d863d6d428bbe4476d
def run_gui(game): <NEW_LINE> <INDENT> gui = GUI(game) <NEW_LINE> gui.start()
Instantiate and run the GUI.
625941d8a4f1c619b28b02b2
def _get_selected(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> iter_ = self.get_selection().get_selected()[1] <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if iter_ is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return self.model.convert_iter_to_chil...
return the selected row or None
625941d88e71fb1e9831da26
def calc_in_time_point(matrix, time): <NEW_LINE> <INDENT> op = np.vectorize(lambda el: Operable(el)(time), otypes=[np.float]) <NEW_LINE> return op(matrix)
Calculates matrix in given time point
625941d899fddb7c1c9de60f
def updateConfig(confi): <NEW_LINE> <INDENT> log.debug('[updateConfig]') <NEW_LINE> conf = getLinotpConfig() <NEW_LINE> p_keys = copy.deepcopy(confi) <NEW_LINE> typing = False <NEW_LINE> for entry in confi: <NEW_LINE> <INDENT> typ = confi.get(entry + ".type", None) <NEW_LINE> des = confi.get(entry + ".desc", None) <NEW...
update the server config entries incl. syncing it to disc
625941d8cb5e8a47e48b7d25
def load(self, path): <NEW_LINE> <INDENT> path = path if isinstance(path, Path) else Path(str(path)) <NEW_LINE> if path.is_dir(): <NEW_LINE> <INDENT> for item in path.iterdir(): <NEW_LINE> <INDENT> for i in self.load(item): <NEW_LINE> <INDENT> yield i <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> try:...
Load and extract info from music folder or files. :param path: Music folder path or music filename (relative or absolute path). :return: Music info object (iterable)
625941d891f36d47f21ac772
def del_folder(input_name_folder): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.rmdir('{}'.format(input_name_folder)) <NEW_LINE> print('Папка \'{}\' удалена'. format(input_name_folder)) <NEW_LINE> <DEDENT> except FileNotFoundError: <NEW_LINE> <INDENT> print("Не удается найти указанную папку: \'{}\'".format(input_nam...
del direct and checks for del
625941d8ab23a570cc250402
def findnearest(myarray, target, bounds): <NEW_LINE> <INDENT> newarray = abs(myarray - target) <NEW_LINE> candidate = np.argmin(newarray) <NEW_LINE> if newarray[candidate] < bounds: <NEW_LINE> <INDENT> return candidate <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.nan
Find index of element closest to target, that is also within +/- bounds of target. This function may be slow for sorted arrays.
625941d81f037a2d8b94647c
def recursive_proc_tree(children, pid, indention_count, level, recursive): <NEW_LINE> <INDENT> self_row = (pid, level) <NEW_LINE> children_rows = [] <NEW_LINE> if recursive and pid in children.keys(): <NEW_LINE> <INDENT> for child_pid in sorted(children[pid]): <NEW_LINE> <INDENT> children_rows += recursive_proc_tree(ch...
Recursive function
625941d88a43f66fc4b542e1
def load_config(self): <NEW_LINE> <INDENT> self.client.notify(KEY('/general/use_trayicon')) <NEW_LINE> self.client.notify(KEY('/general/prompt_on_quit')) <NEW_LINE> self.client.notify(KEY('/general/window_tabbar')) <NEW_LINE> self.client.notify(KEY('/general/window_ontop')) <NEW_LINE> self.client.notify(KEY('/general/w...
"Just a proxy for all the configuration stuff.
625941d8ac7a0e7691ed4346
def hook_reprewsi(m, i, o): <NEW_LINE> <INDENT> repre = i[0] <NEW_LINE> self.reprewsi = repre.squeeze().detach().cpu().numpy()
Hooks the antepenultiem layer of the classifier.
625941d85fc7496912cc3bfc
@pytest.mark.parametrize('query_parameters, redirect_to', [ ('?next=/abc', '/abc'), ('', '/'), ('?next=http://malicious.dangerous', '/'), ('?next=%2Fdeposit%2Fnew', '/deposit/new')]) <NEW_LINE> def test_redirect_to_next(query_parameters, redirect_to, app): <NEW_LINE> <INDENT> app.extensions['security'] = Mock() <NEW_LI...
Test view when LDAP connection is A-OK.
625941d84428ac0f6e5baa72
def getDB(self): <NEW_LINE> <INDENT> self.conn = self.connect() <NEW_LINE> return self.conn
creating the database
625941d8004d5f362079a5b0
def feedforward(self, inputs, is_training=True): <NEW_LINE> <INDENT> with slim.arg_scope(vgg.vgg_arg_scope()): <NEW_LINE> <INDENT> logits = vgg.vgg_16(inputs=inputs, num_classes=21, is_training=is_training) <NEW_LINE> <DEDENT> return logits
feedforward procedure :param inputs: net's input , the shape is [1, height, width, 3] :return: logits, the shape is [1, height, width, 22]
625941d8236d856c2ad44a5b
def all_anagrams(filename): <NEW_LINE> <INDENT> d = {} <NEW_LINE> for line in open(filename): <NEW_LINE> <INDENT> word = line.strip().lower() <NEW_LINE> t = signature(word) <NEW_LINE> if t not in d: <NEW_LINE> <INDENT> d[t] = [word] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> d[t].append(word) <NEW_LINE> <DEDENT> <DE...
Finds all anagrams in a list of words. filename: string filename of the word list Returns: a map from each word to a list of its anagrams.
625941d829b78933be1e5927
def __generate_random_data_centers(size1=200,size2=300,size3=200): <NEW_LINE> <INDENT> mean1, cov1, n1 = [1, 5], [[1,1],[1,2]], size1 <NEW_LINE> x1 = np.random.multivariate_normal(mean1, cov1, n1) <NEW_LINE> mean2, cov2, n2 = [2.5, 2.5], [[1,0],[0,1]], size2 <NEW_LINE> x2 = np.random.multivariate_normal(mean2, cov2, n2...
*DOES:* * generates 3 sets of data containing randomized members centered around known coords (x1,x2,x3) *RETURNS:* * tuple(data,x1,x2,x3)
625941d8be8e80087fb20ebe
def queuedmessage(method: Callable) -> Callable: <NEW_LINE> <INDENT> @functools.wraps(method) <NEW_LINE> def wrapped(self: 'Bot', *args: object, **kwargs: object) -> object: <NEW_LINE> <INDENT> queued = kwargs.pop( 'queued', self._is_messages_queued_default ) <NEW_LINE> isgroup = kwargs.pop('isgroup', False) <NEW_LINE>...
A decorator to be used with :attr:`telegram.Bot` send* methods. Note: As it probably wouldn't be a good idea to make this decorator a property, it has been coded as decorator function, so it implies that first positional argument to wrapped MUST be self. The next object attributes are used by decorator: ...
625941d8ec188e330fd5aa19
def cookie_demo(request): <NEW_LINE> <INDENT> response = HttpResponse('ok') <NEW_LINE> response.set_cookie('name', 'ww', max_age=3600) <NEW_LINE> print(request.COOKIES.get('name')) <NEW_LINE> return response
演示cookie读写操作
625941d826068e7796caef61
def intersection(self, other): <NEW_LINE> <INDENT> return self._helper_union_and_intersection(other, False)
Make intersection of two DFAs Using the Sipser's proof that the class of regular languages is closed under the intersection operation. Return a new automata that is the intersection of the self instance and the dfa passed by parameter.
625941d8f8510a7c17cf997c
def testCanFilter(self): <NEW_LINE> <INDENT> for s in self.scores: <NEW_LINE> <INDENT> qobj = GameScore.Query.using(self.USING).filter(objectId=s.objectId).get() <NEW_LINE> self.assert_(qobj.objectId == s.objectId, "Getting object with .filter() failed") <NEW_LINE> self.assert_(qobj.score == s.score, "Getting object wi...
test the Queryset.filter() method
625941d8e1aae11d1e749f38
def process_summary(content): <NEW_LINE> <INDENT> for i in range(len(content)): <NEW_LINE> <INDENT> if '期初结存' in content[i]: <NEW_LINE> <INDENT> balance_bf_row = i <NEW_LINE> <DEDENT> if '出 入 金' in content[i]: <NEW_LINE> <INDENT> total_deposit_withdrawal_row = i <NEW_LINE> <DEDENT> if '平仓盈亏' in content[i]: <NEW_LINE> <...
处理资金状况,获取期初结存、出入金、平仓盈亏、盯市盈亏、手续费和期末结存等数据。
625941d8f8510a7c17cf997b
def train(nn, reader, args): <NEW_LINE> <INDENT> num_sents = len(reader.sentences) <NEW_LINE> logger.info("Starting training with %d sentences" % num_sents) <NEW_LINE> avg_len = sum(len(x) for x in text_reader.sentences) / float(num_sents) <NEW_LINE> logger.debug("Average sentence length is %f tokens" % avg_len) <NEW_L...
Trains a neural network for the selected task.
625941d830c21e258bdfa71d
def test_channelmanager_start_with_zero_entries( private_keys, tester_events, tester_registry, tester_state, tester_token): <NEW_LINE> <INDENT> pkey0 = private_keys[0] <NEW_LINE> channel_manager = new_channelmanager( pkey0, tester_state, tester_events.append, tester_registry, tester_token.address, ) <NEW_LINE> assert n...
A new channel manager must start empty.
625941d8a05bb46b383eca9f
def gen_uplift_spring(data, h, model="asce"): <NEW_LINE> <INDENT> D_o = general.total_outside_diameter(data.D, data.t_coat) <NEW_LINE> H = depth_to_centre(D_o, h) <NEW_LINE> disp = delta_qu(data.soil_type, H, D_o) <NEW_LINE> springs = { "asce": (disp, Qu(data.psi_s, data.c, D_o, data.gamma_s, H)), "f114": (disp, F_upli...
Returns vertical uplift soil spring as a tuple of displacement and resistance based on chosen soil model.
625941d87d847024c06be53d
def meyeraux(x): <NEW_LINE> <INDENT> return 35*x**4-84.*x**5+70.*x**6-20.*x**7
Compute the Meyer auxiliary function The Meyer function is .. math:: y = 35 x^4-84 x^5+70 x^6-20 x^7 :param array x: :return: the waveform .. plot:: :include-source: :width: 80% from spectrum import * from pylab import * t = linspace(0, 1, 1000) plot(t, meyeraux(t))
625941d82ae34c7f2600d3af
def getOptions(self): <NEW_LINE> <INDENT> options = self.options <NEW_LINE> return options
Returns available options
625941d8d7e4931a7ee9e19c
@delay_scope_application <NEW_LINE> def fill_empty_returns(scope, expression_getter): <NEW_LINE> <INDENT> expression, scope = expression_getter(scope) <NEW_LINE> if expression is None: <NEW_LINE> <INDENT> return insert_vm_code('push constant 0')(scope) <NEW_LINE> <DEDENT> return expression, scope
Catch empty returns and make them return `0` In the vm, all functions have to return something
625941d899cbb53fe6792e65
def test_essence_operation(self): <NEW_LINE> <INDENT> base_app = base_frame_view.BaseFrameView(self.get_driver()) <NEW_LINE> try: <NEW_LINE> <INDENT> curr_discover_activity = discover_tab_activity.DiscoverTabActivity(base_app) <NEW_LINE> curr_discover_activity.swipe_up_entire_scroll_view() <NEW_LINE> log.logger.info("点...
test_cases/test_topic_operations.py:TopicTestCase.test_essence_operation Summary: 发现首页-》点击九宫格箭头-》分类-》精选分类选择分类/点击图片/点赞
625941d885dfad0860c3b0da
def _geopotential(Z): <NEW_LINE> <INDENT> return _r0*Z/(_r0+Z)
Calculate geopotential at a given altitude above the standard latitude :param Z: Geometric altitude, m :return: Geopotential, m'
625941d83c8af77a43ae3a21
def _GetTypeName(x): <NEW_LINE> <INDENT> if type(x) is types.InstanceType: <NEW_LINE> <INDENT> return x.__class__.__name__ <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return type(x).__name__
Returns a user-friendly name descriping the given object's type.
625941d8d7e4931a7ee9e19d
@access_control(workspace_api_access_control.is_workspace_owner) <NEW_LINE> def get_list_group_can_write_workspace(workspace, user): <NEW_LINE> <INDENT> write_permission = permission_api.get_by_id(workspace.write_perm_id) <NEW_LINE> return list(write_permission.group_set.all())
Get the list of groups that have write access to workspace. Args: workspace user Returns:
625941d863f4b57ef0001392
def eq_fp(x, y): <NEW_LINE> <INDENT> return _apply_elem_wise_fp(x, y, '==')
Element wise equality check of scalars, vectors or matrices. Args: x: first argument y: second argument Returns: an 0-1 array indicating where the comparison is true
625941d84a966d76dd551290
def remove_url_param(key, value=None, replace=None, controller=None, action=None, extras=None, alternative_url=None): <NEW_LINE> <INDENT> params_nopage = [(k, v) for k, v in request.params.items() if k != 'page'] <NEW_LINE> params = list(params_nopage) <NEW_LINE> if value: <NEW_LINE> <INDENT> params.remove((key, value)...
Remove a key from the current parameters. A specific key/value pair can be removed by passing a second value argument otherwise all pairs matching the key will be removed. If replace is given then a new param key=replace will be added. controller action & extras (dict) are used to create the base url via url_for(contr...
625941d8be7bc26dc91cd87b
def reactor_sleep(sleep_time): <NEW_LINE> <INDENT> d = defer.Deferred() <NEW_LINE> reactor.callLater(sleep_time, d.callback, None) <NEW_LINE> return d
Reactor based sleep().
625941d88e05c05ec3eea5f5
def __init__(self, full=0, mode='w', verbose=1, **kw ): <NEW_LINE> <INDENT> self.verbose = verbose <NEW_LINE> self.foutName = tempfile.mktemp() + '.pml' <NEW_LINE> self.fgenerate = open(self.foutName, mode) <NEW_LINE> self.dic = {} <NEW_LINE> self.initPymol() <NEW_LINE> arg = '-q %s'%self.foutName <NEW_LINE> if full ==...
@param mode: open file with this mode, w=override, a=append @type mode: str @param full: dispaly pymol structures in fill screen mode:: 0 - normal mode 1 - full screen mode 2 - full screen and no menues @type full: 0|1|2
625941d823849d37ff7b330c
def mysql(self, name): <NEW_LINE> <INDENT> value = self.config.get('MYSQL', name) <NEW_LINE> return value
读取mysql配置文件内容 :param name: 名称 :return: 返回值
625941d87047854f462a1686
def clear_content(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.lock.acquire() <NEW_LINE> if os.path.exists(self.file_name) and os.stat(self.file_name).st_size: <NEW_LINE> <INDENT> with open(self.file_name, 'w', encoding="utf-8") as f: <NEW_LINE> <INDENT> f.write('\n{\n "Content": [\n ]\n}\n') <NEW_LIN...
Funcion para limpiar todos los datos de un archivo json
625941d838b623060ff0b06c
def GetParamsClean(kwargs, _a_params_dict, needed_params = None): <NEW_LINE> <INDENT> for var in needed_params: <NEW_LINE> <INDENT> if var in kwargs: <NEW_LINE> <INDENT> _a_params_dict[0][var] = kwargs[var] <NEW_LINE> del kwargs[var] <NEW_LINE> <DEDENT> <DEDENT> return kwargs
GetParamsClean: it looks general enough to be further abstracted
625941d863b5f9789fde7365
def setLoaded(self, v): <NEW_LINE> <INDENT> self.loadCompleted = v
Mark the serie as loaded.
625941d85fc7496912cc3bfd
def raggedness(font: ImageFont, lines: list, max_width_px: int) -> int: <NEW_LINE> <INDENT> line_space = [max_width_px - line_width(font, line) for line in lines] <NEW_LINE> return sum(_ * _ for _ in line_space)
Knuth-style raggedness, defined as sum of squares of available space in each line.
625941d8bde94217f368306e
def test_view_str_value(two_card_view): <NEW_LINE> <INDENT> two_card_view_string = ( "\n" "\x1b[47m\x1b[30mA \x1b[0m \x1b[47m\x1b[31mQ \x1b[0m \n" "\x1b[47m\x1b[30m♣ \x1b[0m \x1b[47m\x1b[31m♥ \x1b[0m \n" "\x1b[47m\x1b[30m \x1b[0m \x1b[47m\x1b[31m \x1b[0m \n"...
Ensure the proper string value of the given View
625941d8460517430c3943ff
def instagram_graph(instagram_scraped): <NEW_LINE> <INDENT> fig = plt.figure(figsize=(8, 6)) <NEW_LINE> plt.subplot2grid((3, 3), (0, 0), colspan=3, rowspan=1) <NEW_LINE> instagram_scraped['Comments Count'].plot(kind='bar', alpha=.55) <NEW_LINE> plt.title("Total Comments Count") <NEW_LINE> plt.subplot2grid((3, 3), (1, 0...
Displays all the graphs
625941d8f548e778e58cd7fe
def test_eval_once_loop_interval(self): <NEW_LINE> <INDENT> job = { 'schedule': { 'job1': { 'function': 'test.ping', 'once': '2017-12-13T13:00:00', } } } <NEW_LINE> LOOP_INTERVAL = random.randint(0, 59) <NEW_LINE> self.schedule.opts['loop_interval'] = LOOP_INTERVAL <NEW_LINE> run_time = dateutil_parser.parse('12/13/201...
verify that scheduled job runs
625941d826238365f5f0f0f0
def test_angelic_action(): <NEW_LINE> <INDENT> h_1 = Angelic_HLA( expr('h1'), 'B' , 'A & $-B') <NEW_LINE> h_2 = Angelic_HLA( expr('h2'), 'A', '$$A & $$C') <NEW_LINE> action_1 = Angelic_HLA.angelic_action(h_1) <NEW_LINE> action_2 = Angelic_HLA.angelic_action(h_2) <NEW_LINE> assert ([a.effect for a in action_1] == [ [exp...
Finds the HLA actions that correspond to the HLA actions with angelic semantics h1 : precondition positive: B _______ (add A) or (add A and remove B) effect: add A and possibly remove B h2 : precondition positive: A _______ (add A and add C) or ...
625941d8a219f33f34628be6
def getModuleID(self): <NEW_LINE> <INDENT> logger.debug('get module ID') <NEW_LINE> modid = self.vme.singleReadD32(self.base_address + MODID) <NEW_LINE> return decode_module_id(modid)
Reads module ID and firmware revision.
625941d88c3a87329515863c
def __init__(self, *, file_value: str = None, has_received_file: bool = None, id: str = None) -> None: <NEW_LINE> <INDENT> self.file_value = file_value <NEW_LINE> self.has_received_file = has_received_file <NEW_LINE> self.id = id
Initialize a TemplateRepoTarUploadResponse object. :param str file_value: (optional) Tar file value. :param bool has_received_file: (optional) Has received tar file?. :param str id: (optional) Template ID.
625941d873bcbd0ca4b2c2f5
@normalform.register(Implies) <NEW_LINE> def normalform_Implies(formula): <NEW_LINE> <INDENT> phi = normalform(formula.phi) <NEW_LINE> psi = normalform(formula.psi) <NEW_LINE> return normalform(Or(Not(phi), psi))
4.3
625941d844b2445a33932314
def __init__(self, user_id, max_id, limit): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.result = None <NEW_LINE> self.content_related = True <NEW_LINE> self.user_id = user_id <NEW_LINE> self.max_id = max_id <NEW_LINE> self.limit = limit
:param TypeInputUser user_id: :param int max_id: :param int limit: :returns messages.Chats: Instance of either Chats, ChatsSlice.
625941d8507cdc57c6306f5f
def n_leafs(self): <NEW_LINE> <INDENT> size = 1 if self.is_leaf() else 0 <NEW_LINE> for c in self.children: <NEW_LINE> <INDENT> size += c.n_leafs() <NEW_LINE> <DEDENT> return size
Returns: int: The number of leafs in the current tree.
625941d89b70327d1c4e1055
def test_graph_single_station(self): <NEW_LINE> <INDENT> grapher = Grapher() <NEW_LINE> grapher.graph_station('imars', 'img_publisher') <NEW_LINE> self.assertTrue('img_publisher' in list(grapher.graph.nodes()))
imars img_publisher station node is created
625941d8ad47b63b2c50a1fd
def main(): <NEW_LINE> <INDENT> test('1 2 3 4 5 6 7 ## ## ## ## ## ## 8', 6, 8) <NEW_LINE> test('1 2 3 4 5 6 7 ## ## ## ## ## ## 8', 5, 8) <NEW_LINE> test('1 2 3 4 5 6 7 ## ## ## ## ## ## 8', 5, 2) <NEW_LINE> test('1 2 3 4 5 6 7 ## ## ## ## ## ## 8', 1, 7) <NEW_LINE> test('1 2 3 4 5 6 7 ## ## ## ## ## ## 8', 8, 3)
在二叉树中找到两个节点的最近公共祖先
625941d845492302aab5e545
def http_method(httpMethod): <NEW_LINE> <INDENT> def _http_method(func): <NEW_LINE> <INDENT> def wrapper(request, *args, **kwargs): <NEW_LINE> <INDENT> if request.method == httpMethod: <NEW_LINE> <INDENT> ret = func(request, *args, **kwargs) <NEW_LINE> return ret <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise http...
:param httpMethod: GET POST :return: :raise:
625941d83cc13d1c6d3c75f9
def convert_back(self, number)->str: <NEW_LINE> <INDENT> if number == 1: <NEW_LINE> <INDENT> number = self.player1 <NEW_LINE> return number <NEW_LINE> <DEDENT> if number == -1: <NEW_LINE> <INDENT> number = self.player2 <NEW_LINE> return number <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> number = '.' <NEW_LINE> return...
converts int player pieces back to str
625941d8de87d2750b860014
def CreateDefaultVpc(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("CreateDefaultVpc", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.CreateDefaultVpcResponse() ...
This API is used to create a default VPC. The default VPC is suitable for getting started with and launching public instances, and it can be used like any other VPCs. To create a standard VPC, for which you need to specify a VPC name, VPC IP range, subnet IP range, and subnet availability zone, use the regular CreateV...
625941d897e22403b379d21a
def config_list() -> list[Path]: <NEW_LINE> <INDENT> return sorted(config_dir().glob(f"*.{CONFIG_EXT}"))
Returns a list of available tmuxp session configuration paths
625941d8956e5f7376d710eb
def nextId(self): <NEW_LINE> <INDENT> current_id = self.currentId() <NEW_LINE> if self.page(current_id) == self.uiNetworkAdaptersWizardPage: <NEW_LINE> <INDENT> platform = self.uiPlatformComboBox.currentText() <NEW_LINE> if platform not in WIC_MATRIX: <NEW_LINE> <INDENT> return self.uiNetworkAdaptersWizardPage.nextId()...
Wizard rules!
625941d8a934411ee3751913
def _send_state_to_connections(self, connections): <NEW_LINE> <INDENT> configuration = self.configuration_service.get() <NEW_LINE> state = self.cluster_state.as_deployment() <NEW_LINE> can_update = [] <NEW_LINE> delayed_update = [] <NEW_LINE> elided_update = [] <NEW_LINE> for connection in connections: <NEW_LINE> <INDE...
Send desired configuration and cluster state to all given connections. :param connections: A collection of ``AMP`` instances.
625941d8462c4b4f79d1d94f
def subset_of(self, other): <NEW_LINE> <INDENT> common_domains = {} <NEW_LINE> for dom, dims in self._core._domains.items(): <NEW_LINE> <INDENT> if dom in other._core._domains and other._core._domains[dom] == dims: <NEW_LINE> <INDENT> common_domains[dom] = dims <NEW_LINE> <DEDENT> <DEDENT> if len(common_domains) == 0: ...
Computes the degree of subsethood between this concept and a given other concept.
625941d821a7993f00bc7f73
def check_populate(self, tablename): <NEW_LINE> <INDENT> cursor = self.session.open_cursor('table:' + tablename, None, None) <NEW_LINE> wantkey = '' <NEW_LINE> i = 0 <NEW_LINE> for gotkey, gotval in cursor: <NEW_LINE> <INDENT> wantkey += str(i) <NEW_LINE> wantval = wantkey + wantkey <NEW_LINE> self.assertEqual(gotkey, ...
Verify that items added by populate are still there
625941d84527f215b584c6d4
def register_car(user_id, data): <NEW_LINE> <INDENT> return requests.post(urljoin(SHARED_SERVER_URL, 'users/{}/cars'.format(user_id)), headers={"AuthToken": SS_TOKEN}, data=data)
Register driver's car info in the shared server
625941d81b99ca400220ad31
def list(self, n=10): <NEW_LINE> <INDENT> print(self.db.tail(n))
list the last n rows from the data file
625941d80383005118ecf861
def test_refresh_bundle_ests(df, pipeline, prod=True): <NEW_LINE> <INDENT> if isinstance(pipeline, str): <NEW_LINE> <INDENT> pipeline = [pipeline] <NEW_LINE> <DEDENT> assert not set(['bundle_id', 'estimate_id']) - set(df.columns), "This function needs bundles and estimates" <NEW_LINE> acceptable_pipelines = ['al...
Use the clinical.bundle table to identify very specific missingness by bundle_id and estimate_id Params: df : (pd.DataFrame) clinical data in a pandas dataframe pipeline : (str) identifies which pipeline to check b/c estimate_ids are intrinsically tied to a pipeline option...
625941d8bd1bec0571d908af
def get_car(self, id): <NEW_LINE> <INDENT> for car in self.cars: <NEW_LINE> <INDENT> if car.id == id: <NEW_LINE> <INDENT> return car
Get the instance of car based on its id :param id: car id :return: an instance of car
625941d8cdde0d52a9e532b4
def makeWire(pointslist,closed=False,placement=None,face=None,support=None): <NEW_LINE> <INDENT> if not FreeCAD.ActiveDocument: <NEW_LINE> <INDENT> FreeCAD.Console.PrintError("No active document. Aborting\n") <NEW_LINE> return <NEW_LINE> <DEDENT> import DraftGeomUtils, Part <NEW_LINE> if not isinstance(pointslist,list)...
makeWire(pointslist,[closed],[placement]): Creates a Wire object from the given list of vectors. If closed is True or first and last points are identical, the wire is closed. If face is true (and wire is closed), the wire will appear filled. Instead of a pointslist, you can also pass a Part Wire.
625941d8379a373c97cfadc6
def __init__(self, parent_id, element, fei, context): <NEW_LINE> <INDENT> self.conditions = [] <NEW_LINE> FlowExpression.__init__(self, parent_id, element, fei, context) <NEW_LINE> self.event = element.attrib["event"]
Constructor.
625941d8167d2b6e31218e15
@app.route('/wechat_portal/pay/notify', methods=['GET']) <NEW_LINE> def pay_notify(): <NEW_LINE> <INDENT> data = XmlOperate.xml_to_dict(request.data) <NEW_LINE> print('pay notify data: %s' % data) <NEW_LINE> pay_service = WxPayService(data.get('appid')) <NEW_LINE> if not pay_service.check(data): <NEW_LINE> <INDENT> ret...
微信异步通知
625941d8460517430c394400
def test_one_auth_post_one_not_user_not_logged(self): <NEW_LINE> <INDENT> user = create_user('anon') <NEW_LINE> blog = create_blog(user, 'Blog title', 'Blog description') <NEW_LINE> create_post(blog, user, 'Post title', 'Post content', True) <NEW_LINE> create_post(blog, user, 'Second title', 'Second Post content', Fals...
If there's a private and non-private post on the blog, not authenticated user will see only non-private post
625941d8dd821e528d63b427
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, JsonChangeScriptAttributeRequest): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941d82c8b7c6e89b35a3f
def execute(self, node_context): <NEW_LINE> <INDENT> fq_filename = create_filenames_from_parameters(node_context.parameters) <NEW_LINE> fig = Figure() <NEW_LINE> FigureCanvasNonInteractive(fig) <NEW_LINE> axes = fig.add_subplot(111) <NEW_LINE> with node_context.input['port1'] as adaffile: <NEW_LINE> <INDENT> (tb_ts_dic...
Execute
625941d899fddb7c1c9de610
def get_tensor_filter(self, filter_name): <NEW_LINE> <INDENT> if filter_name not in self._tensor_filters: <NEW_LINE> <INDENT> raise ValueError("There is no tensor filter named \"%s\"" % filter_name) <NEW_LINE> <DEDENT> return self._tensor_filters[filter_name]
Retrieve filter function by name. Parameters ---------- filter_name: Name of the filter set during add_tensor_filter() call. Returns: The callable associated with the filter name. Raises: ValueError: If there is no tensor filter of the specified filter name.
625941d81f037a2d8b94647d
def trace(self, msg, *args): <NEW_LINE> <INDENT> self.logger.log(msg.format(*args))
Log the specified message
625941d8a05bb46b383ecaa0
def playGame(wordList): <NEW_LINE> <INDENT> lastHand = {} <NEW_LINE> messageStart = "Enter n to deal a new hand, r to replay the last hand, or e to end game: " <NEW_LINE> messageNoPreviousHand = "You have not played a hand yet. Please play a new hand first!" <NEW_LINE> messageInvalidCommand = "Invalid command." <NEW_LI...
Allow the user to play an arbitrary number of hands. 1) Asks the user to input 'n' or 'r' or 'e'. * If the user inputs 'n', let the user play a new (random) hand. * If the user inputs 'r', let the user play the last hand again. * If the user inputs 'e', exit the game. * If the user inputs anything else, tell t...
625941d8a934411ee3751914
def create_damaged_animator(self): <NEW_LINE> <INDENT> def f(): <NEW_LINE> <INDENT> f.count -= 1 <NEW_LINE> if f.count % 3 == 0: <NEW_LINE> <INDENT> self.image = self.blank_image <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.default_animator() <NEW_LINE> <DEDENT> if f.count <= 0: <NEW_LINE> <INDENT> self.animator_...
This is the animator for when the SuperSprite is damaged. This function returns a closure.
625941d8d18da76e23532758
def get_author(self, obj): <NEW_LINE> <INDENT> return self.get_version(obj).created_by
Return the author who created a version :param obj: MenuContent Instance :return: Author
625941d88c0ade5d55d3ec3c
def prepare_dict_data(data_dir, train_file, dev_file, test_file, vocabulary_size, max_seq_len, tokenizer=None): <NEW_LINE> <INDENT> train_path = os.path.join(data_dir, train_file) <NEW_LINE> dev_path = os.path.join(data_dir, dev_file) <NEW_LINE> test_path = os.path.join(data_dir, test_file) <NEW_LINE> vocab_path_stem =...
Get processed data into data_dir, create vocabulary. Args: data_dir: directory in which the data sets will be stored. train_file: file with dictionary definitions for training. dev_file: file with dictionary definitions for development testing. vocabulary_size: size of the vocabulary to create and use. max_s...
625941d8287bf620b61d3ce2
def player_named(self, name): <NEW_LINE> <INDENT> return self.player_names.get(name, None)
Return a player with the given name (case insensitive) or None.
625941d8cb5e8a47e48b7d27
def parse_gpg_date_string(date_string): <NEW_LINE> <INDENT> if 'T' in date_string: <NEW_LINE> <INDENT> dt = datetime.strptime(date_string, "%Y%m%dT%H%M%S") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dt = datetime.utcfromtimestamp(int(date_string)) <NEW_LINE> <DEDENT> return dt
Parse a date string returned from `gpg --with-colons --list-keys` into a datetime. The format of the date strings is complicated; see gnupg doc/DETAILS for a full explanation. Key details: - The creation date of the key is given in UTC. - the date is usually printed in seconds since epoch, however, we are migrating t...
625941d850812a4eaa59c5a0
def set_title_field(self, *export): <NEW_LINE> <INDENT> self.field_list = [] <NEW_LINE> self.export = export <NEW_LINE> model_field = get_model_field(self.ku_model, self.exclude) <NEW_LINE> csv_row = [] <NEW_LINE> for i_export in self.export: <NEW_LINE> <INDENT> i_export = i_export.strip() <NEW_LINE> if i_export: <NEW_...
设置标题和写入的内容 export 是要导出列的名字列表
625941d85fdd1c0f98dc04b4
def get_resource_matchdict_checked(request, resource_name_key="resource_id"): <NEW_LINE> <INDENT> resource_id = get_value_matchdict_checked(request, resource_name_key, pattern=ax.INDEX_REGEX) <NEW_LINE> resource_id = ax.evaluate_call(lambda: int(resource_id), http_error=HTTPBadRequest, msg_on_fail=s.Resource_MatchDictC...
Obtains the resource matched against the specified request path variable. :returns: found resource. :raises HTTPForbidden: if the requesting user does not have sufficient permission to execute this request. :raises HTTPNotFound: if the specified resource ID does not correspond to any existing resource.
625941d871ff763f4b54990f
def utctodate(utctime): <NEW_LINE> <INDENT> return dt.utcfromtimestamp(utctime).strftime("%Y-%m-%d %H:%M:%S")
Convert POSIX time to YYYY-MM-DD HH:MM:SS
625941d8498bea3a759b9d2f
def prepare_menu_list(self, items: Dict[str, Widget]) -> ListBox: <NEW_LINE> <INDENT> menu_items: List[MenuItem] = self.create_menu_items(items) <NEW_LINE> return ListBox(SimpleFocusListWalker(menu_items))
Prepare general menu list. :param items: A dictionary of widgets representing the menu items. :return: ListBox containig menu items.
625941d8adb09d7d5db6ca0e
def serialize(self, buff): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _x = self <NEW_LINE> buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) <NEW_LINE> _x = self.header.frame_id <NEW_LINE> length = len(_x) <NEW_LINE> if python3 or type(_x) == unicode: <NEW_LINE> <INDENT> _x...
serialize message into buffer :param buff: buffer, ``StringIO``
625941d8566aa707497f47e6
def _generate_image_and_label_batch(image, label, min_queue_examples): <NEW_LINE> <INDENT> num_preprocess_threads = 16 <NEW_LINE> images, label_batch = tf.train.shuffle_batch( [image, label], batch_size=FLAGS.batch_size, num_threads=num_preprocess_threads, capacity=min_queue_examples + 3 * FLAGS.batch_size, min_after_d...
Construct a queued batch of images and labels. Args: image: 3-D Tensor of [IMAGE_SIZE, IMAGE_SIZE, 3] of type.float32. label: 1-D Tensor of type.int32 min_queue_examples: int32, minimum number of samples to retain in the queue that provides of batches of examples. Returns: images: Images. 4D tensor of [ba...
625941d8596a897236089d3e
def requestReceived(self, command, path, version): <NEW_LINE> <INDENT> clength = self.content.tell() <NEW_LINE> self.content.seek(0, 0) <NEW_LINE> self.args = {} <NEW_LINE> self.method, self.uri = command, path <NEW_LINE> self.clientproto = version <NEW_LINE> x = self.uri.split(b'?', 1) <NEW_LINE> if len(x) == 1: <NEW_...
Called by channel when all data has been received. This method is not intended for users. @type command: C{bytes} @param command: The HTTP verb of this request. This has the case supplied by the client (eg, it maybe "get" rather than "GET"). @type path: C{bytes} @param path: The URI of this request. @type vers...
625941d8adb09d7d5db6ca0f
def _observe(self): <NEW_LINE> <INDENT> theta = np.random.uniform(0.0, 2.0 * np.pi, (self._batch_size)) <NEW_LINE> r = np.sqrt(np.random.uniform(size=self._batch_size)) <NEW_LINE> batched_observations = np.stack( [r * np.cos(theta), r * np.sin(theta)], axis=1) <NEW_LINE> self._observation = batched_observations.astype(...
Returns 2-dim samples falling in the unit circle.
625941d80a366e3fb873ea9c
def test_scoretools_make_leaves_01(): <NEW_LINE> <INDENT> leaves = scoretools.make_leaves([1, (1,2,3), None], [(1, 4)]) <NEW_LINE> assert isinstance(leaves[0], Note) <NEW_LINE> assert isinstance(leaves[1], Chord) <NEW_LINE> assert isinstance(leaves[2], Rest) <NEW_LINE> for l in leaves: <NEW_LINE> <INDENT> assert l.writ...
Leaves constructor can create chords, notes and rests simultaneously.
625941d89c8ee82313fbb9f5
def get_arguments(self): <NEW_LINE> <INDENT> if self.message.text and len(self.message.text.split()) > 1: <NEW_LINE> <INDENT> return self.message.text.split(' ', 1)[1]
Returns the command arguments.
625941d89c8ee82313fbb9f6
def TotalVertices(A): <NEW_LINE> <INDENT> n = int(len(A[0,:])) <NEW_LINE> return n
TotalVertices calculates the total number of vertices in a network. Input: A = adjacency matrix Output: n = total number of vertices
625941d830c21e258bdfa71f