code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def add_user(self, username, homedir=None, **kwargs): <NEW_LINE> <INDENT> users = [entry['name'] for entry in win32net.NetUserEnum(None, 0)[0]] <NEW_LINE> if not username in users: <NEW_LINE> <INDENT> raise ftpserver.AuthorizerError('No such user "%s".' %username) <NEW_LINE> <DEDENT> if not homedir: <NEW_LINE> <INDENT>...
Add a "real" system user to the virtual users table. If no homedir argument is specified the user's profile directory will possibly be determined and used. The keyword arguments in kwargs are the same expected by the original add_user method: "perm", "msg_login" and "msg_quit".
625941f43cc13d1c6d3c798f
def get_xenonnt_tpc_pmts_with_http_info(self, **kwargs): <NEW_LINE> <INDENT> local_var_params = locals() <NEW_LINE> all_params = [ 'where', 'sort', 'page', 'max_results' ] <NEW_LINE> all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) <NEW_LINE> for key, val in six.ite...
Retrieves one or more XenonntTpcPmts # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_xenonnt_tpc_pmts_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronou...
625941f476e4537e8c351c90
def plot_ellipse(S1, S2, Center, part= "Part::Feature", name= "Ellipse", grp="Circles"): <NEW_LINE> <INDENT> if not(App.ActiveDocument.getObject(grp)): <NEW_LINE> <INDENT> App.ActiveDocument.addObject("App::DocumentObjectGroup", grp) <NEW_LINE> <DEDENT> ellipse = App.ActiveDocument.addObject(part, name) <NEW_LINE> prin...
Creates an ellipse centered on the point Center, where the plane of the ellipse is defined by Center, S1 and S2, its major axis is defined by Center and S1, its major radius is the distance between Center and S1, and its minor radius is the distance between S2 and the major axis.
625941f4925a0f43d254a495
def _check_pkg_version_format(pkg): <NEW_LINE> <INDENT> ret = {'result': False, 'comment': None, 'prefix': None, 'version_spec': None} <NEW_LINE> if not HAS_PIP: <NEW_LINE> <INDENT> ret['comment'] = ( 'An importable Python 2 pip module is required but could not be ' 'found on your system. This usually means that the sy...
Takes a package name and version specification (if any) and checks it using the pip library.
625941f4711fe17d82542975
@app.route('/final_check_edit', methods = ['GET', 'POST']) <NEW_LINE> def final_check_edit(): <NEW_LINE> <INDENT> user = get_current_user() <NEW_LINE> if not user: <NEW_LINE> <INDENT> return redirect(url_for('login')) <NEW_LINE> <DEDENT> if user['final_editor'] == 0: <NEW_LINE> <INDENT> flash('You are not a final edito...
Commit in chuncks.
625941f460cbc95b062c6b5c
def parse_latlong(json_result:'json')->list: <NEW_LINE> <INDENT> result = [] <NEW_LINE> coord = json_result['route']['boundingBox'] <NEW_LINE> start_lat = abs(coord['ul']['lat']) <NEW_LINE> start_long = abs(coord['ul']['lng']) <NEW_LINE> result.append((map_direction('lat', start_lat), map_direction('long', start_long))...
Takes a parsed JSON response and returns a list of the latitude and longitude
625941f499cbb53fe67931fc
def checkin(self): <NEW_LINE> <INDENT> return self.s.get( "{}/v1/checkin" )
GET /v1/checkin removed
625941f45e10d32532c5f53d
def move_agent(self, agent, pos): <NEW_LINE> <INDENT> pos = self.torus_adj(pos) <NEW_LINE> idx = self._agent_to_index[agent] <NEW_LINE> self._agent_points[idx, 0] = pos[0] <NEW_LINE> self._agent_points[idx, 1] = pos[1] <NEW_LINE> agent.pos = pos
Move an agent from its current position to a new position. Args: agent: The agent object to move. pos: Coordinate tuple to move the agent to.
625941f48da39b475bd65594
def make_domain_path_split(urls, path_level_thresh = 1): <NEW_LINE> <INDENT> domain_path_map = defaultdict(list) <NEW_LINE> for url in urls: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> url_obj = urlparse.urlparse(url) <NEW_LINE> if len(url_obj.path)>1 and url_obj.path.count('/') >= path_level_thresh: <NEW_LINE> <INDEN...
make domain map to path for preparation of build graph :param urls: :return:
625941f4090684286d50f308
@asyncio.coroutine <NEW_LINE> def async_setup(hass, config): <NEW_LINE> <INDENT> component = EntityComponent( _LOGGER, DOMAIN, hass, SCAN_INTERVAL, GROUP_NAME_ALL_VACUUMS) <NEW_LINE> yield from component.async_setup(config) <NEW_LINE> @asyncio.coroutine <NEW_LINE> def async_handle_vacuum_service(service): <NEW_LINE> <I...
Set up the vacuum component.
625941f4090684286d50f309
def skew_sym(w): <NEW_LINE> <INDENT> res = np.array( [[0.0, -w[2], w[1]], [w[2], 0.0, -w[0]], [-w[1], w[0], 0.0]]) <NEW_LINE> return res
input: 1*3 numpy array contains rotation angles output: 3*3 numpy array skew symmetric matrix
625941f455399d3f05588cd1
def ransac(data): <NEW_LINE> <INDENT> num_closeData = data.shape[0] * params.closeData_percent - params.n <NEW_LINE> iterations = 0 <NEW_LINE> bestfit = None <NEW_LINE> besterr = np.inf <NEW_LINE> best_inlier_idxs = None <NEW_LINE> while iterations < params.max_iters: <NEW_LINE> <INDENT> maybe_idxs, test_idxs = random_...
fit model parameters to data using the RANSAC algorithm Params: data - a set of observed data points Return: bestdata - best fit data by the model(or nil if no good model is found)
625941f496565a6dacc8fce1
@doublewrap <NEW_LINE> def define_scope(function, scope=None, *args, **kwargs): <NEW_LINE> <INDENT> attribute = '_cache_' + function.__name__ <NEW_LINE> name = scope or function.__name__ <NEW_LINE> @property <NEW_LINE> @functools.wraps(function) <NEW_LINE> def decorator(self): <NEW_LINE> <INDENT> if not hasattr(self, a...
A decorator for functions that define TensorFlow operations. The wrapped function will only be executed once. Subsequent calls to it will directly return the result so that operations are added to the graph only once. The operations added by the function live within a tf.variable_scope(). If this decorator is used with...
625941f444b2445a339326aa
def get_music_notenames(self, count_in): <NEW_LINE> <INDENT> cadence = "" <NEW_LINE> cadence += "<" <NEW_LINE> cadence += mpd.transpose_notename("c''", self.m_transp) + "4 " <NEW_LINE> cadence += mpd.transpose_notename("g'", self.m_transp) + " " <NEW_LINE> cadence += mpd.transpose_notename("e'", self.m_transp) + " " <N...
Return a string with the notenames of the current question. Include count in if count_in == True
625941f4e64d504609d74e58
def check_bullet_alien_collisions(game_setting, stats, sb, screen, ship, aliens, bullets): <NEW_LINE> <INDENT> collisions = pygame.sprite.groupcollide(bullets, aliens, True, True) <NEW_LINE> if collisions: <NEW_LINE> <INDENT> for alien in collisions.values(): <NEW_LINE> <INDENT> stats.score += game_setting.alien_points...
响应子弹和外星人的碰撞
625941f44c3428357757c93c
@nose_raises(Err) <NEW_LINE> def test_cast__lconf_to_datetime_expect_failure1(): <NEW_LINE> <INDENT> print('::: TEST: test_cast__lconf_to_datetime_expect_failure1()') <NEW_LINE> test_value = '2014-05-08-13:39' <NEW_LINE> ok_(isinstance(lconf_to_datetime(test_value, test_value), datetime), msg=None)
Tests: test_cast__lconf_to_datetime_expect_failure1
625941f4dc8b845886cb5b4f
def __init__(self, parent = None): <NEW_LINE> <INDENT> pass
void QSqlRelationalDelegate.__init__(QObject parent = None)
625941f4fb3f5b602dac3cb3
def _converged(self): <NEW_LINE> <INDENT> if len(self.responsibilities) < 2: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> diff = np.linalg.norm(self.responsibilities[-1] - self.responsibilities[-2]) <NEW_LINE> return diff <= self.tolerance
Covergence if || likehood - last_likelihood || < tolerance
625941f44a966d76dd55162e
def test_stateMachine_initialState(self): <NEW_LINE> <INDENT> machine = StateMachine(State1) <NEW_LINE> self.assertTrue(machine.inState(State1)) <NEW_LINE> self.assertFalse(State1 in machine.state.movesTo) <NEW_LINE> self.assertTrue(State2 in machine.state.movesTo)
Test State Machine Initial set up.
625941f45510c4643540f9ec
def endElement(self, name): <NEW_LINE> <INDENT> if name == 'msms_run_summary': <NEW_LINE> <INDENT> self._search_summary = False <NEW_LINE> <DEDENT> elif name == 'spectrum_query': <NEW_LINE> <INDENT> self.row.data.newscan(self._scan) <NEW_LINE> self._scan = None
XML element ended
625941f4cc0a2c11143dd4aa
def as_basic(self): <NEW_LINE> <INDENT> multinomial = dict(zip(self.monoms, self.coeffs)) <NEW_LINE> return multinomial_as_basic(multinomial, *self.symbols)
Converts polynomial to a valid sympy expression. Takes list representation of a polynomial and constructs expression using symbols used during creation of a given polynomial. If you wish to have different symbols in the resulting expressions, use subs() first. Note that the result is always returned in expanded form....
625941f4b7558d58953c551f
def test_automations(): <NEW_LINE> <INDENT> example_tasks = ["PartNameFromCompany A++","GetContactEmail GERTB125", "PartNameFromId 0988FHG2", "PartIdFromCompany RocketScience"] <NEW_LINE> expected_values_from_spreadsheet = ["Haltegriff Pl", "wils1170@msu.edu", "Gear", "GERTB125"] <NEW_LINE> action = get_action(example_...
This function is for testing automations. No input; no return. Choose task string from exmaple_task. This represents a mock response from dialogflow The value from the spreadsheet is placed in the clipboard PartNameFromCompany Given the company name, return the part name their provided auto_get_part_name_2.py Ge...
625941f4c4546d3d9de73053
def tx_committed(commands): <NEW_LINE> <INDENT> for command in commands: <NEW_LINE> <INDENT> logging.debug('command committed: %s', command)
Called once a block has been committed. Args: commands (list): List of Transaction commands inside committed block.
625941f4656771135c3ebe8f
def parse_mpn(self): <NEW_LINE> <INDENT> mpn = self.soup.find('h1', {"itemprop": "model"}).text <NEW_LINE> mpn = ''.join(mpn.split()) <NEW_LINE> self.info['mpn'] = mpn
parse manufacturer part number to dict:info
625941f4d164cc6175783367
def levelOrder(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> node_list = [root] <NEW_LINE> result = [] <NEW_LINE> while len(node_list): <NEW_LINE> <INDENT> result.append([n.val for n in node_list]) <NEW_LINE> temp_list = [] <NEW_LINE> for n in node_list: <NEW_LINE> <IND...
:type root: TreeNode :rtype: List[List[int]]
625941f4851cf427c661ab22
def create_container(image, command=None, hostname=None, user=None, detach=True, stdin_open=False, tty=False, mem_limit=0, ports=None, environment=None, dns=None, volumes=None, volumes_from=None, name=None): <NEW_LINE> <INDENT> status = base_status.copy() <NEW_LINE> client = _get_client() <NEW_LINE> try: <NEW_LINE> <IN...
Create a new container image image to create the container from command command to execute while starting hostname hostname of the container user user to run docker as detach daemon mode, Default is ``True`` environment environment variable mapping ``({'foo':'BAR'})`` ports port redirection...
625941f4377c676e912727bf
def rotation_mode_set(type='QUATERNION'): <NEW_LINE> <INDENT> pass
Set the rotation representation used by selected bones :param type: Rotation ModeQUATERNION Quaternion (WXYZ), No Gimbal Lock (default).XYZ XYZ Euler, XYZ Rotation Order (prone to Gimbal Lock).XZY XZY Euler, XZY Rotation Order (prone to Gimbal Lock).YXZ YXZ Euler, YXZ Rotation Order (prone to Gimbal Lock).YZX YZX Eul...
625941f47b25080760e39a6e
def reset(self, destination=None, testing=False): <NEW_LINE> <INDENT> self.planner.route_to(destination) <NEW_LINE> if testing: <NEW_LINE> <INDENT> self.alpha = 0 <NEW_LINE> self.epsilon = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if optim: <NEW_LINE> <INDENT> self.epsilon = self.epsilon - 0.00002*self.t <NEW_LIN...
The reset function is called at the beginning of each trial. 'testing' is set to True if testing trials are being used once training trials have completed.
625941f4d8ef3951e3243b56
def affected(self, in_path): <NEW_LINE> <INDENT> if not self.active: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return any( self.has_package(in_path, package_name) for package_name in self.package_names )
Whether environment was affected by upgraded packages.
625941f49f2886367277aea0
def _get_element_screenshot(self, locator_type, query_string, action, finalize, scroll_and_screen) -> Tuple[Image.Image, Tuple[int, int, int, int]]: <NEW_LINE> <INDENT> if not scroll_and_screen: <NEW_LINE> <INDENT> self._scroll(0, 0) <NEW_LINE> <DEDENT> if callable(action): <NEW_LINE> <INDENT> action() <NEW_LINE> <...
Сделать скриншот страницы и кропнуть до скриншота элемента. Не получится использовать метод session/{sessionId}/element/{elementId}/screenshot Потому что он имплементирован только в эдж. https://stackoverflow.com/questions/36084257/im-trying-to-take-a-screenshot-of-an-element-with-selenium-webdriver-but-unsup
625941f492d797404e3047a6
def compile_global_geometrical_stiffness_matrix(self): <NEW_LINE> <INDENT> return compile_global_matrix(self.beams, geometrical=True)
Compiles the global stiffness matrix from the element matrices. :return:
625941f4b830903b967e9f1c
def update_from_kwargs(self, **kwargs): <NEW_LINE> <INDENT> for (key, value) in kwargs.items(): <NEW_LINE> <INDENT> setattr(self, key, value)
A shortcut method to update model instance from the kwargs.
625941f4cad5886f8bd275f1
def swap_influence_2(skinCl, vert, inflA, inflB): <NEW_LINE> <INDENT> with denormalized_skin(skinCl): <NEW_LINE> <INDENT> swap_influence_fast(skinCl, vert, inflA, inflB)
For a given vertex, swaps the weight between two influences.
625941f4d6c5a10208144668
def compare_late(s1, s2): <NEW_LINE> <INDENT> result = s2.earliest_time - s1.earliest_time <NEW_LINE> if result == 0: <NEW_LINE> <INDENT> return s2.average_start - s1.average_start <NEW_LINE> <DEDENT> return result
Compares two section objects to see which one has later classes.
625941f4a8370b7717052eb6
def pop(self): <NEW_LINE> <INDENT> return self.stack1.pop()
Removes the element from in front of queue and returns that element. :rtype: int
625941f45fc7496912cc3f96
def execute_sql_serializable(self, sqlStatement): <NEW_LINE> <INDENT> cur = None <NEW_LINE> while True: <NEW_LINE> <INDENT> self.__set_isolation_level(3) <NEW_LINE> try: <NEW_LINE> <INDENT> cur = self._dbconnection.cursor() <NEW_LINE> self.__execute_sql(cur, sqlStatement) <NEW_LINE> <DEDENT> except (DatabaseError, Tran...
Executes the SQL statement within a SERIALIZABLE transaction. The first tuple of the result is fetched and returned. For example: | Execute Sql Serializable | SELECT my_func() |
625941f44527f215b584ca6a
def triple_lst(lst_of_lst, avoid = []): <NEW_LINE> <INDENT> target = [] <NEW_LINE> second_triple = False <NEW_LINE> third_triple = False <NEW_LINE> lst1, lst2, lst3 = None, None, None <NEW_LINE> for ind in range(len(lst_of_lst)): <NEW_LINE> <INDENT> note = lst_of_lst[ind] <NEW_LINE> if len(note) <=3 and is_val_in_lst(n...
Rough draft of the triple function, takes a list of list
625941f4435de62698dfe266
def print_tags(journal): <NEW_LINE> <INDENT> tags = [tag for entry in journal.entries for tag in set(entry.tags) ] <NEW_LINE> tag_counts = {(tags.count(tag), tag) for tag in tags} <NEW_LINE> if min(tag_counts)[0] == 0: <NEW_LINE> <INDENT> tag_counts = filter(lambda x: x[0] > 1, tag_counts) <NEW_LINE> print('[Removed ta...
Prints a list of all tags and the number of occurances.
625941f4d164cc6175783368
def get_fai(b): <NEW_LINE> <INDENT> return b['b2'].subtract(b['b1'].add(b['b5'].subtract(b['b1']).multiply((859.0 - 645) / (1240 - 645)))).select(['sur_refl_b02'], ['b1'])
Just the internals of the FAI method
625941f4925a0f43d254a496
def banana_verify(source, goal, cont, moves): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> result = "" <NEW_LINE> source = [] <NEW_LINE> for element in moves: <NEW_LINE> <INDENT> if element == 'P': <NEW_LINE> <INDENT> cont.put(source.pop(0)) <NEW_LINE> <DEDENT> elif element == 'G': <NEW_LINE> <INDENT> result += cont.ge...
(str,str,container,list of str) -> bool check whether we can get the goal word with the source word using the given methods.
625941f4f7d966606f6aa624
def compute_moments(self,y,x,y_til,constrain=True): <NEW_LINE> <INDENT> hidden_post_x = networks.fc_network(x, self.weights, tf.shape(self.N_x)[0], self.nonlinearity, ID=0) <NEW_LINE> hidden_post_y = networks.conv_2D_network(y, self.weights, self.st_y, self.nonlinearity, im_size=self.y_siz, reshape_in=True, reshape_out...
compute moments of latent Gaussian distribution from targets, high-fidelity measurements and low-fidelity measurements INPUTS: x - targets y - high-fidelity measurements y_til -low fidelity measurements OPTIONAL INPUTS: constrain - whether to force the output mean to be between 0 and 1 OUTPUTS: mu_w...
625941f47047854f462a1a1b
def get_device_id(self): <NEW_LINE> <INDENT> return self._did
return the device id
625941f45510c4643540f9ed
def inputinformationappen(self): <NEW_LINE> <INDENT> self.logopen().write(datetime.datetime.now().ctime() + '\n') <NEW_LINE> self.logopen().write(msg14) <NEW_LINE> self.logopen().write(msg15 + self.checkreversereads(readreverse=self.readreverse)) <NEW_LINE> if self.sequencingtype == 'Paired-End': <NEW_LINE> <INDENT> se...
Log compilation. Call all the previous functions :return:
625941f48e7ae83300e4b5e8
def warp(im, segmentsBefore, segmentsAfter, a=10, b=1, p=1): <NEW_LINE> <INDENT> out = im.copy() <NEW_LINE> for y, x in imIter(out): <NEW_LINE> <INDENT> DSUM = (0,0) <NEW_LINE> weightsum = 0 <NEW_LINE> for i, segment in enumerate(segmentsAfter): <NEW_LINE> <INDENT> u,v = segment.uv(point(y,x)) <NEW_LINE> yp,xp = segmen...
Takes an image, a list of before segments, a list of after segments, and the parameters a,b,p (see Beier)
625941f407d97122c4178eb3
def set_Forum(self, value): <NEW_LINE> <INDENT> super(ListModeratorsInputSet, self)._set_input('Forum', value)
Set the value of the Forum input for this Choreo. ((required, string) Forum Short Name (i.e., the subdomain of the Disqus Site URL).)
625941f46fb2d068a760f6c0
def update_service_object(self, fix_req): <NEW_LINE> <INDENT> logger.info("Updating service %s with assigned instances", fix_req.root_workflow_id) <NEW_LINE> try: <NEW_LINE> <INDENT> service = self.axdb_client.get_service(fix_req.root_workflow_id) <NEW_LINE> service_fixtures = service.get('fixtures') or {} <NEW_LINE> f...
Updates the service object and adds the instances to its 'fixtures' field. This is best effort
625941f410dbd63aa1bd31bb
@app.route('/api/v1.0/directions', methods=['POST']) <NEW_LINE> def create_directions(): <NEW_LINE> <INDENT> if not request.json: <NEW_LINE> <INDENT> abort(400) <NEW_LINE> <DEDENT> if not 'latitude' in request.json: <NEW_LINE> <INDENT> abort(400) <NEW_LINE> <DEDENT> if not 'longitude' in request.json: <NEW_LINE> <INDEN...
Simple endpoint which takes the latitude/longitude from the POST request and returns the nearest bicycle parking locations near that point.
625941f4be7bc26dc91cdc0d
def get_active_sim_list(verbose_warnings=False): <NEW_LINE> <INDENT> active_list = {} <NEW_LINE> droid_list = android_device.get_all_instances() <NEW_LINE> for droid_device in droid_list: <NEW_LINE> <INDENT> droid = droid_device.get_droid(False) <NEW_LINE> sub_info_list = droid.subscriptionGetActiveSubInfoList() <NEW_L...
Get a dictionary of active sims across phones Args: verbose_warnings - print warnings as issues are encountered if True Returns: A dictionary with keys equivalent to the ICCIDs of each SIM containing information about that SIM
625941f4236d856c2ad44dfd
def clean_2d_csv(csv_data): <NEW_LINE> <INDENT> cleaner = re.compile(r'(,|\n|\r)') <NEW_LINE> for sublist in csv_data: <NEW_LINE> <INDENT> for el in sublist: <NEW_LINE> <INDENT> el = cleaner.sub('', el) <NEW_LINE> <DEDENT> <DEDENT> return csv_data
Removes all , and characters from data being loaded to a csv TODO TODO TODO ValueError: line 8 of the docstring for __main__.clean_2d_csv has inconsistent leading whitespace: "1']])" >>> clean_2d_csv([['1','2','3']]) [['1', '2', '3']] >>> clean_2d_csv([['1','2','3 1']]) [['1', '2', '31']] ...
625941f44428ac0f6e5bae11
def redistribute_threads(blockdimx, blockdimy, blockdimz, dimx, dimy, dimz): <NEW_LINE> <INDENT> while blockdimz > dimz: <NEW_LINE> <INDENT> tmp = blockdimz // 2 <NEW_LINE> if tmp < dimz: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> blockdimy *= 2 <NEW_LINE> blockdimz = tmp <NEW_LINE> <DEDENT> while blockdimy > dimy: ...
Redistribute threads from the Z dimension towards the X dimension. Also clamp number of threads to the problem dimension size, if necessary
625941f4cdde0d52a9e53652
def set_date(self, date): <NEW_LINE> <INDENT> if not isinstance(date, datetime.date): <NEW_LINE> <INDENT> TypeError('date - должен быть объектом datetime') <NEW_LINE> <DEDENT> date = self.__border_validate(date) <NEW_LINE> self.__date = date <NEW_LINE> self.__setup_date()
Устанавливает дату в виджете (date - объект datetime) Если дата выходит за граничные условия, будет выставлена ближайшая граничная дата.
625941f426068e7796caf302
def run(self, url, numChapters=None): <NEW_LINE> <INDENT> print(f'Downloading: {url}...') <NEW_LINE> response = self.scraper.get(url) <NEW_LINE> if not response.status_code == 200 or numChapters is 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if numChapters: <NEW_LINE> <INDENT> numChapter...
recursive get wesite :param url: url link :return: None
625941f45f7d997b871750b7
def soft_word_overlap(self, pair, name=False): <NEW_LINE> <INDENT> if name: <NEW_LINE> <INDENT> if self.both: <NEW_LINE> <INDENT> return 'Soft Overlap T->H', 'Soft Overlap H->T' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 'Soft Overlap H->T' <NEW_LINE> <DEDENT> <DEDENT> ids_t = [token.id - 1 for token in self....
Compute the "soft" word overlap between the sentences. It is defined as the average of the maximum embedding similarity of each word in one sentence in relation to the other. sum_i max_similarity(t_i, h)) / len(t) where max_similarity returns the highest similarity value (cosine) of words in H with respect to t_i. :...
625941f430c21e258bdfaabe
def render_winner_screen(self): <NEW_LINE> <INDENT> self.message_layover.render_message("YOU WIN", fontsize=48, fade=True)
Player wins the multiplayer match!
625941f407d97122c4178eb4
def get_event_images(self, events, limit): <NEW_LINE> <INDENT> return [e["img"] for e in events][:limit]
returns a sorted list of images corresponding to self.events
625941f4462c4b4f79d1dce8
def monitor(self, duration=10, mode=0, auto_format=False, filtering=False, raw_response=False): <NEW_LINE> <INDENT> self.set_can_auto_format(auto_format) <NEW_LINE> self.set_can_monitor_mode(mode) <NEW_LINE> timeout = self._port.timeout <NEW_LINE> try: <NEW_LINE> <INDENT> if duration == None: <NEW_LINE> <INDENT> if fil...
Monitor messages on bus. For CAN protocols, all messages will be treated as ISO 15765.
625941f4adb09d7d5db6cda5
def removeFile(self, file): <NEW_LINE> <INDENT> if file in self.added: <NEW_LINE> <INDENT> self.added.pop(file)
GLFileAssistant.removeFile(file) Remove file from the list of added files.
625941f491af0d3eaac9c037
def register_listener(self, listener_function): <NEW_LINE> <INDENT> self.listeners.append(listener_function)
Registers a listener function that is executed when the test report is done. :param function listener_function: listener function :return:
625941f4fbf16365ca6f67eb
def buildDriver(self) -> None: <NEW_LINE> <INDENT> pass
Build the driver for the repository in conf.
625941f430bbd722463cc3e3
def setCurrentUrl(self, url: typing.Union[DataUrl, str]) -> None: <NEW_LINE> <INDENT> assert isinstance(url, (DataUrl, str)) <NEW_LINE> if isinstance(url, str): <NEW_LINE> <INDENT> url = DataUrl(path=url) <NEW_LINE> <DEDENT> if url != self._current_url: <NEW_LINE> <INDENT> self._current_url = url <NEW_LINE> self.sigCur...
Define the url to be displayed :param url: url to be displayed :type: DataUrl
625941f42eb69b55b151ced2
def is_vendor_open(request, event): <NEW_LINE> <INDENT> end = event.registration_end <NEW_LINE> from .models import EventPermission <NEW_LINE> return (end is not None and timezone.now() <= end) or ( EventPermission.get(event, request.user).can_register_items_outside_registration )
Test if Item edit for vendor is currently open. :param request: Optional Django request for checking whether current user has override permission for registration. :type event: Event :return: True if open, False if not and modifications by vendor must not be allowed.
625941f42ae34c7f2600d749
def add_item(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> msg = MessageHandler() <NEW_LINE> dba = DatabaseAccess(self.inventory_file) <NEW_LINE> if msg.confirmation( 'Are you sure you want to add a new item to the inventory?'): <NEW_LINE> <INDENT> if msg.confirmation('Add a new category?'): <NEW_LINE> <INDENT> p...
Add new item to inventory.
625941f4d268445f265b5489
def stub_out_db_instance_api(stubs): <NEW_LINE> <INDENT> INSTANCE_TYPES = { 'm1.tiny': dict(memory_mb=512, vcpus=1, local_gb=0, flavorid=1), 'm1.small': dict(memory_mb=2048, vcpus=1, local_gb=20, flavorid=2), 'm1.medium': dict(memory_mb=4096, vcpus=2, local_gb=40, flavorid=3), 'm1.large': dict(memory_mb=8192, vcpus=4, ...
Stubs out the db API for creating Instances.
625941f4596a89723608a0d1
def __init__(self, integration_type=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self._integration_type = None <NEW_LIN...
IntegrationType - a model defined in OpenAPI
625941f4b545ff76a891442f
def from_internal_video_id(self, video_id, video=None): <NEW_LINE> <INDENT> return video_id if video_id else video.video_id
Coverts the internal video id representation (the actual ) Video.video_id into a public video id. Partners can override the logic to fetch to their ids here. If a video has already been fetched from the db, it can be passed to avoid an extra lookup.
625941f401c39578d7e75455
def __init__(self): <NEW_LINE> <INDENT> self.data_map = {} <NEW_LINE> self.year_list = [] <NEW_LINE> self.load_data_map() <NEW_LINE> self.year_list.sort()
Initializes required variables
625941f43617ad0b5ed68510
def test_conformance_v1_0_stdout_redirect_docker(self): <NEW_LINE> <INDENT> self.cwl_populator.run_conformance_test("""v1.0""", """Test command execution in Docker with stdout redirection""")
Test command execution in Docker with stdout redirection Generated from:: job: v1.0/cat-job.json label: stdout_redirect_docker output: output_file: checksum: sha1$47a013e660d408619d894b20806b1d5086aab03b class: File location: output.txt size: 13 tags: - requir...
625941f4eab8aa0e5d26e174
def parse_person(person): <NEW_LINE> <INDENT> required = object() <NEW_LINE> employee_id = None <NEW_LINE> def get(xpath, default=None): <NEW_LINE> <INDENT> elem = person.find(xpath) <NEW_LINE> if elem is None or not elem.text: <NEW_LINE> <INDENT> logger.warning('Missing element %r for employee_id=%r', xpath, employee_...
Parse a Person xml element. :param person: A //Persons/Person element :rtype: dict :return: A dictionary with normalized values.
625941f41d351010ab856134
def create(): <NEW_LINE> <INDENT> import node <NEW_LINE> reload(node) <NEW_LINE> node.create_node()
:example from resources.studio_nodes import lookdev_bake_node reload(lookdev_bake_node) lookdev_bake_node.create()
625941f494891a1f4081c0c6
def isType(self, typename): <NEW_LINE> <INDENT> return _isDerivedNodeType(self._CyObject__data['nodetype'], typename, self._CyObject__data['getname']())
指定ノードタイプの派生型かどうか。 :param `str` typename: ノードタイプ名。 :rtype: `bool`
625941f4bde94217f3683404
def __init__(self, obj, time, *fields, predicates=()): <NEW_LINE> <INDENT> super(Select, self).__init__(obj) <NEW_LINE> self._fields = fields <NEW_LINE> self._predicates = predicates <NEW_LINE> self._time = time <NEW_LINE> self._value = () <NEW_LINE> self._schema = {field: obj.schema[field] for field in fields} <NEW_LI...
Creates a retroactively-updated SELECT view for the given obj on the given fields. If given predicates, all predicates must be satisfied in order to be part of the select. In other words, predicates are inherently and'ed together. Args: obj (Subscribable): the object for which to compute the sum time (int): the t...
625941f421bff66bcd684f66
def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { '_global': 'StatsInstanceStat', 'groupings': 'list[StatsInstanceGrouping]' } <NEW_LINE> self.attribute_map = { '_global': 'global', 'groupings': 'groupings' } <NEW_LINE> self.__global = None <NEW_LINE> self._groupings = None
StatsInstance - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
625941f4462c4b4f79d1dce9
def press_entry(self, instance): <NEW_LINE> <INDENT> name = instance.text <NEW_LINE> self.status_text = "{}".format(name)
Handler for pressing entry buttons :param instance: the Kivy button instance :return: None
625941f40383005118ecfbfa
def is_changed(self): <NEW_LINE> <INDENT> if os.path.exists(self.cachefile): <NEW_LINE> <INDENT> last_mtime = 0 <NEW_LINE> all_rule_files = self.list_local() <NEW_LINE> for filename in all_rule_files: <NEW_LINE> <INDENT> file_mtime = os.stat(filename).st_mtime <NEW_LINE> if file_mtime > last_mtime: <NEW_LINE> <INDENT> ...
check if rules on disk are probably different from rules in cache :return: boolean
625941f46aa9bd52df0373c2
def conv2d_backprop_filter(input, filter_sizes, out_backprop, strides, padding, use_cudnn_on_gpu=None, name=None): <NEW_LINE> <INDENT> return _op_def_lib.apply_op("Conv2DBackpropFilter", input=input, filter_sizes=filter_sizes, out_backprop=out_backprop, strides=strides, padding=padding, use_cudnn_on_gpu=use_cudnn_on_gp...
Computes the gradients of convolution with respect to the filter. Args: input: A `Tensor`. Must be one of the following types: `float32`, `float64`. 4-D with shape `[batch, in_height, in_width, in_channels]`. filter_sizes: A `Tensor` of type `int32`. An integer vector representing the tensor shape of `filt...
625941f4627d3e7fe0d6946b
@check( id = 'com.google.fonts/check/points_out_of_bounds', conditions = ['is_ttf'], misc_metadata = { 'request': 'https://github.com/googlefonts/fontbakery/issues/735' } ) <NEW_LINE> def com_google_fonts_check_points_out_of_bounds(ttFont): <NEW_LINE> <INDENT> from fontbakery.utils import pretty_print_list <NEW_LINE> p...
Check for points out of bounds.
625941f4ad47b63b2c50a59a
def predict_proba(self, X): <NEW_LINE> <INDENT> if getattr(X, "dtype", None) != DTYPE or X.ndim != 2: <NEW_LINE> <INDENT> X = array2d(X, dtype=DTYPE) <NEW_LINE> <DEDENT> n_jobs, n_trees, starts = _partition_trees(self) <NEW_LINE> all_proba = Parallel(n_jobs=n_jobs, verbose=self.verbose)( delayed(_parallel_predict_proba...
Predict class probabilities for X. The predicted class probabilities of an input sample is computed as the mean predicted class probabilities of the trees in the forest. Parameters ---------- X : array-like of shape = [n_samples, n_features] The input samples. Returns ------- p : array of shape = [n_samples, n_c...
625941f43c8af77a43ae3dc2
def create(self, validated_data): <NEW_LINE> <INDENT> movie = Movie() <NEW_LINE> movie.title = validated_data['title'] <NEW_LINE> movie.release_year = validated_data['release_year'] <NEW_LINE> movie.save() <NEW_LINE> movie.producers.set(validated_data['producers']) <NEW_LINE> movie.directors.set(validated_data['directo...
Fix for Django 2.0 support for direct assignment in manytomany fields https://docs.djangoproject.com/en/2.0/releases/2.0/#features-removed-in-2-0)
625941f415fb5d323cde1133
@hasdocker <NEW_LINE> def test_build_bad_dockerfile(parse_and_run): <NEW_LINE> <INDENT> path = parse_and_run(["init", "cpl"]) <NEW_LINE> parse_and_run(["new", "a1"]) <NEW_LINE> dockerfile_path = os.path.join(path, "assignments", "a1", "gradesheet", "Dockerfile") <NEW_LINE> with open(dockerfile_path, 'w') as dockerfile:...
Test building an image that has a bad Dockerfile
625941f429b78933be1e5cbe
def test_not_logged_in_message(self): <NEW_LINE> <INDENT> with self.client as c: <NEW_LINE> <INDENT> resp = c.post("/messages/new", data={"text": "Hello"}, follow_redirects=True) <NEW_LINE> self.assertEqual(resp.status_code, 200) <NEW_LINE> self.assertIn("Access unauthorized", str(resp.data))
Test not logged in user adding a message
625941f491f36d47f21acb13
def setSize(self, x): <NEW_LINE> <INDENT> pyoArgsAssert(self, "i", x) <NEW_LINE> self._size = x <NEW_LINE> x, lmax = convertArgsToLists(x) <NEW_LINE> poly = len(self._base_players) // self._overlaps <NEW_LINE> for j in range(self._overlaps): <NEW_LINE> <INDENT> for i in range(poly): <NEW_LINE> <INDENT> hopsize = wrap(x...
Replace the `size` attribute. :Args: x: int new `size` attribute.
625941f44428ac0f6e5bae12
def RenderAsHtml(self): <NEW_LINE> <INDENT> html = '<table>' <NEW_LINE> for p in FrontendJob._properties: <NEW_LINE> <INDENT> if p == 'log' or p == 'clovis_task': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> value = getattr(self, p) <NEW_LINE> if value: <NEW_LINE> <INDENT> html += '<tr><td>' + p + '</td><td>' + str...
Render a short job description as a HTML table. The log and ClovisTask are not included, because they are potentially very large.
625941f48e05c05ec3eea994
def stokesFlowUpdater(t,y,pdict): <NEW_LINE> <INDENT> if 'forcedict' not in pdict.keys(): <NEW_LINE> <INDENT> pdict['forcedict'] = {} <NEW_LINE> <DEDENT> pdict['forcedict']['t'] = t <NEW_LINE> Q=len(y)/2 <NEW_LINE> fpts = np.reshape(y,(Q,2)) <NEW_LINE> f = pdict['myForces'](fpts,pdict['xr'],pdict['K'],**pdict['forcedic...
t = current time, y = [fpts.flatten(), l.flatten(), P.flatten()], pdict contains: K is spring constant, xr is resting position, blob is regularized Stokeslet object, myForces is a function handle, forcedict is a dictionary containing optional parameters for calculating forces.
625941f432920d7e50b287ef
def validate(self): <NEW_LINE> <INDENT> if self.clf and self.x_validate: <NEW_LINE> <INDENT> return self.predict(self.x_validate)
Validate the objects classifier
625941f4de87d2750b8603b4
def test_merge_move_mto_mts(self): <NEW_LINE> <INDENT> picking_pick, picking_client = self.create_pick_ship() <NEW_LINE> self.MoveObj.create({ 'name': self.productA.name, 'product_id': self.productA.id, 'product_uom_qty': 3, 'product_uom': self.productA.uom_id.id, 'picking_id': picking_client.id, 'location_id': self.st...
Create 2 moves of the same product in the same picking with one in 'MTO' and the other one in 'MTS'. The moves shouldn't be merged
625941f44527f215b584ca6b
def filter_loop(self, event_name): <NEW_LINE> <INDENT> while event_name in self.active_events: <NEW_LINE> <INDENT> current_block = self.w3.eth.getBlock('latest') <NEW_LINE> print("current_block is %d" % current_block['number']) <NEW_LINE> event_filter = self.root_chain.eventFilter(event_name, { 'fromBlock': max(current...
Starts a filter loop to broadcast events. Note that we only watch for events that occur between `confirmations` and `confirmations * 2`. This is important because we never want a client to act on an event that isn't finalized. We might catch the same event twice, so we hash each event and make sure we haven't seen tha...
625941f44f88993c3716c67a
def interact_with_objects(self): <NEW_LINE> <INDENT> for i in self.game_objects.sprites()[::-1]: <NEW_LINE> <INDENT> if issubclass(type(i), InteractiveObject) and i.collide_rect(self.rect): <NEW_LINE> <INDENT> i.interaction() <NEW_LINE> break
Функция, которая взаимодейстувет с какими-либо объектами в игре
625941f4046cf37aa974d35b
def make_geo_data(lat, lng): <NEW_LINE> <INDENT> def float_to_str(f): <NEW_LINE> <INDENT> return '{0:.8f}'.format(f).rstrip('0') <NEW_LINE> <DEDENT> return 'geo:{0},{1}'.format(float_to_str(lat), float_to_str(lng))
Creates a geo location URI. :param float lat: Latitude :param float lng: Longitude :rtype: str
625941f45fdd1c0f98dc084f
def add_entry(): <NEW_LINE> <INDENT> print("Type your entry. Press ctrl + d to finish.\n") <NEW_LINE> data = sys.stdin.read().strip() <NEW_LINE> if data: <NEW_LINE> <INDENT> if input("\nSave entry? [Yn] ").lower().strip() != "n": <NEW_LINE> <INDENT> clear() <NEW_LINE> Entry.create(content=data) <NEW_LINE> print("Saved ...
Add entry
625941f44c3428357757c93d
def get_save_layer_ids(model, model_name): <NEW_LINE> <INDENT> from keras.layers import BatchNormalization, MaxPool2D, Dense <NEW_LINE> if model_name == 'resnet18': <NEW_LINE> <INDENT> layer_type = type(BatchNormalization()) <NEW_LINE> sel_layer_ids = [] <NEW_LINE> for l in range(len(model.layers)): <NEW_LINE> <INDENT>...
Get ids for layers that we'd like to save Parameters ---------- model [keras model] model_name [str] Returns ---------- final_sel_layer_ids [list]: layer ids
625941f44f6381625f115055
def _normalize(self, count, total): <NEW_LINE> <INDENT> return float(count) / float(total) * 1e6
Normalize to reads per million.
625941f4fff4ab517eb2fa5a
def forward_procedure_single_cell(XX_I0,XX_I1,L_I0,L_I1,II): <NEW_LINE> <INDENT> alpha = np.zeros([XX_I0.shape[0],II.shape[0]]) <NEW_LINE> alpha[0,:] = .5 <NEW_LINE> for t in range(L_I0.shape[1]): <NEW_LINE> <INDENT> la0 = np.multiply(L_I0[:,t],alpha[:,0]) <NEW_LINE> xla0 = np.dot(XX_I0,la0) <NEW_LINE> la1 = np.multipl...
calculate likelihood of data using forwad procedure. assuming equally likely to start in either context and probability that you start at the beginning of the track is 1
625941f4cc40096d61595f67
def lengthOfLongestSubstring2(self, s): <NEW_LINE> <INDENT> dic = {} <NEW_LINE> ans = i = j = 0 <NEW_LINE> while(i<len(s) and j<len(s)): <NEW_LINE> <INDENT> if s[j] not in dic: <NEW_LINE> <INDENT> dic[s[j]]=1 <NEW_LINE> j+=1 <NEW_LINE> ans = max(ans,j-i) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> del dic[s[i]] <NEW_...
:type s: str :rtype: int
625941f43cc13d1c6d3c7991
def ex_set_node_tags(self, node, tags): <NEW_LINE> <INDENT> request = '/zones/%s/instances/%s/setTags' % (node.extra['zone'].name, node.name) <NEW_LINE> tags_data = {} <NEW_LINE> tags_data['items'] = tags <NEW_LINE> tags_data['fingerprint'] = node.extra['tags_fingerprint'] <NEW_LINE> response = self.connection.async_re...
Set the tags on a Node instance. Note that this updates the node object directly. @param node: Node object @type node: L{Node} @param tags: List of tags to apply to the object @type tags: C{list} of C{str} @return: True if successful @rtype: C{bool}
625941f476d4e153a657f14c
def add_globals(env): <NEW_LINE> <INDENT> import operator as op <NEW_LINE> from functools import reduce <NEW_LINE> reducer = lambda o: lambda *args: reduce(o, args) <NEW_LINE> env.update({ '+': reducer(op.add), '-': reducer(op.sub), '*': reducer(op.mul), '/': reducer(op.truediv), 'not': op.not_, '>': op.gt, '<': op.l...
Add some Lisp standard procedures to an environment.
625941f46e29344779a62c2b
def authenticate_tenant(self, tenant_id, log=None): <NEW_LINE> <INDENT> auth = partial(self._auth_me, log=log) <NEW_LINE> d = user_for_tenant(self._admin_url, self._identity_admin_user, self._identity_admin_password, tenant_id, log=log) <NEW_LINE> def impersonate(user): <NEW_LINE> <INDENT> iud = impersonate_user(self._...
see :meth:`IAuthenticator.authenticate_tenant`
625941f496565a6dacc8fce3
def p_dimensionSelBody_singleElem(p): <NEW_LINE> <INDENT> p[0] = [p[1]]
dimensionSelBody : dimensionSelElem
625941f4e64d504609d74e5a
def rollSingleTest(self): <NEW_LINE> <INDENT> DIFFICULTY = 4 <NEW_LINE> result = self.roll() <NEW_LINE> outcome = '' <NEW_LINE> if result > DIFFICULTY: <NEW_LINE> <INDENT> outcome = 'hit' <NEW_LINE> <DEDENT> elif result ==1: <NEW_LINE> <INDENT> outcome = 'glitch' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> outcome = ...
single dice component of test returns typle: (result INT, hit/miss STR)
625941f492d797404e3047a7
def link(nodes1, dirs1, c1, nodes2, dirs2, c2, value=0.0): <NEW_LINE> <INDENT> bc_dofs1 = np.array([[n, d] for n, d in _broadcast_nd(nodes1, dirs1)]) <NEW_LINE> bc_dofs2 = np.array([[n, d] for n, d in _broadcast_nd(nodes2, dirs2)]) <NEW_LINE> bc_linked_dofs = np.broadcast_arrays(bc_dofs1, bc_dofs2) <NEW_LINE> return [(...
Return constraints corresponding to the specified arrys of nodes and dirs. For example, given the call:: fix([2,4],[0],1.0,[0,1],[0],-1.0) defines the dof_constraints of the form: [([(2, 0, 1.0), (0, 0, -1.0)], -1.0), ([(4, 0, 1.0), (1, 0, -1.0)], -1.0)] The structure of the dof_constraints list is explained ...
625941f4cc0a2c11143dd4ac
def createWriterInstances(self): <NEW_LINE> <INDENT> pass
Initializes the writer instances.
625941f4c432627299f05265