code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def save_scatter(plot, index): <NEW_LINE> <INDENT> result = save_plot_base(plot, index) <NEW_LINE> result['type'] = 'scatter' <NEW_LINE> result['xAxis'] = dict(columnName=plot.state.x_att.label, range=[float(plot.state.x_min), float(plot.state.x_max)]) <NEW_LINE> result['yAxis'] = dict(columnName=plot.state.y_att.label...
Convert a single glue scatter plot to a D3PO plot :param plot: Glue scatter plot :class:`~glue.viewers.scatter.qt.ScatterViewer` :param index: 1D index of plot on the page :type index: int :rtype: json-serializable dict
625941eecb5e8a47e48b7ff4
def showVersion(tccActor, userCmd): <NEW_LINE> <INDENT> kwStr = 'Version=%s' % (quoteStr(tcc.__version__),) <NEW_LINE> userCmd.setState(userCmd.Done, hubMsg=kwStr)
@param[in,out] tccActor tcc actor @param[in,out] userCmd user command
625941ee15baa723493c44cc
def cast(*args): <NEW_LINE> <INDENT> return _itkNormalizedCorrelationImageFilterPython.itkNormalizedCorrelationImageFilterID2ID2ID2_cast(*args)
cast(itkLightObject obj) -> itkNormalizedCorrelationImageFilterID2ID2ID2
625941ee85dfad0860c3b3af
def FormalDerivative(f): <NEW_LINE> <INDENT> dc = Polynomial([]) <NEW_LINE> l=len(coeffs) <NEW_LINE> for i in range(l-1): <NEW_LINE> <INDENT> dc.coeffs.append((l-i-1)*coeffs[i]) <NEW_LINE> <DEDENT> return dc
Returns a Polynomial which is the formal derivative of the polynomial f
625941eea8ecb033257d361d
def setServiceCode(self, serviceCode): <NEW_LINE> <INDENT> self.serviceCode = serviceCode
:param serviceCode: (Optional) 产品代码
625941ee55399d3f05588c0a
def checkPossibility(self, nums): <NEW_LINE> <INDENT> cnt = 0 <NEW_LINE> for i in range( 1, len(nums) ): <NEW_LINE> <INDENT> if nums[i] < nums[i - 1]: <NEW_LINE> <INDENT> cnt += 1 <NEW_LINE> if cnt > 1: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if i == 1 or nums[i] >= nums[i - 2]: <NEW_LINE> <INDENT> nums[i ...
:type nums: List[int] :rtype: bool
625941ee5166f23b2e1a56ab
def getsmtpuser(self): <NEW_LINE> <INDENT> return self.__config["SMTPUser"]
Get the username for the smtp server
625941ee3539df3088e2e89e
def twoSum(self, nums, target): <NEW_LINE> <INDENT> final_dict = {} <NEW_LINE> for i in range(len(nums)): <NEW_LINE> <INDENT> complement = target - nums[i] <NEW_LINE> if complement in final_dict.keys(): <NEW_LINE> <INDENT> return [final_dict[complement], i] <NEW_LINE> <DEDENT> final_dict[nums[i]] = i
:type nums: List[int] :type target: int :rtype: List[int]
625941ee6fece00bbac2dc98
def __init__(self, manager): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._manager = manager <NEW_LINE> self._login_info_manager = manager.login_info_manager() <NEW_LINE> self.allow_cli_args = False <NEW_LINE> self._completer_state = CompleterState(self) <NEW_LINE> self._keyboard = Controller()
slm shell :manager: slm instance
625941ee60cbc95b062c6a96
def is_in_collision(self, tf, other, tf_other): <NEW_LINE> <INDENT> fcl_tf_1 = fcl.Transform(tf[:3, :3], tf[:3, 3]) <NEW_LINE> fcl_tf_2 = fcl.Transform(tf_other[:3, :3], tf_other[:3, 3]) <NEW_LINE> o1 = fcl.CollisionObject(self.fcl_shape, fcl_tf_1) <NEW_LINE> o2 = fcl.CollisionObject(other.fcl_shape, fcl_tf_2) <NEW_LIN...
Collision checking with another shape for the given transforms.
625941ee4d74a7450ccd4718
def _remove_numbers(text): <NEW_LINE> <INDENT> return ''.join([letter for letter in text if not letter.isdigit()])
Elimina los números del texto
625941eec432627299f0519c
@pytest.mark.parametrize('ext', all_exts) <NEW_LINE> def test_column_name_read_write(ext): <NEW_LINE> <INDENT> filename = "output." + ext <NEW_LINE> test_head = ["TIME", "INTEGER", "FLOAT"] <NEW_LINE> test_data = np.array([[_ / 10.0, _, _ / 9.0] for _ in range(0, 10)]) <NEW_LINE> print("Writing {0}".format(filename)) <...
Ensure that test data can be written and read successfully with using the column name functionality.
625941ee4f88993c3716c5b4
def _network_config(self): <NEW_LINE> <INDENT> LOG.info('Setup guest networking') <NEW_LINE> interfaces = self.domain.xml.find('devices').findall('interface') <NEW_LINE> addresses = [] <NEW_LINE> udev_lines = [] <NEW_LINE> for interface, network in zip(interfaces, self.domain.networks): <NEW_LINE> <INDENT> network.xml ...
Domain network configuration
625941ee851cf427c661aa5c
def scheme_eval(expr, env): <NEW_LINE> <INDENT> while env is not None: <NEW_LINE> <INDENT> if expr is None: <NEW_LINE> <INDENT> raise SchemeError("Cannot evaluate an undefined expression.") <NEW_LINE> <DEDENT> if scheme_symbolp(expr): <NEW_LINE> <INDENT> expr, env = env.lookup(expr).get_actual_value(), None <NEW_LINE> ...
Evaluate Scheme expression EXPR in environment ENV. If ENV is None, simply returns EXPR as its value without further evaluation. >>> expr = read_line("(+ 2 2)") >>> expr Pair('+', Pair(2, Pair(2, nil))) >>> scheme_eval(expr, create_global_frame()) scnum(4)
625941ee76e4537e8c351bca
def open(self, fullurl, data=None): <NEW_LINE> <INDENT> if isinstance(fullurl, basestring): <NEW_LINE> <INDENT> req = Request(fullurl, data) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> req = fullurl <NEW_LINE> if data is not None: <NEW_LINE> <INDENT> req.add_data(data) <NEW_LINE> <DEDENT> <DEDENT> protocol = req.get_...
Overriding to remove the timeout kwarg which was being used below to override my own HTTPRequest.timeout attribute.
625941ee187af65679ca5672
def _hex(list=None): <NEW_LINE> <INDENT> list = list or [] <NEW_LINE> if list: <NEW_LINE> <INDENT> list.reverse() <NEW_LINE> return int(''.join(list), 16) <NEW_LINE> <DEDENT> return 0
Format the return value in list into hex.
625941ee3c8af77a43ae3cfa
def __init__(self, hidden_dims, input_dim=3*32*32, num_classes=10, dropout=1, normalization=None, reg=0.0, weight_scale=1e-2, dtype=np.float32, seed=None): <NEW_LINE> <INDENT> self.normalization = normalization <NEW_LINE> self.use_dropout = dropout != 1 <NEW_LINE> self.reg = reg <NEW_LINE> self.num_layers = 1 + len(hid...
Initialize a new FullyConnectedNet. Inputs: - hidden_dims: A list of integers giving the size of each hidden layer. - input_dim: An integer giving the size of the input. - num_classes: An integer giving the number of classes to classify. - dropout: Scalar between 0 and 1 giving dropout strength. If dropout=1 then th...
625941ee8e71fb1e9831dcfa
def test_sort_attributes_within_product_type_invalid_product_type( staff_api_client, permission_manage_products ): <NEW_LINE> <INDENT> product_type_id = graphene.Node.to_global_id("ProductType", -1) <NEW_LINE> attribute_id = graphene.Node.to_global_id("Attribute", -1) <NEW_LINE> variables = { "type": "VARIANT", "produc...
Try to reorder an invalid product type (invalid ID).
625941eed10714528d60023c
def subs_map(self, value): <NEW_LINE> <INDENT> value_array = np.asarray(value, object) <NEW_LINE> if self.shape != value_array.shape: <NEW_LINE> <INDENT> raise ValueError('invalid shape for argument') <NEW_LINE> <DEDENT> return {self[i]: e for i,e in np.ndenumerate(value_array)}
Create mapping of this variable's symbols to the value given.
625941ee009cb60464c63900
def get_stopwords(lang='english'): <NEW_LINE> <INDENT> stopwords = [unicode_to_ascii( elem) for elem in stopwords.words(lang)] <NEW_LINE> return stopwords
Return stopwords array.
625941ee38b623060ff0b340
def isOverwrittenDefaultTemplate(self, default_template_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.getTemplate(default_template_id) is not None <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return False
if the default template id matches 'registration' or 'password_reset' - check the existance of these templates.
625941ee9c8ee82313fbbcca
def call(self,x): <NEW_LINE> <INDENT> ndim = len(x.get_shape()) <NEW_LINE> if ndim == 3: <NEW_LINE> <INDENT> x = tf.transpose(x,perm=[0,2,1]) <NEW_LINE> if self.freq_format == "freq_first": <NEW_LINE> <INDENT> perm = [0,3,2,1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> perm = [0,1,2,3] <NEW_LINE> <DEDENT> <DEDENT> e...
Assumes shape (num_batches,num_time_steps,num_channels)
625941eed4950a0f3b08c89a
def get_priority(account, show): <NEW_LINE> <INDENT> if not show: <NEW_LINE> <INDENT> show = 'online' <NEW_LINE> <DEDENT> if show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible') and config.get_per('accounts', account, 'adjust_priority_with_status'): <NEW_LINE> <INDENT> return config.get_per('accounts', accou...
Return the priority an account must have
625941eed58c6744b42581b0
def get_site_metas(with_static=False, with_media=False, extra={}): <NEW_LINE> <INDENT> site_current = Site.objects.get_current() <NEW_LINE> metas = { 'SITE': { 'name': site_current.name, 'domain': site_current.domain, 'web_url': 'http://%s' % site_current.domain, } } <NEW_LINE> if with_media: <NEW_LINE> <INDENT> metas[...
Return metas from the current *Site* and settings Added Site metas will be callable in templates like this ``SITE.themetaname`` This can be used in code out of a Django requests (like in management commands) or in a context processor to get the *Site* urls. Default metas returned : * name: Current *Site* entry nam...
625941ee07d97122c4178deb
@cache_page(30) <NEW_LINE> @transaction.atomic <NEW_LINE> def index(request): <NEW_LINE> <INDENT> start =time.time() <NEW_LINE> data2= Resource.objects.order_by("-resourceTime") <NEW_LINE> P = Paginator(data2, 3) <NEW_LINE> page = request.GET.get('page') if request.GET.get('page') else 1 <NEW_LINE> data = P.get_page(p...
系统首页 :param request: :return:
625941eebe383301e01b59ce
def right_shift_rows(x, shift, pad_val=numpy.float32(0)): <NEW_LINE> <INDENT> return T.concatenate([ T.alloc(pad_val, x.shape[0], shift), x[:,:-shift] ], axis=1)
Right-shift rows in a matrix, padding the left with a given value.
625941ee596a89723608a00c
def _next_code_point(val, val_iter, yield_char=False, to_int=lambda x: x): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> high = next(val_iter) <NEW_LINE> <DEDENT> except StopIteration: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> low = None <NEW_LINE> code_point = to_int(high) <NEW_LINE> if _LOW_SURROGATE_START <= cod...
Provides the next *code point* in the given Unicode sequence. This generator function yields complete character code points, never incomplete surrogates. When a low surrogate is found without following a high surrogate, this function raises ``ValueError`` for having encountered an unpaired low surrogate. When the prov...
625941ee956e5f7376d713be
def __call__(self, instances: Instances) -> DensePoseList: <NEW_LINE> <INDENT> boxes_xyxy_abs = instances.pred_boxes.tensor.clone().cpu() <NEW_LINE> boxes_xywh_abs = BoxMode.convert(boxes_xyxy_abs, BoxMode.XYXY_ABS, BoxMode.XYWH_ABS) <NEW_LINE> dp_datas = [] <NEW_LINE> for i in range(len(boxes_xywh_abs)): <NEW_LINE> <I...
Convert DensePose predictions (an instance of `DensePoseChartPredictorOutput`) into DensePose annotations data (an instance of `DensePoseList`)
625941ee5fc7496912cc3ed0
def _send(self, data): <NEW_LINE> <INDENT> packet = bytearray() <NEW_LINE> packet += intb4(len(data) + 8) <NEW_LINE> packet += intb4(randint(0, 2 ** 32 - 1)) <NEW_LINE> packet += bytearray(data) <NEW_LINE> LOG.debug('sent transaction ' + str(b4int(packet[4:8]))) <NEW_LINE> return self.socket.sendall(packet)
Takes a bytestring and sends it off to the other side. The Connection is responsible for handeling protocols used by this program, and strips off this excess information
625941ee44b2445a339325e5
def _token_iter(tokens): <NEW_LINE> <INDENT> if len(tokens) < 3: <NEW_LINE> <INDENT> yield from tokens <NEW_LINE> return <NEW_LINE> <DEDENT> def _is_elif_token(t1, t2, t3): <NEW_LINE> <INDENT> return ( t1.type == NAME and t1.string == "ellers" and t2.type == OP and t2.string == "-" and t3.type == NAME and t3.string == ...
Collapse tokens considered a single token in danish into one. We need this function, because the tokenizer considers `ellers-hvis` and `for-hver` as "ellers" MINUS "hvis" and "for" MINUS "hver" respectively. Send the tokenized danish code through this guy.
625941ee16aa5153ce3629cc
def build_team_two(self): <NEW_LINE> <INDENT> os.system("clear") <NEW_LINE> print("TIME TO BUILD THE SECOND TEAM!") <NEW_LINE> hero_one = Hero(self.user_input("What is the name of your first hero? ")) <NEW_LINE> ability_name = self.user_input("Whats the heroes power? ") <NEW_LINE> power_stats = len(ability_name) * rand...
This method should allow user to build team two.
625941eeadb09d7d5db6ccdf
def __init__(self, start_index: int, end_index: int, text: str) -> None: <NEW_LINE> <INDENT> self.__start_index = start_index <NEW_LINE> self.__end_index = end_index <NEW_LINE> self.__text = text
Constructor :param start_index the start position in the original text string :param end_index the end position in the original text string :param text the text for the generator
625941eed99f1b3c44c67ad8
def evaluate_solution(self, symbol_value_map, expr_values): <NEW_LINE> <INDENT> solution = set() <NEW_LINE> ret = self._evaluate_solution(symbol_value_map, expr_values, solution) <NEW_LINE> return (ret, solution)
Given a symbol => value map, calculates the value of this expression as well as which symbols were involved in the calculation. This is meant for identifying which symbols contribute to a tristate m or y value of the expression, and acts like a shortcut find_solution(). @param symbol_value_map: (incomplete) symbol t...
625941ee56ac1b37e6264718
def test_gentoo_legacy_ipv6(self): <NEW_LINE> <INDENT> interface = { 'label': 'public', 'hwaddr': '00:11:22:33:44:55', 'ipv6': [('2001:db8::42', 96)], 'gateway6': '2001:db8::1', 'dns': ['2001:db8::2'], } <NEW_LINE> outfiles = self._run_test('gentoo', eth0=interface, version='legacy') <NEW_LINE> self.assertTrue('net' in...
Test setting public IPv6 for Gentoo legacy networking
625941ee004d5f362079a882
def get_full_command(self, command) -> bytes: <NEW_LINE> <INDENT> log.info(f"Using protocol {self._protocol_id} with {len(self.COMMANDS)} commands") <NEW_LINE> self._command = command <NEW_LINE> self._command_defn = self.get_command_defn(command) <NEW_LINE> cmd = bytes(self._command, "utf-8") <NEW_LINE> if ( self._comm...
Override the default get_full_command as its different for PI16
625941ee167d2b6e312190e8
def run_field(X, tth, eps, S, K, P): <NEW_LINE> <INDENT> times_gt_box_field = [] <NEW_LINE> times_gt_gaussian_field = [] <NEW_LINE> errors_tt_box_field = [] <NEW_LINE> times_tt_box_field = [] <NEW_LINE> errors_tt_gaussian_field = [] <NEW_LINE> times_tt_gaussian_field = [] <NEW_LINE> N = X.ndim <NEW_LINE> B = tth.tensor...
Field histogram reconstruction
625941ee30c21e258bdfa9f6
def get(self, request, vimid=""): <NEW_LINE> <INDENT> self._logger.info("vimid: %s" % vimid) <NEW_LINE> self._logger.debug("with META: %s" % request.META) <NEW_LINE> try: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> viminfo = extsys.get_vim_by_id(vimid) <NEW_LINE> cloud_extra_info_str = viminfo.get('cloud_extra_info', ...
get blob of vesagent-config :param request: :param vimid: :return:
625941ee8e05c05ec3eea8cc
def set_notifier(self, notifier): <NEW_LINE> <INDENT> self.notifier = notifier
Notifier implements any parameter subscription logic. The notifier should be a function that takes in a key and value that represents a parameter update. Notifier is called under lock and thus must not implement any lengthy computation.
625941ee21a7993f00bc824d
def compute(x, y): <NEW_LINE> <INDENT> return x + y
Calculates the sum between 2 positive integers. :param x: first number in the sum calculation. :type x: int :param y: second number in the sum calculation. :type y: int :return: sum between x and y
625941ee57b8e32f524839f2
def parse_fileinfo(self, rawinfo): <NEW_LINE> <INDENT> items = list(filter(None, rawinfo.split(' '))) <NEW_LINE> mode, num, owner, group, size, date, filename = ( items[0], items[1], items[2], items[3], items[4], ' '.join(items[5:8]), ' '.join(items[8:]) ) <NEW_LINE> return mode, num, owner, group, size, date, filename
drwxr-xr-x 10 nasen nasen 4096 Oct 14 23:16 Desktop
625941eecdde0d52a9e5358b
def main(): <NEW_LINE> <INDENT> num = int(input()) <NEW_LINE> for cnt in range(num): <NEW_LINE> <INDENT> for _ in range(cnt): <NEW_LINE> <INDENT> print(" ", end='') <NEW_LINE> <DEDENT> for _ in range(2 * (num - cnt) - 1): <NEW_LINE> <INDENT> print("*", end='') <NEW_LINE> <DEDENT> print()
Main Function
625941ee6aa9bd52df0372fb
def convert(json_list, json_file): <NEW_LINE> <INDENT> json_dict = {"images":[], "type": "instances", "annotations": [], "categories": []} <NEW_LINE> imageID = 1 <NEW_LINE> categories = PRE_DEFINE_CATEGORIES <NEW_LINE> bnd_id = START_BOUNDING_BOX_ID <NEW_LINE> for json_f in json_list: <NEW_LINE> <INDENT> json_dir = ana...
:param json_list: 需要转换的txt列表 :param json_file: 导出json文件的路径 :return: None
625941ee8e7ae83300e4b522
def test_needleman_wunsch(self): <NEW_LINE> <INDENT> pass
edit distances with scoring preference to obtain highest scoring sequence
625941eea17c0f6771cbe5a2
def __init__(self, A, S) : <NEW_LINE> <INDENT> Module.__init__(self, MonoidPowerSeriesRing(A.base_ring(), S)) <NEW_LINE> MonoidPowerSeriesAmbient_abstract.__init__(self, A, S) <NEW_LINE> self.__coeff_gens = [ self._element_class(self, dict([(S.zero_element(), a)]), self.monoid().filter_all() ) for a in A.gens(...
INPUT: - `A` -- A module. - `S` -- A monoid as implemented in :class:~`fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids.NNMonoid`. TESTS:: sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import * sage: from psage.modform....
625941ee4f6381625f114f8e
def event_atom_warmup(self, testdata: AtomWarmup): <NEW_LINE> <INDENT> super().event_atom_warmup(testdata) <NEW_LINE> self._tags["loop"] = testdata.loop.value <NEW_LINE> self._tags["idx"] = testdata.idx.value <NEW_LINE> self._tags[KEY_ATOM_NAME] = slugify(testdata.atom_name.value) <NEW_LINE> annotation_tags = "loop {},...
Respond to warmup event. This data is stored as an event or so called annotation. For more info on storing and displaying annotations.
625941ee236d856c2ad44d35
def get_logger(name: str = 'roger') -> logging.Logger: <NEW_LINE> <INDENT> global logger <NEW_LINE> if logger is None: <NEW_LINE> <INDENT> config = get_config() <NEW_LINE> logger = logging.getLogger(name) <NEW_LINE> handler = logging.StreamHandler(sys.stdout) <NEW_LINE> formatter = logging.Formatter(config['logging']['...
Get an instance of logger. Parameters ---------- name: str The name of logger Returns ------- logging.Logger An instance of logging.Logger
625941eeb57a9660fec33ddf
def simple_line_justifying(line, width): <NEW_LINE> <INDENT> wcount = len(line) <NEW_LINE> if wcount < 2: <NEW_LINE> <INDENT> return line <NEW_LINE> <DEDENT> length = linelen(line) <NEW_LINE> if length >= width: <NEW_LINE> <INDENT> return line <NEW_LINE> <DEDENT> lastword = line.pop() <NEW_LINE> trailing = width - leng...
Justify a line. 'line' is the list of words for this line, and 'width' the maximum output width.
625941ee4c3428357757c878
def _is_sld_or_lower(self, name): <NEW_LINE> <INDENT> return len(name) >= 3
Return True if the name is an SLD or lower.
625941ee99cbb53fe6793138
def ccw(A,B,C): <NEW_LINE> <INDENT> return (C.y-A.y)*(B.x-A.x) > (B.y-A.y)*(C.x-A.x)
ccw(A, B, C) Test if moving from point A to B to C moves in a counter-clockwise direction. Points are (P.x, P.y) http://www.bryceboe.com/2006/10/23/line-segment-intersection-algorithm/
625941ee7cff6e4e81117ed9
def observe(self, observation, gameState): <NEW_LINE> <INDENT> noisyDistance = observation <NEW_LINE> emissionModel = busters.getObservationDistribution(noisyDistance) <NEW_LINE> pacmanPosition = gameState.getPacmanPosition() <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> allPossible = util.Counter() <NEW_LINE> if nois...
Updates beliefs based on the distance observation and Pacman's position. When we enter this function pacman's distribution over possible locations of the ghost are stored in self.beliefs For any position p: self.beliefs[p] = Pr(Xt=p | e_{t-1}, e_{t-2}, ..., e_1) That is, pacman's distribution has already been update...
625941ee8e05c05ec3eea8cd
def test_reduce_A(self): <NEW_LINE> <INDENT> A_returned = self.LTI_proj.reduce_A(self.A_on_basis_vec_handles) <NEW_LINE> N.testing.assert_allclose(A_returned, self.A_true) <NEW_LINE> LTI_proj = LGP.LTIGalerkinProjectionHandles(N.vdot, self.basis_vec_handles, self.adjoint_basis_vec_handles, is_basis_orthonormal=False, v...
Reduction of A matrix for Matrix, LookUp operators and in_memory.
625941ee32920d7e50b28728
def __init__( self, *, ramp_up_rules: Optional[List["RampUpRule"]] = None, **kwargs ): <NEW_LINE> <INDENT> super(Experiments, self).__init__(**kwargs) <NEW_LINE> self.ramp_up_rules = ramp_up_rules
:keyword ramp_up_rules: List of ramp-up rules. :paramtype ramp_up_rules: list[~azure.mgmt.web.v2020_12_01.models.RampUpRule]
625941ee50485f2cf553d2ef
def __init__(self, Re=None, file_path=None): <NEW_LINE> <INDENT> self.y, self.u = None, None <NEW_LINE> self.x, self.v = None, None <NEW_LINE> if Re: <NEW_LINE> <INDENT> self.read_centerline_velocities(Re, file_path=file_path)
Initialization. Parameters ---------- Re: float, optional Desired Reynolds number; default: None. file_path: string, optional Path of the file containing the validation data; default: None.
625941eeb57a9660fec33de0
def __init__( self, *, value: List["AnalysisDefinition"], **kwargs ): <NEW_LINE> <INDENT> super(DiagnosticAnalysisCollection, self).__init__(**kwargs) <NEW_LINE> self.value = value <NEW_LINE> self.next_link = None
:keyword value: Required. Collection of resources. :paramtype value: list[~azure.mgmt.web.v2020_12_01.models.AnalysisDefinition]
625941eeb7558d58953c545c
def cosine_similarity(vector_query, normalised_doc): <NEW_LINE> <INDENT> dotProduct = 0 <NEW_LINE> for term in vector_query: <NEW_LINE> <INDENT> if term in normalised_doc: <NEW_LINE> <INDENT> dotProduct += vector_query[term] * normalised_doc[term] <NEW_LINE> <DEDENT> <DEDENT> return dotProduct
Calculate the cosine similarity between a query and a document :param vector_query: vectorised query :param normalised_doc: normalised document :return:
625941ee29b78933be1e5bf9
def with_target_audience(self, target_audience): <NEW_LINE> <INDENT> return self.__class__( self._signer, service_account_email=self._service_account_email, token_uri=self._token_uri, target_audience=target_audience, additional_claims=self._additional_claims.copy(), quota_project_id=self.quota_project_id, )
Create a copy of these credentials with the specified target audience. Args: target_audience (str): The intended audience for these credentials, used when requesting the ID Token. Returns: google.auth.service_account.IDTokenCredentials: A new credentials instance.
625941ee92d797404e3046e0
def choose_leaf(self, E): <NEW_LINE> <INDENT> current_tree = self.head <NEW_LINE> while True: <NEW_LINE> <INDENT> if isinstance(current_tree, LeafNode): <NEW_LINE> <INDENT> return current_tree <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> F = RTree.min_increase(current_tree, E) <NEW_LINE> current_tree = F
Choose a leaf node in self to insert E. :param self: an RTree object :param E: an object of shape classes :return a leaf node in self
625941ee67a9b606de4a840a
def get_patch_data(self, data, patch_size=5, debug=False, is_rotate=False): <NEW_LINE> <INDENT> assert isinstance(data.flatten()[0], float) <NEW_LINE> dx = patch_size // 2 <NEW_LINE> data_add_zeros = self.data_add_zero(data=data, patch_size=patch_size) <NEW_LINE> for i in range(dx): <NEW_LINE> <INDENT> data_add_zeros[:...
:param data: m x n x c :param patch_size: :param debug: :param var: :return: m x n x patch_size x patch_size x c
625941eebd1bec0571d90b83
def send_check_result(self, target, hostname, ping_ret, onlywarn=True): <NEW_LINE> <INDENT> if ping_ret != 0: <NEW_LINE> <INDENT> self.write_msg(target, config.WARNMSG_1.format(hostname)) <NEW_LINE> self.write_msg(target, config.WARNMSG_2.format(ping_ret)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not onlywarn: ...
Send results.
625941ee4e696a04525c99a1
def get_next_gen_batch(self): <NEW_LINE> <INDENT> if self.indexes["gen"] >= self.gen_data_size: <NEW_LINE> <INDENT> self.indexes["gen"] = 0 <NEW_LINE> <DEDENT> x_input_batch_a = self.datasets["gen"][self.indexes["gen"]:self.indexes["gen"]+self.batch_size] <NEW_LINE> self.indexes["gen"] += self.batch_size <NEW_LINE> ret...
Provides a batch that contains data to be used for generation :return: A data batch to use for generation
625941ee6e29344779a62b64
def unsubtract(self, id=None): <NEW_LINE> <INDENT> if (self._get_pha_data(id).subtracted is False): <NEW_LINE> <INDENT> raise DataErr( 'subtractset', 'data set', str(self._fix_id(id)), 'False') <NEW_LINE> <DEDENT> self._get_pha_data(id).unsubtract()
Undo any background subtraction for the data set. The `unsubtract` function undoes any changes made by `subtract`. After this command, anything that uses the data set - such as a plot, fit, or error analysis - will use the original data values. Models should be re-fit if `subtract` is called. Parameters ---------- id...
625941ee99fddb7c1c9de8e2
def init_sims(self, replace=False): <NEW_LINE> <INDENT> super(FastTextKeyedVectors, self).init_sims(replace) <NEW_LINE> if getattr(self, 'vectors_ngrams_norm', None) is None or replace: <NEW_LINE> <INDENT> logger.info("precomputing L2-norms of ngram weight vectors") <NEW_LINE> if replace: <NEW_LINE> <INDENT> for i in r...
Precompute L2-normalized vectors. If `replace` is set, forget the original vectors and only keep the normalized ones = saves lots of memory! Note that you **cannot continue training** after doing a replace. The model becomes effectively read-only = you can only call `most_similar`, `similarity` etc.
625941ee090684286d50f242
def write(self, out, relax=True): <NEW_LINE> <INDENT> return self._controller.write(self._address+self._shift, out, relax=relax)
Write one or more bytes to a remote slave :param out: the byte buffer to send :type out: array or bytes or list(int) :param bool relax: whether to relax the bus (emit STOP) or not :raise I2cIOError: if device is not configured or input parameters are invalid
625941eeadb09d7d5db6cce0
def aes_encrypt(data, key): <NEW_LINE> <INDENT> cipher = Cipher(AES(key), CBC(generate_aes_iv(key)), backend=default_backend()) <NEW_LINE> padded_data = pad(data) <NEW_LINE> encryptor = cipher.encryptor() <NEW_LINE> return encryptor.update(padded_data) + encryptor.finalize()
Return a version of the data that has been encrypted
625941ee5fdd1c0f98dc0789
def set_text(self, text): <NEW_LINE> <INDENT> self.text = text
Change text.
625941eea934411ee3751be9
def _replace_invalid_chars(self, name: str) -> str: <NEW_LINE> <INDENT> name = re.sub('[<>]', '', name) <NEW_LINE> name = re.sub('[&]', 'AND', name) <NEW_LINE> return name
Replacing invalid characters. Args: name: String where the invalid characters should be replaced. Returns: Valid string for xgmml files.
625941ee63f4b57ef000165d
def fix_case(self): <NEW_LINE> <INDENT> circuit = self.circuit <NEW_LINE> element_translation = {element.lower():element for element in circuit.element_names()} <NEW_LINE> node_translation = {node.lower():node for node in circuit.node_names()} <NEW_LINE> for variable in self.variables.values(): <NEW_LINE> <INDENT> vari...
Ngspice return lower case names. This method fixes the case of the variable names.
625941ee9c8ee82313fbbccb
def __init__(self, id=None, from_number=None, to_number=None, message=None, created_at=None, updated_at=None): <NEW_LINE> <INDENT> self.swagger_types = { 'id': 'str', 'from_number': 'str', 'to_number': 'str', 'message': 'str', 'created_at': 'str', 'updated_at': 'str' } <NEW_LINE> self.attribute_map = { 'id': 'id', 'fro...
Incomingtext - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
625941ee8a43f66fc4b545b3
def allPossibleFBT(self, N): <NEW_LINE> <INDENT> if N % 2 == 0: return [] <NEW_LINE> def helper(n): <NEW_LINE> <INDENT> if n == 1: <NEW_LINE> <INDENT> return [TreeNode(0)] <NEW_LINE> <DEDENT> i, res = 1, [] <NEW_LINE> while i < n - 1: <NEW_LINE> <INDENT> left, right = helper(i), helper(n - 1 - i) <NEW_LINE> for x in le...
:type N: int :rtype: List[TreeNode]
625941ee6fb2d068a760f5fa
def get_output_bit_packing_type_increment(self): <NEW_LINE> <INDENT> return self.get_param('output_bit_packing_type:inc')
Data packing type. Some cameras supports only specific packing type.XI_PRM_OUTPUT_DATA_PACKING_TYPE
625941eebe8e80087fb2118e
def reach_elevations_decrease_downstream(reach_data): <NEW_LINE> <INDENT> rd = reach_data.reset_index() <NEW_LINE> return check_monotonicity(rd.rno, rd.outreach, rd.strtop)
Verify that reach values decrease monotonically in the downstream direction.
625941ee73bcbd0ca4b2c5c9
def test_a_name(): <NEW_LINE> <INDENT> html = '<a name="foo">bar</a>' <NEW_LINE> eq_(html, bleach.delinkify(html))
Don't screw with non-link <a> tags.
625941eed268445f265b53c3
def __str__(self): <NEW_LINE> <INDENT> return self.army_str()
Returns a string representation of the settings in army format.
625941eee76e3b2f99f3ad56
def is_add_right(self, index): <NEW_LINE> <INDENT> return self.compare(index, '>=', 'insert')
It returns True if the cursor is positioned at the left of the initial selection mark. It is useful for sel_right method.
625941ee1d351010ab85606f
def croptobbox(img, border=None): <NEW_LINE> <INDENT> min1,max1,min2,max2 = bbox(img, border=border) <NEW_LINE> return img[min1:max1,min2:max2]
nimg = croptobbox(img, border=0) Returns a version of img cropped to the image's bounding box Parameters ---------- img : ndarray Integer image array border : int, optional whether to add a border (default no border) Returns ------- nimg : ndarray A subimage of img. Bugs ---- Note that the border is on ...
625941ee32920d7e50b28729
def delete(self, request): <NEW_LINE> <INDENT> result = {} <NEW_LINE> data = QueryDict(request.body.decode('utf-8')) <NEW_LINE> if 'id' in data: <NEW_LINE> <INDENT> categoryid = data['id'] <NEW_LINE> try: <NEW_LINE> <INDENT> print(categoryid) <NEW_LINE> category = Category.objects.get(id=categoryid) <NEW_LINE> category...
删除指定分类
625941ee7d43ff24873a31f9
def multiplesOf3and5(n) -> int: <NEW_LINE> <INDENT> if type(n) is not type(int()): <NEW_LINE> <INDENT> raise ValueError("Input must be of type int.") <NEW_LINE> <DEDENT> multiples_of_3 = {*range(3, n, 3)} <NEW_LINE> multiples_of_5 = {*range(5, n, 5)} <NEW_LINE> return sum(multiples_of_3.union(multiples_of_5))
Returns the sum of all the multiples of 3 or 5 below n.
625941ee82261d6c526ab9fc
def test_float_range(self): <NEW_LINE> <INDENT> field = Float() <NEW_LINE> self.assertIsInstance(field, Range)
A Float is a kind of Range
625941ee3d592f4c4ed1d5b3
def minPathSum(self, grid): <NEW_LINE> <INDENT> if grid is None: return 0 <NEW_LINE> m = len(grid) <NEW_LINE> n = len(grid[0]) <NEW_LINE> dp = [[0] * n for i in range(m)] <NEW_LINE> dp[m-1][n-1] = grid[m-1][n-1] <NEW_LINE> def minPath(i, j): <NEW_LINE> <INDENT> if dp[i][j] != 0: <NEW_LINE> <INDENT> return dp[i][j] <NEW...
:type grid: List[List[int]] :rtype: int
625941ee45492302aab5e81d
def completed(self, on_rating=2): <NEW_LINE> <INDENT> self.rating = on_rating
Completed the level with a "on_rating" rating.
625941eef548e778e58cdad4
def __init__(self, inDict=None): <NEW_LINE> <INDENT> self.dict = {} <NEW_LINE> if inDict is not None: <NEW_LINE> <INDENT> for key in inDict: <NEW_LINE> <INDENT> k = key.lower() <NEW_LINE> self.dict[k] = (key, inDict[key]) <NEW_LINE> <DEDENT> <DEDENT> self.keyList = self.dict.keys() <NEW_LINE> return
Constructor: takes conventional dictionary as input (or nothing).
625941ee566aa707497f4ab5
def set_points(polyline): <NEW_LINE> <INDENT> if polyline is not None: <NEW_LINE> <INDENT> points = pl.decode(polyline.data) <NEW_LINE> y_range, x_range = interpolate.dimensions(points) <NEW_LINE> g['y_range'] = y_range <NEW_LINE> g['x_range'] = x_range <NEW_LINE> g['points'] = [(y, -x) for (x, y) in points] <NEW_LINE>...
Given a polyline as a ROS message, normalize and store the points.
625941ee26238365f5f0f3ca
def getlistofpossibletitles(fileitem, oddtitles): <NEW_LINE> <INDENT> title = [] <NEW_LINE> myvalue = "" <NEW_LINE> try: <NEW_LINE> <INDENT> fileitem.decode('utf-8') <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> title.append(fileitem) <NEW_LINE> lookfor = fileitem.replace("."," ") <NEW_LINE> ...
Create list of possible names for the directory based on the original filename Args: fileitem - title of the media item. Used to determine what show is in the subdirectory shows - List of all the media directories (which should represent shows) Returns: A python list of possible media directory n...
625941ee5166f23b2e1a56ad
def read_csv(input_file): <NEW_LINE> <INDENT> df = load_csv(input_file,header=0).fillna('|') <NEW_LINE> jobcontent = df['content'].tolist() <NEW_LINE> jlabel = df.loc[:,hp.label_vocabulary].values <NEW_LINE> lines = [[jlabel[i],jobcontent[i]] for i in range(len(jlabel)) if type(jobcontent[i])==str] <NEW_LINE> return li...
Reads a tab separated value file.
625941ee462c4b4f79d1dc24
def add_jwt(timestamp, target, tag, jwt_secret): <NEW_LINE> <INDENT> jwt_exp = datetime.fromtimestamp(timestamp) + timedelta(days=JWT_VALID_DAYS) <NEW_LINE> jwt_claims = { "exp": jwt_exp, "nbf": timestamp, "iat": timestamp, ATTR_TARGET: target, ATTR_TAG: tag, } <NEW_LINE> return jwt.encode(jwt_claims, jwt_secret)
Create JWT json to put into payload.
625941eea4f1c619b28b0580
def _setup_partials(self, recurse=True): <NEW_LINE> <INDENT> super(ExplicitComponent, self)._setup_partials() <NEW_LINE> abs2meta_out = self._var_abs2meta['output'] <NEW_LINE> abs2prom_out = self._var_abs2prom['output'] <NEW_LINE> other_names = [] <NEW_LINE> for out_abs in self._var_abs_names['output']: <NEW_LINE> <IND...
Call setup_partials in components. Parameters ---------- recurse : bool Whether to call this method in subsystems.
625941ee377c676e912726fb
def get_game_state(self): <NEW_LINE> <INDENT> return self._game_state
Simply returns the status of the game. Either 'UNFINISHED', 'BLACK_WON', or 'WHITE_WON'.
625941eec4546d3d9de72f8d
def record_timestamp(filepath): <NEW_LINE> <INDENT> file_obj = open(filepath, 'a') <NEW_LINE> file_obj.write('%f\n' % time.time()) <NEW_LINE> file_obj.close()
Appends a line to `filepath` that contains the return value of time.time()
625941ee0a50d4780f6673eb
def test_equilateral_list(self): <NEW_LINE> <INDENT> result = get_triangle_type([1, 1, 1]) <NEW_LINE> self.assertEqual(result, 'equilateral')
Triangle test
625941ee66656f66f7cbc702
def test_filter_semvers_only(): <NEW_LINE> <INDENT> input_list = [ 'v1.2', '1.4', '0.1.2', '99.88.77-654321', '22.33.1-YADA', '1.2.3_5', ] <NEW_LINE> expected = [ '0.1.2', '99.88.77-654321', '22.33.1-YADA', ] <NEW_LINE> assert expected == TagFilter().matching_only(input_list)
Test only semver-compliant versions are returned by only_semvers
625941ee8a43f66fc4b545b4
def fix_html(x:str) -> str: <NEW_LINE> <INDENT> re1 = re.compile(r' +') <NEW_LINE> x = x.replace('#39;', "'").replace('amp;', '&').replace('#146;', "'").replace( 'nbsp;', ' ').replace('#36;', '$').replace('\\n', "\n").replace('quot;', "'").replace( '<br />', "\n").replace('\\"', '"').replace('<unk>',UNK).replace(' @.@...
List of replacements from html strings in `x`.
625941ee3346ee7daa2b32c5
def _find_annotated_funcs(clsattrs, annotation): <NEW_LINE> <INDENT> funcs = (func for func in clsattrs.itervalues() if getattr(func, annotation, None) is not None) <NEW_LINE> return funcs
Return a (generated) list of methods that include the given annotation.
625941ee4f88993c3716c5b6
def start_init(): <NEW_LINE> <INDENT> current_budget = input("Please, input your current budget\n") <NEW_LINE> return int(current_budget)
ask user to enter the starting budget
625941ee851cf427c661aa5e
def shapefile(x): <NEW_LINE> <INDENT> file_exists(x, "shapefile") <NEW_LINE> with fiona.open(x,'r') as fid: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> return x
Type for argparse - checks that file exists and can be opened by fiona.
625941ee7cff6e4e81117eda
def test_nb3(self): <NEW_LINE> <INDENT> with self.fopen(u'test3.ipynb', u'r') as f: <NEW_LINE> <INDENT> nb = read(f, as_version=4) <NEW_LINE> <DEDENT> validate(nb) <NEW_LINE> self.assertEqual(isvalid(nb), True)
Test that a v3 notebook passes validation
625941ee187af65679ca5674
def _upload_photo(self, user, file_path): <NEW_LINE> <INDENT> data = {'full_name': user.userprofile.full_name, 'email': user.email, 'username': user.username, 'lat': 40.005814, 'lng': -3.42071, 'photo': open(file_path, 'rb'), 'externalaccount_set-MAX_NUM_FORMS': '1000', 'externalaccount_set-INITIAL_FORMS': '0', 'extern...
Helper for the next methods.
625941eebe7bc26dc91cdb4a
def hex_str_to_arr(txt: str, required_len=None) -> list: <NEW_LINE> <INDENT> assert (txt[:2] == "0x") <NEW_LINE> txt = txt[2:] <NEW_LINE> if required_len: <NEW_LINE> <INDENT> assert (len(txt) == required_len) <NEW_LINE> <DEDENT> arr = [] <NEW_LINE> for i in range(len(txt) // 16): <NEW_LINE> <INDENT> arr.append(int("0x"...
Convert hex string into an array of 64-bit words Args: txt: a hex string (at least 0 bits) required_len: len of txt Returns: arr: input as list of 64-bit words
625941eeab23a570cc2506dc
def getOrbitMatrix(self, density_matrix, Upsilon): <NEW_LINE> <INDENT> return _numpy.column_stack(( _numpy.ones(len(density_matrix)), density_matrix ))
Produce the matrix of orbit contributions to each of the constraints from the matrix recorded during orbit integration by the Target object
625941ee3cc13d1c6d3c78cc
def __init__(self): <NEW_LINE> <INDENT> pass
initialise's the class
625941ee16aa5153ce3629cd
def get_rs_conf_json(self): <NEW_LINE> <INDENT> host = self.active_nodes[0] <NEW_LINE> index = self.mongo_hosts.index(host) <NEW_LINE> port = self.mongo_ports[index] <NEW_LINE> cmd = AVX_Path + '/db/mongodb/bin/mongo --port ' + port + ' ' + self.db_name + ' -u ' + self.db_user + ' -p ' + self.db_p...
Function to get the json from active dbs.
625941eed8ef3951e3243a92