code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def slew_to_home(self, blocking=False, timeout=120): <NEW_LINE> <INDENT> response = 0 <NEW_LINE> if not self.is_parked: <NEW_LINE> <INDENT> self._target_coordinates = None <NEW_LINE> response = self.query('goto_home', timeout=timeout) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.logger.info('Mount is parked') <NE...
Slews the mount to the home position. Note: Home position and Park position are not the same thing Args: blocking (bool, optional): If command should block while slewing to home, default False. timeout (int, optional): Timeout in seconds, default 120. Returns: bool: indicating success
625941d20383005118ecf79e
def create(self, parent): <NEW_LINE> <INDENT> self.ui = self.edit_traits(kind='subpanel', parent=parent) <NEW_LINE> self.control = self.ui.control
Create and set the toolkit-specific control that represents the pane.
625941d21d351010ab855cd8
def read_seq(sequence): <NEW_LINE> <INDENT> new_seq = [] <NEW_LINE> index = 0 <NEW_LINE> while index < len(sequence): <NEW_LINE> <INDENT> count = 1 <NEW_LINE> try: <NEW_LINE> <INDENT> while sequence[index + 1] == sequence[index]: <NEW_LINE> <INDENT> count += 1 <NEW_LINE> index += 1 <NEW_LINE> <DEDENT> <DEDENT> except I...
>>> read_seq('1') '11' >>> read_seq('11') '21' >>> read_seq('21') '1211' >>> read_seq('1211') '111221' >>> read_seq('111221') '312211'
625941d224f1403a92600d21
def parse_match_header(self) -> dict: <NEW_LINE> <INDENT> header_div = self.soup.find("div", {"class": "header-content"}) <NEW_LINE> stats = header_div.find("div", {"class": "header-content-secondary"}) <NEW_LINE> output = {} <NEW_LINE> for dl in stats.find_all("dl"): <NEW_LINE> <INDENT> header = dl.find("dt").text <NE...
parses basic info about match itself like league, duration etc. :return: dict with League, Game Mode, Region etc.
625941d297e22403b379d156
def _getDiagonalNE(self, nRows, nColumns): <NEW_LINE> <INDENT> lineListV = [self._findLine(rr, 0, nRows, nColumns, -1, 1) for rr in range(nRows)] <NEW_LINE> lineListH = [self._findLine(nRows -1, cc, nRows, nColumns, -1, 1) for cc in range(1, nColumns)] <NEW_LINE> return lineListV + lineListH
- Calls the '_findLine()' function, to find all of the diagonal line coordinates from bottom left to top right. - 'nRows' and 'nColumns' specifies the grid dimensions. > Returns a list of sublists; each sublist corresponds to a set of line coordinates.
625941d2fff4ab517eb2f5f9
def has_private_ip(self): <NEW_LINE> <INDENT> if self.ipv4: <NEW_LINE> <INDENT> return IPAddress(str(self.ipv4)).is_private() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Check if the IPv4 address assigned is private.
625941d23eb6a72ae02ec69c
def close_calender(self): <NEW_LINE> <INDENT> if self.selected_date != None: <NEW_LINE> <INDENT> self.button_set_calender_window.show() <NEW_LINE> self.calendar.hide() <NEW_LINE> self.next_button.hide() <NEW_LINE> self.button_set_time_window.show() <NEW_LINE> self.text_field_hours.hide() <NEW_LINE> self.text_field_minu...
the method close and open the necessary fields in the layout.
625941d25e10d32532c5f0e3
@bp.route("/", methods = ("GET",)) <NEW_LINE> @login_required("ADMIN") <NEW_LINE> def list(): <NEW_LINE> <INDENT> return render_template( "share/list.html", certificates = Certificate.get_all_for_list(), last_share_number = Share.get_last_share_number(), unbound_ranges = Share.get_unbound_ranges() )
Show the subindex for managing shares. (Okay it's not exactly a 'list' but for sake of naming consistency ...)
625941d216aa5153ce362634
def is_illegal_scope(self, pt, bracket_id, scope=None): <NEW_LINE> <INDENT> bracket = self.search.rules.brackets[bracket_id] <NEW_LINE> if self.sub_search and not bracket.find_in_sub_search: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> illegal_scope = False <NEW_LINE> if scope is not None: <NEW_LINE> <INDENT> if...
Check if scope at pt X should be ignored.
625941d256ac1b37e626438a
def draw(self, screen): <NEW_LINE> <INDENT> pygame.draw.rect(screen, self.color, (self.x, self.y, self.width, self.height)) <NEW_LINE> txt_surface, txt_rect = txt_obj(self.message, button_text) <NEW_LINE> txt_rect.center = ((self.x + (self.width/2)), (self.y + (self.height/2))) <NEW_LINE> screen.blit(txt_surface, txt_r...
Draw button
625941d221bff66bcd684b0e
def _sort_with_specific_suffix_first(list_in, suffix=None, sort_key=lambda s: s.lower()): <NEW_LINE> <INDENT> list_out = [] <NEW_LINE> if suffix is not None: <NEW_LINE> <INDENT> for list_entry in MARBL_tools.sort(list_in, sort_key): <NEW_LINE> <INDENT> if list_entry.endswith(suffix): <NEW_LINE> <INDENT> list_out.append...
Sort, but make sure entries that end in a specified suffix are listed first
625941d23eb6a72ae02ec69d
def test_parsing(self): <NEW_LINE> <INDENT> if test.runner.require_control(self): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> control_socket = test.runner.get_runner().get_tor_socket(False) <NEW_LINE> control_socket.send("PROTOCOLINFO 1") <NEW_LINE> protocolinfo_response = control_socket.recv() <NEW_LINE> stem.respo...
Makes a PROTOCOLINFO query and processes the response for our control connection.
625941d25166f23b2e1a5316
def sentenceWordFreqs(self): <NEW_LINE> <INDENT> wordFreqs = {} <NEW_LINE> for word in self.stemmedWords: <NEW_LINE> <INDENT> if word not in wordFreqs.keys(): <NEW_LINE> <INDENT> wordFreqs[word] = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> wordFreqs[word] = wordFreqs[word] + 1 <NEW_LINE> <DEDENT> <DEDENT> return w...
Set up a word frequency dictionary for this sentence
625941d263d6d428bbe446ac
def close(self): <NEW_LINE> <INDENT> ftp = self.client.open_sftp() <NEW_LINE> ftp.remove(self.script_filename) <NEW_LINE> ftp.close() <NEW_LINE> self.client.close()
Close the ssh connection
625941d229b78933be1e5867
def awapJune(len_lat,len_lon): <NEW_LINE> <INDENT> June = data_flat[0::12] <NEW_LINE> June = np.ma.masked_less(June,mask) <NEW_LINE> data = np.reshape(June,(105,len_lat,len_lon)) <NEW_LINE> return June
A function to produce an array of June data for all 105 years. Note: June[year,lat,lon] len_lat : 27 len_lon : 22
625941d263f4b57ef00012d3
def main(argv): <NEW_LINE> <INDENT> if len(argv) > 1: <NEW_LINE> <INDENT> target = argv[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> target = TARGET <NEW_LINE> <DEDENT> while(True): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with urllib.request.urlopen(target) as f: <NEW_LINE> <INDENT> if f.code == 200: <NEW_LINE...
request looping
625941d2d268445f265b502b
def print_pairing_info(melon_types): <NEW_LINE> <INDENT> for melon in melon_types: <NEW_LINE> <INDENT> print(f'{melon.name} pairs with') <NEW_LINE> for pair in melon.pairings: <NEW_LINE> <INDENT> print(f'-{pair}') <NEW_LINE> <DEDENT> print()
Prints information about each melon type's pairings.
625941d21b99ca400220ac6e
def IS(real_series, simulated_series, a=0.95, last_n=5000): <NEW_LINE> <INDENT> a_c = 1-a <NEW_LINE> T2 = real_series <NEW_LINE> T_check = simulated_series[-last_n:, :] <NEW_LINE> q1 = np.percentile(T_check, (a_c/2)*100, axis=0) <NEW_LINE> q3 = np.percentile(T_check, (1-a_c/2)*100, axis=0) <NEW_LINE> IS_res = [] <NEW_L...
Interval Score Best value : 0
625941d23317a56b86939e13
def rummage(self): <NEW_LINE> <INDENT> self.__pulls = random.sample(self.choices, self.count)
Roll all dice in the DiceCan.
625941d2be383301e01b5641
def remove_outliers(data, outliers): <NEW_LINE> <INDENT> ds = dict(data) <NEW_LINE> print("Items on the DS before removal:", len(ds)) <NEW_LINE> for outlier in outliers: <NEW_LINE> <INDENT> ds.pop(outlier, None) <NEW_LINE> <DEDENT> print('Removed {:,} outliers from the dataset'.format(len(outliers))) <NEW_LINE> print("...
Removes the outliers from the dataset :param data: Dict with the data associated to each person :return: same data without the outliers
625941d23346ee7daa2b2f2a
def _refresh_cache(self): <NEW_LINE> <INDENT> self._list_columns = self.get_list_columns() <NEW_LINE> self._sortable_columns = self.get_sortable_columns() <NEW_LINE> self._create_form_class = self.get_create_form() <NEW_LINE> self._edit_form_class = self.get_edit_form() <NEW_LINE> self._search_supported = self.init_sea...
Refresh various cached variables.
625941d223849d37ff7b324c
def test_get_matches(self): <NEW_LINE> <INDENT> results = GenomePropertiesResultsWithMatches(*self.test_genome_property_results, properties_tree=self.test_tree) <NEW_LINE> self.assertEqual(len( results.step_matches.reset_index()[['Property_Identifier', 'Step_Number']].drop_duplicates()), 1) <NEW_LINE> self.assertEqual(...
Test that we can get matches that support the existence of steps.
625941d25e10d32532c5f0e4
def describe_blob(self, blobref): <NEW_LINE> <INDENT> describe = 'camli/search/describe?blobref={0}'.format(blobref) <NEW_LINE> describe_url = urlparse.urljoin(self.url_searchRoot, describe) <NEW_LINE> r = requests.get(describe_url, auth=self.auth) <NEW_LINE> r.raise_for_status() <NEW_LINE> return r.json().get('meta', ...
Return blob meta data.
625941d2925a0f43d254a035
def update(self, result): <NEW_LINE> <INDENT> self.result = result <NEW_LINE> if self.verbose == False or self.result.query_time is None: <NEW_LINE> <INDENT> response_time_text = "" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> response_time_text = f" [{round(self.result.query_time * 1000)} ms]" <NEW_LINE> <DEDENT> if ...
Notify Update. Will print the query result to the standard output. Keyword Arguments: self -- This object. result -- Object of type QueryResult() containing results for this query. Return Value: Nothing.
625941d2099cdd3c635f0e18
def destroy(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if hasattr(self.cc, 'polling_timer'): <NEW_LINE> <INDENT> root.after_cancel(self.cc.polling_timer) <NEW_LINE> <DEDENT> self.cc._release() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.hide() <NEW_LINE> tk.Misc.destroy(self)
widgetを破棄する
625941d216aa5153ce362635
def traffic_statuscodes_services(self, **kwargs): <NEW_LINE> <INDENT> url_path = 'traffic/statuscodes' + '/services' <NEW_LINE> self.logger.debug(f"Get list of services (StatusCodes)") <NEW_LINE> body = self._make_body(kwargs) <NEW_LINE> return self._common_get(request_path=url_path, parameters=body)
Get list of services (SC). :param shortname: (required) <list> - List of shortnames :return: list of services, like: [ "HTTP", "HTTPS", "HLS" ]
625941d221bff66bcd684b0f
def welcome_messages(ar): <NEW_LINE> <INDENT> Vote = rt.models.votes.Vote <NEW_LINE> qs = Vote.objects.filter(user=ar.get_user()).exclude(nickname='') <NEW_LINE> qs = qs.order_by('priority') <NEW_LINE> if qs.count() > 0: <NEW_LINE> <INDENT> chunks = [str(_("Your favourite {0} are ").format( config.votable_model._meta.v...
Yield a message "Your favourites are X, Y, ..." for the welcome page. This message mentions all voted objects of the requesting user and whose :attr:`nickname <Vote.nickname>` is not empty.
625941d2187af65679ca52dc
def high_scores(self): <NEW_LINE> <INDENT> top = tk.Toplevel(width=80, height=100) <NEW_LINE> top.title("Top3") <NEW_LINE> label = tk.Label(top, text="High Scores", fg="white", bg="indian red", font="Courier 12 bold") <NEW_LINE> label.pack(fill=tk.X) <NEW_LINE> if path.exists('high_scores.txt'): <NEW_LINE> <INDENT> fd ...
Show top 3 high scores :return: None
625941d2d7e4931a7ee9e0db
def draw_mod(self): <NEW_LINE> <INDENT> self._set_editing(False) <NEW_LINE> if self.main.mod is None: <NEW_LINE> <INDENT> if not self.main.num_selected: <NEW_LINE> <INDENT> self.draw_settings() <NEW_LINE> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> config = [a2mod.NEW_MODULE_CFG.copy()] <NEW_LINE> config[0]['d...
From module config create display controls, fill them with the saved settings from database.
625941d2460517430c394340
def postprocess(self, doc_tokens, token_to_sp_fact_map, result, n_best_size, max_answer_length): <NEW_LINE> <INDENT> supporting_facts = set() <NEW_LINE> sp_indexes = np.where(np.asarray(result["sp_logits"]) > 0.)[0] <NEW_LINE> for spi in sp_indexes: <NEW_LINE> <INDENT> if spi in token_to_sp_fact_map: <NEW_LINE> <INDENT...
Get final prediction from logits.
625941d28c3a873295158579
def get_role_resid(role): <NEW_LINE> <INDENT> return get_resource_identity("role", "/api/v1/roles?description=" + role)
Get the resourceIdentity of a role, based on the description of the role
625941d24e696a04525c9609
def get_pileup_2d(filename, conf, rebin=1): <NEW_LINE> <INDENT> cor = CaloSpectra.from_root_file(filename, conf['cor_hist_name']) <NEW_LINE> uncor = CaloSpectra.from_root_file(filename, conf['uncor_hist_name']) <NEW_LINE> pu_3d = uncor.array - cor.array <NEW_LINE> pu_3d = rebinned_last_axis(pu_3d, rebin) <NEW_LINE> reb...
return the dataset's pu spectrum as a 2D root histogram
625941d2d18da76e23532695
def setValue(self, index, value): <NEW_LINE> <INDENT> self.setData(index, value, QtCore.Qt.EditRole)
set index EditRole to value
625941d2a219f33f34628b26
def deserialize_response(self, examples, predict_response): <NEW_LINE> <INDENT> num_ex = len(predict_response['classes']) <NEW_LINE> scores = predict_response['scores'] <NEW_LINE> classes = predict_response['classes'] <NEW_LINE> result = [] <NEW_LINE> for i in range(num_ex): <NEW_LINE> <INDENT> score_i = scores[i] <NEW...
Read the JSON response and decode it according to the signature. :param examples: Input examples :param predict_response: an HTTP/REST output
625941d2d58c6744b4257e1c
def GetOutput(self): <NEW_LINE> <INDENT> return _btk.btkWrenchCollectionDownsampleFilter_GetOutput(self)
GetOutput(self) -> btkWrenchCollection Returns the output created with this process.
625941d2293b9510aa2c3452
def clean(self, case): <NEW_LINE> <INDENT> if case in self.outcomes: <NEW_LINE> <INDENT> if isinstance(self.outcomes[case], list): <NEW_LINE> <INDENT> for result in self.outcomes[case]: <NEW_LINE> <INDENT> if result is not None: <NEW_LINE> <INDENT> result.clean() <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> else: <NEW_LINE> <...
Dereferences the test results' memory to the representations of the output and only retains the percent and common matches etc. for aggregate statistics. Should only be called after the *.compare files have been written out for the test case.
625941d291f36d47f21ac6b1
def get_copies_parfor(parfor, typemap): <NEW_LINE> <INDENT> blocks = wrap_parfor_blocks(parfor) <NEW_LINE> in_copies_parfor, out_copies_parfor = copy_propagate(blocks, typemap) <NEW_LINE> in_gen_copies, in_extra_kill = get_block_copies(blocks, typemap) <NEW_LINE> unwrap_parfor_blocks(parfor) <NEW_LINE> kill_set = in_ex...
find copies generated/killed by parfor
625941d2090684286d50eea4
def clean_captcha(self): <NEW_LINE> <INDENT> answer = self.cleaned_data.get("captcha") <NEW_LINE> if answer != self.captcha_answer: <NEW_LINE> <INDENT> raise forms.ValidationError( "Sorry, that's not the answer we were looking for.")
Fail form validation if captcha answer is not the expected answer. If no expected captcha answer was previously generated (this is the request on which they hit the rate limit for the first time) and no captcha answer was provided in the POST data, we don't fail them -- if they've got the right username and password o...
625941d29b70327d1c4e0f93
def draw_bs_pairs(x, y,func, size=1): <NEW_LINE> <INDENT> inds = np.arange(len(x)) <NEW_LINE> bs_slope_reps = np.empty(size) <NEW_LINE> bs_intercept_reps = np.empty(size) <NEW_LINE> for i in range(size): <NEW_LINE> <INDENT> bs_inds = np.random.choice(inds,len(inds)) <NEW_LINE> bs_x, bs_y = x[bs_inds],y[bs_inds] <NEW_LI...
Perform pairs bootstrap for linear regression.
625941d28e05c05ec3eea533
def mem_usage(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open('/proc/meminfo') as f: <NEW_LINE> <INDENT> i = 0 <NEW_LINE> total_memory = used_memory = 0 <NEW_LINE> for line in f: <NEW_LINE> <INDENT> int_value = int(line.split(":")[1][:-4].lstrip()) <NEW_LINE> if i == 0: <NEW_LINE> <INDENT> total_memory = used...
Display current Memory usage
625941d27cff6e4e81117b43
def multiline_prompt(): <NEW_LINE> <INDENT> curr = builtins.__xonsh_env__.get('PROMPT', "set '$PROMPT = ...' $ ") <NEW_LINE> curr = curr() if callable(curr) else curr <NEW_LINE> line = curr.rsplit('\n', 1)[1] if '\n' in curr else curr <NEW_LINE> line = RE_HIDDEN.sub('', line) <NEW_LINE> head = line.rstrip() <NEW_LINE> ...
Returns the filler text for the prompt in multiline scenarios.
625941d267a9b606de4a8077
def _normalize_default(self, mapping, schema, field): <NEW_LINE> <INDENT> mapping[field] = schema[field]['default']
{'nullable': True}
625941d28a349b6b435e8331
def calculate_fitness(k, delay, y, u, dt): <NEW_LINE> <INDENT> delay_periods = int(delay / dt) <NEW_LINE> e = y - k * u.shift(delay_periods) <NEW_LINE> fit = 1 - (e.var() / y.var()) ** 2 <NEW_LINE> return fit
Find how well the function fits the data
625941d215baa723493c4134
def release(self): <NEW_LINE> <INDENT> super().release() <NEW_LINE> for nnpatch in self.nnpatches: <NEW_LINE> <INDENT> for nnmodel in nnpatch.nnmodels: <NEW_LINE> <INDENT> nnmodel.release_iterstores()
Release internal resources used by NNFramework.
625941d2097d151d1a223017
def getStoragerunningJobs(storage=None): <NEW_LINE> <INDENT> jobs = [] <NEW_LINE> if storage is not None: <NEW_LINE> <INDENT> bconsole = bconsolecommand(".status storage=\"" + storage + "\" running")[8:] <NEW_LINE> jobparams = {} <NEW_LINE> first = True <NEW_LINE> for line in bconsole: <NEW_LINE> <INDENT> scan_data = r...
*.status storage=devel1-Tape1 running Connecting to Storage daemon devel1-Tape1 at 192.168.0.215:9103 Running Jobs: Writing: Full Backup job devel1-etc JobId=10 Volume="E01002L4" pool="Pool-30-days" device="Tape1Dev0" (/dev/nst0) spooling=0 despooling=0 despool_wait=0 Files=19 Bytes=716,381 AveBytes/sec=15...
625941d28da39b475bd65133
def preprocess_entry(self, entry): <NEW_LINE> <INDENT> oh, ow = self._eye_image_shape <NEW_LINE> eye = entry['eye'] <NEW_LINE> eye = cv.resize(eye, (ow, oh)) <NEW_LINE> eye = eye.astype(np.float32) <NEW_LINE> eye *= 2.0 / 255.0 <NEW_LINE> eye -= 1.0 <NEW_LINE> eye = np.expand_dims(eye, axis=0 if self.data_format == 'NC...
Resize eye image and normalize intensities.
625941d27047854f462a15c6
def get_pc_most_positives(): <NEW_LINE> <INDENT> pass
returns a list of 5 states with the most cases
625941d2adb09d7d5db6c94d
def main(): <NEW_LINE> <INDENT> win_width = 800 <NEW_LINE> win_height = 600 <NEW_LINE> random.seed(1) <NEW_LINE> world = World(random, 128, 128) <NEW_LINE> window = Window(width=win_width, height=win_height, vsync=True) <NEW_LINE> camera = Camera(0, 0, 0) <NEW_LINE> game = Game(world=world, window=window, camera=camera...
app container?
625941d28e71fb1e9831d966
def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None): <NEW_LINE> <INDENT> datadir = os.path.join(dirname, "node"+str(i)) <NEW_LINE> if binary is None: <NEW_LINE> <INDENT> binary = os.getenv("KGLDCOIND", "kazugoldd") <NEW_LINE> <DEDENT> args = [ binary, "-datadir="+datadir, "-server", "-...
Start a kazugoldd and return RPC connection to it
625941d23317a56b86939e14
def get_random_item(self): <NEW_LINE> <INDENT> if(self.ship.cargo > 0): <NEW_LINE> <INDENT> rand_type = random.choice(list(ItemTypes)) <NEW_LINE> while (self.get_item_count(rand_type) == 0): <NEW_LINE> <INDENT> rand_type = random.choice(list(ItemTypes)) <NEW_LINE> <DEDENT> return rand_type <NEW_LINE> <DEDENT> return No...
Returns a random item type that the player has at least one of
625941d276d4e153a657ecef
def __sub__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ClassFunction_gap): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> s = self._gap_classfunction - other._gap_classfunction <NEW_LINE> return ClassFunction(self._group, s)
Returns the difference of the characters ``self`` and ``other``. INPUT: - ``other`` -- a :class:`ClassFunction` of the same group as ``self``. OUTPUT: A :class:`ClassFunction` EXAMPLES:: sage: G = SymmetricGroup(4) sage: chi1 = ClassFunction(G, [3, 1, -1, 0, -1]) sage: chi2 = ClassFunction(G, [1, -1...
625941d223849d37ff7b324d
def addParentContextMenus(self, item, menu, event): <NEW_LINE> <INDENT> menusToAdd = [] <NEW_LINE> while item is not self: <NEW_LINE> <INDENT> item = item.parentItem() <NEW_LINE> if item is None: <NEW_LINE> <INDENT> item = self <NEW_LINE> <DEDENT> if not hasattr(item, "getContextMenus"): <NEW_LINE> <INDENT> continue <N...
Can be called by any item in the scene to expand its context menu to include parent context menus. Parents may implement getContextMenus to add new menus / actions to the existing menu. getContextMenus must accept 1 argument (the event that generated the original menu) and return a single QMenu or a list of QMenus. Th...
625941d25fc7496912cc3b3c
def distance(p1, p2): <NEW_LINE> <INDENT> return math.hypot(p2[0] - p1[0], p2[1] - p1[1])
get distance between two points
625941d2d99f1b3c44c6774a
def init(config: str): <NEW_LINE> <INDENT> logger = logging.getLogger(APP_NAME + ".init") <NEW_LINE> yaml_src = pkg_resources.resource_filename("export_vn", "data/evn_template.yaml") <NEW_LINE> yaml_dst = str(Path.home() / config) <NEW_LINE> logger.info(_("Creating YAML configuration file %s, from %s"), yaml_dst, yaml_...
Copy template YAML file to home directory.
625941d226238365f5f0f02d
def replace_bearer_token_macro(self, pattern): <NEW_LINE> <INDENT> if not self.is_in_context(context='request', tools=[self.callbacks.TOOL_MACRO]): return <NEW_LINE> import re <NEW_LINE> response_bytes = self.macroItems[0].getResponse() <NEW_LINE> match = re.search(pattern, response_bytes) <NEW_LINE> if not match: <NEW...
Replaces the Bearer token in the current request with a token extracted from a macro response. Requires a session handling rule to pass the result of a macro to the extension. Tip: Create and copy the REGEX pattern from the macro editor.
625941d2baa26c4b54cb12dc
def alphabetBoardPath(self, target): <NEW_LINE> <INDENT> m = {c: [i // 5, i % 5] for i, c in enumerate("abcdefghijklmnopqrstuvwxyz")} <NEW_LINE> x0, y0 = 0, 0 <NEW_LINE> res = [] <NEW_LINE> for c in target: <NEW_LINE> <INDENT> x, y = m[c] <NEW_LINE> if y < y0: <NEW_LINE> <INDENT> res.append("L" * (y0 - y)) <NEW_LINE> <...
Time Complexity: O(N) Space Complexity: O(N)
625941d2004d5f362079a4f0
def Xwgraph(self): <NEW_LINE> <INDENT> return self._wgraph('X')
The distance graph for non-trivial X stabilizer.
625941d2ec188e330fd5a95b
def initialize(context): <NEW_LINE> <INDENT> listOfTypes = listTypes('tud.addons.chat') <NEW_LINE> content_types, constructors, ftis = process_types(listOfTypes, 'tud.addons.chat') <NEW_LINE> for atype, constructor, fti in zip(content_types, constructors, ftis): <NEW_LINE> <INDENT> ret = ContentInit('%s: %s' % ('tud.ad...
Initializes content types. :param context: product context :type context: App.ProductContext.ProductContext
625941d256b00c62f0f14818
def _buffer_decode_step(self, input, errors, final): <NEW_LINE> <INDENT> sup = UTF8IncrementalDecoder._buffer_decode <NEW_LINE> cutoff1 = input.find(b'\xed') <NEW_LINE> cutoff2 = input.find(b'\xc0') <NEW_LINE> if cutoff1 != -1 and cutoff2 != -1: <NEW_LINE> <INDENT> cutoff = min(cutoff1, cutoff2) <NEW_LINE> <DEDENT> eli...
There are three possibilities for each decoding step: - Decode as much real UTF-8 as possible. - Decode a six-byte CESU-8 sequence at the current position. - Decode a Java-style null at the current position. This method figures out which step is appropriate, and does it.
625941d294891a1f4081bc68
@azure('datalake') <NEW_LINE> @sdc_min_version('3.9.0') <NEW_LINE> @pytest.mark.parametrize('executor_name', [ADLS_GEN1_FILE_METADATA, ADLS_GEN2_FILE_METADATA]) <NEW_LINE> def test_datalake_metadata_create(sdc_builder, sdc_executor, azure, executor_name): <NEW_LINE> <INDENT> directory_name = get_random_string(string.as...
ADLS File Metadata with Create File Task The data is written to an ADLS file but removed by ADLS File Metadata executor.
625941d26e29344779a627cf
def sort_shop(shopIdlist): <NEW_LINE> <INDENT> shopIdlist.sort(key=lambda d:d[11]) <NEW_LINE> top_eight = [] <NEW_LINE> for i in range(0, min(len(shopIdlist), 8)): <NEW_LINE> <INDENT> shop = shopIdlist[i] <NEW_LINE> top_eight.append(shop) <NEW_LINE> <DEDENT> return top_eight
sort shop in shoplist, elect best eight shop Args: shopIdlist:{shopId:rank} Returns: top_eight: top eight shop
625941d266673b3332b9224f
def testPullGoodRss(self): <NEW_LINE> <INDENT> data = ('<?xml version="1.0" encoding="utf-8"?>\n' '<rss version="2.0"><channel><my header="data"/>' '<item><guid>1</guid><updated>123</updated>wooh</item>' '</channel></rss>') <NEW_LINE> topic = 'http://example.com/my-topic' <NEW_LINE> callback = 'http://example.com/my-su...
Tests when the RSS XML can parse just fine.
625941d26fb2d068a760f25d
def stats(self): <NEW_LINE> <INDENT> for hero in self.heroes: <NEW_LINE> <INDENT> if hero.deaths != 0: <NEW_LINE> <INDENT> kd = hero.kills / hero.deaths <NEW_LINE> <DEDENT> print(f"Kills: {hero.kills} Deaths:{hero.deaths}")
Print team statistics
625941d2f8510a7c17cf98ba
def p_arr_decl_initialized(p): <NEW_LINE> <INDENT> def check_bound(boundlist, remaining): <NEW_LINE> <INDENT> lineno = p.lineno(8) <NEW_LINE> if not boundlist: <NEW_LINE> <INDENT> if not isinstance(remaining, list): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> error(lineno, 'Unexpected extra vector dimensions. I...
var_arr_decl : DIM idlist LP bound_list RP typedef RIGHTARROW const_vector | DIM idlist LP bound_list RP typedef EQ const_vector
625941d24428ac0f6e5ba9b1
def prepare_inputs(self, extrachanges=None, **kwargs): <NEW_LINE> <INDENT> if os.path.isdir(self.rundir+self.inputfile): <NEW_LINE> <INDENT> self.inputmod = self.inputmod(self.rundir+self.inputfile) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise IOError("OpenFOAM input " + self.rundir+self.inputfile + " not found"...
Make alterations to the base input file (specified on construction) that will be copied into the run directory. The input "changes" should be a dictionary of the form: {'cell':[8,8,8], 'domainsize':[1.,10.,2.], 'origin' : [0.,0.,0.] 'process':[1,1,1]} The user can also specify the full keyword in a form...
625941d257b8e32f52483659
def ci_secrets_file_resolver(secret_data, req_secret_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return next(secret['secret_data'] for secret in secret_data if match(secret.get('name', '.*'), req_secret_name)) <NEW_LINE> <DEDENT> except StopIteration: <NEW_LINE> <INDENT> raise ResolverKeyError( "Could not find ...
Resolve CI secret - extrat the data field :param list secret_data: A list representing the yaml config of the secrets file. :param str req_secret_name: The name of the requested secret. :rtype: dict :returns: A dict containing the requested keys and values
625941d2c4546d3d9de72bf3
def __init__(self, x, y): <NEW_LINE> <INDENT> self.x = float(x) <NEW_LINE> self.y = float(y)
Initializes the point class with x and y coordinates as floating point values :param x: A value representing the x coordinate :param y: A value representing the y coordinate :return:
625941d2f548e778e58cd73c
def build_pipeline(**kwargs): <NEW_LINE> <INDENT> import sklearn.pipeline as sk_pipeline <NEW_LINE> if sys.version_info[:2] < (3, 6): <NEW_LINE> <INDENT> raise RuntimeError("pipeline factory requires deterministic kwarg order") <NEW_LINE> <DEDENT> return sk_pipeline.Pipeline(list(kwargs.items()))
Build a pipeline from named steps. The order of the keyword arguments is retained. Note, this functionality requires python ``>= 3.6``. Usage:: pipeline = build_pipeline( transform=..., predict=..., )
625941d24e4d5625662d4595
def _initialize_data_pipeline(self): <NEW_LINE> <INDENT> self.x = tf.placeholder( dtype=tf.float32, shape=[None, self.input_size], name='input_ph') <NEW_LINE> self.labels = tf.placeholder( tf.float32, shape=[None, self.num_classes], name='class_ph') <NEW_LINE> self.eps = tf.placeholder( dtype=tf.float32, shape=[None, s...
Create placeholders for input and random values
625941d2eab8aa0e5d26dd16
def position_after(self, instr): <NEW_LINE> <INDENT> self._block = instr.parent <NEW_LINE> self._anchor = self._block.instructions.index(instr) + 1
Position immediately after the given instruction. The current block is also changed to the instruction's basic block.
625941d291af0d3eaac9bbd8
def get_topic(channel: discord.TextChannel, split: bool = False) -> Union[str, list, None]: <NEW_LINE> <INDENT> topic: str = channel.topic <NEW_LINE> if split == False: <NEW_LINE> <INDENT> return topic <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return topic.splitlines() <NEW_LINE> <DEDENT> e...
トピック情報を取得します。 引数splitedをTrueにすると、splitlinesが適用されたトピックデータを返します。
625941d299cbb53fe6792da4
def listAll(self): <NEW_LINE> <INDENT> return _ilwisobjects.ThematicRange_listAll(self)
listAll(ThematicRange self) -> PyObject *
625941d2046cf37aa974cf05
def update_global_config(self, config_model, tag="version1", detail=None): <NEW_LINE> <INDENT> return configuration._update_configuration( self._get_resource_root(), self.cluster_name, "global", tag, config_model)
Updates the global configuration of cluster. @param config_model: The configModel object @return: A ConfigModel object.
625941d24527f215b584c614
def sort_row_list_by_columns(row_list, sort_columns=(), desc_columns=()): <NEW_LINE> <INDENT> for column_index, column_name in reversed( [x for x in enumerate(sort_columns)]): <NEW_LINE> <INDENT> og = operator.itemgetter(column_index) <NEW_LINE> if not isinstance(row_list, list): <NEW_LINE> <INDENT> row_list = sorted( ...
Sort by leading sort columns by stable-sorting in reverse-index order.
625941d2d164cc6175782f0c
def create_api_service(self, body, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> return self.create_api_service_with_http_info(body, **kwargs)
create_api_service # noqa: E501 create an APIService # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_api_service(body, async_req=True) >>> result = thread.get() :param body: (required) :type body: V1APISe...
625941d215fb5d323cde0cd0
def plot_hz(self, Teff=[2600, 6000], inner='moist-greenhouse', outer='maximum-greenhouse', color='cornflowerblue', alpha=0.25, linewidth=0, **kw): <NEW_LINE> <INDENT> plt.sca(self.ax) <NEW_LINE> S_inner = make_hz(inner) <NEW_LINE> S_outer = make_hz(outer) <NEW_LINE> if np.atleast_1d(Teff).size == 1: <NEW_LINE> <INDENT>...
Add a bar that indicates an approximate habitable zone. (Estimated very roughly by eye from Kopparapu et al.) Pa
625941d224f1403a92600d23
def test_recv_assoc_ac_role(self, caplog): <NEW_LINE> <INDENT> with caplog.at_level(logging.DEBUG, logger="pynetdicom"): <NEW_LINE> <INDENT> self.ae = ae = AE() <NEW_LINE> ae.add_supported_context("1.2.840.10008.1.2", scu_role=True, scp_role=True) <NEW_LINE> ae.add_supported_context("1.2.840.10008.1.3", scu_role=True, ...
Test ACSE.debug_receive_associate_ac with role selection.
625941d2090684286d50eea5
def plugin_objective_load_balancing(self): <NEW_LINE> <INDENT> delta = 10 ** -6 <NEW_LINE> obj_expr = LinExpr() <NEW_LINE> for req in self.requests: <NEW_LINE> <INDENT> for u, v in self.substrate.substrate_edge_resources: <NEW_LINE> <INDENT> cost = self.substrate.get_edge_cost((u, v)) <NEW_LINE> capacity = self.substra...
Adaptation of AbstractEmbeddingModelcreator.plugin_objective_minimize_cost to include the additional coefficients used for load balancing.
625941d2b7558d58953c50d1
def test_vip_more_payment(self): <NEW_LINE> <INDENT> for i in range(0, 1): <NEW_LINE> <INDENT> self.driver.get(self.url) <NEW_LINE> self.driver.maximize_window() <NEW_LINE> self.lp.send_username("18180470015") <NEW_LINE> self.lp.send_password("123456") <NEW_LINE> self.lp.click_button() <NEW_LINE> self.mpp.click01() <NE...
会员购买单个项目,选择多个服务项目
625941d221a7993f00bc7eb0
def sub(self, other, level=None, fill_value=None, axis=0): <NEW_LINE> <INDENT> new_self, new_other = self._prepare_inter_op(other) <NEW_LINE> return super(Series, new_self).sub( new_other, level=level, fill_value=None, axis=axis )
Return subtraction of Series and `other`, element-wise (binary operator `sub`).
625941d2379a373c97cfad04
def __init__(self, behavior=None, max_replicas=None, metrics=None, min_replicas=None, scale_target_ref=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration.get_default_copy() <NEW_LINE> <DEDENT> self.local_vars_config...
V2beta2HorizontalPodAutoscalerSpec - a model defined in OpenAPI
625941d28c3a87329515857a
def test_get_liked_posts(self): <NEW_LINE> <INDENT> elon = User.objects.get(username='elonmusk') <NEW_LINE> self.assertEqual(elon.liked_posts.count(), 2)
given a user, get their liked posts
625941d28e71fb1e9831d967
def PIDsteer(self, setpoint): <NEW_LINE> <INDENT> P = self.inertial_data[0, self.angle_z] <NEW_LINE> max_p = max(self.inertial_data[0, self.steer_P], self.inertial_data[1, self.steer_P]) <NEW_LINE> min_p = min(self.inertial_data[0, self.steer_P], self.inertial_data[1, self.steer_P]) <NEW_LINE> I = ((max_p - min_p) / 2 ...
Calculate the error value to apply to the steering to keep the robot tracking in a straight line. Return a Controller Output (CO) in the range -100 to +100
625941d27047854f462a15c7
def slide_count(self): <NEW_LINE> <INDENT> return super(ListPreviewWidget, self).rowCount()
Returns the number of slides this widget holds.
625941d250485f2cf553cf59
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, TeamEventStatusRankRanking): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
625941d2b57a9660fec33a43
def getBodyFile(self): <NEW_LINE> <INDENT> fd = StringIO.StringIO() <NEW_LINE> if not empty(self._pmap): <NEW_LINE> <INDENT> multi = self._pmap.get('multi') <NEW_LINE> if not multi: <NEW_LINE> <INDENT> phash = self._pmap.get("phash", None) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pmap = self._pmap.get('part_map') ...
Retrieve a file object containing only the body of this message. :return: file-like object opened for reading :rtype: StringIO
625941d2de87d2750b85ff52
def prepare_containers(zone_file: pathlib.Path, zone_domain: str, cid: int, restart: bool, implementations: Dict[str, Tuple[bool, int]], tag: str) -> None: <NEW_LINE> <INDENT> process_pool = [] <NEW_LINE> for impl, (check, port) in implementations.items(): <NEW_LINE> <INDENT> if check: <NEW_LINE> <INDENT> process_pool....
Either starts new containers or reuses existing containers to prepare the container to serve the input zone file. Uses one process for each implementation tested to speedup preparation. :param zone_file: The path to the zone file :param zone_domain: The zone origin :param cid: The unique id for all the containers :par...
625941d25fcc89381b1e187e
def _get_keyword_list(self, keyword_entry_list): <NEW_LINE> <INDENT> keyword_list = [] <NEW_LINE> for keyword_entry_dict in keyword_entry_list: <NEW_LINE> <INDENT> keyword = self._get_dict_item(keyword_entry_dict, '$', '') <NEW_LINE> keyword_list.append(keyword) <NEW_LINE> <DEDENT> return keyword_list
Creates a list of string keywords from the keyword entry list given :param keyword_entry_list: The list of dicts, which was ectracted from the response dict of a abstract retrieval response request. :return: A list of string keywords for the publication
625941d23eb6a72ae02ec69f
def __init__(self, operation, contract, status_extractor=None, cleanup=None): <NEW_LINE> <INDENT> self.__operation = operation <NEW_LINE> self.__contract = contract <NEW_LINE> self.__status_extractor = status_extractor <NEW_LINE> self.__cleanup = cleanup
Construct instance. Args: operation: [AgentOperation] To be performed. contract: [JsonContract] To verify operation. status_extractor: [Callable(OperationStatus, ExecutionContext)] See the status_extractor property for more information. cleanup: [Callable(ExecutionContext)] Perform any post-test clea...
625941d2cdde0d52a9e531f3
def _invoice_columns(self): <NEW_LINE> <INDENT> result = [] <NEW_LINE> result.append(Column("<span class='fa fa-comment'></span>")) <NEW_LINE> result.append(Column(u"N° facture", u"official_number")) <NEW_LINE> if self.is_admin_view: <NEW_LINE> <INDENT> result.append(Column(u"Enseigne", u"company")) <NEW_LINE> <DEDENT>...
Columns used to display an invoice list
625941d221bff66bcd684b10
def find_winner(election): <NEW_LINE> <INDENT> dem_votes = 0 <NEW_LINE> gop_votes = 0 <NEW_LINE> for state in election: <NEW_LINE> <INDENT> if state.get_winner() == "dem": <NEW_LINE> <INDENT> dem_votes += state.get_num_ecvotes() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> gop_votes += state.get_num_ecvotes() <NEW_LIN...
Finds the winner of the election based on who has the most amount of EC votes. Note: In this simplified representation, all of EC votes from a state go to the party with the majority vote. Parameters: election - a list of State instances Returns: a tuple, (winner, loser) of the election i.e. ('dem', 'gop') if Democra...
625941d2091ae3566866711b
def load_from_json_file(self, file_path): <NEW_LINE> <INDENT> with open(file_path, 'r') as f: <NEW_LINE> <INDENT> s = f.read() <NEW_LINE> self.load_from_json_str(s)
loads data from json string from a file :param file_path: path to json file :return:
625941d2566aa707497f4726
def _find_attributes_in_question(self, question): <NEW_LINE> <INDENT> attributes_position = set() <NEW_LINE> for attribute in self._attributes: <NEW_LINE> <INDENT> position = question.find(attribute) <NEW_LINE> if position != -1: <NEW_LINE> <INDENT> attributes_position.add(position) <NEW_LINE> <DEDENT> <DEDENT> return ...
Returns positions of attributes in the question. Positions are sorted.
625941d2435de62698dfde0c
def get_rbase_ip(self, rpkt): <NEW_LINE> <INDENT> dst = rpkt.src <NEW_LINE> src = rpkt.dst <NEW_LINE> options = rpkt.options <NEW_LINE> return IP(src=src, dst=dst, options=options)
Creates a base IP packet based on a rcvd segment. :param rpkt: rcvd IP packet to base a new packet off of :type rpkt: scapy.IP
625941d2dc8b845886cb56f4
def dump_data_nocontent(path,newdata): <NEW_LINE> <INDENT> archive = [] <NEW_LINE> archive_dict = {} <NEW_LINE> new = {x:y for x,y in newdata.items()} <NEW_LINE> if os.path.exists(path): <NEW_LINE> <INDENT> with open(path,'r',encoding='utf-8') as f: <NEW_LINE> <INDENT> old = json.load(f) <NEW_LINE> archive = old['artic...
保存爬取的文章(仅题目),已存在则追加,不存在就创建。无返回值
625941d23539df3088e2e50a
def get_indexer(self, target, method=None, limit=None): <NEW_LINE> <INDENT> method = com._clean_reindex_fill_method(method) <NEW_LINE> target = _ensure_index(target) <NEW_LINE> pself, ptarget = self._possibly_promote(target) <NEW_LINE> if pself is not self or ptarget is not target: <NEW_LINE> <INDENT> return pself.get_...
Compute indexer and mask for new index given the current index. The indexer should be then used as an input to ndarray.take to align the current data to the new index. Parameters ---------- target : Index method : {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'} * default: exact matches only. * pad / ffill...
625941d2bd1bec0571d907ee
def run_battle(battle): <NEW_LINE> <INDENT> scores = [] <NEW_LINE> while battle.over == False: <NEW_LINE> <INDENT> battle.nextRound() <NEW_LINE> sendToLog(battle) <NEW_LINE> <DEDENT> for p in battle.players: <NEW_LINE> <INDENT> print(p.name + " scored " + str(p.score) + " point(s)!") <NEW_LINE> scores.append([p.name, p...
Runs a battle simulation.
625941d24f6381625f114bf9
def set_marker(self, code): <NEW_LINE> <INDENT> if not isinstance(code, int): <NEW_LINE> <INDENT> raise TypeError('Marker code must be an integer!') <NEW_LINE> <DEDENT> if 0 <= code <= 7: <NEW_LINE> <INDENT> raise ValueError('Marker code value is not valid') <NEW_LINE> <DEDENT> self.process(EventMarker(timestamp=time.t...
Set a marker in the stream
625941d282261d6c526ab660
def request(self, zeroconf, timeout): <NEW_LINE> <INDENT> now = currentTimeMillis() <NEW_LINE> delay = _LISTENER_TIME <NEW_LINE> next = now + delay <NEW_LINE> last = now + timeout <NEW_LINE> result = 0 <NEW_LINE> try: <NEW_LINE> <INDENT> zeroconf.addListener(self, DNSQuestion(self.name, _TYPE_ANY, _CLASS_IN)) <NEW_LINE...
Returns true if the service could be discovered on the network, and updates this object with details discovered.
625941d2aad79263cf390c01
def removeBreakpoint(self, address): <NEW_LINE> <INDENT> self.emu.remove_breakpoint(address) <NEW_LINE> return
Remove the breakpoint at the specified address.
625941d276e4537e8c351832