code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def create_transition_matrix(self, width, height): <NEW_LINE> <INDENT> self.transitionMatrix = np.zeros((width * height, width * height)) <NEW_LINE> i = 0 <NEW_LINE> while i < (width * height): <NEW_LINE> <INDENT> xPositionInitial = int(i / height) <NEW_LINE> yPositionInitial = int(i % height) <NEW_LINE> if self.walls[...
This method creates the transition matrix of the maze. Arguments: ---------- - width: The width of the maze. - height: The height of the maze. Return: ------- - The transition matrix of the maze.
625941e28c0ade5d55d3ed8b
def assert_arc_user_can_search_and_view_applications(self): <NEW_LINE> <INDENT> global selenium_task_executor <NEW_LINE> title_change_wait = 15 <NEW_LINE> try: <NEW_LINE> <INDENT> self.login_as_arc_user() <NEW_LINE> selenium_task_executor.get_driver().find_element_by_xpath("//*[@id='proposition-links']/li[1]/a").click(...
Tests that an Arc user can perform a search on applications
625941e2d58c6744b425802b
def create_day_month(start_year, end_year): <NEW_LINE> <INDENT> day_month_list = [] <NEW_LINE> times = pd.date_range('01-01-{}'.format(start_year), '12-31-{}'.format(end_year)) <NEW_LINE> for time in times: <NEW_LINE> <INDENT> day = str(time).split(' ')[0].split('-')[2] <NEW_LINE> month = str(time).split(' ')[0].split(...
Returns a list of from 0101-3112.
625941e28e71fb1e9831db75
def _lookup(self, p, directory, fsclass, create=1): <NEW_LINE> <INDENT> if isinstance(p, Base): <NEW_LINE> <INDENT> p.must_be_same(fsclass) <NEW_LINE> return p <NEW_LINE> <DEDENT> p = str(p) <NEW_LINE> if not os_sep_is_slash: <NEW_LINE> <INDENT> p = p.replace(OS_SEP, '/') <NEW_LINE> <DEDENT> if p[0:1] == '#': <NEW_LINE...
The generic entry point for Node lookup with user-supplied data. This translates arbitrary input into a canonical Node.FS object of the specified fsclass. The general approach for strings is to turn it into a fully normalized absolute path and then call the root directory's lookup_abs() method for the heavy lifting. ...
625941e2cc0a2c11143dd25f
def obj2unicode(obj): <NEW_LINE> <INDENT> if isinstance(obj, unicode_type): <NEW_LINE> <INDENT> return obj <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return unicode_type(obj, 'utf') <NEW_LINE> <DEDENT> except UnicodeDecodeError as strerror: <NEW_LINE> <INDENT> sys.stderr.write("UnicodeDecode...
Return a unicode representation of a python object
625941e230c21e258bdfa86d
def get_index(self): <NEW_LINE> <INDENT> return Index(self._index_under_construction)
Returns Index object
625941e2e64d504609d74c0d
def has_permission(self, request, user): <NEW_LINE> <INDENT> if user and user.is_staff: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Please refer to the interface documentation.
625941e230dc7b7665901d2f
def activate_subscription(self, id, reason): <NEW_LINE> <INDENT> url = self.resources['subscriptions'] + f'/{id}/activate' <NEW_LINE> response = self.api.post(url, json={'reason': reason}) <NEW_LINE> return self.handle_response(response)
Use this function to activate a subscription.
625941e29f2886367277ac58
def list( self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): <NEW_LINE> <INDENT> def internal_paging(next_link=None, raw=False): <NEW_LINE> <INDENT> if not next_link: <NEW_LINE> <INDENT> url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/...
Gets all the load balancer frontend IP configurations. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param load_balancer_name: The name of the load balancer. :type load_balancer_name: str :param dict custom_headers: headers that will be added to the request :param bool raw...
625941e2be8e80087fb2100a
@comments.route('/<int:comment_id>', methods=['DELETE']) <NEW_LINE> def delete_comment(comment_id): <NEW_LINE> <INDENT> comment = Comment.query.get_or_404(comment_id) <NEW_LINE> db.session.delete(comment) <NEW_LINE> db.session.commit() <NEW_LINE> return ""
Delete a comment by id
625941e2a79ad161976cc512
def __init__(self, movie, fps=1): <NEW_LINE> <INDENT> self.x_data = None <NEW_LINE> self.movie = movie <NEW_LINE> self.n_images = len(movie.images) <NEW_LINE> if self.n_images == 0: <NEW_LINE> <INDENT> raise RuntimeError('At least one image is needed') <NEW_LINE> <DEDENT> self.n_axes = len(movie.axes) <NEW_LINE> self._...
:param movie:
625941e230bbd722463cc195
def test_add_partially_learnt_topic_id(self) -> None: <NEW_LINE> <INDENT> incomplete_activities = (user_domain.IncompleteActivities( 'user_id0', ['exp_id0'], ['collect_id0'], ['story_id0'], ['topic_id0'])) <NEW_LINE> self.assertListEqual( incomplete_activities.partially_learnt_topic_ids, ['topic_id0']) <NEW_LINE> incom...
Testing add_partially_learnt_topic_id.
625941e201c39578d7e75209
def get_chrom(self): <NEW_LINE> <INDENT> return self.chrom
return the variant chromosome
625941e22ae34c7f2600d4fe
def wage_process_mean(self,w_old,age,state=1): <NEW_LINE> <INDENT> a0=self.palkat_ika[max(0,age-1-self.min_age)] <NEW_LINE> a1=self.palkat_ika[age-self.min_age] <NEW_LINE> if state==0: <NEW_LINE> <INDENT> factor=self.unemp_wageshock <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> factor=1.0 <NEW_LINE> <DEDENT> sigma=self...
wage process mean function palkka vuositasolla w_cum cumulative probability until w_cum w_old vanha palkka age ika state employment state
625941e2379a373c97cfaf14
def aws_from_configuration( region, zone, access_key_id, secret_access_key, cluster_id, session_token=None, validate_region=True ): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return EBSBlockDeviceAPI( ec2_client=ec2_client( region=region, zone=zone, access_key_id=access_key_id, secret_access_key=secret_access_key, se...
Build an ``EBSBlockDeviceAPI`` instance using configuration and credentials. :param str region: The EC2 region slug. Volumes will be manipulated in this region. :param str zone: The EC2 availability zone. Volumes will be manipulated in this zone. :param str access_key_id: The EC2 API key identifier to use to...
625941e27d847024c06be68d
def card_touched(self, card_display): <NEW_LINE> <INDENT> if self._in_progress: return <NEW_LINE> if self._in_tutorial(): <NEW_LINE> <INDENT> if self.current_screen.card_touched(): return <NEW_LINE> <DEDENT> elif not self.is_game_screen(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self.game.round == 0: <NEW_LIN...
Handle a touch to a displayed card.
625941e2d486a94d0b98e514
def getTdSizes(nmrData=None): <NEW_LINE> <INDENT> if not nmrData: <NEW_LINE> <INDENT> nmrData = processor.getNMRData() <NEW_LINE> <DEDENT> nDim = nmrData.getNDim() <NEW_LINE> sizes = [ nmrData.getSize(i) for i in range(nDim) ] <NEW_LINE> return sizes
return time domain sizes
625941e2187af65679ca54ee
def _build(self, args, kwargs): <NEW_LINE> <INDENT> regex = self.regex <NEW_LINE> variables = self.variables <NEW_LINE> if self.args_count: <NEW_LINE> <INDENT> for index, value in enumerate(args): <NEW_LINE> <INDENT> key = '__%d__' % index <NEW_LINE> if key in variables: <NEW_LINE> <INDENT> kwargs[key] = value <NEW_LIN...
Returns the URI path for this route. :returns: A tuple ``(path, kwargs)`` with the built URI path and extra keywords to be used as URI query arguments.
625941e2dd821e528d63b573
def p_left_value_matrix(p): <NEW_LINE> <INDENT> p[0] = p[1]
left_value : matrix_id
625941e25fcc89381b1e1a8e
def _do_upgrade(self, step): <NEW_LINE> <INDENT> request = self.layer['request'] <NEW_LINE> request.form['profile_id'] = self.profile_id <NEW_LINE> request.form['upgrades'] = [step['id']] <NEW_LINE> self.setup.manage_doUpgrades(request=request)
Execute an upgrade step.
625941e25fcc89381b1e1a8f
def inference(self, preprocessed_image): <NEW_LINE> <INDENT> if not self.model: <NEW_LINE> <INDENT> raise RuntimeError("first load the model with 'load_model()' method then call inferece()") <NEW_LINE> <DEDENT> input_image = np.expand_dims(preprocessed_image, axis=0) <NEW_LINE> input_tensor = tf.convert_to_tensor(input...
Inference function sets input tensor to input image and gets the output. The interpreter instance provides corresponding detection output which is used for creating result Args: resized_rgb_image: uint8 numpy array with shape (img_height, img_width, channels) Returns: result: A Frame protobuf massages
625941e2656771135c3ebc40
def evalDect(predf, gtf): <NEW_LINE> <INDENT> def hits(rect, targets): <NEW_LINE> <INDENT> return any([intersectOverLeft(rect, target) >= 0.7 for target in targets]) <NEW_LINE> <DEDENT> predicted_slices = ba.utils.load(predf) <NEW_LINE> if predicted_slices is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> ground_...
Evaluate detection for a result file. Args: predf (str): The path to the YAML file conataining the predictions gtf (str): The path to the YAML file conataining the ground truth Returns: precision, recall, thresholds
625941e257b8e32f5248386b
def nextPermutation(self, nums: List[int]) -> None: <NEW_LINE> <INDENT> if len(nums) == 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if len(nums) == 1: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if len(nums) == 2: <NEW_LINE> <INDENT> nums[0], nums[1] = nums[1], nums[0] <NEW_LINE> return <NEW_LINE> <DEDENT> for...
Do not return anything, modify nums in-place instead.
625941e24e4d5625662d47a0
def read_ScanFile(self, attr): <NEW_LINE> <INDENT> self.debug_stream("In read_ScanFile()") <NEW_LINE> attr.set_value(self.__stg.scanFile or "")
Read ScanFile attribute :param attr: read attribute :type attr: :class:`PyTango.Attribute`
625941e2bf627c535bc1359d
def test_upload_fk_as_id(self): <NEW_LINE> <INDENT> f = open(os.path.join(self.dir_name, 'files/instructors_fk.csv'), "r") <NEW_LINE> uploaded_file = SimpleUploadedFile('instructors_fk.csv', f.read()) <NEW_LINE> output = handle_uploaded_file(uploaded_file, 'tests', 'instructor') <NEW_LINE> from nomnom.tests.models impo...
Allow unique-field values in M2M columns in the CSV upload
625941e28e7ae83300e4b39b
def make_rum_param_list(samples, config, params=None): <NEW_LINE> <INDENT> final_list = [] <NEW_LINE> fastq_dir = config['general_params']['fastq_input_dir'] <NEW_LINE> log_dir = config['general_params']['log_file_dir'] <NEW_LINE> rum_dir = config['rum_params']['output_dir'] <NEW_LINE> for sample in samples: <NEW_LINE>...
Helper function to turn the sample file into a list of files. Needs to be a list of [[input1, input2], output, params]; for the fastqc script. The output is the file RUM.sam. while the params are taken from the global opts variable (and possibly from the YAML config file).
625941e20383005118ecf9af
def as_pdf_selectors(self, *field_names): <NEW_LINE> <INDENT> if field_names: <NEW_LINE> <INDENT> pdf_fields = [] <NEW_LINE> for field_name in field_names: <NEW_LINE> <INDENT> field = self._meta['field_info'].get(field_name) <NEW_LINE> if field is None: <NEW_LINE> <INDENT> raise ValueError('{field} is not a DocField de...
Return pdfminer selector for specified field. If no field is specified, then selectors for **all** fields are returned.
625941e2be383301e01b584c
def _can_download( _type: str, file_formats: dict, file_format: Optional[str] ) -> bool: <NEW_LINE> <INDENT> if _type in ["audio", "document", "video"]: <NEW_LINE> <INDENT> allowed_formats: list = file_formats[_type] <NEW_LINE> if not file_format in allowed_formats and allowed_formats[0] != "all": <NEW_LINE> <INDENT> r...
Check if the given file format can be downloaded. Parameters ---------- _type: str Type of media object. file_formats: dict Dictionary containing the list of file_formats to be downloaded for `audio`, `document` & `video` media types file_format: str Format of the current file to be downloaded. Re...
625941e23c8af77a43ae3b72
def dailyTemperatures(self, temperatures): <NEW_LINE> <INDENT> n = len(temperatures) <NEW_LINE> rtn = [0] * n <NEW_LINE> st = [] <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> while st and temperatures[st[-1]] < temperatures[i]: <NEW_LINE> <INDENT> rtn[st[-1]] = i - st[-1] <NEW_LINE> st.pop() <NEW_LINE> <DEDENT> st....
:type temperatures: List[int] :rtype: List[int]
625941e2d99f1b3c44c67956
def clearPreviewer(self): <NEW_LINE> <INDENT> return self.previewer.clear()
@see: L{EntryPreviewer.clear}.
625941e267a9b606de4a8285
def write_seds(self): <NEW_LINE> <INDENT> log.info("Writing the SEDs ...") <NEW_LINE> for label in self.seds: <NEW_LINE> <INDENT> log.debug("Writing " + label + " SED ...") <NEW_LINE> sed_path = fs.join(self.data_seds_path, label + ".dat") <NEW_LINE> self.seds[label].saveto(sed_path)
This function ... :return:
625941e2566aa707497f4931
def scatter(self, x, y, filename=None, spot_cols=None, spots=True, label=False, alpha=0.8, spot_size=40, label_font_size=7, cut=None, squish_scales=False, only_plot_if_x_in_label=None, **kargs): <NEW_LINE> <INDENT> assert filename, "scatter(): Must provide a filename" <NEW_LINE> labels = self.labels <NEW_LINE> xdata = ...
**Purpose** plot a scatter plot of PCx against PCy. **Arguments** x, y (Required) PC dimension to plot as scatter Note that PC begin at 1 (and not at zero, as might be expected) filename (Required) spot_cols (Optional, default="black" or self.set_cols()) list of colours fo...
625941e27b180e01f3dc4bc4
def acknowledge(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None): <NEW_LINE> <INDENT> data = locals().copy() <NEW_LINE> del data["self"] <NEW_LINE> resp = client.make_request(self.url_path, "EventsRouter", "acknowledge", [data]) <NEW_LINE> return create_response(resp)
Acknowledge event(s). @type evids: [string] @param evids: (optional) List of event IDs to acknowledge (default: None) @type excludeIds: [string] @param excludeIds: (optional) List of event IDs to exclude from acknowledgment (default: None) @type params: dictionary @param params: (optional) Key-va...
625941e256ac1b37e6264597
def remove_person(self, person): <NEW_LINE> <INDENT> self.persons.discard(person)
:param person: Person object :return
625941e2d99f1b3c44c67957
def emit_metadata_py(self, datadir, module_prefix): <NEW_LINE> <INDENT> if not os.path.isdir(datadir): <NEW_LINE> <INDENT> os.mkdir(datadir) <NEW_LINE> <DEDENT> modulefilename = os.path.join(datadir, '__init__.py') <NEW_LINE> for country_id in sorted(self.territory.keys()): <NEW_LINE> <INDENT> filename = os.path.join(d...
Emit Python code for the phone number metadata to the given file, and to a data/ subdirectory in the same directory as that file.
625941e2442bda511e8be7e1
def find_diffs(files): <NEW_LINE> <INDENT> found_diffs = False <NEW_LINE> for file in files: <NEW_LINE> <INDENT> cli.log.debug('Checking for changes in %s', file) <NEW_LINE> clang_format = Popen([find_clang_format(), file], stdout=PIPE, stderr=PIPE, universal_newlines=True) <NEW_LINE> diff = cli.run(['diff', '-u', f'--...
Run clang-format and diff it against a file.
625941e2460517430c394549
@database.route('/database/create/<database_name>') <NEW_LINE> def create_database(database_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> conn = sqlite3.connect(database_name) <NEW_LINE> return 'Database {} created!'.format(database_name) <NEW_LINE> <DEDENT> except Error as e: <NEW_LINE> <INDENT> return str(e) <N...
Create a database :param database_name: :return:
625941e2cc40096d61595d1d
def go_finish_super(self, riderId, dataSaver): <NEW_LINE> <INDENT> orderId = dataSaver.superDic[riderId]['orderId'] <NEW_LINE> yuyueExpectTime = dataSaver.timer.trans_unix_to_datetime( dataSaver.superDic[riderId]['expectTime'] ) <NEW_LINE> nowTime = dataSaver.timer.trans_unix_to_datetime( dataSaver.time ) <NEW_LINE> co...
完成身上所挂的预订单
625941e285dfad0860c3b229
def update_gen_class(self): <NEW_LINE> <INDENT> schema_root_key = self.schema.keys()[0] <NEW_LINE> self.schema[schema_root_key][self.pro_name][GenElements.MOD][0][ GenElements.INIT ] = self.template[self.pro_type][0][GenElements.CLASS] <NEW_LINE> self.schema[schema_root_key][self.pro_name][GenElements.MOD][1][ GenEleme...
Preparing generator project setup. :exceptions: None
625941e2b57a9660fec33c57
def test_form_has_fields(self): <NEW_LINE> <INDENT> expected = ['name','cpf','email','phone'] <NEW_LINE> self.assertSequenceEqual(expected,list(self.form.fields))
Form deve conter 4 campo
625941e257b8e32f5248386c
def get_user_details(self, response): <NEW_LINE> <INDENT> contact_infos = response.get('contact_infos') <NEW_LINE> try: <NEW_LINE> <INDENT> email = contact_infos[0]['value'] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> email = "none@openstax.org" <NEW_LINE> <DEDENT> return {'username': str(response.get('i...
Return user details from openstax account's
625941e230bbd722463cc196
def publish_post(self, post): <NEW_LINE> <INDENT> post.post_status = "publish" <NEW_LINE> if not (hasattr(post, "post_type") and post.post_type == "page"): <NEW_LINE> <INDENT> post.comment_status = "open" <NEW_LINE> <DEDENT> if hasattr(post, "id"): <NEW_LINE> <INDENT> method = wordpress_xmlrpc.methods.posts.EditPost(po...
Publish new post or update an existing one. If the given post already has an id assigned then it is just updated. Otherwise it is added as a new post. Post should consists of title and text. :param post: instance of the post to be published
625941e226068e7796caf0b3
def count_ops(expr, *args, **kwargs): <NEW_LINE> <INDENT> if isinstance(expr, sp.MatrixBase): <NEW_LINE> <INDENT> return matrix_count_ops(expr, *args, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> res = sp.count_ops(expr, *args, **kwargs) <NEW_LINE> if expr == 0: <NEW_LINE> <INDENT> return res <NEW_LINE> <DED...
Matrix aware wrapper for sp.count_ops In difference to the sympy version this function only returns 0 if the operand is equal to 0, otherwise it returns at least 1 (for atoms)
625941e2e1aae11d1e74a089
def _dispatch(table, action, user, obj): <NEW_LINE> <INDENT> if action in table: <NEW_LINE> <INDENT> result = table[action]() <NEW_LINE> return result <NEW_LINE> <DEDENT> raise ValueError(u"Unknown action for object type '{0}': '{1}'".format( type(obj), action))
Helper: call table[action], raising a nice pretty error if there is no such key. user and object passed in only for error messages and debugging
625941e25fc7496912cc3d4c
def all_remarks(self, commid=None, sort_by=('remark.commid', 'remark.lineno'), reverse=False): <NEW_LINE> <INDENT> return self.remarks.values(subset_dict={'remark.commid': commid}, sort_by=sort_by, reverse=reverse)
Get all remarks, filtered by commid, and sorted by lineno.
625941e27047854f462a17d3
def read_wkb_raster(wkb): <NEW_LINE> <INDENT> ret = {} <NEW_LINE> (endian,) = unpack('<b', wkb.read(1)) <NEW_LINE> if endian == 0: <NEW_LINE> <INDENT> endian = '>' <NEW_LINE> <DEDENT> elif endian == 1: <NEW_LINE> <INDENT> endian = '<' <NEW_LINE> <DEDENT> (version, bands, scaleX, scaleY, ipX, ipY, skewX, skewY, srid, wi...
Read a WKB raster to a Numpy array. Based off of the RFC here: http://trac.osgeo.org/postgis/browser/trunk/raster/doc/RFC2-WellKnownBinaryFormat Object is returned in this format: { 'version': int, 'scaleX': float, 'scaleY': float, 'ipX': float, 'ipY': float, 'skewX': float, 'skewY':...
625941e21f037a2d8b9465cb
def daterange(start_date, end_date, reverse=False): <NEW_LINE> <INDENT> if end_date >= start_date: <NEW_LINE> <INDENT> step = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> step = -1 <NEW_LINE> <DEDENT> sequence = range(0, (end_date - start_date).days, step) <NEW_LINE> if reverse: <NEW_LINE> <INDENT> sequence = revers...
Returns a generator that produces the datetime.date() objects that are between start_date (inclusive) and end_date (exclusive). Normally returns dates in the natural order between start_date and end_date, but when reverse=True is passed, the sequence will be reversed.
625941e232920d7e50b285a1
def get_diff_sds(refsd, cursd, domainsid, checkSacl=True): <NEW_LINE> <INDENT> cursddl = get_clean_sd(cursd).as_sddl(domainsid) <NEW_LINE> refsddl = get_clean_sd(refsd).as_sddl(domainsid) <NEW_LINE> txt = "" <NEW_LINE> hash_cur = chunck_sddl(cursddl) <NEW_LINE> hash_ref = chunck_sddl(refsddl) <NEW_LINE> if "owner" not ...
Get the difference between 2 sd This function split the textual representation of ACL into smaller chunck in order to not to report a simple permutation as a difference :param refsddl: First sddl to compare :param cursddl: Second sddl to compare :param checkSacl: If false we skip the sacl checks :return: A string tha...
625941e2ff9c53063f47c5c0
def __rmul__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, int): <NEW_LINE> <INDENT> raise TypeError(f"can't multiply {self.__class__.__name__} by non-int type") <NEW_LINE> <DEDENT> return self.__class__(str(self) * other)
Multiply integer by Seq. >>> from Bio.Seq import Seq >>> 2 * Seq('ATG') Seq('ATGATG')
625941e207f4c71912b11853
def aes_inv_main(self, state, expandedKey, nbrRounds): <NEW_LINE> <INDENT> state = self.add_round_key(state, self.create_round_key(expandedKey, 16 * nbrRounds)) <NEW_LINE> i = nbrRounds - 1 <NEW_LINE> while i > 0: <NEW_LINE> <INDENT> state = self.aes_inv_round(state, self.create_round_key(expandedKey, 16 * i)) <NEW_LIN...
Perform the initial operations, the standard round, and the final operations of the inverse aes, creating a round key for each round
625941e232920d7e50b285a2
def test_serialize_sparse_2d_array(self): <NEW_LINE> <INDENT> array = sparse.rand(10, 10, density=0.3, format='csr').astype(self.dtype) <NEW_LINE> serialize_array(array, self.array_file) <NEW_LINE> serialized_array = load_array(self.array_file, array_dim=2, array_type='sparse', dtype=self.dtype) <NEW_LINE> np.testing.a...
...Test serialization of 2d sparse array is done as expected
625941e2a05bb46b383ecbed
def appDriver(self): <NEW_LINE> <INDENT> self.initApp(); <NEW_LINE> while(True): <NEW_LINE> <INDENT> if(self.state == SYS_STATE_HOME): <NEW_LINE> <INDENT> self.state = self.processStateHome(); <NEW_LINE> <DEDENT> if(self.state == SYS_STATE_MEMBER): <NEW_LINE> <INDENT> self.state = self.processStateMember(); <NEW_LINE> ...
The driver that runs the application
625941e22c8b7c6e89b35b8c
def check_last_event(self, event_id): <NEW_LINE> <INDENT> if self.get_latest_event() == event_id: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False
if last_event is the same return True, that seems if there isn't new event return True, else return False
625941e250485f2cf553d16a
def authenticate(username, password): <NEW_LINE> <INDENT> user = UserModel.find_by_username(username) <NEW_LINE> if user and safe_str_cmp(user.password, password): <NEW_LINE> <INDENT> return user
Function that gets called when a user calls the /auth endpoint with their username and password. :param username: User's username in string format. :param password: User's un-encrypted password in string format. :return: A UserModel object if authentication was successful
625941e27c178a314d6ef834
def associated_text(self, link: Tag, page_url: str) -> str: <NEW_LINE> <INDENT> if link.has_attr("class") and link.attrs["class"][0] == "image": <NEW_LINE> <INDENT> if self.link_is_thumbnail_in_list(link): <NEW_LINE> <INDENT> return self.thumbnail_in_list_text(link) <NEW_LINE> <DEDENT> elif self.link_is_inline_thumbnai...
Returns text that accompanies link.
625941e21b99ca400220ae81
def p_negacao1(self, p): <NEW_LINE> <INDENT> p[0] = Tree("negacao", p[1:])
negacao : expressoes_booleanas_primario
625941e294891a1f4081be79
def timeout_queue_process(self): <NEW_LINE> <INDENT> while self.timeout_add_queue: <NEW_LINE> <INDENT> self.timeout_process_add_queue(*self.timeout_add_queue.popleft()) <NEW_LINE> <DEDENT> now = time.time() <NEW_LINE> due_timeouts = [] <NEW_LINE> for timeout in self.timeout_keys: <NEW_LINE> <INDENT> if timeout > now: <...
Check the timeout_queue and set any due modules to update.
625941e2596a897236089e8a
def request_data(strict=False): <NEW_LINE> <INDENT> def wrapper(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def _wrapper(request, *args, **kwargs): <NEW_LINE> <INDENT> request.query_data = RequestData(request, is_query=True, strict=strict) <NEW_LINE> request.shift_data = RequestData(request, is_query=F...
添加自定义的请求参数对象 :param strict: 严格过滤模式 :return: 请求处理方法
625941e210dbd63aa1bd2f71
def test_list_pkgs(self): <NEW_LINE> <INDENT> def _add_data(data, key, value): <NEW_LINE> <INDENT> data.setdefault(key, []).append(value) <NEW_LINE> <DEDENT> rpm_out = [ 'protobuf-java_|-2.6.1_|-3.1.develHead_|-noarch_|-_|-1499257756', 'yast2-ftp-server_|-3.1.8_|-8.1_|-x86_64_|-_|-1499257798', 'jose4j_|-0.4.4_|-2.1.dev...
Test packages listing. :return:
625941e255399d3f05588a85
def table_str(key): <NEW_LINE> <INDENT> table, schema = key <NEW_LINE> return "%s.%s" % (str(schema), (table)) if schema else str(table)
Make (`schema`, `table`) tuple printable.
625941e24c3428357757c6f4
@pytest.fixture <NEW_LINE> def valid_attributes(): <NEW_LINE> <INDENT> return dict( email_mapping=['test@hzdr.de'], id_mapping=['test123'], full_name_mapping=['Test Tester'], )
Fixture for valid attributes.
625941e221bff66bcd684d1d
def nnls(A, B, **kwargs): <NEW_LINE> <INDENT> if B.ndim == 1: <NEW_LINE> <INDENT> return scipy.optimize.nnls(A, B)[0] <NEW_LINE> <DEDENT> n_columns = int(MAX_MEM_BLOCK // (A.shape[-1] * A.itemsize)) <NEW_LINE> if B.shape[-1] <= n_columns: <NEW_LINE> <INDENT> return _nnls_lbfgs_block(A, B, **kwargs).astype(A.dtype) <NEW...
Non-negative least squares. Given two matrices A and B, find a non-negative matrix X that minimizes the sum squared error: `err(X) = sum_i,j ((AX)[i,j] - B[i, j])^2` Parameters ---------- A : np.ndarray [shape=(m, n)] The basis matrix B : np.ndarray [shape=(m, N)] The target matrix. kwargs Addition...
625941e21f037a2d8b9465cc
def requestControl(self): <NEW_LINE> <INDENT> status = self.send_cmd(0x4243, 0x5555, read=True) <NEW_LINE> return self.from_bytes(status) == 1
Returns True if control was granted, False otherwise.
625941e2be7bc26dc91cd9c8
@blueprint.route("/about/") <NEW_LINE> def about(): <NEW_LINE> <INDENT> return render_template("public/about.html")
Renders a simple about page
625941e20a50d4780f667264
def test_cannot_send_empy_feild_of_form(self): <NEW_LINE> <INDENT> self.browser.get(self.live_server_url + '/contacts') <NEW_LINE> self.get_item_by_id('name').send_keys(Keys.ENTER) <NEW_LINE> self.wait_for(lambda: self.assertTrue( self.browser.find_elements_by_css_selector('.with-errors')[0].is_displayed() )) <NEW_LINE...
тест: форма не отправляет пустые поля
625941e2956e5f7376d7123a
def delete_tasks(prefix: str): <NEW_LINE> <INDENT> client = boto3.client('events') <NEW_LINE> response = client.list_rules(NamePrefix=prefix) <NEW_LINE> for rule in response['Rules']: <NEW_LINE> <INDENT> name = rule['Name'] <NEW_LINE> targets = client.list_targets_by_rule(Rule=name)['Targets'] <NEW_LINE> print(f"Deleti...
Delete the scheduled tasks with the given prefix, if they exist.
625941e26fb2d068a760f472
def default_get(self, cr, uid, fields, context=None): <NEW_LINE> <INDENT> if context is None: <NEW_LINE> <INDENT> context = {} <NEW_LINE> <DEDENT> record_id = context and context.get('active_id',False) <NEW_LINE> res = {} <NEW_LINE> line = self.pool.get('stock.inventory.line').browse(cr, uid, record_id, context=context...
To check the availability of production lot. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values.
625941e26e29344779a629df
def card_count(self, format): <NEW_LINE> <INDENT> return format.card_count()
Return the current number of cards in the format.
625941e2ec188e330fd5ab66
def get_current_broadcast(self): <NEW_LINE> <INDENT> return self.membership_list
Returns the membership list for this slave.
625941e250812a4eaa59c6ed
def test_course_autocomplete_with_course_team(self): <NEW_LINE> <INDENT> response = self.client.get(self.course_autocomplete_url.format(title='test')) <NEW_LINE> self._assert_response(response, 1) <NEW_LINE> response = self.client.get( self.course_autocomplete_url.format(title='dummy') ) <NEW_LINE> self._assert_respons...
Verify course autocomplete returns data for course team user.
625941e2ec188e330fd5ab67
def test_12_create_a_tables6_object(self): <NEW_LINE> <INDENT> self.assertIsInstance(Tables(dst, "", ipversion=6), Tables) <NEW_LINE> tables = Tables(dst, "", ipversion=6) <NEW_LINE> expect = {'filter': {'FORWARD': [], 'INPUT': [], 'OUTPUT': []}, 'raw': {'OUTPUT': [], 'PREROUTING': []}, 'mangle': {'FORWARD': [], 'INPUT...
Tables 12: create an ipv6 Tables object, check chains
625941e2dc8b845886cb5905
def update_transaction_id(): <NEW_LINE> <INDENT> pass
Updates the transaction ID with that of the global graph manager.
625941e2cb5e8a47e48b7e73
def _open_page_cwe_home(self): <NEW_LINE> <INDENT> self.browser.get("%s%s" % (self.live_server_url, self.PAGE_URL_CWE_HOME))
Open the "CWEs" page.
625941e238b623060ff0b1bc
def PC_S_calc(classes): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return 1 / (len(classes)) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return "None"
Calculate percent chance agreement for Bennett-et-al.'s-S-score. :param classes: confusion matrix classes :type classes : list :return: percent chance agreement as float
625941e2cc40096d61595d1e
def is_empty(self): <NEW_LINE> <INDENT> return len(self) == 0
Returns true if the stack is empty.
625941e25fdd1c0f98dc0604
def skip_example(self, example, options): <NEW_LINE> <INDENT> pass
It is the turn for the example to be executed but it will not. No other concern's method will be called with this example.
625941e2d58c6744b425802d
def find_errors(self) -> Generator[str, None, None]: <NEW_LINE> <INDENT> capture_agent = self.metadata["capture_agent"] <NEW_LINE> potential_error = self.check_capture_agent_format(capture_agent) <NEW_LINE> if potential_error is not None: <NEW_LINE> <INDENT> yield potential_error
Locate any errors with the capture_agent field in the metadata. Yields: Yields human-readable string of any issues. Otherwise, returns None if no problems discovered.
625941e26fece00bbac2db12
def formatOutput(self, storedText, titleMode, internal=False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> text = GenDate(storedText).dateStr(self.format) <NEW_LINE> <DEDENT> except GenDateError: <NEW_LINE> <INDENT> text = _errorStr <NEW_LINE> <DEDENT> return TextFormat.formatOutput(self, text, titleMode, internal)
Return formatted text, properly escaped if not in titleMode
625941e2dc8b845886cb5906
def test_ib_bandwidth(self): <NEW_LINE> <INDENT> err = [] <NEW_LINE> for val in self.test_op: <NEW_LINE> <INDENT> if self.bandwidthperf_exec(self.tool_name, val, "") != 0: <NEW_LINE> <INDENT> err.append("client cmd fail: %s %s" % (self.tool_name, val)) <NEW_LINE> <DEDENT> <DEDENT> if self.flag == "1": <NEW_LINE> <INDEN...
test options are mandatory ext test options are depends upon user
625941e2091ae35668667326
def filter_sampson_error(cam1, cam2, pts1, pts2, matched_ids, error=4): <NEW_LINE> <INDENT> F = cam1.F(cam2) <NEW_LINE> err = sampson_error(F, pts2, pts1) <NEW_LINE> inliers, = np.where(np.fabs(err) < error) <NEW_LINE> pts1, pts2, matched_ids = pts1[inliers], pts2[inliers], matched_ids[inliers] <NEW_LINE>...
Filter feature matches via sampson error given the two camera extrinsics.
625941e2fb3f5b602dac3a66
def save_cluster_labels(self,prepped_cluster_data): <NEW_LINE> <INDENT> msg = '''INSERT INTO default_clusters VALUES(NULL, ?, ?, ?, ?) ''' <NEW_LINE> self.c.executemany(msg,prepped_cluster_data) <NEW_LINE> self.conn.commit() <NEW_LINE> return None
How to organize the cluster labels?
625941e24c3428357757c6f5
def mark_rewrite(self, *names): <NEW_LINE> <INDENT> already_imported = ( set(names).intersection(sys.modules).difference(self._rewritten_names) ) <NEW_LINE> for name in already_imported: <NEW_LINE> <INDENT> mod = sys.modules[name] <NEW_LINE> if not AssertionRewriter.is_rewrite_disabled( mod.__doc__ or "" ) and not isin...
Mark import names as needing to be rewritten. The named module or package as well as any nested modules will be rewritten on import.
625941e23c8af77a43ae3b73
def __getstate__(self): <NEW_LINE> <INDENT> return (self.conn.conn_number, self.base, self.index, self.data)
Return picklable state The rpath's connection will be encoded as its conn_number. It and the other information is put in a tuple. Data and any attached file won't be saved.
625941e28c3a87329515878e
def __init__(self, user): <NEW_LINE> <INDENT> self._user = user <NEW_LINE> user_is_anonymous = self._user.is_anonymous <NEW_LINE> if not user_is_anonymous: <NEW_LINE> <INDENT> setattr(self._user, User.USERNAME_FIELD, self._user.get_username()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> setattr(self._user, User.USERN...
Constructor. :param user: :return:
625941e25510c4643540f7aa
def solve_row0_tile(self, target_col): <NEW_LINE> <INDENT> move_str = "" <NEW_LINE> target_row = 0 <NEW_LINE> assert self.row0_invariant(target_col) <NEW_LINE> target_position = self.current_position(target_row, target_col) <NEW_LINE> if target_position[0] == 0 and target_position[1] == target_col - 1: <NEW_LINE> <INDE...
Solve the tile in row zero at the specified column Updates puzzle and returns a move string
625941e2925a0f43d254a24a
def __call__(self, x, train=True): <NEW_LINE> <INDENT> return tf.contrib.layers.batch_norm(x, decay=self.momentum, updates_collections=None, epsilon=self.epsilon, center=True, scale=True, is_training=train, scope=self.name)
:param x: tensor with dimension of [batch_size, ...] :param train: whether or not the layer is in training model :return: A tensor representing the output of the operation
625941e263b5f9789fde74b5
def remove_selected(self): <NEW_LINE> <INDENT> select_data = self._obj.get_selection().get_selected() <NEW_LINE> if select_data is None or select_data[1] is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> (model, node) = select_data <NEW_LINE> path = model.get_path(node) <NEW_LINE> if len(path) > 1: <NEW_LINE> <IN...
Removes the selected node from the list
625941e2ff9c53063f47c5c1
def generate_random_inventory_count(): <NEW_LINE> <INDENT> return str(random.randint(1, 11))
Generate a random integer between 1 and 10.
625941e226238365f5f0f243
def part2(wire1, wire2): <NEW_LINE> <INDENT> return calc_fewest_steps(wire1, wire2)
Solve the puzzle (part 2), given the input in input.txt
625941e2442bda511e8be7e2
def hasChildren(self, parentIndex=QtCore.QModelIndex()): <NEW_LINE> <INDENT> parentItem = self.getItem(parentIndex, altItem=self.invisibleRootTreeItem) <NEW_LINE> return parentItem.hasChildren()
Returns true if parent has any children; otherwise returns false. Use rowCount() on the parent to find out the number of children.
625941e2a219f33f34628d34
def test_unknown_mac_unicast_default(self): <NEW_LINE> <INDENT> tenant, bd = self.create_bd() <NEW_LINE> self.assertTrue(bd.get_unknown_mac_unicast(), 'proxy')
Test default unknown mac unicast
625941e297e22403b379d36b
def solve_power(self, effect_size=None, nobs1=None, alpha=None, power=None, ratio=1., alternative='two-sided'): <NEW_LINE> <INDENT> return super(NormalIndPower, self).solve_power(effect_size=effect_size, nobs1=nobs1, alpha=alpha, power=power, ratio=ratio, alternative=alternative)
solve for any one parameter of the power of a two sample z-test for z-test the keywords are: effect_size, nobs1, alpha, power, ratio exactly one needs to be ``None``, all others need numeric values Parameters ---------- effect_size : float standardized effect size, difference between the two means divided ...
625941e2f548e778e58cd94e
def claim_create_onaccept(form): <NEW_LINE> <INDENT> form_vars = form.vars <NEW_LINE> if "id" in form_vars: <NEW_LINE> <INDENT> record_id = form_vars.id <NEW_LINE> <DEDENT> elif hasattr(form, "record_id"): <NEW_LINE> <INDENT> record_id = form.record_id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return <NEW_LINE> <DE...
Custom create-onaccept for claim to notify the provider accountant about the new claim
625941e2187af65679ca54f0
@api_view(['GET']) <NEW_LINE> def api_root(request, format=None): <NEW_LINE> <INDENT> return Response({ 'scheduleitems': reverse('api-scheduleitem-list', request=request), 'videos': reverse('api-video-list', request=request), })
The root of the FK API / web services
625941e2a8ecb033257d349b
def testUsingTestData(self): <NEW_LINE> <INDENT> new_key_value = ds.KeyValueFromString(ds_test_data.TEST_KEY_VALUE1) <NEW_LINE> self.assert_(isinstance(new_key_value.dsa_key_value, ds.DSAKeyValue)) <NEW_LINE> self.key_value.dsa_key_value = None <NEW_LINE> self.key_value.rsa_key_value = ds.RSAKeyValueFromString( ds_test...
Test for KeyValueFromString() using test data
625941e263b5f9789fde74b6
def get_repeat(self, chrom, pos): <NEW_LINE> <INDENT> position_index = get_position_index(chrom, pos, bin_size=self.bin_size) <NEW_LINE> potentials = self.allias_to_tups[position_index] <NEW_LINE> for repeat in potentials: <NEW_LINE> <INDENT> is_in_range = int(pos) >= int(repeat[1]) and int(pos) <= int(repeat[2]) <NEW_...
Get repeat from collection
625941e2cad5886f8bd273a8
def inventory_diary(error): <NEW_LINE> <INDENT> _headergame(p) <NEW_LINE> empty_line(2) <NEW_LINE> tri_content('ENTRY I', 'ENTRY II', 'ENTRY III') <NEW_LINE> tri_content('name', 'name', 'name') <NEW_LINE> tri_content('', '', '') <NEW_LINE> empty_line(2) <NEW_LINE> tri_content('ENTRY IV', 'ENTRY V', 'ENTRY VI') <NEW_LIN...
Print inventory_diary
625941e2eab8aa0e5d26df29
def parse_data(request): <NEW_LINE> <INDENT> uname, passwd, user = basicauth(request) <NEW_LINE> if not user: <NEW_LINE> <INDENT> response = HttpResponse('Unauthorized', status=401, content_type='text/plain') <NEW_LINE> return response <NEW_LINE> <DEDENT> datadict = dict(parse.parse_qsl(request.META['QUERY_STRING'])) <...
Data is in the query string and looks like this: devid=3AFF42&temp=22.1&humidity=42&pressure=1013.4
625941e2e76e3b2f99f3abd6
def _keepalive(self): <NEW_LINE> <INDENT> fcntl.ioctl(self.watchdog, WDIOC_KEEPALIVE)
Keep alive watchdog timer
625941e2cad5886f8bd273a9
def get(self, sid): <NEW_LINE> <INDENT> return WebhookContext(self._version, conversation_sid=self._solution['conversation_sid'], sid=sid, )
Constructs a WebhookContext :param sid: A 34 character string that uniquely identifies this resource. :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookContext :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext
625941e256ac1b37e6264598