code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def set_parent_pool(self, parent_pool=None): <NEW_LINE> <INDENT> import libsvn.core, weakref <NEW_LINE> self.__dict__["_parent_pool"] = parent_pool or libsvn.core.application_pool; <NEW_LINE> if self.__dict__["_parent_pool"]: <NEW_LINE> <INDENT> self.__dict__["_is_valid"] = weakref.ref( self.__dict__["_parent_po...
Create a new proxy object for svn_ra_get_latest_revnum_func_t
625941e66fb2d068a760f4dc
@app.route(WEBPAGES.Get_Analysis.value, methods=['GET']) <NEW_LINE> def getAnalysis(applicationName, rowUid): <NEW_LINE> <INDENT> useCache = True if flask.request.args.get('useCache', default="True", type=str) == "True" else False <NEW_LINE> with Storage() as storage: <NEW_LINE> <INDENT> analysis = storage.getAnalysis(...
will get back an analysis page based off the given application name and uid. Optionally the useCache param may be used. By default it is True. If False is given, cache will be removed, then analysis regenerated for the given uid's crash dump
625941e68a43f66fc4b54498
def search(): <NEW_LINE> <INDENT> for student in student_list: <NEW_LINE> <INDENT> if search_textbox.value in student.get_name(): <NEW_LINE> <INDENT> student_listbox.append(student.get_name())
Get names of students matching the search.
625941e6b57a9660fec33cc2
def __init__(self, effect): <NEW_LINE> <INDENT> super(EffectInstance, self).__init__() <NEW_LINE> self.effect = effect <NEW_LINE> if effect == None: <NEW_LINE> <INDENT> self.match_any = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.match_any = False
Default constructor
625941e6091ae3566866738e
def testBoxLengthsVectors(self): <NEW_LINE> <INDENT> a, b, c = geo.box_lengths_and_angles_to_vectors(1, 1, 1, 90, 90, 90) <NEW_LINE> self.assertEqualVectors(a, [1.0, 0.0, 0.0] * u.angstroms) <NEW_LINE> self.assertEqualVectors(b, [0.0, 1.0, 0.0] * u.angstroms) <NEW_LINE> self.assertEqualVectors(c, [0.0, 0.0, 1.0] * u.an...
Test converting box lengths/angles to vectors and back again
625941e607d97122c4178ccd
def get_vis_chains(layer_to_chains, model, dataset): <NEW_LINE> <INDENT> vis_chains = layer_to_chains[model.visible_layer] <NEW_LINE> vis_chains = vis_chains.get_value() <NEW_LINE> print(vis_chains.shape) <NEW_LINE> if vis_chains.ndim == 2: <NEW_LINE> <INDENT> vis_chains = dataset.get_topological_view(vis_chains) <NEW_...
Get visible chains formatted for the path viewer. Parameters ---------- layers_to_chains: dict Dictionary mapping layers to states. model: Model The model from which we get the visible chains. dataset: The dataset used to train the model.
625941e6097d151d1a22328f
def render_xml(self): <NEW_LINE> <INDENT> context = Context({'ap': self}) <NEW_LINE> template = loader.get_template( 'wlcmanager/wlcapi/save_ap/{}.xml'.format(self.model)) <NEW_LINE> return template.render(context)
Render model specific XML to be send to WLC
625941e6167d2b6e31218fcd
def _get_ip_addr_num(file_path): <NEW_LINE> <INDENT> num = '' <NEW_LINE> with open(file_path, 'r') as f: <NEW_LINE> <INDENT> data = f.read() <NEW_LINE> <DEDENT> data = data.splitlines() <NEW_LINE> for line in data: <NEW_LINE> <INDENT> found = re.search(r'IPADDR(\d?)=', line) <NEW_LINE> if found: <NEW_LINE> <INDENT> if ...
Get the next IPADDR index num to use for adding an ip addr to an ifcfg file.
625941e68a43f66fc4b54499
def connect_db(): <NEW_LINE> <INDENT> rv = sqlite3.connect('app.db', detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES ) <NEW_LINE> rv.row_factory = sqlite3.Row <NEW_LINE> return rv
Connects to the specific database.
625941e68a349b6b435e85aa
def solveNQueens(self, n): <NEW_LINE> <INDENT> def DFS(queens, xy_dif, xy_sum): <NEW_LINE> <INDENT> p = len(queens) <NEW_LINE> if p == n: <NEW_LINE> <INDENT> result.append(queens) <NEW_LINE> return <NEW_LINE> <DEDENT> for q in range(n): <NEW_LINE> <INDENT> if q not in queens and p-q not in xy_dif and p+q not in xy_sum:...
:type n: int :rtype: List[List[str]]
625941e6b830903b967e9d3e
def query_trace_measurement(self, trace=1): <NEW_LINE> <INDENT> scpi_command = scpi_preprocess(":CALC:PAR{:}:DEF?", trace) <NEW_LINE> value = self.query(scpi_command) <NEW_LINE> value = process_query(value, csv=False, strip_outer_quotes=True, returns='str') <NEW_LINE> return value
no help available
625941e610dbd63aa1bd2fda
def clear(self, target_commit): <NEW_LINE> <INDENT> raise NotImplementedError
Resets the repository to the target commit, removing any staged, unstaged, and untracked files. :param str target_commit: the commit ID :raises tigerhost.vcs.base.CommandError: if the commit does not exist
625941e6d99f1b3c44c679bf
def get(self, request): <NEW_LINE> <INDENT> material_types = Material.objects.filter(type_status=1).values_list('type_identify', 'type_name') <NEW_LINE> measure = models.Meterage.objects.filter(measure_status=1).values_list('measure_dimension', 'measure_identify', 'measure_name') <NEW_LINE> return Response({"material_t...
物料类别及其名字和最大流水号编码
625941e623e79379d52ee996
def prepare_for_classification(self, pdfnames, pad_out=True, flatten=True, padded_shape=(25, 25)): <NEW_LINE> <INDENT> symbols = [] <NEW_LINE> labels = [] <NEW_LINE> for name in pdfnames: <NEW_LINE> <INDENT> foldername = "symbol_shapes/" + name <NEW_LINE> dirnames = listdir(foldername) <NEW_LINE> for dirname in dirname...
Pads out the training symbols and makes label arrays for them.
625941e6009cb60464c637e6
def imadjust(im0, threshold=.01): <NEW_LINE> <INDENT> if type(threshold) in [tuple,list,ndarray]: <NEW_LINE> <INDENT> low_threshold, high_threshold = threshold <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> low_threshold, high_threshold = threshold,threshold <NEW_LINE> <DEDENT> im = copy(im0) <NEW_LINE> if max(ravel(im)...
Automatically rescale the histogram of the image im0 : N x M x P np.array An RGB or grayscale image, where P is the depth of the image threshold : float The fraction of values saturating the lower and upper portions of the histogram threshold : 2-list or tuple Manually set the upper and lower cl...
625941e673bcbd0ca4b2c4ad
def add_num_nodes_col(df): <NEW_LINE> <INDENT> if "topo" in df and "shape" in df: <NEW_LINE> <INDENT> new_df = df.copy() <NEW_LINE> new_df["num_nodes"] = new_df.apply(lambda x: cal_num_nodes(x["topo"], x["shape"]), axis=1) <NEW_LINE> return new_df <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> exit("cannot calculate num...
add a column of num of nodes to a df, based on "topo", "shape" cols, and potentially other cols e.g. "torus:local_ports" :param df: input df, must contain "topo" and "shape" cols :return:a new df with a "num_nodes" column
625941e6a934411ee3751acc
def build_with_http_info(self, build_execution_configuration, **kwargs): <NEW_LINE> <INDENT> all_params = ['build_execution_configuration', 'username_triggered', 'callback_url'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content...
Triggers the build execution for a given configuration. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.build_...
625941e62c8b7c6e89b35bf5
def redirect( location: str, code: int = 302, Response: t.Optional[t.Type["Response"]] = None ) -> "Response": <NEW_LINE> <INDENT> import html <NEW_LINE> if Response is None: <NEW_LINE> <INDENT> from .wrappers import Response <NEW_LINE> <DEDENT> display_location = html.escape(location) <NEW_LINE> if isinstance(location...
Returns a response object (a WSGI application) that, if called, redirects the client to the target location. Supported codes are 301, 302, 303, 305, 307, and 308. 300 is not supported because it's not a real redirect and 304 because it's the answer for a request with a request with defined If-Modified-Since headers. ....
625941e6b545ff76a891424d
def __init__(self, parent=None): <NEW_LINE> <INDENT> super(kh, self).__init__(parent) <NEW_LINE> self.setupUi(self)
Constructor @param parent reference to the parent widget @type QWidget
625941e657b8e32f524838d6
def load_frozen_graph(graph_filename): <NEW_LINE> <INDENT> with tf.gfile.GFile(graph_filename, 'rb') as f: <NEW_LINE> <INDENT> graph_def = tf.GraphDef() <NEW_LINE> graph_def.ParseFromString(f.read()) <NEW_LINE> <DEDENT> tf.import_graph_def( graph_def, input_map=None, return_elements=None, name='', op_dict=None, produce...
load a protobuf *into the default graph* and parse it
625941e62c8b7c6e89b35bf6
def svg(self): <NEW_LINE> <INDENT> svgfilename = self.save_svg() <NEW_LINE> with open(svgfilename, encoding='UTF-8') as f: <NEW_LINE> <INDENT> svg = f.read() <NEW_LINE> <DEDENT> return svg
Render tree as svg and return svg text.
625941e691f36d47f21ac92f
def bias_variable(shape): <NEW_LINE> <INDENT> initial = tf.constant(0.1, shape=shape) <NEW_LINE> return tf.Variable(initial)
Properly initialize the bias
625941e6de87d2750b8601cf
def findMaxConsecutiveOnes(self, nums): <NEW_LINE> <INDENT> count = maxCount = 0 <NEW_LINE> for num in nums: <NEW_LINE> <INDENT> if num == 1: <NEW_LINE> <INDENT> count += 1 <NEW_LINE> maxCount = max(count, maxCount) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> count = 0 <NEW_LINE> <DEDENT> <DEDENT> return maxCount
:type nums: List[int] :rtype: int
625941e68a349b6b435e85ab
def moveOrder(self, orderNumber, rate, amount=False, orderType=False): <NEW_LINE> <INDENT> args = { 'orderNumber': str(orderNumber), 'rate': str(rate) } <NEW_LINE> if amount: <NEW_LINE> <INDENT> args['amount'] = str(amount) <NEW_LINE> <DEDENT> if orderType: <NEW_LINE> <INDENT> possTypes = ['immediateOrCancel', 'postOnl...
Cancels an order and places a new one of the same type in a single atomic transaction, meaning either both operations will succeed or both will fail. Required parameters are "orderNumber" and "rate"; you may optionally specify "amount" if you wish to change the amount of the new order. "postOnly" or "immediateOrCancel"...
625941e68c3a8732951587f8
def plot_data(self, canvas, cr): <NEW_LINE> <INDENT> cr.set_source_rgb(0, 0, 0) <NEW_LINE> cr.set_line_width(0.5) <NEW_LINE> height = canvas.get_allocated_height() - 20 <NEW_LINE> width = canvas.get_allocated_width() - 20 <NEW_LINE> with self.__run_data_lock: <NEW_LINE> <INDENT> if 1 < len(self.run_data): <NEW_LINE> <I...
Draw the graph Parameters -------- canvas - the GTKDrawingArea into which the cairo contex will will render cr - the cairo context to draw with
625941e6adb09d7d5db6cbc5
def calc_bezier_path(control_points, n_points=100): <NEW_LINE> <INDENT> traj = [] <NEW_LINE> for t in np.linspace(0, 1, n_points): <NEW_LINE> <INDENT> traj.append(bezier(t, control_points)) <NEW_LINE> <DEDENT> return np.array(traj)
Compute bezier path (trajectory) given control points. :param control_points: (numpy array) :param n_points: (int) number of points in the trajectory :return: (numpy array)
625941e64a966d76dd55144b
def write_figures_of_merit(figures_of_merit, filename): <NEW_LINE> <INDENT> with open(filename + '.csv', 'w', newline='') as fileout: <NEW_LINE> <INDENT> csvwriter = csv.writer(fileout) <NEW_LINE> for i in range(figures_of_merit.shape[0]): <NEW_LINE> <INDENT> csvwriter.writerow(figures_of_merit[i])
Write figures of merit to a .csv file. ... Parameters ---------- figures_of_merit : figures of merit, numpy 2d array The top num_parents number of figures of merit for each generation is stored in here filename : name of the file, string The name of the file you want to save the genes to
625941e6ac7a0e7691ed44fd
def CreatePERSISTANCE_CHECKWorkflow(WFname): <NEW_LINE> <INDENT> PERSISTANCE_CHECKWF= pe.Workflow(name=WFname) <NEW_LINE> inputsSpec = pe.Node(interface=IdentityInterface(fields=['fixedVolume','fixedBinaryVolume','movingVolume','movingBinaryVolume','initialTransform']), name='InputSpec' ) <NEW_LINE> PERSISTANCE_CHECKWF...
The purpose of this workflow is to debug the automatic deletion of files from the output directory.
625941e699fddb7c1c9de7c7
def format_float_sigfig(number, sigfig=5, threshold=None): <NEW_LINE> <INDENT> if pd.isnull(number): <NEW_LINE> <INDENT> return number <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> d = decimal.Decimal(number) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> d = _float_to_decimal(float(number)) <NEW_LINE> <DEDEN...
format the number to string, keeping some significant digits.
625941e66fece00bbac2db7c
def bubble_sort(unsorted_list): <NEW_LINE> <INDENT> for i in range(len(unsorted_list) - 1): <NEW_LINE> <INDENT> swapped = False <NEW_LINE> for j in range(len(unsorted_list) - i - 1): <NEW_LINE> <INDENT> if unsorted_list[j] > unsorted_list[j + 1]: <NEW_LINE> <INDENT> unsorted_list[j], unsorted_list[j + 1] = unsorted_lis...
Implementation of bubble sort. Sorts an unsorted list in-place.
625941e6fff4ab517eb2f877
def test_comments_cleaned(self): <NEW_LINE> <INDENT> doc = Article(self.article) <NEW_LINE> self.assertTrue('class="comments"' not in doc.readable)
The div with the comments should be removed.
625941e621bff66bcd684d86
def RefreshLine(self, line): <NEW_LINE> <INDENT> if self.InReportView(): <NEW_LINE> <INDENT> visibleFrom, visibleTo = self.GetVisibleLinesRange() <NEW_LINE> if line < visibleFrom or line > visibleTo: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> rect = self.GetLineRect(line) <NEW_LINE> rect.x, rect.y = self....
Redraws the input line. :param `line`: an instance of :class:`UltimateListLineData`.
625941e6d268445f265b52a7
def process_file(self, ev=None): <NEW_LINE> <INDENT> if self.processUsed == True: <NEW_LINE> <INDENT> self.leftFrame.destroy() <NEW_LINE> if self.leftScrolBar: <NEW_LINE> <INDENT> self.myscrollbar.destroy() <NEW_LINE> leftScrolBar = False <NEW_LINE> <DEDENT> <DEDENT> filename=self.browsedFile <NEW_LINE> self.reader=Dem...
Open the choosen file by calling Demonstrator Class
625941e6b830903b967e9d3f
def get_expire_time(self): <NEW_LINE> <INDENT> return self.level_expire_time
返回等级到期时间
625941e663f4b57ef0001545
def primitive_nurbs_surface_curve_add( radius: float = 1.0, view_align: bool = False, enter_editmode: bool = False, location: float = (0.0, 0.0, 0.0), rotation: float = (0.0, 0.0, 0.0), layers: bool = (False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,...
Construct a Nurbs surface Curve :param radius: Radius :type radius: float :param view_align: Align to View, Align the new object to the view :type view_align: bool :param enter_editmode: Enter Editmode, Enter editmode when adding this object :type enter_editmode: bool :param location: Location, Location for the ne...
625941e621bff66bcd684d87
def print_sorted_stat(self, left_width=0, right_width=0, align=(0, 0)) -> None: <NEW_LINE> <INDENT> self._print_hor_line_table_border(left_width=left_width, right_width=right_width, hor_chr='=') <NEW_LINE> self._print_table_row(left_str='Буква', right_str='Частота', width=(left_width, right_width), align=(0, 0)) <NEW_L...
Метод вывода на консоль отсортированной статистики Входит в шаблон :param left_width: ширина левой колонки :param right_width: ширина правой колонки :param align: выравнивание содежжимого колонок в теле таблицы
625941e6fb3f5b602dac3ad0
def onDamagingHit(**bvalues): <NEW_LINE> <INDENT> pass
function (damage, target, source, move) { if (move.type === 'Dark') { this.boost({ atk: 1 }); } }
625941e6283ffb24f3c55d35
def remove_association(self): <NEW_LINE> <INDENT> self.__eraseOpAbove() <NEW_LINE> self.__undoCtrl.eraseCtrlAbove() <NEW_LINE> studId=Validator.read_positive_integer("Introduce association's student id to be removed:") <NEW_LINE> assignId=Validator.read_positive_integer("Introduce association's assignment id to be upda...
read's the student's id and assignment's id of the associations to be removed then removes is and introduces in the undo controller the operation we've done Returns:
625941e66aa9bd52df0371df
def _latex_(self): <NEW_LINE> <INDENT> generators_latex = ", ".join(self.latex_variable_names()) <NEW_LINE> return "%s[[%s]]"%(latex.latex(self.base_ring()), generators_latex)
Returns latex representation of power series ring EXAMPLES:: sage: M = PowerSeriesRing(QQ,4,'v'); M Multivariate Power Series Ring in v0, v1, v2, v3 over Rational Field sage: M._latex_() '\Bold{Q}[[v_{0}, v_{1}, v_{2}, v_{3}]]'
625941e673bcbd0ca4b2c4ae
@sockets.command() <NEW_LINE> @click.pass_context <NEW_LINE> @click.argument('endpoint_name') <NEW_LINE> @click.argument('method', default=u'GET') <NEW_LINE> @click.option('-d', '--data', help=u'A data to be sent as payload: key=value', multiple=True) <NEW_LINE> def run(ctx, endpoint_name, method, data): <NEW_LINE> <IN...
Run Endpoint and shows the output. Note that full name of an Endpoint consist of Sockets name and Endpoint name: <custom_socket_name>/<endpoint_name>.
625941e6b5575c28eb68e43c
def vel(dirc,i_step): <NEW_LINE> <INDENT> C = get_solution(i_step, copy=True) <NEW_LINE> u = spec2phys(C) <NEW_LINE> u = u[dirc] <NEW_LINE> return u
returns the velocity in direction dirc
625941e6e76e3b2f99f3ac3d
def test_account_setup(app_rest, example_cern, models_fixture): <NEW_LINE> <INDENT> with app_rest.test_client() as c: <NEW_LINE> <INDENT> ioc = app_rest.extensions['oauthlib.client'] <NEW_LINE> resp = c.get(url_for( 'invenio_oauthclient.rest_login', remote_app='cern')) <NEW_LINE> assert resp.status_code == 302 <NEW_LIN...
Test account setup after login.
625941e65fdd1c0f98dc066e
def handle_tags(self, tokenized_list, idx): <NEW_LINE> <INDENT> if len(self.text_tokens) > idx + 1: <NEW_LINE> <INDENT> self.text_tokens[idx + 1] = ''
merges text_tokens[idx] with text_tokens[idx+1] such that '@','example' becomes '@example' :param tokenized_list: list of tokenized words :param idx: index of @ in text_tokens
625941e644b2445a339324cb
def divide_data(self, data, feature_column, feature_val): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.feature_column = feature_column <NEW_LINE> self.feature_val = feature_val <NEW_LINE> data1 = [] <NEW_LINE> data2 = [] <NEW_LINE> r = [row[feature_column] for row in data] <NEW_LINE> item = [i for i,j in enumer...
divide_data a function takes the data and divides it in two parts by a line. A line is defined by the feature we are considering (feature_column) and the target value. The function returns a tuple (data1, data2) which are the desired parts of the data. For int or float types of the value, data1 have all the data with ...
625941e6b545ff76a891424e
def testPagedRequest(self): <NEW_LINE> <INDENT> pass
Test PagedRequest
625941e6f9cc0f698b140a30
def predict_next(self, session_id, input_item_id, predict_for_item_ids, skip=False, type='view', timestamp=0): <NEW_LINE> <INDENT> preds = np.zeros(len(predict_for_item_ids)) <NEW_LINE> sim_list = self.sims[input_item_id] <NEW_LINE> mask = np.in1d(predict_for_item_ids, sim_list.index) <NEW_LINE> preds[mask] = sim_list[...
Gives predicton scores for a selected set of items on how likely they be the next item in the session. Parameters -------- session_id : int or string The session IDs of the event. input_item_id : int or string The item ID of the event. Must be in the set of item IDs of the training set. predict_for_ite...
625941e6fbf16365ca6f6605
def convert_ip_list(json_dict): <NEW_LINE> <INDENT> itms = json_dict.values() <NEW_LINE> val = [] <NEW_LINE> for i in itms: <NEW_LINE> <INDENT> if isinstance(i, list): <NEW_LINE> <INDENT> for j in i: <NEW_LINE> <INDENT> val.append(j) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> val.append(json_dict["elb_dns_name"]) <NEW_LINE>...
json list dict
625941e6bf627c535bc13608
def make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> return SegmentParameters( memory_id = 10641, document_id = 1876, source = 'Code zur Fehleranalyse einschalten', target = 'Enable debugging code' ) <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> return SegmentParamet...
Test SegmentParameters include_option is a boolean, when False only required params are included, when True both required and optional params are included
625941e6e8904600ed9f236c
@app.route('/recipeCategory/<category_id>/update', methods=['POST', 'GET']) <NEW_LINE> def update_recipe_category(category_id): <NEW_LINE> <INDENT> if 'email' not in session: <NEW_LINE> <INDENT> return render_template('login.html') <NEW_LINE> <DEDENT> user = users.users_dict[session['email']] <NEW_LINE> if request.meth...
Method for user to edit recipe category
625941e644b2445a339324cc
def loaded(self, path, reason=None, data=None): <NEW_LINE> <INDENT> self._associate(path, "load", reason, data)
Method to be called after loading the file from a path.
625941e6796e427e537b0a02
def _can_equip(self, uid, merch): <NEW_LINE> <INDENT> armor_types = self._classes[self._players[uid]["class"]]["armor"] <NEW_LINE> weapon_types = self._classes[self._players[uid]["class"]]["weapon"] <NEW_LINE> if "etype" not in merch.keys(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if merch["etype"] not in [...
get modifier
625941e6cc0a2c11143dd2cb
def address_list(self, stream): <NEW_LINE> <INDENT> if not stream: <NEW_LINE> <INDENT> raise ParserException('No input provided to parser.') <NEW_LINE> <DEDENT> if isinstance(stream, str) and not is_pure_ascii(stream): <NEW_LINE> <INDENT> raise ParserException('ASCII string contains non-ASCII chars.') <NEW_LINE> <DEDEN...
Extract a mailbox and/or url list from a stream of input, operates in strict and relaxed modes.
625941e6ec188e330fd5abcf
def test_get_recommendation_not_found(self): <NEW_LINE> <INDENT> resp = self.app.get('/recommendations/11') <NEW_LINE> self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)
Read a Recommendation thats not found
625941e64527f215b584c88b
def update(self, restriction = lambda r:True, Hsetting = [], setting = lambda t:{}): <NEW_LINE> <INDENT> old = self.where(restriction) <NEW_LINE> t1 = old.rename(dict(list(zip(self._heading, ['_OLD_'+x for x in self._heading])))) <NEW_LINE> upd = t1.extend(Hsetting, setting) <NEW_LINE> Hupdold = ['_OLD_'+x for x in Hse...
Update tuples (in place) in relation, e.g. r.update(lambda t: t.x==3, ['UpdAttr'], lambda u: {'UpdAttr':4})
625941e6a05bb46b383ecc56
def predict_proposals( self, anchors: List[Boxes], pred_objectness_logits: List[torch.Tensor], pred_anchor_deltas: List[torch.Tensor], image_sizes: List[Tuple[int, int]], cpgs: torch.Tensor = None, cpg_strides: Tuple[int] = None, ): <NEW_LINE> <INDENT> with torch.no_grad(): <NEW_LINE> <INDENT> pred_proposals = self._de...
Decode all the predicted box regression deltas to proposals. Find the top proposals by applying NMS and removing boxes that are too small. Returns: proposals (list[Instances]): list of N Instances. The i-th Instances stores post_nms_topk object proposals for image i, sorted by their objectness scor...
625941e6004d5f362079a769
def _master_opts(self, load): <NEW_LINE> <INDENT> mopts = {} <NEW_LINE> file_roots = {} <NEW_LINE> envs = self._file_envs() <NEW_LINE> for saltenv in envs: <NEW_LINE> <INDENT> if saltenv not in file_roots: <NEW_LINE> <INDENT> file_roots[saltenv] = [] <NEW_LINE> <DEDENT> <DEDENT> mopts['file_roots'] = file_roots <NEW_LI...
Return the master options to the minion
625941e60a50d4780f6672ce
def get_form(self, request, obj=None, **kwargs): <NEW_LINE> <INDENT> form = super(FieldAdmin, self).get_form(request, obj, **kwargs) <NEW_LINE> form.base_fields['domain'].queryset = Type.objects.all() <NEW_LINE> form.base_fields['range'].queryset = Type.objects.all() <NEW_LINE> return form
Available values for :prop:`.domain` and :prop:`.range` should be limited to :class:`.Type` objects that directly instantiate the :class:`.Type` or :class:`.ConceptType` classes.
625941e6fbf16365ca6f6606
def iswritable(self): <NEW_LINE> <INDENT> return self._iswritable()
Return if the table is writable.
625941e6cb5e8a47e48b7edd
def count_twins(): <NEW_LINE> <INDENT> checks = 0 <NEW_LINE> errors = 0 <NEW_LINE> for k in range(10): <NEW_LINE> <INDENT> sk = str(k) <NEW_LINE> for i in range(10): <NEW_LINE> <INDENT> si = str(i) <NEW_LINE> for j in range(10): <NEW_LINE> <INDENT> sj = str(j) <NEW_LINE> checks += 1 <NEW_LINE> if encode(sk+si+si) == en...
Count the number of twin errors missed (aa -> bb).
625941e666656f66f7cbc5e6
def getPermanenceDecrement(self): <NEW_LINE> <INDENT> return _algorithms.TemporalMemory_getPermanenceDecrement(self)
getPermanenceDecrement(self) -> nupic::algorithms::connections::Permanence
625941e6be8e80087fb21076
def p_agrega_falso(p): <NEW_LINE> <INDENT> edjo.pilaOperadores.append('(')
agrega_falso :
625941e60a366e3fb873ec57
def _set_buttons_rdm(self, rdm_status): <NEW_LINE> <INDENT> items1 = ["button_ddl", "menu_ddl", "button_eq", "menu_eq", "button_barre", "menu_barre", "menu_char", "button_char", "menu_degree", "menu_reac", "button_reac", "menu_n", "button_n", "menu_v", "button_v", "menu_m", "button_m", "menu_defo", "button_defo", "menu...
Fonction qui sert à modifier la sensibilité des boutons en fonction de l'état de l'objet rdm
625941e6f8510a7c17cf9b38
def string_to_semi_redundant_sequences(string, seq_maxlen=25, redun_step=3, char_idx=None): <NEW_LINE> <INDENT> print("Vectorizing text...") <NEW_LINE> if char_idx is None: <NEW_LINE> <INDENT> char_idx = chars_to_dictionary(string) <NEW_LINE> <DEDENT> len_chars = len(char_idx) <NEW_LINE> sequences = [] <NEW_LINE> next_...
string_to_semi_redundant_sequences. Vectorize a string and returns parsed sequences and targets, along with the associated dictionary. Arguments: string: `str`. Lower-case text from input text file. seq_maxlen: `int`. Maximum length of a sequence. Default: 25. redun_step: `int`. Redundancy step. Default: 3....
625941e6d58c6744b4258097
def __init__(self, rate=1, C=1, epoch=1, random=1, randomseed=-1, isshuffle=True ): <NEW_LINE> <INDENT> self._rate = rate <NEW_LINE> self._epoch = epoch <NEW_LINE> self._random = random <NEW_LINE> self._C = C <NEW_LINE> self._isshuffle = isshuffle <NEW_LINE> if randomseed < 0: <NEW_LINE> <INDENT> self._randomseed = Non...
Initialize a new SVM classifier. Args: rate: float - Learning rate. C: float - Tradeoff between loss and regularizer. epoch: int - Number of passes over the training data. random: int - 1 for randon initialization, 0 for all zero initialization. randomseed: int - Random seed. If r...
625941e6c4546d3d9de72e71
def income_delete(self, cid): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> url = "http://" + self.host + "/arespayment/apis/plat/income/delete" <NEW_LINE> self.income_status(cid=cid, status=0) <NEW_LINE> resp = requests.get(url=url, headers=self.headers, params={"cid": cid}) <NEW_LINE> Pylog.debug("【公司入款账号删除-resp】" + s...
公司入款账号删除
625941e6796e427e537b0a03
def show(self, text): <NEW_LINE> <INDENT> remove_signal_id(self.configure_event_callback_id) <NEW_LINE> remove_signal_id(self.destroy_callback_id) <NEW_LINE> remove_signal_id(self.focus_out_callback_id) <NEW_LINE> remove_timeout_id(self.start_hide_callback_id) <NEW_LINE> self.text = text <NEW_LINE> (tooltip_width, tool...
Show. @param text: OSD tooltip text.
625941e6462c4b4f79d1db09
def clear(): <NEW_LINE> <INDENT> metadata = cbpos.database.Base.metadata <NEW_LINE> metadata.drop_all()
Clear the database. Note: Drops all tables, does not drop database.
625941e6a17c0f6771cbe489
def test_upload_check_for_duration_sec_as_response(self): <NEW_LINE> <INDENT> self.login(self.EDITOR_EMAIL) <NEW_LINE> csrf_token = self.get_new_csrf_token() <NEW_LINE> with utils.open_file( os.path.join(feconf.TESTS_DATA_DIR, self.TEST_AUDIO_FILE_MP3), 'rb', encoding=None ) as f: <NEW_LINE> <INDENT> raw_audio = f.read...
Tests the file upload and trying to confirm the audio file duration_secs is accurate.
625941e66fece00bbac2db7d
def get_language_default_key(self, language): <NEW_LINE> <INDENT> default_key = None <NEW_LINE> if language in self.codes: <NEW_LINE> <INDENT> default_key = self.codes[language]['default_key'] <NEW_LINE> <DEDENT> return default_key
gets a key for language to express in a JSON-LD object
625941e6287bf620b61d3e9a
def seed(self, num): <NEW_LINE> <INDENT> self.rnd.seed(num)
Set the seed for the random number generator.
625941e676e4537e8c351aaf
def __init__(self, cs_str_args=None, num_batches=None, nanmean_args_cs_str=None, device=None): <NEW_LINE> <INDENT> assert(num_batches is not None) <NEW_LINE> self.device = device <NEW_LINE> self.loggers = {} <NEW_LINE> if cs_str_args is not None: <NEW_LINE> <INDENT> args_list = comma_seperated_str_to_list(cs_str_args) ...
cs_str_args: arguments list as a comma separated string
625941e692d797404e3045c5
def TemplateUpgradeFailedEvent(vim, *args, **kwargs): <NEW_LINE> <INDENT> obj = vim.client.factory.create('ns0:TemplateUpgradeFailedEvent') <NEW_LINE> if (len(args) + len(kwargs)) < 6: <NEW_LINE> <INDENT> raise IndexError('Expected at least 7 arguments got: %d' % len(args)) <NEW_LINE> <DEDENT> required = [ 'reason', 'l...
This event records that the template upgrade failed.
625941e656ac1b37e6264601
def _is_type_compatible(a, b): <NEW_LINE> <INDENT> is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset)) <NEW_LINE> is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset)) <NEW_LINE> return ( (is_number(a) and is_number(b)) or (is_ts_compat(a) and is_ts_compat(b)) or (is_td_compat(a) and is_td_compat(...
helper for interval_range to check type compat of start/end/freq
625941e6bd1bec0571d90a68
def makeMove(self, movable_statement): <NEW_LINE> <INDENT> matches = match(movable_statement, (self.produceMovableQuery()).statement) <NEW_LINE> if matches: <NEW_LINE> <INDENT> disk = matches.bindings[0].constant.element <NEW_LINE> start = matches.bindings[1].constant.element <NEW_LINE> end = matches.bindings[2].consta...
Takes a MOVABLE statement and makes the corresponding move. This will result in a change of the game state, and therefore requires updating the KB in the Game Master. The statement should come directly from the result of the MOVABLE query issued to the KB, in the following format: (movable disk1 peg1 peg3) Args: ...
625941e69f2886367277acc3
def bonus(self, participant): <NEW_LINE> <INDENT> node = participant.nodes()[0] <NEW_LINE> score = node.score_in_pgg <NEW_LINE> bonus = round(score * 0.025, 2) <NEW_LINE> return bonus
Calculate a participants bonus.
625941e615fb5d323cde0f4f
def rotate_bound(image, angle): <NEW_LINE> <INDENT> (h, w) = image.shape[:2] <NEW_LINE> (cX, cY) = (w // 2, h // 2) <NEW_LINE> M = cv2.getRotationMatrix2D((cX, cY), -angle, 1.0) <NEW_LINE> cos = np.abs(M[0, 0]) <NEW_LINE> sin = np.abs(M[0, 1]) <NEW_LINE> nW = int((h * sin) + (w * cos)) <NEW_LINE> nH = int((h * cos) + (...
Copied from Adrian Rosebrock's code at: https://www.pyimagesearch.com/2017/01/02/rotate-images-correctly-with-opencv-and-python/
625941e6d58c6744b4258098
def print_epoch(epoch,num_epoch,loss_train,loss_val,overwrite): <NEW_LINE> <INDENT> assert (type(epoch) == int),'epoch must be int.' <NEW_LINE> assert (type(num_epoch) == int),'num_epoch must be int.' <NEW_LINE> assert (type(loss_train) == float),'loss_train must be float.' <NEW_LINE> assert (type(loss_val) == float),'...
NOTES: Structure for nice printing of train/validation loss for given epoch. INPUT: epoch = int; current epoch number num_epoch = int; total number of epochs that will be executed loss_train = float; error for training data loss_val = float; error for validation data overwrite = bool; choice to ov...
625941e64c3428357757c75f
def create_master_turnstile_file(filenames, output_file): <NEW_LINE> <INDENT> with open(output_file, 'w') as master_file: <NEW_LINE> <INDENT> master_file.write('C/A,UNIT,SCP,DATEn,TIMEn,DESCn,ENTRIESn,EXITSn\n') <NEW_LINE> write = csv.writer(master_file,delimiter=',') <NEW_LINE> for filename in filenames: <NEW_LINE> <I...
Write a function that takes the files in the list filenames, which all have the columns 'C/A, UNIT, SCP, DATEn, TIMEn, DESCn, ENTRIESn, EXITSn', and consolidates them into one file located at output_file. There should be ONE row with the column headers, located at the top of the file. The input files do not have colu...
625941e67047854f462a183e
def format_value(value,number_format): <NEW_LINE> <INDENT> style,sufix,scale = decode_format(number_format) <NEW_LINE> fmt = "{0:" + style + "}" + sufix <NEW_LINE> return fmt.format(scale * value)
Convert number to string using a style string
625941e624f1403a92600f9c
def shell_escape(s): <NEW_LINE> <INDENT> if not s: <NEW_LINE> <INDENT> return "''" <NEW_LINE> <DEDENT> if _find_unsafe(s) is None: <NEW_LINE> <INDENT> return s <NEW_LINE> <DEDENT> return "'" + s.replace("'", "'\"'\"'") + "'"
Return a shell-escaped version of the string *s*.
625941e65510c4643540f813
def save_traceback(app): <NEW_LINE> <INDENT> import sphinx <NEW_LINE> import jinja2 <NEW_LINE> import docutils <NEW_LINE> import platform <NEW_LINE> exc = sys.exc_info()[1] <NEW_LINE> if isinstance(exc, SphinxParallelError): <NEW_LINE> <INDENT> exc_format = '(Error in parallel process)\n' + exc.traceback <NEW_LINE> <DE...
Save the current exception's traceback in a temporary file.
625941e632920d7e50b2860d
def do_set_display(self,param=0): <NEW_LINE> <INDENT> logging.debug(__name__ + ' : setting the display parameter for the instrument') <NEW_LINE> self.connectToAVS() <NEW_LINE> self._visainstrument.write('DIS%s' %param)
Set the display parameter of AVS Input: param(int)= 0 : R 1 : deltaR 2 : ADJ ref 3...: ... (look at the device front panel) 7 : 530 set PT Output: None
625941e626238365f5f0f2ae
def isChecked(self): <NEW_LINE> <INDENT> return bool()
bool Plasma.PushButton.isChecked()
625941e63c8af77a43ae3bdf
def post(self, urlPrefix, url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> volunteer = self.auth(require_login=True, require_admin = True) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.urlPrefix = urlPrefix <NEW_LINE> self._callHandlingMethod(url, self.postRegexps)
Handle HTTP POST
625941e67d847024c06be6f9
def x_single_shooting(self, car_dyn, x0, u): <NEW_LINE> <INDENT> x = [] <NEW_LINE> z = x0 <NEW_LINE> for k in range(self.N): <NEW_LINE> <INDENT> z = car_dyn(z, u[k * car_dyn.nu:(k + 1) * car_dyn.nu]) <NEW_LINE> x.append(z) <NEW_LINE> <DEDENT> return x
Returns a list of the state variables along a trajectory given initial state and control variables Parameters ---------- car_dyn : Dynamics object the dynamics of the regarded vehicle x0 : cs.SX or cs.MX the initial state u : cs.SX or cs.MX the control variables
625941e630dc7b7665901d9b
def run(self): <NEW_LINE> <INDENT> pass
Do the actual work.
625941e610dbd63aa1bd2fdc
def fw(self): <NEW_LINE> <INDENT> self.renderer.draw_segment(self.length_stack[-1]) <NEW_LINE> self.renderer.turn((-1 if self.flipped else 1) * random.gauss(2, 2))
Dessiner un segment d'une branche. Se comporte d'une façon qui ressemble au fw() du turtle, mais tourne un petit peu de manière aléatoire (l'angle de rotation suit une distribution normale d'espérance 2 et d'écart type 2. Ceci correspond à une rotation qui aura la tendance d'être vers le haut (dans la direction de la ...
625941e6009cb60464c637e8
def tip_summary(game, tips): <NEW_LINE> <INDENT> summary = {} <NEW_LINE> winners = [] <NEW_LINE> summary['margin'] = [] <NEW_LINE> for club in (game.afl_home, game.afl_away): <NEW_LINE> <INDENT> winners.append((club, len([t for t in tips if t.winner == club]))) <NEW_LINE> margins = [t.margin for t in tips if t.winner =...
Build a summary of the game's tips.
625941e6a934411ee3751ace
def readItems(self): <NEW_LINE> <INDENT> return self.itemsDescrip
Read the items descriptions params ------ None Return ------ itemDescriptions -> dict
625941e61b99ca400220aeed
def handle(self): <NEW_LINE> <INDENT> data = str(self.request.recv(MAX_DATA_SIZE), *apiutils.encoding_defaults) <NEW_LINE> match = apiutils.re_apicommand.match( data ) <NEW_LINE> if not match: <NEW_LINE> <INDENT> print("Bad Request: {!r}".format(data)) <NEW_LINE> return self.exception( 'BadRequest', "Failed to parse re...
Convert peer requests into into api_* methods This method is called when data is received. It interprets the command-and-arguments structure dictated by the API into a method to which the interpreted arguments are passed. Arguments are decoded using :func:`apiutils.arg_decode` before being passed on, but they remain s...
625941e6d8ef3951e3243978
def _check_bullet_alien_collisions(self): <NEW_LINE> <INDENT> collisions = pygame.sprite.groupcollide( self.bullets, self.aliens, True, True ) <NEW_LINE> if not self.aliens: <NEW_LINE> <INDENT> self.bullets.empty() <NEW_LINE> self._create_fleet()
响应子弹和外星人碰撞
625941e68a349b6b435e85ad
def images_names(self): <NEW_LINE> <INDENT> return self.imagespaths.keys()
Returns: List[str]: Preloaded images names.
625941e6711fe17d8254279c
def delete_by_path(self, path): <NEW_LINE> <INDENT> if not os.path.exists(path): <NEW_LINE> <INDENT> raise IOError("Unknown path '%s'!" % path) <NEW_LINE> <DEDENT> if not path.startswith(self.path): <NEW_LINE> <INDENT> raise IOError( "Path '%s' is not in the root of the storage ('%s')!" % ( path, self.path ) ) <NEW_LIN...
Delete file/directory identified by `path` argument. Warning: `path` have to be in :attr:`path`. Args: path (str): Path of the file / directory you want to remove. Raises: IOError: If the file / directory doesn't exists, or is not in :attr:`path`.
625941e6a8ecb033257d3506
def process_request(self, request, client_address): <NEW_LINE> <INDENT> t = threading.Thread(target = self.process_request_thread, args = (request, client_address)) <NEW_LINE> if self.daemon_threads: <NEW_LINE> <INDENT> t.daemon = True <NEW_LINE> <DEDENT> t.start()
Start a new thread to process the request.
625941e6236d856c2ad44c1a
def test_object_access_through_slug_urls(self): <NEW_LINE> <INDENT> john = Author.objects.create(name='Peter', age=25) <NEW_LINE> for index in range(1, 10): <NEW_LINE> <INDENT> Book.objects.create(title='Title %d' % index, author=john) <NEW_LINE> <DEDENT> response = self.client.get(reverse("uuidbooks:list")) <NEW_LINE>...
Test CRUDViewset view access using slug_field based urls
625941e663f4b57ef0001547
@staff_member_required <NEW_LINE> def download_xlsx(request, pk, queryset=None): <NEW_LINE> <INDENT> import cStringIO as StringIO <NEW_LINE> from openpyxl.workbook import Workbook <NEW_LINE> from openpyxl.writer.excel import save_virtual_workbook <NEW_LINE> from openpyxl.cell import get_column_letter <NEW_LINE> import ...
Download the full report in xlsx format Why xlsx? Because there is no decent ods library for python and xls has limitations queryset: predefined queryset to bypass filters
625941e62c8b7c6e89b35bf8
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(edgesUpdateResponse, self).__init__(*args, **kwds) <NEW_LINE> if self.ret is None: <NEW_LINE> <INDENT> self.ret = 0 <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.ret = 0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: ret :param args: complete set of ...
625941e691af0d3eaac9be57
def load_environment(global_conf, app_conf): <NEW_LINE> <INDENT> config = PylonsConfig() <NEW_LINE> root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) <NEW_LINE> paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root...
Configure the Pylons environment via the ``pylons.config`` object
625941e6a934411ee3751acf
def _declare_ampr_variables(self): <NEW_LINE> <INDENT> self._initialize_time_fields() <NEW_LINE> self.Scan = np.zeros(self.nscans, dtype=np.int32) <NEW_LINE> self.Icon = np.zeros(self.nscans, dtype=np.int32) <NEW_LINE> self.Noise10 = np.zeros(self.nscans, dtype='float') <NEW_LINE> self.Noise19 = np.zeros(self.nscans, d...
Define variables to be populated
625941e6fb3f5b602dac3ad2
def test_available_ports(): <NEW_LINE> <INDENT> ports = available_ports() <NEW_LINE> assert_equals(ports, PRETEND_PORT_RANGE) <NEW_LINE> mock_port = list(PRETEND_PORT_RANGE)[2] <NEW_LINE> assert_true(mock_port in ports) <NEW_LINE> pretend_server = Mock() <NEW_LINE> pretend_server.port = mock_port <NEW_LINE> PRETENDERS[...
Test ``available_ports`` filters out ports that are in use by ``MOCK_SERVERS``.
625941e60383005118ecfa1c