code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def show(self, window, ground_height): <NEW_LINE> <INDENT> top_left_pos = (self.x - self.size[0] / 2, ground_height - self.size[1]) <NEW_LINE> scaled_image = pygame.transform.scale(self.image, self.size) <NEW_LINE> window.blit(scaled_image, top_left_pos)
Show the hurdle on window at ground_height. Parameters: window (pygame.Surface): surface to show image to ground_height (int): height of ground
625941ed1b99ca400220afde
def on_get(self, req, resp): <NEW_LINE> <INDENT> resp.status = falcon.HTTP_200 <NEW_LINE> dt_avg_in_s = ewma_dt.values <NEW_LINE> if dt_avg_in_s is None: <NEW_LINE> <INDENT> statement = "no traffic means, it's fast enough" <NEW_LINE> <DEDENT> elif dt_avg_in_s * 1000 < 5: <NEW_LINE> <INDENT> statement = "this is fine" <...
Handles GET requests
625941edd486a94d0b98e671
def test_set_lazy_load(self): <NEW_LINE> <INDENT> self.lazy_load_mgr = loader(verbose=self.verbose, recursive=False, lazy_load=True) <NEW_LINE> self.lazy_load_mgr.set_addon_dirs(['./data']) <NEW_LINE> self.lazy_load_mgr.load_addons() <NEW_LINE> self.assertEqual(0, len(self.lazy_load_mgr.get_loaded_addons(list_all=True)...
test to check if lazy_load mode runs as expected. addons are only loaded when they are required.
625941ed8da39b475bd654a5
@action(MessageAction.DROP_DUPLICATED_CONTACT) <NEW_LINE> def drop_duplicated_contact(payload, msg_id): <NEW_LINE> <INDENT> numbers = payload.get('numbers', []) <NEW_LINE> if not numbers: <NEW_LINE> <INDENT> logging.error("no numbers should drop") <NEW_LINE> <DEDENT> query = (TotalContact .objects(Q(src_number__in=numb...
total_count,total_duration去重时,先total_count, 后total_duration :param payload: :param msg_id: :return:
625941edb830903b967e9e2f
def setMinimum(self, minimum): <NEW_LINE> <INDENT> if self._check_nan(float(minimum)): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.__minimum = float(minimum) <NEW_LINE> if self.__minimum > self.value(): <NEW_LINE> <INDENT> self.setValue(self.__minimum)
Setter method to set the minimum value allowed in the SpinBox. Input will be converted to float before being stored. @param minimum: float, the minimum value to be set
625941ede1aae11d1e74a1e7
def _var(self, x: list, y: list): <NEW_LINE> <INDENT> if np.any(np.array(x) == None) or np.any(np.array(y) == None): <NEW_LINE> <INDENT> raise ValueError('List cannot conatin None Value\nx: ' + str(x) +'\ny: ' + str(y)) <NEW_LINE> <DEDENT> X, Y_mean = self._mean(x,y) <NEW_LINE> Y = np.array(copy.copy(X)) <NEW_LINE> for...
Does the same as _mean, but for variance. :param self: :param data: :return:
625941ed82261d6c526ab9d2
def set(self, value, source): <NEW_LINE> <INDENT> if self.active_source is None: <NEW_LINE> <INDENT> log.debug("Read value %r for %s (%s) from %r", value, self.name, self.description, source) <NEW_LINE> self.active_source = source <NEW_LINE> if self.value_is_int: <NEW_LINE> <INDENT> self.value = value <NEW_LINE> try: <...
Set a value of a parameter - unless already set. :param value: value :param source: source; for example "Configuration file /etc/felix.cfg"
625941ed4a966d76dd55153f
def simplify(self): <NEW_LINE> <INDENT> v_shift = self._val_shift <NEW_LINE> new = self.copy() <NEW_LINE> if v_shift > 0: <NEW_LINE> <INDENT> new._vector = (0,) * v_shift + self._vec <NEW_LINE> <DEDENT> return new
Set all elements in self._vector to 0 with a bigger index than self._val_shift. >>> monzo0 = Monzo((1, -1), val_border=1) >>> monzo0.val_border = 2 >>> monzo0._vector (1, -1) >>> monzo0_simplified = monzo0.simplify() >>> monzo0._vector (0, -1)
625941ed57b8e32f524839c9
def check_ca(ca_data): <NEW_LINE> <INDENT> errors = [] <NEW_LINE> warnings = ['\nCourse Attendance Data Warnings:\n'] <NEW_LINE> for student in ca_data: <NEW_LINE> <INDENT> if len(student[0]) != 9: <NEW_LINE> <INDENT> errors.append('Student ID Number incorrect length for student ' '{}'.format(student[0])) <NEW_LINE> <D...
Return list of warnings for information in Course Attendance Data file. Checks the Course Attendance data for the required information. Required information that is missing causes an error file to be saved and the program to exit. Missing or incorrect information that is non-fatal is appended to a warnings list and...
625941edd58c6744b4258188
def __init__(self, rotation,sfall_main, N, mosaic_domains=25, mosaic_spread_deg=0.05, SEED=1, randomize=False): <NEW_LINE> <INDENT> UMAT_nm = flex.mat3_double() <NEW_LINE> mersenne_twister = flex.mersenne_twister(seed=0) <NEW_LINE> scitbx.random.set_random_seed(1234) <NEW_LINE> rand_norm = scitbx.random.normal_distribu...
:param rotation: :param sfall_main: :param N: :param mosaic_domains: :param mosaic_spread_deg: :param SEED: :param randomize:
625941ed009cb60464c638d8
def run(self): <NEW_LINE> <INDENT> self.viewing = True <NEW_LINE> while self.viewing and self._lock.acquire(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> line = self._readline() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logger.info(line) <NEW_LINE> <DEDENT> sel...
Threading callback
625941ed090684286d50f218
def process_child(node): <NEW_LINE> <INDENT> if isinstance(node, sphinx.addnodes.desc_addname): <NEW_LINE> <INDENT> if len(node.children) == 1: <NEW_LINE> <INDENT> child = node.children[0] <NEW_LINE> text = child.astext() <NEW_LINE> if text.startswith("wpilib.") and text.endswith("."): <NEW_LINE> <INDENT> text = ".".jo...
This function changes class references to not have the intermediate module name by hacking at the doctree
625941edf548e778e58cdaab
def doApiRequest(self, method=None, query=None): <NEW_LINE> <INDENT> if not method: <NEW_LINE> <INDENT> raise Exception("doApiRequest needs an method") <NEW_LINE> <DEDENT> url = 'https://api.steampowered.com/' <NEW_LINE> url += method <NEW_LINE> url += ('&' if '?' in url else '?') + 'key={0}'.format(self.__apikey) <NEW...
Sends an direct request for DOTA2's API.
625941ed91f36d47f21aca23
def display(self): <NEW_LINE> <INDENT> print("Seed: ", self._seed) <NEW_LINE> print("Range: ", self._range[0], "-", self._range[1]) <NEW_LINE> print("Size: ", self._size) <NEW_LINE> print("Samples: ", self._samples) <NEW_LINE> print("Measure Type: ", str(self._measureType).replace("MeasureType.","")) <NEW_LINE> print("...
This method prints the parameters specific to the Distribution object
625941ed38b623060ff0b318
def bitperm(s, perm, pos): <NEW_LINE> <INDENT> perm = perm.upper() <NEW_LINE> pos = pos.upper() <NEW_LINE> assert perm in ['R', 'W', 'X'] <NEW_LINE> assert pos in ['USR', 'GRP', 'OTH'] <NEW_LINE> return s.st_mode & getattr(stat, 'S_I{}{}'.format(perm, pos))
Returns zero if there are no permissions for a bit of the perm. of a file. Otherwise it returns a positive value :param os.stat_result s: os.stat(file) object :param str perm: R (Read) or W (Write) or X (eXecute) :param str pos: USR (USeR) or GRP (GRouP) or OTH (OTHer) :return: mask value :rtype: int
625941ed56ac1b37e62646ef
def setViewport(self, *__args): <NEW_LINE> <INDENT> pass
setViewport(self, QRect) setViewport(self, int, int, int, int)
625941eda8370b7717052dc8
def say_goodbye(self): <NEW_LINE> <INDENT> self.display_maze() <NEW_LINE> goodbye = "Thank you for playing with us.\n" <NEW_LINE> show_backpack = f"You have {len(self._backpack)} in your backpack: {','.join(self._backpack)}" <NEW_LINE> print(goodbye + show_backpack)
Template pattern: display end game text. Show the items in backpack Returns: str: a goodbye string and which gift of 4 items the player collected
625941ed2eb69b55b151cde2
def index_queryset(self, using=None): <NEW_LINE> <INDENT> return self.get_model().objects.filter(create_time__lte=datetime.datetime.now())
Used when the entire index for model is updated.
625941ed45492302aab5e7f3
def test_tip_tip_distances_endpoints(self): <NEW_LINE> <INDENT> t = TreeNode.read(StringIO(u'((H:1,G:1):2,(R:0.5,M:0.7):3);')) <NEW_LINE> nodes = [t.find('H'), t.find('G'), t.find('M')] <NEW_LINE> names = ['H', 'G', 'M'] <NEW_LINE> exp = DistanceMatrix(np.array([[0, 2.0, 6.7], [2.0, 0, 6.7], [6.7, 6.7, 0.0]]), ['H', 'G...
Test getting specifc tip distances with tipToTipDistances
625941ed5510c4643540f901
def on_threshold_change(self, val): <NEW_LINE> <INDENT> self.threshold = val
Called when threshold slider is changed
625941ed4e4d5625662d48fb
def get( self, resource_group_name, network_interface_name, tap_configuration_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_...
Get the specified tap configuration on a network interface. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_interface_name: The name of the network interface. :type network_interface_name: str :param tap_configuration_name: The name of the tap configuration. :t...
625941ed0c0af96317bb8712
def proc_txt_mask_word(lines,lv): <NEW_LINE> <INDENT> w_ret=list() <NEW_LINE> wcount=0 <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> line_info=line_to_number_body_pair(line) <NEW_LINE> if is_memory_line(line_info): <NEW_LINE> <INDENT> if FLAG_ANSWER: <NEW_LINE> <INDENT> w_ret.append(line.strip()) <NEW_LINE> <DEDENT...
指定した文字で始まっている単語をマスクする
625941ed45492302aab5e7f4
def uniquePathsWithObstacles(self, obstacleGrid): <NEW_LINE> <INDENT> if len(obstacleGrid) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> dp = [[0 for _ in obstacleGrid[0]] for _ in obstacleGrid] <NEW_LINE> dp[0][0] = 1 if obstacleGrid[0][0] == 0 else 0 <NEW_LINE> for c in range(1, len(obstacleGrid[0])): <NEW_L...
:type obstacleGrid: List[List[int]] :rtype: int
625941ed004d5f362079a85a
def get_whole_height(self): <NEW_LINE> <INDENT> return 800
a tricky way to only return a fixed height, because i just know it
625941edec188e330fd5acbf
@app.route('/online/<ip>', methods=['POST', 'GET']) <NEW_LINE> def is_online(ip): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> target = models.Entry.get(models.Entry.ip == ip) <NEW_LINE> <DEDENT> except models.Entry.DoesNotExist: <NEW_LINE> <INDENT> return 'False' <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> if not tar...
Gets a request for a user and returns if the user is online. Also set's the online status of the user in the db.
625941ed60cbc95b062c6a6e
def stop(self): <NEW_LINE> <INDENT> return _gnuradio_core_gengen.gr_mute_ss_sptr_stop(self)
stop(self) -> bool
625941eda219f33f34628e8d
def store_auth_ref_into_keyring(self, keyring_key): <NEW_LINE> <INDENT> if self.use_keyring: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> keyring.set_password("keystoneclient_auth", keyring_key, pickle.dumps(self.auth_ref)) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> _logger.warning("Failed to store ...
Store auth_ref into keyring.
625941ed6fece00bbac2dc70
def check_con(con): <NEW_LINE> <INDENT> if not con: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> event = con.api('status') <NEW_LINE> return bool(con.connected()) and bool(event)
Raise a connection error if this connection is down.
625941edd6c5a1020814457a
def enqueue_feedback_message_batch_email_task(user_id): <NEW_LINE> <INDENT> taskqueue_services.enqueue_email_task( feconf.TASK_URL_FEEDBACK_MESSAGE_EMAILS, {'user_id': user_id}, feconf.DEFAULT_FEEDBACK_MESSAGE_EMAIL_COUNTDOWN_SECS)
Adds a 'send feedback email' (batch) task into the task queue. Args: user_id: str. The user to be notified.
625941ed31939e2706e4d38d
@config_group.command("get", short_help="Lookup configuration value(s)") <NEW_LINE> @click.argument("section") <NEW_LINE> @click.argument("key", required=False, default=None) <NEW_LINE> @click.pass_obj <NEW_LINE> def get_value(context, section, key, output_format=GET_OUTPUT_FORMAT): <NEW_LINE> <INDENT> section, key = _...
Retrieve the value in a config Will return all values under SECTION if just SECTION is defined, otherwise will just return the value for SECTION.KEY.
625941ed4527f215b584c97d
def write_compressed(text_filename, huff_filename, codes, huff_length): <NEW_LINE> <INDENT> comp_filename = open(huff_filename , "w") <NEW_LINE> text_file = open(text_filename , "r").read() <NEW_LINE> string = '' <NEW_LINE> comp_filename.write(str(len(codes))+' '+str(huff_length)+'\n') <NEW_LINE> for i in codes: <NEW_L...
Write the encoded (compressed) form of the text in 'text_filename' to 'huff_filename'. 'huff_length' is the compressed length of the contents of the text file. 'codes' is the hash that gives the huffman code for each input character Algo: (i) Write the number of distinct input chars and the compressed length in one lin...
625941eda05bb46b383ecd48
def __SetTransform(self, position, angle): <NEW_LINE> <INDENT> return _Box2D.b2Body___SetTransform(self, position, angle)
__SetTransform(b2Body self, b2Vec2 position, float32 angle) Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior. Parameters: ----------- position: the world position of the body's local origin. angl...
625941ed26068e7796caf212
def existing_url(module): <NEW_LINE> <INDENT> url_base = "/axapi/v3/slb/virtual-server/{name}/port/{port-number}+{protocol}/stats?file-inspection=true" <NEW_LINE> f_dict = {} <NEW_LINE> return url_base.format(**f_dict)
Return the URL for an existing resource
625941ed29b78933be1e5bd0
def on_stop(self, *args): <NEW_LINE> <INDENT> pass
on_stop event handler
625941edb7558d58953c5434
def play_edges(possible_moves): <NEW_LINE> <INDENT> edges = [2, 4, 6, 8] <NEW_LINE> available_edges = [] <NEW_LINE> for idx in possible_moves: <NEW_LINE> <INDENT> if idx in edges: <NEW_LINE> <INDENT> available_edges.append(idx) <NEW_LINE> <DEDENT> <DEDENT> if len(available_edges) > 0: <NEW_LINE> <INDENT> return select_...
Check if there is a possible move in list of edge indices [2, 4, 6, 8] If any edge slots are available, make a move into one of them >> play_edges([1, 2, 5]) 2 :param possible_moves: list - empty slots on the board :returns: int - randomly selected position to be occupied
625941ed6aa9bd52df0372d2
def test_create_webhook(): <NEW_LINE> <INDENT> w = Webhook( name='test', endpoint_url='http://test.com/test', active=True ) <NEW_LINE> db.session.add(w) <NEW_LINE> db.session.commit() <NEW_LINE> assert len(Webhook.query.all()) == 1 <NEW_LINE> queried_webhook = Webhook.query.one() <NEW_LINE> assert queried_webhook.name ...
Test creating a webhook
625941ed8a349b6b435e869e
def __exit__(self, exc_type, exc_val, exc_tb): <NEW_LINE> <INDENT> self.unstub()
For compatibility with MegaStub, with-statement
625941ed0c0af96317bb8713
def airmass(zen_dist): <NEW_LINE> <INDENT> zen_dist = abs(np.radians(zen_dist)) if zen_dist <= 85 else np.radians(85) <NEW_LINE> secant_z = 1/np.cos(zen_dist) <NEW_LINE> return secant_z - (0.0018167 * (secant_z-1) + 0.002875 * (secant_z-1)**2 + 0.0008083 * (secant_z-1)**3)
Returns airmass for apparent zenith distance with truncation at > 85 deg zenith. This particular airmass formula can be found on the Wikipedia page on airmasses. :param zen_dist: Zenith distance, degrees :return: Airmass
625941ed4a966d76dd551540
def insert(self, key, value): <NEW_LINE> <INDENT> index = self._hash_mod(key) <NEW_LINE> pair = self.storage[index] <NEW_LINE> if pair is not None: <NEW_LINE> <INDENT> if pair.key != key: <NEW_LINE> <INDENT> print("Warning: value was overwritten.") <NEW_LINE> pair.key = key <NEW_LINE> <DEDENT> pair.value = value <NEW_L...
Store the value with the given key. Part 1: Hash collisions should be handled with an error warning. (Think about and investigate the impact this will have on the tests) Part 2: Change this so that hash collisions are handled with Linked List Chaining.
625941ed15fb5d323cde1043
def add_meta_data(self): <NEW_LINE> <INDENT> self.header += webquiz_templates.html_meta.format( version=self.metadata.version, authors=self.metadata.authors, webquiz_url=self.webquiz_url, description=self.metadata.description, copyright=self.metadata.copyright, department=self.quiz.department, institution=self.quiz.ins...
add the meta data for the web page to self.header
625941edd268445f265b539a
def get_lasttrade_volume(self): <NEW_LINE> <INDENT> print("Getting lasttrade volumes.") <NEW_LINE> assert self.marketorders is not None <NEW_LINE> assert self.orderbook is not None <NEW_LINE> self.orderbook["LastTradeVolume"] = 0 <NEW_LINE> l_tradetime = 0 <NEW_LINE> for cix in self.marketorders.index: <NEW_LINE> <INDE...
Inserts a column into the orderbook which gives at each time step the last traded volume :return:
625941ed5510c4643540f902
def fullmatch(pattern, string): <NEW_LINE> <INDENT> return Regex(pattern).fullmatch(string)
Try to apply the pattern to all of the string, returning true or None if no match was found.
625941ed99cbb53fe6793110
@never_cache <NEW_LINE> def main(request): <NEW_LINE> <INDENT> if request.method == "POST": <NEW_LINE> <INDENT> token = request.POST.get("token") <NEW_LINE> id = request.POST.get("id") <NEW_LINE> if token and id: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> posizione = Posizione.objects.get(pk=id) <NEW_LINE> <DEDENT> e...
Handler della pagina
625941ed30c21e258bdfa9ce
def test_basic(self): <NEW_LINE> <INDENT> request = self.factory.get('/solos/1/') <NEW_LINE> response = SoloDetailView.as_view()( request, pk=self.drum_solo.pk ) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertEqual(response.context_data['solo'].artist, 'Rich') <NEW_LINE> with self.assertTe...
Test that the solo view returns a 200 response, uses the correct template, and has the correct context
625941eddc8b845886cb5a62
def p_LlamadaFuncionA(t): <NEW_LINE> <INDENT> pass
LlamadaFuncionA : Expresion CorreExpresion LlamadaFuncionB | empty
625941edbaa26c4b54cb1645
def vrednost_pozicije(self): <NEW_LINE> <INDENT> vrednost_stirice = { (4, 0): Minimax.ZMAGA, (0, 4): -Minimax.ZMAGA, (3, 0): Minimax.ZMAGA // 100, (0, 3): -Minimax.ZMAGA // 100, (2, 0): Minimax.ZMAGA // 10000, (0, 2): -Minimax.ZMAGA // 10000, (1, 0): Minimax.ZMAGA // 100000, (0, 1): -Minimax.ZMAGA// 100000} <NEW_LINE> ...
Ocena vrednosti pozicije: sešteje vrednosti vseh štiric na plošči.
625941ed99fddb7c1c9de8b9
def register(self, *args): <NEW_LINE> <INDENT> if len(args) == 1 and hasattr(args[0], '__annotations__'): <NEW_LINE> <INDENT> return overload.register(self, *args) <NEW_LINE> <DEDENT> return lambda func: self.__setitem__(args, func) or func
Decorator for registering a function. Optionally call with types to return a decorator for unannotated functions.
625941ed8a43f66fc4b5458b
def _get_instance_parameters(): <NEW_LINE> <INDENT> provider_variables = utils.get_provider_variables() <NEW_LINE> attached_group_ids = utils.get_target_external_resource_ids( constants.INSTANCE_SECURITY_GROUP_RELATIONSHIP, ctx.instance) <NEW_LINE> if provider_variables.get('agents_security_group'): <NEW_LINE> <...
The parameters to the run_instance boto call. :param ctx: The Cloudify ctx context. :returns parameters dictionary
625941ed3d592f4c4ed1d58a
def _convert_dataset(dataset_split): <NEW_LINE> <INDENT> dataset = os.path.basename(dataset_split)[:-4] <NEW_LINE> sys.stdout.write('Processing ' + dataset) <NEW_LINE> filenames = [x.strip('\n') for x in open(dataset_split, 'r')] <NEW_LINE> num_images = len(filenames) <NEW_LINE> num_per_shard = int(math.ceil(num_images...
Converts the specified dataset split to TFRecord format. Args: dataset_split: The dataset split (e.g., train, test). Raises: RuntimeError: If loaded image and label have different shape.
625941ed21a7993f00bc8225
def lock(self, seconds=None): <NEW_LINE> <INDENT> if seconds is None: <NEW_LINE> <INDENT> self.execute(Command.LOCK) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.execute(Command.LOCK, {'seconds': seconds}) <NEW_LINE> <DEDENT> return self
Lock the device. No changes are made if the device is already unlocked. Args: seconds (optional): The duration to lock the device, in seconds. The device is going to be locked forever until `unlock` is called if it equals or is less than zero, otherwise this call blocks until the timeout ex...
625941ed30c21e258bdfa9cf
def testRbf(k1 = 1.3): <NEW_LINE> <INDENT> dataArr,labelArr = loadData('testSetRBF.txt') <NEW_LINE> b,alphas = smoP(dataArr, labelArr, 200, 0.0001, 100, ('rbf', k1)) <NEW_LINE> datMat = np.mat(dataArr); labelMat = np.mat(labelArr).transpose() <NEW_LINE> svInd = np.nonzero(alphas.A > 0)[0] <NEW_LINE> sVs = datMat[svInd]...
测试函数 Parameters: k1 - 使用高斯核函数的时候表示到达率 Returns: 无
625941ed796e427e537b0af6
def patch_authenticate(self, return_value=None): <NEW_LINE> <INDENT> mock_authenticate = mock.MagicMock() <NEW_LINE> mock_authenticate.return_value = return_value <NEW_LINE> return mock.patch( 'automationoauthdrf.authentication.OAuth2TokenAuthentication.authenticate', mock_authenticate )
Patch authentication's authenticate function.
625941ed627d3e7fe0d6937d
def portals_id_designs_nk_tags_fk_put(self, id, nk, fk, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.portals_id_designs_nk_tags_fk_put_with_http_info(id, nk, fk, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data)...
Update a related item by id for tags. 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.portals_id_designs_nk_t...
625941ed2c8b7c6e89b35ce8
def get_king(self, color: Color) -> Piece: <NEW_LINE> <INDENT> for i in range(len(self.chessboard)): <NEW_LINE> <INDENT> for j in range(len(self.chessboard)): <NEW_LINE> <INDENT> field = self.chessboard[i][j] <NEW_LINE> if isinstance(field, King) and field.color == color: <NEW_LINE> <INDENT> return field
Looks for king of given color and returns him. :param color: Color of King to be looked for. :return: king of given color
625941ed8da39b475bd654a6
def __init__(__self__, *, attachments: Optional[pulumi.Input[Sequence[pulumi.Input['FirewallFirewallStatusSyncStateAttachmentArgs']]]] = None, availability_zone: Optional[pulumi.Input[str]] = None): <NEW_LINE> <INDENT> if attachments is not None: <NEW_LINE> <INDENT> pulumi.set(__self__, "attachments", attachments) <NEW...
:param pulumi.Input[Sequence[pulumi.Input['FirewallFirewallStatusSyncStateAttachmentArgs']]] attachments: Nested list describing the attachment status of the firewall's association with a single VPC subnet. :param pulumi.Input[str] availability_zone: The Availability Zone where the subnet is configured.
625941edcdde0d52a9e53563
def _receive(self,msg,cid=None): <NEW_LINE> <INDENT> self.receive(msg,cid)
Internal handler called whenever a packet of this type is received. By default, this method passes its arguments through to :py:meth:`receive()`\ . May be overridden by subclasses to prevent further processing.
625941edaad79263cf390f75
def test_root_rank(self): <NEW_LINE> <INDENT> seach_rank = self.tree.os_rank(self.tree.root) <NEW_LINE> self.assertEqual(seach_rank, self.tree.root.left.size + 1) <NEW_LINE> self.assertEqual(self.tree.root.left.size + self.tree.root.right.size + 1, self.tree.root.size) <NEW_LINE> self.assertEqual(self.tree.root.left.si...
:return:
625941ed23849d37ff7b35b7
def start_job(self, device): <NEW_LINE> <INDENT> devicetypes = { 'date': lambda d: self._start_job_date(d), 'timer': lambda d: self._start_job_timer(d), 'interval': lambda d: self._start_job_interval(d), 'cron': lambda d: self._start_job_cron(d), 'hvac': lambda d: self._start_job_hvac(d), 'alarm': lambda d: self._start...
start a job @param device : the name of the job (=device in xpl)
625941ed8c3a8732951588ed
def __init__(self): <NEW_LINE> <INDENT> self.id = 0; <NEW_LINE> self.wordset = set() <NEW_LINE> self.assoc = {}
initlalise the provider
625941ed99fddb7c1c9de8ba
def complete_items_in_children(self, key_sets=None, item_cache=None): <NEW_LINE> <INDENT> if key_sets is None: <NEW_LINE> <INDENT> item_cache = {} <NEW_LINE> def collect_key_sets(node): <NEW_LINE> <INDENT> item_cache[node] = set((item.key, item.origin) for item in node.items) <NEW_LINE> key_sets = {node.name: item_cach...
Assures that all decendents of this node that have the same node name also have the same item keys. This is interesting for kinds of nodes which don't have a strict set of items. An example are result processes: The user is completely free which items he gives them. This irritates ``build_column_group_list``: It tak...
625941eda17c0f6771cbe57b
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
625941ed31939e2706e4d38e
def check_keydown_events(event, ai_settings, screen, ship, bullets, bullet_sound): <NEW_LINE> <INDENT> if event.key == pygame.K_RIGHT: <NEW_LINE> <INDENT> ship.moving_right = True <NEW_LINE> <DEDENT> if event.key == pygame.K_LEFT: <NEW_LINE> <INDENT> ship.moving_left = True <NEW_LINE> <DEDENT> elif event.key == pygame....
Respond to keypresses
625941ed1b99ca400220afdf
def isConfirmed(self) -> bool: <NEW_LINE> <INDENT> return True
Returns False if the user cancelled the input. :return: true if confirmed, if cancelled false Example:: .. if (kb.isConfirmed()): ..
625941ed3cc13d1c6d3c78a3
def setTextFormatter(self, textFormatter): <NEW_LINE> <INDENT> if textFormatter is None: <NEW_LINE> <INDENT> raise ValueError("Formatter expected but None found") <NEW_LINE> <DEDENT> if self.__formatter is textFormatter: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.__formatter.formatChanged.disconnect(self.__for...
Set the text formatter to be used :param TextFormatter textFormatter: The text formatter to use
625941ed2ae34c7f2600d65c
def _mkdir(self, ds_path, ds_ref): <NEW_LINE> <INDENT> LOG.debug(_("Creating directory with path %s") % ds_path) <NEW_LINE> dc_info = self.get_datacenter_ref_and_name(ds_ref) <NEW_LINE> self._session._call_method(self._session._get_vim(), "MakeDirectory", self._session._get_vim().get_service_content().fileManager, name...
Creates a directory at the path specified. If it is just "NAME", then a directory with this name is created at the topmost level of the DataStore.
625941edbf627c535bc136fb
def get_response_dict(self, helper, context, is_formset): <NEW_LINE> <INDENT> if not isinstance(helper, FormHelper): <NEW_LINE> <INDENT> raise TypeError('helper object provided to {% crispy %} tag must be a crispy.helper.FormHelper object.') <NEW_LINE> <DEDENT> attrs = helper.get_attributes() <NEW_LINE> form_type = "fo...
Returns a dictionary with all the parameters necessary to render the form/formset in a template. :param attrs: Dictionary with the helper's attributes used for rendering the form/formset :param context: `django.template.Context` for the node :param is_formset: Boolean value. If set to True, indicates we are working wi...
625941ed5fcc89381b1e1bef
def gaussian(x, g0, x0, sigma0): <NEW_LINE> <INDENT> gauss = g0*(exp((-(x-x0)*(x-x0))/(2.0*sigma0*sigma0))) <NEW_LINE> return gauss
1D gaussian
625941ede76e3b2f99f3ad2e
def do_all(self, args): <NEW_LINE> <INDENT> list_obj = [] <NEW_LINE> new_obj = storage.all() <NEW_LINE> if args and args not in self.classes: <NEW_LINE> <INDENT> print("** class doesn't exist **") <NEW_LINE> return <NEW_LINE> <DEDENT> if args in self.classes: <NEW_LINE> <INDENT> for key, value in new_obj.items(): <NEW_...
Prints all the str representation of the instances
625941ed711fe17d8254288b
def getSampleData(rows=400, cols=5, namelen=2): <NEW_LINE> <INDENT> if namelen == 1: <NEW_LINE> <INDENT> colnames = list(string.ascii_lowercase[:cols]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> colnames = [genstr(namelen) for i in range(cols)] <NEW_LINE> <DEDENT> if namelen==1 and cols>26: <NEW_LINE> <INDENT> cols=...
Generate sample data
625941edbe8e80087fb21166
def importAbc(self): <NEW_LINE> <INDENT> filetypes = '{0} (*.abc);;{1} (*)'.format( _("ABC Files"), _("All Files")) <NEW_LINE> caption = app.caption(_("dialog title", "Import an abc file")) <NEW_LINE> directory = os.path.dirname(self.mainwindow().currentDocument().url().toLocalFile()) or app.basedir() <NEW_LINE> self.i...
Opens an abc file. Converts it to ly by using abc2ly.
625941ed236d856c2ad44d0e
def preprocess_features(features): <NEW_LINE> <INDENT> rowsum = np.array(features.sum(1)) <NEW_LINE> r_inv = np.power(rowsum, -1).flatten() <NEW_LINE> r_inv[np.isinf(r_inv)] = 0. <NEW_LINE> r_mat_inv = sp.diags(r_inv) <NEW_LINE> features = sp.coo_matrix(features) <NEW_LINE> features = r_mat_inv.dot(features) <NEW_LINE>...
Row-normalize feature matrix and convert to tuple representation
625941ed596a897236089fe5
def test_uri_without_credentials_doesnt_override_conn_settings(self): <NEW_LINE> <INDENT> connect( host="mongodb://localhost/mongoenginetest", username="user", password="pass" ) <NEW_LINE> if PYMONGO_VERSION >= (4,): <NEW_LINE> <INDENT> with pytest.raises(OperationFailure): <NEW_LINE> <INDENT> db = get_db() <NEW_LINE> ...
Ensure connect() uses the username & password params if the URI doesn't explicitly specify them.
625941edec188e330fd5acc0
def GetUserTimeline(self, user=None, count=None, since=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if count: <NEW_LINE> <INDENT> int(count) <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> raise TwitterError("Count must be an integer") <NEW_LINE> <DEDENT> parameters = {} <NEW_LINE> if count: <NEW_LINE> ...
Fetch the sequence of public twitter.Status messages for a single user. The twitter.Api instance must be authenticated if the user is private. Args: user: either the username (short_name) or id of the user to retrieve. If not specified, then the current authenticated user is used. [optional] count: the n...
625941ed4c3428357757c851
def add_geometries(self, geoms, crs, **kwargs): <NEW_LINE> <INDENT> feature = cartopy.feature.ShapelyFeature(geoms, crs, **kwargs) <NEW_LINE> return self.add_feature(feature)
Add the given shapely geometries (in the given crs) to the axes. Args: * geoms: A collection of shapely geometries. * crs: The cartopy CRS in which the provided geometries are defined. Kwargs: Keyword arguments to be used when drawing this feature. Returns: * A :class:`cartopy.mpl.feature_artist.Fe...
625941ed5fc7496912cc3eaa
def _send_reply(self): <NEW_LINE> <INDENT> time.sleep(random.randint(0, self.max_delay)) <NEW_LINE> _socket = self.request[1] <NEW_LINE> timestamp = time.strftime("%A, %d %B %Y %H:%M:%S GMT", time.gmtime()) <NEW_LINE> reply_data = SSDP_REPLY.format(self.server.device_url, self.server.cache_expire, self.server.os_id, se...
Sends reply to SSDP search messages.
625941ed96565a6dacc8fbf5
def from_iso8601utc(value): <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> time = datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%fZ") <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> time = datetime.strptime(value, "%Y-%m-%dT%H:%M:%SZ") <NEW_LI...
Parse UTC ISO-8601 formatted string to datetime.
625941ed851cf427c661aa36
def _room_color(self, room_name=None): <NEW_LINE> <INDENT> if not room_name: <NEW_LINE> <INDENT> room_name = self.room.name <NEW_LINE> <DEDENT> return self.bot.room_color(room_name)
Get colored room name Uses the BotHelper method room_color @type room_name: str @param room_name: specified room name or nothing for the current room @rtype: str @return: colored room name
625941edfff4ab517eb2f96c
def assign_add(ref, value, use_locking=False, name=None): <NEW_LINE> <INDENT> _ctx = _context._context <NEW_LINE> if _ctx is None or not _ctx._eager_context.is_eager: <NEW_LINE> <INDENT> if use_locking is None: <NEW_LINE> <INDENT> use_locking = False <NEW_LINE> <DEDENT> use_locking = _execute.make_bool(use_locking, "us...
Update 'ref' by adding 'value' to it. This operation outputs "ref" after the update is done. This makes it easier to chain operations that need to use the reset value. Args: ref: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, `int64`, `q...
625941ed63f4b57ef0001636
def analyse_line_type(line): <NEW_LINE> <INDENT> mixed_mode = False <NEW_LINE> tab_part = '' <NEW_LINE> space_part = '' <NEW_LINE> if len(line) > 0 and line[0] != ' ' and line[0] != '\t': <NEW_LINE> <INDENT> return (LineType.no_indent, '') <NEW_LINE> <DEDENT> mo = INDENT_RE.match(line) <NEW_LINE> if not mo: <NEW_LINE> ...
Analyse the type of line. Return (LineType, <indentation part of the line>). The function will reject improperly formatted lines (mixture of tab and space for example) and comment lines.
625941ed4428ac0f6e5bad23
def close(self, correlation_id: Optional[str]): <NEW_LINE> <INDENT> if not self.__opened: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self._connection is None: <NEW_LINE> <INDENT> raise InvalidStateException(correlation_id, 'NO_CONNECTION', 'MySql connection is missing') <NEW_LINE> <DEDENT> if self.__local_connec...
Closes component and frees used resources. :param correlation_id: (optional) transaction id to trace execution through call chain. :return: raise error or None no errors occured.
625941ed507cdc57c6307214
def test_sell_profit_only_disable_profit(default_conf, limit_buy_order, mocker) -> None: <NEW_LINE> <INDENT> patch_get_signal(mocker) <NEW_LINE> patch_RPCManager(mocker) <NEW_LINE> patch_coinmarketcap(mocker) <NEW_LINE> mocker.patch('freqtrade.freqtradebot.Analyze.min_roi_reached', return_value=False) <NEW_LINE> mocker...
Test sell_profit_only feature when disabled
625941ed97e22403b379d4c8
def _activate(self): <NEW_LINE> <INDENT> logger.debug("GPU: Activate render framebuffer") <NEW_LINE> gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self._handle) <NEW_LINE> if self._need_attach: <NEW_LINE> <INDENT> self._attach() <NEW_LINE> self._need_attach = False
Activate framebuffer on GPU
625941ed462c4b4f79d1dbfc
def draw(self): <NEW_LINE> <INDENT> return self.drawEntries()
Draw the menu
625941edf8510a7c17cf9c2d
def __init__(self, id, address, username, password): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.address = address <NEW_LINE> self.username = username <NEW_LINE> self.password = password <NEW_LINE> self.url = 'https://' + address
Initialize the class
625941edd4950a0f3b08c874
def test_add_post(self): <NEW_LINE> <INDENT> with app.test_client() as client: <NEW_LINE> <INDENT> d = {"title": "Test Title", "content": "Test content", "user_id": f"{self.user_id}"} <NEW_LINE> response = client.post(f"/users/{self.user_id}/posts/new", data=d, follow_redirects=True) <NEW_LINE> html = response.get_data...
Test the form submission for adding a new post
625941ed4a966d76dd551541
def print_func_done(function): <NEW_LINE> <INDENT> @wraps(function) <NEW_LINE> def func_info(*args, **kwargs): <NEW_LINE> <INDENT> result = function(*args, **kwargs) <NEW_LINE> print('=====>', function.__name__, 'is done') <NEW_LINE> return result <NEW_LINE> <DEDENT> return func_info
打印信息 :param function: :param info: :return:
625941ed4d74a7450ccd46f1
def test_adding_follower_user_admin_approval(self): <NEW_LINE> <INDENT> authorB = create_author( username='abc002', password='abcpwd', adminApproval=False, id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'), ) <NEW_LINE> payload = { 'actor': { 'host': 'https://konnection-server.herokuapp.com/', 'id': 'aaaaa', }, 'obj...
Test adding follower endpoint is safeguard by adminApproval
625941ed01c39578d7e75368
def _switch_for_specs(self, attribute: str, func: callable): <NEW_LINE> <INDENT> if self._can_simplify_for(attribute): <NEW_LINE> <INDENT> return func(self.relation_specs[0]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ors = [] <NEW_LINE> for spec in self.relation_specs: <NEW_LINE> <INDENT> condition = func(spec) <NE...
Creates a conditional expression based on the different sources, for example, creates constructs like: ... AND ((src._application = 'A' AND row_number = 1) OR (src._application = 'B' AND row_number = 1) OR (src._application = 'C' AND some_other_condition)) where the expressions (AND row_number = 1 in this case) a...
625941ed30dc7b7665901e8c
def dt_checksum_script_unsupported_text(): <NEW_LINE> <INDENT> pass
>>> old_state = test_config.setup() >>> ChecksumScript("crds.refactor.checksum data/opaque_fts.tmp")() # doctest: +ELLIPSIS CRDS - INFO - Adding checksum for 'data/opaque_fts.tmp' CRDS - ERROR - Checksum operation FAILED : File 'data/opaque_fts.tmp' does not appear to be a CRDS reference or mapping file. 1 >>> Check...
625941ed460517430c3946a3
def bdce_sf(Sr, Fsa, rdflag=False, Nroff=0, isplot=False): <NEW_LINE> <INDENT> Na, Nr = Sr.shape <NEW_LINE> if not rdflag: <NEW_LINE> <INDENT> Sr = fft(Sr, axis=1, shift=True) <NEW_LINE> <DEDENT> Sr = Sr * (Sr.conj()) <NEW_LINE> dpidx = np.argmax(Sr, axis=0) <NEW_LINE> dpf = np.linspace(-Fsa / 2., Fsa / 2., Na) <NEW_LI...
Baseband doppler centroid estimation by spectrum fitting Baseband doppler centroid estimation by spectrum fitting. Parameters ---------- Sr : {numpy array} SAR signal :math:`N_a×N_r` in range-doppler domain (range frequency domain). Fsa : {float} Sampling rate in azimuth rdflag : {bool} Specifies whether ...
625941edcc40096d61595e7a
def floatToLoad(string_num): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return struct.pack('>f', string_num) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return "Failure"
将浮点转换为load
625941ed090684286d50f21a
def test__read_proc_file_multiprocessing_true(self): <NEW_LINE> <INDENT> opts = {"multiprocessing": True} <NEW_LINE> proc_data = { "tgt_type": "glob", "jid": "20200310230030623022", "tgt": "minion", "pid": 12345, "ret": "", "user": "root", "arg": [10], "fun": "test.sleep", } <NEW_LINE> with patch("os.getpid", MagicMock...
test get_minion_pillar when target exists
625941ed9c8ee82313fbbca4
def convert_other_auth_policy(self, auth_policy_parse_tree): <NEW_LINE> <INDENT> original_tree = copy.deepcopy(auth_policy_parse_tree) <NEW_LINE> tree_list = [original_tree] <NEW_LINE> policy_name = auth_policy_parse_tree.positional_value(0).value <NEW_LINE> pol_obj = common.Policy(policy_name, self.__class__.__name__)...
Converting local/ldap/radius/saml/tacacs/negotiate/cert policy to advanced authentication policy. Syntax for localPolicy: add authentication localPolicy <name> <classic rule> converts to add authentication Policy <name> -rule <advanced rule> -action local syntax for other policies: add authentication <policy type> <na...
625941edf548e778e58cdaad
def datetime_to_djd(time): <NEW_LINE> <INDENT> if time.tzinfo is None: <NEW_LINE> <INDENT> time_utc = pytz.utc.localize(time) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> time_utc = time.astimezone(pytz.utc) <NEW_LINE> <DEDENT> djd_start = pytz.utc.localize(dt.datetime(1899, 12, 31, 12)) <NEW_LINE> djd = (time_utc - d...
Converts a datetime to the Dublin Julian Day Parameters ---------- time : datetime.datetime time to convert Returns ------- float fractional days since 12/31/1899+0000
625941ed4527f215b584c97e
def start(self, pipeline_name, *args, **kwargs): <NEW_LINE> <INDENT> pipeline = self._pipeline_registry.get(pipeline_name, None) <NEW_LINE> if not pipeline: <NEW_LINE> <INDENT> raise PipelineDoesNotExist('Pipeline "%s" has not been registered.' % pipeline_name) <NEW_LINE> <DEDENT> return pipeline().start(*args, **kwarg...
Starts a pipeline by name
625941ed3346ee7daa2b329d
def _bytes_to_integer(self, integer_bytes): <NEW_LINE> <INDENT> return struct.unpack(self.INTEGER_FORMAT, integer_bytes)[0]
The function that convert bytes to integer. Param: integer_bytes: the bytes needed to be converted.
625941ed91f36d47f21aca25
def __init__(self, original_features_num, num_blocks, in_features,out_features, depth_of_mlp, **kwargs): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.original_features_num = original_features_num <NEW_LINE> self.num_blocks = num_blocks <NEW_LINE> self.in_features = in_features <NEW_LINE> self.out_features = o...
take a batch of graphs (bs, n_vertices, n_vertices, in_features) and return a batch of node embedding (bs, n_vertices, out_features) graphs must have same size inside the batch
625941ed73bcbd0ca4b2c5a2
def execute(self, run, streams, conn = None, transaction = False): <NEW_LINE> <INDENT> binds = [] <NEW_LINE> for stream in streams: <NEW_LINE> <INDENT> for lumi in streams[stream]: <NEW_LINE> <INDENT> binds.append({"RUN_ID" : run, "STREAM_ID" : stream, "LUMI_ID" : lumi}) <NEW_LINE> <DEDENT> <DEDENT> result = self.dbi.p...
_execute_ Executes the query and formats the output
625941ede5267d203edce1c3
def diagnostics_plot_chisq(self, ds, figname = "modelfit_chisqs.png"): <NEW_LINE> <INDENT> label_names = ds.get_plotting_labels() <NEW_LINE> lams = ds.wl <NEW_LINE> pivots = self.pivots <NEW_LINE> npixels = len(lams) <NEW_LINE> nlabels = len(pivots) <NEW_LINE> chisqs = self.chisqs <NEW_LINE> coeffs = self.coeffs <NEW_L...
Produce a set of diagnostic plots for the model Parameters ---------- (optional) chisq_dist_plot_name: str Filename of output saved plot
625941edf9cc0f698b140b23
def _get_size(self): <NEW_LINE> <INDENT> return self.__size
Getter method for size, mapped from YANG variable /inputs/vnfbd/scenario/nodes/resources/storage/size (uint32) YANG Description: The storage allocation size.
625941ed3617ad0b5ed68423