code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def glGetTexImage(target: int, level: int, format: int, type: int, pixels: 'Buffer'): <NEW_LINE> <INDENT> pass
Return a texture image :param target: Specifies which texture is to be obtained. :type target: int :param level: Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level n is the nth mipmap reduction image. :type level: int :param format: Specifies a pixel format for the ret...
625941c716aa5153ce3624b8
def SMER(mode, d1, d2): <NEW_LINE> <INDENT> if mode == 1: <NEW_LINE> <INDENT> d3 = 6378388 <NEW_LINE> d4 = 0.0033670033670033669 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> d3 = 6378137 <NEW_LINE> d4 = 0.0033528106647429845 <NEW_LINE> <DEDENT> d5 = 2.0 * d4 - pow(d4, 2); <NEW_LINE> d6 = 1.0 + 0.75 * d5 ...
* @param int mode * @param float $d1 * @param float $d2
625941c71f5feb6acb0c4b91
def __init__(self,parent=None): <NEW_LINE> <INDENT> super(MScene,self).__init__(parent) <NEW_LINE> self.colorMap = MB.ColorMap() <NEW_LINE> self.mandelbrotImage = MB.MandelbrotImage() <NEW_LINE> self.generateImage()
Constructor.
625941c726238365f5f0eeac
def get_model(self): <NEW_LINE> <INDENT> if self.model_opt['finetune']: <NEW_LINE> <INDENT> self.model_opt['base_learn_rate'] = self.new_model_opt['base_learn_rate'] <NEW_LINE> self.model_opt['knob_box_offset'] = self.new_model_opt['knob_box_offset'] <NEW_LINE> self.model_opt['knob_segm_offset'] = self.new_model_opt[ '...
Model router.
625941c7e5267d203edcdcde
def build_param(self, key): <NEW_LINE> <INDENT> return self._build_params[key]
Return building parameter.
625941c7eab8aa0e5d26db98
def vline(self, value): <NEW_LINE> <INDENT> self.ax.axvline(value, linestyle='--', zorder=9)
功能:画垂直线 :param value: :return:
625941c755399d3f055886f3
def dialogue(self, input): <NEW_LINE> <INDENT> self.emotion.update(input) <NEW_LINE> parts = analyze(input) <NEW_LINE> x = random.randint(1,100) <NEW_LINE> if x <= 30: <NEW_LINE> <INDENT> self.responder = self.res_pattern <NEW_LINE> <DEDENT> elif 31 <= x <= 50: <NEW_LINE> <INDENT> self.responder = self.resp_template <N...
応答オブジェクトのresponse()を呼び出して 応答文字列を取得 inputはユーザーに入力された文字列
625941c7d486a94d0b98e185
def https_open(self, req): <NEW_LINE> <INDENT> return self.do_open(self.get_connection, req)
Rather than pass in a reference to a connection class, we pass in a reference to a function which, for all intents and purposes, will behave as a constructor
625941c76e29344779a62653
def __new__(cls, type, shape, name): <NEW_LINE> <INDENT> shape = tuple(shape) <NEW_LINE> assert isinstance(type, tf.DType), type <NEW_LINE> if any(k in name for k in [':', '/', ' ']): <NEW_LINE> <INDENT> raise ValueError("Invalid InputDesc name: '{}'".format(name)) <NEW_LINE> <DEDENT> self = super(InputDesc, cls).__new...
Args: type (tf.DType): shape (tuple): name (str):
625941c763f4b57ef000115c
def FindWrapper(handle): <NEW_LINE> <INDENT> class_name = handleprops.classname(handle) <NEW_LINE> try: <NEW_LINE> <INDENT> return _MetaWrapper.str_wrappers[class_name] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> wrapper_match = None <NEW_LINE> for regex, wrapper in list(_MetaWrapper.re_wrappers.items()): ...
Find the correct wrapper for this handle
625941c78a349b6b435e81b3
def list_by_virtual_wan( self, resource_group_name, virtual_wan_name, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_vers...
Retrieves all P2SVpnServerConfigurations for a particular VirtualWan. :param resource_group_name: The resource group name of the VirtualWan. :type resource_group_name: str :param virtual_wan_name: The name of the VirtualWan. :type virtual_wan_name: str :keyword callable cls: A custom type or function that will be pass...
625941c7d6c5a1020814408a
def set_blocks(self, blocks): <NEW_LINE> <INDENT> if len(blocks) > self.phrase_length: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> self.blocks = blocks <NEW_LINE> return 0
Set the blocks to be the given blocks. If length of the blocks exceeds the phrase length, return 0 and do not update the blocks.
625941c715fb5d323cde0b4e
def get_iscc_exe(): <NEW_LINE> <INDENT> localdir = osp.join(sys.prefix, os.pardir, os.pardir) <NEW_LINE> for drive in get_drives(): <NEW_LINE> <INDENT> for dirname in ( r'C:\Program Files', r'C:\Program Files (x86)', osp.join(localdir, 'Inno Setup 5'), ): <NEW_LINE> <INDENT> for subdirname in ('.', 'App'): <NEW_LINE> <...
Return ISCC executable
625941c7f8510a7c17cf973c
def py_cpu_nms(dets, thresh): <NEW_LINE> <INDENT> x1 = dets[:, 0] <NEW_LINE> y1 = dets[:, 1] <NEW_LINE> x2 = dets[:, 2] <NEW_LINE> y2 = dets[:, 3] <NEW_LINE> scores = dets[:, 4] <NEW_LINE> areas = (x2 - x1 + 1) * (y2 - y1 + 1) <NEW_LINE> order = scores.argsort()[::-1] <NEW_LINE> keep = [] <NEW_LINE> while order.size > ...
Pure Python NMS baseline.
625941c7d53ae8145f87a2b2
def population(self, id_): <NEW_LINE> <INDENT> metadata, = self._ll_tree_sequence.get_population(id_) <NEW_LINE> return Population(id_=id_, metadata=metadata)
Returns the :ref:`population <sec_population_table_definition>` in this tree sequence with the specified ID. :rtype: :class:`.Population`
625941c78da39b475bd64fb2
def after_delay(delay_time, action): <NEW_LINE> <INDENT> THE_AGENDA.add_action(delay_time + THE_AGENDA.current_time, action)
在适当的时间所对应的队列增加action
625941c7379a373c97cfab84
def interactively_update_alert_state( cb: CbThreatHunterAPI, alert_id, state: Union["DISMISSED", "OPEN"] = None, remediation_state: str = None, comment: str = None, ) -> Dict: <NEW_LINE> <INDENT> from cbinterface.helpers import input_with_timeout <NEW_LINE> if not state: <NEW_LINE> <INDENT> state = input_with_timeout("...
Update alert remediation state by ID.
625941c7711fe17d825423ae
def xcorr_fft_1d(a, b, a_ft=False, b_ft=False, shift=True): <NEW_LINE> <INDENT> if a.shape != b.shape: <NEW_LINE> <INDENT> raise ValueError('Both input arrays must have the same shape - got {0} and {1}.'.format(a.shape, b.shape)) <NEW_LINE> <DEDENT> afft = (a if a_ft else np.fft.fft(a)) <NEW_LINE> bfft = (b if b_ft els...
Compute cross-correlation between two 1D arrays of equal shape by using fourier transform (uses convolution theorem with an extra conjugate). Can supply pre-calculated fts of a and/or b. If so, set a_ft and/or b_ft to True
625941c7cdde0d52a9e53072
def gradientDescent(trainData,rate,coefficient): <NEW_LINE> <INDENT> coefficientDemo = coefficient[:] <NEW_LINE> for index, num in enumerate(coefficient): <NEW_LINE> <INDENT> sum = 0 <NEW_LINE> for data in trainData: <NEW_LINE> <INDENT> sum += (hypothesisFunction(data, coefficient) - data[-1]) * data[index] <NEW_LINE>...
梯度下降算法,本函数为一次迭代过程,有梯度下降就有学习率rate :param trainData: :param rate: :param coefficient: :return:
625941c75166f23b2e1a5199
def link_message(n1, n2, intf_one=None, address_one=None, intf_two=None, address_two=None, key=None): <NEW_LINE> <INDENT> mac_one, mac_two = None, None <NEW_LINE> if address_one: <NEW_LINE> <INDENT> mac_one = MacAddress.random() <NEW_LINE> <DEDENT> if address_two: <NEW_LINE> <INDENT> mac_two = MacAddress.random() <NEW_...
Convenience method for creating link TLV messages. :param int n1: node one id :param int n2: node two id :param int intf_one: node one interface id :param core.misc.ipaddress.IpAddress address_one: node one ip4 address :param int intf_two: node two interface id :param core.misc.ipaddress.IpAddress address_two: node tw...
625941c7a05bb46b383ec863
@manager.command <NEW_LINE> def run(): <NEW_LINE> <INDENT> app.flask.run(host="0.0.0.0", port=8080, debug=True)
Run the application in dev mode
625941c74f6381625f114a7c
def generate_unique_id(digits, queryset, queryset_attr='id'): <NEW_LINE> <INDENT> value = generate_numeric_id(digits) <NEW_LINE> attempts = 1 <NEW_LINE> while queryset.filter(**{queryset_attr: value}).exists(): <NEW_LINE> <INDENT> if attempts == settings.ID_GENERATION_ATTEMPTS_NOTICE: <NEW_LINE> <INDENT> logger.info( '...
Generate a unique ID for a given queryset. The provided ID is guaranteed to be unique for the provided queryset. warning .. There is still a race condition between when the value is returned from the function and when it is saved to an instance. Args: digits: The number of digits in the returned...
625941c74f6381625f114a7b
def check_blocks_obj_id(self): <NEW_LINE> <INDENT> log.info('Checking blocks (referenced objects)...') <NEW_LINE> for (block_id, obj_id) in self.conn.query('SELECT blocks.id, obj_id FROM blocks LEFT JOIN objects ' 'ON obj_id = objects.id WHERE objects.id IS NULL'): <NEW_LINE> <INDENT> self.found_errors = True <NEW_LINE...
Check blocks.obj_id
625941c7adb09d7d5db6c7d0
def execute_stop_autosample(self, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedException('execute_stop_autosample() not implemented.')
Leave autosample mode. @param timeout=timeout Optional command timeout. @raises InstrumentTimeoutException if could not wake device or no response. @raises InstrumentProtocolException if stop command not recognized. @raises InstrumentStateException if command not allowed in current state. @raises NotImplemented...
625941c7091ae35668666fa0
def check_status_value(self,match): <NEW_LINE> <INDENT> self.log_info_message("Inside check_status_value()",self.file_name) <NEW_LINE> if match: <NEW_LINE> <INDENT> return 'completed' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 'notcompleted'
return completed or notcompleted
625941c791f36d47f21ac532
def run_type_word(run): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return detector_state.get_run_state(run)['run_type'] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return "-"
Get the run start time using the detector state db :param int run: :returns str: "-" if not found
625941c7baa26c4b54cb1161
def set_param_val( param_val, param_key, kv_sep=PARAM_KEY_VAL_SEP, case='lower'): <NEW_LINE> <INDENT> if case == 'lower': <NEW_LINE> <INDENT> param_key = param_key.lower() <NEW_LINE> <DEDENT> elif case == 'upper': <NEW_LINE> <INDENT> param_key = param_key.upper() <NEW_LINE> <DEDENT> if param_val is not None: <NEW_LINE>...
Extract numerical value from string information. This expects an appropriate string, as retrieved by parse_filename(). Args: param_val (int|float|None): The value of the parameter. param_key (str): The string containing the label of the parameter. kv_sep (str): String separating key from value in parameter...
625941c74e4d5625662d4419
def adapts(*interfaces): <NEW_LINE> <INDENT> pass
Declare that a class adapts the given interfaces. This function can only be used in a class definition. (TODO, allow classes to be passed as well as interfaces.)
625941c7a8ecb033257d310e
def test_signup_duplicated_email(self): <NEW_LINE> <INDENT> data1 = { 'screen_name': 'Taro YAMADA', 'username': 't_yamada', 'password1': 'password', 'password2': 'password', 'email': 'test@ryu22e.org', } <NEW_LINE> r = self.client.post('/accounts/signup/', data1) <NEW_LINE> self.assertRedirects(r, '/') <NEW_LINE> u = U...
Tests that duplicated email is not accepted.
625941c77c178a314d6ef49e
def _fn(dtype, shape, name, trainable, add_variable_fn): <NEW_LINE> <INDENT> loc, scale = loc_scale_fn(dtype, shape, name, trainable, add_variable_fn) <NEW_LINE> if scale is None: <NEW_LINE> <INDENT> dist = tfd.Deterministic(loc=loc) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dist = tfd.Normal(loc=loc, scale=scale) ...
Creates multivariate `Deterministic` or `Normal` distribution. Args: dtype: Type of parameter's event. shape: Python `list`-like representing the parameter's event shape. name: Python `str` name prepended to any created (or existing) `tf.Variable`s. trainable: Python `bool` indicating all created `tf.Varia...
625941c7d268445f265b4eae
def add(self, val, abs_par=None, rel_par=None, dist_par=None, point=None, recompute=True): <NEW_LINE> <INDENT> par = self._get_real_param(abs_par, rel_par, dist_par, point) <NEW_LINE> self._pts.append(FreeCAD.Vector(par, val, 0.0)) <NEW_LINE> self._pts = sorted(self._pts, key=itemgetter(0)) <NEW_LINE> if recompute: <NE...
Add a value on the edge at the given parameter. Input: - val : float value - abs_par : the real parameter - rel_par : the normalized parameter in [0.0, 1.0] - dist_par : the distance from start (if positive) or end (if negative) - recompute : if True(default), recompute the interpolating curve
625941c7498bea3a759b9af0
def scanBack(self, startDate): <NEW_LINE> <INDENT> raise NotImplementedError()
Не реализовано: выбрасывает C{NotImplementedError}
625941c7a4f1c619b28b007c
def fibonacci(n): <NEW_LINE> <INDENT> tmp = '1' <NEW_LINE> r = n <NEW_LINE> idx = fibonacci_index(n) <NEW_LINE> F_idx = fibonacci_number(idx) <NEW_LINE> F_idx_1 = fibonacci_number(idx+1) <NEW_LINE> if F_idx_1 <= n: <NEW_LINE> <INDENT> r -= F_idx_1 <NEW_LINE> last_idx = idx + 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE...
Return a binary string that rappresent n in fibonacci code. Parameters: n (int): integer to rappresent (must be greater that 0) Returns: str : fibonacci rappresentation of n
625941c7f7d966606f6aa044
def number_labeled_neighbors(self, neighbor_ids): <NEW_LINE> <INDENT> num_neighbors_labeled = (self.labels[neighbor_ids] == True).sum() <NEW_LINE> return (num_neighbors_labeled)
return the number of neighbor_ids that are labeled
625941c7cdde0d52a9e53073
def process_queries(search_index, queries): <NEW_LINE> <INDENT> for line in queries: <NEW_LINE> <INDENT> print(search(search_index, line))
function to process the search queries iterate through all the queries and call the search function print the results returned by search function
625941c757b8e32f524834db
def create_app(): <NEW_LINE> <INDENT> app = Application([WaiterPrep], TNS, in_protocol=Soap11(validator='soft'), out_protocol=Soap11()) <NEW_LINE> return app
Creates an Application object containing the waiter service.
625941c7442bda511e8be45a
def find_common_and_diff_signals(self, group1, group2): <NEW_LINE> <INDENT> if group1 not in self._mapping: <NEW_LINE> <INDENT> raise ValueError("Group %s is not present."%(group1)) <NEW_LINE> <DEDENT> if group2 not in self._mapping: <NEW_LINE> <INDENT> raise ValueError("Group %s is not present."%(group2)) <NEW_LINE> <...
Find the common and different signals between two groups.
625941c730bbd722463cbe05
def update_document(self, document): <NEW_LINE> <INDENT> pass
Update document
625941c773bcbd0ca4b2c0b7
def train_lda_model(self, corpus): <NEW_LINE> <INDENT> print("====================== train lda model =======================") <NEW_LINE> texts = [document.split(" ") for document in corpus] <NEW_LINE> del corpus <NEW_LINE> dictonary = corpora.Dictionary(texts) <NEW_LINE> dictonary.save(self.lda_dict_path) <NEW_LINE> b...
:param corpus: form of corpus: [ "I am good", "How are you", "That's OK" ] :return:
625941c7d268445f265b4eaf
def sync_phone_session(): <NEW_LINE> <INDENT> if not session.get('synced', False): <NEW_LINE> <INDENT> firebase_session = SB.get_phone_session(phone) <NEW_LINE> if firebase_session is None: <NEW_LINE> <INDENT> session['synced'] = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for k, v in firebase_session.items(): <...
all we're doing is pushing the session every time, unless its empty, which means our instance has been reset.
625941c7097d151d1a222e9b
def peri_poly(n, s): <NEW_LINE> <INDENT> perimeter = 0 <NEW_LINE> for sides in range(n): <NEW_LINE> <INDENT> perimeter += s <NEW_LINE> <DEDENT> return perimeter**2
:param n: int number of sides of the polygon :param s: int or float length size of each side in the polygon :return: length of boundary of polygon squared
625941c7236d856c2ad4481a
def get_child_type_choices(self): <NEW_LINE> <INDENT> choices = [] <NEW_LINE> for model, _ in self.get_child_models(): <NEW_LINE> <INDENT> ct = ContentType.objects.get_for_model(model) <NEW_LINE> choices.append((ct.id, model._meta.verbose_name)) <NEW_LINE> <DEDENT> return choices
Return a list of polymorphic types which can be added.
625941c7d10714528d5ffd22
def plot_samples_2d(ax,samples): <NEW_LINE> <INDENT> Y=samples[:,-1] <NEW_LINE> position_p=Y==1 <NEW_LINE> position_m=Y==-1 <NEW_LINE> ax.scatter(samples[position_p,0],samples[position_p,1], marker='+',label='+',color='b') <NEW_LINE> ax.scatter(samples[position_m,0],samples[position_m,1], marker='^',label='-',color='y'...
绘制二维数据集 :param ax: Axes 实例,用于绘制图形 :param samples: 二维数据集 :return: None
625941c72ae34c7f2600d172
def hit_or_stand(deck, hand): <NEW_LINE> <INDENT> global PLAYING <NEW_LINE> player_input = (input("Would you like to Hit or Stand? Enter H or S ")).upper() <NEW_LINE> if player_input == "H": <NEW_LINE> <INDENT> hit(deck, hand) <NEW_LINE> PLAYING = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> PLAYING = False
Prompts player to Hit or Stand Accepts deck and player's hand as argument. Assigns 'playing' as a Global variable. If the player hits, executes the hit() function If the player stands, set the 'playing variable to false
625941c72eb69b55b151c8ee
def nextPermutation(self, nums): <NEW_LINE> <INDENT> i = k = len(nums) - 1 <NEW_LINE> while i > 0 and nums[i-1] >= nums[i]: <NEW_LINE> <INDENT> i -= 1 <NEW_LINE> <DEDENT> j = i <NEW_LINE> while j < k: <NEW_LINE> <INDENT> nums[j], nums[k] = nums[k], nums[j] <NEW_LINE> j += 1; k -= 1 <NEW_LINE> <DEDENT> if i > 0: <NEW_LI...
:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
625941c7596a897236089b03
def test_order_apiNameEN(self): <NEW_LINE> <INDENT> dict_cookies = json.loads(self.redis.str_get("str_cookies"), encoding="utf8") <NEW_LINE> params = PARAMS <NEW_LINE> url = "{{apiHost}}" + "{{apiUrl}}" <NEW_LINE> caseHeaders = headers <NEW_LINE> resp = requests.get(url=url, params=params, headers=caseHeaders, cookies=...
{{caseDesc}}<br/>{{apiHost}}{{apiUrl}}<br/>
625941c7596a897236089b02
def test_decorated_init(self): <NEW_LINE> <INDENT> dec_init = DecoratedInitClass(mode="o") <NEW_LINE> self.assertEqual(dec_init.get_mode(), OUT) <NEW_LINE> dec_init = DecoratedInitClass() <NEW_LINE> self.assertEqual(dec_init.get_mode(), DEFAULT)
decorator_generator should work with __init__ method
625941c7be8e80087fb20c85
def test_put_organization_support_information(self): <NEW_LINE> <INDENT> pass
Test case for put_organization_support_information Update support information of organization
625941c7379a373c97cfab85
def main(): <NEW_LINE> <INDENT> config = Config() <NEW_LINE> headers = {'Accept': 'application/json', 'Version': '1.0'} <NEW_LINE> if config.has_config_value('auth_token'): <NEW_LINE> <INDENT> headers['SEC'] = config.get_config_value('auth_token') <NEW_LINE> <DEDENT> elif (config.has_config_value('username') and config...
The entry point for the sample.
625941c7851cf427c661a551
def code_reviewer_config(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.project_config()['code_reviewer'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.project_config()['codeReviewer'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise click.C...
Return the code reviewer configuration if one exists. Raises: click.ClickException: if no code review configuration is present.
625941c7d164cc6175782d8e
def test_false_explicit(self): <NEW_LINE> <INDENT> command = shutil.which('false') <NEW_LINE> operation = commandline.cli(command=[command], shell=False) <NEW_LINE> operation.run() <NEW_LINE> assert operation.output.returncode.result() == 1
Test a command known to produce a return code of 1.
625941c7fb3f5b602dac36d3
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <...
Returns the model properties as a dict
625941c776e4537e8c3516b2
def __call_succeeded(self): <NEW_LINE> <INDENT> self._state = STATE_CLOSED <NEW_LINE> self._failure_count = 0
Close circuit after successful execution and reset failure count
625941c723e79379d52ee5a6
@cache_page(settings.FILE_CACHE_TIMEOUT, cache='file') <NEW_LINE> def media_json_view(request, spatial_context=None): <NEW_LINE> <INDENT> rd = RequestDict() <NEW_LINE> request_dict_json = rd.make_request_dict_json(request, spatial_context) <NEW_LINE> if rd.security_ok is False: <NEW_LINE> <INDENT> template = loader.get...
API for searching Open Context, media only
625941c799cbb53fe6792c28
def user_permissions(): <NEW_LINE> <INDENT> user_permissions = [ "read_user", "read_restaurant", ] <NEW_LINE> return [get_permission(item) for item in user_permissions]
Return list of user's permissions.
625941c7c432627299f04c86
def searchMatrix(self, matrix, target): <NEW_LINE> <INDENT> row = len(matrix) - 1 <NEW_LINE> col = 0 <NEW_LINE> while 0 <= row < len(matrix) and 0 <= col < len(matrix[0]): <NEW_LINE> <INDENT> if matrix[row][col] == target: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif matrix[row][col] > target: <NEW_LINE> <I...
:type matrix: List[List[int]] :type target: int :rtype: bool
625941c7d4950a0f3b08c391
def setUp(self): <NEW_LINE> <INDENT> super(EditProfileViewTest, self).setUp() <NEW_LINE> self.profile = self.F.ProfileFactory.create() <NEW_LINE> self.add_perm("manage_environments")
Setup for edit-profile; create a profile, give user permission.
625941c797e22403b379cfdb
def flush(self): <NEW_LINE> <INDENT> for connection in self._connection_list: <NEW_LINE> <INDENT> self.delprefix(keys=[], args=[self.prefix + "*"], client=connection) <NEW_LINE> self.delprefix(keys=[], args=[self.stats_prefix + "*"], client=connection)
Deletes all messages and groups on all shards.
625941c721a7993f00bc7d2f
def t_symbol(t): <NEW_LINE> <INDENT> t.value = Symbol(t.value) <NEW_LINE> return t
[^ \t\r\n\#\:\;\<\>\/\.\(\)\[\]\{\}]+
625941c70383005118ecf624
def sigmoid(x): <NEW_LINE> <INDENT> return call_pure_intrin(x.dtype, "sigmoid", x)
Quick function to get sigmoid Parameters ---------- x : Expr Input argument. Returns ------- y : Expr The result.
625941c73c8af77a43ae37e0
def _normalize_sparse_corpus(corpus, matrix, normalization): <NEW_LINE> <INDENT> if not normalization: <NEW_LINE> <INDENT> return corpus <NEW_LINE> <DEDENT> corpus_norm = corpus.T.dot(matrix).multiply(corpus.T).sum(axis=1).T <NEW_LINE> assert corpus_norm.min() >= 0.0, NON_NEGATIVE_NORM_ASSERTION_MESSAGE <NEW_LINE> if n...
Normalize a sparse corpus after a change of basis. Parameters ---------- corpus : MxN :class:`scipy.sparse.csc_matrix` A sparse corpus. matrix : NxN :class:`scipy.sparse.csc_matrix` A change-of-basis matrix. normalization : {True, False, 'maintain'} Whether the vector will be L2-normalized (True; correspon...
625941c767a9b606de4a7efc
def test_create(self): <NEW_LINE> <INDENT> with self.assertRaises(ValidationError): <NEW_LINE> <INDENT> self.env['good_process.process'].create({ 'model_id': self.env.ref('buy.model_buy_order').id, }) <NEW_LINE> <DEDENT> with self.assertRaises(ValidationError): <NEW_LINE> <INDENT> self.env['good_process.process'].creat...
新建审批配置规则,如果配置的模型有type字段而规则未输入type,保存时给出提示
625941c7dc8b845886cb5576
def rapmap_quasi_paired(job, config, name, samples, flags): <NEW_LINE> <INDENT> output = "{}.rapmap.sam".format(name) <NEW_LINE> logfile = "{}.rapmap_quasi.log".format(name) <NEW_LINE> command = ["{} quasimap".format(config['rapmap']['bin']), "-t {}".format(config['rapmap']['num_cores']), "-i {}".format(config['rapmap'...
Run RapMap Quasi-Mapping procedure on paired-end sequencing data :param config: The configuration dictionary. :type config: dict. :param name: sample name. :type name: str. :param samples: The samples info and config dictionary. :type samples: dict. :returns: str -- The output vcf file name.
625941c7099cdd3c635f0c9d
def pixel_at(self, row, col): <NEW_LINE> <INDENT> return self.run_native("pixel_at", row, col)
Returns the color of the pixel at the coordinates specified. Images with different pixel orders will behave differently: RGBA: returns the color as it is RGB: returns the color with a 1 alpha channel MASK: sets all the three rgb components with the single byte value
625941c79c8ee82313fbb7b6
def setPreeditArea(self, p_int, QString): <NEW_LINE> <INDENT> pass
QTextLayout.setPreeditArea(int, QString)
625941c7ff9c53063f47c235
def py27(d): <NEW_LINE> <INDENT> for k, v in d.items(): <NEW_LINE> <INDENT> if isinstance(v, str): <NEW_LINE> <INDENT> d[k] = {'dependency': v} <NEW_LINE> d[k].setdefault('versions', {Version('2.7')}) <NEW_LINE> <DEDENT> <DEDENT> return d
Mark all pydist entries as being for Python 2.7
625941c76fb2d068a760f0dd
def __fetch_all(self): <NEW_LINE> <INDENT> self.__fetch_dimensions() <NEW_LINE> self.__fetch_cubes() <NEW_LINE> self.__fetch_rules() <NEW_LINE> self.__fetch_processes()
creates all server objects
625941c707f4c71912b114c3
def fit_model(model, train_data, steps): <NEW_LINE> <INDENT> model.fit(input_fn=lambda: get_inputs(train_data), steps=steps) <NEW_LINE> print("\nModel trained after %s steps." % steps)
Fit model with custom input function
625941c7b830903b967e994d
def pc_input_buffers_full_var(self, *args): <NEW_LINE> <INDENT> return _filter_swig.pfb_interpolator_ccf_sptr_pc_input_buffers_full_var(self, *args)
pc_input_buffers_full_var(pfb_interpolator_ccf_sptr self, int which) -> float pc_input_buffers_full_var(pfb_interpolator_ccf_sptr self) -> pmt_vector_float
625941c7fff4ab517eb2f47d
def test_technical_disclosure_scheme_approval(self): <NEW_LINE> <INDENT> t = technicalDisclosureSchemeView() <NEW_LINE> data = { 'approval_type': 1, 'sub_project_id': 6, 'plan_code': 'RJYGY-JSJDFA-15-00015', 'contract_name': '软件园公寓', 'building_num': '软三b区', 'plan_start_time': '2020-03-06', 'plan_end_time': '2020-03-28'...
测试技术交底与方案待审核接口
625941c79b70327d1c4e0e16
def write_table(self, table, filename, keyword, gen_schema=True, ds_type=None, **kwargs): <NEW_LINE> <INDENT> file_path = os.path.join(self.directories[keyword], filename + '.csv') <NEW_LINE> table.to_csv(file_path, encoding='utf-8', **kwargs) <NEW_LINE> if gen_schema: <NEW_LINE> <INDENT> unique_values = [] <NEW_LINE> ...
write data table :param table: dataframe :param filename: file name :param keyword: directory name :param gen_schema: True[Generate schema], False[No generate schema] :param ds_type: data type :param kwargs: multiple keyword arguments in pandas :return: None
625941c7167d2b6e31218bd7
def PR2_Correct6BDac(self, idif, iasic, cor): <NEW_LINE> <INDENT> for a in self.asiclist: <NEW_LINE> <INDENT> if (idif != 0 and a["dif"] != idif): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if (iasic != 0 and a["num"] != iasic): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> print(a["sl...
Correct the 6BDAC value of specified asics, modified asics are tagged for upload :param idif: DIF_ID (IP>>16), if 0 all FEBs are changed :param iasic: asic number, if 0 all Asics are changed :param cor: A 32 channels array of corrections to be applied on the 6BDAC values of all channels
625941c7090684286d50ed26
def __init__(self, model: Model = None, x: np.ndarray = None, y: np.ndarray = None, y_fit: np.ndarray = None, error_vector: np.ndarray = None, rms: float = None): <NEW_LINE> <INDENT> self.model = model <NEW_LINE> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.y_fit = y_fit <NEW_LINE> self.error_vector = error_vector ...
The data class storage contains model object, error vector, rms and outlier object
625941c7eab8aa0e5d26db99
def pl_lpar(self, par): <NEW_LINE> <INDENT> assert par == "(" <NEW_LINE> self.stack.append(self.preq) <NEW_LINE> self.preq = None
Called in a package requirements list, when lparens are found
625941c771ff763f4b5496cb
@njit(parallel=True) <NEW_LINE> def rho(m): <NEW_LINE> <INDENT> r = m-m0 <NEW_LINE> rho=1*np.e**(-1/2*r.T@np.linalg.inv(C_rho)@r ) <NEW_LINE> return(rho)
Parameters ---------- m : Our model (array) Returns ------- The a priori probability density rho. When the residual (m-m0) ->0, rho->1 and when (m-m0) -> inf, rho->0.
625941c7c432627299f04c87
def _generate_route_signature( self, route, namespace, route_args, extra_args, doc_list, task_type_name, func_suffix): <NEW_LINE> <INDENT> for name, _, typ in extra_args: <NEW_LINE> <INDENT> route_args.append((name, typ)) <NEW_LINE> <DEDENT> deprecated = 'DEPRECATED: ' if route.deprecated else '' <NEW_LINE> func_name =...
Generates route method signature for the given route.
625941c7f8510a7c17cf973d
def _sequence_loss(self, logits, targets, weights, name): <NEW_LINE> <INDENT> with ops.op_scope(logits + targets + weights, name): <NEW_LINE> <INDENT> cost = math_ops.reduce_sum(self._sequence_loss_per_sample(logits, targets, weights)) <NEW_LINE> batch_size = array_ops.shape(targets[0])[0] <NEW_LINE> return cost / math...
TODO(nh2tran): docstring. Weighted cross-entropy loss for a sequence of logits, batch-collapsed. Args: logits: List of 2D Tensors of shape [batch_size x num_decoder_symbols]. targets: List of 1D batch-sized int32 Tensors of the same length as logits. weights: List of 1D batch-sized float-Tensors of the same leng...
625941c73d592f4c4ed1d0b2
def on_gradeDistribution_clicked(self, widget): <NEW_LINE> <INDENT> ss = "SELECT DISTINCT cno, AVG(grade) FROM SC GROUP BY cno;" <NEW_LINE> cursor.execute(ss) <NEW_LINE> results = cursor.fetchall() <NEW_LINE> n = len(results) <NEW_LINE> d = {} <NEW_LINE> for row in results: <NEW_LINE> <INDENT> d[row[0]] = float(row[1])...
picture everyCourse avgGrade
625941c707d97122c41788cb
def iterate_container_objects(self, container): <NEW_LINE> <INDENT> params = {'restype': 'container', 'comp': 'list', 'maxresults': RESPONSES_PER_REQUEST, 'include': 'metadata'} <NEW_LINE> container_path = self._get_container_path(container) <NEW_LINE> while True: <NEW_LINE> <INDENT> response = self.connection.request(...
@inherits: :class:`StorageDriver.iterate_container_objects`
625941c7e5267d203edcdce0
def new_tile(self): <NEW_LINE> <INDENT> index_row = randint(0,self._grid_height - 1) <NEW_LINE> index_col = randint(0,self._grid_width - 1) <NEW_LINE> current_cell = self._grid[index_row][index_col] <NEW_LINE> if current_cell == 0: <NEW_LINE> <INDENT> two_or_four = randint(1,10) <NEW_LINE> if two_or_four != 10: <NEW_LI...
Create a new tile in a randomly selected empty square. The tile should be 2 90% of the time and 4 10% of the time.
625941c726238365f5f0eeaf
def test_library_photos(self): <NEW_LINE> <INDENT> for session in self.users_sessions: <NEW_LINE> <INDENT> response = session['lib_response'] <NEW_LINE> user = session['user'] <NEW_LINE> ctx_user = user_from_response(response) <NEW_LINE> for photo in user.photos.all(): <NEW_LINE> <INDENT> self.assertIn(photo, ctx_user....
Test that all of user's album's titles display in library.
625941c70a366e3fb873e85b
def retrieve_past_timestamps(ref_timestamp, streams_stamps, prev_timestamp=0): <NEW_LINE> <INDENT> closest_previous_index = 0 <NEW_LINE> previous_stamps = {} <NEW_LINE> diff = sys.maxsize <NEW_LINE> for index in streams_stamps: <NEW_LINE> <INDENT> if (streams_stamps[index] > prev_timestamp) and (streams_stamps[index] <...
get timestamps between two annotated frames. Parameters ---------- ref_timestamp : The timestamp of the annotated image. streams_stamps : Timestamps dict of the whole sequence prev_timestamp : The timestamp of the previously annotated image. Returns ------- dict: The timestamps of the frames in between the ...
625941c71f037a2d8b946240
def parse_date_from_filename(filename): <NEW_LINE> <INDENT> filename = os.path.basename(filename) <NEW_LINE> date = None <NEW_LINE> date_str = filename[9:16] <NEW_LINE> try: <NEW_LINE> <INDENT> date = dt.strptime(date_str, '%Y%j') <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> logger.debug('File {f} could not be parse...
Tries to extract date from a filename for common image filenames Should work for: - Landsat Args: filename (str): filename to extract from Returns: date_str (datetime): datetime object for file if parsed, else None
625941c76e29344779a62655
def get_all_hosts(root): <NEW_LINE> <INDENT> return root.findall('host')
Searches root for all hosts, returns list.
625941c7e1aae11d1e749cf8
def format_filename(fname): <NEW_LINE> <INDENT> return ''.join(convert_valid(one_char) for one_char in fname)
Convert fname into a safe string for a file name. Return: string
625941c792d797404e3041cb
def test_main(): <NEW_LINE> <INDENT> assert check(["echo"]).stdout == "\n" <NEW_LINE> assert check(["echo", "a", "b", "c", "d"]).stdout == "a b c d\n" <NEW_LINE> assert check(["echo", "owo"]).stdout == "owo\n" <NEW_LINE> assert check(["echo", "owo\\nuwu"]).stdout == "owo\\nuwu\n"
Echo should print all arguments, no matter what.
625941c73346ee7daa2b2dad
def on_windowOptions_window_state_event(self, widget, event, *args): <NEW_LINE> <INDENT> settings.set('maximized', ((int(event.new_window_state) & Gdk.WindowState.ICONIFIED) != Gdk.WindowState.ICONIFIED) and ((int(event.new_window_state) & Gdk.WindowState.MAXIMIZED) == Gdk.WindowState.MAXIMIZED) ) <NEW_LINE> self.save_...
Handler for windowOptions.window-state-event.
625941c732920d7e50b28211
def __setattr__(self, name, value): <NEW_LINE> <INDENT> field = self.__class__.__dict__[name] <NEW_LINE> field.validate(value) <NEW_LINE> self.__dict__[name] = value
Sets attribute of the object with the validation.
625941c7a934411ee37516d5
def set_isems(name, items): <NEW_LINE> <INDENT> pass
Sets a finite value selection control (ex. list or combo box) selectable items.
625941c74c3428357757c36a
def backspace_changed(self, settings, key, user_data): <NEW_LINE> <INDENT> terminal = self.guake.notebook_manager.get_terminal_by_uuid(user_data.get('terminal_uuid')) if user_data else None <NEW_LINE> terminals = (terminal, ) if terminal else self.guake.notebook_manager.iter_terminals() <NEW_LINE> for i in t...
If the gconf var compat_backspace be changed, this method will be called and will change the binding configuration in all terminals open.
625941c7627d3e7fe0d68e91
def __init__(self, n_=5000000, min_a_=-28, max_a_=28, trace_=False): <NEW_LINE> <INDENT> this = _math.new_LogSumApprox(n_, min_a_, max_a_, trace_) <NEW_LINE> try: <NEW_LINE> <INDENT> self.this.append(this) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> self.this = this
__init__(self, n_=5000000, min_a_=-28, max_a_=28, trace_=False) -> LogSumApprox
625941c723849d37ff7b30d2
@app.route('/remove_favorite/<user_id>/<recipe_id>') <NEW_LINE> def remove_favorite(user_id, recipe_id): <NEW_LINE> <INDENT> user = None <NEW_LINE> current_favorites = None <NEW_LINE> try: <NEW_LINE> <INDENT> user = DB_USERS.find_one({'_id': ObjectId(user_id)}) <NEW_LINE> current_favorites = user['favorites'] <NEW_LINE...
Removes the recipe from the users favorites list in the users profile :return Redirect to profile view with updated favorites list
625941c792d797404e3041cc
def __init__(self, acq, data, posterior, **kwargs): <NEW_LINE> <INDENT> self.acq = acq <NEW_LINE> self.posterior = posterior <NEW_LINE> self.kwargs = kwargs <NEW_LINE> self.save_dir = self.kwargs.pop('save_dir', None) <NEW_LINE> train_idx, unlabeled_idx = data.index['train'], data.index['unlabeled'] <NEW_LINE> self.X_t...
Base class for constructing active learning batches. :param acq: (function) Acquisition function. :param data: (ActiveLearningDataset) Dataset. :param posterior: (function) Function to compute posterior mean and covariance. :param kwargs: (dict) Additional arguments.
625941c7ec188e330fd5a7e3
def get_project_tree(self, cloud_pk, id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> return self.get_project_tree_with_http_info(cloud_pk, id, **kwargs)
Retrieve the complete DMS tree # noqa: E501 Retrieve the complete DMS tree (all folders and all documents in the project). DEPRECATED: renamed to getProjectDMSTree # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.g...
625941c7711fe17d825423b0
def create_token(result_type, app_secret_key, udid, verify_date, transaction_id): <NEW_LINE> <INDENT> import struct <NEW_LINE> check_hash_code = generate_hash_code(app_secret_key, udid, verify_date, transaction_id) <NEW_LINE> token_format = '!4s20sH{0}s14s{1}s'.format(len(udid), len(transaction_id)) <NEW_LINE> final_da...
create sha1 token return data length format : result:4 + token:20 + udid_len:2 + udid:udid_len + verify_time:14 + transaction_id_len:2 transaction_id:t...
625941c77cff6e4e811179c8
def forward(self, input, rois): <NEW_LINE> <INDENT> return roi_pool(input.float(), rois.float(), self.output_size, self.spatial_scale)
:param input: the input features [B C H W] :param rois: [k, 5] : (im_index, x1, y1, x2, y2) :return: pooled features (K C H W), K = k
625941c7377c676e912721eb
def testUpdateProfileUser(self): <NEW_LINE> <INDENT> pass
Test UpdateProfileUser
625941c7a17c0f6771cbe094
def testConsistency(self): <NEW_LINE> <INDENT> tolerance = 1.0e-8 <NEW_LINE> atm_rate = self.cds_option.atmRate() <NEW_LINE> buyer_cds = QLECreditDefaultSwap(Protection.Buyer, self.notional, self.upfront, atm_rate, self.schedule, self.bdc, self.day_counter, self.settles_accrual, self.protection_payment_time, self.settl...
Test consistency of fair price and NPV()
625941c75166f23b2e1a519b
def individually_most_likely_states(X, pi, A, B): <NEW_LINE> <INDENT> Z = np.empty((X.shape[0], X.shape[1]), dtype=np.int) <NEW_LINE> for i in range(X.shape[0]): <NEW_LINE> <INDENT> x = X[i,:] <NEW_LINE> alpha = forward(x, pi, A, B) <NEW_LINE> beta = backward(x, pi, A, B) <NEW_LINE> p_x = np.sum(alpha[alpha.shape[0]-1]...
Computes individually most-likely states. By "individually most-likely states," we mean that the *marginal* distributions are maximized. In other words, for any particular time step of any particular sequence, each returned state i is chosen to maximize P(z_t = i | x). All sequences in X are assumed to have the same ...
625941c7a05bb46b383ec865
def get_sha1_thumbprint_pfx(pfxfile, passphrase): <NEW_LINE> <INDENT> if pfxfile is None: <NEW_LINE> <INDENT> raise ValueError('pfxfile is invalid') <NEW_LINE> <DEDENT> if passphrase is None: <NEW_LINE> <INDENT> passphrase = getpass.getpass('Enter password for PFX: ') <NEW_LINE> <DEDENT> pfxdump = subprocess.check_outp...
Get SHA1 thumbprint of PFX :param str pfxfile: name of the pfx file :param str passphrase: passphrase for pfx :rtype: str :return: sha1 thumbprint of pfx
625941c794891a1f4081baeb