code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def ucb1_func(node: Node, c: float) -> Node: <NEW_LINE> <INDENT> child_action_key, urgent_child = None, None <NEW_LINE> ucb1_max = -np.inf <NEW_LINE> for a, child in zip(node.children.keys(), node.children.values()): <NEW_LINE> <INDENT> ucb1 = (child.r / child.n) + c * (((2 * log(node.n)) / child.n) ** (1 / 2)) <NEW_LI...
Returns the most urgent child to visit using the Upper Bound Confidence interval :param node: Node: current node in which to check for most urgent child :param c: float: exploration parameter :return: Node: node of the most urgent child to visit
625941d18a43f66fc4b541fb
def _create_biolist_comment(self): <NEW_LINE> <INDENT> if not self._current_set: <NEW_LINE> <INDENT> self._logger.error('Tried to save biolist num, but current set not set.') <NEW_LINE> return <NEW_LINE> <DEDENT> BIOLIST_NOTE_PREFIX = 'Biolist #' <NEW_LINE> APPSTATE = f"set_details_state::Set {self.currentSetId} Detail...
Replaces _save_notes_biolist_num func Adds biolist string to comment table instead of saving directly to fishing_activity.notes. Comment record is picked up for comment parsing later (FIELD-2071) :return: None
625941d12eb69b55b151ca47
def test_same_comment_same_highlight(self): <NEW_LINE> <INDENT> message1 = "You have posted same comment on this highlight before." <NEW_LINE> message2 = "Consider editting the comment or highlight" <NEW_LINE> message = message1+message2 <NEW_LINE> response = self.highlight()[6] <NEW_LINE> self._400_bad_request(respons...
Test same user same comment same highlight
625941d1fff4ab517eb2f5d3
def initialize(self, data): <NEW_LINE> <INDENT> self.clear() <NEW_LINE> self.__draw_global_node(data)
初始化全局变量。
625941d1956e5f7376d71003
def remove_user_ratings (sample_20_raw_data, user_ID): <NEW_LINE> <INDENT> with_user_ratings_RDD = loadRDD(sample_20_raw_data) <NEW_LINE> sample_20_sin_user_ratings_RDD = with_user_ratings_RDD.filter(lambda x: x[1] != user_ID) <NEW_LINE> return sample_20_sin_user_ratings_RDD
Enlève de l'échantillon de 20M les tuples de l'utilisateur user_ID.
625941d115fb5d323cde0ca7
def __init__(self, driver): <NEW_LINE> <INDENT> super(CheckStatus, self).__init__(driver) <NEW_LINE> self.resultList = []
Inits CheckPoint class
625941d1a8370b7717052a35
def menu(self): <NEW_LINE> <INDENT> self.menubar = tk.Menu(self.root) <NEW_LINE> self.menubar.add_command(label="Help", command=self.help) <NEW_LINE> self.root.config(menu=self.menubar) <NEW_LINE> self.frame2 = tk.Frame(self.root) <NEW_LINE> self.frame2["bg"] = "coral" <NEW_LINE> self.frame2.pack(side='left', fill=tk.Y...
Listbox on the left with file names
625941d1c432627299f04ddd
def mm_move(board, player): <NEW_LINE> <INDENT> if board.check_win() == None: <NEW_LINE> <INDENT> move_list = [] <NEW_LINE> for empty_square in board.get_empty_squares(): <NEW_LINE> <INDENT> board_clone = board.clone() <NEW_LINE> board_clone.move(empty_square[0], empty_square[1], player) <NEW_LINE> score, dummy_move = ...
Make a move on the board. Returns a tuple with two elements. The first element is the score of the given board and the second element is the desired move as a tuple, (row, col).
625941d1c4546d3d9de72bcb
def handle_cover_service(service): <NEW_LINE> <INDENT> method = SERVICE_TO_METHOD.get(service.service) <NEW_LINE> params = service.data.copy() <NEW_LINE> params.pop(ATTR_ENTITY_ID, None) <NEW_LINE> if not method: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> covers = component.extract_from_service(service) <NEW_LINE> ...
Handle calls to the cover services.
625941d1379a373c97cfacdc
def find_package_data(): <NEW_LINE> <INDENT> excludes = ['mathjax'] <NEW_LINE> excludes = tuple([os.path.join('static', ex) for ex in excludes]) <NEW_LINE> cwd = os.getcwd() <NEW_LINE> os.chdir(os.path.join('IPython', 'html')) <NEW_LINE> static_walk = list(os.walk('static')) <NEW_LINE> static_data = [] <NEW_LINE> for p...
Find IPython's package_data.
625941d17d43ff24873a2e37
def __rxor__(self, other): <NEW_LINE> <INDENT> return Nodex(other ^ self)
Gereneric implementation for right hand ^ operator
625941d18e7ae83300e4b163
def is_pos_def(x): <NEW_LINE> <INDENT> x = x.detach().numpy() <NEW_LINE> return np.all(np.linalg.eigvalsh(x) > 0)
Check if the matrix is positive definite
625941d13317a56b86939ded
def get_gpu_ids(self)->list: <NEW_LINE> <INDENT> gpu_ids = self.config.App.gpu_ids <NEW_LINE> return gpu_ids
Return gpu ids :return: gpu idxes
625941d1d164cc6175782ee5
def setVisibilityEpsilon(self, *args): <NEW_LINE> <INDENT> return _motionplanning.CSpaceInterface_setVisibilityEpsilon(self, *args)
setVisibilityEpsilon(CSpaceInterface self, double eps)
625941d19b70327d1c4e0f6c
def convert( self, cls: Type[AbstractLUT], force_conversion: Boolean = False, **kwargs: Any, ) -> AbstractLUT: <NEW_LINE> <INDENT> return LUT_to_LUT(self, cls, force_conversion, **kwargs)
Convert the *LUT* to given ``cls`` class instance. Parameters ---------- cls *LUT* class instance. force_conversion Whether to force the conversion as it might be destructive. Other Parameters ---------------- interpolator Interpolator class type to use as interpolating function. interpolator_kwargs A...
625941d131939e2706e4d000
@cache('step') <NEW_LINE> def wp_daily_costs(): <NEW_LINE> <INDENT> return (wp_unit_conversion_factor() * wp_total_dynamic_head_of_pump() * wp_duration_of_pump_operation() * electricity_fee() * (distributed_treated_water() * 0.0115741)) / ( wp_motor_efficiency() * wp_pump_efficiency() * wp_variable_speed_drive_efficien...
Real Name: WP Daily Costs Original Eqn: (WP Unit Conversion Factor * WP Total Dynamic Head of Pump * WP Duration of Pump Operation\ * Electricity Fee * (Distributed Treated Water * 0.0115741)) / (WP Motor Efficiency* WP Pump Efficiency*WP Variable Speed Drive Efficiency) + WP Daily Maintenance Units: $/Day Limits: (Non...
625941d15510c4643540f579
def _derivative_(self, alpha, x, diff_param=None): <NEW_LINE> <INDENT> if diff_param == 0: <NEW_LINE> <INDENT> raise NotImplementedError("cannot differentiate airy_bi in the" " first parameter") <NEW_LINE> <DEDENT> return airy_bi_general(alpha + 1, x)
EXAMPLES:: sage: from sage.functions.airy import airy_bi_general sage: x, n = var('x n') sage: derivative(airy_bi_general(n, x), x) airy_bi(n + 1, x) sage: derivative(airy_bi_general(n, x), n) Traceback (most recent call last): ... NotImplementedError: cannot differentiate airy_bi in th...
625941d1ab23a570cc25031a
def _preprocessing(self, pattern): <NEW_LINE> <INDENT> pat_len = len(pattern) <NEW_LINE> if pat_len == 1: <NEW_LINE> <INDENT> return [1] <NEW_LINE> <DEDENT> Z = [0 for _ in pattern] <NEW_LINE> Z[0] = pat_len <NEW_LINE> Z[1] = self._matched_len(pattern, 0, 1) <NEW_LINE> for i in range(2, 1 + Z[1]): <NEW_LINE> <INDENT> Z...
returns array i-th element of which is the length of the substring of given string which begins at i-th position and simulataniously is a prefix of the string
625941d1fb3f5b602dac382b
@common_bp.route("/files/<path:path>") <NEW_LINE> def get_file(path): <NEW_LINE> <INDENT> return send_from_directory(app.config['USER_DATA'], path, as_attachment=True)
Download a file.
625941d1711fe17d82542501
def renderer_dip_edited(self, widget, path, new_string): <NEW_LINE> <INDENT> new_number = self.validate_numeric_input(new_string, "dip") <NEW_LINE> if new_number is not None: <NEW_LINE> <INDENT> self.store[path][1] = new_number <NEW_LINE> self.redraw() <NEW_LINE> return new_number <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
If the dip angle is edited, replace the existing value. The function replaces a ","- with a "."-comma. Converts the string value to a float.
625941d121a7993f00bc7e88
def wage_approval_action(self, ids_list): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> print("\nEnter # to Go Back otherwise.") <NEW_LINE> approval_id = input("Enter S.No.: ") <NEW_LINE> if approval_id == '#': <NEW_LINE> <INDENT> print("\nAction aborted.") <NEW_LINE> break <NEW_LINE> <DEDENT> elif approval_id in...
Approve/Reject wage request. :param ids_list: wage request id :return: True/False
625941d1b57a9660fec33a1b
def mu(self, z): <NEW_LINE> <INDENT> return 5. * np.log10(self.Dl(z) * 1E6) - 5.
Distance Modulus at redshift z
625941d1046cf37aa974cede
def query_all_sub_options(self, on_off=False): <NEW_LINE> <INDENT> if on_off: <NEW_LINE> <INDENT> self.query_disk_data = True <NEW_LINE> self.query_license_data = True <NEW_LINE> self.query_net_data = True
If set enables the querying of all suboptions
625941d1bd1bec0571d907c6
def get_mount_volume(self, mount_name, volume_name, container_path, mode): <NEW_LINE> <INDENT> if mount_name not in self.mounts: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> volume = None <NEW_LINE> mount_config = self.mounts[mount_name] <NEW_LINE> mount_type = mount_config.mount_type <NEW_LINE> if mount_type ==...
Returns the volume that has been configured for the given mount name. If the given mount is not defined in this configuration, None is returned. :param mount_name: The name of the mount defined in the job type :type mount_name: string :param volume_name: The name of the volume :type volume_name: string :param containe...
625941d1b57a9660fec33a1c
def ordered_load( stream, Loader=yaml.SafeLoader, object_pairs_hook=collections.OrderedDict ): <NEW_LINE> <INDENT> class OrderedLoader(Loader): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def construct_mapping(loader, node): <NEW_LINE> <INDENT> loader.flatten_mapping(node) <NEW_LINE> return object_pairs_hook(loader.co...
Load yaml files and keeping order. From stackoverflow.com/questions/5121931 :param stream the file object to read :param loader yaml.SafeLoader or its subclasses :object_pairs_hook type of return :return OrderedDict object with the same order of the yaml file
625941d115fb5d323cde0ca8
def select_sort(lst): <NEW_LINE> <INDENT> for i, item in enumerate(lst): <NEW_LINE> <INDENT> min_idx = len(lst) - 1 <NEW_LINE> for j in range(i, len(lst)): <NEW_LINE> <INDENT> if lst[j] < lst[min_idx]: <NEW_LINE> <INDENT> min_idx = j <NEW_LINE> <DEDENT> <DEDENT> if min_idx != i: <NEW_LINE> <INDENT> lst[min_idx], lst[i]...
Selection sort
625941d163d6d428bbe44686
def __str__(self): <NEW_LINE> <INDENT> return self.to_string()
Make sure str works exactly the same as python 3
625941d15166f23b2e1a52f0
def split_edge_mesh(mesh, u, v, t=0.5, allow_boundary=False): <NEW_LINE> <INDENT> if t <= 0.0: <NEW_LINE> <INDENT> raise ValueError('t should be greater than 0.0.') <NEW_LINE> <DEDENT> if t >= 1.0: <NEW_LINE> <INDENT> raise ValueError('t should be smaller than 1.0.') <NEW_LINE> <DEDENT> fkey_uv = mesh.halfedge[u][v] <N...
Split and edge by inserting a vertex along its length. Parameters: u (str): The key of the first vertex of the edge. v (str): The key of the second vertex of the edge. t (float): The position of the inserted vertex. allow_boundary (bool): Split boundary edges, if True. Defaults to False. Retur...
625941d1b830903b967e9aa1
def export(self, directory): <NEW_LINE> <INDENT> if not self.existing or not hasattr(self, 'filename'): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> secret_h = self.export_handle(directory) <NEW_LINE> obj = self.existing <NEW_LINE> if isinstance(obj, str): <NEW_LINE> <INDENT> secret_h.write(obj) <NEW_LINE> <DEDENT> e...
Export exportable resources decoding as needed
625941d1f9cc0f698b140792
def error_handler(update, context, error): <NEW_LINE> <INDENT> logging.error('Update "%s" caused error "%s"', update, error) <NEW_LINE> update.message.reply_text('對不起,似乎服务器出现问题了,正在处理。。。')
Log Errors caused by Updates.
625941d1442bda511e8be5ae
def get_new_id(utt, utt_modifier_type, utt_modifier): <NEW_LINE> <INDENT> if utt_modifier_type == "suffix" and len(utt_modifier) > 0: <NEW_LINE> <INDENT> new_utt = utt + "-" + utt_modifier <NEW_LINE> <DEDENT> elif utt_modifier_type == "prefix" and len(utt_modifier) > 0: <NEW_LINE> <INDENT> new_utt = utt_modifier + "-" ...
This function generates a new id from the input id This is needed when we have to create multiple copies of the original data E.g. get_new_id("swb0035", prefix="rvb", copy=1) returns a string "rvb1_swb0035"
625941d18c0ade5d55d3eb52
def get_problem_item_count(self): <NEW_LINE> <INDENT> return Item_Current_Status.objects.filter(item__batch_item__batch=self, has_problem=True).count()
Gets count of items in this batch that have unresolved problems
625941d15fc7496912cc3b15
def _isophote_list_to_table(isophote_list, columns='main'): <NEW_LINE> <INDENT> properties = {} <NEW_LINE> meta = {'version': _get_version_info()} <NEW_LINE> isotable = QTable(meta=meta) <NEW_LINE> def __rename_properties(properties, orig_names=['int_err', 'eps', 'ellip_err', 'grad_r_error', 'nflag'], new_names=['inten...
Convert an `~photutils.isophote.IsophoteList` instance to a `~astropy.table.QTable`. Parameters ---------- isophote_list : list of `~photutils.isophote.Isophote` or `~photutils.isophote.IsophoteList` instance A list of isophotes. columns : list of str A list of properties to export from the isopho...
625941d1bf627c535bc13366
def read_auth(): <NEW_LINE> <INDENT> print('> Please provide your username and password:') <NEW_LINE> username = input('< ') <NEW_LINE> password = input('< ') <NEW_LINE> return username, password
Reads user authentification credentials from keyboard Returns: username (str) -- Username password (str) -- Password
625941d1b830903b967e9aa2
def test_response_json(tests_path): <NEW_LINE> <INDENT> responses_path = os.path.join(tests_path, '..', 'responses', '*.json') <NEW_LINE> for jpf in glob.glob(responses_path): <NEW_LINE> <INDENT> jfile = open(jpf, 'r') <NEW_LINE> jpf_text = jfile.read() <NEW_LINE> response_file = ('"consumption"' in jpf_text and '"grow...
Check that each JSON file can be converted into dictionaries that can be used to construct objects needed for a Calculator object.
625941d1956e5f7376d71004
def __init__(self, dir, prefix='/'): <NEW_LINE> <INDENT> print("[Indexer::__init__] dir=%s, prefix=%s" % (dir, prefix)) <NEW_LINE> self.path = dir <NEW_LINE> self.prefix = prefix <NEW_LINE> self.abs = path.abspath(path.expanduser(dir)) <NEW_LINE> print(" hosting", self.abs)
Construct an Indexer middleware object, provided a directory to call and an optional http prefix. @param dir str: The path to the directory to serve. @param prefix str: The http prefix
625941d18c0ade5d55d3eb53
def save_stat_files(self, x, t=None): <NEW_LINE> <INDENT> if isinstance(x, str): <NEW_LINE> <INDENT> x_list = [x, ] <NEW_LINE> <DEDENT> elif isinstance(x, list): <NEW_LINE> <INDENT> x_list = x <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Exception('character or list supported, unknown types detected') <NEW_LINE>...
Write list of files to file t
625941d1b545ff76a8913fad
def _check_all(self, state): <NEW_LINE> <INDENT> if state == "down" and self.table.check_all(state): <NEW_LINE> <INDENT> self.table.table_header.ids.check.state = "down" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.table.table_header.ids.check.state = "normal"
Checks if all checkboxes are in same state
625941d13617ad0b5ed6808f
def searchMatrix_ii_submisson2(self, matrix, target): <NEW_LINE> <INDENT> if not matrix: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> len_matrix = len(matrix) <NEW_LINE> ridx = 0 <NEW_LINE> cidx = len(matrix[0]) - 1 <NEW_LINE> while ridx < len_matrix and cidx >= 0: <NEW_LINE> <INDENT> val = matrix[ridx][cidx] <...
:type matrix: List[List[int]] :type target: int :rtype: bool
625941d1ec188e330fd5a935
def box_iou(boxes1, boxes2): <NEW_LINE> <INDENT> box_area = lambda boxes: ((boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])) <NEW_LINE> areas1 = box_area(boxes1) <NEW_LINE> areas2 = box_area(boxes2) <NEW_LINE> inter_upperlefts = np.maximum(boxes1[:, None, :2], boxes2[:, :2]) <NEW_LINE> inter_lowerrights = np.m...
Compute pairwise IoU across two lists of anchor or bounding boxes. Defined in :numref:`sec_anchor`
625941d1925a0f43d254a00f
def SearchInMenuAndClick(val): <NEW_LINE> <INDENT> while poco(text=val).exists()==False: <NEW_LINE> <INDENT> swipe([100, 500],0, vector=[0, -0.5]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> poco(text=val).click()
Ищем элементы и сравниваем текст
625941d182261d6c526ab638
def calc_variables ( ): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> import math <NEW_LINE> from averages_module import msd, VariableType <NEW_LINE> from mc_chain_lj_module import potential, spring_pot, PotentialType <NEW_LINE> total = potential(r) <NEW_LINE> assert not total.ovr, 'Overlap in configuration' <NE...
Calculates all variables of interest. They are collected and returned as a list, for use in the main program.
625941d138b623060ff0af85
def test_add(c, x1, y1, x2, y2, x3, y3): <NEW_LINE> <INDENT> p1 = Point(c, x1, y1) <NEW_LINE> p2 = Point(c, x2, y2) <NEW_LINE> p3 = p1 + p2 <NEW_LINE> print_("%s + %s = %s" % (p1, p2, p3), end=' ') <NEW_LINE> if p3.x() != x3 or p3.y() != y3: <NEW_LINE> <INDENT> raise FailedTest("Failure: should give (%d,%d)." % (x3, y3...
We expect that on curve c, (x1,y1) + (x2, y2 ) = (x3, y3).
625941d1aad79263cf390bda
def remove_html_tags(text: str) -> str: <NEW_LINE> <INDENT> clean = re.compile(r'<.*?>') <NEW_LINE> return re.sub(clean, '', text)
Removes html tags :param text: Text to be cleaned :return: Clean text
625941d1d4950a0f3b08c4e6
def doRandomTests(functions, bin_size, max_value, min_value, numbers_object): <NEW_LINE> <INDENT> every_stats = {f.__name__: [] for f in functions} <NEW_LINE> for nb in numbers_object: <NEW_LINE> <INDENT> objects = [randint(min_value, max_value) for _ in range(nb)] <NEW_LINE> execFunctionsStats(every_stats, functions, ...
Generates random lists of objects of different sizes and executes functions on them :param numbers_object: a list of numbers that represent the size of the object list :param functions: a list of functions to execute :param bin_size: size of the bin :param max_value: maximum value of an object :param min_value: minimum...
625941d191af0d3eaac9bbb1
def lineAfterFont(self): <NEW_LINE> <INDENT> if True: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self.mtd[self.ptr] == 1: <NEW_LINE> <INDENT> self.ptr += 1 <NEW_LINE> self.endct += 1 <NEW_LINE> print("LINE after font") <NEW_LINE> if self.mtd[self.ptr] == 0: <NEW_LINE> <INDENT> print("END after font LINE")
generated source for method lineAfterFont
625941d1a934411ee375182b
def metadata(self, stack_id, resource_name): <NEW_LINE> <INDENT> stack_id = self._resolve_stack_id(stack_id) <NEW_LINE> resp, body = self.api.json_request('GET', '/stacks/%s/resources/%s/metadata' % (stack_id, resource_name)) <NEW_LINE> return Resource(self, body['metadata'])
Get the metadata for a specific resource. :param stack_id: ID of stack containing the resource :param resource_name: ID of resource to get metadata for
625941d19f2886367277aa24
def clean_shutdown(test, broker_type): <NEW_LINE> <INDENT> node = broker_node(test, broker_type) <NEW_LINE> test.kafka.signal_node(node, sig=signal.SIGTERM)
Discover broker node of requested type and shut it down cleanly.
625941d17c178a314d6ef5f8
def reset(self): <NEW_LINE> <INDENT> raise NotImplementedError
:return: measurements, observation, done
625941d11f037a2d8b946395
def process_response(self, statement, session_id=None): <NEW_LINE> <INDENT> subprocess.check_output(['tark-win-lt', statement.text]) <NEW_LINE> print("[LiepaTtsAdapter]Computer says: : " + statement.text) <NEW_LINE> return statement.text
Print the response to the user's input.
625941d14a966d76dd5511a7
def get_depths(self): <NEW_LINE> <INDENT> z1 = self.z1_spinbox.value() <NEW_LINE> z2 = self.z2_spinbox.value() <NEW_LINE> meas_depths = self.meas_depth_line.text() <NEW_LINE> meas_depths = np.array([float(md) for md in meas_depths.split()]) <NEW_LINE> return z1, z2, meas_depths
:return: depth top of spike, depth bottom of spike, ndarray of measurement depths
625941d145492302aab5e45c
def create_or_update( self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, polling=True, **operation_config): <NEW_LINE> <INDENT> raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, s...
Creates or updates a subnet in the specified virtual network. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param virtual_network_name: The name of the virtual network. :type virtual_network_name: str :param subnet_name: The name of the subnet. :type subnet_name: str :para...
625941d150812a4eaa59c4b8
def softmax_smooth(a, b, smooth=0.0): <NEW_LINE> <INDENT> t = smooth / 2.0 <NEW_LINE> return torch.log( torch.exp((1.0 - t) * a + b * t) + torch.exp((1.0 - t) * b + t * a) ) - np.log(1.0 + smooth)
The smoothed softmaximum of softmax(a,b) = log(e^a + a^b). With smooth=0.0, is softmax; with smooth=1.0, averages a and b
625941d1462c4b4f79d1d868
def setup_platform(hass, config, add_devices, discovery_info=None): <NEW_LINE> <INDENT> value_template = config.get(CONF_VALUE_TEMPLATE) <NEW_LINE> if value_template is not None: <NEW_LINE> <INDENT> value_template.hass = hass <NEW_LINE> <DEDENT> add_devices([MqttClimate( hass, config.get(CONF_NAME), config.get(CONF_STA...
Setup the MQTT climate device.
625941d1cdde0d52a9e531cc
def phase(self, ph0, ph1, axis=0): <NEW_LINE> <INDENT> import math as m <NEW_LINE> todo = self.test_axis(axis) <NEW_LINE> it = self.axes(todo).itype <NEW_LINE> if it == 0: <NEW_LINE> <INDENT> raise NPKError(msg="no phase correction on real data-set", data=self) <NEW_LINE> <DEDENT> size = self.axes(todo).size//2 <NEW_LI...
apply a phase correction along given axis phase corrections are in degree
625941d1de87d2750b85ff2b
def setModel(self, *args): <NEW_LINE> <INDENT> return _Seismology.TravelTimeTable_setModel(self, *args)
setModel(TravelTimeTable self, std::string const & model) -> bool
625941d14d74a7450ccd435b
@pytest.fixture <NEW_LINE> def local_fixture(): <NEW_LINE> <INDENT> print('doing local fixture setup stuff')
fixtures are callables(functions) decoratred with @fixture
625941d110dbd63aa1bd2d3b
def _get_api_server(): <NEW_LINE> <INDENT> global _GLANCE_API_SERVER <NEW_LINE> if not _GLANCE_API_SERVER: <NEW_LINE> <INDENT> _GLANCE_API_SERVER = _get_api_server_iterator() <NEW_LINE> <DEDENT> return six.next(_GLANCE_API_SERVER)
Return a Glance API server. :returns: for an API server, the tuple (host-or-IP, port, use_ssl), where use_ssl is True to use the 'https' scheme, and False to use 'http'.
625941d1e5267d203edcde34
def key_indexed_sort(data): <NEW_LINE> <INDENT> max_sector = data[0][1] <NEW_LINE> for _, sector in data: <NEW_LINE> <INDENT> if sector > max_sector: <NEW_LINE> <INDENT> max_sector = sector <NEW_LINE> <DEDENT> <DEDENT> frequencies = [0] * (max_sector + 1) <NEW_LINE> for _, sector in data: <NEW_LINE> <INDENT> frequencie...
Sorts the passed in strings using key indexed method. :param List[(str, sector)] data: A list containing tuples of the the string to sort and its sector. :returns: A list with the sorted by sectors strings. :rtype: List[str]
625941d1925a0f43d254a010
@utils.log_function <NEW_LINE> @cache <NEW_LINE> def records_with_office_and_election_year(from_date, to_date, report_type): <NEW_LINE> <INDENT> def add_election_columns(record): <NEW_LINE> <INDENT> record['Office'], record["Election Year"] = election_of_committee( record["Committee Name"], utils.year_from_date(record[...
:rtype: :py:class:`tablib.Dataset`
625941d110dbd63aa1bd2d3c
def __setattr__(self, name, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if name.upper() in self.__dict__['all_variables']: <NEW_LINE> <INDENT> self.set_variable(name, value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__dict__[name] = value <NEW_LINE> <DEDENT> <DEDENT> except KeyError: <NEW_LINE> <INDEN...
Function to overload setting attributes to allow geometry variable assigment as if member data.
625941d1dd821e528d63b340
@utils.command(locked_servers) <NEW_LINE> @click.option( "--output-format", "-f", type=click.Choice(["json", "csv"]), default="json", show_default=True, help="Format of the output" ) <NEW_LINE> def get_all(output_format): <NEW_LINE> <INDENT> servers = [] <NEW_LINE> cursor = server.ServerModel.collection().find( {"lock"...
List locked servers
625941d1462c4b4f79d1d869
def testFromFilename(self): <NEW_LINE> <INDENT> config = BpsConfig(self.filename) <NEW_LINE> self.assertIn("foo", config)
Test initialization from a file.
625941d13d592f4c4ed1d204
@app.route('/old') <NEW_LINE> def main(): <NEW_LINE> <INDENT> app.logger.info('User accessed the main.html template') <NEW_LINE> return render_template('main.html', title="Sentiment Analysis")
twitter sentiment analysisinput page
625941d1711fe17d82542502
def send_unsent(self): <NEW_LINE> <INDENT> for i in range(len(self.unsent)): <NEW_LINE> <INDENT> recipients, msg_string = self.unsent.pop(i) <NEW_LINE> self._attempt_send(recipients, msg_string)
Emails that were not being able to send will be stored in self.unsent. Use this function to attempt to send these again
625941d1099cdd3c635f0df3
def tournamentSelection(self): <NEW_LINE> <INDENT> candidates = [] <NEW_LINE> for k in range(int(self.population_size * self.percentage_for_tournament)): <NEW_LINE> <INDENT> candidates.append(choice(self.population)) <NEW_LINE> <DEDENT> candidates.sort(key=lambda p: p["score"], reverse=True) <NEW_LINE> return (candidat...
Sélection par tournoi
625941d11b99ca400220ac49
@app.route("/buy", methods=["GET", "POST"]) <NEW_LINE> @login_required <NEW_LINE> def buy(): <NEW_LINE> <INDENT> if request.method == "POST": <NEW_LINE> <INDENT> symbol = request.form.get("symbol") <NEW_LINE> if not symbol.isalpha(): <NEW_LINE> <INDENT> return apology("reinput symbol please") <NEW_LINE> <DEDENT> if not...
Buy shares of stock
625941d1cb5e8a47e48b7c41
def test_enqueue_method(): <NEW_LINE> <INDENT> from que_ import Queue <NEW_LINE> q = Queue() <NEW_LINE> assert type(q) == Queue
Add a node into the queue.
625941d14f88993c3716c1fe
def whitelist(string, valid_chars=FILE_CHARS, rep_char='_'): <NEW_LINE> <INDENT> chars = list(string) <NEW_LINE> for ind, char in enumerate(chars): <NEW_LINE> <INDENT> if char not in valid_chars: <NEW_LINE> <INDENT> chars[ind] = rep_char <NEW_LINE> <DEDENT> <DEDENT> return ''.join(chars)
Replace any characters not in the whitelist with the replacement char.
625941d173bcbd0ca4b2c20e
def ArclinkRequestLine_ConstCast(*args): <NEW_LINE> <INDENT> return _DataModel.ArclinkRequestLine_ConstCast(*args)
ConstCast(BaseObject o) -> ArclinkRequestLine ArclinkRequestLine_ConstCast(Seiscomp::Core::BaseObjectCPtr o) -> ArclinkRequestLine
625941d1e1aae11d1e749e50
def __init__(self, command, args, resources=None, display_info=None): <NEW_LINE> <INDENT> self._args = args <NEW_LINE> self._command = command <NEW_LINE> self._default_format_used = False <NEW_LINE> self._format = None <NEW_LINE> self._info = command.ResourceInfo(args) <NEW_LINE> self._printer = None <NEW_LINE> self._p...
Constructor. Args: command: The Command object. args: The argparse.Namespace given to the command.Run(). resources: The resources to display, returned by command.Run(). May be omitted if only GetFormat() will be called. display_info: The DisplayInfo object reaped from parser.AddDisplayInfo() in the com...
625941d17b180e01f3dc4994
def log_file_contains_strings(log_fifo, string_list): <NEW_LINE> <INDENT> log_lines = log_fifo.sequential_reader(100) <NEW_LINE> for log_line in log_lines: <NEW_LINE> <INDENT> for text in string_list: <NEW_LINE> <INDENT> if text in log_line: <NEW_LINE> <INDENT> string_list.remove(text) <NEW_LINE> break <NEW_LINE> <DEDE...
Check if the log file contains all strings in string_list. We search for each string in the string_list array only in the first 100 lines of the log.
625941d150485f2cf553cf32
def __init__( self, transport=None, channel=None, credentials=None, client_config=None, client_info=None, client_options=None, ): <NEW_LINE> <INDENT> if client_config is not None: <NEW_LINE> <INDENT> warnings.warn( "The `client_config` argument is deprecated.", PendingDeprecationWarning, stacklevel=2, ) <NEW_LINE> <DED...
Constructor. Args: transport (Union[~.CloudBuildGrpcTransport, Callable[[~.Credentials, type], ~.CloudBuildGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable whi...
625941d1a4f1c619b28b01cf
def records(self) -> List[IndigoRecord]: <NEW_LINE> <INDENT> lines = [ff.records() for ff in self.files_] <NEW_LINE> return [i for i in chain.from_iterable(lines)]
Records for all files together.
625941d196565a6dacc8f863
def get_handler(self): <NEW_LINE> <INDENT> if self.__handler is None: <NEW_LINE> <INDENT> resolved_spec = util.for_name(self.handler_spec) <NEW_LINE> if isinstance(resolved_spec, type): <NEW_LINE> <INDENT> self.__handler = resolved_spec() <NEW_LINE> <DEDENT> elif isinstance(resolved_spec, types.MethodType): <NEW_LINE> ...
Get mapper handler instance. Returns: cached handler instance as callable.
625941d1f548e778e58cd716
def Kill(self): <NEW_LINE> <INDENT> def _WaitForShutdown(process, shutdown_event): <NEW_LINE> <INDENT> process.wait() <NEW_LINE> shutdown_event.acquire() <NEW_LINE> shutdown_event.notify() <NEW_LINE> shutdown_event.release() <NEW_LINE> <DEDENT> if self._process is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> tr...
Kills the ChromeDriver server, if it is running.
625941d1e76e3b2f99f3a9a2
def read_csv(filename: Union[pathlib.Path, str]): <NEW_LINE> <INDENT> if isinstance(filename, str): <NEW_LINE> <INDENT> filename = pathlib.Path(filename) <NEW_LINE> <DEDENT> with open(filename) as fh: <NEW_LINE> <INDENT> fields = fh.readline().replace('"', "").replace("\n", "").split(",") <NEW_LINE> reader = csv.DictRe...
Read a CSV file. **Example**: >>> read_csv('/path/to/data.csv') [{ 'name': 'foo' }] :param filename: Path to CSV file. :return: A Python representation of the CSV document.
625941d1d486a94d0b98e2de
def get_bbox_labels(delineation, label): <NEW_LINE> <INDENT> bboxes = [] <NEW_LINE> labels = [] <NEW_LINE> peaks = [] <NEW_LINE> for obj in delineation: <NEW_LINE> <INDENT> if len(obj) >= 3: <NEW_LINE> <INDENT> xmin = obj[0] <NEW_LINE> peak = obj[1] <NEW_LINE> xmax = obj[2] <NEW_LINE> <DEDENT> elif len(obj) == 2: <NEW_...
get bbox labels from delineation table Args: delineation: (list) sized [#obj, 3], 3 indicates onset, peak, offset Returns: bboxes: (list) with sized [#obj, 2], 2 indicates (xmin, xmax) labels: (list) with sized [#obj]
625941d16fece00bbac2d8d7
def recv_msg(self, l=HDRLEN): <NEW_LINE> <INDENT> return self.recv(l).decode()
Get the next message send through the socket. Args: l: Length of the accepted message. Defaults to HDRLEN.
625941d12eb69b55b151ca48
def getStartAnnotId(alg, paramDict, fileId): <NEW_LINE> <INDENT> annotDigits = int(pubConf.ANNOTDIGITS) <NEW_LINE> annotIdAdd = getAnnotIdStart(alg, paramDict) <NEW_LINE> annotIdStart = (int(fileId) * (10**annotDigits)) + annotIdAdd <NEW_LINE> return annotIdStart
get starting annotation ID for a given algorithm
625941d16fb2d068a760f237
def get_parties(party_ids: Set[PartyID]) -> List[Party]: <NEW_LINE> <INDENT> if not party_ids: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> parties = DbParty.query .filter(DbParty.id.in_(party_ids)) .all() <NEW_LINE> return [_db_entity_to_party(party) for party in parties]
Return the parties with those IDs.
625941d1a219f33f34628b01
def play_audio(self): <NEW_LINE> <INDENT> subprocess.call(['ffplay', '-autoexit', '{}/{}'.format(self.destination, self.mp4_file)])
Play audio file locally, then close player.
625941d1a79ad161976cc2de
def jsonp(f): <NEW_LINE> <INDENT> @wraps(f) <NEW_LINE> def decorated_function(*args, **kwargs): <NEW_LINE> <INDENT> callback = request.args.get('callback', False) <NEW_LINE> if callback: <NEW_LINE> <INDENT> content = str(callback) + '(' + str(f().data) + ')' <NEW_LINE> return app.response_class(content, mimetype='appli...
Wraps JSONified output for JSONP
625941d1956e5f7376d71005
def output(self): <NEW_LINE> <INDENT> return luigi.LocalTarget(path='/tmp/_docs-%s.json' % self.filename)
Returns the target output for this task. In this case, a successful execution of this task will create a file on the local filesystem. :return: the target output for this task. :rtype: object (:py:class:`luigi.target.Target`)
625941d126068e7796caee78
def credit_card_number(self, card_type: Optional[CardType] = None) -> str: <NEW_LINE> <INDENT> card = self._credit_card_type(card_type) <NEW_LINE> prefix: str = self.random_element(card.prefixes) <NEW_LINE> number = self._generate_number(self.numerify(prefix), card.length) <NEW_LINE> return number
Generate a valid credit card number.
625941d1596a897236089c58
def get_health_monitor(self, hm_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> hm_obj = self.obj.show_health_monitor(hm_id) <NEW_LINE> return hm_obj['health_monitor'] <NEW_LINE> <DEDENT> except CommonNetworkClientException as e: <NEW_LINE> <INDENT> self.logger.debug('Get health-monitor on %s failed' % (hm_id))
Returns Health monitor object as dict. If not found, returns None
625941d17d43ff24873a2e39
def coverageFitness(population): <NEW_LINE> <INDENT> for i in range(len(population)): <NEW_LINE> <INDENT> chromo = population[i] <NEW_LINE> myworld = World("Simulator", 2000, 400, 40) <NEW_LINE> myworld.readWorldConfigFile("easyBigWorld.txt") <NEW_LINE> myworld.getValidStand() <NEW_LINE> myworld.getAirspace() <NEW_LINE...
Given a NEAT population, compute the fitness of each individual
625941d18e7ae83300e4b165
def __iter__(self) -> Iterator[Path]: <NEW_LINE> <INDENT> return iter(self._list)
Returns an iterator to iterate over each file in the list
625941d11f037a2d8b946396
def __getitem__(self, index): <NEW_LINE> <INDENT> id = self.ids[index] <NEW_LINE> if self.split != 'all' and self.split != 'val': <NEW_LINE> <INDENT> filename = '{:05d}.png'.format(id) <NEW_LINE> img_path = os.path.join(self.image_base_path, filename) <NEW_LINE> lbl_path = os.path.join(self.label_base_path, filename) <...
__getitem__ param: index
625941d191f36d47f21ac68c
def delete_equation (**kwargs): <NEW_LINE> <INDENT> pass
devsim.delete_equation (device, region, name) This command deletes an equation from a region. Parameters ---------- device : str The selected device region : str The selected region name : str Name of the equation being deleted
625941d155399d3f0558884d
def get_spacing(self): <NEW_LINE> <INDENT> return self._spacing
@return the voxel spacing
625941d17047854f462a15a1
def get_dir(self): <NEW_LINE> <INDENT> return Path(APP_DIRECTORY)
Get the app directory.
625941d131939e2706e4d002
def show(parent, username, uid, to_show=None): <NEW_LINE> <INDENT> if to_show is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> keys = [] <NEW_LINE> for key in config[username]: <NEW_LINE> <INDENT> if not (key in get_prefs(username)._not_saved or key.startswith('_')): <NEW_LINE> <INDENT> _type = select_option_typ...
Shows all the requested configuration options in alphabetical order.
625941d1851cf427c661a6a7
def checkValue(self, r, c, value=0): <NEW_LINE> <INDENT> if self.items[r][c]!=-1 and self.items[r][c]==value: <NEW_LINE> <INDENT> self.items[r][c]=-1 <NEW_LINE> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
检测某个位置的值是否为value
625941d15fcc89381b1e1858
def find(self): <NEW_LINE> <INDENT> user = None <NEW_LINE> if self.email != None: <NEW_LINE> <INDENT> user = self.graph.find_one("User", "email", self.email) <NEW_LINE> if user: <NEW_LINE> <INDENT> self.username = user['username'] <NEW_LINE> <DEDENT> <DEDENT> elif self.username != None: <NEW_LINE> <INDENT> user = self....
find a user by email or username
625941d199cbb53fe6792d7f
def test_shorthand_disabled(self): <NEW_LINE> <INDENT> self.xbee = XBeePro900(self.ser, shorthand=False) <NEW_LINE> try: <NEW_LINE> <INDENT> self.xbee.at <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.fail("Specified shorthand command should not ex...
When shorthand is disabled, any attempt at calling a non-existant attribute should raise AttributeError
625941d138b623060ff0af86
def type_multiplier(attack_type, target_pokemon): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pokestats = type_multiplier.pokestats <NEW_LINE> attack_matrix = type_multiplier.attack_matrix <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> type_multiplier.pokestats = pd.read_csv('./data/pokemon_alopez247.c...
Returns type multiplier for attack against a given pokemon attack_type: string, type of elemental attack target_pokemon: string, name of pokemon being attacked
625941d171ff763f4b549825
def list_item_labels(self, menu): <NEW_LINE> <INDENT> items = menu.GetMenuItems() <NEW_LINE> titles = [] <NEW_LINE> for item in items: <NEW_LINE> <INDENT> titles.append(item.GetLabel()) <NEW_LINE> <DEDENT> return titles
return a list of the labels from a list of menu items **INPUTS** *wxMenu menu* -- the menu **OUTPUTS** *[STR]* -- the list of labels representing the contents of that menu
625941d16aa9bd52df036f3e
def max(x, y): <NEW_LINE> <INDENT> return max_p.bind(x, y)
Elementwise maximum. For complex numbers, uses a lexicographic comparison on the `(real, imaginary)` pairs.
625941d1bd1bec0571d907c8
def copy_default_images(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> copytree(settings.DEFAULT_MEDIA_SRC_PATH, DEST_DIRECTORY) <NEW_LINE> <DEDENT> except OSError as e: <NEW_LINE> <INDENT> if e.errno != 17: <NEW_LINE> <INDENT> raise
Copy images to proper media dir
625941d14428ac0f6e5ba98c