code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def evaluate(self, point): <NEW_LINE> <INDENT> x = point[0] - self.x0 <NEW_LINE> y = point[1] - self.y0 <NEW_LINE> z = point[2] - self.z0 <NEW_LINE> return x**2 + y**2 + z**2 - self.r**2
Evaluate the surface equation at a given point. Parameters ---------- point : 3-tuple of float The Cartesian coordinates, :math:`(x',y',z')`, at which the surface equation should be evaluated. Returns ------- float :math:`(x' - x_0)^2 + (y' - y_0)^2 + (z' - z_0)^2 - r^2`
625941e3656771135c3ebc62
def totime(req, key): <NEW_LINE> <INDENT> value = req.get_argument(key, '') <NEW_LINE> if not value: <NEW_LINE> <INDENT> realtime = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> tmptime = datetime.datetime.strptime(value, '%Y-%m-%d %H:%M:%S') <NEW_LINE> realtime = time.mktime(tmptime.timetuple()) <NEW_LINE> <DEDENT> ...
接收并处理时间数据 将接收到的(%Y-%m-%d %H:%M:%S)时间字符串转换为time格式 Args: req: RequestHandler对象 key: 表单对象的name属性,字段名 Returns: time类型数据
625941e3f8510a7c17cf9aee
@marc21_authority.over('subdivision_usage', '^073..') <NEW_LINE> @utils.filter_values <NEW_LINE> def subdivision_usage(self, key, value): <NEW_LINE> <INDENT> field_map = { 'a': 'subdivision_usage', 'z': 'code_source', '6': 'linkage', '8': 'field_link_and_sequence_number', } <NEW_LINE> order = utils.map_order(field_map,...
Subdivision Usage.
625941e3f7d966606f6aa3f8
def test_scrap_for_posts_no_pages_specified(self): <NEW_LINE> <INDENT> url = "https://hitomi.la/reader/1305683.html#1" <NEW_LINE> response = self.hit.scrap_for_posts(url, 2, 1, 1) <NEW_LINE> pat = re.compile(r'\bhttps:\/\/[ab]*a\.hitomi\.la\/galleries\/[\d]+\/[\S]+\b') <NEW_LINE> for post in response: <NEW_LINE> <INDEN...
Tests scrap_for_posts returns valid post urls using a regular expression, with no pages specified
625941e3a8370b7717052c8c
def handle_remove_user(self, p_, args): <NEW_LINE> <INDENT> group_factory = p_.rpc.get_connection('group_factory') <NEW_LINE> group = group_factory.get_object_by_name(args.name) <NEW_LINE> p_.rpc.annotate_object(group) <NEW_LINE> user_factory = p_.rpc.get_connection('user_factory') <NEW_LINE> if args.virtual_machine: <...
Perform removal of user from group.
625941e3ac7a0e7691ed44b4
def connect(self,idn_message=b'*IDN?\r'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> p = Serial(self.port, self.baudrate, timeout=self.timeout) <NEW_LINE> p.write(idn_message) <NEW_LINE> s = p.readline().decode() <NEW_LINE> if '*IDN?' in s: <NEW_LINE> <INDENT> p.write(b'system:echo off\r') <NEW_LINE> p.readline().dec...
tries to connect port. idn_message - message to be sent to devise to identify it If connected returns 0, if not - value < 0
625941e3b7558d58953c52fb
def setup(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> imap = imaplib.IMAP4(config.ini['screen_default']['server']) <NEW_LINE> imap.login(config.ini['screen_default']['user'], config.ini['screen_default']['password']) <NEW_LINE> imap.select('Inbox',readonly=True) <NEW_LINE> for sender in config.ini['screen_default']...
Initialises values
625941e3c432627299f05038
def traversegroups(group, headerlevel): <NEW_LINE> <INDENT> string = '' <NEW_LINE> checklist = [] <NEW_LINE> for key, members in sorted(group.items(), key=lambda x: len(x[1]) > 0): <NEW_LINE> <INDENT> name = data.groupnames[key] <NEW_LINE> if members: <NEW_LINE> <INDENT> if checklist: <NEW_LINE> <INDENT> string += '<di...
Recursive traversal of groups, outputs headers and checkboxen
625941e34d74a7450ccd45b3
def merge(self, max_qual, fraction_agree): <NEW_LINE> <INDENT> (base,qual_sum) = ('N',2) <NEW_LINE> bases_set = set(self.bases()) <NEW_LINE> if len(bases_set) == 1: <NEW_LINE> <INDENT> base = bases_set.pop() <NEW_LINE> qual_sum = sum(self.quals()) <NEW_LINE> if qual_sum > max_qual: <NEW_LINE> <INDENT> qual_sum = max_qu...
:type max_qual: int :type fraction_agree: float :return: PileupElement
625941e37d43ff24873a3092
def test_get_event_list_eid_error(self): <NEW_LINE> <INDENT> r = requests.get(self.base_url, auth=self.auth_user, params={'eid':901}) <NEW_LINE> result = r.json() <NEW_LINE> self.assertEqual(result['status'], 10022) <NEW_LINE> self.assertEqual(result['message'], 'query result is empty')
eid=901 查询结果为空
625941e323849d37ff7b347c
def remapEntries(self, mapping=Mapping(), mode=None): <NEW_LINE> <INDENT> mappingFromFiles = Mapping() <NEW_LINE> for dirname in hooks.customisationDirs: <NEW_LINE> <INDENT> self._readRemapFile(dirname, mappingFromFiles, mode) <NEW_LINE> <DEDENT> mapping.merge(mappingFromFiles, overwrite=False) <NEW_LINE> self.mapping ...
Allow the user to modify entries in the Manifest The mapping is defined by the file userDataDir/manifest.remap, which consists of up to three columns: productName[:version-in-manifest] [[outProductName:]desired-version] [flavor] Comments (starting with #) are skipped If version-in-manifest is "Any" the desired-...
625941e3925a0f43d254a26a
def updatevalidationdata(self): <NEW_LINE> <INDENT> monolith = self.monolith <NEW_LINE> for instance in monolith.iter(): <NEW_LINE> <INDENT> if (x.lower() in instance.maj_type.lower() for x in (self.defines.defs. schemafilecollectiontype, "Collection.", self.defines.defs.regfilecollectiontype)) and any( x.lower() in ...
Loads the types into the validation manager from monolith.
625941e301c39578d7e7522b
def conv_backward_naive(dout, cache): <NEW_LINE> <INDENT> dx, dw, db = None, None, None <NEW_LINE> x, w, b, conv_param = cache <NEW_LINE> N, C, H, W = x.shape <NEW_LINE> F, _, HH, WW = w.shape <NEW_LINE> _, _, H_, W_ = dout.shape <NEW_LINE> pad = conv_param['pad'] <NEW_LINE> stride = conv_param['stride'] <NEW_LINE> dw ...
A naive implementation of the backward pass for a convolutional layer. Inputs: - dout: Upstream derivatives. - cache: A tuple of (x, w, b, conv_param) as in conv_forward_naive Returns a tuple of: - dx: Gradient with respect to x - dw: Gradient with respect to w - db: Gradient with respect to b
625941e39c8ee82313fbbb65
def check_permission_safety(path): <NEW_LINE> <INDENT> f_stats = os.stat(path) <NEW_LINE> return (f_stats.st_mode & (stat.S_IRWXG | stat.S_IRWXO)) == 0 and f_stats.st_uid == os.getuid()
Check if the file at the given path is safe to use as a state file. This checks that group and others have no permissions on the file and that the current user is the owner.
625941e3097d151d1a223247
def set_RefreshToken(self, value): <NEW_LINE> <INDENT> super(ListChildrenInputSet, self)._set_input('RefreshToken', value)
Set the value of the RefreshToken input for this Choreo. ((conditional, string) An OAuth refresh token used to generate a new access token when the original token is expired. Required unless providing a valid AccessToken.)
625941e3cad5886f8bd273c8
def exist(self, board, word): <NEW_LINE> <INDENT> if len(board) == 0 or len(board[0]) == 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> numRows = len(board) <NEW_LINE> numCols = len(board[0]) <NEW_LINE> def dfs(row, col, level): <NEW_LINE> <INDENT> if level == len(word): <NEW_LINE> <INDENT> return True <NEW_LI...
:type board: List[List[str]] :type word: str :rtype: bool
625941e36e29344779a629ff
def edit_entry(entry, entry_id): <NEW_LINE> <INDENT> editing = True <NEW_LINE> while editing: <NEW_LINE> <INDENT> clear_screen() <NEW_LINE> print_entry(entry) <NEW_LINE> print(edit_menu()) <NEW_LINE> edit_choice = input("> ") <NEW_LINE> if edit_choice.lower() == "a": <NEW_LINE> <INDENT> entry = edit_value(entry_id, 'Da...
Continously prompt user to edit entry. :param entry: Entry marked for editing :param entry_id: int that is primary id of entry :return: None
625941e3d53ae8145f87a658
def get_same_day_routes(self): <NEW_LINE> <INDENT> station_route_data = self.get_station_data() <NEW_LINE> if station_route_data.empty: <NEW_LINE> <INDENT> raise ValueError("Searched station not found, please try another") <NEW_LINE> <DEDENT> if type(self.search_time) != type(datetime.now()): <NEW_LINE> <INDENT> self.c...
Filter Dataframe for weekday that routes run.
625941e3ec188e330fd5ab87
def __init__(self, type=None, content=None, name=None): <NEW_LINE> <INDENT> if type is not None: <NEW_LINE> <INDENT> assert 0 <= type < 256, type <NEW_LINE> <DEDENT> if content is not None: <NEW_LINE> <INDENT> assert isinstance(content, basestring), repr(content) <NEW_LINE> <DEDENT> self.type = type <NEW_LINE> self.con...
Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key.
625941e392d797404e30457b
def get_link_rate(self): <NEW_LINE> <INDENT> if (self.link == None): <NEW_LINE> <INDENT> return 0.0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.link.get_link_rate()
Returns the transmission rate of the outbound link.
625941e3d486a94d0b98e536
def webhooks(self): <NEW_LINE> <INDENT> for repository in self.watching: <NEW_LINE> <INDENT> print("[+] repository: %s, setting up webhook" % repository) <NEW_LINE> target = self.root.config['public-host'] + '/hook/kernel' <NEW_LINE> self.webhook_repository(repository, target) <NEW_LINE> <DEDENT> return True
Auto-configure watching repositories for webhook
625941e38e7ae83300e4b3bd
def isNStraightHand(self, hand, groupSize): <NEW_LINE> <INDENT> n = len(hand) <NEW_LINE> if n % groupSize != 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> hand.sort() <NEW_LINE> for i in range(n // groupSize): <NEW_LINE> <INDENT> start = hand[0] <NEW_LINE> hand.remove(start) <NEW_LINE> j = 1 <NEW_LINE> while ...
Inputs: hand: list[int] groupSize: int Outputs: res: bool
625941e326068e7796caf0d5
def require_setting(self, name, feature="this feature"): <NEW_LINE> <INDENT> if name not in self.settings: <NEW_LINE> <INDENT> raise Exception("You must define the '%s' setting in your " "application to use %s" % (name, feature))
Raises an exception if the given app setting is not defined.
625941e3fbf16365ca6f65bb
def test_notification_duplicate_registration_id(self, gcm_mock): <NEW_LINE> <INDENT> self.set_up_notifier() <NEW_LINE> self.target_chat_room.members.add(self.sender) <NEW_LINE> self.target_chat_room.members.add(self.members[0]) <NEW_LINE> self.members[0].registration_ids.append( self.members[0].registration_ids[0]) <NE...
Tests that a notification is sent only once for each unique registration ID, disregarding possible duplicates.
625941e33539df3088e2e73b
def playlist_change_details( self, playlist_id, name=None, public=None, collaborative=None, description=None, ): <NEW_LINE> <INDENT> data = {} <NEW_LINE> if isinstance(name, six.string_types): <NEW_LINE> <INDENT> data["name"] = name <NEW_LINE> <DEDENT> if isinstance(public, bool): <NEW_LINE> <INDENT> data["public"] = p...
Changes a playlist's name and/or public/private state Parameters: - playlist_id - the id of the playlist - name - optional name of the playlist - public - optional is the playlist public - collaborative - optional is the playlist collaborative - description - optional description of the playlist
625941e3eab8aa0e5d26df49
def p_expect_data_many(self, p): <NEW_LINE> <INDENT> p[0] = p[1] + [p[2]]
expect_data : expect_data expect_datum
625941e3ac7a0e7691ed44b5
def on_intent(intent_request, session): <NEW_LINE> <INDENT> print("on_intent requestId=" + intent_request['requestId'] + ", sessionId=" + session['sessionId']) <NEW_LINE> intent = intent_request['intent'] <NEW_LINE> intent_name = intent_request['intent']['name'] <NEW_LINE> if intent_name == "CalculateRetirementTime": <...
Called when the user specifies an intent for this skill
625941e315fb5d323cde0f04
def rvs(self, loc=None, shape=1, df=1, size=1, random_state=None): <NEW_LINE> <INDENT> dim, loc, shape, df = self._process_parameters(loc, shape, df) <NEW_LINE> if random_state is not None: <NEW_LINE> <INDENT> rng = check_random_state(random_state) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rng = self._random_state ...
Draw random samples from a multivariate t-distribution. Parameters ---------- %(_mvt_doc_default_callparams)s size : integer, optional Number of samples to draw (default 1). %(_doc_random_state)s Returns ------- rvs : ndarray or scalar Random variates of size (`size`, `P`), where `P` is the dimension of t...
625941e39b70327d1c4e11c7
def export(self): <NEW_LINE> <INDENT> if self.file is not None: <NEW_LINE> <INDENT> new_file = os.path.join(self.export_dir, "DesignMatrix.png") <NEW_LINE> orig_filename, filename = self.copy_nifti(self.file, new_file) <NEW_LINE> self.p.entity(self.id, other_attributes={ PROV['type']: NIDM['Image'], PROV['atLocation']:...
Create prov entity.
625941e3435de62698dfe03d
def __init__( self, loop, hostname='localhost', port=1883, username=None, password=None, use_tls=False, ca_certs=None, tls_version=ssl.PROTOCOL_TLSv1_2, client_id='', topics={}, clean_session=True, ping_interval=2, ping_timeout=1 ): <NEW_LINE> <INDENT> self.loop = loop <NEW_LINE> self.client_id = client_id <NEW_LINE> s...
Initialize client state.
625941e38c3a8732951587af
def false(self, ax, data, **kwargs): <NEW_LINE> <INDENT> order = kwargs.pop('order', (0, 1, 2)) <NEW_LINE> hide_outliers = kwargs.pop('hide_outliers', False) <NEW_LINE> vmin = kwargs.pop('vmin', 0.) <NEW_LINE> vmax = kwargs.pop('vmax', 1.) <NEW_LINE> assert len(order) == 3 <NEW_LINE> order = order + (0,) <NEW_LINE> col...
Plot field on map projection as false-colour pcolormesh().
625941e373bcbd0ca4b2c465
def test_is_not_listed_not_unique_name_bug_1173607(self): <NEW_LINE> <INDENT> Addon.from_upload(self.get_upload('extension.xpi'), [self.platform], is_listed=False)
An unlisted add-on should be able to choose any name.
625941e391f36d47f21ac8e6
@unwrap_spec(level=int, method=int, wbits=int, memLevel=int, strategy=int) <NEW_LINE> def Compress___new__(space, w_subtype, level=rzlib.Z_DEFAULT_COMPRESSION, method=rzlib.Z_DEFLATED, wbits=rzlib.MAX_WBITS, memLevel=rzlib.DEF_MEM_LEVEL, strategy=rzlib.Z_DEFAULT_STRATEGY): <NEW_LINE> <INDENT> stream = space.allocate_in...
Create a new z_stream and call its initializer.
625941e3adb09d7d5db6cb7d
def configure_template_filters(app): <NEW_LINE> <INDENT> app.jinja_env.filters['markup'] = render_markup <NEW_LINE> app.jinja_env.filters['format_date'] = format_date <NEW_LINE> app.jinja_env.filters['time_since'] = time_since <NEW_LINE> app.jinja_env.filters['is_online'] = is_online <NEW_LINE> app.jinja_env.filters['c...
Configures the template filters
625941e3b57a9660fec33c7a
def __init__(self, device = 'Dev1', port = 1, rewardline = 0): <NEW_LINE> <INDENT> self.device = device <NEW_LINE> self.port = port <NEW_LINE> self.rewardline = rewardline <NEW_LINE> self.dout = do(device,port) <NEW_LINE> self.on = 0 <NEW_LINE> self.off = 1 <NEW_LINE> self.rewardtime = 0.2 <NEW_LINE> self.rewardcount =...
Construct reward
625941e3377c676e91272597
def subscribe(self, path, scope=SCOPE.LOCAL, regex_flag=False): <NEW_LINE> <INDENT> self._send(cmd='SUBSCRIBE', args=[path, scope.value, str(regex_flag)])
Sends SUBSCRIBE to tega REST server.
625941e33cc13d1c6d3c7768
def test_FunctionDisconnect(self): <NEW_LINE> <INDENT> funcSignal = PySignal.Signal() <NEW_LINE> funcSignal.connect(testFunc) <NEW_LINE> funcSignal.disconnect(testFunc) <NEW_LINE> self.assertEqual(len(funcSignal._slots), 0, "Slot was not removed from signal")
Test disconnecting function
625941e315baa723493c4368
def cluster_graph(self): <NEW_LINE> <INDENT> clu = ClusterWithAnnotations( self.graph, self.cell_types_atlas, resolution_parameter=self.resolution_parameter, metric=self.clustering_metric, ) <NEW_LINE> self.membership = clu.fit_transform()
Compute communities from a matrix with fixed nodes Returns: None, but Subsample.membership is set as an array of int with size N - n_fixed with the community/cluster membership of all columns except the first n_fixed ones.
625941e3fff4ab517eb2f82e
def try_shutdown(self): <NEW_LINE> <INDENT> if self.__context is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> with self.__context, self._lock: <NEW_LINE> <INDENT> if self.__context.ok(): <NEW_LINE> <INDENT> self.__context.shutdown() <NEW_LINE> self._call_on_shutdown_callbacks() <NEW_LINE> self._logging_fini()
Shutdown this context, if not already shutdown.
625941e34c3428357757c716
def tabuleiro_celula(tab,coor): <NEW_LINE> <INDENT> return tab[coordenada_para_str(coor)]
tabuleiro_celula: tabuleiro x coordenada -> celula funcao que devolve a celula presente na coordenada introduzida do tabuleiro introduzido
625941e35166f23b2e1a5549
def queue_up_new_game(self, blocking=True): <NEW_LINE> <INDENT> if self.logged_in is False or self._uguid is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> cmd = 'queue_up' <NEW_LINE> game_id = self._getString(cmd) <NEW_LINE> if blocking: <NEW_LINE> <INDENT> while game_id == 'queued_for_game': <NEW_LINE> <I...
Request a new game from the server against a random player. Returns: String: The guid of the new game
625941e34a966d76dd551403
def t000001_x36(): <NEW_LINE> <INDENT> MainBonfireMenuFlag() <NEW_LINE> while True: <NEW_LINE> <INDENT> ClearTalkListData() <NEW_LINE> AddTalkListDataIf(f124(1) == 1, 1, 15001001, 6001) <NEW_LINE> AddTalkListDataIf(f124(2) == 1, 2, 15001002, 6001) <NEW_LINE> AddTalkListDataIf(f124(3) == 1, 3, 15001003, 6001) <NEW_LINE>...
State 0,14
625941e38da39b475bd65369
def displayVolume(image, title='volume'): <NEW_LINE> <INDENT> image = generalTools.castImage(image, 'uchar') <NEW_LINE> volume, mapper = createVolume(image) <NEW_LINE> ren1 = vtk.vtkRenderer() <NEW_LINE> ren1.AddVolume(volume) <NEW_LINE> renWin = vtk.vtkRenderWindow() <NEW_LINE> renWin.SetSize(700, 700) <NEW_LINE> renW...
display a volume image - image must be a typical irm image with gray values comprised between 0 and 255
625941e321a7993f00bc80e7
def test_astar_correctly_terminates(scramble_complexity_6): <NEW_LINE> <INDENT> from electric_slide.scripts.algorithm import a_star <NEW_LINE> assert a_star(scramble_complexity_6)
Test that astar will correctly solve a scrambled board state.
625941e3d18da76e235328cb
def detector_coordinate2panel_coordinate(self,**kwargs): <NEW_LINE> <INDENT> point = kwargs["point_"] <NEW_LINE> projection_list = [(numpy.inner(numpy.subtract(point,corner),x_axis),numpy.inner(numpy.subtract(point,corner),y_axis)) for (corner,x_axis,y_axis) in zip(self.detector.corner_xy,self.detector.fs,self.detector...
arguments: {point_}
625941e30a50d4780f667286
def __init__( self, *, properties: Optional["BindingResourceProperties"] = None, **kwargs ): <NEW_LINE> <INDENT> super(BindingResource, self).__init__(**kwargs) <NEW_LINE> self.properties = properties
:keyword properties: Properties of the Binding resource. :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties
625941e33c8af77a43ae3b95
def globals(self, env): <NEW_LINE> <INDENT> env.globals['insert_files'] = self._insertFiles <NEW_LINE> env.globals['relpath'] = self._relpath <NEW_LINE> env.globals['breadcrumbs'] = self._breadcrumbs
Defines global template functions. (virtual) Args: env[jinja2.Environment]: Template object for adding global functions.
625941e301c39578d7e7522c
def __decompress_rar(self): <NEW_LINE> <INDENT> rar_file = rarfile.RarFile(self.filepath) <NEW_LINE> self.__check_filename_dir() <NEW_LINE> os.mkdir(os.path.join(self.package_path, self.dir_name)) <NEW_LINE> rar_file.extractall(os.path.join(self.package_path, self.dir_name)) <NEW_LINE> rar_file.close() <NEW_LINE> retur...
extract a rar file.
625941e33317a56b8693a03f
def stop_training(self): <NEW_LINE> <INDENT> self.started_training = False
Stops training the model
625941e3596a897236089eac
def setegid(egid): <NEW_LINE> <INDENT> pass
Set the current process's effective group id. :type egid: int :rtype: None
625941e3004d5f362079a721
@pytest.mark.P1 <NEW_LINE> def test_EI_BC_081(clients_new_node, reset_environment): <NEW_LINE> <INDENT> first_client = clients_new_node[0] <NEW_LINE> second_client = clients_new_node[1] <NEW_LINE> first_economic = first_client.economic <NEW_LINE> first_node = first_client.node <NEW_LINE> second_economic = second_client...
委托多节点,委托犹豫期多次领取 :param clients_new_node: :return:
625941e30fa83653e46573a9
def test_001(self): <NEW_LINE> <INDENT> loginPage(self.driver).login("admin","admin") <NEW_LINE> driver = self.driver <NEW_LINE> sku_attribute = { u'颜色' : u'蓝色', u'尺寸' : u'38'} <NEW_LINE> self.new_sku_one(u"即食柠檬即食柠檬即食柠檬即食柠檬即食柠檬即食柠檬即食柠檬即食柠檬即食柠檬即食柠檬",u"柠檬柠檬柠檬柠檬柠檬柠檬柠檬柠檬柠檬柠檬",True,0.01,0.01,**sku_attribute) <NEW_...
三方商户管理员:最长长名称+最长短名称+要邮寄+非0单价+非0邮费+多个SKU属性+支持退货+存在三方商家SKU编号
625941e3b7558d58953c52fc
@assert_no_logs <NEW_LINE> def test_css_parsing(): <NEW_LINE> <INDENT> def check_css(css): <NEW_LINE> <INDENT> h1_rule, = css.matcher.lower_local_name_selectors['h1'] <NEW_LINE> assert h1_rule[3] == 'before' <NEW_LINE> assert h1_rule[4][0][0] == 'content' <NEW_LINE> assert h1_rule[4][0][1][0][1] == 'I løvë Unicode' <NE...
Test the constructor for the CSS class.
625941e371ff763f4b549a83
def findLengthOfShortestSubarray(self, arr): <NEW_LINE> <INDENT> j = -1 <NEW_LINE> for j in reversed(xrange(1, len(arr))): <NEW_LINE> <INDENT> if arr[j-1] > arr[j]: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> result = j <NEW_LINE> for i in xrange(j): <NE...
:type arr: List[int] :rtype: int
625941e391af0d3eaac9be0d
def get_form(self): <NEW_LINE> <INDENT> form = super(ProcessOrder, self).get_form() <NEW_LINE> form.fields['crate'].queryset = Crate.objects.filter(at_user=None).filter(at_distributer=None).filter(in_repairs=False) <NEW_LINE> return form
get form to change fields
625941e385dfad0860c3b24c
def save_aggregate_scores(self): <NEW_LINE> <INDENT> approx_number_of_experiment_sessions, all_accuracy = self.get_aggregate_scores() <NEW_LINE> self.misc = (approx_number_of_experiment_sessions, all_accuracy) <NEW_LINE> self.save()
Save aggregate scores. If there are aggregate scores, save them as the value of the misc attribute.
625941e350812a4eaa59c70e
def get_labels(self): <NEW_LINE> <INDENT> return ["sarcastic", "literal"]
See base class.
625941e35fdd1c0f98dc0626
def send_ding_msg(self, id, msg): <NEW_LINE> <INDENT> if self.check_msg_send(id): <NEW_LINE> <INDENT> result = requests.post(config.APP_CONFIG['dingding_send_url'], data=msg.encode( 'utf-8'), headers=self._ding_headers) <NEW_LINE> if config.APP_CONFIG['is_print_detail']: <NEW_LINE> <INDENT> self._logger.info('send ding...
发送微信消息 :param id: 消息标识 :param msg: 消息内容 :return:
625941e373bcbd0ca4b2c466
def _order(self): <NEW_LINE> <INDENT> gens = self.gens() <NEW_LINE> if not gens or len(gens) < 2: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> for g in gens: <NEW_LINE> <INDENT> if g.order() != 2: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if len(g.cycle_tuples()) != 1: <NEW_LINE> <INDENT> return None <...
This handles a few special cases of computing the subgroup order much faster than GAP. This currently operates very quickly for stabilizer subgroups of permutation groups, for one. Will return None if the we could not easily compute it. Author: Christopher Swenson EXAMPLES:: sage: G = SymmetricGroup(10).subgro...
625941e31b99ca400220aea3
def autoDetectXMLEncoding(buffer): <NEW_LINE> <INDENT> encoding = "utf_8" <NEW_LINE> bytes = (byte1, byte2, byte3, byte4) = tuple(map(ord, buffer[0:4])) <NEW_LINE> enc_info = autodetect_dict.get(bytes, None) <NEW_LINE> if not enc_info: <NEW_LINE> <INDENT> bytes = (byte1, byte2, None, None) <NEW_LINE> enc_info = autodet...
buffer -> encoding_name The buffer should be at least 4 bytes long. Returns None if encoding cannot be detected. Note that encoding_name might not have an installed decoder (e.g. EBCDIC)
625941e3be7bc26dc91cd9e9
def onAttachConfirmed(self, userID): <NEW_LINE> <INDENT> self.userID = userID <NEW_LINE> if self.observer: <NEW_LINE> <INDENT> self.observer.onAttachConfirmed(self)
Called when a user was attached :param userID: the user ID assigned to this user
625941e34f88993c3716c454
def tabulate( headers: List[str], rows: List[Dict[str, str]], header_labels: Optional[Dict[str, str]] = None, ) -> str: <NEW_LINE> <INDENT> col_widths = {} <NEW_LINE> def label(name) -> str: <NEW_LINE> <INDENT> label = (header_labels or {}).get(name, "") <NEW_LINE> if label: <NEW_LINE> <INDENT> return label <NEW_LINE> ...
Tabulate some data so that it renders reasonably. rows - is a list of data that is to be rendered headers - is a list of the dictionary keys of the row data to be rendered and specifies the order of the fields. header_labels - an optional mapping from dictionary key to a more human friendly la...
625941e31d351010ab855f0c
def shn_hms_hospital_search_simple(r, **attr): <NEW_LINE> <INDENT> resource = r.resource <NEW_LINE> table = resource.table <NEW_LINE> r.id = None <NEW_LINE> if not shn_has_permission("read", table): <NEW_LINE> <INDENT> r.unauthorised() <NEW_LINE> <DEDENT> if r.representation == "html": <NEW_LINE> <INDENT> next = r.requ...
Simple search form for hospitals
625941e310dbd63aa1bd2f93
def _predictTransition(self, fs, filterReduce): <NEW_LINE> <INDENT> prediction = {} <NEW_LINE> for trans in self.transitions: <NEW_LINE> <INDENT> if (filterReduce and trans == "REDUCE"): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> prediction[trans] = self._computeTransitionValue(fs, trans...
Predict next transition based on the features of current configuration (fs)
625941e3004d5f362079a722
def __init__(self, service: ServiceInterface) -> None: <NEW_LINE> <INDENT> self._service = service
Use constructor injection.
625941e3d58c6744b425804f
def int_to_bin(x,d): <NEW_LINE> <INDENT> return ('{0:0'+str(d)+'b}').format(x)
Convert an integer x to d bits
625941e363f4b57ef00014ff
def sig2noise_val(u, v, s2n, w=None, threshold=1.05): <NEW_LINE> <INDENT> ind = s2n < threshold <NEW_LINE> u[ind] = np.nan <NEW_LINE> v[ind] = np.nan <NEW_LINE> mask = np.zeros_like(u, dtype=bool) <NEW_LINE> mask[ind] = True <NEW_LINE> if isinstance(w, np.ndarray): <NEW_LINE> <INDENT> w[ind] = np.nan <NEW_LINE> return ...
Eliminate spurious vectors from cross-correlation signal to noise ratio. Replace spurious vectors with zero if signal to noise ratio is below a specified threshold. Parameters ---------- u : 2d or 3d np.ndarray a two or three dimensional array containing the u velocity component. v : 2d or 3d np.ndarray a tw...
625941e3de87d2750b860187
def del_property(self): <NEW_LINE> <INDENT> if cls is None: <NEW_LINE> <INDENT> xpath = '%s:%s' % (ns, name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> xpath = '%s:%s' % (ns, cls.__name__) <NEW_LINE> <DEDENT> xpath = self._node.xpath(xpath, namespaces=SLDNode._nsmap) <NEW_LINE> if len(xpath) == 1: <NEW_LINE> <INDENT...
A generic property deleter.
625941e3b830903b967e9cf8
def patch_hl7v2_message( service_account_json, api_key, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id, label_key, label_value): <NEW_LINE> <INDENT> client = get_client(service_account_json, api_key) <NEW_LINE> hl7v2_message_parent = 'projects/{}/locations/{}'.format( project_id, cloud_region, d...
Updates the message.
625941e3f548e778e58cd970
def draw(self): <NEW_LINE> <INDENT> progn = 'PROGN' <NEW_LINE> expr = [] <NEW_LINE> for num, branch in enumerate(self.trees[:-1]): <NEW_LINE> <INDENT> expr = expr + ['F%s' % num] + branch <NEW_LINE> <DEDENT> expr += ['RPB'] + self.trees[-1] <NEW_LINE> nodes = list(range(len(expr))) <NEW_LINE> edges = list() <NEW_LINE> ...
Draws a node tree of an adf individual
625941e330c21e258bdfa892
def residualVariance(self, weighted=False): <NEW_LINE> <INDENT> if weighted: <NEW_LINE> <INDENT> if self._weightedResidualVariance is not None: <NEW_LINE> <INDENT> return self._weightedResidualVariance <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._weightedResidualVariance = self.sumSqResiduals(weighted=True) ...
Estimates the variance of the residuals of the time series. As normalization the degrees of freedom is used @param weighted: If false the unweighted residuals are used, if True, the weighted ones are used. @type weighted: boolean @return: the variance of the residuals @rtype: double
625941e3a17c0f6771cbe440
def second_derivative(self): <NEW_LINE> <INDENT> return 2.0*self.ABC_tmp[0]
givin a previous fit, return the second derivative
625941e38a349b6b435e8564
def check_subtree(node_1, node_2): <NEW_LINE> <INDENT> if not node_1: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if node_1.value == node_2.value: <NEW_LINE> <INDENT> if compare_traversal(node_1, node_2): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> if check_subtree(node_1.left, node_2): <NEW_L...
Function to check if a tree is subtree of another. Parameters ---------- node_1: ``Node`` Node of the larger tree. node_1: ``Node`` Node of the potential sub-tree. Returns ------- True if sub-tree. False otherwise. Time Complexity: --------------- O(N), where N is the number of nodes in `node_1` tree. Space ...
625941e3aad79263cf390e38
def _moebius_z(self, *args): <NEW_LINE> <INDENT> return smithhelper.moebius_z(convert_args(*args), self._scale)
Basic transformation. Arguments: *z*: Complex number or numpy.ndarray with dtype=complex *x, y*: Float numbers or numpy.ndarray's with dtype not complex Returns: *w*: Performs w = (z - k) / (z + k) with k = 'axes.scale' Type: Complex number or numpy.ndarray wi...
625941e360cbc95b062c6935
def get_prediction_for_cor(model_predict, actual_prediction, prob_true_positive, prob_true_negative): <NEW_LINE> <INDENT> res = [empirical_new_result(actual_prediction[i], model_predict[i] == 1, prob_true_positive, prob_true_negative) for i in range(len(actual_prediction))] <NEW_LINE> return res
" For a prediction from the correct_model return the resulting prediction
625941e3566aa707497f4954
def generate(site): <NEW_LINE> <INDENT> fp = plugins.open_html(plugins.urllist, site) <NEW_LINE> fp.write( ' <p class="description">\n' ' This is the list of all urls encountered during the examination of\n' ' the website. It lists internal as well as external and\n' ' non-examined urls.\n' ' </p>\n' ' <...
Output a sorted list of urls to the specified file descriptor.
625941e3f548e778e58cd971
def importFile(self, filename): <NEW_LINE> <INDENT> bvh = BVHReader(filename) <NEW_LINE> bvh.read()
Import a BVH file.
625941e3a219f33f34628d55
def minrange(start_date, end_date): <NEW_LINE> <INDENT> tr = end_date - start_date <NEW_LINE> for n in range(tr.seconds / 60): <NEW_LINE> <INDENT> yield start_date + timedelta(seconds = (n*60))
Check one min at a time
625941e323e79379d52ee950
def ternary_quadratic_form(self, include_basis=False): <NEW_LINE> <INDENT> if self.base_ring() != ZZ: <NEW_LINE> <INDENT> raise NotImplementedError("ternary quadratic form of order only implemented for quaternion algebras over QQ") <NEW_LINE> <DEDENT> Q = self.quaternion_algebra() <NEW_LINE> twoR = self.free_module().s...
Return the ternary quadratic form associated to this order. INPUT: - ``include_basis`` -- bool (default: False), if True also return a basis for the dimension 3 subspace `G` OUTPUT: - QuadraticForm - optional basis for dimension 3 subspace This function computes the positive definition quadratic form obtained b...
625941e34c3428357757c717
def test_diff_exit_stag_pressure(): <NEW_LINE> <INDENT> exit_stag_pres = diff.exit_stagnation_pressure(gamma, inlet_static_pressure, mach_number) <NEW_LINE> assert isclose(6089300.0, exit_stag_pres, rel_tol=1.0e-2)
Test the exit_stagnation_pressure() function for the Diffuser class
625941e3498bea3a759b9e9f
def is3D(self): <NEW_LINE> <INDENT> return _ilwisobjects.Envelope_is3D(self)
is3D(Envelope self) -> bool
625941e3e64d504609d74c31
def method_missing(self, attr, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError( "Missing method '{s}' called.".format(s=attr))
Stub: override this function
625941e3656771135c3ebc65
def write_dummy_outcar(name,E): <NEW_LINE> <INDENT> with open(name,'w') as wf: <NEW_LINE> <INDENT> wf.write(' energy without entropy= energy(sigma->0) = '+str(E)+'\n')
Construct a dummy OUTCAR for images 0 and n Args: name (string): name of file to write E (float): energy to write out in dummy OUTCAR
625941e3cad5886f8bd273ca
def project(self, ncomp=None, transform=True, unweight=True): <NEW_LINE> <INDENT> ncomp = self._ncomp if ncomp is None else ncomp <NEW_LINE> if ncomp > self._ncomp: <NEW_LINE> <INDENT> raise ValueError('ncomp must be smaller than the number of ' 'components computed.') <NEW_LINE> <DEDENT> factors = np.asarray(self.fact...
Project series onto a specific number of factors Parameters ---------- ncomp : int, optional Number of components to use. If omitted, all components initially computed are used. Returns ------- projection : array nobs by nvar array of the projection onto ncomp factors transform : bool Flag indicating...
625941e3097d151d1a223249
def insert(self, a): <NEW_LINE> <INDENT> if a.id != None: <NEW_LINE> <INDENT> a.id = None <NEW_LINE> <DEDENT> for c in a.clients: <NEW_LINE> <INDENT> self.insert_address_to_client(c,a) <NEW_LINE> <DEDENT> self.session.add(a) <NEW_LINE> self.session.commit()
Method to add new address into DB, if client.id has to be None or it will change it to generate a new id by the ORM
625941e397e22403b379d38d
def get_vcs_root(path): <NEW_LINE> <INDENT> previous_path = path <NEW_LINE> while get_vcs_info(path) is None: <NEW_LINE> <INDENT> path = abspardir(path) <NEW_LINE> if path == previous_path: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> previous_path = path <NEW_LINE> <DEDENT> <DEDENT> return ...
Return VCS root directory path Return None if path is not within a supported VCS repository
625941e356b00c62f0f14a4d
def findLength(self, A, B): <NEW_LINE> <INDENT> dp = [[0 for _ in range(len(B))] for _ in range(len(A))] <NEW_LINE> for idx in range(len(A)): <NEW_LINE> <INDENT> for jdx in range(len(B)): <NEW_LINE> <INDENT> if idx < 1 or jdx < 1: <NEW_LINE> <INDENT> if A[idx] == B[jdx]: <NEW_LINE> <INDENT> dp[idx][jdx] = 1 <NEW_LINE> ...
:type A: List[int] :type B: List[int] :rtype: int
625941e3d18da76e235328cc
def _get_indexData(self): <NEW_LINE> <INDENT> return self.__indexData
Getter method for indexData, mapped from YANG variable /perfdata/indexData (list) YANG Description: List of indexes associated with this data point.
625941e3e1aae11d1e74a0ad
@make_function(COMPARISON, ">=") <NEW_LINE> def _ge(env: Environment, x: am.Amalgam, y: am.Amalgam) -> am.Atom: <NEW_LINE> <INDENT> if x >= y: <NEW_LINE> <INDENT> return am.Atom("TRUE") <NEW_LINE> <DEDENT> return am.Atom("FALSE")
Performs a `greater than or equal` comparison.
625941e3ec188e330fd5ab89
def pop(self): <NEW_LINE> <INDENT> res = self._heap[1] <NEW_LINE> self._swap(1, len(self)) <NEW_LINE> value = self[res] <NEW_LINE> del self[res] <NEW_LINE> self._sink(1) <NEW_LINE> return (res, value)
Returns and removes the heap's smallest element
625941e3b545ff76a8914207
def create_deck(self, new_deck): <NEW_LINE> <INDENT> logger.debug('head.create_deck called') <NEW_LINE> logger.debug('newDeck: {}'.format(new_deck)) <NEW_LINE> nameArray = [] <NEW_LINE> for containerName in new_deck : <NEW_LINE> <INDENT> nameArray.append(containerName) <NEW_LINE> <DEDENT> response = {} <NEW_LINE> for n...
Create a dictionary of new container names to be stored in each pipette given a deck list Calls :meth:`head.save_pipette_values` right before returning dictionary :returns: container data for each axis :rtype: dictionary
625941e39b70327d1c4e11c8
def option1(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> file_name = input('Please enter CSV file name (with the .csv): ') <NEW_LINE> data = [] <NEW_LINE> with open(f'{file_name}','r') as dta: <NEW_LINE> <INDENT> dta.readline() <NEW_LINE> for line in dta: <NEW_LINE> <INDENT> data.append(line.strip().split(',')) <NEW...
This function is used to read the csv file inputed by the user
625941e3a8ecb033257d34bd
def remove_line(self, line_number): <NEW_LINE> <INDENT> self.lines.pop(line_number-1)
Simple method to remove a line. First line would be 1.
625941e3167d2b6e31218f86
def getStrategicObjectives(self, skip_states=['created']): <NEW_LINE> <INDENT> if self.is_dashboard() and self.sel_type == 'strategicobjective': <NEW_LINE> <INDENT> return self.objs <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pcat = self.real_context.portal_catalog <NEW_LINE> brains = pcat(portal_type='strategicobjec...
get a list of contained strategic objectives
625941e3cdde0d52a9e53427
def __init__(self, regulizer = None, beta = 0.5, batchsize = 128, epoch = 10): <NEW_LINE> <INDENT> self.__batchsize = 128 <NEW_LINE> self.__regulizer = regulizer <NEW_LINE> self.__epoch = epoch <NEW_LINE> if regulizer: <NEW_LINE> <INDENT> self.__beta = beta <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__beta = 0 ...
:param regulizer: None(Default), 'l1' or 'l2' :param beta: rate of regularization :param batchsize: batch size :param epoch: number of epoch to train :return:
625941e3090684286d50f0dc
def position_move(self, position_x, position_y): <NEW_LINE> <INDENT> position_x_integer = int(position_x * CONVERSION_RATIO) <NEW_LINE> position_y_integer = int(position_y * CONVERSION_RATIO) <NEW_LINE> position_x_bytes = super()._int32_to_bytes(position_x_integer) <NEW_LINE> position_y_bytes = super()._int32_to_bytes(...
Sets the desired position move vector for the robot. Inputs: speed_x -- The x displacement as a float in meters. speed_y -- The y displacement as a float in meters. Note: position move and position rotate are mutually exclusive in the robot. Note: THIS IS RELATIVE TO THE ROBOT'S POSITION WHEN IT RECEIV...
625941e3e8904600ed9f2324
def reset_counts(self): <NEW_LINE> <INDENT> self.n_comments = 0 <NEW_LINE> self.n_noisy_comments = 0 <NEW_LINE> self.n_strings = 0 <NEW_LINE> self.n_noisy_strings = 0 <NEW_LINE> self.n_dic_selected = 0 <NEW_LINE> self.n_bpe_selected = 0
Reset counts of strings/comments processed
625941e307f4c71912b11876
def test_log_update_multiple_fields(self): <NEW_LINE> <INDENT> log_count_init = LoggerHistory.objects.count() <NEW_LINE> original_name = self.category.name <NEW_LINE> original_status = self.category.status <NEW_LINE> self.category.name = '%s UPDATED' % self.category.name <NEW_LINE> self.category.status = 'inactive' <NE...
Test when multiple model fields changes.
625941e3eab8aa0e5d26df4c
def do_organizations_list(self): <NEW_LINE> <INDENT> response = [] <NEW_LINE> if self.headers.get("Authorization") == "Bearer valid-token": <NEW_LINE> <INDENT> response.append( { "login": "hvac", "id": 1, } ) <NEW_LINE> self.wfile.write(json.dumps(response).encode())
Return the bare minimum Okta organization data needed for Vault's Okta auth method. Only returns data if the request Authorization header has a contrived Okta token value of "valid-token".
625941e34428ac0f6e5babe7
def _render(self, player_index, choice_index=None): <NEW_LINE> <INDENT> return '{0}. {1}'.format( choice_index, _translate_text(self.text, player_index))
Render the data. @param <player_index>: A player index. @param <choice_index>: The number should be required to select this item. It depends on the menu type if this parameter gets passed.
625941e37c178a314d6ef857